X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/fe6e837cfe77e1414998c0216defe7912e34bf75..5e420d9e50af1caca380c2ad22932f9d5ca26821:/app/assets/javascripts/index/export.js diff --git a/app/assets/javascripts/index/export.js b/app/assets/javascripts/index/export.js index e1b079607..31a981ec9 100644 --- a/app/assets/javascripts/index/export.js +++ b/app/assets/javascripts/index/export.js @@ -15,10 +15,11 @@ $(document).ready(function () { var locationFilter = new L.LocationFilter({ enableButton: false, - adjustButton: false, - onChange: filterChanged + adjustButton: false }).addTo(map); + locationFilter.on("change", filterChanged); + map.on("moveend", mapMoved); map.on("baselayerchange", htmlUrlChanged); @@ -37,7 +38,7 @@ $(document).ready(function () { openSidebar(); - if (map.hasLayer(layers[0].layer)) { + if (getMapBaseLayer().keyid == "mapnik") { $("#format_mapnik").prop("checked", true); } @@ -54,6 +55,7 @@ $(document).ready(function () { map.off("moveend", mapMoved); map.off("baselayerchange", htmlUrlChanged); + locationFilter.off("change", filterChanged); }); function getBounds() { @@ -81,15 +83,18 @@ $(document).ready(function () { var bounds = getBounds(); map.fitBounds(bounds); - - enableFilter(); locationFilter.setBounds(bounds); + enableFilter(); validateControls(); mapnikSizeChanged(); } function enableFilter() { + if (!locationFilter.getBounds().isValid()) { + locationFilter.setBounds(map.getBounds().pad(-0.2)); + } + $("#drag_box").hide(); locationFilter.enable(); }