X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/aebacc88de18c24c583a12b589eb98cf0b826627..efc65b86a23032e7867314082f80e1da3654b51a:/vendor/assets/leaflet/leaflet.osm.js diff --git a/vendor/assets/leaflet/leaflet.osm.js b/vendor/assets/leaflet/leaflet.osm.js index 53d18bf2c..83cc3e2d6 100644 --- a/vendor/assets/leaflet/leaflet.osm.js +++ b/vendor/assets/leaflet/leaflet.osm.js @@ -104,6 +104,13 @@ L.OSM.DataLayer = L.FeatureGroup.extend({ } }, + loadingLayers: [], + + cancelLoading: function () { + this.loadingLayers.forEach(layer => clearTimeout(layer)); + this.loadingLayers = []; + }, + addData: function (features) { if (!(features instanceof Array)) { features = this.buildFeatures(features); @@ -220,9 +227,11 @@ L.OSM.DataLayer = L.FeatureGroup.extend({ eachLayer: function (method, context, asynchronous = false) { for (let i in this._layers) { if (asynchronous) { - setTimeout(() => { - method.call(context, this._layers[i]); - }); + this.loadingLayers.push( + setTimeout(() => { + method.call(context, this._layers[i]); + }) + ); } else { method.call(context, this._layers[i]); }