]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/export.js
Merge branch 'master' into notes
[rails.git] / app / assets / javascripts / index / export.js
index 04c6b6ff7236868037ae0a22738ec9e1ca2c1786..31a981ec9a15b34ff87d183e9b3f91b58b6ce676 100644 (file)
@@ -15,7 +15,7 @@ $(document).ready(function () {
 
     var locationFilter = new L.LocationFilter({
       enableButton: false,
 
     var locationFilter = new L.LocationFilter({
       enableButton: false,
-      adjustButton: false,
+      adjustButton: false
     }).addTo(map);
 
     locationFilter.on("change", filterChanged);
     }).addTo(map);
 
     locationFilter.on("change", filterChanged);
@@ -38,7 +38,7 @@ $(document).ready(function () {
 
     openSidebar();
 
 
     openSidebar();
 
-    if (map.hasLayer(layers[0].layer)) {
+    if (getMapBaseLayer().keyid == "mapnik") {
       $("#format_mapnik").prop("checked", true);
     }
 
       $("#format_mapnik").prop("checked", true);
     }
 
@@ -83,15 +83,18 @@ $(document).ready(function () {
       var bounds = getBounds();
 
       map.fitBounds(bounds);
       var bounds = getBounds();
 
       map.fitBounds(bounds);
-
-      enableFilter();
       locationFilter.setBounds(bounds);
 
       locationFilter.setBounds(bounds);
 
+      enableFilter();
       validateControls();
       mapnikSizeChanged();
     }
 
     function enableFilter() {
       validateControls();
       mapnikSizeChanged();
     }
 
     function enableFilter() {
+      if (!locationFilter.getBounds().isValid()) {
+        locationFilter.setBounds(map.getBounds().pad(-0.2));
+      }
+
       $("#drag_box").hide();
       locationFilter.enable();
     }
       $("#drag_box").hide();
       locationFilter.enable();
     }