@nextgis/ngw-leaflet 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-leaflet; version: 2.1.0; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 2.2.0; author: NextGIS */
2
2
  import 'leaflet/dist/leaflet.css';
3
3
  import LeafletMapAdapter from '@nextgis/leaflet-map-adapter';
4
4
  import { NgwMap } from '@nextgis/ngw-map';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-leaflet; version: 2.1.0; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 2.2.0; author: NextGIS */
2
2
  var NgwLeaflet = (function () {
3
3
  'use strict';
4
4
 
@@ -16908,30 +16908,32 @@ var NgwLeaflet = (function () {
16908
16908
  class ImageOverlay extends leafletSrcExports.ImageOverlay {
16909
16909
  constructor(imageUrl, bounds, options) {
16910
16910
  super(imageUrl, bounds, options);
16911
- __publicField$D(this, "_abort", []);
16911
+ __publicField$D(this, "_aborter");
16912
16912
  }
16913
16913
  cancelLoad() {
16914
- if (this._abort) {
16915
- this._abort.forEach((x) => x());
16916
- this._abort = [];
16914
+ if (this._aborter) {
16915
+ this._aborter();
16916
+ this._aborter = void 0;
16917
16917
  }
16918
16918
  }
16919
16919
  _initImage() {
16920
16920
  super._initImage();
16921
16921
  const headers = this.options.headers;
16922
+ const img = this._image;
16923
+ const src = img.src;
16922
16924
  if (headers) {
16923
- const img = this._image;
16924
- const src = img.src;
16925
16925
  img.src = "";
16926
- this._abort.push(
16927
- callAjax(
16928
- src,
16929
- (response) => {
16930
- img.src = response;
16931
- },
16932
- headers
16933
- )
16926
+ this._aborter = callAjax(
16927
+ src,
16928
+ (response) => {
16929
+ img.src = response;
16930
+ },
16931
+ headers
16934
16932
  );
16933
+ } else {
16934
+ this._aborter = () => {
16935
+ img.setAttribute("src", leafletSrcExports.Util.emptyImageUrl);
16936
+ };
16935
16937
  }
16936
16938
  }
16937
16939
  }
@@ -16970,6 +16972,7 @@ var NgwLeaflet = (function () {
16970
16972
  __publicField$C(this, "_url");
16971
16973
  __publicField$C(this, "_currentUrl");
16972
16974
  __publicField$C(this, "_currentOverlay");
16975
+ __publicField$C(this, "_loadedOverlay");
16973
16976
  this._url = url;
16974
16977
  const params = {};
16975
16978
  const opts = {};
@@ -17023,15 +17026,18 @@ var NgwLeaflet = (function () {
17023
17026
  this._currentUrl = url;
17024
17027
  const viewPortBuffer = this.options.viewPortBuffer || 0;
17025
17028
  const bounds = this._map.getBounds().pad(viewPortBuffer);
17029
+ if (this._loadedOverlay) {
17030
+ this._loadedOverlay.cancelLoad();
17031
+ this._loadedOverlay.off("load");
17032
+ this._loadedOverlay = void 0;
17033
+ }
17026
17034
  const overlay = new ImageOverlay(url, bounds, {
17027
17035
  opacity: 0,
17028
17036
  pane: this.options.pane,
17029
17037
  headers: this.options.headers
17030
17038
  });
17031
17039
  overlay.addTo(this._map);
17032
- if (this._currentOverlay) {
17033
- this._currentOverlay.cancelLoad();
17034
- }
17040
+ this._loadedOverlay = overlay;
17035
17041
  overlay.once(
17036
17042
  "load",
17037
17043
  () => {
@@ -17044,6 +17050,7 @@ var NgwLeaflet = (function () {
17044
17050
  } else if (this._currentOverlay) {
17045
17051
  this._map.removeLayer(this._currentOverlay);
17046
17052
  }
17053
+ this._loadedOverlay = void 0;
17047
17054
  this._currentOverlay = overlay;
17048
17055
  overlay.setOpacity(
17049
17056
  this.options.opacity !== void 0 ? this.options.opacity : 1
@@ -20920,7 +20927,7 @@ var NgwLeaflet = (function () {
20920
20927
  } = props;
20921
20928
  const addLayerOptionsPriority = alop != null ? alop : true;
20922
20929
  const options = layerOptions;
20923
- const GeoJsonAdapter = Adapter || webMap.mapAdapter.layerAdapters.GEOJSON;
20930
+ const GeoJsonAdapter = Adapter || layerOptions.Adapter || webMap.mapAdapter.layerAdapters.GEOJSON;
20924
20931
  const _loadedIds = [];
20925
20932
  let _fullDataLoad = false;
20926
20933
  let _lastFilterArgs;