@nextgis/leaflet-map-adapter 2.2.3 → 2.5.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.
- package/lib/leaflet-map-adapter.esm-browser.js +44 -57
- package/lib/leaflet-map-adapter.esm-browser.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-browser.prod.js +1 -1
- package/lib/leaflet-map-adapter.esm-browser.prod.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-bundler.js +43 -53
- package/lib/leaflet-map-adapter.esm-bundler.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-bundler.prod.js +1 -1
- package/lib/leaflet-map-adapter.esm-bundler.prod.js.map +1 -1
- package/lib/leaflet-map-adapter.global.js +44 -57
- package/lib/leaflet-map-adapter.global.js.map +1 -1
- package/lib/leaflet-map-adapter.global.prod.js +1 -1
- package/lib/leaflet-map-adapter.global.prod.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/leaflet-map-adapter; version: 2.
|
|
1
|
+
/** Bundle of @nextgis/leaflet-map-adapter; version: 2.5.0; author: NextGIS */
|
|
2
2
|
var LeafletMapAdapter = (function () {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -14761,10 +14761,7 @@ var LeafletMapAdapter = (function () {
|
|
|
14761
14761
|
|
|
14762
14762
|
var __defProp$c = Object.defineProperty;
|
|
14763
14763
|
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14764
|
-
var __publicField$8 = (obj, key, value) =>
|
|
14765
|
-
__defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14766
|
-
return value;
|
|
14767
|
-
};
|
|
14764
|
+
var __publicField$8 = (obj, key, value) => __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14768
14765
|
class BaseAdapter {
|
|
14769
14766
|
constructor(map, options) {
|
|
14770
14767
|
this.map = map;
|
|
@@ -14846,10 +14843,7 @@ var LeafletMapAdapter = (function () {
|
|
|
14846
14843
|
}
|
|
14847
14844
|
return a;
|
|
14848
14845
|
};
|
|
14849
|
-
var __publicField$7 = (obj, key, value) =>
|
|
14850
|
-
__defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14851
|
-
return value;
|
|
14852
|
-
};
|
|
14846
|
+
var __publicField$7 = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14853
14847
|
class GeoJsonEvents {
|
|
14854
14848
|
constructor(layer) {
|
|
14855
14849
|
__publicField$7(this, "layer");
|
|
@@ -14957,10 +14951,7 @@ var LeafletMapAdapter = (function () {
|
|
|
14957
14951
|
}
|
|
14958
14952
|
return target;
|
|
14959
14953
|
};
|
|
14960
|
-
var __publicField$6 = (obj, key, value) =>
|
|
14961
|
-
__defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14962
|
-
return value;
|
|
14963
|
-
};
|
|
14954
|
+
var __publicField$6 = (obj, key, value) => __defNormalProp$9(obj, key + "" , value);
|
|
14964
14955
|
class GeoJsonPaint {
|
|
14965
14956
|
constructor(layer) {
|
|
14966
14957
|
__publicField$6(this, "layer");
|
|
@@ -15109,10 +15100,7 @@ var LeafletMapAdapter = (function () {
|
|
|
15109
15100
|
return a;
|
|
15110
15101
|
};
|
|
15111
15102
|
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
15112
|
-
var __publicField$5 = (obj, key, value) =>
|
|
15113
|
-
__defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15114
|
-
return value;
|
|
15115
|
-
};
|
|
15103
|
+
var __publicField$5 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15116
15104
|
var __async = (__this, __arguments, generator) => {
|
|
15117
15105
|
return new Promise((resolve, reject) => {
|
|
15118
15106
|
var fulfilled = (value) => {
|
|
@@ -15670,7 +15658,11 @@ var LeafletMapAdapter = (function () {
|
|
|
15670
15658
|
}
|
|
15671
15659
|
}
|
|
15672
15660
|
|
|
15673
|
-
function callAjax(
|
|
15661
|
+
function callAjax({
|
|
15662
|
+
src,
|
|
15663
|
+
headers,
|
|
15664
|
+
withCredentials
|
|
15665
|
+
}) {
|
|
15674
15666
|
let abortFunc = () => {
|
|
15675
15667
|
};
|
|
15676
15668
|
const promise = new Promise((resolve, reject) => {
|
|
@@ -15680,6 +15672,9 @@ var LeafletMapAdapter = (function () {
|
|
|
15680
15672
|
for (const h in headers) {
|
|
15681
15673
|
xhr.setRequestHeader(h, headers[h]);
|
|
15682
15674
|
}
|
|
15675
|
+
if (withCredentials) {
|
|
15676
|
+
xhr.withCredentials = withCredentials;
|
|
15677
|
+
}
|
|
15683
15678
|
xhr.onload = function() {
|
|
15684
15679
|
const arrayBufferView = new Uint8Array(this.response);
|
|
15685
15680
|
const blob = new Blob([arrayBufferView], { type: "image/png" });
|
|
@@ -15699,10 +15694,7 @@ var LeafletMapAdapter = (function () {
|
|
|
15699
15694
|
|
|
15700
15695
|
var __defProp$7 = Object.defineProperty;
|
|
15701
15696
|
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15702
|
-
var __publicField$4 = (obj, key, value) =>
|
|
15703
|
-
__defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15704
|
-
return value;
|
|
15705
|
-
};
|
|
15697
|
+
var __publicField$4 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15706
15698
|
class Queue {
|
|
15707
15699
|
/**
|
|
15708
15700
|
* @param {PromiseQueueOptions} options - Configuration options for the queue.
|
|
@@ -15788,14 +15780,10 @@ var LeafletMapAdapter = (function () {
|
|
|
15788
15780
|
}
|
|
15789
15781
|
|
|
15790
15782
|
const imageQueue = new Queue({ concurrency: 6, delay: 200 });
|
|
15791
|
-
var imageQueue$1 = imageQueue;
|
|
15792
15783
|
|
|
15793
15784
|
var __defProp$6 = Object.defineProperty;
|
|
15794
15785
|
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15795
|
-
var __publicField$3 = (obj, key, value) =>
|
|
15796
|
-
__defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15797
|
-
return value;
|
|
15798
|
-
};
|
|
15786
|
+
var __publicField$3 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
|
|
15799
15787
|
class ImageOverlay extends leafletSrcExports.ImageOverlay {
|
|
15800
15788
|
constructor(imageUrl, bounds, options) {
|
|
15801
15789
|
super(imageUrl, bounds, options);
|
|
@@ -15809,12 +15797,16 @@ var LeafletMapAdapter = (function () {
|
|
|
15809
15797
|
}
|
|
15810
15798
|
_initImage() {
|
|
15811
15799
|
super._initImage();
|
|
15812
|
-
const headers = this.options
|
|
15800
|
+
const { headers, withCredentials } = this.options;
|
|
15813
15801
|
const img = this._image;
|
|
15814
15802
|
const src = img.src;
|
|
15815
15803
|
img.src = "";
|
|
15816
|
-
imageQueue
|
|
15817
|
-
const [promise, abortFunc] = callAjax(
|
|
15804
|
+
imageQueue.add(() => {
|
|
15805
|
+
const [promise, abortFunc] = callAjax({
|
|
15806
|
+
src,
|
|
15807
|
+
headers,
|
|
15808
|
+
withCredentials
|
|
15809
|
+
});
|
|
15818
15810
|
promise.then((imgUrl) => {
|
|
15819
15811
|
img.src = imgUrl;
|
|
15820
15812
|
});
|
|
@@ -15826,10 +15818,7 @@ var LeafletMapAdapter = (function () {
|
|
|
15826
15818
|
|
|
15827
15819
|
var __defProp$5 = Object.defineProperty;
|
|
15828
15820
|
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15829
|
-
var __publicField$2 = (obj, key, value) =>
|
|
15830
|
-
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15831
|
-
return value;
|
|
15832
|
-
};
|
|
15821
|
+
var __publicField$2 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15833
15822
|
class ImageLayer extends leafletSrcExports.Layer {
|
|
15834
15823
|
constructor(url, options) {
|
|
15835
15824
|
super(options);
|
|
@@ -15851,6 +15840,7 @@ var LeafletMapAdapter = (function () {
|
|
|
15851
15840
|
minZoom: 0,
|
|
15852
15841
|
pane: "tilePane",
|
|
15853
15842
|
headers: null,
|
|
15843
|
+
withCredentials: false,
|
|
15854
15844
|
viewPortBuffer: 0,
|
|
15855
15845
|
setViewDelay: 100
|
|
15856
15846
|
});
|
|
@@ -15920,7 +15910,8 @@ var LeafletMapAdapter = (function () {
|
|
|
15920
15910
|
const overlay = new ImageOverlay(url, bounds, {
|
|
15921
15911
|
opacity: 0,
|
|
15922
15912
|
pane: this.options.pane,
|
|
15923
|
-
headers: this.options.headers
|
|
15913
|
+
headers: this.options.headers,
|
|
15914
|
+
withCredentials: this.options.withCredentials
|
|
15924
15915
|
});
|
|
15925
15916
|
overlay.addTo(this._map);
|
|
15926
15917
|
this._loadedOverlay = overlay;
|
|
@@ -16033,10 +16024,7 @@ var LeafletMapAdapter = (function () {
|
|
|
16033
16024
|
}
|
|
16034
16025
|
return a;
|
|
16035
16026
|
};
|
|
16036
|
-
var __publicField$1 = (obj, key, value) =>
|
|
16037
|
-
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
16038
|
-
return value;
|
|
16039
|
-
};
|
|
16027
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
16040
16028
|
class ImageAdapter extends BaseAdapter {
|
|
16041
16029
|
constructor() {
|
|
16042
16030
|
super(...arguments);
|
|
@@ -16063,7 +16051,7 @@ var LeafletMapAdapter = (function () {
|
|
|
16063
16051
|
}
|
|
16064
16052
|
}
|
|
16065
16053
|
}
|
|
16066
|
-
__publicField$1(ImageAdapter, "queue", imageQueue
|
|
16054
|
+
__publicField$1(ImageAdapter, "queue", imageQueue);
|
|
16067
16055
|
|
|
16068
16056
|
function makeRemote(Base) {
|
|
16069
16057
|
return class RemoteTileLayer extends Base {
|
|
@@ -16076,13 +16064,13 @@ var LeafletMapAdapter = (function () {
|
|
|
16076
16064
|
}
|
|
16077
16065
|
}
|
|
16078
16066
|
createTile(coords, done) {
|
|
16079
|
-
const
|
|
16067
|
+
const src = this.getTileUrl(coords);
|
|
16080
16068
|
const tile = document.createElement("img");
|
|
16081
|
-
const [promise, abortFunc] = callAjax(
|
|
16082
|
-
|
|
16083
|
-
|
|
16084
|
-
this.options.headers
|
|
16085
|
-
);
|
|
16069
|
+
const [promise, abortFunc] = callAjax({
|
|
16070
|
+
src,
|
|
16071
|
+
withCredentials: this.options.withCredentials,
|
|
16072
|
+
headers: this.options.headers
|
|
16073
|
+
});
|
|
16086
16074
|
promise.then((response) => {
|
|
16087
16075
|
tile.src = response;
|
|
16088
16076
|
done(null, tile);
|
|
@@ -16172,9 +16160,10 @@ var LeafletMapAdapter = (function () {
|
|
|
16172
16160
|
tileLayerOptions.subdomains = opt.subdomains;
|
|
16173
16161
|
}
|
|
16174
16162
|
let layer;
|
|
16175
|
-
if (opt.headers) {
|
|
16163
|
+
if (opt.headers || opt.withCredentials) {
|
|
16176
16164
|
layer = new TileLayer(url, __spreadProps$2(__spreadValues$3({}, tileLayerOptions), {
|
|
16177
16165
|
headers: opt.headers,
|
|
16166
|
+
withCredentials: opt.withCredentials,
|
|
16178
16167
|
setViewDelay: opt.setViewDelay
|
|
16179
16168
|
}));
|
|
16180
16169
|
} else {
|
|
@@ -16280,8 +16269,11 @@ var LeafletMapAdapter = (function () {
|
|
|
16280
16269
|
transparent: true
|
|
16281
16270
|
}, options.nativeOptions);
|
|
16282
16271
|
let layer;
|
|
16283
|
-
if (opt.headers) {
|
|
16284
|
-
layer = new WmsLayer(url, __spreadProps(__spreadValues$1({}, layerOptions), {
|
|
16272
|
+
if (opt.headers || opt.withCredentials) {
|
|
16273
|
+
layer = new WmsLayer(url, __spreadProps(__spreadValues$1({}, layerOptions), {
|
|
16274
|
+
headers: opt.headers,
|
|
16275
|
+
withCredentials: opt.withCredentials
|
|
16276
|
+
}));
|
|
16285
16277
|
} else {
|
|
16286
16278
|
layer = new leafletSrcExports.TileLayer.WMS(url, layerOptions);
|
|
16287
16279
|
}
|
|
@@ -16314,10 +16306,7 @@ var LeafletMapAdapter = (function () {
|
|
|
16314
16306
|
}
|
|
16315
16307
|
return a;
|
|
16316
16308
|
};
|
|
16317
|
-
var __publicField = (obj, key, value) =>
|
|
16318
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
16319
|
-
return value;
|
|
16320
|
-
};
|
|
16309
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
16321
16310
|
const _LeafletMapAdapter = class _LeafletMapAdapter {
|
|
16322
16311
|
constructor() {
|
|
16323
16312
|
__publicField(this, "options", { target: "map" });
|
|
@@ -16395,8 +16384,7 @@ var LeafletMapAdapter = (function () {
|
|
|
16395
16384
|
}
|
|
16396
16385
|
setView(lngLatOrOpt, zoom) {
|
|
16397
16386
|
const map = this.map;
|
|
16398
|
-
if (!map)
|
|
16399
|
-
return;
|
|
16387
|
+
if (!map) return;
|
|
16400
16388
|
if (Array.isArray(lngLatOrOpt)) {
|
|
16401
16389
|
const lngLat = lngLatOrOpt;
|
|
16402
16390
|
const [lng, lat] = lngLat;
|
|
@@ -16464,8 +16452,7 @@ var LeafletMapAdapter = (function () {
|
|
|
16464
16452
|
return (_a = this.map && this.map.getZoom()) != null ? _a : void 0;
|
|
16465
16453
|
}
|
|
16466
16454
|
getBounds() {
|
|
16467
|
-
if (!this.map)
|
|
16468
|
-
return void 0;
|
|
16455
|
+
if (!this.map) return void 0;
|
|
16469
16456
|
const b = this.map.getBounds();
|
|
16470
16457
|
const sw = b.getSouthWest();
|
|
16471
16458
|
const ne = b.getNorthEast();
|