@nextgis/ngw-leaflet 2.2.1 → 2.2.3
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/ngw-leaflet.esm-browser.js +57 -3
- 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 +57 -3
- 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 +5 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-leaflet; version: 2.2.
|
|
1
|
+
/** Bundle of @nextgis/ngw-leaflet; version: 2.2.3; 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.2.
|
|
1
|
+
/** Bundle of @nextgis/ngw-leaflet; version: 2.2.3; author: NextGIS */
|
|
2
2
|
var NgwLeaflet = (function () {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -14860,6 +14860,32 @@ var NgwLeaflet = (function () {
|
|
|
14860
14860
|
return radius;
|
|
14861
14861
|
}
|
|
14862
14862
|
|
|
14863
|
+
function checkExtent(extent) {
|
|
14864
|
+
const [minLon, minLat, maxLon, maxLat] = extent;
|
|
14865
|
+
const isOrderValid = minLon < maxLon && minLat < maxLat;
|
|
14866
|
+
if (!isOrderValid) {
|
|
14867
|
+
console.log("Error: The extent coordinates are not in the correct order.");
|
|
14868
|
+
console.log(
|
|
14869
|
+
`Received extent: [${minLon}, ${minLat}, ${maxLon}, ${maxLat}]`
|
|
14870
|
+
);
|
|
14871
|
+
const correctedExtent = [
|
|
14872
|
+
Math.min(minLon, maxLon),
|
|
14873
|
+
Math.min(minLat, maxLat),
|
|
14874
|
+
Math.max(minLon, maxLon),
|
|
14875
|
+
Math.max(maxLat, minLat)
|
|
14876
|
+
];
|
|
14877
|
+
console.log(`Expected order: [${correctedExtent.join(", ")}]`);
|
|
14878
|
+
}
|
|
14879
|
+
const isValidLon = minLon >= -180 && maxLon <= 180;
|
|
14880
|
+
const isValidLat = minLat >= -90 && maxLat <= 90;
|
|
14881
|
+
if (!isValidLon || !isValidLat) {
|
|
14882
|
+
console.log(
|
|
14883
|
+
"Warning: The coordinates may not be within valid geographic ranges."
|
|
14884
|
+
);
|
|
14885
|
+
}
|
|
14886
|
+
return isOrderValid && isValidLon && isValidLat;
|
|
14887
|
+
}
|
|
14888
|
+
|
|
14863
14889
|
function isEqual(a, b, o, p) {
|
|
14864
14890
|
if (a instanceof Array) {
|
|
14865
14891
|
if (!(b instanceof Array))
|
|
@@ -15126,12 +15152,13 @@ var NgwLeaflet = (function () {
|
|
|
15126
15152
|
constructor(layer) {
|
|
15127
15153
|
__publicField$H(this, "layer");
|
|
15128
15154
|
__publicField$H(this, "_onclick");
|
|
15155
|
+
__publicField$H(this, "_ondblclick");
|
|
15129
15156
|
__publicField$H(this, "_mouseout");
|
|
15130
15157
|
__publicField$H(this, "_mouseover");
|
|
15131
15158
|
this.layer = layer;
|
|
15132
15159
|
}
|
|
15133
15160
|
handleMouseEvents(layer) {
|
|
15134
|
-
const { onClick, onLayerClick, onMouseOut, onMouseOver } = this.layer.options;
|
|
15161
|
+
const { onClick, onDoubleClick, onLayerClick, onMouseOut, onMouseOver } = this.layer.options;
|
|
15135
15162
|
const onClick_ = onClick || onLayerClick;
|
|
15136
15163
|
if (onClick_) {
|
|
15137
15164
|
this._onclick = (e) => {
|
|
@@ -15142,6 +15169,16 @@ var NgwLeaflet = (function () {
|
|
|
15142
15169
|
};
|
|
15143
15170
|
layer.on("click", this._onclick, this);
|
|
15144
15171
|
}
|
|
15172
|
+
if (onDoubleClick) {
|
|
15173
|
+
this._ondblclick = (e) => {
|
|
15174
|
+
leafletSrcExports.DomEvent.stopPropagation(e);
|
|
15175
|
+
const selected = !!this.layer._getSelected(layer);
|
|
15176
|
+
onDoubleClick(__spreadValues$C({
|
|
15177
|
+
selected
|
|
15178
|
+
}, this._createMouseEvent(e)));
|
|
15179
|
+
};
|
|
15180
|
+
layer.on("dblclick", this._ondblclick, this);
|
|
15181
|
+
}
|
|
15145
15182
|
if (onMouseOut) {
|
|
15146
15183
|
this._mouseout = (e) => {
|
|
15147
15184
|
onMouseOut(this._createMouseEvent(e));
|
|
@@ -17019,9 +17056,10 @@ var NgwLeaflet = (function () {
|
|
|
17019
17056
|
super._initImage();
|
|
17020
17057
|
const headers = this.options.headers;
|
|
17021
17058
|
const img = this._image;
|
|
17059
|
+
const src = img.src;
|
|
17022
17060
|
img.src = "";
|
|
17023
17061
|
imageQueue.add(() => {
|
|
17024
|
-
const [promise, abortFunc] = callAjax(
|
|
17062
|
+
const [promise, abortFunc] = callAjax(src, headers);
|
|
17025
17063
|
promise.then((imgUrl) => {
|
|
17026
17064
|
img.src = imgUrl;
|
|
17027
17065
|
});
|
|
@@ -23571,6 +23609,7 @@ var NgwLeaflet = (function () {
|
|
|
23571
23609
|
* ```
|
|
23572
23610
|
*/
|
|
23573
23611
|
fitBounds(bounds, options) {
|
|
23612
|
+
checkExtent(bounds);
|
|
23574
23613
|
if (bounds.every((x) => defined(x))) {
|
|
23575
23614
|
if (bounds[1] < -85.06) {
|
|
23576
23615
|
bounds[1] = -85.06;
|
|
@@ -24688,6 +24727,13 @@ var NgwLeaflet = (function () {
|
|
|
24688
24727
|
return Promise.resolve(options);
|
|
24689
24728
|
});
|
|
24690
24729
|
}
|
|
24730
|
+
_onLayerDoubleClick(options) {
|
|
24731
|
+
return __async$4(this, null, function* () {
|
|
24732
|
+
const id = options.layer.id;
|
|
24733
|
+
this._emitLayerEvent("layer:dblclick", id || "", options);
|
|
24734
|
+
return Promise.resolve(options);
|
|
24735
|
+
});
|
|
24736
|
+
}
|
|
24691
24737
|
_onLayerSelect(options) {
|
|
24692
24738
|
return __async$4(this, null, function* () {
|
|
24693
24739
|
this._emitLayerEvent("layer:select", options.layer.id || "", options);
|
|
@@ -24699,17 +24745,25 @@ var NgwLeaflet = (function () {
|
|
|
24699
24745
|
onSelect,
|
|
24700
24746
|
onLayerSelect,
|
|
24701
24747
|
onClick,
|
|
24748
|
+
onDoubleClick,
|
|
24702
24749
|
onLayerClick,
|
|
24703
24750
|
onMouseOut,
|
|
24704
24751
|
onMouseOver
|
|
24705
24752
|
} = options;
|
|
24706
24753
|
const onLayerClickFromOpt = onClick || onLayerClick;
|
|
24754
|
+
const onLayerDblClickFromOpt = onDoubleClick || onLayerClick;
|
|
24707
24755
|
options.onClick = (e) => {
|
|
24708
24756
|
if (onLayerClickFromOpt) {
|
|
24709
24757
|
onLayerClickFromOpt(e);
|
|
24710
24758
|
}
|
|
24711
24759
|
return this._onLayerClick(e);
|
|
24712
24760
|
};
|
|
24761
|
+
options.onDoubleClick = (e) => {
|
|
24762
|
+
if (onLayerDblClickFromOpt) {
|
|
24763
|
+
onLayerDblClickFromOpt(e);
|
|
24764
|
+
}
|
|
24765
|
+
return this._onLayerDoubleClick(e);
|
|
24766
|
+
};
|
|
24713
24767
|
options.onMouseOut = (e) => {
|
|
24714
24768
|
const id = e.layer.id;
|
|
24715
24769
|
onMouseOut && onMouseOut(e);
|