@watergis/maplibre-gl-terradraw 1.9.0 → 1.9.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.
|
@@ -8,10 +8,10 @@ function x() {
|
|
|
8
8
|
return s;
|
|
9
9
|
}, x.apply(null, arguments);
|
|
10
10
|
}
|
|
11
|
-
var
|
|
11
|
+
var E;
|
|
12
12
|
(function(s) {
|
|
13
13
|
s.Commit = "commit", s.Provisional = "provisional", s.Finish = "finish";
|
|
14
|
-
})(
|
|
14
|
+
})(E || (E = {}));
|
|
15
15
|
const _ = { SELECTED: "selected", MID_POINT: "midPoint", SELECTION_POINT_FEATURE_ID: "selectionPointFeatureId", SELECTION_POINT: "selectionPoint" }, S = { MODE: "mode", CURRENTLY_DRAWING: "currentlyDrawing", EDITED: "edited", CLOSING_POINT: "closingPoint", SNAPPING_POINT: "snappingPoint", COORDINATE_POINT: "coordinatePoint", COORDINATE_POINT_FEATURE_ID: "coordinatePointFeatureId", COORDINATE_POINT_IDS: "coordinatePointIds", PROVISIONAL_COORDINATE_COUNT: "provisionalCoordinateCount", COMMITTED_COORDINATE_COUNT: "committedCoordinateCount" }, U = 10;
|
|
16
16
|
function Le(s) {
|
|
17
17
|
return !!(s && typeof s == "object" && s !== null && !Array.isArray(s));
|
|
@@ -95,7 +95,7 @@ class j {
|
|
|
95
95
|
return r ? { valid: !1, reason: r } : { valid: !0 };
|
|
96
96
|
})(e, this.store.idStrategy.isValidId);
|
|
97
97
|
if (this.validate) {
|
|
98
|
-
const i = this.validate(e, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType:
|
|
98
|
+
const i = this.validate(e, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Provisional });
|
|
99
99
|
return { valid: t.valid && i.valid, reason: i.reason };
|
|
100
100
|
}
|
|
101
101
|
return { valid: t.valid, reason: t.reason };
|
|
@@ -146,30 +146,30 @@ function G(s, e) {
|
|
|
146
146
|
const t = (d) => d * Math.PI / 180, i = t(s[1]), o = t(s[0]), r = t(e[1]), n = r - i, a = t(e[0]) - o, l = Math.sin(n / 2) * Math.sin(n / 2) + Math.cos(i) * Math.cos(r) * Math.sin(a / 2) * Math.sin(a / 2);
|
|
147
147
|
return 2 * Math.atan2(Math.sqrt(l), Math.sqrt(1 - l)) * 6371e3 / 1e3;
|
|
148
148
|
}
|
|
149
|
-
const
|
|
149
|
+
const Et = 63710088e-1;
|
|
150
150
|
function D(s) {
|
|
151
151
|
return s % 360 * Math.PI / 180;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function bt(s) {
|
|
154
154
|
return s / 6371.0088;
|
|
155
155
|
}
|
|
156
156
|
function V(s) {
|
|
157
157
|
return s % (2 * Math.PI) * 180 / Math.PI;
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function b(s, e = 9) {
|
|
160
160
|
const t = Math.pow(10, e);
|
|
161
161
|
return Math.round(s * t) / t;
|
|
162
162
|
}
|
|
163
163
|
const ot = 57.29577951308232, rt = 0.017453292519943295, xe = 6378137, O = (s, e) => ({ x: s === 0 ? 0 : s * rt * xe, y: e === 0 ? 0 : Math.log(Math.tan(Math.PI / 4 + e * rt / 2)) * xe }), A = (s, e) => ({ lng: s === 0 ? 0 : ot * (s / xe), lat: e === 0 ? 0 : (2 * Math.atan(Math.exp(e / xe)) - Math.PI / 2) * ot });
|
|
164
164
|
function ii(s, e, t) {
|
|
165
|
-
const i = D(s[0]), o = D(s[1]), r = D(t), n =
|
|
165
|
+
const i = D(s[0]), o = D(s[1]), r = D(t), n = bt(e), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(r));
|
|
166
166
|
return [V(i + Math.atan2(Math.sin(r) * Math.sin(n) * Math.cos(o), Math.cos(n) - Math.sin(o) * Math.sin(a))), V(a)];
|
|
167
167
|
}
|
|
168
168
|
function st(s) {
|
|
169
169
|
const { center: e, radiusKilometers: t, coordinatePrecision: i } = s, o = s.steps ? s.steps : 64, r = [];
|
|
170
170
|
for (let n = 0; n < o; n++) {
|
|
171
171
|
const a = ii(e, t, -360 * n / o);
|
|
172
|
-
r.push([
|
|
172
|
+
r.push([b(a[0], i), b(a[1], i)]);
|
|
173
173
|
}
|
|
174
174
|
return r.push(r[0]), { type: "Feature", geometry: { type: "Polygon", coordinates: [r] }, properties: {} };
|
|
175
175
|
}
|
|
@@ -200,7 +200,7 @@ function Ue(s) {
|
|
|
200
200
|
function fe(s, e) {
|
|
201
201
|
return s[0] === e[0] && s[1] === e[1];
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function be(s, e) {
|
|
204
204
|
return nt(s[0]) <= e && nt(s[1]) <= e;
|
|
205
205
|
}
|
|
206
206
|
function Ae(s) {
|
|
@@ -219,7 +219,7 @@ function we(s, e) {
|
|
|
219
219
|
if (s.geometry.coordinates[0].length < 4) return { valid: !1, reason: ri };
|
|
220
220
|
for (let o = 0; o < s.geometry.coordinates[0].length; o++) {
|
|
221
221
|
if (!Ae(s.geometry.coordinates[0][o])) return { valid: !1, reason: si };
|
|
222
|
-
if (!
|
|
222
|
+
if (!be(s.geometry.coordinates[0][o], e)) return { valid: !1, reason: "Feature has coordinates with excessive precision" };
|
|
223
223
|
}
|
|
224
224
|
return (t = s.geometry.coordinates[0][0])[0] !== (i = s.geometry.coordinates[0][s.geometry.coordinates[0].length - 1])[0] || t[1] !== i[1] ? { valid: !1, reason: ni } : { valid: !0 };
|
|
225
225
|
var t, i;
|
|
@@ -242,7 +242,7 @@ let wt = class extends j {
|
|
|
242
242
|
const e = this.currentCircleId;
|
|
243
243
|
if (this.validate && e) {
|
|
244
244
|
const t = this.store.getGeometryCopy(e);
|
|
245
|
-
if (!this.validate({ type: "Feature", id: e, geometry: t, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType:
|
|
245
|
+
if (!this.validate({ type: "Feature", id: e, geometry: t, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid) return;
|
|
246
246
|
}
|
|
247
247
|
this.cursorMovedAfterInitialCursorDown = !1, this.center = void 0, this.currentCircleId = void 0, this.clickCount = 0, this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
|
|
248
248
|
}
|
|
@@ -303,7 +303,7 @@ let wt = class extends j {
|
|
|
303
303
|
const { center: n, radiusKilometers: a, coordinatePrecision: l } = r, d = r.steps ? r.steps : 64, c = 1e3 * a, [h, u] = n, { x: p, y: g } = O(h, u), y = [];
|
|
304
304
|
for (let f = 0; f < d; f++) {
|
|
305
305
|
const v = 360 * f / d * Math.PI / 180, C = c * Math.cos(v), m = c * Math.sin(v), [P, I] = [p + C, g + m], { lng: w, lat: L } = A(P, I);
|
|
306
|
-
y.push([
|
|
306
|
+
y.push([b(w, l), b(L, l)]);
|
|
307
307
|
}
|
|
308
308
|
return y.push(y[0]), { type: "Feature", geometry: { type: "Polygon", coordinates: [y] }, properties: {} };
|
|
309
309
|
})({ center: this.center, radiusKilometers: t * o, coordinatePrecision: this.coordinatePrecision });
|
|
@@ -311,7 +311,7 @@ let wt = class extends j {
|
|
|
311
311
|
if (this.projection !== "globe") throw new Error("Invalid projection");
|
|
312
312
|
i = st({ center: this.center, radiusKilometers: t, coordinatePrecision: this.coordinatePrecision });
|
|
313
313
|
}
|
|
314
|
-
if (this.validate && !this.validate({ type: "Feature", id: this.currentCircleId, geometry: i.geometry, properties: { radiusKilometers: t } }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType:
|
|
314
|
+
if (this.validate && !this.validate({ type: "Feature", id: this.currentCircleId, geometry: i.geometry, properties: { radiusKilometers: t } }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Provisional }).valid) return;
|
|
315
315
|
this.store.updateGeometry([{ id: this.currentCircleId, geometry: i.geometry }]), this.store.updateProperty([{ id: this.currentCircleId, property: "radiusKilometers", value: t }]);
|
|
316
316
|
}
|
|
317
317
|
}
|
|
@@ -351,7 +351,7 @@ class Lt extends j {
|
|
|
351
351
|
const e = this.currentId;
|
|
352
352
|
if (this.validate && e) {
|
|
353
353
|
const t = this.store.getGeometryCopy(e);
|
|
354
|
-
if (!this.validate({ type: "Feature", id: e, geometry: t, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType:
|
|
354
|
+
if (!this.validate({ type: "Feature", id: e, geometry: t, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid) return;
|
|
355
355
|
}
|
|
356
356
|
this.closingPointId && this.store.delete([this.closingPointId]), this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.hasLeftStartingPoint = !1, this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
|
|
357
357
|
}
|
|
@@ -372,7 +372,7 @@ class Lt extends j {
|
|
|
372
372
|
if (l < this.minDistance) return;
|
|
373
373
|
t.coordinates[0].pop();
|
|
374
374
|
const p = { type: "Polygon", coordinates: [[...t.coordinates[0], [e.lng, e.lat], t.coordinates[0][0]]] };
|
|
375
|
-
this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: p, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType:
|
|
375
|
+
this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: p, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Provisional }).valid || this.store.updateGeometry([{ id: this.currentId, geometry: p }]);
|
|
376
376
|
}
|
|
377
377
|
onClick(e) {
|
|
378
378
|
if (e.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, e) || e.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, e) || e.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, e)) {
|
|
@@ -462,7 +462,7 @@ let Oe = class extends B {
|
|
|
462
462
|
}
|
|
463
463
|
};
|
|
464
464
|
function at(s, e, t) {
|
|
465
|
-
const i = D(s[0]), o = D(s[1]), r = D(t), n =
|
|
465
|
+
const i = D(s[0]), o = D(s[1]), r = D(t), n = bt(e), a = Math.asin(Math.sin(o) * Math.cos(n) + Math.cos(o) * Math.sin(n) * Math.cos(r));
|
|
466
466
|
return [V(i + Math.atan2(Math.sin(r) * Math.sin(n) * Math.cos(o), Math.cos(n) - Math.sin(o) * Math.sin(a))), V(a)];
|
|
467
467
|
}
|
|
468
468
|
function ue({ x: s, y: e }, t, i) {
|
|
@@ -541,7 +541,7 @@ class ui extends B {
|
|
|
541
541
|
return this.limitCoordinates(r);
|
|
542
542
|
}
|
|
543
543
|
limitCoordinates(e) {
|
|
544
|
-
return e.map((t) => [
|
|
544
|
+
return e.map((t) => [b(t[0], this.config.coordinatePrecision), b(t[1], this.config.coordinatePrecision)]);
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
547
|
function te(s, e) {
|
|
@@ -552,7 +552,7 @@ function Re(s, e) {
|
|
|
552
552
|
if (s.geometry.coordinates.length < 2) return { valid: !1, reason: "Feature has less than 2 coordinates" };
|
|
553
553
|
for (let t = 0; t < s.geometry.coordinates.length; t++) {
|
|
554
554
|
if (!Ae(s.geometry.coordinates[t])) return { valid: !1, reason: "Feature has invalid coordinates" };
|
|
555
|
-
if (!
|
|
555
|
+
if (!be(s.geometry.coordinates[t], e)) return { valid: !1, reason: "Feature has coordinates with excessive precision" };
|
|
556
556
|
}
|
|
557
557
|
return { valid: !0 };
|
|
558
558
|
}
|
|
@@ -590,10 +590,10 @@ class Ge extends B {
|
|
|
590
590
|
constructor(e, t, i) {
|
|
591
591
|
super(e), this.config = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.getSnappableCoordinateFirstClick = (o) => {
|
|
592
592
|
const r = this.getSnappable(o, (n) => !!(n.properties && n.properties.mode === this.mode));
|
|
593
|
-
return r.coordinate ? [
|
|
593
|
+
return r.coordinate ? [b(r.coordinate[0], this.config.coordinatePrecision), b(r.coordinate[1], this.config.coordinatePrecision)] : void 0;
|
|
594
594
|
}, this.getSnappableCoordinate = (o, r) => {
|
|
595
595
|
const n = this.getSnappable(o, (a) => !!(a.properties && a.properties.mode === this.mode && a.id !== r));
|
|
596
|
-
return n.coordinate ? [
|
|
596
|
+
return n.coordinate ? [b(n.coordinate[0], this.config.coordinatePrecision), b(n.coordinate[1], this.config.coordinatePrecision)] : void 0;
|
|
597
597
|
}, this.config = e, this.pixelDistance = t, this.clickBoundingBox = i;
|
|
598
598
|
}
|
|
599
599
|
getSnappable(e, t) {
|
|
@@ -634,7 +634,7 @@ class Ge extends B {
|
|
|
634
634
|
return y === 1 / 0 ? void 0 : { coordinate: g, distance: y, lineIndex: f };
|
|
635
635
|
})(c, l)), !d) return;
|
|
636
636
|
const h = this.pixelDistance.measure(e, d.coordinate);
|
|
637
|
-
h < r.minDistance && h < this.pointerDistance && (r.featureId = n.id, r.coordinate = [
|
|
637
|
+
h < r.minDistance && h < this.pointerDistance && (r.featureId = n.id, r.coordinate = [b(d.coordinate[0], this.config.coordinatePrecision), b(d.coordinate[1], this.config.coordinatePrecision)], r.featureCoordinateIndex = d.lineIndex, r.minDistance = h);
|
|
638
638
|
}), r;
|
|
639
639
|
}
|
|
640
640
|
}
|
|
@@ -661,7 +661,7 @@ class ze extends j {
|
|
|
661
661
|
close() {
|
|
662
662
|
if (this.currentId === void 0) return;
|
|
663
663
|
const e = this.store.getGeometryCopy(this.currentId);
|
|
664
|
-
e.coordinates.pop(), this.updateGeometries([...e.coordinates], void 0,
|
|
664
|
+
e.coordinates.pop(), this.updateGeometries([...e.coordinates], void 0, E.Commit), this.store.updateProperty([{ id: this.currentId, property: S.CURRENTLY_DRAWING, value: void 0 }]);
|
|
665
665
|
const t = this.currentId;
|
|
666
666
|
this.closingPointId && this.store.delete([this.closingPointId]), this.snappedPointId && this.store.delete([this.snappedPointId]), this.currentCoordinate = 0, this.currentId = void 0, this.closingPointId = void 0, this.snappedPointId = void 0, this.lastCommittedCoordinates = void 0, this.state === "drawing" && this.setStarted(), this.onFinish(t, { mode: this.mode, action: "draw" });
|
|
667
667
|
}
|
|
@@ -688,7 +688,7 @@ class ze extends j {
|
|
|
688
688
|
const t = this.store.getGeometryCopy(this.currentId).coordinates, [i] = this.store.create([{ geometry: { type: "Point", coordinates: [...e] }, properties: { mode: this.mode, [S.CLOSING_POINT]: !0 } }]);
|
|
689
689
|
this.closingPointId = i, this.setCursor(this.cursors.close);
|
|
690
690
|
const o = [...t, e];
|
|
691
|
-
this.updateGeometries(o, void 0,
|
|
691
|
+
this.updateGeometries(o, void 0, E.Commit), this.currentCoordinate++;
|
|
692
692
|
}
|
|
693
693
|
updateToLine(e, t) {
|
|
694
694
|
if (!this.currentId) return;
|
|
@@ -696,7 +696,7 @@ class ze extends j {
|
|
|
696
696
|
if (F({ x: n, y: a }, { x: t.x, y: t.y }) < this.pointerDistance) return void this.close();
|
|
697
697
|
this.setCursor(this.cursors.close);
|
|
698
698
|
const l = [...i, e];
|
|
699
|
-
this.updateGeometries(l, i[i.length - 1],
|
|
699
|
+
this.updateGeometries(l, i[i.length - 1], E.Commit), this.currentCoordinate++;
|
|
700
700
|
}
|
|
701
701
|
registerBehaviors(e) {
|
|
702
702
|
this.coordinateSnapping = new Oe(e, new oe(e), new ie(e)), this.insertPoint = new ui(e), this.clickBoundingBox = new ie(e), this.pixelDistance = new oe(e), this.lineSnapping = new Ge(e, this.pixelDistance, this.clickBoundingBox), this.coordinateSnapping = new Oe(e, this.pixelDistance, this.clickBoundingBox);
|
|
@@ -724,7 +724,7 @@ class ze extends j {
|
|
|
724
724
|
o = [...this.lastCommittedCoordinates.slice(0, -1), ...a, t];
|
|
725
725
|
}
|
|
726
726
|
}
|
|
727
|
-
this.updateGeometries(o, void 0,
|
|
727
|
+
this.updateGeometries(o, void 0, E.Provisional);
|
|
728
728
|
}
|
|
729
729
|
onRightClick(e) {
|
|
730
730
|
if (!this.editable || this.state !== "started") return;
|
|
@@ -733,7 +733,7 @@ class ze extends j {
|
|
|
733
733
|
const o = this.store.getGeometryCopy(t);
|
|
734
734
|
let r;
|
|
735
735
|
if (o.type === "LineString" && (r = o.coordinates, !(r.length <= 2))) {
|
|
736
|
-
if (r.splice(i, 1), this.validate && !this.validate({ id: t, type: "Feature", geometry: o, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType:
|
|
736
|
+
if (r.splice(i, 1), this.validate && !this.validate({ id: t, type: "Feature", geometry: o, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Commit }).valid) return;
|
|
737
737
|
this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: t, geometry: o }]), this.onFinish(t, { mode: this.mode, action: "edit" });
|
|
738
738
|
}
|
|
739
739
|
}
|
|
@@ -772,7 +772,7 @@ class ze extends j {
|
|
|
772
772
|
const i = this.store.getGeometryCopy(this.editedFeatureId);
|
|
773
773
|
this.editedSnapType === "coordinate" || this.editedSnapType === "line" && this.editedInsertIndex !== void 0 ? i.coordinates[this.editedFeatureCoordinateIndex] = [e.lng, e.lat] : this.editedSnapType === "line" && this.editedInsertIndex === void 0 && (this.editedInsertIndex = this.editedFeatureCoordinateIndex + 1, i.coordinates.splice(this.editedInsertIndex, 0, [e.lng, e.lat]), this.editedFeatureCoordinateIndex++);
|
|
774
774
|
const o = { type: "LineString", coordinates: i.coordinates };
|
|
775
|
-
this.validate && !this.validate({ type: "Feature", geometry: o, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType:
|
|
775
|
+
this.validate && !this.validate({ type: "Feature", geometry: o, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Provisional }).valid || (this.snapping && this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: this.editedFeatureId, geometry: o }]), this.editedPointId && this.store.updateGeometry([{ id: this.editedPointId, geometry: { type: "Point", coordinates: [e.lng, e.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }]));
|
|
776
776
|
}
|
|
777
777
|
onDragEnd(e, t) {
|
|
778
778
|
this.allowPointerEvent(this.pointerEvents.onDragEnd, e) && this.editedFeatureId !== void 0 && (this.setCursor(this.cursors.dragEnd), this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !1 }]), this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedInsertIndex = void 0, this.editedSnapType = void 0, t(!0));
|
|
@@ -815,7 +815,7 @@ class ze extends j {
|
|
|
815
815
|
}
|
|
816
816
|
const mi = "Feature is not a Point", vi = "Feature has invalid coordinates", Ci = "Feature has coordinates with excessive precision";
|
|
817
817
|
function Ve(s, e) {
|
|
818
|
-
return s.geometry.type !== "Point" ? { valid: !1, reason: mi } : Ae(s.geometry.coordinates) ?
|
|
818
|
+
return s.geometry.type !== "Point" ? { valid: !1, reason: mi } : Ae(s.geometry.coordinates) ? be(s.geometry.coordinates, e) ? { valid: !0 } : { valid: !1, reason: Ci } : { valid: !1, reason: vi };
|
|
819
819
|
}
|
|
820
820
|
const Pi = { create: "crosshair", dragStart: "grabbing", dragEnd: "crosshair" };
|
|
821
821
|
class $e extends j {
|
|
@@ -853,7 +853,7 @@ class $e extends j {
|
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
855
|
onDrag(e, t) {
|
|
856
|
-
this.allowPointerEvent(this.pointerEvents.onDrag, e) && this.editedFeatureId !== void 0 && (this.validate && !this.validate({ type: "Feature", geometry: { type: "Point", coordinates: [e.lng, e.lat] }, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType:
|
|
856
|
+
this.allowPointerEvent(this.pointerEvents.onDrag, e) && this.editedFeatureId !== void 0 && (this.validate && !this.validate({ type: "Feature", geometry: { type: "Point", coordinates: [e.lng, e.lat] }, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid || (this.store.updateGeometry([{ id: this.editedFeatureId, geometry: { type: "Point", coordinates: [e.lng, e.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }])));
|
|
857
857
|
}
|
|
858
858
|
onDragEnd(e, t) {
|
|
859
859
|
this.allowPointerEvent(this.pointerEvents.onDragEnd, e) && this.editedFeatureId !== void 0 && (this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.setCursor(this.cursors.dragEnd), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !1 }]), this.editedFeatureId = void 0, t(!0));
|
|
@@ -874,7 +874,7 @@ class $e extends j {
|
|
|
874
874
|
}
|
|
875
875
|
onLeftClick(e) {
|
|
876
876
|
const t = { type: "Point", coordinates: [e.lng, e.lat] }, i = { mode: this.mode };
|
|
877
|
-
if (this.validate && !this.validate({ type: "Feature", geometry: t, properties: i }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType:
|
|
877
|
+
if (this.validate && !this.validate({ type: "Feature", geometry: t, properties: i }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid) return;
|
|
878
878
|
const [o] = this.store.create([{ geometry: t, properties: i }]);
|
|
879
879
|
this.onFinish(o, { mode: this.mode, action: "draw" });
|
|
880
880
|
}
|
|
@@ -998,7 +998,7 @@ class Dt extends j {
|
|
|
998
998
|
close() {
|
|
999
999
|
if (this.currentId === void 0) return;
|
|
1000
1000
|
const e = this.store.getGeometryCopy(this.currentId).coordinates[0];
|
|
1001
|
-
if (e.length < 5 || !this.updatePolygonGeometry([...e.slice(0, -2), e[0]],
|
|
1001
|
+
if (e.length < 5 || !this.updatePolygonGeometry([...e.slice(0, -2), e[0]], E.Finish)) return;
|
|
1002
1002
|
const t = this.currentId;
|
|
1003
1003
|
if (this.currentId) {
|
|
1004
1004
|
const i = ye(this.store.getGeometryCopy(this.currentId));
|
|
@@ -1038,7 +1038,7 @@ class Dt extends j {
|
|
|
1038
1038
|
const { isClosing: o, isPreviousClosing: r } = this.closingPoints.isClosingPoint(e);
|
|
1039
1039
|
r || o ? (this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.setCursor(this.cursors.close), i = [...t.slice(0, -2), t[0], t[0]]) : i = [...t.slice(0, -2), [e.lng, e.lat], t[0]];
|
|
1040
1040
|
}
|
|
1041
|
-
this.store.updateProperty([{ id: this.currentId, property: S.PROVISIONAL_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.updatePolygonGeometry(i,
|
|
1041
|
+
this.store.updateProperty([{ id: this.currentId, property: S.PROVISIONAL_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.updatePolygonGeometry(i, E.Provisional);
|
|
1042
1042
|
}
|
|
1043
1043
|
updatePolygonGeometry(e, t) {
|
|
1044
1044
|
if (!this.currentId) return !1;
|
|
@@ -1067,7 +1067,7 @@ class Dt extends j {
|
|
|
1067
1067
|
if (!t || i === void 0) return;
|
|
1068
1068
|
const o = this.store.getGeometryCopy(t);
|
|
1069
1069
|
let r;
|
|
1070
|
-
o.type === "Polygon" && (r = o.coordinates[0], r.length <= 4 || (o.type !== "Polygon" || i !== 0 && i !== r.length - 1 ? r.splice(i, 1) : (r.shift(), r.pop(), r.push([r[0][0], r[0][1]])), (!this.validate || this.validate({ id: t, type: "Feature", geometry: o, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType:
|
|
1070
|
+
o.type === "Polygon" && (r = o.coordinates[0], r.length <= 4 || (o.type !== "Polygon" || i !== 0 && i !== r.length - 1 ? r.splice(i, 1) : (r.shift(), r.pop(), r.push([r[0][0], r[0][1]])), (!this.validate || this.validate({ id: t, type: "Feature", geometry: o, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Commit }).valid) && (this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: t, geometry: o }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(t), this.onFinish(t, { mode: this.mode, action: "edit" }))));
|
|
1071
1071
|
}
|
|
1072
1072
|
onLeftClick(e) {
|
|
1073
1073
|
if (this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.currentCoordinate === 0) {
|
|
@@ -1079,13 +1079,13 @@ class Dt extends j {
|
|
|
1079
1079
|
const t = this.snapCoordinate(e);
|
|
1080
1080
|
t && (e.lng = t[0], e.lat = t[1]);
|
|
1081
1081
|
const i = this.store.getGeometryCopy(this.currentId);
|
|
1082
|
-
if (te([e.lng, e.lat], i.coordinates[0][0]) || !this.updatePolygonGeometry([i.coordinates[0][0], [e.lng, e.lat], [e.lng, e.lat], i.coordinates[0][0]],
|
|
1082
|
+
if (te([e.lng, e.lat], i.coordinates[0][0]) || !this.updatePolygonGeometry([i.coordinates[0][0], [e.lng, e.lat], [e.lng, e.lat], i.coordinates[0][0]], E.Commit)) return;
|
|
1083
1083
|
this.store.updateProperty([{ id: this.currentId, property: S.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++;
|
|
1084
1084
|
} else if (this.currentCoordinate === 2 && this.currentId) {
|
|
1085
1085
|
const t = this.snapCoordinate(e);
|
|
1086
1086
|
t && (e.lng = t[0], e.lat = t[1]);
|
|
1087
1087
|
const i = this.store.getGeometryCopy(this.currentId).coordinates[0];
|
|
1088
|
-
if (te([e.lng, e.lat], i[1]) || !this.updatePolygonGeometry([i[0], i[1], [e.lng, e.lat], [e.lng, e.lat], i[0]],
|
|
1088
|
+
if (te([e.lng, e.lat], i[1]) || !this.updatePolygonGeometry([i[0], i[1], [e.lng, e.lat], [e.lng, e.lat], i[0]], E.Commit)) return;
|
|
1089
1089
|
this.currentCoordinate === 2 && this.closingPoints.create(i, "polygon"), this.store.updateProperty([{ id: this.currentId, property: S.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++;
|
|
1090
1090
|
} else if (this.currentId) {
|
|
1091
1091
|
const t = this.store.getGeometryCopy(this.currentId).coordinates[0], { isClosing: i, isPreviousClosing: o } = this.closingPoints.isClosingPoint(e);
|
|
@@ -1096,7 +1096,7 @@ class Dt extends j {
|
|
|
1096
1096
|
const n = /* @__PURE__ */ (function(a = [[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]) {
|
|
1097
1097
|
return { type: "Feature", geometry: { type: "Polygon", coordinates: a }, properties: {} };
|
|
1098
1098
|
})([[...t.slice(0, -1), [e.lng, e.lat], t[0]]]);
|
|
1099
|
-
if (!this.updatePolygonGeometry(n.geometry.coordinates[0],
|
|
1099
|
+
if (!this.updatePolygonGeometry(n.geometry.coordinates[0], E.Commit)) return;
|
|
1100
1100
|
this.store.updateProperty([{ id: this.currentId, property: S.COMMITTED_COORDINATE_COUNT, value: this.currentCoordinate + 1 }]), this.currentCoordinate++, this.closingPoints.ids.length && this.closingPoints.update(n.geometry.coordinates[0]);
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
@@ -1131,7 +1131,7 @@ class Dt extends j {
|
|
|
1131
1131
|
const i = this.store.getGeometryCopy(this.editedFeatureId), o = i.coordinates[0];
|
|
1132
1132
|
this.editedSnapType === "coordinate" || this.editedSnapType === "line" && this.editedInsertIndex !== void 0 ? this.editedFeatureCoordinateIndex === 0 || this.editedFeatureCoordinateIndex === i.coordinates[0].length - 1 ? (o[0] = [e.lng, e.lat], o[o.length - 1] = [e.lng, e.lat]) : o[this.editedFeatureCoordinateIndex] = [e.lng, e.lat] : this.editedSnapType === "line" && this.editedInsertIndex === void 0 && (this.editedInsertIndex = this.editedFeatureCoordinateIndex + 1, i.coordinates[0].splice(this.editedInsertIndex, 0, [e.lng, e.lat]), this.editedFeatureCoordinateIndex++);
|
|
1133
1133
|
const r = { type: "Polygon", coordinates: i.coordinates };
|
|
1134
|
-
this.validate && !this.validate({ type: "Feature", geometry: r, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType:
|
|
1134
|
+
this.validate && !this.validate({ type: "Feature", geometry: r, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Provisional }).valid || (this.snapping && this.snappedPointId && (this.store.delete([this.snappedPointId]), this.snappedPointId = void 0), this.store.updateGeometry([{ id: this.editedFeatureId, geometry: r }]), this.showCoordinatePoints && this.coordinatePoints.createOrUpdate(this.editedFeatureId), this.editedPointId && this.store.updateGeometry([{ id: this.editedPointId, geometry: { type: "Point", coordinates: [e.lng, e.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }]));
|
|
1135
1135
|
}
|
|
1136
1136
|
onDragEnd(e, t) {
|
|
1137
1137
|
this.allowPointerEvent(this.pointerEvents.onDragEnd, e) && this.editedFeatureId !== void 0 && (this.setCursor(this.cursors.dragEnd), this.editedPointId && (this.store.delete([this.editedPointId]), this.editedPointId = void 0), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !1 }]), this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.editedFeatureId = void 0, this.editedFeatureCoordinateIndex = void 0, this.editedInsertIndex = void 0, this.editedSnapType = void 0, t(!0));
|
|
@@ -1167,10 +1167,10 @@ class Dt extends j {
|
|
|
1167
1167
|
return this.validateModeFeature(e, (t) => we(t, this.coordinatePrecision));
|
|
1168
1168
|
}
|
|
1169
1169
|
}
|
|
1170
|
-
const Oi = { cancel: "Escape", finish: "Enter" },
|
|
1170
|
+
const Oi = { cancel: "Escape", finish: "Enter" }, Ei = { start: "crosshair" };
|
|
1171
1171
|
class kt extends j {
|
|
1172
1172
|
constructor(e) {
|
|
1173
|
-
super(e, !0), this.mode = "rectangle", this.center = void 0, this.clickCount = 0, this.currentRectangleId = void 0, this.keyEvents = Oi, this.cursors =
|
|
1173
|
+
super(e, !0), this.mode = "rectangle", this.center = void 0, this.clickCount = 0, this.currentRectangleId = void 0, this.keyEvents = Oi, this.cursors = Ei, this.updateOptions(e);
|
|
1174
1174
|
}
|
|
1175
1175
|
updateOptions(e) {
|
|
1176
1176
|
super.updateOptions(e), e != null && e.cursors && (this.cursors = x({}, this.cursors, e.cursors)), e?.keyEvents === null ? this.keyEvents = { cancel: null, finish: null } : e != null && e.keyEvents && (this.keyEvents = x({}, this.keyEvents, e.keyEvents));
|
|
@@ -1201,10 +1201,10 @@ class kt extends j {
|
|
|
1201
1201
|
this.center = [e.lng, e.lat];
|
|
1202
1202
|
const [t] = this.store.create([{ geometry: { type: "Polygon", coordinates: [[[e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat], [e.lng, e.lat]]] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
|
|
1203
1203
|
this.currentRectangleId = t, this.clickCount++, this.setDrawing();
|
|
1204
|
-
} else this.updateRectangle(e,
|
|
1204
|
+
} else this.updateRectangle(e, E.Finish), this.close();
|
|
1205
1205
|
}
|
|
1206
1206
|
onMouseMove(e) {
|
|
1207
|
-
this.updateRectangle(e,
|
|
1207
|
+
this.updateRectangle(e, E.Provisional);
|
|
1208
1208
|
}
|
|
1209
1209
|
onKeyDown() {
|
|
1210
1210
|
}
|
|
@@ -1287,7 +1287,7 @@ function Ne(s, e) {
|
|
|
1287
1287
|
function _t(s, e, t) {
|
|
1288
1288
|
let i = e;
|
|
1289
1289
|
e < 0 && (i = -Math.abs(i));
|
|
1290
|
-
const o = i /
|
|
1290
|
+
const o = i / Et, r = s[0] * Math.PI / 180, n = D(s[1]), a = D(t), l = o * Math.cos(a);
|
|
1291
1291
|
let d = n + l;
|
|
1292
1292
|
Math.abs(d) > Math.PI / 2 && (d = d > 0 ? Math.PI - d : -Math.PI - d);
|
|
1293
1293
|
const c = Math.log(Math.tan(d / 2 + Math.PI / 4) / Math.tan(n / 2 + Math.PI / 4)), h = Math.abs(c) > 1e-11 ? l / c : Math.cos(n), u = [(180 * (r + o * Math.sin(a) / h) / Math.PI + 540) % 360 - 180, 180 * d / Math.PI];
|
|
@@ -1295,11 +1295,11 @@ function _t(s, e, t) {
|
|
|
1295
1295
|
}
|
|
1296
1296
|
function Nt(s, e, t, i, o) {
|
|
1297
1297
|
const r = i(s[0], s[1]), n = i(e[0], e[1]), { lng: a, lat: l } = o((r.x + n.x) / 2, (r.y + n.y) / 2);
|
|
1298
|
-
return [
|
|
1298
|
+
return [b(a, t), b(l, t)];
|
|
1299
1299
|
}
|
|
1300
|
-
function
|
|
1300
|
+
function bi(s, e, t) {
|
|
1301
1301
|
const i = _t(s, 1e3 * G(s, e) / 2, Ne(s, e));
|
|
1302
|
-
return [
|
|
1302
|
+
return [b(i[0], t), b(i[1], t)];
|
|
1303
1303
|
}
|
|
1304
1304
|
function ht({ featureCoords: s, precision: e, unproject: t, project: i, projection: o }) {
|
|
1305
1305
|
const r = [];
|
|
@@ -1308,7 +1308,7 @@ function ht({ featureCoords: s, precision: e, unproject: t, project: i, projecti
|
|
|
1308
1308
|
if (o === "web-mercator") a = Nt(s[n], s[n + 1], e, i, t);
|
|
1309
1309
|
else {
|
|
1310
1310
|
if (o !== "globe") throw new Error("Invalid projection");
|
|
1311
|
-
a =
|
|
1311
|
+
a = bi(s[n], s[n + 1], e);
|
|
1312
1312
|
}
|
|
1313
1313
|
r.push(a);
|
|
1314
1314
|
}
|
|
@@ -1444,12 +1444,12 @@ class Mi extends B {
|
|
|
1444
1444
|
const g = [this.dragPosition[0] - o[0], this.dragPosition[1] - o[1]];
|
|
1445
1445
|
u = h[0] - g[0], p = h[1] - g[1];
|
|
1446
1446
|
}
|
|
1447
|
-
if (u =
|
|
1447
|
+
if (u = b(u, this.config.coordinatePrecision), p = b(p, this.config.coordinatePrecision), u > 180 || u < -180 || p > 90 || p < -90) return !1;
|
|
1448
1448
|
r[c] = [u, p];
|
|
1449
1449
|
}
|
|
1450
1450
|
i.type === "Polygon" && (r[r.length - 1] = [r[0][0], r[0][1]]);
|
|
1451
1451
|
const a = this.selectionPoints.getUpdated(r) || [], l = this.midPoints.getUpdated(r) || [], d = this.coordinatePoints.getUpdated(this.draggedFeatureId, r) || [];
|
|
1452
|
-
if (t && !t({ type: "Feature", id: this.draggedFeatureId, geometry: i, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType:
|
|
1452
|
+
if (t && !t({ type: "Feature", id: this.draggedFeatureId, geometry: i, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: E.Provisional }).valid) return !1;
|
|
1453
1453
|
this.store.updateGeometry([{ id: this.draggedFeatureId, geometry: i }, ...a, ...l, ...d]), this.dragPosition = [e.lng, e.lat];
|
|
1454
1454
|
} else i.type === "Point" && (this.store.updateGeometry([{ id: this.draggedFeatureId, geometry: { type: "Point", coordinates: o } }]), this.dragPosition = [e.lng, e.lat]);
|
|
1455
1455
|
}
|
|
@@ -1506,7 +1506,7 @@ class Di extends B {
|
|
|
1506
1506
|
d[0] = u, d[v] = u;
|
|
1507
1507
|
} else d[n] = u;
|
|
1508
1508
|
const p = this.selectionPoints.getOneUpdated(n, u), g = p ? [p] : [], y = this.midPoints.getUpdated(d) || [], f = this.coordinatePoints.getUpdated(r, d) || [];
|
|
1509
|
-
return !(a.type !== "Point" && !t && Ue({ geometry: a }) || i && !i(h, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType:
|
|
1509
|
+
return !(a.type !== "Point" && !t && Ue({ geometry: a }) || i && !i(h, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: E.Provisional }).valid || (this.store.updateGeometry([{ id: r, geometry: a }, ...g, ...y, ...f]), 0));
|
|
1510
1510
|
}
|
|
1511
1511
|
isDragging() {
|
|
1512
1512
|
return this.draggedCoordinate.id !== null;
|
|
@@ -1583,7 +1583,7 @@ class ki extends B {
|
|
|
1583
1583
|
(u.geometry.type === "Polygon" ? u.geometry.coordinates[0] : u.geometry.coordinates).forEach((y) => {
|
|
1584
1584
|
const f = Ne(g, y) + p, v = (function(m, P) {
|
|
1585
1585
|
m[0] += m[0] - P[0] > 180 ? -360 : P[0] - m[0] > 180 ? 360 : 0;
|
|
1586
|
-
const I =
|
|
1586
|
+
const I = Et, w = P[1] * Math.PI / 180, L = m[1] * Math.PI / 180, M = L - w;
|
|
1587
1587
|
let N = Math.abs(m[0] - P[0]) * Math.PI / 180;
|
|
1588
1588
|
N > Math.PI && (N -= 2 * Math.PI);
|
|
1589
1589
|
const k = Math.log(Math.tan(L / 2 + Math.PI / 4) / Math.tan(w / 2 + Math.PI / 4)), T = Math.abs(k) > 1e-11 ? M / k : Math.cos(w);
|
|
@@ -1595,10 +1595,10 @@ class ki extends B {
|
|
|
1595
1595
|
}
|
|
1596
1596
|
const l = o.type === "Polygon" ? o.coordinates[0] : o.coordinates;
|
|
1597
1597
|
l.forEach((u) => {
|
|
1598
|
-
u[0] =
|
|
1598
|
+
u[0] = b(u[0], this.coordinatePrecision), u[1] = b(u[1], this.coordinatePrecision);
|
|
1599
1599
|
});
|
|
1600
1600
|
const d = this.midPoints.getUpdated(l) || [], c = this.selectionPoints.getUpdated(l) || [], h = this.coordinatePoints.getUpdated(t, l) || [];
|
|
1601
|
-
if (i && !i({ id: t, type: "Feature", geometry: o, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType:
|
|
1601
|
+
if (i && !i({ id: t, type: "Feature", geometry: o, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: E.Provisional })) return !1;
|
|
1602
1602
|
this.store.updateGeometry([{ id: t, geometry: o }, ...c, ...d, ...h]), this.projection === "web-mercator" ? this.lastBearing = n : this.projection === "globe" && (this.lastBearing = n + 180);
|
|
1603
1603
|
}
|
|
1604
1604
|
}
|
|
@@ -1779,10 +1779,10 @@ class Ni extends B {
|
|
|
1779
1779
|
if (t === "center" ? r = this.centerWebMercatorDrag(e) : t === "opposite" ? r = this.oppositeWebMercatorDrag(e) : t === "center-fixed" ? r = this.centerFixedWebMercatorDrag(e) : t === "opposite-fixed" && (r = this.oppositeFixedWebMercatorDrag(e)), !r) return !1;
|
|
1780
1780
|
for (let c = 0; c < r.length; c++) {
|
|
1781
1781
|
const h = r[c];
|
|
1782
|
-
if (h[0] =
|
|
1782
|
+
if (h[0] = b(h[0], this.coordinatePrecision), h[1] = b(h[1], this.coordinatePrecision), !be(h, this.coordinatePrecision)) return !1;
|
|
1783
1783
|
}
|
|
1784
1784
|
const n = this.midPoints.getUpdated(r) || [], a = this.selectionPoints.getUpdated(r) || [], l = this.coordinatePoints.getUpdated(o.id, r) || [], d = { type: o.geometry.type, coordinates: o.geometry.type === "Polygon" ? [r] : r };
|
|
1785
|
-
return !(i && !i({ id: this.draggedCoordinate.id, type: "Feature", geometry: d, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType:
|
|
1785
|
+
return !(i && !i({ id: this.draggedCoordinate.id, type: "Feature", geometry: d, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: E.Provisional }).valid || (this.store.updateGeometry([{ id: this.draggedCoordinate.id, geometry: d }, ...a, ...n, ...l]), 0));
|
|
1786
1786
|
}
|
|
1787
1787
|
}
|
|
1788
1788
|
const Ti = { deselect: "Escape", delete: "Delete", rotate: ["Control", "r"], scale: ["Control", "s"] }, pt = { pointerOver: "move", dragStart: "move", dragEnd: "move", insertMidpoint: "crosshair" };
|
|
@@ -1833,7 +1833,7 @@ class Ye extends ti {
|
|
|
1833
1833
|
if (d.type === "Polygon") {
|
|
1834
1834
|
if (c = d.coordinates[0], c.length <= 4) return;
|
|
1835
1835
|
} else if (d.type === "LineString" && (c = d.coordinates, c.length <= 2)) return;
|
|
1836
|
-
if (!c || (d.type !== "Polygon" || r !== 0 && r !== c.length - 1 ? c.splice(r, 1) : (c.shift(), c.pop(), c.push([c[0][0], c[0][1]])), l && !l({ id: o, type: "Feature", geometry: d, properties: n }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType:
|
|
1836
|
+
if (!c || (d.type !== "Polygon" || r !== 0 && r !== c.length - 1 ? c.splice(r, 1) : (c.shift(), c.pop(), c.push([c[0][0], c[0][1]])), l && !l({ id: o, type: "Feature", geometry: d, properties: n }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Commit }).valid)) return;
|
|
1837
1837
|
const h = [...this.midPoints.ids, ...this.selectionPoints.ids];
|
|
1838
1838
|
this.store.delete(h), this.store.updateGeometry([{ id: o, geometry: d }]), n.coordinatePointIds && this.coordinatePoints.createOrUpdate(o), this.selectionPoints.create(c, d.type, o), a && a.feature && a.feature.coordinates && a.feature.coordinates.midpoints && this.midPoints.create(c, o, this.coordinatePrecision);
|
|
1839
1839
|
}
|
|
@@ -2431,9 +2431,9 @@ class Ut extends j {
|
|
|
2431
2431
|
const M = (L.x - w.x) * (I.y - w.y) - (L.y - w.y) * (I.x - w.x);
|
|
2432
2432
|
return M > 1e-10 ? "left" : M < -1e-10 ? "right" : "left";
|
|
2433
2433
|
})(a, d, c) === "right" ? -90 : 90), v = ue(a, y, f), C = ue(d, y, f), m = A(v.x, v.y), P = A(C.x, C.y);
|
|
2434
|
-
i = [t[0], t[1], [
|
|
2434
|
+
i = [t[0], t[1], [b(P.lng, this.coordinatePrecision), b(P.lat, this.coordinatePrecision)], [b(m.lng, this.coordinatePrecision), b(m.lat, this.coordinatePrecision)], t[0]];
|
|
2435
2435
|
}
|
|
2436
|
-
i && this.updatePolygonGeometry(this.currentId, i,
|
|
2436
|
+
i && this.updatePolygonGeometry(this.currentId, i, E.Provisional);
|
|
2437
2437
|
}
|
|
2438
2438
|
updatePolygonGeometry(e, t, i) {
|
|
2439
2439
|
const o = { type: "Polygon", coordinates: [t] };
|
|
@@ -2445,7 +2445,7 @@ class Ut extends j {
|
|
|
2445
2445
|
this.currentId = t, this.currentCoordinate++, this.setDrawing();
|
|
2446
2446
|
} else if (this.currentCoordinate === 1 && this.currentId) {
|
|
2447
2447
|
const t = this.store.getGeometryCopy(this.currentId);
|
|
2448
|
-
if (te([e.lng, e.lat], t.coordinates[0][0]) || !this.updatePolygonGeometry(this.currentId, [t.coordinates[0][0], [e.lng, e.lat], [e.lng, e.lat], t.coordinates[0][0]],
|
|
2448
|
+
if (te([e.lng, e.lat], t.coordinates[0][0]) || !this.updatePolygonGeometry(this.currentId, [t.coordinates[0][0], [e.lng, e.lat], [e.lng, e.lat], t.coordinates[0][0]], E.Commit)) return;
|
|
2449
2449
|
this.currentCoordinate++;
|
|
2450
2450
|
} else this.currentCoordinate === 2 && this.currentId && this.close();
|
|
2451
2451
|
}
|
|
@@ -2525,12 +2525,12 @@ class Rt extends j {
|
|
|
2525
2525
|
const C = (this.direction === "anticlockwise" ? 1 : -1) * v / p;
|
|
2526
2526
|
g.push(r);
|
|
2527
2527
|
for (let m = 0; m <= p; m++) {
|
|
2528
|
-
const P = ue(a, c, y + m * C), { lng: I, lat: w } = A(P.x, P.y), L = [
|
|
2528
|
+
const P = ue(a, c, y + m * C), { lng: I, lat: w } = A(P.x, P.y), L = [b(I, this.coordinatePrecision), b(w, this.coordinatePrecision)];
|
|
2529
2529
|
L[0] !== g[g.length - 1][0] && L[1] !== g[g.length - 1][1] && g.push(L);
|
|
2530
2530
|
}
|
|
2531
2531
|
g.push(o), i = [...g];
|
|
2532
2532
|
}
|
|
2533
|
-
i && this.updatePolygonGeometry(this.currentId, i,
|
|
2533
|
+
i && this.updatePolygonGeometry(this.currentId, i, E.Provisional);
|
|
2534
2534
|
}
|
|
2535
2535
|
updatePolygonGeometry(e, t, i) {
|
|
2536
2536
|
const o = { type: "Polygon", coordinates: [t] };
|
|
@@ -2542,7 +2542,7 @@ class Rt extends j {
|
|
|
2542
2542
|
this.currentId = t, this.currentCoordinate++, this.setDrawing();
|
|
2543
2543
|
} else if (this.currentCoordinate === 1 && this.currentId) {
|
|
2544
2544
|
const t = this.store.getGeometryCopy(this.currentId);
|
|
2545
|
-
if (te([e.lng, e.lat], t.coordinates[0][0]) || !this.updatePolygonGeometry(this.currentId, [t.coordinates[0][0], [e.lng, e.lat], [e.lng, e.lat], t.coordinates[0][0]],
|
|
2545
|
+
if (te([e.lng, e.lat], t.coordinates[0][0]) || !this.updatePolygonGeometry(this.currentId, [t.coordinates[0][0], [e.lng, e.lat], [e.lng, e.lat], t.coordinates[0][0]], E.Commit)) return;
|
|
2546
2546
|
this.currentCoordinate++;
|
|
2547
2547
|
} else this.currentCoordinate === 2 && this.currentId && this.close();
|
|
2548
2548
|
}
|
|
@@ -2611,10 +2611,10 @@ class Gt extends j {
|
|
|
2611
2611
|
this.direction === "anticlockwise" ? (f = y - g, f < 0 && (f += 360)) : (f = g - y, f < 0 && (f += 360));
|
|
2612
2612
|
const v = (this.direction === "anticlockwise" ? 1 : -1) * f / u;
|
|
2613
2613
|
for (let C = 0; C <= u; C++) {
|
|
2614
|
-
const m = ue(l, d, g + C * v), { lng: P, lat: I } = A(m.x, m.y), w = [
|
|
2614
|
+
const m = ue(l, d, g + C * v), { lng: P, lat: I } = A(m.x, m.y), w = [b(P, this.coordinatePrecision), b(I, this.coordinatePrecision)];
|
|
2615
2615
|
w[0] !== p[p.length - 1][0] && w[1] !== p[p.length - 1][1] && p.push(w);
|
|
2616
2616
|
}
|
|
2617
|
-
this.updateLineStringGeometry(this.currentInitialArcId, p,
|
|
2617
|
+
this.updateLineStringGeometry(this.currentInitialArcId, p, E.Provisional);
|
|
2618
2618
|
} else if (this.currentCoordinate === 3) {
|
|
2619
2619
|
const t = this.store.getGeometryCopy(this.currentInitialArcId).coordinates;
|
|
2620
2620
|
if (t.length < 2 || !this.direction) return;
|
|
@@ -2622,10 +2622,10 @@ class Gt extends j {
|
|
|
2622
2622
|
if (this.notInSector({ normalizedCursor: v, normalizedStart: y, normalizedEnd: f, direction: this.direction })) return;
|
|
2623
2623
|
const C = this.getDeltaBearing(this.direction, y, f), m = this.arcPoints, P = (this.direction === "anticlockwise" ? 1 : -1) * C / m, I = F(d, h), w = [];
|
|
2624
2624
|
for (let L = 0; L <= m; L++) {
|
|
2625
|
-
const M = ue(d, I, y + L * P), { lng: N, lat: k } = A(M.x, M.y), T = [
|
|
2625
|
+
const M = ue(d, I, y + L * P), { lng: N, lat: k } = A(M.x, M.y), T = [b(N, this.coordinatePrecision), b(k, this.coordinatePrecision)];
|
|
2626
2626
|
T[0] !== t[t.length - 1][0] && T[1] !== t[t.length - 1][1] && w.unshift(T);
|
|
2627
2627
|
}
|
|
2628
|
-
t.push(...w), t.push(t[0]), this.currentId ? this.updatePolygonGeometry(this.currentId, t,
|
|
2628
|
+
t.push(...w), t.push(t[0]), this.currentId ? this.updatePolygonGeometry(this.currentId, t, E.Provisional) : [this.currentId] = this.store.create([{ geometry: { type: "Polygon", coordinates: [t] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
|
|
2629
2629
|
}
|
|
2630
2630
|
}
|
|
2631
2631
|
}
|
|
@@ -2693,7 +2693,7 @@ class Z {
|
|
|
2693
2693
|
}
|
|
2694
2694
|
var Qi = { __proto__: null, TerraDrawBaseAdapter: class {
|
|
2695
2695
|
constructor(s) {
|
|
2696
|
-
this._nextKeyUpIsContextMenu = !1, this._minPixelDragDistance = void 0, this._minPixelDragDistanceDrawing = void 0, this._minPixelDragDistanceSelecting = void 0, this._lastDrawEvent = void 0, this._coordinatePrecision = void 0, this._heldKeys = /* @__PURE__ */ new Set(), this._listeners = [], this._dragState = "not-dragging", this._currentModeCallbacks = void 0, this._minPixelDragDistance = typeof s.minPixelDragDistance == "number" ? s.minPixelDragDistance : 1, this._minPixelDragDistanceSelecting = typeof s.minPixelDragDistanceSelecting == "number" ? s.minPixelDragDistanceSelecting : 1, this._minPixelDragDistanceDrawing = typeof s.minPixelDragDistanceDrawing == "number" ? s.minPixelDragDistanceDrawing : 8, this._coordinatePrecision = typeof s.coordinatePrecision == "number" ? s.coordinatePrecision : 9;
|
|
2696
|
+
this._nextKeyUpIsContextMenu = !1, this._lastPointerDownEventTarget = void 0, this._ignoreMismatchedPointerEvents = !1, this._minPixelDragDistance = void 0, this._minPixelDragDistanceDrawing = void 0, this._minPixelDragDistanceSelecting = void 0, this._lastDrawEvent = void 0, this._coordinatePrecision = void 0, this._heldKeys = /* @__PURE__ */ new Set(), this._listeners = [], this._dragState = "not-dragging", this._currentModeCallbacks = void 0, this._ignoreMismatchedPointerEvents = typeof s.ignoreMismatchedPointerEvents == "boolean" && s.ignoreMismatchedPointerEvents, this._minPixelDragDistance = typeof s.minPixelDragDistance == "number" ? s.minPixelDragDistance : 1, this._minPixelDragDistanceSelecting = typeof s.minPixelDragDistanceSelecting == "number" ? s.minPixelDragDistanceSelecting : 1, this._minPixelDragDistanceDrawing = typeof s.minPixelDragDistanceDrawing == "number" ? s.minPixelDragDistanceDrawing : 8, this._coordinatePrecision = typeof s.coordinatePrecision == "number" ? s.coordinatePrecision : 9;
|
|
2697
2697
|
}
|
|
2698
2698
|
getButton(s) {
|
|
2699
2699
|
return s.button === -1 ? "neither" : s.button === 0 ? "left" : s.button === 1 ? "middle" : s.button === 2 ? "right" : "neither";
|
|
@@ -2706,7 +2706,7 @@ var Qi = { __proto__: null, TerraDrawBaseAdapter: class {
|
|
|
2706
2706
|
const t = this.getLngLatFromEvent(s);
|
|
2707
2707
|
if (!t) return null;
|
|
2708
2708
|
const { lng: i, lat: o } = t, { containerX: r, containerY: n } = this.getMapElementXYPosition(s), a = this.getButton(s), l = Array.from(this._heldKeys);
|
|
2709
|
-
return { lng:
|
|
2709
|
+
return { lng: b(i, this._coordinatePrecision), lat: b(o, this._coordinatePrecision), containerX: r, containerY: n, button: a, heldKeys: l, isContextMenu: e };
|
|
2710
2710
|
}
|
|
2711
2711
|
register(s) {
|
|
2712
2712
|
this._currentModeCallbacks = s, this._listeners = this.getAdapterListeners(), this._listeners.forEach((e) => {
|
|
@@ -2720,7 +2720,7 @@ var Qi = { __proto__: null, TerraDrawBaseAdapter: class {
|
|
|
2720
2720
|
return [new Z({ name: "pointerdown", callback: (s) => {
|
|
2721
2721
|
if (!this._currentModeCallbacks || !s.isPrimary) return;
|
|
2722
2722
|
const e = this.getDrawEventFromEvent(s);
|
|
2723
|
-
e && (this._dragState = "pre-dragging", this._lastDrawEvent = e);
|
|
2723
|
+
e && (this._dragState = "pre-dragging", this._lastDrawEvent = e, this._lastPointerDownEventTarget = s.target ? s.target : void 0);
|
|
2724
2724
|
}, register: (s) => {
|
|
2725
2725
|
this.getMapEventElement().addEventListener("pointerdown", s);
|
|
2726
2726
|
}, unregister: (s) => {
|
|
@@ -2752,7 +2752,7 @@ var Qi = { __proto__: null, TerraDrawBaseAdapter: class {
|
|
|
2752
2752
|
}, unregister: (s) => {
|
|
2753
2753
|
this.getMapEventElement().removeEventListener("contextmenu", s);
|
|
2754
2754
|
} }), new Z({ name: "pointerup", callback: (s) => {
|
|
2755
|
-
if (!this._currentModeCallbacks || s.target !== this.getMapEventElement() || !s.isPrimary) return;
|
|
2755
|
+
if (!this._currentModeCallbacks || s.target !== this.getMapEventElement() || this._ignoreMismatchedPointerEvents && this._lastPointerDownEventTarget !== s.target || (this._lastPointerDownEventTarget = void 0, !s.isPrimary)) return;
|
|
2756
2756
|
const e = this.getDrawEventFromEvent(s);
|
|
2757
2757
|
e && (this._dragState === "dragging" ? this._currentModeCallbacks.onDragEnd(e, (t) => {
|
|
2758
2758
|
this.setDraggability.bind(this)(t);
|
|
@@ -2778,7 +2778,7 @@ var Qi = { __proto__: null, TerraDrawBaseAdapter: class {
|
|
|
2778
2778
|
unregister() {
|
|
2779
2779
|
this._listeners.forEach((s) => {
|
|
2780
2780
|
s.unregister();
|
|
2781
|
-
}), this.clear(), this._currentModeCallbacks = void 0;
|
|
2781
|
+
}), this.clear(), this._currentModeCallbacks = void 0, this._lastDrawEvent = void 0, this._lastPointerDownEventTarget = void 0, this._nextKeyUpIsContextMenu = !1;
|
|
2782
2782
|
}
|
|
2783
2783
|
} };
|
|
2784
2784
|
const eo = { cancel: "Escape", finish: "Enter" }, to = { start: "crosshair", close: "pointer" };
|
|
@@ -2795,7 +2795,7 @@ class zt extends j {
|
|
|
2795
2795
|
const e = this.currentId;
|
|
2796
2796
|
if (this.validate && e) {
|
|
2797
2797
|
const t = this.store.getGeometryCopy(e);
|
|
2798
|
-
if (!this.validate({ type: "Feature", id: e, geometry: t, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType:
|
|
2798
|
+
if (!this.validate({ type: "Feature", id: e, geometry: t, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid) return;
|
|
2799
2799
|
}
|
|
2800
2800
|
this.closingPointId && this.store.delete([this.closingPointId]), this.startingClick = !1, this.currentId = void 0, this.closingPointId = void 0, this.state === "drawing" && this.setStarted(), this.onFinish(e, { mode: this.mode, action: "draw" });
|
|
2801
2801
|
}
|
|
@@ -2810,7 +2810,7 @@ class zt extends j {
|
|
|
2810
2810
|
const t = this.store.getGeometryCopy(this.currentId), i = t.coordinates.length - 2, [o, r] = t.coordinates[i], { x: n, y: a } = this.project(o, r), l = F({ x: n, y: a }, { x: e.containerX, y: e.containerY }), [d, c] = t.coordinates[t.coordinates.length - 1], { x: h, y: u } = this.project(d, c), p = F({ x: h, y: u }, { x: e.containerX, y: e.containerY });
|
|
2811
2811
|
if (this.setCursor(p < this.pointerDistance ? this.cursors.close : this.cursors.start), l < this.minDistance) return;
|
|
2812
2812
|
const g = { type: "LineString", coordinates: [...t.coordinates, [e.lng, e.lat]] };
|
|
2813
|
-
this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: g, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType:
|
|
2813
|
+
this.validate && !this.validate({ type: "Feature", id: this.currentId, geometry: g, properties: {} }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Provisional }).valid || (this.store.updateGeometry([{ id: this.currentId, geometry: g }]), this.closingPointId && this.store.updateGeometry([{ id: this.closingPointId, geometry: { type: "Point", coordinates: [e.lng, e.lat] } }]));
|
|
2814
2814
|
}
|
|
2815
2815
|
onClick(e) {
|
|
2816
2816
|
if (e.button === "right" && this.allowPointerEvent(this.pointerEvents.rightClick, e) || e.button === "left" && this.allowPointerEvent(this.pointerEvents.leftClick, e) || e.isContextMenu && this.allowPointerEvent(this.pointerEvents.contextMenu, e)) {
|
|
@@ -2903,7 +2903,7 @@ class Vt extends j {
|
|
|
2903
2903
|
}
|
|
2904
2904
|
}
|
|
2905
2905
|
onDrag(e, t) {
|
|
2906
|
-
this.allowPointerEvent(this.pointerEvents.onDrag, e) && this.editedFeatureId !== void 0 && (this.validate && !this.validate({ type: "Feature", geometry: { type: "Point", coordinates: [e.lng, e.lat] }, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType:
|
|
2906
|
+
this.allowPointerEvent(this.pointerEvents.onDrag, e) && this.editedFeatureId !== void 0 && (this.validate && !this.validate({ type: "Feature", geometry: { type: "Point", coordinates: [e.lng, e.lat] }, properties: this.store.getPropertiesCopy(this.editedFeatureId) }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid || (this.store.updateGeometry([{ id: this.editedFeatureId, geometry: { type: "Point", coordinates: [e.lng, e.lat] } }]), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !0 }])));
|
|
2907
2907
|
}
|
|
2908
2908
|
onDragEnd(e, t) {
|
|
2909
2909
|
this.allowPointerEvent(this.pointerEvents.onDragEnd, e) && this.editedFeatureId !== void 0 && (this.onFinish(this.editedFeatureId, { mode: this.mode, action: "edit" }), this.setCursor(this.cursors.dragEnd), this.store.updateProperty([{ id: this.editedFeatureId, property: S.EDITED, value: !1 }]), this.editedFeatureId = void 0, t(!0));
|
|
@@ -2921,7 +2921,7 @@ class Vt extends j {
|
|
|
2921
2921
|
}
|
|
2922
2922
|
onLeftClick(e) {
|
|
2923
2923
|
const t = { type: "Point", coordinates: [e.lng, e.lat] }, i = { mode: this.mode, markerUrl: this.markerUrl, markerHeight: this.markerHeight, markerWidth: this.markerWidth };
|
|
2924
|
-
if (this.validate && !this.validate({ type: "Feature", geometry: t, properties: i }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType:
|
|
2924
|
+
if (this.validate && !this.validate({ type: "Feature", geometry: t, properties: i }, { project: this.project, unproject: this.unproject, coordinatePrecision: this.coordinatePrecision, updateType: E.Finish }).valid) return;
|
|
2925
2925
|
const [o] = this.store.create([{ geometry: t, properties: i }]);
|
|
2926
2926
|
this.onFinish(o, { mode: this.mode, action: "draw" });
|
|
2927
2927
|
}
|
|
@@ -3157,7 +3157,7 @@ class oo {
|
|
|
3157
3157
|
const { x: a, y: l } = O(t.origin[0], t.origin[1]);
|
|
3158
3158
|
Bt({ coordinates: n, originX: a, originY: l, xScale: t.options.xScale || 1, yScale: t.options.yScale || 1 });
|
|
3159
3159
|
} else t.type === "rotate" && (i = Wt(i, t.options.angle || 0), n = i.geometry.type === "Polygon" ? i.geometry.coordinates[0] : i.geometry.coordinates);
|
|
3160
|
-
if (n = n.map((a) => [
|
|
3160
|
+
if (n = n.map((a) => [b(a[0], this._adapter.getCoordinatePrecision()), b(a[1], this._adapter.getCoordinatePrecision())]), i.geometry.coordinates = i.geometry.type === "Polygon" ? [n] : n, this._store.updateGeometry([{ id: i.id, geometry: i.geometry }], { origin: "api" }), r.afterFeatureUpdated) {
|
|
3161
3161
|
r.afterFeatureUpdated(i);
|
|
3162
3162
|
const a = i.properties[_.SELECTED], l = this.getSelectMode({ switchToSelectMode: !1 });
|
|
3163
3163
|
l && a && l.afterFeatureUpdated(i);
|
|
@@ -3224,7 +3224,7 @@ class oo {
|
|
|
3224
3224
|
}
|
|
3225
3225
|
class ro extends Qi.TerraDrawBaseAdapter {
|
|
3226
3226
|
constructor(e) {
|
|
3227
|
-
super(e), this._renderBeforeLayerId = void 0, this._prefixId = void 0, this._initialDragPan = void 0, this._initialDragRotate = void 0, this._nextRender = void 0, this._map = void 0, this._container = void 0, this.
|
|
3227
|
+
super(e), this._renderBeforeLayerId = void 0, this._prefixId = void 0, this._initialDragPan = void 0, this._initialDragRotate = void 0, this._nextRender = void 0, this._map = void 0, this._container = void 0, this.changedIds = { deletion: !1, points: !1, linestrings: !1, polygons: !1, styling: !1 }, this._map = e.map, this._container = this._map.getContainer(), this._initialDragRotate = this._map.dragRotate.isEnabled(), this._initialDragPan = this._map.dragPan.isEnabled(), this._renderBeforeLayerId = e.renderBelowLayerId, this._prefixId = e.prefixId || "td";
|
|
3228
3228
|
}
|
|
3229
3229
|
hashCode(e) {
|
|
3230
3230
|
let t = 0;
|
|
@@ -3309,14 +3309,13 @@ class ro extends Qi.TerraDrawBaseAdapter {
|
|
|
3309
3309
|
for (let c = 0; c < i.length; c++) {
|
|
3310
3310
|
const h = i[c], { properties: u } = h, p = t[u.mode](h);
|
|
3311
3311
|
if (u.zIndex = p.zIndex, u.zIndex = p.zIndex, h.geometry.type === "Point") {
|
|
3312
|
-
if (u.pointColor = p.pointColor, u.pointOutlineColor = p.pointOutlineColor, u.pointOutlineWidth = p.pointOutlineWidth, u.pointWidth = p.pointWidth, p.markerUrl && p.markerWidth && p.markerHeight)
|
|
3313
|
-
else {
|
|
3312
|
+
if (u.pointColor = p.pointColor, u.pointOutlineColor = p.pointOutlineColor, u.pointOutlineWidth = p.pointOutlineWidth, u.pointWidth = p.pointWidth, p.markerUrl && p.markerWidth && p.markerHeight) {
|
|
3314
3313
|
const g = `marker-${this.hashCode(p.markerUrl)}`;
|
|
3315
|
-
this.resizeImage(p.markerUrl, p.markerWidth, p.markerHeight, (y) => {
|
|
3314
|
+
this._map.hasImage(g) || this.resizeImage(p.markerUrl, p.markerWidth, p.markerHeight, (y) => {
|
|
3316
3315
|
this._map.loadImage(y).then((f) => {
|
|
3317
|
-
this._map.addImage(g, f.data);
|
|
3316
|
+
this._map.hasImage(g) || this._map.addImage(g, f.data);
|
|
3318
3317
|
});
|
|
3319
|
-
}),
|
|
3318
|
+
}), u.markerId = g, u.pointWidth = 0;
|
|
3320
3319
|
}
|
|
3321
3320
|
o.push(h);
|
|
3322
3321
|
} else h.geometry.type === "LineString" ? (u.lineStringColor = p.lineStringColor, u.lineStringWidth = p.lineStringWidth, r.push(h)) : h.geometry.type === "Polygon" && (u.polygonFillColor = p.polygonFillColor, u.polygonFillOpacity = p.polygonFillOpacity, u.polygonOutlineColor = p.polygonOutlineColor, u.polygonOutlineWidth = p.polygonOutlineWidth, n.push(h));
|
|
@@ -4890,17 +4889,17 @@ const xt = (s, e, t, i, o = "metric", r = q) => {
|
|
|
4890
4889
|
}
|
|
4891
4890
|
return s;
|
|
4892
4891
|
};
|
|
4893
|
-
var Oo = Object.defineProperty,
|
|
4894
|
-
function
|
|
4892
|
+
var Oo = Object.defineProperty, Eo = (s, e, t) => e in s ? Oo(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, le = (s, e, t) => Eo(s, typeof e != "symbol" ? e + "" : e, t), Ee = 2 * Math.PI * 6378137 / 2;
|
|
4893
|
+
function bo(s) {
|
|
4895
4894
|
return s = s || 256, 2 * Math.PI * 6378137 / s;
|
|
4896
4895
|
}
|
|
4897
4896
|
function wo(s, e, t = { enable: !0, decimal: 1 }) {
|
|
4898
4897
|
s = He(s);
|
|
4899
|
-
var i = s[0], o = s[1], r = i *
|
|
4900
|
-
return n = n *
|
|
4898
|
+
var i = s[0], o = s[1], r = i * Ee / 180, n = Math.log(Math.tan((90 + o) * Math.PI / 360)) / (Math.PI / 180);
|
|
4899
|
+
return n = n * Ee / 180, t.enable && (r = Number(r.toFixed(t.decimal)), n = Number(n.toFixed(t.decimal))), [r, n];
|
|
4901
4900
|
}
|
|
4902
4901
|
function Lo(s, e, t) {
|
|
4903
|
-
var i = s[0], o = s[1], r = No(e, t), n = (i +
|
|
4902
|
+
var i = s[0], o = s[1], r = No(e, t), n = (i + Ee) / r, a = (o + Ee) / r;
|
|
4904
4903
|
return [n, a, e];
|
|
4905
4904
|
}
|
|
4906
4905
|
function Ht(s, e, t) {
|
|
@@ -4956,7 +4955,7 @@ function He(s, e) {
|
|
|
4956
4955
|
return i > 85 && (i = 85), i < -85 && (i = -85), [t, i];
|
|
4957
4956
|
}
|
|
4958
4957
|
function No(s, e) {
|
|
4959
|
-
return
|
|
4958
|
+
return bo(e) / Math.pow(2, s);
|
|
4960
4959
|
}
|
|
4961
4960
|
function To(s) {
|
|
4962
4961
|
if (s == null) throw new Error("lat is required");
|