@nextgis/ngw-map 2.1.0 → 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-map.cjs.js +1 -1
- package/lib/ngw-map.esm-browser.js +44 -2
- package/lib/ngw-map.esm-browser.js.map +1 -1
- package/lib/ngw-map.esm-browser.prod.js +1 -1
- package/lib/ngw-map.esm-browser.prod.js.map +1 -1
- package/lib/ngw-map.esm-bundler.js +1 -1
- package/lib/ngw-map.global.js +44 -2
- package/lib/ngw-map.global.js.map +1 -1
- package/lib/ngw-map.global.prod.js +1 -1
- package/lib/ngw-map.global.prod.js.map +1 -1
- package/package.json +8 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-map; version: 2.
|
|
1
|
+
/** Bundle of @nextgis/ngw-map; version: 2.2.3; author: NextGIS */
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import CancelablePromise from '@nextgis/cancelable-promise';
|
|
4
4
|
import { getIcon } from '@nextgis/icons';
|
package/lib/ngw-map.global.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-map; version: 2.
|
|
1
|
+
/** Bundle of @nextgis/ngw-map; version: 2.2.3; author: NextGIS */
|
|
2
2
|
var NgwMap = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -1053,6 +1053,32 @@ var NgwMap = (function (exports) {
|
|
|
1053
1053
|
return radius;
|
|
1054
1054
|
}
|
|
1055
1055
|
|
|
1056
|
+
function checkExtent(extent) {
|
|
1057
|
+
const [minLon, minLat, maxLon, maxLat] = extent;
|
|
1058
|
+
const isOrderValid = minLon < maxLon && minLat < maxLat;
|
|
1059
|
+
if (!isOrderValid) {
|
|
1060
|
+
console.log("Error: The extent coordinates are not in the correct order.");
|
|
1061
|
+
console.log(
|
|
1062
|
+
`Received extent: [${minLon}, ${minLat}, ${maxLon}, ${maxLat}]`
|
|
1063
|
+
);
|
|
1064
|
+
const correctedExtent = [
|
|
1065
|
+
Math.min(minLon, maxLon),
|
|
1066
|
+
Math.min(minLat, maxLat),
|
|
1067
|
+
Math.max(minLon, maxLon),
|
|
1068
|
+
Math.max(maxLat, minLat)
|
|
1069
|
+
];
|
|
1070
|
+
console.log(`Expected order: [${correctedExtent.join(", ")}]`);
|
|
1071
|
+
}
|
|
1072
|
+
const isValidLon = minLon >= -180 && maxLon <= 180;
|
|
1073
|
+
const isValidLat = minLat >= -90 && maxLat <= 90;
|
|
1074
|
+
if (!isValidLon || !isValidLat) {
|
|
1075
|
+
console.log(
|
|
1076
|
+
"Warning: The coordinates may not be within valid geographic ranges."
|
|
1077
|
+
);
|
|
1078
|
+
}
|
|
1079
|
+
return isOrderValid && isValidLon && isValidLat;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1056
1082
|
function isEqual(a, b, o, p) {
|
|
1057
1083
|
if (a instanceof Array) {
|
|
1058
1084
|
if (!(b instanceof Array))
|
|
@@ -4000,7 +4026,7 @@ var NgwMap = (function (exports) {
|
|
|
4000
4026
|
} = props;
|
|
4001
4027
|
const addLayerOptionsPriority = alop != null ? alop : true;
|
|
4002
4028
|
const options = layerOptions;
|
|
4003
|
-
const GeoJsonAdapter = Adapter || webMap.mapAdapter.layerAdapters.GEOJSON;
|
|
4029
|
+
const GeoJsonAdapter = Adapter || layerOptions.Adapter || webMap.mapAdapter.layerAdapters.GEOJSON;
|
|
4004
4030
|
const _loadedIds = [];
|
|
4005
4031
|
let _fullDataLoad = false;
|
|
4006
4032
|
let _lastFilterArgs;
|
|
@@ -7408,6 +7434,7 @@ var NgwMap = (function (exports) {
|
|
|
7408
7434
|
* ```
|
|
7409
7435
|
*/
|
|
7410
7436
|
fitBounds(bounds, options) {
|
|
7437
|
+
checkExtent(bounds);
|
|
7411
7438
|
if (bounds.every((x) => defined(x))) {
|
|
7412
7439
|
if (bounds[1] < -85.06) {
|
|
7413
7440
|
bounds[1] = -85.06;
|
|
@@ -8525,6 +8552,13 @@ var NgwMap = (function (exports) {
|
|
|
8525
8552
|
return Promise.resolve(options);
|
|
8526
8553
|
});
|
|
8527
8554
|
}
|
|
8555
|
+
_onLayerDoubleClick(options) {
|
|
8556
|
+
return __async$5(this, null, function* () {
|
|
8557
|
+
const id = options.layer.id;
|
|
8558
|
+
this._emitLayerEvent("layer:dblclick", id || "", options);
|
|
8559
|
+
return Promise.resolve(options);
|
|
8560
|
+
});
|
|
8561
|
+
}
|
|
8528
8562
|
_onLayerSelect(options) {
|
|
8529
8563
|
return __async$5(this, null, function* () {
|
|
8530
8564
|
this._emitLayerEvent("layer:select", options.layer.id || "", options);
|
|
@@ -8536,17 +8570,25 @@ var NgwMap = (function (exports) {
|
|
|
8536
8570
|
onSelect,
|
|
8537
8571
|
onLayerSelect,
|
|
8538
8572
|
onClick,
|
|
8573
|
+
onDoubleClick,
|
|
8539
8574
|
onLayerClick,
|
|
8540
8575
|
onMouseOut,
|
|
8541
8576
|
onMouseOver
|
|
8542
8577
|
} = options;
|
|
8543
8578
|
const onLayerClickFromOpt = onClick || onLayerClick;
|
|
8579
|
+
const onLayerDblClickFromOpt = onDoubleClick || onLayerClick;
|
|
8544
8580
|
options.onClick = (e) => {
|
|
8545
8581
|
if (onLayerClickFromOpt) {
|
|
8546
8582
|
onLayerClickFromOpt(e);
|
|
8547
8583
|
}
|
|
8548
8584
|
return this._onLayerClick(e);
|
|
8549
8585
|
};
|
|
8586
|
+
options.onDoubleClick = (e) => {
|
|
8587
|
+
if (onLayerDblClickFromOpt) {
|
|
8588
|
+
onLayerDblClickFromOpt(e);
|
|
8589
|
+
}
|
|
8590
|
+
return this._onLayerDoubleClick(e);
|
|
8591
|
+
};
|
|
8550
8592
|
options.onMouseOut = (e) => {
|
|
8551
8593
|
const id = e.layer.id;
|
|
8552
8594
|
onMouseOut && onMouseOut(e);
|