From 49ed8686267dac2bf2814c482024dee677d8af91 Mon Sep 17 00:00:00 2001 From: fkloft Date: Wed, 4 Dec 2013 19:13:33 +0100 Subject: [PATCH 1/2] 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. --- plugins/minimap.user.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/minimap.user.js b/plugins/minimap.user.js index d8c49cda..23a1ea8a 100644 --- a/plugins/minimap.user.js +++ b/plugins/minimap.user.js @@ -41,17 +41,17 @@ window.plugin.miniMap.setup = function() { 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); - if(!isSmartphone()) { - // desktop mode - bottom-left, so it doesn't clash with the sidebar - new L.Control.MiniMap(mqMap, {toggleDisplay: true, position: 'bottomleft'}).addTo(window.map); - } else { - // mobile mode - bottom-right - so it floats above the map copyright text - new L.Control.MiniMap(mqMap, {toggleDisplay: true, position: 'bottomright'}).addTo(window.map); - } + setTimeout(function() { + if(!isSmartphone()) { + // desktop mode - bottom-left, so it doesn't clash with the sidebar + new L.Control.MiniMap(mqMap, {toggleDisplay: true, position: 'bottomleft'}).addTo(window.map); + } else { + // mobile mode - bottom-right - so it floats above the map copyright text + new L.Control.MiniMap(mqMap, {toggleDisplay: true, position: 'bottomright'}).addTo(window.map); + } + }, 0); $('head').append(''); - - }; var setup = window.plugin.miniMap.setup; From c537811e9b996bdcda80510d4e04e17fd3654796 Mon Sep 17 00:00:00 2001 From: fkloft Date: Wed, 4 Dec 2013 19:58:15 +0100 Subject: [PATCH 2/2] Remove zoom slider from minimap --- plugins/zoom-slider.user.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/zoom-slider.user.js b/plugins/zoom-slider.user.js index d54e4be0..0b5a96a9 100644 --- a/plugins/zoom-slider.user.js +++ b/plugins/zoom-slider.user.js @@ -27,6 +27,11 @@ window.plugin.zoomSlider.setup = function() { @@INCLUDERAW:external/L.Control.Zoomslider.js@@ try { console.log('done loading Leaflet.zoomslider JS'); } catch(e) {} + // prevent Zoomslider from being activated by default (e.g. in minimap) + L.Map.mergeOptions({ + zoomsliderControl: false + }); + if(map.zoomControl._map) { window.map.removeControl(map.zoomControl); } @@ -35,7 +40,7 @@ window.plugin.zoomSlider.setup = function() { $('head').append(''); }; -var setup = window.plugin.zoomSlider.setup; +var setup = window.plugin.zoomSlider.setup; // PLUGIN END //////////////////////////////////////////////////////////