@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
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ const ngwMap = new NgwMap({
|
|
|
64
64
|
});
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
Check out the [API Documentation](https://code-api.nextgis.com/modules/
|
|
67
|
+
Check out the [API Documentation](https://code-api.nextgis.com/modules/_nextgis_ngw_map.html)
|
|
68
68
|
|
|
69
69
|
## Commercial support
|
|
70
70
|
|
|
@@ -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
|
function styleInject(css, ref) {
|
|
3
3
|
if ( ref === void 0 ) ref = {};
|
|
4
4
|
var insertAt = ref.insertAt;
|
|
@@ -17286,6 +17286,16 @@ class TileAdapter extends BaseAdapter {
|
|
|
17286
17286
|
}
|
|
17287
17287
|
}
|
|
17288
17288
|
}
|
|
17289
|
+
updateLayer() {
|
|
17290
|
+
if (this.layer) {
|
|
17291
|
+
const currentUrl = this.layer._url;
|
|
17292
|
+
const timestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
17293
|
+
const separator = currentUrl.includes("?") ? "&" : "?";
|
|
17294
|
+
const newUrl = currentUrl.replace(/(\?|&)timestamp=\d*/g, "") + separator + `timestamp=${timestamp}`;
|
|
17295
|
+
this.layer.setUrl(newUrl);
|
|
17296
|
+
this.layer.redraw();
|
|
17297
|
+
}
|
|
17298
|
+
}
|
|
17289
17299
|
}
|
|
17290
17300
|
|
|
17291
17301
|
var __defProp$N = Object.defineProperty;
|
|
@@ -17453,6 +17463,8 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
|
|
|
17453
17463
|
center: center && [center[1], center[0]],
|
|
17454
17464
|
zoom
|
|
17455
17465
|
}, mapAdapterOptions));
|
|
17466
|
+
this._updateMinZoomForBounds(minZoom);
|
|
17467
|
+
this._watchSizeChangeToUpdateMinZoom();
|
|
17456
17468
|
const defPane = this.map.createPane("order-0");
|
|
17457
17469
|
this.map._addUnselectCb = (def) => {
|
|
17458
17470
|
this._addUnselectCb(def);
|
|
@@ -17516,19 +17528,17 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
|
|
|
17516
17528
|
if (maxBounds) {
|
|
17517
17529
|
const b = arrayToBoundsExpression(maxBounds);
|
|
17518
17530
|
map.setMaxBounds(b);
|
|
17519
|
-
|
|
17520
|
-
this._watchSizeChangeToUpdateMinZoom(b);
|
|
17531
|
+
this._updateMinZoomForBounds();
|
|
17521
17532
|
} else {
|
|
17522
17533
|
map.setMaxBounds(null);
|
|
17523
|
-
this.
|
|
17534
|
+
this._updateMinZoomForBounds();
|
|
17524
17535
|
}
|
|
17525
17536
|
}
|
|
17526
17537
|
if (maxZoom !== void 0) {
|
|
17527
17538
|
map.setMaxZoom(maxZoom);
|
|
17528
17539
|
}
|
|
17529
17540
|
if (minZoom !== void 0) {
|
|
17530
|
-
this.
|
|
17531
|
-
map.setMinZoom(minZoom);
|
|
17541
|
+
this._updateMinZoomForBounds(minZoom);
|
|
17532
17542
|
}
|
|
17533
17543
|
}
|
|
17534
17544
|
}
|
|
@@ -17662,22 +17672,18 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
|
|
|
17662
17672
|
this._unselectCb.length = 0;
|
|
17663
17673
|
this._unselectCb.push(cb);
|
|
17664
17674
|
}
|
|
17665
|
-
_watchSizeChangeToUpdateMinZoom(
|
|
17675
|
+
_watchSizeChangeToUpdateMinZoom() {
|
|
17666
17676
|
this._stopWatchSizeChangeToUpdateMinZoom();
|
|
17667
17677
|
const container = this.getContainer();
|
|
17668
17678
|
const map = this.map;
|
|
17669
17679
|
if (container && map && window.ResizeObserver) {
|
|
17670
17680
|
this._resizeObserver = new ResizeObserver(() => {
|
|
17671
|
-
|
|
17681
|
+
this._updateMinZoomForBounds();
|
|
17672
17682
|
});
|
|
17673
17683
|
this._resizeObserver.observe(container);
|
|
17674
17684
|
}
|
|
17675
17685
|
}
|
|
17676
17686
|
_stopWatchSizeChangeToUpdateMinZoom() {
|
|
17677
|
-
const map = this.map;
|
|
17678
|
-
if (map) {
|
|
17679
|
-
map.setMinZoom(0);
|
|
17680
|
-
}
|
|
17681
17687
|
if (this._resizeObserver) {
|
|
17682
17688
|
this._resizeObserver.disconnect();
|
|
17683
17689
|
this._resizeObserver = void 0;
|
|
@@ -17704,6 +17710,28 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
|
|
|
17704
17710
|
}
|
|
17705
17711
|
}
|
|
17706
17712
|
}
|
|
17713
|
+
_updateMinZoomForBounds(zoom) {
|
|
17714
|
+
var _a;
|
|
17715
|
+
const map = this.map;
|
|
17716
|
+
if (map) {
|
|
17717
|
+
zoom = zoom != null ? zoom : map.getMinZoom();
|
|
17718
|
+
const defaultBounds = leafletSrcExports.latLngBounds(
|
|
17719
|
+
leafletSrcExports.latLng(-90, -18e3),
|
|
17720
|
+
leafletSrcExports.latLng(90, 18e3)
|
|
17721
|
+
);
|
|
17722
|
+
const maxBounds = (_a = map.options.maxBounds) != null ? _a : defaultBounds;
|
|
17723
|
+
if (maxBounds !== void 0) {
|
|
17724
|
+
map.setMinZoom(0);
|
|
17725
|
+
const boundsZoom = map.getBoundsZoom(maxBounds, true);
|
|
17726
|
+
const minZoom = zoom < boundsZoom ? boundsZoom : zoom;
|
|
17727
|
+
map.options.minZoom = minZoom;
|
|
17728
|
+
map.setMinZoom(minZoom);
|
|
17729
|
+
if (map.getZoom() < minZoom) {
|
|
17730
|
+
map.setZoom(minZoom);
|
|
17731
|
+
}
|
|
17732
|
+
}
|
|
17733
|
+
}
|
|
17734
|
+
}
|
|
17707
17735
|
};
|
|
17708
17736
|
__publicField$A(_LeafletMapAdapter, "layerAdapters", {
|
|
17709
17737
|
GEOJSON: GeoJsonAdapter,
|
|
@@ -20889,7 +20917,7 @@ function createGeoJsonAdapter(props) {
|
|
|
20889
20917
|
} = props;
|
|
20890
20918
|
const addLayerOptionsPriority = alop != null ? alop : true;
|
|
20891
20919
|
const options = layerOptions;
|
|
20892
|
-
const GeoJsonAdapter = Adapter || webMap.mapAdapter.layerAdapters.GEOJSON;
|
|
20920
|
+
const GeoJsonAdapter = Adapter || layerOptions.Adapter || webMap.mapAdapter.layerAdapters.GEOJSON;
|
|
20893
20921
|
const _loadedIds = [];
|
|
20894
20922
|
let _fullDataLoad = false;
|
|
20895
20923
|
let _lastFilterArgs;
|
|
@@ -23610,6 +23638,9 @@ const _WebMapMain = class _WebMapMain {
|
|
|
23610
23638
|
this.setView(center, zoom);
|
|
23611
23639
|
} else if (bounds) {
|
|
23612
23640
|
this.fitBounds(bounds);
|
|
23641
|
+
if (zoom !== void 0) {
|
|
23642
|
+
this.setZoom(zoom);
|
|
23643
|
+
}
|
|
23613
23644
|
}
|
|
23614
23645
|
}
|
|
23615
23646
|
_setInitMapState(states) {
|