Merge pull request #683 from fkloft/controls

Fix Leaflet controls
This commit is contained in:
Jon Atkins 2013-12-04 16:21:42 -08:00
commit f2e597370e
2 changed files with 15 additions and 10 deletions

View File

@ -41,17 +41,17 @@ 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);
if(!isSmartphone()) { setTimeout(function() {
// desktop mode - bottom-left, so it doesn't clash with the sidebar if(!isSmartphone()) {
new L.Control.MiniMap(mqMap, {toggleDisplay: true, position: 'bottomleft'}).addTo(window.map); // desktop mode - bottom-left, so it doesn't clash with the sidebar
} else { new L.Control.MiniMap(mqMap, {toggleDisplay: true, position: 'bottomleft'}).addTo(window.map);
// mobile mode - bottom-right - so it floats above the map copyright text } else {
new L.Control.MiniMap(mqMap, {toggleDisplay: true, position: 'bottomright'}).addTo(window.map); // 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('<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;

View File

@ -27,6 +27,11 @@ window.plugin.zoomSlider.setup = function() {
@@INCLUDERAW:external/L.Control.Zoomslider.js@@ @@INCLUDERAW:external/L.Control.Zoomslider.js@@
try { console.log('done loading Leaflet.zoomslider JS'); } catch(e) {} 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) { if(map.zoomControl._map) {
window.map.removeControl(map.zoomControl); window.map.removeControl(map.zoomControl);
} }
@ -35,7 +40,7 @@ window.plugin.zoomSlider.setup = function() {
$('head').append('<style>@@INCLUDESTRING:external/L.Control.Zoomslider.css@@</style>'); $('head').append('<style>@@INCLUDESTRING:external/L.Control.Zoomslider.css@@</style>');
}; };
var setup = window.plugin.zoomSlider.setup; var setup = window.plugin.zoomSlider.setup;
// PLUGIN END ////////////////////////////////////////////////////////// // PLUGIN END //////////////////////////////////////////////////////////