@nextgis/leaflet-map-adapter 2.0.0 → 2.1.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/README.md +1 -3
- package/lib/index.d.ts +1 -0
- package/lib/leaflet-map-adapter.esm-browser.js +40 -12
- 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 +41 -13
- 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 +40 -12
- 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 +9 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/leaflet-map-adapter; version: 2.
|
|
1
|
+
/** Bundle of @nextgis/leaflet-map-adapter; version: 2.1.0; author: NextGIS */
|
|
2
2
|
var LeafletMapAdapter = (function () {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -16069,6 +16069,16 @@ var LeafletMapAdapter = (function () {
|
|
|
16069
16069
|
}
|
|
16070
16070
|
}
|
|
16071
16071
|
}
|
|
16072
|
+
updateLayer() {
|
|
16073
|
+
if (this.layer) {
|
|
16074
|
+
const currentUrl = this.layer._url;
|
|
16075
|
+
const timestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
16076
|
+
const separator = currentUrl.includes("?") ? "&" : "?";
|
|
16077
|
+
const newUrl = currentUrl.replace(/(\?|&)timestamp=\d*/g, "") + separator + `timestamp=${timestamp}`;
|
|
16078
|
+
this.layer.setUrl(newUrl);
|
|
16079
|
+
this.layer.redraw();
|
|
16080
|
+
}
|
|
16081
|
+
}
|
|
16072
16082
|
}
|
|
16073
16083
|
|
|
16074
16084
|
var __defProp$2 = Object.defineProperty;
|
|
@@ -16236,6 +16246,8 @@ var LeafletMapAdapter = (function () {
|
|
|
16236
16246
|
center: center && [center[1], center[0]],
|
|
16237
16247
|
zoom
|
|
16238
16248
|
}, mapAdapterOptions));
|
|
16249
|
+
this._updateMinZoomForBounds(minZoom);
|
|
16250
|
+
this._watchSizeChangeToUpdateMinZoom();
|
|
16239
16251
|
const defPane = this.map.createPane("order-0");
|
|
16240
16252
|
this.map._addUnselectCb = (def) => {
|
|
16241
16253
|
this._addUnselectCb(def);
|
|
@@ -16299,19 +16311,17 @@ var LeafletMapAdapter = (function () {
|
|
|
16299
16311
|
if (maxBounds) {
|
|
16300
16312
|
const b = arrayToBoundsExpression(maxBounds);
|
|
16301
16313
|
map.setMaxBounds(b);
|
|
16302
|
-
|
|
16303
|
-
this._watchSizeChangeToUpdateMinZoom(b);
|
|
16314
|
+
this._updateMinZoomForBounds();
|
|
16304
16315
|
} else {
|
|
16305
16316
|
map.setMaxBounds(null);
|
|
16306
|
-
this.
|
|
16317
|
+
this._updateMinZoomForBounds();
|
|
16307
16318
|
}
|
|
16308
16319
|
}
|
|
16309
16320
|
if (maxZoom !== void 0) {
|
|
16310
16321
|
map.setMaxZoom(maxZoom);
|
|
16311
16322
|
}
|
|
16312
16323
|
if (minZoom !== void 0) {
|
|
16313
|
-
this.
|
|
16314
|
-
map.setMinZoom(minZoom);
|
|
16324
|
+
this._updateMinZoomForBounds(minZoom);
|
|
16315
16325
|
}
|
|
16316
16326
|
}
|
|
16317
16327
|
}
|
|
@@ -16445,22 +16455,18 @@ var LeafletMapAdapter = (function () {
|
|
|
16445
16455
|
this._unselectCb.length = 0;
|
|
16446
16456
|
this._unselectCb.push(cb);
|
|
16447
16457
|
}
|
|
16448
|
-
_watchSizeChangeToUpdateMinZoom(
|
|
16458
|
+
_watchSizeChangeToUpdateMinZoom() {
|
|
16449
16459
|
this._stopWatchSizeChangeToUpdateMinZoom();
|
|
16450
16460
|
const container = this.getContainer();
|
|
16451
16461
|
const map = this.map;
|
|
16452
16462
|
if (container && map && window.ResizeObserver) {
|
|
16453
16463
|
this._resizeObserver = new ResizeObserver(() => {
|
|
16454
|
-
|
|
16464
|
+
this._updateMinZoomForBounds();
|
|
16455
16465
|
});
|
|
16456
16466
|
this._resizeObserver.observe(container);
|
|
16457
16467
|
}
|
|
16458
16468
|
}
|
|
16459
16469
|
_stopWatchSizeChangeToUpdateMinZoom() {
|
|
16460
|
-
const map = this.map;
|
|
16461
|
-
if (map) {
|
|
16462
|
-
map.setMinZoom(0);
|
|
16463
|
-
}
|
|
16464
16470
|
if (this._resizeObserver) {
|
|
16465
16471
|
this._resizeObserver.disconnect();
|
|
16466
16472
|
this._resizeObserver = void 0;
|
|
@@ -16487,6 +16493,28 @@ var LeafletMapAdapter = (function () {
|
|
|
16487
16493
|
}
|
|
16488
16494
|
}
|
|
16489
16495
|
}
|
|
16496
|
+
_updateMinZoomForBounds(zoom) {
|
|
16497
|
+
var _a;
|
|
16498
|
+
const map = this.map;
|
|
16499
|
+
if (map) {
|
|
16500
|
+
zoom = zoom != null ? zoom : map.getMinZoom();
|
|
16501
|
+
const defaultBounds = leafletSrcExports.latLngBounds(
|
|
16502
|
+
leafletSrcExports.latLng(-90, -18e3),
|
|
16503
|
+
leafletSrcExports.latLng(90, 18e3)
|
|
16504
|
+
);
|
|
16505
|
+
const maxBounds = (_a = map.options.maxBounds) != null ? _a : defaultBounds;
|
|
16506
|
+
if (maxBounds !== void 0) {
|
|
16507
|
+
map.setMinZoom(0);
|
|
16508
|
+
const boundsZoom = map.getBoundsZoom(maxBounds, true);
|
|
16509
|
+
const minZoom = zoom < boundsZoom ? boundsZoom : zoom;
|
|
16510
|
+
map.options.minZoom = minZoom;
|
|
16511
|
+
map.setMinZoom(minZoom);
|
|
16512
|
+
if (map.getZoom() < minZoom) {
|
|
16513
|
+
map.setZoom(minZoom);
|
|
16514
|
+
}
|
|
16515
|
+
}
|
|
16516
|
+
}
|
|
16517
|
+
}
|
|
16490
16518
|
};
|
|
16491
16519
|
__publicField(_LeafletMapAdapter, "layerAdapters", {
|
|
16492
16520
|
GEOJSON: GeoJsonAdapter,
|