mapboxgl-tools 2.2.11 → 2.2.13
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/dist/ui.es.js +47 -4
- package/dist/ui.umd.js +1 -1
- package/package.json +1 -1
package/dist/ui.es.js
CHANGED
|
@@ -2471,6 +2471,7 @@ class MeasureDistanceControl extends KeyboardControl {
|
|
|
2471
2471
|
}
|
|
2472
2472
|
}
|
|
2473
2473
|
var control$4 = "";
|
|
2474
|
+
const areaPath = "M146.285714 292.571429v438.857142h73.142857V292.571429zM804.571429 292.571429v438.857142h73.142857V292.571429zM292.571429 219.428571h438.857142V146.285714H292.571429zM292.571429 877.714286h438.857142v-73.142857H292.571429zM345.234286 397.897143l292.571428 292.571428a36.571429 36.571429 0 1 0 51.712-51.712l-292.571428-292.571428a36.571429 36.571429 0 0 0-51.712 51.712zM804.571429 804.571429h73.142857v73.142857h-73.142857v-73.142857z m146.285714-73.142858h-219.428572v219.428572h219.428572v-219.428572zM804.571429 146.285714h73.142857v73.142857h-73.142857V146.285714z m146.285714-73.142857h-219.428572v219.428572h219.428572V73.142857zM146.285714 146.285714h73.142857v73.142857H146.285714V146.285714z m146.285715-73.142857H73.142857v219.428572h219.428572V73.142857zM146.285714 804.571429h73.142857v73.142857H146.285714v-73.142857z m146.285715-73.142858H73.142857v219.428572h219.428572v-219.428572z";
|
|
2474
2475
|
const options$4 = {
|
|
2475
2476
|
title: "\u6D4B\u91CF\u9762\u79EF",
|
|
2476
2477
|
showCloseButton: true,
|
|
@@ -2627,6 +2628,7 @@ class MeasureAreaControl extends KeyboardControl {
|
|
|
2627
2628
|
this._map.on("dblclick", (e2) => {
|
|
2628
2629
|
if (!this.flag)
|
|
2629
2630
|
return;
|
|
2631
|
+
e2.preventDefault();
|
|
2630
2632
|
const coords = [e2.lngLat.lng, e2.lngLat.lat];
|
|
2631
2633
|
this.points.push(coords);
|
|
2632
2634
|
this.measureFlag = false;
|
|
@@ -2643,6 +2645,11 @@ class MeasureAreaControl extends KeyboardControl {
|
|
|
2643
2645
|
if (!this.options.isKeep) {
|
|
2644
2646
|
this._clearLayers();
|
|
2645
2647
|
this._resetData();
|
|
2648
|
+
this.measureFlag = false;
|
|
2649
|
+
this._map.doubleClickZoom.enable();
|
|
2650
|
+
this._map.getCanvas().style.cursor = "";
|
|
2651
|
+
this._onClose();
|
|
2652
|
+
this._container.querySelector(`.${this.mainClass}-entry path`).setAttribute("d", areaPath);
|
|
2646
2653
|
} else {
|
|
2647
2654
|
if (this.options.showCloseButton) {
|
|
2648
2655
|
const ele = document.createElement("div");
|
|
@@ -2963,6 +2970,9 @@ class MouseRectControl extends KeyboardControl {
|
|
|
2963
2970
|
this.options.onEnd && this.options.onEnd({ minX, minY, maxX, maxY, wkt });
|
|
2964
2971
|
if (!this.options.isKeep) {
|
|
2965
2972
|
this._clearDrawLayers();
|
|
2973
|
+
this.flagValue = false;
|
|
2974
|
+
this._onClose();
|
|
2975
|
+
this._container.querySelector(`.${this.mainClass}-entry path`).setAttribute("d", rectPath);
|
|
2966
2976
|
} else {
|
|
2967
2977
|
if (this.options.showCloseButton) {
|
|
2968
2978
|
this._addCloseButton([maxX, maxY]);
|
|
@@ -3904,7 +3914,7 @@ class PositionControl extends KeyboardControl {
|
|
|
3904
3914
|
_resetData() {
|
|
3905
3915
|
this.flagValue = false;
|
|
3906
3916
|
}
|
|
3907
|
-
_navigate() {
|
|
3917
|
+
_navigate(updateInput = true) {
|
|
3908
3918
|
this.current = -1;
|
|
3909
3919
|
const newLocs = this._coords();
|
|
3910
3920
|
if (this.options.type === "feature") {
|
|
@@ -3983,10 +3993,14 @@ class PositionControl extends KeyboardControl {
|
|
|
3983
3993
|
li.append(span);
|
|
3984
3994
|
ul.append(li);
|
|
3985
3995
|
}
|
|
3986
|
-
|
|
3996
|
+
if (updateInput) {
|
|
3997
|
+
this.getterValue = newLocs.map((o2) => o2.join(",")).join("\n");
|
|
3998
|
+
}
|
|
3987
3999
|
}
|
|
3988
4000
|
_coords() {
|
|
3989
|
-
|
|
4001
|
+
let coordStr = this.getterValue;
|
|
4002
|
+
coordStr = coordStr.replace(/(\d+[\°°]?\d*[\']?\d*[\"]?[\d\.]*)\s+(\d+[\°°]?\d*[\']?\d*[\"]?[\d\.]*)/g, "$1,$2");
|
|
4003
|
+
const locs = coordListByStr(coordStr);
|
|
3990
4004
|
const newLocs = [...new Set(locs.map((a2) => a2.join(",")))].map((s2) => s2.split(","));
|
|
3991
4005
|
if (newLocs.length < locs.length)
|
|
3992
4006
|
this.options.onMini && this.options.onMini();
|
|
@@ -4017,6 +4031,15 @@ class PositionControl extends KeyboardControl {
|
|
|
4017
4031
|
this._toggleCityPanel();
|
|
4018
4032
|
};
|
|
4019
4033
|
div.append(areaBtn);
|
|
4034
|
+
const locateBtn = document.createElement("span");
|
|
4035
|
+
locateBtn.innerText = "\u5B9A\u4F4D";
|
|
4036
|
+
locateBtn.className = "wk-c-app wk-c-p wk-o-hover-70 wk-ease-300 wk-m-r-10";
|
|
4037
|
+
locateBtn.onclick = (e2) => {
|
|
4038
|
+
e2.preventDefault();
|
|
4039
|
+
e2.stopPropagation();
|
|
4040
|
+
this._handleLocate();
|
|
4041
|
+
};
|
|
4042
|
+
div.append(locateBtn);
|
|
4020
4043
|
const clearBtn = document.createElement("span");
|
|
4021
4044
|
clearBtn.innerText = "\u6E05\u7A7A";
|
|
4022
4045
|
clearBtn.className = "wk-c-danger wk-c-hover-danger wk-c-p wk-ease-300 wk-o-hover-70 wk-scale-active-90 wk-m-l-10";
|
|
@@ -4148,7 +4171,7 @@ class PositionControl extends KeyboardControl {
|
|
|
4148
4171
|
}
|
|
4149
4172
|
console.log("\u63A7\u4EF6\u4F4D\u7F6E:", isOnRight ? "\u53F3\u4FA7" : "\u5DE6\u4FA7");
|
|
4150
4173
|
console.log("\u4E3B\u6D6E\u7A97\u5C3A\u5BF8:", mainRect.width, "x", mainRect.height);
|
|
4151
|
-
console.log("\u9762\u677F\u5C3A\u5BF8:", panelWidth, "x",
|
|
4174
|
+
console.log("\u9762\u677F\u5C3A\u5BF8:", panelWidth, "x", 220);
|
|
4152
4175
|
}
|
|
4153
4176
|
_toggleCityPanel() {
|
|
4154
4177
|
if (!this._map) {
|
|
@@ -4191,6 +4214,26 @@ class PositionControl extends KeyboardControl {
|
|
|
4191
4214
|
}, 100);
|
|
4192
4215
|
}
|
|
4193
4216
|
}
|
|
4217
|
+
_handleLocate() {
|
|
4218
|
+
const textarea = this._container.querySelector("textarea");
|
|
4219
|
+
if (!textarea)
|
|
4220
|
+
return;
|
|
4221
|
+
const inputValue = textarea.value.trim();
|
|
4222
|
+
if (!inputValue) {
|
|
4223
|
+
console.warn("\u8BF7\u8F93\u5165\u5750\u6807");
|
|
4224
|
+
return;
|
|
4225
|
+
}
|
|
4226
|
+
this.value = inputValue;
|
|
4227
|
+
this._navigate(false);
|
|
4228
|
+
const newLocs = this._coords();
|
|
4229
|
+
if (newLocs.length === 0) {
|
|
4230
|
+
console.warn("\u6CA1\u6709\u6709\u6548\u7684\u5750\u6807");
|
|
4231
|
+
return;
|
|
4232
|
+
}
|
|
4233
|
+
setTimeout(() => {
|
|
4234
|
+
this.current = 0;
|
|
4235
|
+
}, 100);
|
|
4236
|
+
}
|
|
4194
4237
|
}
|
|
4195
4238
|
var FUNC_ERROR_TEXT = "Expected a function";
|
|
4196
4239
|
var NAN = 0 / 0;
|