@nextgis/ngw-leaflet 2.0.2 → 2.1.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/README.md +1 -1
- package/lib/ngw-leaflet.esm-browser.js +44 -13
- package/lib/ngw-leaflet.esm-browser.js.map +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js.map +1 -1
- package/lib/ngw-leaflet.esm-bundler.js +1 -1
- package/lib/ngw-leaflet.global.js +44 -13
- package/lib/ngw-leaflet.global.js.map +1 -1
- package/lib/ngw-leaflet.global.prod.js +1 -1
- package/lib/ngw-leaflet.global.prod.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-leaflet; version: 2.
|
|
1
|
+
/** Bundle of @nextgis/ngw-leaflet; version: 2.1.1; author: NextGIS */
|
|
2
2
|
import 'leaflet/dist/leaflet.css';
|
|
3
3
|
import LeafletMapAdapter from '@nextgis/leaflet-map-adapter';
|
|
4
4
|
import { NgwMap } from '@nextgis/ngw-map';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-leaflet; version: 2.
|
|
1
|
+
/** Bundle of @nextgis/ngw-leaflet; version: 2.1.1; author: NextGIS */
|
|
2
2
|
var NgwLeaflet = (function () {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -17289,6 +17289,16 @@ var NgwLeaflet = (function () {
|
|
|
17289
17289
|
}
|
|
17290
17290
|
}
|
|
17291
17291
|
}
|
|
17292
|
+
updateLayer() {
|
|
17293
|
+
if (this.layer) {
|
|
17294
|
+
const currentUrl = this.layer._url;
|
|
17295
|
+
const timestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
17296
|
+
const separator = currentUrl.includes("?") ? "&" : "?";
|
|
17297
|
+
const newUrl = currentUrl.replace(/(\?|&)timestamp=\d*/g, "") + separator + `timestamp=${timestamp}`;
|
|
17298
|
+
this.layer.setUrl(newUrl);
|
|
17299
|
+
this.layer.redraw();
|
|
17300
|
+
}
|
|
17301
|
+
}
|
|
17292
17302
|
}
|
|
17293
17303
|
|
|
17294
17304
|
var __defProp$N = Object.defineProperty;
|
|
@@ -17456,6 +17466,8 @@ var NgwLeaflet = (function () {
|
|
|
17456
17466
|
center: center && [center[1], center[0]],
|
|
17457
17467
|
zoom
|
|
17458
17468
|
}, mapAdapterOptions));
|
|
17469
|
+
this._updateMinZoomForBounds(minZoom);
|
|
17470
|
+
this._watchSizeChangeToUpdateMinZoom();
|
|
17459
17471
|
const defPane = this.map.createPane("order-0");
|
|
17460
17472
|
this.map._addUnselectCb = (def) => {
|
|
17461
17473
|
this._addUnselectCb(def);
|
|
@@ -17519,19 +17531,17 @@ var NgwLeaflet = (function () {
|
|
|
17519
17531
|
if (maxBounds) {
|
|
17520
17532
|
const b = arrayToBoundsExpression(maxBounds);
|
|
17521
17533
|
map.setMaxBounds(b);
|
|
17522
|
-
|
|
17523
|
-
this._watchSizeChangeToUpdateMinZoom(b);
|
|
17534
|
+
this._updateMinZoomForBounds();
|
|
17524
17535
|
} else {
|
|
17525
17536
|
map.setMaxBounds(null);
|
|
17526
|
-
this.
|
|
17537
|
+
this._updateMinZoomForBounds();
|
|
17527
17538
|
}
|
|
17528
17539
|
}
|
|
17529
17540
|
if (maxZoom !== void 0) {
|
|
17530
17541
|
map.setMaxZoom(maxZoom);
|
|
17531
17542
|
}
|
|
17532
17543
|
if (minZoom !== void 0) {
|
|
17533
|
-
this.
|
|
17534
|
-
map.setMinZoom(minZoom);
|
|
17544
|
+
this._updateMinZoomForBounds(minZoom);
|
|
17535
17545
|
}
|
|
17536
17546
|
}
|
|
17537
17547
|
}
|
|
@@ -17665,22 +17675,18 @@ var NgwLeaflet = (function () {
|
|
|
17665
17675
|
this._unselectCb.length = 0;
|
|
17666
17676
|
this._unselectCb.push(cb);
|
|
17667
17677
|
}
|
|
17668
|
-
_watchSizeChangeToUpdateMinZoom(
|
|
17678
|
+
_watchSizeChangeToUpdateMinZoom() {
|
|
17669
17679
|
this._stopWatchSizeChangeToUpdateMinZoom();
|
|
17670
17680
|
const container = this.getContainer();
|
|
17671
17681
|
const map = this.map;
|
|
17672
17682
|
if (container && map && window.ResizeObserver) {
|
|
17673
17683
|
this._resizeObserver = new ResizeObserver(() => {
|
|
17674
|
-
|
|
17684
|
+
this._updateMinZoomForBounds();
|
|
17675
17685
|
});
|
|
17676
17686
|
this._resizeObserver.observe(container);
|
|
17677
17687
|
}
|
|
17678
17688
|
}
|
|
17679
17689
|
_stopWatchSizeChangeToUpdateMinZoom() {
|
|
17680
|
-
const map = this.map;
|
|
17681
|
-
if (map) {
|
|
17682
|
-
map.setMinZoom(0);
|
|
17683
|
-
}
|
|
17684
17690
|
if (this._resizeObserver) {
|
|
17685
17691
|
this._resizeObserver.disconnect();
|
|
17686
17692
|
this._resizeObserver = void 0;
|
|
@@ -17707,6 +17713,28 @@ var NgwLeaflet = (function () {
|
|
|
17707
17713
|
}
|
|
17708
17714
|
}
|
|
17709
17715
|
}
|
|
17716
|
+
_updateMinZoomForBounds(zoom) {
|
|
17717
|
+
var _a;
|
|
17718
|
+
const map = this.map;
|
|
17719
|
+
if (map) {
|
|
17720
|
+
zoom = zoom != null ? zoom : map.getMinZoom();
|
|
17721
|
+
const defaultBounds = leafletSrcExports.latLngBounds(
|
|
17722
|
+
leafletSrcExports.latLng(-90, -18e3),
|
|
17723
|
+
leafletSrcExports.latLng(90, 18e3)
|
|
17724
|
+
);
|
|
17725
|
+
const maxBounds = (_a = map.options.maxBounds) != null ? _a : defaultBounds;
|
|
17726
|
+
if (maxBounds !== void 0) {
|
|
17727
|
+
map.setMinZoom(0);
|
|
17728
|
+
const boundsZoom = map.getBoundsZoom(maxBounds, true);
|
|
17729
|
+
const minZoom = zoom < boundsZoom ? boundsZoom : zoom;
|
|
17730
|
+
map.options.minZoom = minZoom;
|
|
17731
|
+
map.setMinZoom(minZoom);
|
|
17732
|
+
if (map.getZoom() < minZoom) {
|
|
17733
|
+
map.setZoom(minZoom);
|
|
17734
|
+
}
|
|
17735
|
+
}
|
|
17736
|
+
}
|
|
17737
|
+
}
|
|
17710
17738
|
};
|
|
17711
17739
|
__publicField$A(_LeafletMapAdapter, "layerAdapters", {
|
|
17712
17740
|
GEOJSON: GeoJsonAdapter,
|
|
@@ -20892,7 +20920,7 @@ var NgwLeaflet = (function () {
|
|
|
20892
20920
|
} = props;
|
|
20893
20921
|
const addLayerOptionsPriority = alop != null ? alop : true;
|
|
20894
20922
|
const options = layerOptions;
|
|
20895
|
-
const GeoJsonAdapter = Adapter || webMap.mapAdapter.layerAdapters.GEOJSON;
|
|
20923
|
+
const GeoJsonAdapter = Adapter || layerOptions.Adapter || webMap.mapAdapter.layerAdapters.GEOJSON;
|
|
20896
20924
|
const _loadedIds = [];
|
|
20897
20925
|
let _fullDataLoad = false;
|
|
20898
20926
|
let _lastFilterArgs;
|
|
@@ -23613,6 +23641,9 @@ var NgwLeaflet = (function () {
|
|
|
23613
23641
|
this.setView(center, zoom);
|
|
23614
23642
|
} else if (bounds) {
|
|
23615
23643
|
this.fitBounds(bounds);
|
|
23644
|
+
if (zoom !== void 0) {
|
|
23645
|
+
this.setZoom(zoom);
|
|
23646
|
+
}
|
|
23616
23647
|
}
|
|
23617
23648
|
}
|
|
23618
23649
|
_setInitMapState(states) {
|