@watergis/maplibre-gl-terradraw 1.8.0 → 1.8.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.
|
@@ -153,7 +153,7 @@ function Oe(r) {
|
|
|
153
153
|
function V(r) {
|
|
154
154
|
return r % (2 * Math.PI) * 180 / Math.PI;
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function b(r, t = 9) {
|
|
157
157
|
const e = Math.pow(10, t);
|
|
158
158
|
return Math.round(r * e) / e;
|
|
159
159
|
}
|
|
@@ -166,7 +166,7 @@ function oe(r) {
|
|
|
166
166
|
const { center: t, radiusKilometers: e, coordinatePrecision: i } = r, o = r.steps ? r.steps : 64, s = [];
|
|
167
167
|
for (let n = 0; n < o; n++) {
|
|
168
168
|
const a = ti(t, e, -360 * n / o);
|
|
169
|
-
s.push([
|
|
169
|
+
s.push([b(a[0], i), b(a[1], i)]);
|
|
170
170
|
}
|
|
171
171
|
return s.push(s[0]), { type: "Feature", geometry: { type: "Polygon", coordinates: [s] }, properties: {} };
|
|
172
172
|
}
|
|
@@ -186,8 +186,8 @@ function jt(r) {
|
|
|
186
186
|
function o(s, n, a, l) {
|
|
187
187
|
const d = t[s][n], c = t[s][n + 1], h = t[a][l], u = t[a][l + 1], p = (function(m, v, C, f) {
|
|
188
188
|
if (gt(m, C) || gt(m, f) || gt(v, C) || gt(f, C)) return null;
|
|
189
|
-
const P = m[0], I = m[1],
|
|
190
|
-
return $ === 0 ? null : [((P * L - I *
|
|
189
|
+
const P = m[0], I = m[1], w = v[0], L = v[1], M = C[0], N = C[1], _ = f[0], T = f[1], $ = (P - w) * (N - T) - (I - L) * (M - _);
|
|
190
|
+
return $ === 0 ? null : [((P * L - I * w) * (M - _) - (P - w) * (M * T - N * _)) / $, ((P * L - I * w) * (N - T) - (I - L) * (M * T - N * _)) / $];
|
|
191
191
|
})(d, c, h, u);
|
|
192
192
|
if (p === null) return;
|
|
193
193
|
let g, y;
|
|
@@ -299,8 +299,8 @@ let Ee = class extends A {
|
|
|
299
299
|
i = (function(s) {
|
|
300
300
|
const { center: n, radiusKilometers: a, coordinatePrecision: l } = s, d = s.steps ? s.steps : 64, c = 1e3 * a, [h, u] = n, { x: p, y: g } = O(h, u), y = [];
|
|
301
301
|
for (let m = 0; m < d; m++) {
|
|
302
|
-
const v = 360 * m / d * Math.PI / 180, C = c * Math.cos(v), f = c * Math.sin(v), [P, I] = [p + C, g + f], { lng:
|
|
303
|
-
y.push([w
|
|
302
|
+
const v = 360 * m / d * Math.PI / 180, C = c * Math.cos(v), f = c * Math.sin(v), [P, I] = [p + C, g + f], { lng: w, lat: L } = R(P, I);
|
|
303
|
+
y.push([b(w, l), b(L, l)]);
|
|
304
304
|
}
|
|
305
305
|
return y.push(y[0]), { type: "Feature", geometry: { type: "Polygon", coordinates: [y] }, properties: {} };
|
|
306
306
|
})({ center: this.center, radiusKilometers: e * o, coordinatePrecision: this.coordinatePrecision });
|
|
@@ -530,15 +530,15 @@ class ci extends B {
|
|
|
530
530
|
for (let y = 0; y <= l; y++) {
|
|
531
531
|
const m = y / l, v = Math.sin((1 - m) * g) / Math.sin(g), C = Math.sin(m * g) / Math.sin(g), f = v * Math.cos(c) * Math.cos(h) + C * Math.cos(u) * Math.cos(p), P = v * Math.cos(c) * Math.sin(h) + C * Math.cos(u) * Math.sin(p), I = v * Math.sin(c) + C * Math.sin(u);
|
|
532
532
|
if (isNaN(f) || isNaN(P) || isNaN(I)) continue;
|
|
533
|
-
const
|
|
534
|
-
isNaN(
|
|
533
|
+
const w = Math.atan2(I, Math.sqrt(f ** 2 + P ** 2)), L = Math.atan2(P, f);
|
|
534
|
+
isNaN(w) || isNaN(L) || d.push([ae(L), ae(w)]);
|
|
535
535
|
}
|
|
536
536
|
return d.slice(1, -1);
|
|
537
537
|
})(t, e, Math.floor(o / i));
|
|
538
538
|
return this.limitCoordinates(s);
|
|
539
539
|
}
|
|
540
540
|
limitCoordinates(t) {
|
|
541
|
-
return t.map((e) => [
|
|
541
|
+
return t.map((e) => [b(e[0], this.config.coordinatePrecision), b(e[1], this.config.coordinatePrecision)]);
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
544
|
function tt(r, t) {
|
|
@@ -575,9 +575,9 @@ function hi(r, t, e) {
|
|
|
575
575
|
const i = Lt(r), o = Lt(t), s = Lt(e), [n, a, l] = s, [d, c, h] = (function(T, $) {
|
|
576
576
|
const [Kt, Xt, qt] = T, [Jt, Ht, Zt] = $;
|
|
577
577
|
return [Xt * Zt - qt * Ht, qt * Jt - Kt * Zt, Kt * Ht - Xt * Jt];
|
|
578
|
-
})(i, o), u = c * l - h * a, p = h * n - d * l, g = d * a - c * n, y = g * c - p * h, m = u * h - g * d, v = p * d - u * c, C = 1 / Math.sqrt(Math.pow(y, 2) + Math.pow(m, 2) + Math.pow(v, 2)), f = [y * C, m * C, v * C], P = [-1 * y * C, -1 * m * C, -1 * v * C], I = Y(i, o),
|
|
578
|
+
})(i, o), u = c * l - h * a, p = h * n - d * l, g = d * a - c * n, y = g * c - p * h, m = u * h - g * d, v = p * d - u * c, C = 1 / Math.sqrt(Math.pow(y, 2) + Math.pow(m, 2) + Math.pow(v, 2)), f = [y * C, m * C, v * C], P = [-1 * y * C, -1 * m * C, -1 * v * C], I = Y(i, o), w = Y(i, f), L = Y(o, f), M = Y(i, P), N = Y(o, P);
|
|
579
579
|
let _;
|
|
580
|
-
return _ =
|
|
580
|
+
return _ = w < M && w < N || L < M && L < N ? f : P, Y(i, _) > I || Y(o, _) > I ? U(K(_), K(i)) <= U(K(_), K(o)) ? [K(i), !0, !1] : [K(o), !1, !0] : [K(_), !1, !1];
|
|
581
581
|
}
|
|
582
582
|
function ui(r, t, e) {
|
|
583
583
|
const i = t.x - r.x, o = t.y - r.y, s = Math.max(0, Math.min(1, ((e.x - r.x) * i + (e.y - r.y) * o) / (i * i + o * o)));
|
|
@@ -587,10 +587,10 @@ class Gt extends B {
|
|
|
587
587
|
constructor(t, e, i) {
|
|
588
588
|
super(t), this.config = void 0, this.pixelDistance = void 0, this.clickBoundingBox = void 0, this.getSnappableCoordinateFirstClick = (o) => {
|
|
589
589
|
const s = this.getSnappable(o, (n) => !!(n.properties && n.properties.mode === this.mode));
|
|
590
|
-
return s.coordinate ? [
|
|
590
|
+
return s.coordinate ? [b(s.coordinate[0], this.config.coordinatePrecision), b(s.coordinate[1], this.config.coordinatePrecision)] : void 0;
|
|
591
591
|
}, this.getSnappableCoordinate = (o, s) => {
|
|
592
592
|
const n = this.getSnappable(o, (a) => !!(a.properties && a.properties.mode === this.mode && a.id !== s));
|
|
593
|
-
return n.coordinate ? [
|
|
593
|
+
return n.coordinate ? [b(n.coordinate[0], this.config.coordinatePrecision), b(n.coordinate[1], this.config.coordinatePrecision)] : void 0;
|
|
594
594
|
}, this.config = t, this.pixelDistance = e, this.clickBoundingBox = i;
|
|
595
595
|
}
|
|
596
596
|
getSnappable(t, e) {
|
|
@@ -611,11 +611,11 @@ class Gt extends B {
|
|
|
611
611
|
for (let v of p) {
|
|
612
612
|
const C = v[0], f = v[1];
|
|
613
613
|
let P, I = 1 / 0;
|
|
614
|
-
const
|
|
614
|
+
const w = O(C[0], C[1]), L = O(f[0], f[1]), M = O(u[0], u[1]);
|
|
615
615
|
if (C[0] === u[0] && C[1] === u[1]) P = C;
|
|
616
616
|
else if (f[0] === u[0] && f[1] === u[1]) P = f;
|
|
617
617
|
else {
|
|
618
|
-
const { x: N, y: _ } = ui(
|
|
618
|
+
const { x: N, y: _ } = ui(w, L, M), { lng: T, lat: $ } = R(N, _);
|
|
619
619
|
P = [T, $];
|
|
620
620
|
}
|
|
621
621
|
P && (I = F(M, O(P[0], P[1])), I < y && (g = P, y = I, m = p.indexOf(v)));
|
|
@@ -631,7 +631,7 @@ class Gt extends B {
|
|
|
631
631
|
return y === 1 / 0 ? void 0 : { coordinate: g, distance: y, lineIndex: m };
|
|
632
632
|
})(c, l)), !d) return;
|
|
633
633
|
const h = this.pixelDistance.measure(t, d.coordinate);
|
|
634
|
-
h < s.minDistance && h < this.pointerDistance && (s.featureId = n.id, s.coordinate = [
|
|
634
|
+
h < s.minDistance && h < this.pointerDistance && (s.featureId = n.id, s.coordinate = [b(d.coordinate[0], this.config.coordinatePrecision), b(d.coordinate[1], this.config.coordinatePrecision)], s.featureCoordinateIndex = d.lineIndex, s.minDistance = h);
|
|
635
635
|
}), s;
|
|
636
636
|
}
|
|
637
637
|
}
|
|
@@ -1292,11 +1292,11 @@ function _e(r, t, e) {
|
|
|
1292
1292
|
}
|
|
1293
1293
|
function ke(r, t, e, i, o) {
|
|
1294
1294
|
const s = i(r[0], r[1]), n = i(t[0], t[1]), { lng: a, lat: l } = o((s.x + n.x) / 2, (s.y + n.y) / 2);
|
|
1295
|
-
return [
|
|
1295
|
+
return [b(a, e), b(l, e)];
|
|
1296
1296
|
}
|
|
1297
1297
|
function Oi(r, t, e) {
|
|
1298
1298
|
const i = _e(r, 1e3 * U(r, t) / 2, kt(r, t));
|
|
1299
|
-
return [
|
|
1299
|
+
return [b(i[0], e), b(i[1], e)];
|
|
1300
1300
|
}
|
|
1301
1301
|
function de({ featureCoords: r, precision: t, unproject: e, project: i, projection: o }) {
|
|
1302
1302
|
const s = [];
|
|
@@ -1441,7 +1441,7 @@ class Li extends B {
|
|
|
1441
1441
|
const g = [this.dragPosition[0] - o[0], this.dragPosition[1] - o[1]];
|
|
1442
1442
|
u = h[0] - g[0], p = h[1] - g[1];
|
|
1443
1443
|
}
|
|
1444
|
-
if (u =
|
|
1444
|
+
if (u = b(u, this.config.coordinatePrecision), p = b(p, this.config.coordinatePrecision), u > 180 || u < -180 || p > 90 || p < -90) return !1;
|
|
1445
1445
|
s[c] = [u, p];
|
|
1446
1446
|
}
|
|
1447
1447
|
i.type === "Polygon" && (s[s.length - 1] = [s[0][0], s[0][1]]);
|
|
@@ -1580,10 +1580,10 @@ class Mi extends B {
|
|
|
1580
1580
|
(u.geometry.type === "Polygon" ? u.geometry.coordinates[0] : u.geometry.coordinates).forEach((y) => {
|
|
1581
1581
|
const m = kt(g, y) + p, v = (function(f, P) {
|
|
1582
1582
|
f[0] += f[0] - P[0] > 180 ? -360 : P[0] - f[0] > 180 ? 360 : 0;
|
|
1583
|
-
const I = xe,
|
|
1583
|
+
const I = xe, w = P[1] * Math.PI / 180, L = f[1] * Math.PI / 180, M = L - w;
|
|
1584
1584
|
let N = Math.abs(f[0] - P[0]) * Math.PI / 180;
|
|
1585
1585
|
N > Math.PI && (N -= 2 * Math.PI);
|
|
1586
|
-
const _ = Math.log(Math.tan(L / 2 + Math.PI / 4) / Math.tan(
|
|
1586
|
+
const _ = Math.log(Math.tan(L / 2 + Math.PI / 4) / Math.tan(w / 2 + Math.PI / 4)), T = Math.abs(_) > 1e-11 ? M / _ : Math.cos(w);
|
|
1587
1587
|
return Math.sqrt(M * M + T * T * N * N) * I;
|
|
1588
1588
|
})(g, y), C = _e(g, v, m);
|
|
1589
1589
|
y[0] = C[0], y[1] = C[1];
|
|
@@ -1592,7 +1592,7 @@ class Mi extends B {
|
|
|
1592
1592
|
}
|
|
1593
1593
|
const l = o.type === "Polygon" ? o.coordinates[0] : o.coordinates;
|
|
1594
1594
|
l.forEach((u) => {
|
|
1595
|
-
u[0] =
|
|
1595
|
+
u[0] = b(u[0], this.coordinatePrecision), u[1] = b(u[1], this.coordinatePrecision);
|
|
1596
1596
|
});
|
|
1597
1597
|
const d = this.midPoints.getUpdated(l) || [], c = this.selectionPoints.getUpdated(l) || [], h = this.coordinatePoints.getUpdated(e, l) || [];
|
|
1598
1598
|
if (i && !i({ id: e, type: "Feature", geometry: o, properties: {} }, { project: this.config.project, unproject: this.config.unproject, coordinatePrecision: this.config.coordinatePrecision, updateType: E.Provisional })) return !1;
|
|
@@ -1776,7 +1776,7 @@ class _i extends B {
|
|
|
1776
1776
|
if (e === "center" ? s = this.centerWebMercatorDrag(t) : e === "opposite" ? s = this.oppositeWebMercatorDrag(t) : e === "center-fixed" ? s = this.centerFixedWebMercatorDrag(t) : e === "opposite-fixed" && (s = this.oppositeFixedWebMercatorDrag(t)), !s) return !1;
|
|
1777
1777
|
for (let c = 0; c < s.length; c++) {
|
|
1778
1778
|
const h = s[c];
|
|
1779
|
-
if (h[0] =
|
|
1779
|
+
if (h[0] = b(h[0], this.coordinatePrecision), h[1] = b(h[1], this.coordinatePrecision), !Ot(h, this.coordinatePrecision)) return !1;
|
|
1780
1780
|
}
|
|
1781
1781
|
const n = this.midPoints.getUpdated(s) || [], a = this.selectionPoints.getUpdated(s) || [], l = this.coordinatePoints.getUpdated(o.id, s) || [], d = { type: o.geometry.type, coordinates: o.geometry.type === "Polygon" ? [s] : s };
|
|
1782
1782
|
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));
|
|
@@ -2424,11 +2424,11 @@ class je extends A {
|
|
|
2424
2424
|
const o = 1 / Math.pow(10, this.coordinatePrecision - 1), s = Math.max(1e-6, o);
|
|
2425
2425
|
i = [e[0], [t.lng, t.lat], [t.lng, t.lat - s], e[0]];
|
|
2426
2426
|
} else if (this.currentCoordinate === 2) {
|
|
2427
|
-
const o = e[0], s = e[1], n = ke(o, s, this.coordinatePrecision, this.project, this.unproject), a = O(o[0], o[1]), l = O(n[0], n[1]), d = O(s[0], s[1]), c = O(t.lng, t.lat), h = F(c, a) < F(c, d), u = pe(a, l, c), p = h ? 90 - u : pe(a, l, c) - 90, g = F(l, c), y = Math.cos(D(p)) * g, m = G(a, d) + ((function(I,
|
|
2428
|
-
const M = (L.x -
|
|
2427
|
+
const o = e[0], s = e[1], n = ke(o, s, this.coordinatePrecision, this.project, this.unproject), a = O(o[0], o[1]), l = O(n[0], n[1]), d = O(s[0], s[1]), c = O(t.lng, t.lat), h = F(c, a) < F(c, d), u = pe(a, l, c), p = h ? 90 - u : pe(a, l, c) - 90, g = F(l, c), y = Math.cos(D(p)) * g, m = G(a, d) + ((function(I, w, L) {
|
|
2428
|
+
const M = (L.x - w.x) * (I.y - w.y) - (L.y - w.y) * (I.x - w.x);
|
|
2429
2429
|
return M > 1e-10 ? "left" : M < -1e-10 ? "right" : "left";
|
|
2430
2430
|
})(a, d, c) === "right" ? -90 : 90), v = ht(a, y, m), C = ht(d, y, m), f = R(v.x, v.y), P = R(C.x, C.y);
|
|
2431
|
-
i = [e[0], e[1], [P.lng, P.lat], [f.lng, f.lat], e[0]];
|
|
2431
|
+
i = [e[0], e[1], [b(P.lng, this.coordinatePrecision), b(P.lat, this.coordinatePrecision)], [b(f.lng, this.coordinatePrecision), b(f.lat, this.coordinatePrecision)], e[0]];
|
|
2432
2432
|
}
|
|
2433
2433
|
i && this.updatePolygonGeometry(this.currentId, i, E.Provisional);
|
|
2434
2434
|
}
|
|
@@ -2522,7 +2522,7 @@ class Re extends A {
|
|
|
2522
2522
|
const C = (this.direction === "anticlockwise" ? 1 : -1) * v / p;
|
|
2523
2523
|
g.push(s);
|
|
2524
2524
|
for (let f = 0; f <= p; f++) {
|
|
2525
|
-
const P = ht(a, c, y + f * C), { lng: I, lat:
|
|
2525
|
+
const P = ht(a, c, y + f * C), { lng: I, lat: w } = R(P.x, P.y), L = [b(I, this.coordinatePrecision), b(w, this.coordinatePrecision)];
|
|
2526
2526
|
L[0] !== g[g.length - 1][0] && L[1] !== g[g.length - 1][1] && g.push(L);
|
|
2527
2527
|
}
|
|
2528
2528
|
g.push(o), i = [...g];
|
|
@@ -2608,8 +2608,8 @@ class Ge extends A {
|
|
|
2608
2608
|
this.direction === "anticlockwise" ? (m = y - g, m < 0 && (m += 360)) : (m = g - y, m < 0 && (m += 360));
|
|
2609
2609
|
const v = (this.direction === "anticlockwise" ? 1 : -1) * m / u;
|
|
2610
2610
|
for (let C = 0; C <= u; C++) {
|
|
2611
|
-
const f = ht(l, d, g + C * v), { lng: P, lat: I } = R(f.x, f.y),
|
|
2612
|
-
|
|
2611
|
+
const f = ht(l, d, g + C * v), { lng: P, lat: I } = R(f.x, f.y), w = [b(P, this.coordinatePrecision), b(I, this.coordinatePrecision)];
|
|
2612
|
+
w[0] !== p[p.length - 1][0] && w[1] !== p[p.length - 1][1] && p.push(w);
|
|
2613
2613
|
}
|
|
2614
2614
|
this.updateLineStringGeometry(this.currentInitialArcId, p, E.Provisional);
|
|
2615
2615
|
} else if (this.currentCoordinate === 3) {
|
|
@@ -2617,12 +2617,12 @@ class Ge extends A {
|
|
|
2617
2617
|
if (e.length < 2 || !this.direction) return;
|
|
2618
2618
|
const i = this.store.getGeometryCopy(this.currentStartingPointId).coordinates, o = e[0], s = e[e.length - 1], n = O(t.lng, t.lat), a = O(o[0], o[1]), l = O(s[0], s[1]), d = O(i[0], i[1]), c = F(d, a), h = F(d, n) < c ? a : n, u = G(d, n), p = G(d, a), g = G(d, l), y = X(p), m = X(g), v = X(u);
|
|
2619
2619
|
if (this.notInSector({ normalizedCursor: v, normalizedStart: y, normalizedEnd: m, direction: this.direction })) return;
|
|
2620
|
-
const C = this.getDeltaBearing(this.direction, y, m), f = this.arcPoints, P = (this.direction === "anticlockwise" ? 1 : -1) * C / f, I = F(d, h),
|
|
2620
|
+
const C = this.getDeltaBearing(this.direction, y, m), f = this.arcPoints, P = (this.direction === "anticlockwise" ? 1 : -1) * C / f, I = F(d, h), w = [];
|
|
2621
2621
|
for (let L = 0; L <= f; L++) {
|
|
2622
|
-
const M = ht(d, I, y + L * P), { lng: N, lat: _ } = R(M.x, M.y), T = [
|
|
2623
|
-
T[0] !== e[e.length - 1][0] && T[1] !== e[e.length - 1][1] &&
|
|
2622
|
+
const M = ht(d, I, y + L * P), { lng: N, lat: _ } = R(M.x, M.y), T = [b(N, this.coordinatePrecision), b(_, this.coordinatePrecision)];
|
|
2623
|
+
T[0] !== e[e.length - 1][0] && T[1] !== e[e.length - 1][1] && w.unshift(T);
|
|
2624
2624
|
}
|
|
2625
|
-
e.push(...
|
|
2625
|
+
e.push(...w), e.push(e[0]), this.currentId ? this.updatePolygonGeometry(this.currentId, e, E.Provisional) : [this.currentId] = this.store.create([{ geometry: { type: "Polygon", coordinates: [e] }, properties: { mode: this.mode, [S.CURRENTLY_DRAWING]: !0 } }]);
|
|
2626
2626
|
}
|
|
2627
2627
|
}
|
|
2628
2628
|
}
|
|
@@ -2703,7 +2703,7 @@ var Hi = { __proto__: null, TerraDrawBaseAdapter: class {
|
|
|
2703
2703
|
const e = this.getLngLatFromEvent(r);
|
|
2704
2704
|
if (!e) return null;
|
|
2705
2705
|
const { lng: i, lat: o } = e, { containerX: s, containerY: n } = this.getMapElementXYPosition(r), a = this.getButton(r), l = Array.from(this._heldKeys);
|
|
2706
|
-
return { lng:
|
|
2706
|
+
return { lng: b(i, this._coordinatePrecision), lat: b(o, this._coordinatePrecision), containerX: s, containerY: n, button: a, heldKeys: l, isContextMenu: t };
|
|
2707
2707
|
}
|
|
2708
2708
|
register(r) {
|
|
2709
2709
|
this._currentModeCallbacks = r, this._listeners = this.getAdapterListeners(), this._listeners.forEach((t) => {
|
|
@@ -2921,44 +2921,44 @@ class to {
|
|
|
2921
2921
|
}), t;
|
|
2922
2922
|
}
|
|
2923
2923
|
featuresAtLocation({ lng: t, lat: e }, i) {
|
|
2924
|
-
const o = i && i.pointerDistance !== void 0 ? i.pointerDistance : 30, s = !i || i.ignoreSelectFeatures === void 0 || i.ignoreSelectFeatures, n = !(!i || i.ignoreCoordinatePoints === void 0) && i.ignoreCoordinatePoints, a = !(!i || i.ignoreCurrentlyDrawing === void 0) && i.ignoreCurrentlyDrawing, l = !(!i || i.ignoreClosingPoints === void 0) && i.ignoreClosingPoints, d = this._adapter.unproject.bind(this._adapter),
|
|
2925
|
-
return this._store.search(
|
|
2926
|
-
if (s && (
|
|
2927
|
-
if (
|
|
2928
|
-
const
|
|
2929
|
-
return F(
|
|
2924
|
+
const o = i && i.pointerDistance !== void 0 ? i.pointerDistance : 30, s = !i || i.ignoreSelectFeatures === void 0 || i.ignoreSelectFeatures, n = !(!i || i.ignoreCoordinatePoints === void 0) && i.ignoreCoordinatePoints, a = !(!i || i.ignoreCurrentlyDrawing === void 0) && i.ignoreCurrentlyDrawing, l = !(!i || i.ignoreClosingPoints === void 0) && i.ignoreClosingPoints, d = !(!i || i.ignoreSnappingPoints === void 0) && i.ignoreSnappingPoints, c = this._adapter.unproject.bind(this._adapter), h = this._adapter.project.bind(this._adapter), u = h(t, e), p = we({ unproject: c, point: u, pointerDistance: o });
|
|
2925
|
+
return this._store.search(p).filter((g) => {
|
|
2926
|
+
if (s && (g.properties[k.MID_POINT] || g.properties[k.SELECTION_POINT]) || n && g.properties[S.COORDINATE_POINT] || l && g.properties[S.CLOSING_POINT] || a && g.properties[S.CURRENTLY_DRAWING] || d && g.properties[S.SNAPPING_POINT]) return !1;
|
|
2927
|
+
if (g.geometry.type === "Point") {
|
|
2928
|
+
const y = g.geometry.coordinates, m = h(y[0], y[1]);
|
|
2929
|
+
return F(u, m) < o;
|
|
2930
2930
|
}
|
|
2931
|
-
if (
|
|
2932
|
-
const
|
|
2933
|
-
for (let
|
|
2934
|
-
const
|
|
2935
|
-
if (Nt(
|
|
2931
|
+
if (g.geometry.type === "LineString") {
|
|
2932
|
+
const y = g.geometry.coordinates;
|
|
2933
|
+
for (let m = 0; m < y.length - 1; m++) {
|
|
2934
|
+
const v = y[m], C = y[m + 1];
|
|
2935
|
+
if (Nt(u, h(v[0], v[1]), h(C[0], C[1])) < o) return !0;
|
|
2936
2936
|
}
|
|
2937
2937
|
return !1;
|
|
2938
2938
|
}
|
|
2939
|
-
if (Ne([t, e],
|
|
2939
|
+
if (Ne([t, e], g.geometry.coordinates)) return !0;
|
|
2940
2940
|
if (i != null && i.includePolygonsWithinPointerDistance) {
|
|
2941
|
-
const
|
|
2942
|
-
for (const
|
|
2943
|
-
const
|
|
2944
|
-
if (Nt(
|
|
2941
|
+
const y = g.geometry.coordinates;
|
|
2942
|
+
for (const m of y) for (let v = 0; v < m.length - 1; v++) {
|
|
2943
|
+
const C = m[v], f = m[v + 1], P = h(C[0], C[1]), I = h(f[0], f[1]);
|
|
2944
|
+
if (Nt(u, P, I) < o) return !0;
|
|
2945
2945
|
}
|
|
2946
2946
|
}
|
|
2947
2947
|
return !1;
|
|
2948
|
-
}).map((
|
|
2949
|
-
if (i == null || !i.addClosestCoordinateInfoToProperties) return
|
|
2950
|
-
let
|
|
2951
|
-
if (
|
|
2948
|
+
}).map((g) => {
|
|
2949
|
+
if (i == null || !i.addClosestCoordinateInfoToProperties) return g;
|
|
2950
|
+
let y;
|
|
2951
|
+
if (g.geometry.type === "Polygon") y = g.geometry.coordinates[0].slice(0, -1);
|
|
2952
2952
|
else {
|
|
2953
|
-
if (
|
|
2954
|
-
|
|
2953
|
+
if (g.geometry.type !== "LineString") return g;
|
|
2954
|
+
y = g.geometry.coordinates;
|
|
2955
2955
|
}
|
|
2956
|
-
let
|
|
2957
|
-
for (let
|
|
2958
|
-
const
|
|
2959
|
-
|
|
2956
|
+
let m, v = -1, C = 1 / 0;
|
|
2957
|
+
for (let f = 0; f < y.length; f++) {
|
|
2958
|
+
const P = y[f], I = F(h(P[0], P[1]), u);
|
|
2959
|
+
I < C && (v = f, C = I, m = P);
|
|
2960
2960
|
}
|
|
2961
|
-
return
|
|
2961
|
+
return g.properties.closestCoordinateIndexToEvent = v, g.properties.closestCoordinatePixelDistanceToEvent = C, g.properties.closestCoordinateDistanceKmToEvent = U(m, [t, e]), g;
|
|
2962
2962
|
});
|
|
2963
2963
|
}
|
|
2964
2964
|
getSelectModeOrThrow() {
|
|
@@ -3076,7 +3076,7 @@ class to {
|
|
|
3076
3076
|
const { x: a, y: l } = O(e.origin[0], e.origin[1]);
|
|
3077
3077
|
We({ coordinates: n, originX: a, originY: l, xScale: e.options.xScale || 1, yScale: e.options.yScale || 1 });
|
|
3078
3078
|
} else e.type === "rotate" && (i = Te(i, e.options.angle || 0), n = i.geometry.type === "Polygon" ? i.geometry.coordinates[0] : i.geometry.coordinates);
|
|
3079
|
-
if (n = n.map((a) => [
|
|
3079
|
+
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" }), s.afterFeatureUpdated) {
|
|
3080
3080
|
s.afterFeatureUpdated(i);
|
|
3081
3081
|
const a = i.properties[k.SELECTED], l = this.getSelectMode({ switchToSelectMode: !1 });
|
|
3082
3082
|
l && a && l.afterFeatureUpdated(i);
|
|
@@ -5165,9 +5165,9 @@ class jo {
|
|
|
5165
5165
|
l.trip.legs.forEach((f, P) => {
|
|
5166
5166
|
const I = this.decodeShape(f.shape);
|
|
5167
5167
|
h.push(...I), u += Number(f.summary.length.toFixed(2)), p += Number((f.summary.time / 60).toFixed()), g.push(...f.maneuvers);
|
|
5168
|
-
const
|
|
5169
|
-
|
|
5170
|
-
...
|
|
5168
|
+
const w = y.features[P + 1];
|
|
5169
|
+
w.properties = {
|
|
5170
|
+
...w.properties,
|
|
5171
5171
|
distance: u,
|
|
5172
5172
|
distance_unit: i === "kilometers" ? "km" : "mi",
|
|
5173
5173
|
time: p,
|