@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 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
|
});
|
|
@@ -15809,13 +15820,7 @@ class ImageLayer extends leafletSrcExports.Layer {
|
|
|
15809
15820
|
constructor(url, options) {
|
|
15810
15821
|
super(options);
|
|
15811
15822
|
__publicField$2(this, "defaultWmsParams", {
|
|
15812
|
-
|
|
15813
|
-
request: "GetMap",
|
|
15814
|
-
version: "1.1.1",
|
|
15815
|
-
layers: "",
|
|
15816
|
-
styles: "",
|
|
15817
|
-
format: "image/jpeg",
|
|
15818
|
-
transparent: false
|
|
15823
|
+
request: "GetMap"
|
|
15819
15824
|
});
|
|
15820
15825
|
__publicField$2(this, "options", {
|
|
15821
15826
|
crs: null,
|
|
@@ -15826,6 +15831,7 @@ class ImageLayer extends leafletSrcExports.Layer {
|
|
|
15826
15831
|
minZoom: 0,
|
|
15827
15832
|
pane: "tilePane",
|
|
15828
15833
|
headers: null,
|
|
15834
|
+
withCredentials: false,
|
|
15829
15835
|
viewPortBuffer: 0,
|
|
15830
15836
|
setViewDelay: 100
|
|
15831
15837
|
});
|
|
@@ -15895,7 +15901,8 @@ class ImageLayer extends leafletSrcExports.Layer {
|
|
|
15895
15901
|
const overlay = new ImageOverlay(url, bounds, {
|
|
15896
15902
|
opacity: 0,
|
|
15897
15903
|
pane: this.options.pane,
|
|
15898
|
-
headers: this.options.headers
|
|
15904
|
+
headers: this.options.headers,
|
|
15905
|
+
withCredentials: this.options.withCredentials
|
|
15899
15906
|
});
|
|
15900
15907
|
overlay.addTo(this._map);
|
|
15901
15908
|
this._loadedOverlay = overlay;
|
|
@@ -15970,9 +15977,7 @@ class ImageLayer extends leafletSrcExports.Layer {
|
|
|
15970
15977
|
size.x = Math.ceil(size.x * factor);
|
|
15971
15978
|
size.y = Math.ceil(size.y * factor);
|
|
15972
15979
|
}
|
|
15973
|
-
const wmsVersion = parseFloat(this.wmsParams.version);
|
|
15974
15980
|
const crs = this.options.crs || map.options.crs;
|
|
15975
|
-
const projectionKey = wmsVersion >= 1.3 ? "crs" : "srs";
|
|
15976
15981
|
if (crs) {
|
|
15977
15982
|
const nw = crs.project(bounds.getNorthWest());
|
|
15978
15983
|
const se = crs.project(bounds.getSouthEast());
|
|
@@ -15980,8 +15985,7 @@ class ImageLayer extends leafletSrcExports.Layer {
|
|
|
15980
15985
|
width: size.x,
|
|
15981
15986
|
height: size.y
|
|
15982
15987
|
};
|
|
15983
|
-
params
|
|
15984
|
-
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(",");
|
|
15988
|
+
params.bbox = [nw.x, se.y, se.x, nw.y];
|
|
15985
15989
|
leafletSrcExports.Util.extend(this.wmsParams, params);
|
|
15986
15990
|
}
|
|
15987
15991
|
}
|
|
@@ -16048,13 +16052,13 @@ function makeRemote(Base) {
|
|
|
16048
16052
|
}
|
|
16049
16053
|
}
|
|
16050
16054
|
createTile(coords, done) {
|
|
16051
|
-
const
|
|
16055
|
+
const src = this.getTileUrl(coords);
|
|
16052
16056
|
const tile = document.createElement("img");
|
|
16053
|
-
const [promise, abortFunc] = callAjax(
|
|
16054
|
-
|
|
16055
|
-
|
|
16056
|
-
this.options.headers
|
|
16057
|
-
);
|
|
16057
|
+
const [promise, abortFunc] = callAjax({
|
|
16058
|
+
src,
|
|
16059
|
+
withCredentials: this.options.withCredentials,
|
|
16060
|
+
headers: this.options.headers
|
|
16061
|
+
});
|
|
16058
16062
|
promise.then((response) => {
|
|
16059
16063
|
tile.src = response;
|
|
16060
16064
|
done(null, tile);
|
|
@@ -16144,9 +16148,10 @@ class TileAdapter extends BaseAdapter {
|
|
|
16144
16148
|
tileLayerOptions.subdomains = opt.subdomains;
|
|
16145
16149
|
}
|
|
16146
16150
|
let layer;
|
|
16147
|
-
if (opt.headers) {
|
|
16151
|
+
if (opt.headers || opt.withCredentials) {
|
|
16148
16152
|
layer = new TileLayer(url, __spreadProps$2(__spreadValues$3({}, tileLayerOptions), {
|
|
16149
16153
|
headers: opt.headers,
|
|
16154
|
+
withCredentials: opt.withCredentials,
|
|
16150
16155
|
setViewDelay: opt.setViewDelay
|
|
16151
16156
|
}));
|
|
16152
16157
|
} else {
|
|
@@ -16252,8 +16257,11 @@ class WmsAdapter extends BaseAdapter {
|
|
|
16252
16257
|
transparent: true
|
|
16253
16258
|
}, options.nativeOptions);
|
|
16254
16259
|
let layer;
|
|
16255
|
-
if (opt.headers) {
|
|
16256
|
-
layer = new WmsLayer(url, __spreadProps(__spreadValues$1({}, layerOptions), {
|
|
16260
|
+
if (opt.headers || opt.withCredentials) {
|
|
16261
|
+
layer = new WmsLayer(url, __spreadProps(__spreadValues$1({}, layerOptions), {
|
|
16262
|
+
headers: opt.headers,
|
|
16263
|
+
withCredentials: opt.withCredentials
|
|
16264
|
+
}));
|
|
16257
16265
|
} else {
|
|
16258
16266
|
layer = new leafletSrcExports.TileLayer.WMS(url, layerOptions);
|
|
16259
16267
|
}
|