@nextgis/leaflet-map-adapter 2.3.0 → 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 +33 -16
- 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 +33 -16
- 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 +33 -16
- 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 domain;
|
|
3
3
|
|
|
4
4
|
// This constructor is used to store event handlers. Instantiating this is
|
|
@@ -14948,7 +14948,7 @@ var __objRest$2 = (source, exclude) => {
|
|
|
14948
14948
|
}
|
|
14949
14949
|
return target;
|
|
14950
14950
|
};
|
|
14951
|
-
var __publicField$6 = (obj, key, value) => __defNormalProp$9(obj,
|
|
14951
|
+
var __publicField$6 = (obj, key, value) => __defNormalProp$9(obj, key + "" , value);
|
|
14952
14952
|
class GeoJsonPaint {
|
|
14953
14953
|
constructor(layer) {
|
|
14954
14954
|
__publicField$6(this, "layer");
|
|
@@ -15655,7 +15655,11 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
15655
15655
|
}
|
|
15656
15656
|
}
|
|
15657
15657
|
|
|
15658
|
-
function callAjax(
|
|
15658
|
+
function callAjax({
|
|
15659
|
+
src,
|
|
15660
|
+
headers,
|
|
15661
|
+
withCredentials
|
|
15662
|
+
}) {
|
|
15659
15663
|
let abortFunc = () => {
|
|
15660
15664
|
};
|
|
15661
15665
|
const promise = new Promise((resolve, reject) => {
|
|
@@ -15665,6 +15669,9 @@ function callAjax(src, headers) {
|
|
|
15665
15669
|
for (const h in headers) {
|
|
15666
15670
|
xhr.setRequestHeader(h, headers[h]);
|
|
15667
15671
|
}
|
|
15672
|
+
if (withCredentials) {
|
|
15673
|
+
xhr.withCredentials = withCredentials;
|
|
15674
|
+
}
|
|
15668
15675
|
xhr.onload = function() {
|
|
15669
15676
|
const arrayBufferView = new Uint8Array(this.response);
|
|
15670
15677
|
const blob = new Blob([arrayBufferView], { type: "image/png" });
|
|
@@ -15773,7 +15780,7 @@ const imageQueue = new Queue({ concurrency: 6, delay: 200 });
|
|
|
15773
15780
|
|
|
15774
15781
|
var __defProp$6 = Object.defineProperty;
|
|
15775
15782
|
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15776
|
-
var __publicField$3 = (obj, key, value) => __defNormalProp$6(obj,
|
|
15783
|
+
var __publicField$3 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
|
|
15777
15784
|
class ImageOverlay extends leafletSrcExports.ImageOverlay {
|
|
15778
15785
|
constructor(imageUrl, bounds, options) {
|
|
15779
15786
|
super(imageUrl, bounds, options);
|
|
@@ -15787,12 +15794,16 @@ class ImageOverlay extends leafletSrcExports.ImageOverlay {
|
|
|
15787
15794
|
}
|
|
15788
15795
|
_initImage() {
|
|
15789
15796
|
super._initImage();
|
|
15790
|
-
const headers = this.options
|
|
15797
|
+
const { headers, withCredentials } = this.options;
|
|
15791
15798
|
const img = this._image;
|
|
15792
15799
|
const src = img.src;
|
|
15793
15800
|
img.src = "";
|
|
15794
15801
|
imageQueue.add(() => {
|
|
15795
|
-
const [promise, abortFunc] = callAjax(
|
|
15802
|
+
const [promise, abortFunc] = callAjax({
|
|
15803
|
+
src,
|
|
15804
|
+
headers,
|
|
15805
|
+
withCredentials
|
|
15806
|
+
});
|
|
15796
15807
|
promise.then((imgUrl) => {
|
|
15797
15808
|
img.src = imgUrl;
|
|
15798
15809
|
});
|
|
@@ -15826,6 +15837,7 @@ class ImageLayer extends leafletSrcExports.Layer {
|
|
|
15826
15837
|
minZoom: 0,
|
|
15827
15838
|
pane: "tilePane",
|
|
15828
15839
|
headers: null,
|
|
15840
|
+
withCredentials: false,
|
|
15829
15841
|
viewPortBuffer: 0,
|
|
15830
15842
|
setViewDelay: 100
|
|
15831
15843
|
});
|
|
@@ -15895,7 +15907,8 @@ class ImageLayer extends leafletSrcExports.Layer {
|
|
|
15895
15907
|
const overlay = new ImageOverlay(url, bounds, {
|
|
15896
15908
|
opacity: 0,
|
|
15897
15909
|
pane: this.options.pane,
|
|
15898
|
-
headers: this.options.headers
|
|
15910
|
+
headers: this.options.headers,
|
|
15911
|
+
withCredentials: this.options.withCredentials
|
|
15899
15912
|
});
|
|
15900
15913
|
overlay.addTo(this._map);
|
|
15901
15914
|
this._loadedOverlay = overlay;
|
|
@@ -16048,13 +16061,13 @@ function makeRemote(Base) {
|
|
|
16048
16061
|
}
|
|
16049
16062
|
}
|
|
16050
16063
|
createTile(coords, done) {
|
|
16051
|
-
const
|
|
16064
|
+
const src = this.getTileUrl(coords);
|
|
16052
16065
|
const tile = document.createElement("img");
|
|
16053
|
-
const [promise, abortFunc] = callAjax(
|
|
16054
|
-
|
|
16055
|
-
|
|
16056
|
-
this.options.headers
|
|
16057
|
-
);
|
|
16066
|
+
const [promise, abortFunc] = callAjax({
|
|
16067
|
+
src,
|
|
16068
|
+
withCredentials: this.options.withCredentials,
|
|
16069
|
+
headers: this.options.headers
|
|
16070
|
+
});
|
|
16058
16071
|
promise.then((response) => {
|
|
16059
16072
|
tile.src = response;
|
|
16060
16073
|
done(null, tile);
|
|
@@ -16144,9 +16157,10 @@ class TileAdapter extends BaseAdapter {
|
|
|
16144
16157
|
tileLayerOptions.subdomains = opt.subdomains;
|
|
16145
16158
|
}
|
|
16146
16159
|
let layer;
|
|
16147
|
-
if (opt.headers) {
|
|
16160
|
+
if (opt.headers || opt.withCredentials) {
|
|
16148
16161
|
layer = new TileLayer(url, __spreadProps$2(__spreadValues$3({}, tileLayerOptions), {
|
|
16149
16162
|
headers: opt.headers,
|
|
16163
|
+
withCredentials: opt.withCredentials,
|
|
16150
16164
|
setViewDelay: opt.setViewDelay
|
|
16151
16165
|
}));
|
|
16152
16166
|
} else {
|
|
@@ -16252,8 +16266,11 @@ class WmsAdapter extends BaseAdapter {
|
|
|
16252
16266
|
transparent: true
|
|
16253
16267
|
}, options.nativeOptions);
|
|
16254
16268
|
let layer;
|
|
16255
|
-
if (opt.headers) {
|
|
16256
|
-
layer = new WmsLayer(url, __spreadProps(__spreadValues$1({}, layerOptions), {
|
|
16269
|
+
if (opt.headers || opt.withCredentials) {
|
|
16270
|
+
layer = new WmsLayer(url, __spreadProps(__spreadValues$1({}, layerOptions), {
|
|
16271
|
+
headers: opt.headers,
|
|
16272
|
+
withCredentials: opt.withCredentials
|
|
16273
|
+
}));
|
|
16257
16274
|
} else {
|
|
16258
16275
|
layer = new leafletSrcExports.TileLayer.WMS(url, layerOptions);
|
|
16259
16276
|
}
|