From 0d30461ebc8fd97c122f30a92151cb139a013bb6 Mon Sep 17 00:00:00 2001 From: Norbert Renner Date: Fri, 5 Aug 2016 12:32:29 +0200 Subject: [PATCH] refactoring: extract scale & locate controls to Map.js --- js/Map.js | 9 ++++++++- js/index.js | 7 ------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/js/Map.js b/js/Map.js index 5243f80..ad4afc9 100644 --- a/js/Map.js +++ b/js/Map.js @@ -113,10 +113,17 @@ BR.Map = { layersControl = L.control.layers(baseLayers, overlays).addTo(map); + L.control.locate({ + icon: 'glyphicon glyphicon-screenshot', + iconLoading: 'glyphicon glyphicon-refresh', + }).addTo(map); + + L.control.scale().addTo(map); + // expose map instance for console debugging BR.debug = BR.debug || {}; BR.debug.map = map; - + return { map: map, layersControl: layersControl diff --git a/js/index.js b/js/index.js index 61569fd..d9ea868 100644 --- a/js/index.js +++ b/js/index.js @@ -32,11 +32,6 @@ // left sidebar as additional control position map._controlCorners[leftPaneId] = L.DomUtil.create('div', 'leaflet-' + leftPaneId, map._controlContainer); - L.control.locate({ - icon: 'glyphicon glyphicon-screenshot', - iconLoading: 'glyphicon glyphicon-refresh', - }).addTo(map); - document.getElementById('about_link').onclick = function() { bootbox.alert({ title: 'About', @@ -276,8 +271,6 @@ routing: routing, profile: profile }).addTo(map); - - L.control.scale().addTo(map); } mapContext = BR.Map.initMap();