use maxNativeZoom to (over-) scale tiles to common max zoom
(avoids gray screen when switching)
This commit is contained in:
parent
6a77c826e4
commit
6394f680e8
1 changed files with 14 additions and 7 deletions
21
js/index.js
21
js/index.js
|
|
@ -13,20 +13,23 @@
|
||||||
L.Icon.Default.imagePath = 'dist/images';
|
L.Icon.Default.imagePath = 'dist/images';
|
||||||
|
|
||||||
var osmAttribution = '© <a target="_blank" href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
|
var osmAttribution = '© <a target="_blank" href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
|
||||||
|
var maxZoom = 19;
|
||||||
|
|
||||||
var osm = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
var osm = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
maxZoom: 19,
|
maxZoom: maxZoom,
|
||||||
attribution: 'tiles ' + osmAttribution
|
attribution: 'tiles ' + osmAttribution
|
||||||
});
|
});
|
||||||
|
|
||||||
var osmde = L.tileLayer('http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png', {
|
var osmde = L.tileLayer('http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png', {
|
||||||
maxZoom: 18,
|
maxNativeZoom: 18,
|
||||||
|
maxZoom: maxZoom,
|
||||||
attribution: 'tiles by <a target="_blank" href="http://openstreetmap.de/karte.html">openstreetmap.de</a> ' + osmAttribution
|
attribution: 'tiles by <a target="_blank" href="http://openstreetmap.de/karte.html">openstreetmap.de</a> ' + osmAttribution
|
||||||
});
|
});
|
||||||
|
|
||||||
var topo = L.tileLayer('http://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
|
var topo = L.tileLayer('http://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
|
||||||
minZoom: 5,
|
minZoom: 5,
|
||||||
maxZoom: 15,
|
maxNativeZoom: 15,
|
||||||
|
maxZoom: maxZoom,
|
||||||
attribution: 'tiles © <a target="_blank" href="https://opentopomap.org">OpenTopoMap</a>, <a target="_blank" href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>'
|
attribution: 'tiles © <a target="_blank" href="https://opentopomap.org">OpenTopoMap</a>, <a target="_blank" href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>'
|
||||||
+ ', <a target="_blank" href="http://viewfinderpanoramas.org">SRTM</a>'
|
+ ', <a target="_blank" href="http://viewfinderpanoramas.org">SRTM</a>'
|
||||||
});
|
});
|
||||||
|
|
@ -34,22 +37,26 @@
|
||||||
var thunderforestAttribution = 'tiles © <a target="_blank" href="http://www.thunderforest.com">Thunderforest</a> '
|
var thunderforestAttribution = 'tiles © <a target="_blank" href="http://www.thunderforest.com">Thunderforest</a> '
|
||||||
+ '(<a target="_blank" href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA 2.0</a>)';
|
+ '(<a target="_blank" href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA 2.0</a>)';
|
||||||
var cycle = L.tileLayer('http://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png', {
|
var cycle = L.tileLayer('http://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png', {
|
||||||
maxZoom: 18,
|
maxNativeZoom: 18,
|
||||||
|
maxZoom: maxZoom,
|
||||||
attribution: thunderforestAttribution
|
attribution: thunderforestAttribution
|
||||||
});
|
});
|
||||||
var outdoors = L.tileLayer('http://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png', {
|
var outdoors = L.tileLayer('http://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png', {
|
||||||
maxZoom: 18,
|
maxNativeZoom: 18,
|
||||||
|
maxZoom: maxZoom,
|
||||||
attribution: thunderforestAttribution
|
attribution: thunderforestAttribution
|
||||||
});
|
});
|
||||||
|
|
||||||
var cycling = L.tileLayer('http://tile.waymarkedtrails.org/cycling/{z}/{x}/{y}.png', {
|
var cycling = L.tileLayer('http://tile.waymarkedtrails.org/cycling/{z}/{x}/{y}.png', {
|
||||||
maxZoom: 18,
|
maxNativeZoom: 18,
|
||||||
|
maxZoom: maxZoom,
|
||||||
opacity: 0.7,
|
opacity: 0.7,
|
||||||
attribution: 'Cycling © <a target="_blank" href="http://cycling.waymarkedtrails.org">Waymarked Trails</a> '
|
attribution: 'Cycling © <a target="_blank" href="http://cycling.waymarkedtrails.org">Waymarked Trails</a> '
|
||||||
+ '(<a target="_blank" href="http://creativecommons.org/licenses/by-sa/3.0/de/deed.en">CC-BY-SA 3.0 DE</a>)'
|
+ '(<a target="_blank" href="http://creativecommons.org/licenses/by-sa/3.0/de/deed.en">CC-BY-SA 3.0 DE</a>)'
|
||||||
});
|
});
|
||||||
var hiking = L.tileLayer('http://tile.waymarkedtrails.org/hiking/{z}/{x}/{y}.png', {
|
var hiking = L.tileLayer('http://tile.waymarkedtrails.org/hiking/{z}/{x}/{y}.png', {
|
||||||
maxZoom: 18,
|
maxNativeZoom: 18,
|
||||||
|
maxZoom: maxZoom,
|
||||||
opacity: 0.7,
|
opacity: 0.7,
|
||||||
attribution: 'Hiking © <a target="_blank" href="http://hiking.waymarkedtrails.org">Waymarked Trails</a> '
|
attribution: 'Hiking © <a target="_blank" href="http://hiking.waymarkedtrails.org">Waymarked Trails</a> '
|
||||||
+ '(<a target="_blank" href="http://creativecommons.org/licenses/by-sa/3.0/de/deed.en">CC-BY-SA 3.0 DE</a>)'
|
+ '(<a target="_blank" href="http://creativecommons.org/licenses/by-sa/3.0/de/deed.en">CC-BY-SA 3.0 DE</a>)'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue