From: John Firebaugh Date: Wed, 9 Oct 2013 00:24:49 +0000 (-0700) Subject: Fix export location filter button X-Git-Tag: live~4668^2~208 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/637799f1f57ab48254a5b6eaa0f78896ae41c456 Fix export location filter button Upstream pull request: https://github.com/kajic/leaflet-locationfilter/pull/14 --- diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 77b247c10..e9e95abfe 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -292,7 +292,7 @@ $(document).ready(function () { }); $(document).on("click", "a", function(e) { - if (e.isPropagationStopped()) return; + if (e.isDefaultPrevented() || e.isPropagationStopped()) return; if (this.host === window.location.host && OSM.route(this.pathname + this.search + this.hash)) e.preventDefault(); }); diff --git a/app/assets/javascripts/index/export.js b/app/assets/javascripts/index/export.js index 51ad1e3e2..02dcdd440 100644 --- a/app/assets/javascripts/index/export.js +++ b/app/assets/javascripts/index/export.js @@ -22,12 +22,12 @@ OSM.Export = function(map) { validateControls(); } - function enableFilter() { - if (!locationFilter.getBounds().isValid()) { - locationFilter.setBounds(map.getBounds().pad(-0.2)); - } + function enableFilter(e) { + e.preventDefault(); $("#drag_box").hide(); + + locationFilter.setBounds(map.getBounds().pad(-0.2)); locationFilter.enable(); } diff --git a/vendor/assets/leaflet/leaflet.locationfilter.js b/vendor/assets/leaflet/leaflet.locationfilter.js index a17f1a5af..9a0af4db4 100644 --- a/vendor/assets/leaflet/leaflet.locationfilter.js +++ b/vendor/assets/leaflet/leaflet.locationfilter.js @@ -114,7 +114,6 @@ L.LocationFilter = L.Class.extend({ onAdd: function(map) { this._map = map; - this._layer = new L.LayerGroup(); if (this.options.enableButton || this.options.adjustButton) { this._initializeButtonContainer(); @@ -285,6 +284,8 @@ L.LocationFilter = L.Class.extend({ return; } + this._layer = new L.LayerGroup(); + // Calculate filter bounds this._calculateBounds();