@nextgis/ngw-leaflet 2.1.1 → 2.2.1

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.1; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 2.2.1; 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.1; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 2.2.1; author: NextGIS */
2
2
  var NgwLeaflet = (function () {
3
3
  'use strict';
4
4
 
@@ -15031,18 +15031,18 @@ var NgwLeaflet = (function () {
15031
15031
  };
15032
15032
  }
15033
15033
 
15034
- var __defProp$_ = Object.defineProperty;
15035
- var __defNormalProp$_ = (obj, key, value) => key in obj ? __defProp$_(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15036
- var __publicField$H = (obj, key, value) => {
15037
- __defNormalProp$_(obj, typeof key !== "symbol" ? key + "" : key, value);
15034
+ var __defProp$$ = Object.defineProperty;
15035
+ var __defNormalProp$$ = (obj, key, value) => key in obj ? __defProp$$(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15036
+ var __publicField$I = (obj, key, value) => {
15037
+ __defNormalProp$$(obj, typeof key !== "symbol" ? key + "" : key, value);
15038
15038
  return value;
15039
15039
  };
15040
15040
  class BaseAdapter {
15041
15041
  constructor(map, options) {
15042
15042
  this.map = map;
15043
15043
  this.options = options;
15044
- __publicField$H(this, "layer");
15045
- __publicField$H(this, "pane", "order-0");
15044
+ __publicField$I(this, "layer");
15045
+ __publicField$I(this, "pane", "order-0");
15046
15046
  if (options.order !== void 0) {
15047
15047
  const pane = "order-" + options.order;
15048
15048
  let exist = map.getPane(pane);
@@ -15071,19 +15071,19 @@ var NgwLeaflet = (function () {
15071
15071
  };
15072
15072
  }
15073
15073
 
15074
- var __defProp$Z = Object.defineProperty;
15074
+ var __defProp$_ = Object.defineProperty;
15075
15075
  var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
15076
15076
  var __hasOwnProp$E = Object.prototype.hasOwnProperty;
15077
15077
  var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
15078
- var __defNormalProp$Z = (obj, key, value) => key in obj ? __defProp$Z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15078
+ var __defNormalProp$_ = (obj, key, value) => key in obj ? __defProp$_(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15079
15079
  var __spreadValues$D = (a, b) => {
15080
15080
  for (var prop in b || (b = {}))
15081
15081
  if (__hasOwnProp$E.call(b, prop))
15082
- __defNormalProp$Z(a, prop, b[prop]);
15082
+ __defNormalProp$_(a, prop, b[prop]);
15083
15083
  if (__getOwnPropSymbols$E)
15084
15084
  for (var prop of __getOwnPropSymbols$E(b)) {
15085
15085
  if (__propIsEnum$E.call(b, prop))
15086
- __defNormalProp$Z(a, prop, b[prop]);
15086
+ __defNormalProp$_(a, prop, b[prop]);
15087
15087
  }
15088
15088
  return a;
15089
15089
  };
@@ -15102,32 +15102,32 @@ var NgwLeaflet = (function () {
15102
15102
  return opt;
15103
15103
  }
15104
15104
 
15105
- var __defProp$Y = Object.defineProperty;
15105
+ var __defProp$Z = Object.defineProperty;
15106
15106
  var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
15107
15107
  var __hasOwnProp$D = Object.prototype.hasOwnProperty;
15108
15108
  var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
15109
- var __defNormalProp$Y = (obj, key, value) => key in obj ? __defProp$Y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15109
+ var __defNormalProp$Z = (obj, key, value) => key in obj ? __defProp$Z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15110
15110
  var __spreadValues$C = (a, b) => {
15111
15111
  for (var prop in b || (b = {}))
15112
15112
  if (__hasOwnProp$D.call(b, prop))
15113
- __defNormalProp$Y(a, prop, b[prop]);
15113
+ __defNormalProp$Z(a, prop, b[prop]);
15114
15114
  if (__getOwnPropSymbols$D)
15115
15115
  for (var prop of __getOwnPropSymbols$D(b)) {
15116
15116
  if (__propIsEnum$D.call(b, prop))
15117
- __defNormalProp$Y(a, prop, b[prop]);
15117
+ __defNormalProp$Z(a, prop, b[prop]);
15118
15118
  }
15119
15119
  return a;
15120
15120
  };
15121
- var __publicField$G = (obj, key, value) => {
15122
- __defNormalProp$Y(obj, typeof key !== "symbol" ? key + "" : key, value);
15121
+ var __publicField$H = (obj, key, value) => {
15122
+ __defNormalProp$Z(obj, typeof key !== "symbol" ? key + "" : key, value);
15123
15123
  return value;
15124
15124
  };
15125
15125
  class GeoJsonEvents {
15126
15126
  constructor(layer) {
15127
- __publicField$G(this, "layer");
15128
- __publicField$G(this, "_onclick");
15129
- __publicField$G(this, "_mouseout");
15130
- __publicField$G(this, "_mouseover");
15127
+ __publicField$H(this, "layer");
15128
+ __publicField$H(this, "_onclick");
15129
+ __publicField$H(this, "_mouseout");
15130
+ __publicField$H(this, "_mouseover");
15131
15131
  this.layer = layer;
15132
15132
  }
15133
15133
  handleMouseEvents(layer) {
@@ -15815,19 +15815,19 @@ var NgwLeaflet = (function () {
15815
15815
  typeof: evaluateArgs(([arg]) => typeOfValue(arg))
15816
15816
  };
15817
15817
 
15818
- var __defProp$X = Object.defineProperty;
15818
+ var __defProp$Y = Object.defineProperty;
15819
15819
  var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
15820
15820
  var __hasOwnProp$C = Object.prototype.hasOwnProperty;
15821
15821
  var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
15822
- var __defNormalProp$X = (obj, key, value) => key in obj ? __defProp$X(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15822
+ var __defNormalProp$Y = (obj, key, value) => key in obj ? __defProp$Y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15823
15823
  var __spreadValues$B = (a, b) => {
15824
15824
  for (var prop in b || (b = {}))
15825
15825
  if (__hasOwnProp$C.call(b, prop))
15826
- __defNormalProp$X(a, prop, b[prop]);
15826
+ __defNormalProp$Y(a, prop, b[prop]);
15827
15827
  if (__getOwnPropSymbols$C)
15828
15828
  for (var prop of __getOwnPropSymbols$C(b)) {
15829
15829
  if (__propIsEnum$C.call(b, prop))
15830
- __defNormalProp$X(a, prop, b[prop]);
15830
+ __defNormalProp$Y(a, prop, b[prop]);
15831
15831
  }
15832
15832
  return a;
15833
15833
  };
@@ -15852,19 +15852,19 @@ var NgwLeaflet = (function () {
15852
15852
  throw new Error(`Expression "${name}" is not supported.`);
15853
15853
  }
15854
15854
 
15855
- var __defProp$W = Object.defineProperty;
15855
+ var __defProp$X = Object.defineProperty;
15856
15856
  var __getOwnPropSymbols$B = Object.getOwnPropertySymbols;
15857
15857
  var __hasOwnProp$B = Object.prototype.hasOwnProperty;
15858
15858
  var __propIsEnum$B = Object.prototype.propertyIsEnumerable;
15859
- var __defNormalProp$W = (obj, key, value) => key in obj ? __defProp$W(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15859
+ var __defNormalProp$X = (obj, key, value) => key in obj ? __defProp$X(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15860
15860
  var __spreadValues$A = (a, b) => {
15861
15861
  for (var prop in b || (b = {}))
15862
15862
  if (__hasOwnProp$B.call(b, prop))
15863
- __defNormalProp$W(a, prop, b[prop]);
15863
+ __defNormalProp$X(a, prop, b[prop]);
15864
15864
  if (__getOwnPropSymbols$B)
15865
15865
  for (var prop of __getOwnPropSymbols$B(b)) {
15866
15866
  if (__propIsEnum$B.call(b, prop))
15867
- __defNormalProp$W(a, prop, b[prop]);
15867
+ __defNormalProp$X(a, prop, b[prop]);
15868
15868
  }
15869
15869
  return a;
15870
15870
  };
@@ -15903,19 +15903,19 @@ var NgwLeaflet = (function () {
15903
15903
  return;
15904
15904
  }
15905
15905
 
15906
- var __defProp$V = Object.defineProperty;
15906
+ var __defProp$W = Object.defineProperty;
15907
15907
  var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
15908
15908
  var __hasOwnProp$A = Object.prototype.hasOwnProperty;
15909
15909
  var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
15910
- var __defNormalProp$V = (obj, key, value) => key in obj ? __defProp$V(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15910
+ var __defNormalProp$W = (obj, key, value) => key in obj ? __defProp$W(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15911
15911
  var __spreadValues$z = (a, b) => {
15912
15912
  for (var prop in b || (b = {}))
15913
15913
  if (__hasOwnProp$A.call(b, prop))
15914
- __defNormalProp$V(a, prop, b[prop]);
15914
+ __defNormalProp$W(a, prop, b[prop]);
15915
15915
  if (__getOwnPropSymbols$A)
15916
15916
  for (var prop of __getOwnPropSymbols$A(b)) {
15917
15917
  if (__propIsEnum$A.call(b, prop))
15918
- __defNormalProp$V(a, prop, b[prop]);
15918
+ __defNormalProp$W(a, prop, b[prop]);
15919
15919
  }
15920
15920
  return a;
15921
15921
  };
@@ -15999,19 +15999,19 @@ var NgwLeaflet = (function () {
15999
15999
  return logic === "any" ? filters_.some(filterFunction) : filters_.every(filterFunction);
16000
16000
  }
16001
16001
 
16002
- var __defProp$U = Object.defineProperty;
16002
+ var __defProp$V = Object.defineProperty;
16003
16003
  var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
16004
16004
  var __hasOwnProp$z = Object.prototype.hasOwnProperty;
16005
16005
  var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
16006
- var __defNormalProp$U = (obj, key, value) => key in obj ? __defProp$U(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16006
+ var __defNormalProp$V = (obj, key, value) => key in obj ? __defProp$V(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16007
16007
  var __spreadValues$y = (a, b) => {
16008
16008
  for (var prop in b || (b = {}))
16009
16009
  if (__hasOwnProp$z.call(b, prop))
16010
- __defNormalProp$U(a, prop, b[prop]);
16010
+ __defNormalProp$V(a, prop, b[prop]);
16011
16011
  if (__getOwnPropSymbols$z)
16012
16012
  for (var prop of __getOwnPropSymbols$z(b)) {
16013
16013
  if (__propIsEnum$z.call(b, prop))
16014
- __defNormalProp$U(a, prop, b[prop]);
16014
+ __defNormalProp$V(a, prop, b[prop]);
16015
16015
  }
16016
16016
  return a;
16017
16017
  };
@@ -16135,21 +16135,21 @@ var NgwLeaflet = (function () {
16135
16135
  return newPaint;
16136
16136
  }
16137
16137
 
16138
- var __defProp$T = Object.defineProperty;
16138
+ var __defProp$U = Object.defineProperty;
16139
16139
  var __defProps$j = Object.defineProperties;
16140
16140
  var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
16141
16141
  var __getOwnPropSymbols$y = Object.getOwnPropertySymbols;
16142
16142
  var __hasOwnProp$y = Object.prototype.hasOwnProperty;
16143
16143
  var __propIsEnum$y = Object.prototype.propertyIsEnumerable;
16144
- var __defNormalProp$T = (obj, key, value) => key in obj ? __defProp$T(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16144
+ var __defNormalProp$U = (obj, key, value) => key in obj ? __defProp$U(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16145
16145
  var __spreadValues$x = (a, b) => {
16146
16146
  for (var prop in b || (b = {}))
16147
16147
  if (__hasOwnProp$y.call(b, prop))
16148
- __defNormalProp$T(a, prop, b[prop]);
16148
+ __defNormalProp$U(a, prop, b[prop]);
16149
16149
  if (__getOwnPropSymbols$y)
16150
16150
  for (var prop of __getOwnPropSymbols$y(b)) {
16151
16151
  if (__propIsEnum$y.call(b, prop))
16152
- __defNormalProp$T(a, prop, b[prop]);
16152
+ __defNormalProp$U(a, prop, b[prop]);
16153
16153
  }
16154
16154
  return a;
16155
16155
  };
@@ -16166,13 +16166,13 @@ var NgwLeaflet = (function () {
16166
16166
  }
16167
16167
  return target;
16168
16168
  };
16169
- var __publicField$F = (obj, key, value) => {
16170
- __defNormalProp$T(obj, typeof key !== "symbol" ? key + "" : key, value);
16169
+ var __publicField$G = (obj, key, value) => {
16170
+ __defNormalProp$U(obj, typeof key !== "symbol" ? key + "" : key, value);
16171
16171
  return value;
16172
16172
  };
16173
16173
  class GeoJsonPaint {
16174
16174
  constructor(layer) {
16175
- __publicField$F(this, "layer");
16175
+ __publicField$G(this, "layer");
16176
16176
  this.layer = layer;
16177
16177
  }
16178
16178
  setPaintEachLayer(paint) {
@@ -16299,27 +16299,27 @@ var NgwLeaflet = (function () {
16299
16299
  }
16300
16300
  }
16301
16301
 
16302
- var __defProp$S = Object.defineProperty;
16302
+ var __defProp$T = Object.defineProperty;
16303
16303
  var __defProps$i = Object.defineProperties;
16304
16304
  var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
16305
16305
  var __getOwnPropSymbols$x = Object.getOwnPropertySymbols;
16306
16306
  var __hasOwnProp$x = Object.prototype.hasOwnProperty;
16307
16307
  var __propIsEnum$x = Object.prototype.propertyIsEnumerable;
16308
- var __defNormalProp$S = (obj, key, value) => key in obj ? __defProp$S(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16308
+ var __defNormalProp$T = (obj, key, value) => key in obj ? __defProp$T(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16309
16309
  var __spreadValues$w = (a, b) => {
16310
16310
  for (var prop in b || (b = {}))
16311
16311
  if (__hasOwnProp$x.call(b, prop))
16312
- __defNormalProp$S(a, prop, b[prop]);
16312
+ __defNormalProp$T(a, prop, b[prop]);
16313
16313
  if (__getOwnPropSymbols$x)
16314
16314
  for (var prop of __getOwnPropSymbols$x(b)) {
16315
16315
  if (__propIsEnum$x.call(b, prop))
16316
- __defNormalProp$S(a, prop, b[prop]);
16316
+ __defNormalProp$T(a, prop, b[prop]);
16317
16317
  }
16318
16318
  return a;
16319
16319
  };
16320
16320
  var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
16321
- var __publicField$E = (obj, key, value) => {
16322
- __defNormalProp$S(obj, typeof key !== "symbol" ? key + "" : key, value);
16321
+ var __publicField$F = (obj, key, value) => {
16322
+ __defNormalProp$T(obj, typeof key !== "symbol" ? key + "" : key, value);
16323
16323
  return value;
16324
16324
  };
16325
16325
  var __async$l = (__this, __arguments, generator) => {
@@ -16345,22 +16345,22 @@ var NgwLeaflet = (function () {
16345
16345
  class GeoJsonAdapter extends BaseAdapter {
16346
16346
  constructor(map, options) {
16347
16347
  super(map, options);
16348
- __publicField$E(this, "layer");
16349
- __publicField$E(this, "selected", false);
16350
- __publicField$E(this, "type");
16351
- __publicField$E(this, "_layers", []);
16352
- __publicField$E(this, "_events");
16353
- __publicField$E(this, "paint");
16354
- __publicField$E(this, "selectedPaint");
16355
- __publicField$E(this, "_selectedLayers", []);
16356
- __publicField$E(this, "_filteredLayers", []);
16357
- __publicField$E(this, "_filterFun");
16358
- __publicField$E(this, "_openedPopup", []);
16359
- __publicField$E(this, "_paint");
16360
- __publicField$E(this, "$updateTooltip", debounce(() => {
16348
+ __publicField$F(this, "layer");
16349
+ __publicField$F(this, "selected", false);
16350
+ __publicField$F(this, "type");
16351
+ __publicField$F(this, "_layers", []);
16352
+ __publicField$F(this, "_events");
16353
+ __publicField$F(this, "paint");
16354
+ __publicField$F(this, "selectedPaint");
16355
+ __publicField$F(this, "_selectedLayers", []);
16356
+ __publicField$F(this, "_filteredLayers", []);
16357
+ __publicField$F(this, "_filterFun");
16358
+ __publicField$F(this, "_openedPopup", []);
16359
+ __publicField$F(this, "_paint");
16360
+ __publicField$F(this, "$updateTooltip", debounce(() => {
16361
16361
  this.updateTooltip();
16362
16362
  }, 300));
16363
- __publicField$E(this, "$unselect", () => {
16363
+ __publicField$F(this, "$unselect", () => {
16364
16364
  this.unselect();
16365
16365
  });
16366
16366
  this._events = new GeoJsonEvents(this);
@@ -16879,26 +16879,125 @@ var NgwLeaflet = (function () {
16879
16879
  }
16880
16880
  }
16881
16881
 
16882
- function callAjax(src, callback, headers) {
16883
- const xhr = new XMLHttpRequest();
16884
- xhr.open("GET", src);
16885
- xhr.responseType = "arraybuffer";
16886
- for (const h in headers) {
16887
- xhr.setRequestHeader(h, headers[h]);
16888
- }
16889
- xhr.onload = function() {
16890
- const arrayBufferView = new Uint8Array(this.response);
16891
- const blob = new Blob([arrayBufferView], { type: "image/png" });
16892
- const urlCreator = window.URL || window.webkitURL;
16893
- const imageUrl = urlCreator.createObjectURL(blob);
16894
- callback(imageUrl);
16895
- };
16896
- xhr.send();
16897
- return () => {
16898
- xhr.abort();
16882
+ function callAjax(src, headers) {
16883
+ let abortFunc = () => {
16899
16884
  };
16885
+ const promise = new Promise((resolve, reject) => {
16886
+ const xhr = new XMLHttpRequest();
16887
+ xhr.open("GET", src);
16888
+ xhr.responseType = "arraybuffer";
16889
+ for (const h in headers) {
16890
+ xhr.setRequestHeader(h, headers[h]);
16891
+ }
16892
+ xhr.onload = function() {
16893
+ const arrayBufferView = new Uint8Array(this.response);
16894
+ const blob = new Blob([arrayBufferView], { type: "image/png" });
16895
+ const urlCreator = window.URL || window.webkitURL;
16896
+ const imageUrl = urlCreator.createObjectURL(blob);
16897
+ resolve(imageUrl);
16898
+ };
16899
+ xhr.onerror = reject;
16900
+ xhr.send();
16901
+ abortFunc = () => {
16902
+ xhr.abort();
16903
+ resolve("");
16904
+ };
16905
+ });
16906
+ return [promise, abortFunc];
16900
16907
  }
16901
16908
 
16909
+ var __defProp$S = Object.defineProperty;
16910
+ var __defNormalProp$S = (obj, key, value) => key in obj ? __defProp$S(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16911
+ var __publicField$E = (obj, key, value) => {
16912
+ __defNormalProp$S(obj, typeof key !== "symbol" ? key + "" : key, value);
16913
+ return value;
16914
+ };
16915
+ class Queue {
16916
+ /**
16917
+ * @param {PromiseQueueOptions} options - Configuration options for the queue.
16918
+ */
16919
+ constructor({ concurrency = 1, delay = 0 } = {}) {
16920
+ __publicField$E(this, "queue", []);
16921
+ __publicField$E(this, "concurrency");
16922
+ __publicField$E(this, "activeCount", 0);
16923
+ __publicField$E(this, "timeoutId");
16924
+ __publicField$E(this, "delay");
16925
+ __publicField$E(this, "toAbort", []);
16926
+ this.concurrency = concurrency;
16927
+ this.delay = delay;
16928
+ }
16929
+ /**
16930
+ * Adds a task to the queue, which can be either a simple asynchronous function or an array containing a function and its abort handler.
16931
+ *
16932
+ * @param {PromiseFuncOrPromiseWithAbortArray} promise - The asynchronous task function or a tuple containing the task and an abort function.
16933
+ * @param {Abort} [abort] - An optional abort function for the task.
16934
+ *
16935
+ * @example
16936
+ * ```javascript
16937
+ * // Add a task without an abort function.
16938
+ * queue.add(() => new Promise(resolve => setTimeout(resolve, 1000)));
16939
+ *
16940
+ * // Add a task with an abort function.
16941
+ * const controller = new AbortController();
16942
+ * queue.add(() => fetch('https://example.com', { signal: controller.signal }), controller.abort);
16943
+ * ```
16944
+ */
16945
+ add(promise, abort) {
16946
+ this.queue.push({ promise, abort });
16947
+ this.debouncedNext();
16948
+ }
16949
+ /**
16950
+ * Aborts all tasks in the queue that have an abort function.
16951
+ *
16952
+ * @example
16953
+ * queue.abort(); // Aborts all abortable tasks in the queue.
16954
+ */
16955
+ abort() {
16956
+ for (const abort of this.toAbort) {
16957
+ abort();
16958
+ }
16959
+ this.toAbort = [];
16960
+ this.queue = [];
16961
+ this._clearTimeout();
16962
+ }
16963
+ debouncedNext() {
16964
+ this._clearTimeout();
16965
+ this.timeoutId = setTimeout(() => this._next(), this.delay);
16966
+ }
16967
+ _clearTimeout() {
16968
+ if (this.timeoutId) {
16969
+ clearTimeout(this.timeoutId);
16970
+ }
16971
+ }
16972
+ _next() {
16973
+ while (this.activeCount < this.concurrency && this.queue.length > 0) {
16974
+ const { promise, abort } = this.queue.shift();
16975
+ this.activeCount++;
16976
+ let toAbort = abort;
16977
+ let request;
16978
+ const execute = promise();
16979
+ if (Array.isArray(execute)) {
16980
+ request = execute[0];
16981
+ toAbort = execute[1];
16982
+ } else {
16983
+ request = execute;
16984
+ }
16985
+ if (toAbort) {
16986
+ this.toAbort.push(toAbort);
16987
+ }
16988
+ request.finally(() => {
16989
+ this.activeCount--;
16990
+ if (toAbort) {
16991
+ this.toAbort = this.toAbort.filter((a) => a !== toAbort);
16992
+ }
16993
+ this.debouncedNext();
16994
+ });
16995
+ }
16996
+ }
16997
+ }
16998
+
16999
+ const imageQueue = new Queue({ concurrency: 6, delay: 200 });
17000
+
16902
17001
  var __defProp$R = Object.defineProperty;
16903
17002
  var __defNormalProp$R = (obj, key, value) => key in obj ? __defProp$R(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16904
17003
  var __publicField$D = (obj, key, value) => {
@@ -16908,31 +17007,27 @@ var NgwLeaflet = (function () {
16908
17007
  class ImageOverlay extends leafletSrcExports.ImageOverlay {
16909
17008
  constructor(imageUrl, bounds, options) {
16910
17009
  super(imageUrl, bounds, options);
16911
- __publicField$D(this, "_abort", []);
17010
+ __publicField$D(this, "_aborter");
16912
17011
  }
16913
17012
  cancelLoad() {
16914
- if (this._abort) {
16915
- this._abort.forEach((x) => x());
16916
- this._abort = [];
17013
+ if (this._aborter) {
17014
+ this._aborter();
17015
+ this._aborter = void 0;
16917
17016
  }
16918
17017
  }
16919
17018
  _initImage() {
16920
17019
  super._initImage();
16921
17020
  const headers = this.options.headers;
16922
- if (headers) {
16923
- const img = this._image;
16924
- const src = img.src;
16925
- img.src = "";
16926
- this._abort.push(
16927
- callAjax(
16928
- src,
16929
- (response) => {
16930
- img.src = response;
16931
- },
16932
- headers
16933
- )
16934
- );
16935
- }
17021
+ const img = this._image;
17022
+ img.src = "";
17023
+ imageQueue.add(() => {
17024
+ const [promise, abortFunc] = callAjax(img.src, headers);
17025
+ promise.then((imgUrl) => {
17026
+ img.src = imgUrl;
17027
+ });
17028
+ this._aborter = abortFunc;
17029
+ return promise;
17030
+ });
16936
17031
  }
16937
17032
  }
16938
17033
 
@@ -16970,6 +17065,7 @@ var NgwLeaflet = (function () {
16970
17065
  __publicField$C(this, "_url");
16971
17066
  __publicField$C(this, "_currentUrl");
16972
17067
  __publicField$C(this, "_currentOverlay");
17068
+ __publicField$C(this, "_loadedOverlay");
16973
17069
  this._url = url;
16974
17070
  const params = {};
16975
17071
  const opts = {};
@@ -17023,15 +17119,18 @@ var NgwLeaflet = (function () {
17023
17119
  this._currentUrl = url;
17024
17120
  const viewPortBuffer = this.options.viewPortBuffer || 0;
17025
17121
  const bounds = this._map.getBounds().pad(viewPortBuffer);
17122
+ if (this._loadedOverlay) {
17123
+ this._loadedOverlay.cancelLoad();
17124
+ this._loadedOverlay.off("load");
17125
+ this._loadedOverlay = void 0;
17126
+ }
17026
17127
  const overlay = new ImageOverlay(url, bounds, {
17027
17128
  opacity: 0,
17028
17129
  pane: this.options.pane,
17029
17130
  headers: this.options.headers
17030
17131
  });
17031
17132
  overlay.addTo(this._map);
17032
- if (this._currentOverlay) {
17033
- this._currentOverlay.cancelLoad();
17034
- }
17133
+ this._loadedOverlay = overlay;
17035
17134
  overlay.once(
17036
17135
  "load",
17037
17136
  () => {
@@ -17044,6 +17143,7 @@ var NgwLeaflet = (function () {
17044
17143
  } else if (this._currentOverlay) {
17045
17144
  this._map.removeLayer(this._currentOverlay);
17046
17145
  }
17146
+ this._loadedOverlay = void 0;
17047
17147
  this._currentOverlay = overlay;
17048
17148
  overlay.setOpacity(
17049
17149
  this.options.opacity !== void 0 ? this.options.opacity : 1
@@ -17170,6 +17270,7 @@ var NgwLeaflet = (function () {
17170
17270
  }
17171
17271
  }
17172
17272
  }
17273
+ __publicField$B(ImageAdapter, "queue", imageQueue);
17173
17274
 
17174
17275
  function makeRemote(Base) {
17175
17276
  return class RemoteTileLayer extends Base {
@@ -17184,15 +17285,16 @@ var NgwLeaflet = (function () {
17184
17285
  createTile(coords, done) {
17185
17286
  const url = this.getTileUrl(coords);
17186
17287
  const tile = document.createElement("img");
17187
- tile.abort = callAjax(
17288
+ const [promise, abortFunc] = callAjax(
17188
17289
  url,
17189
- (response) => {
17190
- tile.src = response;
17191
- done(null, tile);
17192
- },
17193
17290
  // @ts-ignore
17194
17291
  this.options.headers
17195
17292
  );
17293
+ promise.then((response) => {
17294
+ tile.src = response;
17295
+ done(null, tile);
17296
+ });
17297
+ tile.abort = abortFunc;
17196
17298
  if (this.options.crossOrigin || this.options.crossOrigin === "") {
17197
17299
  tile.crossOrigin = this.options.crossOrigin === true ? "" : this.options.crossOrigin;
17198
17300
  }
@@ -17701,6 +17803,12 @@ var NgwLeaflet = (function () {
17701
17803
  for (const e of this._universalEvents) {
17702
17804
  map.on(e, () => this.emitter.emit(e, this), map);
17703
17805
  }
17806
+ map.on("movestart", () => {
17807
+ ImageAdapter.queue.abort();
17808
+ });
17809
+ map.on("zoomstart", () => {
17810
+ ImageAdapter.queue.abort();
17811
+ });
17704
17812
  for (const e of this._positionEvents) {
17705
17813
  map.on(
17706
17814
  e,