From 6394f680e8cc109ee5a925df235a6f5e82cf6798 Mon Sep 17 00:00:00 2001 From: Norbert Renner Date: Fri, 24 Jul 2015 18:52:16 +0200 Subject: [PATCH] use maxNativeZoom to (over-) scale tiles to common max zoom (avoids gray screen when switching) --- js/index.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/js/index.js b/js/index.js index 9a16d4b..4feea16 100644 --- a/js/index.js +++ b/js/index.js @@ -13,20 +13,23 @@ L.Icon.Default.imagePath = 'dist/images'; var osmAttribution = '© OpenStreetMap contributors'; + var maxZoom = 19; var osm = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { - maxZoom: 19, + maxZoom: maxZoom, attribution: 'tiles ' + osmAttribution }); var osmde = L.tileLayer('http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png', { - maxZoom: 18, + maxNativeZoom: 18, + maxZoom: maxZoom, attribution: 'tiles by openstreetmap.de ' + osmAttribution }); var topo = L.tileLayer('http://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', { minZoom: 5, - maxZoom: 15, + maxNativeZoom: 15, + maxZoom: maxZoom, attribution: 'tiles © OpenTopoMap, CC-BY-SA' + ', SRTM' }); @@ -34,22 +37,26 @@ var thunderforestAttribution = 'tiles © Thunderforest ' + '(CC-BY-SA 2.0)'; var cycle = L.tileLayer('http://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png', { - maxZoom: 18, + maxNativeZoom: 18, + maxZoom: maxZoom, attribution: thunderforestAttribution }); var outdoors = L.tileLayer('http://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png', { - maxZoom: 18, + maxNativeZoom: 18, + maxZoom: maxZoom, attribution: thunderforestAttribution }); var cycling = L.tileLayer('http://tile.waymarkedtrails.org/cycling/{z}/{x}/{y}.png', { - maxZoom: 18, + maxNativeZoom: 18, + maxZoom: maxZoom, opacity: 0.7, attribution: 'Cycling © Waymarked Trails ' + '(CC-BY-SA 3.0 DE)' }); var hiking = L.tileLayer('http://tile.waymarkedtrails.org/hiking/{z}/{x}/{y}.png', { - maxZoom: 18, + maxNativeZoom: 18, + maxZoom: maxZoom, opacity: 0.7, attribution: 'Hiking © Waymarked Trails ' + '(CC-BY-SA 3.0 DE)'