@nextgis/leaflet-map-adapter 3.0.0-alpha.0 → 3.0.0-alpha.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/leaflet-map-adapter.esm-browser.js +31 -14
- 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 +31 -14
- 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 +31 -14
- 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: 3.0.0-alpha.
|
|
1
|
+
/** Bundle of @nextgis/leaflet-map-adapter; version: 3.0.0-alpha.1; author: NextGIS */
|
|
2
2
|
var LeafletMapAdapter = (function () {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -15658,7 +15658,11 @@ var LeafletMapAdapter = (function () {
|
|
|
15658
15658
|
}
|
|
15659
15659
|
}
|
|
15660
15660
|
|
|
15661
|
-
function callAjax(
|
|
15661
|
+
function callAjax({
|
|
15662
|
+
src,
|
|
15663
|
+
headers,
|
|
15664
|
+
withCredentials
|
|
15665
|
+
}) {
|
|
15662
15666
|
let abortFunc = () => {
|
|
15663
15667
|
};
|
|
15664
15668
|
const promise = new Promise((resolve, reject) => {
|
|
@@ -15668,6 +15672,9 @@ var LeafletMapAdapter = (function () {
|
|
|
15668
15672
|
for (const h in headers) {
|
|
15669
15673
|
xhr.setRequestHeader(h, headers[h]);
|
|
15670
15674
|
}
|
|
15675
|
+
if (withCredentials) {
|
|
15676
|
+
xhr.withCredentials = withCredentials;
|
|
15677
|
+
}
|
|
15671
15678
|
xhr.onload = function() {
|
|
15672
15679
|
const arrayBufferView = new Uint8Array(this.response);
|
|
15673
15680
|
const blob = new Blob([arrayBufferView], { type: "image/png" });
|
|
@@ -15790,12 +15797,16 @@ var LeafletMapAdapter = (function () {
|
|
|
15790
15797
|
}
|
|
15791
15798
|
_initImage() {
|
|
15792
15799
|
super._initImage();
|
|
15793
|
-
const headers = this.options
|
|
15800
|
+
const { headers, withCredentials } = this.options;
|
|
15794
15801
|
const img = this._image;
|
|
15795
15802
|
const src = img.src;
|
|
15796
15803
|
img.src = "";
|
|
15797
15804
|
imageQueue.add(() => {
|
|
15798
|
-
const [promise, abortFunc] = callAjax(
|
|
15805
|
+
const [promise, abortFunc] = callAjax({
|
|
15806
|
+
src,
|
|
15807
|
+
headers,
|
|
15808
|
+
withCredentials
|
|
15809
|
+
});
|
|
15799
15810
|
promise.then((imgUrl) => {
|
|
15800
15811
|
img.src = imgUrl;
|
|
15801
15812
|
});
|
|
@@ -15829,6 +15840,7 @@ var LeafletMapAdapter = (function () {
|
|
|
15829
15840
|
minZoom: 0,
|
|
15830
15841
|
pane: "tilePane",
|
|
15831
15842
|
headers: null,
|
|
15843
|
+
withCredentials: false,
|
|
15832
15844
|
viewPortBuffer: 0,
|
|
15833
15845
|
setViewDelay: 100
|
|
15834
15846
|
});
|
|
@@ -15898,7 +15910,8 @@ var LeafletMapAdapter = (function () {
|
|
|
15898
15910
|
const overlay = new ImageOverlay(url, bounds, {
|
|
15899
15911
|
opacity: 0,
|
|
15900
15912
|
pane: this.options.pane,
|
|
15901
|
-
headers: this.options.headers
|
|
15913
|
+
headers: this.options.headers,
|
|
15914
|
+
withCredentials: this.options.withCredentials
|
|
15902
15915
|
});
|
|
15903
15916
|
overlay.addTo(this._map);
|
|
15904
15917
|
this._loadedOverlay = overlay;
|
|
@@ -16051,13 +16064,13 @@ var LeafletMapAdapter = (function () {
|
|
|
16051
16064
|
}
|
|
16052
16065
|
}
|
|
16053
16066
|
createTile(coords, done) {
|
|
16054
|
-
const
|
|
16067
|
+
const src = this.getTileUrl(coords);
|
|
16055
16068
|
const tile = document.createElement("img");
|
|
16056
|
-
const [promise, abortFunc] = callAjax(
|
|
16057
|
-
|
|
16058
|
-
|
|
16059
|
-
this.options.headers
|
|
16060
|
-
);
|
|
16069
|
+
const [promise, abortFunc] = callAjax({
|
|
16070
|
+
src,
|
|
16071
|
+
withCredentials: this.options.withCredentials,
|
|
16072
|
+
headers: this.options.headers
|
|
16073
|
+
});
|
|
16061
16074
|
promise.then((response) => {
|
|
16062
16075
|
tile.src = response;
|
|
16063
16076
|
done(null, tile);
|
|
@@ -16147,9 +16160,10 @@ var LeafletMapAdapter = (function () {
|
|
|
16147
16160
|
tileLayerOptions.subdomains = opt.subdomains;
|
|
16148
16161
|
}
|
|
16149
16162
|
let layer;
|
|
16150
|
-
if (opt.headers) {
|
|
16163
|
+
if (opt.headers || opt.withCredentials) {
|
|
16151
16164
|
layer = new TileLayer(url, __spreadProps$2(__spreadValues$3({}, tileLayerOptions), {
|
|
16152
16165
|
headers: opt.headers,
|
|
16166
|
+
withCredentials: opt.withCredentials,
|
|
16153
16167
|
setViewDelay: opt.setViewDelay
|
|
16154
16168
|
}));
|
|
16155
16169
|
} else {
|
|
@@ -16255,8 +16269,11 @@ var LeafletMapAdapter = (function () {
|
|
|
16255
16269
|
transparent: true
|
|
16256
16270
|
}, options.nativeOptions);
|
|
16257
16271
|
let layer;
|
|
16258
|
-
if (opt.headers) {
|
|
16259
|
-
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
|
+
}));
|
|
16260
16277
|
} else {
|
|
16261
16278
|
layer = new leafletSrcExports.TileLayer.WMS(url, layerOptions);
|
|
16262
16279
|
}
|