@nextgis/leaflet-map-adapter 2.3.0 → 2.5.4
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 +35 -27
- 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 +36 -28
- 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 +35 -27
- 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.4; author: NextGIS */
|
|
2
2
|
var LeafletMapAdapter = (function () {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -14951,7 +14951,7 @@ var LeafletMapAdapter = (function () {
|
|
|
14951
14951
|
}
|
|
14952
14952
|
return target;
|
|
14953
14953
|
};
|
|
14954
|
-
var __publicField$6 = (obj, key, value) => __defNormalProp$9(obj,
|
|
14954
|
+
var __publicField$6 = (obj, key, value) => __defNormalProp$9(obj, key + "" , value);
|
|
14955
14955
|
class GeoJsonPaint {
|
|
14956
14956
|
constructor(layer) {
|
|
14957
14957
|
__publicField$6(this, "layer");
|
|
@@ -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" });
|
|
@@ -15776,7 +15783,7 @@ var LeafletMapAdapter = (function () {
|
|
|
15776
15783
|
|
|
15777
15784
|
var __defProp$6 = Object.defineProperty;
|
|
15778
15785
|
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15779
|
-
var __publicField$3 = (obj, key, value) => __defNormalProp$6(obj,
|
|
15786
|
+
var __publicField$3 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
|
|
15780
15787
|
class ImageOverlay extends leafletSrcExports.ImageOverlay {
|
|
15781
15788
|
constructor(imageUrl, bounds, options) {
|
|
15782
15789
|
super(imageUrl, bounds, options);
|
|
@@ -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
|
});
|
|
@@ -15812,13 +15823,7 @@ var LeafletMapAdapter = (function () {
|
|
|
15812
15823
|
constructor(url, options) {
|
|
15813
15824
|
super(options);
|
|
15814
15825
|
__publicField$2(this, "defaultWmsParams", {
|
|
15815
|
-
|
|
15816
|
-
request: "GetMap",
|
|
15817
|
-
version: "1.1.1",
|
|
15818
|
-
layers: "",
|
|
15819
|
-
styles: "",
|
|
15820
|
-
format: "image/jpeg",
|
|
15821
|
-
transparent: false
|
|
15826
|
+
request: "GetMap"
|
|
15822
15827
|
});
|
|
15823
15828
|
__publicField$2(this, "options", {
|
|
15824
15829
|
crs: null,
|
|
@@ -15829,6 +15834,7 @@ var LeafletMapAdapter = (function () {
|
|
|
15829
15834
|
minZoom: 0,
|
|
15830
15835
|
pane: "tilePane",
|
|
15831
15836
|
headers: null,
|
|
15837
|
+
withCredentials: false,
|
|
15832
15838
|
viewPortBuffer: 0,
|
|
15833
15839
|
setViewDelay: 100
|
|
15834
15840
|
});
|
|
@@ -15898,7 +15904,8 @@ var LeafletMapAdapter = (function () {
|
|
|
15898
15904
|
const overlay = new ImageOverlay(url, bounds, {
|
|
15899
15905
|
opacity: 0,
|
|
15900
15906
|
pane: this.options.pane,
|
|
15901
|
-
headers: this.options.headers
|
|
15907
|
+
headers: this.options.headers,
|
|
15908
|
+
withCredentials: this.options.withCredentials
|
|
15902
15909
|
});
|
|
15903
15910
|
overlay.addTo(this._map);
|
|
15904
15911
|
this._loadedOverlay = overlay;
|
|
@@ -15973,9 +15980,7 @@ var LeafletMapAdapter = (function () {
|
|
|
15973
15980
|
size.x = Math.ceil(size.x * factor);
|
|
15974
15981
|
size.y = Math.ceil(size.y * factor);
|
|
15975
15982
|
}
|
|
15976
|
-
const wmsVersion = parseFloat(this.wmsParams.version);
|
|
15977
15983
|
const crs = this.options.crs || map.options.crs;
|
|
15978
|
-
const projectionKey = wmsVersion >= 1.3 ? "crs" : "srs";
|
|
15979
15984
|
if (crs) {
|
|
15980
15985
|
const nw = crs.project(bounds.getNorthWest());
|
|
15981
15986
|
const se = crs.project(bounds.getSouthEast());
|
|
@@ -15983,8 +15988,7 @@ var LeafletMapAdapter = (function () {
|
|
|
15983
15988
|
width: size.x,
|
|
15984
15989
|
height: size.y
|
|
15985
15990
|
};
|
|
15986
|
-
params
|
|
15987
|
-
params.bbox = (wmsVersion >= 1.3 && crs === leafletSrcExports.CRS.EPSG4326 ? [se.y, nw.x, nw.y, se.x] : [nw.x, se.y, se.x, nw.y]).join(",");
|
|
15991
|
+
params.bbox = [nw.x, se.y, se.x, nw.y];
|
|
15988
15992
|
leafletSrcExports.Util.extend(this.wmsParams, params);
|
|
15989
15993
|
}
|
|
15990
15994
|
}
|
|
@@ -16051,13 +16055,13 @@ var LeafletMapAdapter = (function () {
|
|
|
16051
16055
|
}
|
|
16052
16056
|
}
|
|
16053
16057
|
createTile(coords, done) {
|
|
16054
|
-
const
|
|
16058
|
+
const src = this.getTileUrl(coords);
|
|
16055
16059
|
const tile = document.createElement("img");
|
|
16056
|
-
const [promise, abortFunc] = callAjax(
|
|
16057
|
-
|
|
16058
|
-
|
|
16059
|
-
this.options.headers
|
|
16060
|
-
);
|
|
16060
|
+
const [promise, abortFunc] = callAjax({
|
|
16061
|
+
src,
|
|
16062
|
+
withCredentials: this.options.withCredentials,
|
|
16063
|
+
headers: this.options.headers
|
|
16064
|
+
});
|
|
16061
16065
|
promise.then((response) => {
|
|
16062
16066
|
tile.src = response;
|
|
16063
16067
|
done(null, tile);
|
|
@@ -16147,9 +16151,10 @@ var LeafletMapAdapter = (function () {
|
|
|
16147
16151
|
tileLayerOptions.subdomains = opt.subdomains;
|
|
16148
16152
|
}
|
|
16149
16153
|
let layer;
|
|
16150
|
-
if (opt.headers) {
|
|
16154
|
+
if (opt.headers || opt.withCredentials) {
|
|
16151
16155
|
layer = new TileLayer(url, __spreadProps$2(__spreadValues$3({}, tileLayerOptions), {
|
|
16152
16156
|
headers: opt.headers,
|
|
16157
|
+
withCredentials: opt.withCredentials,
|
|
16153
16158
|
setViewDelay: opt.setViewDelay
|
|
16154
16159
|
}));
|
|
16155
16160
|
} else {
|
|
@@ -16255,8 +16260,11 @@ var LeafletMapAdapter = (function () {
|
|
|
16255
16260
|
transparent: true
|
|
16256
16261
|
}, options.nativeOptions);
|
|
16257
16262
|
let layer;
|
|
16258
|
-
if (opt.headers) {
|
|
16259
|
-
layer = new WmsLayer(url, __spreadProps(__spreadValues$1({}, layerOptions), {
|
|
16263
|
+
if (opt.headers || opt.withCredentials) {
|
|
16264
|
+
layer = new WmsLayer(url, __spreadProps(__spreadValues$1({}, layerOptions), {
|
|
16265
|
+
headers: opt.headers,
|
|
16266
|
+
withCredentials: opt.withCredentials
|
|
16267
|
+
}));
|
|
16260
16268
|
} else {
|
|
16261
16269
|
layer = new leafletSrcExports.TileLayer.WMS(url, layerOptions);
|
|
16262
16270
|
}
|