Minimap: Fix bug where map whould be centered on 0,0 on startup
I'm not sure, but my best guess is that the minimap is loaded before the inital position, causing some kind of move loop between main map and mini map.
This commit is contained in:
parent
b4fe2a4c0b
commit
49ed868626
@ -41,6 +41,7 @@ window.plugin.miniMap.setup = function() {
|
|||||||
var mqMapOpt = {attribution: osmAttribution+', Tiles Courtesy of MapQuest', maxZoom: 18, subdomains: mqSubdomains};
|
var mqMapOpt = {attribution: osmAttribution+', Tiles Courtesy of MapQuest', maxZoom: 18, subdomains: mqSubdomains};
|
||||||
var mqMap = new L.TileLayer(mqTileUrlPrefix+'/tiles/1.0.0/map/{z}/{x}/{y}.jpg',mqMapOpt);
|
var mqMap = new L.TileLayer(mqTileUrlPrefix+'/tiles/1.0.0/map/{z}/{x}/{y}.jpg',mqMapOpt);
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
if(!isSmartphone()) {
|
if(!isSmartphone()) {
|
||||||
// desktop mode - bottom-left, so it doesn't clash with the sidebar
|
// desktop mode - bottom-left, so it doesn't clash with the sidebar
|
||||||
new L.Control.MiniMap(mqMap, {toggleDisplay: true, position: 'bottomleft'}).addTo(window.map);
|
new L.Control.MiniMap(mqMap, {toggleDisplay: true, position: 'bottomleft'}).addTo(window.map);
|
||||||
@ -48,10 +49,9 @@ window.plugin.miniMap.setup = function() {
|
|||||||
// mobile mode - bottom-right - so it floats above the map copyright text
|
// mobile mode - bottom-right - so it floats above the map copyright text
|
||||||
new L.Control.MiniMap(mqMap, {toggleDisplay: true, position: 'bottomright'}).addTo(window.map);
|
new L.Control.MiniMap(mqMap, {toggleDisplay: true, position: 'bottomright'}).addTo(window.map);
|
||||||
}
|
}
|
||||||
|
}, 0);
|
||||||
|
|
||||||
$('head').append('<style>@@INCLUDESTRING:external/Control.MiniMap.css@@</style>');
|
$('head').append('<style>@@INCLUDESTRING:external/Control.MiniMap.css@@</style>');
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var setup = window.plugin.miniMap.setup;
|
var setup = window.plugin.miniMap.setup;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user