@nextgis/ngw-leaflet 2.2.0 → 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.
- package/lib/ngw-leaflet.esm-browser.js +202 -101
- package/lib/ngw-leaflet.esm-browser.js.map +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js.map +1 -1
- package/lib/ngw-leaflet.esm-bundler.js +1 -1
- package/lib/ngw-leaflet.global.js +202 -101
- package/lib/ngw-leaflet.global.js.map +1 -1
- package/lib/ngw-leaflet.global.prod.js +1 -1
- package/lib/ngw-leaflet.global.prod.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-leaflet; version: 2.2.
|
|
1
|
+
/** Bundle of @nextgis/ngw-leaflet; version: 2.2.1; author: NextGIS */
|
|
2
2
|
function styleInject(css, ref) {
|
|
3
3
|
if ( ref === void 0 ) ref = {};
|
|
4
4
|
var insertAt = ref.insertAt;
|
|
@@ -15028,18 +15028,18 @@ function createFeaturePositionOptions(features) {
|
|
|
15028
15028
|
};
|
|
15029
15029
|
}
|
|
15030
15030
|
|
|
15031
|
-
var __defProp
|
|
15032
|
-
var __defNormalProp
|
|
15033
|
-
var __publicField$
|
|
15034
|
-
__defNormalProp
|
|
15031
|
+
var __defProp$$ = Object.defineProperty;
|
|
15032
|
+
var __defNormalProp$$ = (obj, key, value) => key in obj ? __defProp$$(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15033
|
+
var __publicField$I = (obj, key, value) => {
|
|
15034
|
+
__defNormalProp$$(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15035
15035
|
return value;
|
|
15036
15036
|
};
|
|
15037
15037
|
class BaseAdapter {
|
|
15038
15038
|
constructor(map, options) {
|
|
15039
15039
|
this.map = map;
|
|
15040
15040
|
this.options = options;
|
|
15041
|
-
__publicField$
|
|
15042
|
-
__publicField$
|
|
15041
|
+
__publicField$I(this, "layer");
|
|
15042
|
+
__publicField$I(this, "pane", "order-0");
|
|
15043
15043
|
if (options.order !== void 0) {
|
|
15044
15044
|
const pane = "order-" + options.order;
|
|
15045
15045
|
let exist = map.getPane(pane);
|
|
@@ -15068,19 +15068,19 @@ function convertMapClickEvent(evt) {
|
|
|
15068
15068
|
};
|
|
15069
15069
|
}
|
|
15070
15070
|
|
|
15071
|
-
var __defProp$
|
|
15071
|
+
var __defProp$_ = Object.defineProperty;
|
|
15072
15072
|
var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
|
|
15073
15073
|
var __hasOwnProp$E = Object.prototype.hasOwnProperty;
|
|
15074
15074
|
var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
|
|
15075
|
-
var __defNormalProp$
|
|
15075
|
+
var __defNormalProp$_ = (obj, key, value) => key in obj ? __defProp$_(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15076
15076
|
var __spreadValues$D = (a, b) => {
|
|
15077
15077
|
for (var prop in b || (b = {}))
|
|
15078
15078
|
if (__hasOwnProp$E.call(b, prop))
|
|
15079
|
-
__defNormalProp$
|
|
15079
|
+
__defNormalProp$_(a, prop, b[prop]);
|
|
15080
15080
|
if (__getOwnPropSymbols$E)
|
|
15081
15081
|
for (var prop of __getOwnPropSymbols$E(b)) {
|
|
15082
15082
|
if (__propIsEnum$E.call(b, prop))
|
|
15083
|
-
__defNormalProp$
|
|
15083
|
+
__defNormalProp$_(a, prop, b[prop]);
|
|
15084
15084
|
}
|
|
15085
15085
|
return a;
|
|
15086
15086
|
};
|
|
@@ -15099,32 +15099,32 @@ function createMouseEvent({
|
|
|
15099
15099
|
return opt;
|
|
15100
15100
|
}
|
|
15101
15101
|
|
|
15102
|
-
var __defProp$
|
|
15102
|
+
var __defProp$Z = Object.defineProperty;
|
|
15103
15103
|
var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
|
|
15104
15104
|
var __hasOwnProp$D = Object.prototype.hasOwnProperty;
|
|
15105
15105
|
var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
|
|
15106
|
-
var __defNormalProp$
|
|
15106
|
+
var __defNormalProp$Z = (obj, key, value) => key in obj ? __defProp$Z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15107
15107
|
var __spreadValues$C = (a, b) => {
|
|
15108
15108
|
for (var prop in b || (b = {}))
|
|
15109
15109
|
if (__hasOwnProp$D.call(b, prop))
|
|
15110
|
-
__defNormalProp$
|
|
15110
|
+
__defNormalProp$Z(a, prop, b[prop]);
|
|
15111
15111
|
if (__getOwnPropSymbols$D)
|
|
15112
15112
|
for (var prop of __getOwnPropSymbols$D(b)) {
|
|
15113
15113
|
if (__propIsEnum$D.call(b, prop))
|
|
15114
|
-
__defNormalProp$
|
|
15114
|
+
__defNormalProp$Z(a, prop, b[prop]);
|
|
15115
15115
|
}
|
|
15116
15116
|
return a;
|
|
15117
15117
|
};
|
|
15118
|
-
var __publicField$
|
|
15119
|
-
__defNormalProp$
|
|
15118
|
+
var __publicField$H = (obj, key, value) => {
|
|
15119
|
+
__defNormalProp$Z(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15120
15120
|
return value;
|
|
15121
15121
|
};
|
|
15122
15122
|
class GeoJsonEvents {
|
|
15123
15123
|
constructor(layer) {
|
|
15124
|
-
__publicField$
|
|
15125
|
-
__publicField$
|
|
15126
|
-
__publicField$
|
|
15127
|
-
__publicField$
|
|
15124
|
+
__publicField$H(this, "layer");
|
|
15125
|
+
__publicField$H(this, "_onclick");
|
|
15126
|
+
__publicField$H(this, "_mouseout");
|
|
15127
|
+
__publicField$H(this, "_mouseover");
|
|
15128
15128
|
this.layer = layer;
|
|
15129
15129
|
}
|
|
15130
15130
|
handleMouseEvents(layer) {
|
|
@@ -15812,19 +15812,19 @@ const typeExpressions = {
|
|
|
15812
15812
|
typeof: evaluateArgs(([arg]) => typeOfValue(arg))
|
|
15813
15813
|
};
|
|
15814
15814
|
|
|
15815
|
-
var __defProp$
|
|
15815
|
+
var __defProp$Y = Object.defineProperty;
|
|
15816
15816
|
var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
|
|
15817
15817
|
var __hasOwnProp$C = Object.prototype.hasOwnProperty;
|
|
15818
15818
|
var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
|
|
15819
|
-
var __defNormalProp$
|
|
15819
|
+
var __defNormalProp$Y = (obj, key, value) => key in obj ? __defProp$Y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15820
15820
|
var __spreadValues$B = (a, b) => {
|
|
15821
15821
|
for (var prop in b || (b = {}))
|
|
15822
15822
|
if (__hasOwnProp$C.call(b, prop))
|
|
15823
|
-
__defNormalProp$
|
|
15823
|
+
__defNormalProp$Y(a, prop, b[prop]);
|
|
15824
15824
|
if (__getOwnPropSymbols$C)
|
|
15825
15825
|
for (var prop of __getOwnPropSymbols$C(b)) {
|
|
15826
15826
|
if (__propIsEnum$C.call(b, prop))
|
|
15827
|
-
__defNormalProp$
|
|
15827
|
+
__defNormalProp$Y(a, prop, b[prop]);
|
|
15828
15828
|
}
|
|
15829
15829
|
return a;
|
|
15830
15830
|
};
|
|
@@ -15849,19 +15849,19 @@ function evaluate(expression, data = {}) {
|
|
|
15849
15849
|
throw new Error(`Expression "${name}" is not supported.`);
|
|
15850
15850
|
}
|
|
15851
15851
|
|
|
15852
|
-
var __defProp$
|
|
15852
|
+
var __defProp$X = Object.defineProperty;
|
|
15853
15853
|
var __getOwnPropSymbols$B = Object.getOwnPropertySymbols;
|
|
15854
15854
|
var __hasOwnProp$B = Object.prototype.hasOwnProperty;
|
|
15855
15855
|
var __propIsEnum$B = Object.prototype.propertyIsEnumerable;
|
|
15856
|
-
var __defNormalProp$
|
|
15856
|
+
var __defNormalProp$X = (obj, key, value) => key in obj ? __defProp$X(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15857
15857
|
var __spreadValues$A = (a, b) => {
|
|
15858
15858
|
for (var prop in b || (b = {}))
|
|
15859
15859
|
if (__hasOwnProp$B.call(b, prop))
|
|
15860
|
-
__defNormalProp$
|
|
15860
|
+
__defNormalProp$X(a, prop, b[prop]);
|
|
15861
15861
|
if (__getOwnPropSymbols$B)
|
|
15862
15862
|
for (var prop of __getOwnPropSymbols$B(b)) {
|
|
15863
15863
|
if (__propIsEnum$B.call(b, prop))
|
|
15864
|
-
__defNormalProp$
|
|
15864
|
+
__defNormalProp$X(a, prop, b[prop]);
|
|
15865
15865
|
}
|
|
15866
15866
|
return a;
|
|
15867
15867
|
};
|
|
@@ -15900,19 +15900,19 @@ function createExpressionCallback(paint) {
|
|
|
15900
15900
|
return;
|
|
15901
15901
|
}
|
|
15902
15902
|
|
|
15903
|
-
var __defProp$
|
|
15903
|
+
var __defProp$W = Object.defineProperty;
|
|
15904
15904
|
var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
|
|
15905
15905
|
var __hasOwnProp$A = Object.prototype.hasOwnProperty;
|
|
15906
15906
|
var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
|
|
15907
|
-
var __defNormalProp$
|
|
15907
|
+
var __defNormalProp$W = (obj, key, value) => key in obj ? __defProp$W(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15908
15908
|
var __spreadValues$z = (a, b) => {
|
|
15909
15909
|
for (var prop in b || (b = {}))
|
|
15910
15910
|
if (__hasOwnProp$A.call(b, prop))
|
|
15911
|
-
__defNormalProp$
|
|
15911
|
+
__defNormalProp$W(a, prop, b[prop]);
|
|
15912
15912
|
if (__getOwnPropSymbols$A)
|
|
15913
15913
|
for (var prop of __getOwnPropSymbols$A(b)) {
|
|
15914
15914
|
if (__propIsEnum$A.call(b, prop))
|
|
15915
|
-
__defNormalProp$
|
|
15915
|
+
__defNormalProp$W(a, prop, b[prop]);
|
|
15916
15916
|
}
|
|
15917
15917
|
return a;
|
|
15918
15918
|
};
|
|
@@ -15996,19 +15996,19 @@ function propertiesFilter(properties, filters) {
|
|
|
15996
15996
|
return logic === "any" ? filters_.some(filterFunction) : filters_.every(filterFunction);
|
|
15997
15997
|
}
|
|
15998
15998
|
|
|
15999
|
-
var __defProp$
|
|
15999
|
+
var __defProp$V = Object.defineProperty;
|
|
16000
16000
|
var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
|
|
16001
16001
|
var __hasOwnProp$z = Object.prototype.hasOwnProperty;
|
|
16002
16002
|
var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
|
|
16003
|
-
var __defNormalProp$
|
|
16003
|
+
var __defNormalProp$V = (obj, key, value) => key in obj ? __defProp$V(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16004
16004
|
var __spreadValues$y = (a, b) => {
|
|
16005
16005
|
for (var prop in b || (b = {}))
|
|
16006
16006
|
if (__hasOwnProp$z.call(b, prop))
|
|
16007
|
-
__defNormalProp$
|
|
16007
|
+
__defNormalProp$V(a, prop, b[prop]);
|
|
16008
16008
|
if (__getOwnPropSymbols$z)
|
|
16009
16009
|
for (var prop of __getOwnPropSymbols$z(b)) {
|
|
16010
16010
|
if (__propIsEnum$z.call(b, prop))
|
|
16011
|
-
__defNormalProp$
|
|
16011
|
+
__defNormalProp$V(a, prop, b[prop]);
|
|
16012
16012
|
}
|
|
16013
16013
|
return a;
|
|
16014
16014
|
};
|
|
@@ -16132,21 +16132,21 @@ function preparePaint({
|
|
|
16132
16132
|
return newPaint;
|
|
16133
16133
|
}
|
|
16134
16134
|
|
|
16135
|
-
var __defProp$
|
|
16135
|
+
var __defProp$U = Object.defineProperty;
|
|
16136
16136
|
var __defProps$j = Object.defineProperties;
|
|
16137
16137
|
var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
|
|
16138
16138
|
var __getOwnPropSymbols$y = Object.getOwnPropertySymbols;
|
|
16139
16139
|
var __hasOwnProp$y = Object.prototype.hasOwnProperty;
|
|
16140
16140
|
var __propIsEnum$y = Object.prototype.propertyIsEnumerable;
|
|
16141
|
-
var __defNormalProp$
|
|
16141
|
+
var __defNormalProp$U = (obj, key, value) => key in obj ? __defProp$U(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16142
16142
|
var __spreadValues$x = (a, b) => {
|
|
16143
16143
|
for (var prop in b || (b = {}))
|
|
16144
16144
|
if (__hasOwnProp$y.call(b, prop))
|
|
16145
|
-
__defNormalProp$
|
|
16145
|
+
__defNormalProp$U(a, prop, b[prop]);
|
|
16146
16146
|
if (__getOwnPropSymbols$y)
|
|
16147
16147
|
for (var prop of __getOwnPropSymbols$y(b)) {
|
|
16148
16148
|
if (__propIsEnum$y.call(b, prop))
|
|
16149
|
-
__defNormalProp$
|
|
16149
|
+
__defNormalProp$U(a, prop, b[prop]);
|
|
16150
16150
|
}
|
|
16151
16151
|
return a;
|
|
16152
16152
|
};
|
|
@@ -16163,13 +16163,13 @@ var __objRest$4 = (source, exclude) => {
|
|
|
16163
16163
|
}
|
|
16164
16164
|
return target;
|
|
16165
16165
|
};
|
|
16166
|
-
var __publicField$
|
|
16167
|
-
__defNormalProp$
|
|
16166
|
+
var __publicField$G = (obj, key, value) => {
|
|
16167
|
+
__defNormalProp$U(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
16168
16168
|
return value;
|
|
16169
16169
|
};
|
|
16170
16170
|
class GeoJsonPaint {
|
|
16171
16171
|
constructor(layer) {
|
|
16172
|
-
__publicField$
|
|
16172
|
+
__publicField$G(this, "layer");
|
|
16173
16173
|
this.layer = layer;
|
|
16174
16174
|
}
|
|
16175
16175
|
setPaintEachLayer(paint) {
|
|
@@ -16296,27 +16296,27 @@ class GeoJsonPaint {
|
|
|
16296
16296
|
}
|
|
16297
16297
|
}
|
|
16298
16298
|
|
|
16299
|
-
var __defProp$
|
|
16299
|
+
var __defProp$T = Object.defineProperty;
|
|
16300
16300
|
var __defProps$i = Object.defineProperties;
|
|
16301
16301
|
var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
|
|
16302
16302
|
var __getOwnPropSymbols$x = Object.getOwnPropertySymbols;
|
|
16303
16303
|
var __hasOwnProp$x = Object.prototype.hasOwnProperty;
|
|
16304
16304
|
var __propIsEnum$x = Object.prototype.propertyIsEnumerable;
|
|
16305
|
-
var __defNormalProp$
|
|
16305
|
+
var __defNormalProp$T = (obj, key, value) => key in obj ? __defProp$T(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16306
16306
|
var __spreadValues$w = (a, b) => {
|
|
16307
16307
|
for (var prop in b || (b = {}))
|
|
16308
16308
|
if (__hasOwnProp$x.call(b, prop))
|
|
16309
|
-
__defNormalProp$
|
|
16309
|
+
__defNormalProp$T(a, prop, b[prop]);
|
|
16310
16310
|
if (__getOwnPropSymbols$x)
|
|
16311
16311
|
for (var prop of __getOwnPropSymbols$x(b)) {
|
|
16312
16312
|
if (__propIsEnum$x.call(b, prop))
|
|
16313
|
-
__defNormalProp$
|
|
16313
|
+
__defNormalProp$T(a, prop, b[prop]);
|
|
16314
16314
|
}
|
|
16315
16315
|
return a;
|
|
16316
16316
|
};
|
|
16317
16317
|
var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
|
|
16318
|
-
var __publicField$
|
|
16319
|
-
__defNormalProp$
|
|
16318
|
+
var __publicField$F = (obj, key, value) => {
|
|
16319
|
+
__defNormalProp$T(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
16320
16320
|
return value;
|
|
16321
16321
|
};
|
|
16322
16322
|
var __async$l = (__this, __arguments, generator) => {
|
|
@@ -16342,22 +16342,22 @@ var __async$l = (__this, __arguments, generator) => {
|
|
|
16342
16342
|
class GeoJsonAdapter extends BaseAdapter {
|
|
16343
16343
|
constructor(map, options) {
|
|
16344
16344
|
super(map, options);
|
|
16345
|
-
__publicField$
|
|
16346
|
-
__publicField$
|
|
16347
|
-
__publicField$
|
|
16348
|
-
__publicField$
|
|
16349
|
-
__publicField$
|
|
16350
|
-
__publicField$
|
|
16351
|
-
__publicField$
|
|
16352
|
-
__publicField$
|
|
16353
|
-
__publicField$
|
|
16354
|
-
__publicField$
|
|
16355
|
-
__publicField$
|
|
16356
|
-
__publicField$
|
|
16357
|
-
__publicField$
|
|
16345
|
+
__publicField$F(this, "layer");
|
|
16346
|
+
__publicField$F(this, "selected", false);
|
|
16347
|
+
__publicField$F(this, "type");
|
|
16348
|
+
__publicField$F(this, "_layers", []);
|
|
16349
|
+
__publicField$F(this, "_events");
|
|
16350
|
+
__publicField$F(this, "paint");
|
|
16351
|
+
__publicField$F(this, "selectedPaint");
|
|
16352
|
+
__publicField$F(this, "_selectedLayers", []);
|
|
16353
|
+
__publicField$F(this, "_filteredLayers", []);
|
|
16354
|
+
__publicField$F(this, "_filterFun");
|
|
16355
|
+
__publicField$F(this, "_openedPopup", []);
|
|
16356
|
+
__publicField$F(this, "_paint");
|
|
16357
|
+
__publicField$F(this, "$updateTooltip", debounce(() => {
|
|
16358
16358
|
this.updateTooltip();
|
|
16359
16359
|
}, 300));
|
|
16360
|
-
__publicField$
|
|
16360
|
+
__publicField$F(this, "$unselect", () => {
|
|
16361
16361
|
this.unselect();
|
|
16362
16362
|
});
|
|
16363
16363
|
this._events = new GeoJsonEvents(this);
|
|
@@ -16876,26 +16876,125 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
16876
16876
|
}
|
|
16877
16877
|
}
|
|
16878
16878
|
|
|
16879
|
-
function callAjax(src,
|
|
16880
|
-
|
|
16881
|
-
xhr.open("GET", src);
|
|
16882
|
-
xhr.responseType = "arraybuffer";
|
|
16883
|
-
for (const h in headers) {
|
|
16884
|
-
xhr.setRequestHeader(h, headers[h]);
|
|
16885
|
-
}
|
|
16886
|
-
xhr.onload = function() {
|
|
16887
|
-
const arrayBufferView = new Uint8Array(this.response);
|
|
16888
|
-
const blob = new Blob([arrayBufferView], { type: "image/png" });
|
|
16889
|
-
const urlCreator = window.URL || window.webkitURL;
|
|
16890
|
-
const imageUrl = urlCreator.createObjectURL(blob);
|
|
16891
|
-
callback(imageUrl);
|
|
16892
|
-
};
|
|
16893
|
-
xhr.send();
|
|
16894
|
-
return () => {
|
|
16895
|
-
xhr.abort();
|
|
16879
|
+
function callAjax(src, headers) {
|
|
16880
|
+
let abortFunc = () => {
|
|
16896
16881
|
};
|
|
16882
|
+
const promise = new Promise((resolve, reject) => {
|
|
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
|
+
resolve(imageUrl);
|
|
16895
|
+
};
|
|
16896
|
+
xhr.onerror = reject;
|
|
16897
|
+
xhr.send();
|
|
16898
|
+
abortFunc = () => {
|
|
16899
|
+
xhr.abort();
|
|
16900
|
+
resolve("");
|
|
16901
|
+
};
|
|
16902
|
+
});
|
|
16903
|
+
return [promise, abortFunc];
|
|
16904
|
+
}
|
|
16905
|
+
|
|
16906
|
+
var __defProp$S = Object.defineProperty;
|
|
16907
|
+
var __defNormalProp$S = (obj, key, value) => key in obj ? __defProp$S(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16908
|
+
var __publicField$E = (obj, key, value) => {
|
|
16909
|
+
__defNormalProp$S(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
16910
|
+
return value;
|
|
16911
|
+
};
|
|
16912
|
+
class Queue {
|
|
16913
|
+
/**
|
|
16914
|
+
* @param {PromiseQueueOptions} options - Configuration options for the queue.
|
|
16915
|
+
*/
|
|
16916
|
+
constructor({ concurrency = 1, delay = 0 } = {}) {
|
|
16917
|
+
__publicField$E(this, "queue", []);
|
|
16918
|
+
__publicField$E(this, "concurrency");
|
|
16919
|
+
__publicField$E(this, "activeCount", 0);
|
|
16920
|
+
__publicField$E(this, "timeoutId");
|
|
16921
|
+
__publicField$E(this, "delay");
|
|
16922
|
+
__publicField$E(this, "toAbort", []);
|
|
16923
|
+
this.concurrency = concurrency;
|
|
16924
|
+
this.delay = delay;
|
|
16925
|
+
}
|
|
16926
|
+
/**
|
|
16927
|
+
* Adds a task to the queue, which can be either a simple asynchronous function or an array containing a function and its abort handler.
|
|
16928
|
+
*
|
|
16929
|
+
* @param {PromiseFuncOrPromiseWithAbortArray} promise - The asynchronous task function or a tuple containing the task and an abort function.
|
|
16930
|
+
* @param {Abort} [abort] - An optional abort function for the task.
|
|
16931
|
+
*
|
|
16932
|
+
* @example
|
|
16933
|
+
* ```javascript
|
|
16934
|
+
* // Add a task without an abort function.
|
|
16935
|
+
* queue.add(() => new Promise(resolve => setTimeout(resolve, 1000)));
|
|
16936
|
+
*
|
|
16937
|
+
* // Add a task with an abort function.
|
|
16938
|
+
* const controller = new AbortController();
|
|
16939
|
+
* queue.add(() => fetch('https://example.com', { signal: controller.signal }), controller.abort);
|
|
16940
|
+
* ```
|
|
16941
|
+
*/
|
|
16942
|
+
add(promise, abort) {
|
|
16943
|
+
this.queue.push({ promise, abort });
|
|
16944
|
+
this.debouncedNext();
|
|
16945
|
+
}
|
|
16946
|
+
/**
|
|
16947
|
+
* Aborts all tasks in the queue that have an abort function.
|
|
16948
|
+
*
|
|
16949
|
+
* @example
|
|
16950
|
+
* queue.abort(); // Aborts all abortable tasks in the queue.
|
|
16951
|
+
*/
|
|
16952
|
+
abort() {
|
|
16953
|
+
for (const abort of this.toAbort) {
|
|
16954
|
+
abort();
|
|
16955
|
+
}
|
|
16956
|
+
this.toAbort = [];
|
|
16957
|
+
this.queue = [];
|
|
16958
|
+
this._clearTimeout();
|
|
16959
|
+
}
|
|
16960
|
+
debouncedNext() {
|
|
16961
|
+
this._clearTimeout();
|
|
16962
|
+
this.timeoutId = setTimeout(() => this._next(), this.delay);
|
|
16963
|
+
}
|
|
16964
|
+
_clearTimeout() {
|
|
16965
|
+
if (this.timeoutId) {
|
|
16966
|
+
clearTimeout(this.timeoutId);
|
|
16967
|
+
}
|
|
16968
|
+
}
|
|
16969
|
+
_next() {
|
|
16970
|
+
while (this.activeCount < this.concurrency && this.queue.length > 0) {
|
|
16971
|
+
const { promise, abort } = this.queue.shift();
|
|
16972
|
+
this.activeCount++;
|
|
16973
|
+
let toAbort = abort;
|
|
16974
|
+
let request;
|
|
16975
|
+
const execute = promise();
|
|
16976
|
+
if (Array.isArray(execute)) {
|
|
16977
|
+
request = execute[0];
|
|
16978
|
+
toAbort = execute[1];
|
|
16979
|
+
} else {
|
|
16980
|
+
request = execute;
|
|
16981
|
+
}
|
|
16982
|
+
if (toAbort) {
|
|
16983
|
+
this.toAbort.push(toAbort);
|
|
16984
|
+
}
|
|
16985
|
+
request.finally(() => {
|
|
16986
|
+
this.activeCount--;
|
|
16987
|
+
if (toAbort) {
|
|
16988
|
+
this.toAbort = this.toAbort.filter((a) => a !== toAbort);
|
|
16989
|
+
}
|
|
16990
|
+
this.debouncedNext();
|
|
16991
|
+
});
|
|
16992
|
+
}
|
|
16993
|
+
}
|
|
16897
16994
|
}
|
|
16898
16995
|
|
|
16996
|
+
const imageQueue = new Queue({ concurrency: 6, delay: 200 });
|
|
16997
|
+
|
|
16899
16998
|
var __defProp$R = Object.defineProperty;
|
|
16900
16999
|
var __defNormalProp$R = (obj, key, value) => key in obj ? __defProp$R(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16901
17000
|
var __publicField$D = (obj, key, value) => {
|
|
@@ -16917,21 +17016,15 @@ class ImageOverlay extends leafletSrcExports.ImageOverlay {
|
|
|
16917
17016
|
super._initImage();
|
|
16918
17017
|
const headers = this.options.headers;
|
|
16919
17018
|
const img = this._image;
|
|
16920
|
-
|
|
16921
|
-
|
|
16922
|
-
img.src
|
|
16923
|
-
|
|
16924
|
-
src
|
|
16925
|
-
|
|
16926
|
-
|
|
16927
|
-
|
|
16928
|
-
|
|
16929
|
-
);
|
|
16930
|
-
} else {
|
|
16931
|
-
this._aborter = () => {
|
|
16932
|
-
img.setAttribute("src", leafletSrcExports.Util.emptyImageUrl);
|
|
16933
|
-
};
|
|
16934
|
-
}
|
|
17019
|
+
img.src = "";
|
|
17020
|
+
imageQueue.add(() => {
|
|
17021
|
+
const [promise, abortFunc] = callAjax(img.src, headers);
|
|
17022
|
+
promise.then((imgUrl) => {
|
|
17023
|
+
img.src = imgUrl;
|
|
17024
|
+
});
|
|
17025
|
+
this._aborter = abortFunc;
|
|
17026
|
+
return promise;
|
|
17027
|
+
});
|
|
16935
17028
|
}
|
|
16936
17029
|
}
|
|
16937
17030
|
|
|
@@ -17174,6 +17267,7 @@ class ImageAdapter extends BaseAdapter {
|
|
|
17174
17267
|
}
|
|
17175
17268
|
}
|
|
17176
17269
|
}
|
|
17270
|
+
__publicField$B(ImageAdapter, "queue", imageQueue);
|
|
17177
17271
|
|
|
17178
17272
|
function makeRemote(Base) {
|
|
17179
17273
|
return class RemoteTileLayer extends Base {
|
|
@@ -17188,15 +17282,16 @@ function makeRemote(Base) {
|
|
|
17188
17282
|
createTile(coords, done) {
|
|
17189
17283
|
const url = this.getTileUrl(coords);
|
|
17190
17284
|
const tile = document.createElement("img");
|
|
17191
|
-
|
|
17285
|
+
const [promise, abortFunc] = callAjax(
|
|
17192
17286
|
url,
|
|
17193
|
-
(response) => {
|
|
17194
|
-
tile.src = response;
|
|
17195
|
-
done(null, tile);
|
|
17196
|
-
},
|
|
17197
17287
|
// @ts-ignore
|
|
17198
17288
|
this.options.headers
|
|
17199
17289
|
);
|
|
17290
|
+
promise.then((response) => {
|
|
17291
|
+
tile.src = response;
|
|
17292
|
+
done(null, tile);
|
|
17293
|
+
});
|
|
17294
|
+
tile.abort = abortFunc;
|
|
17200
17295
|
if (this.options.crossOrigin || this.options.crossOrigin === "") {
|
|
17201
17296
|
tile.crossOrigin = this.options.crossOrigin === true ? "" : this.options.crossOrigin;
|
|
17202
17297
|
}
|
|
@@ -17705,6 +17800,12 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
|
|
|
17705
17800
|
for (const e of this._universalEvents) {
|
|
17706
17801
|
map.on(e, () => this.emitter.emit(e, this), map);
|
|
17707
17802
|
}
|
|
17803
|
+
map.on("movestart", () => {
|
|
17804
|
+
ImageAdapter.queue.abort();
|
|
17805
|
+
});
|
|
17806
|
+
map.on("zoomstart", () => {
|
|
17807
|
+
ImageAdapter.queue.abort();
|
|
17808
|
+
});
|
|
17708
17809
|
for (const e of this._positionEvents) {
|
|
17709
17810
|
map.on(
|
|
17710
17811
|
e,
|