X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/5aea67a71f677c0845941ee0db72d756648fc026..1feda20644f05d83bdda22292e757ef1c14bd35f:/app/assets/javascripts/map.js.erb?ds=inline diff --git a/app/assets/javascripts/map.js.erb b/app/assets/javascripts/map.js.erb index 2354593ff..80e77f26c 100644 --- a/app/assets/javascripts/map.js.erb +++ b/app/assets/javascripts/map.js.erb @@ -17,7 +17,7 @@ var layers; var objectLayer; var objectLoader; -function createMap(divName, options) { +function createMap(divName, options, moreOptions) { if (!layers) { layers = [ { @@ -51,6 +51,8 @@ function createMap(divName, options) { ]; } + moreOptions = moreOptions || {}; + options = $.extend({zoomControl: true, panZoomControl: true, layerControl: true}, options); map = L.map(divName, $.extend({}, options, {panControl: false, zoomsliderControl: false, maxZoom: 18})); @@ -67,6 +69,13 @@ function createMap(divName, options) { map.layersControl = layersControl; } + if (moreOptions.locateControl) { + var loc = L.control.locate({ + position: 'topright' + }); + loc.addTo(map); + } + for (var i = 0; i < layers.length; i++) { layers[i].layer = new (layers[i].klass)(layers[i]); layersControl.addBaseLayer(layers[i].layer, layers[i].name);