mapboxgl-tools 2.2.12 → 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 +37 -4
- package/dist/ui.umd.js +1 -1
- package/package.json +1 -1
package/dist/ui.es.js
CHANGED
|
@@ -3914,7 +3914,7 @@ class PositionControl extends KeyboardControl {
|
|
|
3914
3914
|
_resetData() {
|
|
3915
3915
|
this.flagValue = false;
|
|
3916
3916
|
}
|
|
3917
|
-
_navigate() {
|
|
3917
|
+
_navigate(updateInput = true) {
|
|
3918
3918
|
this.current = -1;
|
|
3919
3919
|
const newLocs = this._coords();
|
|
3920
3920
|
if (this.options.type === "feature") {
|
|
@@ -3993,10 +3993,14 @@ class PositionControl extends KeyboardControl {
|
|
|
3993
3993
|
li.append(span);
|
|
3994
3994
|
ul.append(li);
|
|
3995
3995
|
}
|
|
3996
|
-
|
|
3996
|
+
if (updateInput) {
|
|
3997
|
+
this.getterValue = newLocs.map((o2) => o2.join(",")).join("\n");
|
|
3998
|
+
}
|
|
3997
3999
|
}
|
|
3998
4000
|
_coords() {
|
|
3999
|
-
|
|
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);
|
|
4000
4004
|
const newLocs = [...new Set(locs.map((a2) => a2.join(",")))].map((s2) => s2.split(","));
|
|
4001
4005
|
if (newLocs.length < locs.length)
|
|
4002
4006
|
this.options.onMini && this.options.onMini();
|
|
@@ -4027,6 +4031,15 @@ class PositionControl extends KeyboardControl {
|
|
|
4027
4031
|
this._toggleCityPanel();
|
|
4028
4032
|
};
|
|
4029
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);
|
|
4030
4043
|
const clearBtn = document.createElement("span");
|
|
4031
4044
|
clearBtn.innerText = "\u6E05\u7A7A";
|
|
4032
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";
|
|
@@ -4158,7 +4171,7 @@ class PositionControl extends KeyboardControl {
|
|
|
4158
4171
|
}
|
|
4159
4172
|
console.log("\u63A7\u4EF6\u4F4D\u7F6E:", isOnRight ? "\u53F3\u4FA7" : "\u5DE6\u4FA7");
|
|
4160
4173
|
console.log("\u4E3B\u6D6E\u7A97\u5C3A\u5BF8:", mainRect.width, "x", mainRect.height);
|
|
4161
|
-
console.log("\u9762\u677F\u5C3A\u5BF8:", panelWidth, "x",
|
|
4174
|
+
console.log("\u9762\u677F\u5C3A\u5BF8:", panelWidth, "x", 220);
|
|
4162
4175
|
}
|
|
4163
4176
|
_toggleCityPanel() {
|
|
4164
4177
|
if (!this._map) {
|
|
@@ -4201,6 +4214,26 @@ class PositionControl extends KeyboardControl {
|
|
|
4201
4214
|
}, 100);
|
|
4202
4215
|
}
|
|
4203
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
|
+
}
|
|
4204
4237
|
}
|
|
4205
4238
|
var FUNC_ERROR_TEXT = "Expected a function";
|
|
4206
4239
|
var NAN = 0 / 0;
|