]> git.openstreetmap.org Git - rails.git/commitdiff
Don't zoom map when enabling location filter
authorJohn Firebaugh <john.firebaugh@gmail.com>
Fri, 9 Nov 2012 20:58:47 +0000 (12:58 -0800)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Fri, 9 Nov 2012 21:13:44 +0000 (13:13 -0800)
app/assets/javascripts/index/browse.js
app/assets/javascripts/index/export.js

index 61ac51f6957bd6fa08dcd5ec6f00bf1a90279197..6371f559b1b9807843622232e2a3823da28267de 100644 (file)
@@ -83,6 +83,7 @@ $(document).ready(function () {
 
     function enableFilter() {
       $("#browse_filter_toggle").html(I18n.t('browse.start_rjs.view_data'));
+      locationFilter.setBounds(map.getBounds().pad(-0.2));
       locationFilter.enable();
       getData();
     }
index 04c6b6ff7236868037ae0a22738ec9e1ca2c1786..61a333007f06ac1d2949361f12ba3621e65bf5e6 100644 (file)
@@ -15,7 +15,7 @@ $(document).ready(function () {
 
     var locationFilter = new L.LocationFilter({
       enableButton: false,
-      adjustButton: false,
+      adjustButton: false
     }).addTo(map);
 
     locationFilter.on("change", filterChanged);
@@ -83,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();
     }