bbl-mapbox-react 0.0.34 → 0.0.35
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/index.cjs +3 -3
- package/dist/index.mjs +374 -370
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6329,13 +6329,13 @@ function adjustPopupForBounds(e, t) {
|
|
|
6329
6329
|
return r.x + t.width + 10 > n.width && (r.x = n.width - t.width - 10), r.x < 10 && (r.x = 10), r.y + t.height + 10 > n.height && (r.y = n.height - t.height - 10), r.y < 10 && (r.y = 10), r;
|
|
6330
6330
|
}
|
|
6331
6331
|
const Mapbox = forwardRef((e, c) => {
|
|
6332
|
-
let { center: l = [116.4074, 39.9042], zoom: u = 12, pitch: d = 0, bearing: f = 0, style: p = "mapbox://styles/mapbox/dark-v11", maxBounds: g, mode: _ = "display", editConfig: v = {}, pickerConfig: y = {}, onPick: b, interactive: x = {}, layers: S = [], rasterPaint: C, entities: T = [], selectedIds: E = [], entityConfig: D, nameConfig: O, selectNameConfig: k, areaConfig: j, circleConfig: M, lengthConfig: N, showCoordinates: we = !0, showScale: P = !0, showResetView: Te = !0, showRoadHighlight: Ee = !1, showMeasure: F = !1, showRasterPaint: Oe = !1, showRoutePlanning: Me, onRasterPaintChange: Ne, popupDefaults: I, renderPopup: Fe, onMapLoad: Ie, onEntityClick: Le, onPopupOpen: Re, onPopupClose: ze, className: Be = "", containerStyle: Ve } = e, He = useRef(null), Ue = useRef(null), We = useRef(null), L = useRef(null), R = useRef(/* @__PURE__ */ new Map()), z = useRef(/* @__PURE__ */ new Map()), Ge = useRef(/* @__PURE__ */ new Set()), [B, Ke] = useState(null), qe = useRef(null), Je = useRef(null), Ye = useRef(null), [Xe, Ze] = useState(null), Qe = useRef(null), $e = useRef(null), [et, tt] = useState(null), [V, nt] = useState(_), [rt, it] = useState(null), at = useRef(null), [ot, H] = useState(null), [st, U] = useState(null), [ct, lt] = useState(null), W = useRef(!1), ut = useRef(null), dt = useRef(null), G = useRef(null),
|
|
6333
|
-
|
|
6332
|
+
let { center: l = [116.4074, 39.9042], zoom: u = 12, pitch: d = 0, bearing: f = 0, style: p = "mapbox://styles/mapbox/dark-v11", maxBounds: g, mode: _ = "display", editConfig: v = {}, pickerConfig: y = {}, onPick: b, interactive: x = {}, layers: S = [], rasterPaint: C, entities: T = [], selectedIds: E = [], entityConfig: D, nameConfig: O, selectNameConfig: k, areaConfig: j, circleConfig: M, lengthConfig: N, showCoordinates: we = !0, showScale: P = !0, showResetView: Te = !0, showRoadHighlight: Ee = !1, showMeasure: F = !1, showRasterPaint: Oe = !1, showRoutePlanning: Me, onRasterPaintChange: Ne, popupDefaults: I, renderPopup: Fe, onMapLoad: Ie, onEntityClick: Le, onPopupOpen: Re, onPopupClose: ze, className: Be = "", containerStyle: Ve } = e, He = useRef(null), Ue = useRef(null), We = useRef(null), L = useRef(null), R = useRef(/* @__PURE__ */ new Map()), z = useRef(/* @__PURE__ */ new Map()), Ge = useRef(/* @__PURE__ */ new Set()), [B, Ke] = useState(null), qe = useRef(null), Je = useRef(null), Ye = useRef(null), [Xe, Ze] = useState(null), Qe = useRef(null), $e = useRef(null), [et, tt] = useState(null), [V, nt] = useState(_), [rt, it] = useState(null), at = useRef(null), [ot, H] = useState(null), [st, U] = useState(null), [ct, lt] = useState(null), W = useRef(!1), ut = useRef(null), dt = useRef(null), ft = useRef(null), pt = useRef(null), G = useRef(null), mt = useRef(null), K = useRef(null), ht = useRef([]), gt = useRef(null), _t = useRef(null), vt = useRef(null), yt = useRef([]), bt = useRef(null), xt = useRef(!1), [St, Ct] = useState([]), wt = useRef([]);
|
|
6333
|
+
wt.current = St;
|
|
6334
6334
|
let q = useRef(null);
|
|
6335
6335
|
useEffect(() => {
|
|
6336
6336
|
nt(_);
|
|
6337
6337
|
}, [_]);
|
|
6338
|
-
let
|
|
6338
|
+
let Tt = useCallback((e) => {
|
|
6339
6339
|
let t = R.current.get(e), n = z.current.get(e);
|
|
6340
6340
|
if (t && n) {
|
|
6341
6341
|
if (n.type === "radar" && t instanceof CanvasRadarRenderer) {
|
|
@@ -6352,7 +6352,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6352
6352
|
z.current.set(e, r), t.startAnimation();
|
|
6353
6353
|
}
|
|
6354
6354
|
}
|
|
6355
|
-
}, []),
|
|
6355
|
+
}, []), Et = useCallback((e) => {
|
|
6356
6356
|
let t = R.current.get(e), n = z.current.get(e);
|
|
6357
6357
|
if (t && n) {
|
|
6358
6358
|
if (n.type === "radar" && t instanceof CanvasRadarRenderer) {
|
|
@@ -6369,10 +6369,10 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6369
6369
|
z.current.set(e, r), t.stopAnimation();
|
|
6370
6370
|
}
|
|
6371
6371
|
}
|
|
6372
|
-
}, []),
|
|
6372
|
+
}, []), Dt = useCallback((e) => {
|
|
6373
6373
|
let t = z.current.get(e);
|
|
6374
|
-
t && (t.type === "radar" || t.type === "circle") && (t.type, t.isAnimating ?
|
|
6375
|
-
}, [
|
|
6374
|
+
t && (t.type === "radar" || t.type === "circle") && (t.type, t.isAnimating ? Et(e) : Tt(e));
|
|
6375
|
+
}, [Tt, Et]), Ot = useCallback((e) => {
|
|
6376
6376
|
if (e === void 0) {
|
|
6377
6377
|
let e = !1;
|
|
6378
6378
|
for (let [, t] of R.current) if (t instanceof UnitRenderer) {
|
|
@@ -6388,7 +6388,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6388
6388
|
let t = new Set(e.map(String));
|
|
6389
6389
|
for (let [e, n] of R.current) n instanceof UnitRenderer && n.setShowTrajectory(t.has(String(e)) ? "all" : 0);
|
|
6390
6390
|
}
|
|
6391
|
-
}, []),
|
|
6391
|
+
}, []), kt = useCallback((e, t, n) => {
|
|
6392
6392
|
let r = T.find((t) => String(t.id) === String(e));
|
|
6393
6393
|
if (!r?.popup || !L.current) return;
|
|
6394
6394
|
let i = r.popup.content ?? Fe?.(r);
|
|
@@ -6406,18 +6406,18 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6406
6406
|
I,
|
|
6407
6407
|
Fe,
|
|
6408
6408
|
Re
|
|
6409
|
-
]),
|
|
6409
|
+
]), At = useCallback((e) => {
|
|
6410
6410
|
B?.entityId === e && (Ke(null), ze?.(e));
|
|
6411
|
-
}, [B, ze]),
|
|
6411
|
+
}, [B, ze]), jt = useCallback(() => {
|
|
6412
6412
|
Ke((e) => (e && ze?.(e.entityId), null));
|
|
6413
|
-
}, [ze]),
|
|
6413
|
+
}, [ze]), Mt = useCallback((e) => B?.entityId === e, [B]), Nt = useCallback((e, t, n) => {
|
|
6414
6414
|
let r = L.current;
|
|
6415
6415
|
r && r.flyTo({
|
|
6416
6416
|
center: e,
|
|
6417
6417
|
zoom: t ?? r.getZoom(),
|
|
6418
6418
|
...n
|
|
6419
6419
|
});
|
|
6420
|
-
}, []),
|
|
6420
|
+
}, []), Pt = useCallback((e) => {
|
|
6421
6421
|
if (e.length === 0) return null;
|
|
6422
6422
|
let t = Infinity, n = -Infinity, r = Infinity, i = -Infinity, a = !1;
|
|
6423
6423
|
for (let o of e) {
|
|
@@ -6428,10 +6428,10 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6428
6428
|
}
|
|
6429
6429
|
}
|
|
6430
6430
|
return a ? [(t + n) / 2, (r + i) / 2] : null;
|
|
6431
|
-
}, []),
|
|
6431
|
+
}, []), Ft = useCallback((e, t, n) => {
|
|
6432
6432
|
let r = L.current;
|
|
6433
6433
|
if (!r || e.length === 0) return;
|
|
6434
|
-
let i =
|
|
6434
|
+
let i = Pt(e);
|
|
6435
6435
|
if (!i) return;
|
|
6436
6436
|
let a = [];
|
|
6437
6437
|
for (let t of e) {
|
|
@@ -6456,10 +6456,10 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6456
6456
|
pitch: n?.pitch ?? r.getPitch()
|
|
6457
6457
|
};
|
|
6458
6458
|
t !== void 0 && (f.maxZoom = t), n?.essential !== void 0 && (f.essential = n.essential), r.fitBounds(d, f);
|
|
6459
|
-
}, [
|
|
6459
|
+
}, [Pt]), It = useRef(null), Lt = useRef("display"), [Rt, zt] = useState({}), J = useMemo(() => ({
|
|
6460
6460
|
...y,
|
|
6461
|
-
...
|
|
6462
|
-
}), [y,
|
|
6461
|
+
...Rt
|
|
6462
|
+
}), [y, Rt]), Bt = useCallback((e) => {
|
|
6463
6463
|
let t = L.current;
|
|
6464
6464
|
if (!t || !t.getContainer()) return;
|
|
6465
6465
|
let { showMarker: n = !0, markerColor: r = "#3388ff", name: i, nameConfig: a } = J;
|
|
@@ -6491,33 +6491,33 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6491
6491
|
anchor: "bottom"
|
|
6492
6492
|
}).setLngLat(e).addTo(t);
|
|
6493
6493
|
}
|
|
6494
|
-
}, [J, O]),
|
|
6494
|
+
}, [J, O]), Vt = useCallback(() => {
|
|
6495
6495
|
at.current &&= (at.current.remove(), null);
|
|
6496
|
-
}, []),
|
|
6496
|
+
}, []), Ht = useCallback(() => `marker-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`, []), Ut = useCallback((e) => {
|
|
6497
6497
|
let t = L.current;
|
|
6498
|
-
if (He.current) if (
|
|
6498
|
+
if (He.current) if (bt.current &&= (bt.current.remove(), null), e && t) {
|
|
6499
6499
|
t.getCanvas().style.cursor = "none";
|
|
6500
6500
|
let n = document.createElement("div");
|
|
6501
6501
|
n.className = "mapbox-custom-cursor";
|
|
6502
6502
|
let r = e.size || e.width || 32;
|
|
6503
6503
|
n.style.cssText = "\n position: fixed;\n pointer-events: none;\n z-index: 9999;\n transform: translate(-50%, -50%);\n opacity: 0.8;\n ";
|
|
6504
6504
|
let i = document.createElement("img");
|
|
6505
|
-
i.src = e.icon, i.style.width = `${r}px`, i.style.height = `${e.size || e.height || r}px`, i.style.objectFit = "contain", n.appendChild(i), document.body.appendChild(n),
|
|
6505
|
+
i.src = e.icon, i.style.width = `${r}px`, i.style.height = `${e.size || e.height || r}px`, i.style.objectFit = "contain", n.appendChild(i), document.body.appendChild(n), bt.current = n;
|
|
6506
6506
|
let a = (e) => {
|
|
6507
|
-
|
|
6507
|
+
bt.current && (bt.current.style.left = `${e.clientX}px`, bt.current.style.top = `${e.clientY}px`);
|
|
6508
6508
|
};
|
|
6509
6509
|
document.addEventListener("mousemove", a), n.dataset.cleanup = "true", n._cleanup = () => {
|
|
6510
6510
|
document.removeEventListener("mousemove", a);
|
|
6511
6511
|
};
|
|
6512
6512
|
} else t && (t.getCanvas().style.cursor = "");
|
|
6513
6513
|
}, []), Y = useCallback(() => {
|
|
6514
|
-
if (
|
|
6515
|
-
let e =
|
|
6516
|
-
e && e(),
|
|
6514
|
+
if (bt.current) {
|
|
6515
|
+
let e = bt.current._cleanup;
|
|
6516
|
+
e && e(), bt.current.remove(), bt.current = null;
|
|
6517
6517
|
}
|
|
6518
6518
|
let e = L.current;
|
|
6519
6519
|
e && (e.getCanvas().style.cursor = "");
|
|
6520
|
-
}, []),
|
|
6520
|
+
}, []), Wt = useCallback((e, t, n) => {
|
|
6521
6521
|
if (!e.getSource(t)) {
|
|
6522
6522
|
if (!e.getStyle().glyphs) {
|
|
6523
6523
|
let t = e.style, n = "/gis-fonts/{fontstack}/{range}.pbf";
|
|
@@ -6553,7 +6553,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6553
6553
|
}
|
|
6554
6554
|
});
|
|
6555
6555
|
}
|
|
6556
|
-
}, []),
|
|
6556
|
+
}, []), Gt = useCallback(() => {
|
|
6557
6557
|
let e = L.current;
|
|
6558
6558
|
e && (e.getSource("rect-preview-source") || (e.addSource("rect-preview-source", {
|
|
6559
6559
|
type: "geojson",
|
|
@@ -6578,8 +6578,8 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6578
6578
|
"line-width": 2,
|
|
6579
6579
|
"line-dasharray": [4, 4]
|
|
6580
6580
|
}
|
|
6581
|
-
}),
|
|
6582
|
-
}, [
|
|
6581
|
+
}), Wt(e, "rect-preview-measure-source", "rect-preview-measure-label")));
|
|
6582
|
+
}, [Wt]), Kt = useCallback((e, t) => {
|
|
6583
6583
|
let n = L.current;
|
|
6584
6584
|
if (!n) return;
|
|
6585
6585
|
let r = n.getSource("rect-preview-source");
|
|
@@ -6599,11 +6599,11 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6599
6599
|
},
|
|
6600
6600
|
properties: {}
|
|
6601
6601
|
});
|
|
6602
|
-
let l =
|
|
6602
|
+
let l = ft.current, u = l?.strokeColor ?? "#3388ff", d = l?.strokeWidth ?? 2, f = l?.fillColor ?? "#3388ff", p = l?.fillOpacity ?? .1;
|
|
6603
6603
|
n.getLayer("rect-preview-line") && (n.setPaintProperty("rect-preview-line", "line-color", u), n.setPaintProperty("rect-preview-line", "line-width", d)), n.getLayer("rect-preview-fill") && (n.setPaintProperty("rect-preview-fill", "fill-color", f), n.setPaintProperty("rect-preview-fill", "fill-opacity", p));
|
|
6604
6604
|
let m = n.getSource("rect-preview-measure-source");
|
|
6605
6605
|
if (m) {
|
|
6606
|
-
let e =
|
|
6606
|
+
let e = qn.current, t = [], n = c[0], r = c[1], i = c[2];
|
|
6607
6607
|
if (e?.showArea) {
|
|
6608
6608
|
let e = [(n[0] + i[0]) / 2, (n[1] + i[1]) / 2], a = distance(n, r), o = distance(r, i);
|
|
6609
6609
|
t.push({
|
|
@@ -6640,7 +6640,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6640
6640
|
features: t
|
|
6641
6641
|
});
|
|
6642
6642
|
}
|
|
6643
|
-
}, []),
|
|
6643
|
+
}, []), qt = useCallback(() => {
|
|
6644
6644
|
let e = L.current;
|
|
6645
6645
|
if (!e) return;
|
|
6646
6646
|
let t = e.getSource("rect-preview-source");
|
|
@@ -6654,8 +6654,8 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6654
6654
|
features: []
|
|
6655
6655
|
});
|
|
6656
6656
|
}, []), X = useCallback(() => {
|
|
6657
|
-
lt(null),
|
|
6658
|
-
}, [
|
|
6657
|
+
lt(null), qt();
|
|
6658
|
+
}, [qt]), Jt = useCallback(() => {
|
|
6659
6659
|
let e = L.current;
|
|
6660
6660
|
e && (e.getSource("circle-preview-source") || (e.addSource("circle-preview-source", {
|
|
6661
6661
|
type: "geojson",
|
|
@@ -6680,7 +6680,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6680
6680
|
"line-width": 2,
|
|
6681
6681
|
"line-dasharray": [4, 4]
|
|
6682
6682
|
}
|
|
6683
|
-
}),
|
|
6683
|
+
}), Wt(e, "circle-preview-measure-source", "circle-preview-measure-label"), e.getSource("circle-preview-radius-source") || (e.addSource("circle-preview-radius-source", {
|
|
6684
6684
|
type: "geojson",
|
|
6685
6685
|
data: {
|
|
6686
6686
|
type: "FeatureCollection",
|
|
@@ -6697,22 +6697,22 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6697
6697
|
"line-dasharray": [4, 4]
|
|
6698
6698
|
}
|
|
6699
6699
|
}))));
|
|
6700
|
-
}, [
|
|
6700
|
+
}, [Wt]), Yt = useCallback((e, t, n = 64) => {
|
|
6701
6701
|
let [r, i] = e, a = [], o = t / 6371e3, s = i * Math.PI / 180;
|
|
6702
6702
|
for (let e = 0; e <= n; e++) {
|
|
6703
6703
|
let t = e / n * 2 * Math.PI, c = o * Math.cos(t), l = o * Math.sin(t) / Math.cos(s), u = i + c * 180 / Math.PI, d = r + l * 180 / Math.PI;
|
|
6704
6704
|
a.push([d, u]);
|
|
6705
6705
|
}
|
|
6706
6706
|
return a;
|
|
6707
|
-
}, []),
|
|
6707
|
+
}, []), Xt = useCallback((e, t) => {
|
|
6708
6708
|
let [n, r] = e, [i, a] = t, o = (a - r) * Math.PI / 180, s = (i - n) * Math.PI / 180, c = Math.sin(o / 2) * Math.sin(o / 2) + Math.cos(r * Math.PI / 180) * Math.cos(a * Math.PI / 180) * Math.sin(s / 2) * Math.sin(s / 2);
|
|
6709
6709
|
return 6371e3 * (2 * Math.atan2(Math.sqrt(c), Math.sqrt(1 - c)));
|
|
6710
|
-
}, []),
|
|
6710
|
+
}, []), Zt = useCallback((e, t) => {
|
|
6711
6711
|
let n = L.current;
|
|
6712
6712
|
if (!n) return;
|
|
6713
6713
|
let r = n.getSource("circle-preview-source");
|
|
6714
6714
|
if (!r) return;
|
|
6715
|
-
let i =
|
|
6715
|
+
let i = Xt(e, t), a = Yt(e, i);
|
|
6716
6716
|
r.setData({
|
|
6717
6717
|
type: "Feature",
|
|
6718
6718
|
geometry: {
|
|
@@ -6723,7 +6723,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6723
6723
|
});
|
|
6724
6724
|
let o = G.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
|
|
6725
6725
|
n.getLayer("circle-preview-line") && (n.setPaintProperty("circle-preview-line", "line-color", s), n.setPaintProperty("circle-preview-line", "line-width", c)), n.getLayer("circle-preview-fill") && (n.setPaintProperty("circle-preview-fill", "fill-color", l), n.setPaintProperty("circle-preview-fill", "fill-opacity", u));
|
|
6726
|
-
let d =
|
|
6726
|
+
let d = qn.current, f = [], p = [];
|
|
6727
6727
|
if (d?.showArea) {
|
|
6728
6728
|
let t = Math.PI * i * i;
|
|
6729
6729
|
f.push({
|
|
@@ -6763,7 +6763,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6763
6763
|
type: "FeatureCollection",
|
|
6764
6764
|
features: p
|
|
6765
6765
|
});
|
|
6766
|
-
}, [
|
|
6766
|
+
}, [Xt, Yt]), Qt = useCallback(() => {
|
|
6767
6767
|
let e = L.current;
|
|
6768
6768
|
if (!e) return;
|
|
6769
6769
|
let t = e.getSource("circle-preview-source");
|
|
@@ -6781,9 +6781,9 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6781
6781
|
type: "FeatureCollection",
|
|
6782
6782
|
features: []
|
|
6783
6783
|
});
|
|
6784
|
-
}, []),
|
|
6785
|
-
|
|
6786
|
-
}, [
|
|
6784
|
+
}, []), $t = useCallback(() => {
|
|
6785
|
+
mt.current = null, Qt();
|
|
6786
|
+
}, [Qt]), en = useCallback(() => {
|
|
6787
6787
|
let e = L.current;
|
|
6788
6788
|
e && (e.getSource("polygon-preview-source") || (e.addSource("polygon-preview-source", {
|
|
6789
6789
|
type: "geojson",
|
|
@@ -6824,8 +6824,8 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6824
6824
|
"circle-stroke-color": "#ffffff",
|
|
6825
6825
|
"circle-stroke-width": 2
|
|
6826
6826
|
}
|
|
6827
|
-
}),
|
|
6828
|
-
}, [
|
|
6827
|
+
}), Wt(e, "polygon-preview-measure-source", "polygon-preview-measure-label")));
|
|
6828
|
+
}, [Wt]), tn = useCallback((e, t) => {
|
|
6829
6829
|
let n = L.current;
|
|
6830
6830
|
if (!n) return;
|
|
6831
6831
|
let r = n.getSource("polygon-preview-source"), i = n.getSource("polygon-vertices-source");
|
|
@@ -6867,7 +6867,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6867
6867
|
n.getLayer("polygon-preview-line") && (n.setPaintProperty("polygon-preview-line", "line-color", s), n.setPaintProperty("polygon-preview-line", "line-width", c)), n.getLayer("polygon-preview-fill") && (n.setPaintProperty("polygon-preview-fill", "fill-color", l), n.setPaintProperty("polygon-preview-fill", "fill-opacity", u)), n.getLayer("polygon-vertices") && n.setPaintProperty("polygon-vertices", "circle-color", s);
|
|
6868
6868
|
let d = n.getSource("polygon-preview-measure-source");
|
|
6869
6869
|
if (d) {
|
|
6870
|
-
let e =
|
|
6870
|
+
let e = qn.current, t = [];
|
|
6871
6871
|
if (e?.showArea && a.length >= 3) {
|
|
6872
6872
|
let e = [...a, a[0]], n = polygonArea(e), r = 0, i = 0;
|
|
6873
6873
|
for (let e of a) r += e[0], i += e[1];
|
|
@@ -6909,7 +6909,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6909
6909
|
features: t
|
|
6910
6910
|
});
|
|
6911
6911
|
}
|
|
6912
|
-
}, []),
|
|
6912
|
+
}, []), nn = useCallback(() => {
|
|
6913
6913
|
let e = L.current;
|
|
6914
6914
|
if (!e) return;
|
|
6915
6915
|
let t = e.getSource("polygon-preview-source");
|
|
@@ -6927,9 +6927,9 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6927
6927
|
type: "FeatureCollection",
|
|
6928
6928
|
features: []
|
|
6929
6929
|
});
|
|
6930
|
-
}, []),
|
|
6931
|
-
|
|
6932
|
-
}, [
|
|
6930
|
+
}, []), rn = useCallback(() => {
|
|
6931
|
+
ht.current = [], nn();
|
|
6932
|
+
}, [nn]), an = useCallback(() => {
|
|
6933
6933
|
let e = L.current;
|
|
6934
6934
|
e && (e.getSource("square-preview-source") || (e.addSource("square-preview-source", {
|
|
6935
6935
|
type: "geojson",
|
|
@@ -6954,8 +6954,8 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6954
6954
|
"line-width": 2,
|
|
6955
6955
|
"line-dasharray": [4, 4]
|
|
6956
6956
|
}
|
|
6957
|
-
}),
|
|
6958
|
-
}, [
|
|
6957
|
+
}), Wt(e, "square-preview-measure-source", "square-preview-measure-label")));
|
|
6958
|
+
}, [Wt]), on = useCallback((e, t) => {
|
|
6959
6959
|
let [n, r] = e, i = t / 2 / 6371e3, a = r * Math.PI / 180, o = i * 180 / Math.PI, s = i * 180 / Math.PI / Math.cos(a);
|
|
6960
6960
|
return [
|
|
6961
6961
|
[n - s, r + o],
|
|
@@ -6964,12 +6964,12 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6964
6964
|
[n - s, r - o],
|
|
6965
6965
|
[n - s, r + o]
|
|
6966
6966
|
];
|
|
6967
|
-
}, []),
|
|
6967
|
+
}, []), sn = useCallback((e, t) => {
|
|
6968
6968
|
let n = L.current;
|
|
6969
6969
|
if (!n) return;
|
|
6970
6970
|
let r = n.getSource("square-preview-source");
|
|
6971
6971
|
if (!r) return;
|
|
6972
|
-
let i =
|
|
6972
|
+
let i = Xt(e, t) * 2, a = on(e, i);
|
|
6973
6973
|
r.setData({
|
|
6974
6974
|
type: "Feature",
|
|
6975
6975
|
geometry: {
|
|
@@ -6978,11 +6978,11 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
6978
6978
|
},
|
|
6979
6979
|
properties: {}
|
|
6980
6980
|
});
|
|
6981
|
-
let o =
|
|
6981
|
+
let o = gt.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
|
|
6982
6982
|
n.getLayer("square-preview-line") && (n.setPaintProperty("square-preview-line", "line-color", s), n.setPaintProperty("square-preview-line", "line-width", c)), n.getLayer("square-preview-fill") && (n.setPaintProperty("square-preview-fill", "fill-color", l), n.setPaintProperty("square-preview-fill", "fill-opacity", u));
|
|
6983
6983
|
let d = n.getSource("square-preview-measure-source");
|
|
6984
6984
|
if (d) {
|
|
6985
|
-
let t =
|
|
6985
|
+
let t = qn.current, n = [];
|
|
6986
6986
|
if (t?.showArea && n.push({
|
|
6987
6987
|
type: "Feature",
|
|
6988
6988
|
geometry: {
|
|
@@ -7006,7 +7006,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7006
7006
|
features: n
|
|
7007
7007
|
});
|
|
7008
7008
|
}
|
|
7009
|
-
}, [
|
|
7009
|
+
}, [Xt, on]), cn = useCallback(() => {
|
|
7010
7010
|
let e = L.current;
|
|
7011
7011
|
if (!e) return;
|
|
7012
7012
|
let t = e.getSource("square-preview-source");
|
|
@@ -7019,9 +7019,9 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7019
7019
|
type: "FeatureCollection",
|
|
7020
7020
|
features: []
|
|
7021
7021
|
});
|
|
7022
|
-
}, []),
|
|
7023
|
-
|
|
7024
|
-
}, [
|
|
7022
|
+
}, []), ln = useCallback(() => {
|
|
7023
|
+
_t.current = null, cn();
|
|
7024
|
+
}, [cn]), un = useCallback(() => {
|
|
7025
7025
|
let e = L.current;
|
|
7026
7026
|
e && (e.getSource("polyline-preview-source") || (e.addSource("polyline-preview-source", {
|
|
7027
7027
|
type: "geojson",
|
|
@@ -7054,8 +7054,8 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7054
7054
|
"circle-stroke-color": "#ffffff",
|
|
7055
7055
|
"circle-stroke-width": 2
|
|
7056
7056
|
}
|
|
7057
|
-
}),
|
|
7058
|
-
}, [
|
|
7057
|
+
}), Wt(e, "polyline-preview-measure-source", "polyline-preview-measure-label")));
|
|
7058
|
+
}, [Wt]), dn = useCallback((e, t) => {
|
|
7059
7059
|
let n = L.current;
|
|
7060
7060
|
if (!n) return;
|
|
7061
7061
|
let r = n.getSource("polyline-preview-source"), i = n.getSource("polyline-vertices-source");
|
|
@@ -7082,11 +7082,11 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7082
7082
|
properties: {}
|
|
7083
7083
|
}))
|
|
7084
7084
|
});
|
|
7085
|
-
let o =
|
|
7085
|
+
let o = vt.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2;
|
|
7086
7086
|
n.getLayer("polyline-preview-line") && (n.setPaintProperty("polyline-preview-line", "line-color", s), n.setPaintProperty("polyline-preview-line", "line-width", c)), n.getLayer("polyline-vertices") && n.setPaintProperty("polyline-vertices", "circle-color", s);
|
|
7087
7087
|
let l = n.getSource("polyline-preview-measure-source");
|
|
7088
7088
|
if (l) {
|
|
7089
|
-
let e =
|
|
7089
|
+
let e = qn.current, t = [];
|
|
7090
7090
|
if (e?.showLength && a.length >= 2) for (let e = 0; e < a.length - 1; e++) {
|
|
7091
7091
|
let n = a[e], r = a[e + 1], i = [(n[0] + r[0]) / 2, (n[1] + r[1]) / 2];
|
|
7092
7092
|
t.push({
|
|
@@ -7103,7 +7103,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7103
7103
|
features: t
|
|
7104
7104
|
});
|
|
7105
7105
|
}
|
|
7106
|
-
}, []),
|
|
7106
|
+
}, []), fn = useCallback(() => {
|
|
7107
7107
|
let e = L.current;
|
|
7108
7108
|
if (!e) return;
|
|
7109
7109
|
let t = e.getSource("polyline-preview-source");
|
|
@@ -7122,158 +7122,162 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7122
7122
|
features: []
|
|
7123
7123
|
});
|
|
7124
7124
|
}, []), Z = useCallback(() => {
|
|
7125
|
-
|
|
7126
|
-
}, [
|
|
7127
|
-
H(e),
|
|
7125
|
+
yt.current = [], fn();
|
|
7126
|
+
}, [fn]), pn = useCallback((e) => {
|
|
7127
|
+
H(e), Ut(e), e ? (U("marker"), X(), $t(), rn(), ln(), Z()) : U(null);
|
|
7128
7128
|
}, [
|
|
7129
|
-
|
|
7129
|
+
Ut,
|
|
7130
7130
|
X,
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7131
|
+
$t,
|
|
7132
|
+
rn,
|
|
7133
|
+
ln,
|
|
7134
7134
|
Z
|
|
7135
|
-
]),
|
|
7135
|
+
]), mn = useCallback((e) => {
|
|
7136
7136
|
if (U(e), e === "rectangle") {
|
|
7137
|
-
H(null), Y(),
|
|
7137
|
+
H(null), Y(), $t(), rn(), ln(), Z();
|
|
7138
7138
|
let e = L.current;
|
|
7139
7139
|
e && (e.getCanvas().style.cursor = "crosshair");
|
|
7140
7140
|
} else if (e === "circle") {
|
|
7141
|
-
H(null), Y(), X(),
|
|
7141
|
+
H(null), Y(), X(), rn(), ln(), Z();
|
|
7142
7142
|
let e = L.current;
|
|
7143
7143
|
e && (e.getCanvas().style.cursor = "crosshair");
|
|
7144
7144
|
} else if (e === "polygon") {
|
|
7145
|
-
H(null), Y(), X(),
|
|
7145
|
+
H(null), Y(), X(), $t(), ln(), Z();
|
|
7146
7146
|
let e = L.current;
|
|
7147
7147
|
e && (e.getCanvas().style.cursor = "crosshair");
|
|
7148
7148
|
} else if (e === "square") {
|
|
7149
|
-
H(null), Y(), X(),
|
|
7149
|
+
H(null), Y(), X(), $t(), rn(), Z();
|
|
7150
7150
|
let e = L.current;
|
|
7151
7151
|
e && (e.getCanvas().style.cursor = "crosshair");
|
|
7152
7152
|
} else if (e === "polyline") {
|
|
7153
|
-
H(null), Y(), X(),
|
|
7153
|
+
H(null), Y(), X(), $t(), rn(), ln();
|
|
7154
7154
|
let e = L.current;
|
|
7155
7155
|
e && (e.getCanvas().style.cursor = "crosshair");
|
|
7156
|
-
} else e === "marker" ? (X(),
|
|
7156
|
+
} else e === "marker" ? (X(), $t(), rn(), ln(), Z()) : (H(null), Y(), X(), $t(), rn(), ln(), Z());
|
|
7157
7157
|
}, [
|
|
7158
7158
|
Y,
|
|
7159
7159
|
X,
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7160
|
+
$t,
|
|
7161
|
+
rn,
|
|
7162
|
+
ln,
|
|
7163
7163
|
Z
|
|
7164
|
-
]),
|
|
7164
|
+
]), hn = useCallback((e) => {
|
|
7165
7165
|
if (e !== "picker") {
|
|
7166
7166
|
let e = J.value && isFinite(J.value.lng) && isFinite(J.value.lat), t = J.showMarker !== !1;
|
|
7167
|
-
(!e || !t) &&
|
|
7167
|
+
(!e || !t) && Vt(), it(null);
|
|
7168
7168
|
}
|
|
7169
7169
|
e !== "edit" && (H(null), U(null), X(), Z(), Y()), nt(e);
|
|
7170
7170
|
}, [
|
|
7171
|
-
|
|
7171
|
+
Vt,
|
|
7172
7172
|
Y,
|
|
7173
7173
|
X,
|
|
7174
7174
|
Z
|
|
7175
|
-
]),
|
|
7176
|
-
|
|
7177
|
-
}, [
|
|
7178
|
-
|
|
7179
|
-
})), [
|
|
7175
|
+
]), gn = useCallback(() => V, [V]), _n = useCallback(() => rt, [rt]), vn = useCallback(() => {
|
|
7176
|
+
Vt(), it(null);
|
|
7177
|
+
}, [Vt]), yn = useCallback((e = {}) => (It.current &&= (It.current(null), null), new Promise((t) => {
|
|
7178
|
+
It.current = t, Lt.current = Hn.current, zt(e), hn("picker");
|
|
7179
|
+
})), [hn]);
|
|
7180
7180
|
useEffect(() => {
|
|
7181
7181
|
if (!et) return;
|
|
7182
7182
|
let e = J.value;
|
|
7183
7183
|
if (e && isFinite(e.lng) && isFinite(e.lat)) {
|
|
7184
7184
|
let t = [e.lng, e.lat];
|
|
7185
|
-
it(e),
|
|
7185
|
+
it(e), Bt(t);
|
|
7186
7186
|
}
|
|
7187
7187
|
}, [
|
|
7188
7188
|
J.value,
|
|
7189
|
-
|
|
7189
|
+
Bt,
|
|
7190
7190
|
et
|
|
7191
7191
|
]);
|
|
7192
|
-
let
|
|
7193
|
-
if (
|
|
7194
|
-
if (e.mode === "marker") e.markerStyle ? (
|
|
7192
|
+
let bn = (e) => "mode" in e, xn = useCallback((e, t = !0) => (dt.current &&= (dt.current("cancelled: new drawing started"), ut.current = null, null), new Promise((n, r) => {
|
|
7193
|
+
if (ut.current = n, dt.current = r, t && (Vt(), it(null)), W.current = !0, bn(e)) {
|
|
7194
|
+
if (e.mode === "marker") e.markerStyle ? (pt.current = e.markerStyle, ft.current = null, G.current = null, K.current = null, gt.current = null, vt.current = null, H(null), U("marker"), e.markerStyle.src && e.markerStyle.width ? Ut({
|
|
7195
7195
|
id: "custom",
|
|
7196
7196
|
name: e.markerStyle.name || "Marker",
|
|
7197
7197
|
icon: e.markerStyle.src,
|
|
7198
7198
|
width: e.markerStyle.width
|
|
7199
|
-
}) : Y()) : e.template && (
|
|
7199
|
+
}) : Y()) : e.template && (pt.current = null, ft.current = null, G.current = null, K.current = null, gt.current = null, vt.current = null, H(e.template), U("marker"), Ut(e.template));
|
|
7200
7200
|
else if (e.mode === "rectangle") {
|
|
7201
|
-
|
|
7201
|
+
ft.current = e.rectangleStyle || null, pt.current = null, G.current = null, K.current = null, gt.current = null, vt.current = null, H(null), U("rectangle"), Y();
|
|
7202
7202
|
let t = L.current;
|
|
7203
7203
|
t && (t.getCanvas().style.cursor = "crosshair");
|
|
7204
7204
|
} else if (e.mode === "circle") {
|
|
7205
|
-
G.current = e.circleStyle || null,
|
|
7205
|
+
G.current = e.circleStyle || null, ft.current = null, pt.current = null, K.current = null, gt.current = null, vt.current = null, H(null), U("circle"), Y();
|
|
7206
7206
|
let t = L.current;
|
|
7207
7207
|
t && (t.getCanvas().style.cursor = "crosshair");
|
|
7208
7208
|
} else if (e.mode === "polygon") {
|
|
7209
|
-
K.current = e.polygonStyle || null,
|
|
7209
|
+
K.current = e.polygonStyle || null, ft.current = null, pt.current = null, G.current = null, gt.current = null, vt.current = null, H(null), U("polygon"), Y();
|
|
7210
7210
|
let t = L.current;
|
|
7211
7211
|
t && (t.getCanvas().style.cursor = "crosshair");
|
|
7212
7212
|
} else if (e.mode === "square") {
|
|
7213
|
-
|
|
7213
|
+
gt.current = e.squareStyle || null, ft.current = null, pt.current = null, G.current = null, K.current = null, vt.current = null, H(null), U("square"), Y();
|
|
7214
7214
|
let t = L.current;
|
|
7215
7215
|
t && (t.getCanvas().style.cursor = "crosshair");
|
|
7216
7216
|
} else if (e.mode === "polyline") {
|
|
7217
|
-
|
|
7217
|
+
vt.current = e.polylineStyle || null, ft.current = null, pt.current = null, G.current = null, K.current = null, gt.current = null, H(null), U("polyline"), Y();
|
|
7218
7218
|
let t = L.current;
|
|
7219
7219
|
t && (t.getCanvas().style.cursor = "crosshair");
|
|
7220
7220
|
}
|
|
7221
|
-
} else H(e), U("marker"),
|
|
7222
|
-
}, [
|
|
7223
|
-
zt,
|
|
7221
|
+
} else H(e), U("marker"), Ut(e), ft.current = null, pt.current = null, G.current = null, K.current = null, gt.current = null, vt.current = null;
|
|
7222
|
+
})), [
|
|
7224
7223
|
Vt,
|
|
7224
|
+
Ut,
|
|
7225
7225
|
Y
|
|
7226
|
-
])
|
|
7226
|
+
]), Sn = useCallback((e) => {
|
|
7227
|
+
ut.current && (ut.current(e), ut.current = null, dt.current = null);
|
|
7228
|
+
}, []), Cn = useCallback((e) => {
|
|
7229
|
+
dt.current &&= (dt.current(e), ut.current = null, null);
|
|
7230
|
+
}, []);
|
|
7227
7231
|
useImperativeHandle(c, () => ({
|
|
7228
|
-
startAnimation:
|
|
7229
|
-
stopAnimation:
|
|
7230
|
-
toggleAnimation:
|
|
7232
|
+
startAnimation: Tt,
|
|
7233
|
+
stopAnimation: Et,
|
|
7234
|
+
toggleAnimation: Dt,
|
|
7231
7235
|
getMap: () => L.current,
|
|
7232
|
-
openPopup: (e) =>
|
|
7233
|
-
closePopup:
|
|
7234
|
-
closeAllPopups:
|
|
7235
|
-
isPopupOpen:
|
|
7236
|
-
toggleUnitTrajectory:
|
|
7237
|
-
flyTo:
|
|
7238
|
-
getCenterByIds:
|
|
7239
|
-
flyToEntities:
|
|
7240
|
-
getMode:
|
|
7241
|
-
setMode:
|
|
7242
|
-
getPickedLocation:
|
|
7243
|
-
clearPickedLocation:
|
|
7244
|
-
startDrawing:
|
|
7236
|
+
openPopup: (e) => kt(e, "programmatic"),
|
|
7237
|
+
closePopup: At,
|
|
7238
|
+
closeAllPopups: jt,
|
|
7239
|
+
isPopupOpen: Mt,
|
|
7240
|
+
toggleUnitTrajectory: Ot,
|
|
7241
|
+
flyTo: Nt,
|
|
7242
|
+
getCenterByIds: Pt,
|
|
7243
|
+
flyToEntities: Ft,
|
|
7244
|
+
getMode: gn,
|
|
7245
|
+
setMode: hn,
|
|
7246
|
+
getPickedLocation: _n,
|
|
7247
|
+
clearPickedLocation: vn,
|
|
7248
|
+
startDrawing: xn,
|
|
7245
7249
|
getRenderer: (e) => R.current.get(e),
|
|
7246
7250
|
setEditingEntities: (e) => {
|
|
7247
|
-
for (let t of
|
|
7251
|
+
for (let t of wt.current) e.map(String).includes(String(t)) || R.current.get(t)?.setEditing?.(!1);
|
|
7248
7252
|
for (let t of e) R.current.get(t)?.setEditing?.(!0);
|
|
7249
|
-
q.current &&= (R.current.get(q.current.entityId)?.cancelEditPreview?.(), null),
|
|
7253
|
+
q.current &&= (R.current.get(q.current.entityId)?.cancelEditPreview?.(), null), Ct(e);
|
|
7250
7254
|
},
|
|
7251
|
-
getEditingEntities: () =>
|
|
7252
|
-
startPicking:
|
|
7255
|
+
getEditingEntities: () => wt.current,
|
|
7256
|
+
startPicking: yn,
|
|
7253
7257
|
startRoutePlanning: (e) => {
|
|
7254
7258
|
Ue.current?.startPlanning(e);
|
|
7255
7259
|
},
|
|
7256
7260
|
getRoadHighlightControl: () => We.current
|
|
7257
7261
|
}), [
|
|
7258
|
-
Ct,
|
|
7259
|
-
wt,
|
|
7260
7262
|
Tt,
|
|
7263
|
+
Et,
|
|
7261
7264
|
Dt,
|
|
7262
|
-
Ot,
|
|
7263
7265
|
kt,
|
|
7264
7266
|
At,
|
|
7265
|
-
Et,
|
|
7266
7267
|
jt,
|
|
7267
7268
|
Mt,
|
|
7269
|
+
Ot,
|
|
7268
7270
|
Nt,
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
hn,
|
|
7271
|
+
Pt,
|
|
7272
|
+
Ft,
|
|
7272
7273
|
gn,
|
|
7273
|
-
|
|
7274
|
-
_n
|
|
7274
|
+
hn,
|
|
7275
|
+
_n,
|
|
7276
|
+
vn,
|
|
7277
|
+
xn,
|
|
7278
|
+
yn
|
|
7275
7279
|
]);
|
|
7276
|
-
let
|
|
7280
|
+
let wn = useCallback(() => {
|
|
7277
7281
|
let e = L.current;
|
|
7278
7282
|
if (!e) return;
|
|
7279
7283
|
let t = new Set(T.map((e) => e.id)), n = new Set(R.current.keys());
|
|
@@ -7301,10 +7305,10 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7301
7305
|
else (n.type === "square" && i instanceof SquareRenderer || n.type === "rectangle" && i instanceof RectangleRenderer || n.type === "polyline" && i instanceof PolylineRenderer || n.type === "attack-direction" && i instanceof AttackDirectionRenderer) && i.update(n);
|
|
7302
7306
|
else {
|
|
7303
7307
|
let t = null;
|
|
7304
|
-
n.type === "radar" ? t = new CanvasRadarRenderer(e, n, O, k) : n.type === "image" ? t = new CanvasImageRenderer(e, n, O, k) : n.type === "marker" ? t = new MarkerRenderer(e, n, O, k) : n.type === "unit" ? t = new UnitRenderer(e, n, O, k) : n.type === "polygon" ? t = new PolygonRenderer(e, n, O, k, j, N) : n.type === "circle" ? t = n.fillType === "radial-gradient" ? new CanvasCircleRenderer(e, n, O, k, j, M) : new CircleRenderer(e, n, O, k, j, M) : n.type === "square" ? t = new SquareRenderer(e, n, O, k, j, N) : n.type === "rectangle" ? t = new RectangleRenderer(e, n, O, k, j, N) : n.type === "polyline" ? t = new PolylineRenderer(e, n, O, k, N) : n.type === "attack-direction" && (t = new AttackDirectionRenderer(e, n, O, k)), t && (R.current.set(n.id, t), t.setSelected(r.has(String(n.id))),
|
|
7308
|
+
n.type === "radar" ? t = new CanvasRadarRenderer(e, n, O, k) : n.type === "image" ? t = new CanvasImageRenderer(e, n, O, k) : n.type === "marker" ? t = new MarkerRenderer(e, n, O, k) : n.type === "unit" ? t = new UnitRenderer(e, n, O, k) : n.type === "polygon" ? t = new PolygonRenderer(e, n, O, k, j, N) : n.type === "circle" ? t = n.fillType === "radial-gradient" ? new CanvasCircleRenderer(e, n, O, k, j, M) : new CircleRenderer(e, n, O, k, j, M) : n.type === "square" ? t = new SquareRenderer(e, n, O, k, j, N) : n.type === "rectangle" ? t = new RectangleRenderer(e, n, O, k, j, N) : n.type === "polyline" ? t = new PolylineRenderer(e, n, O, k, N) : n.type === "attack-direction" && (t = new AttackDirectionRenderer(e, n, O, k)), t && (R.current.set(n.id, t), t.setSelected(r.has(String(n.id))), wt.current.map(String).includes(String(n.id)) && t.setEditing?.(!0));
|
|
7305
7309
|
}
|
|
7306
7310
|
}
|
|
7307
|
-
for (let e of
|
|
7311
|
+
for (let e of wt.current) {
|
|
7308
7312
|
let t = R.current.get(e);
|
|
7309
7313
|
t && t.setEditing?.(!0);
|
|
7310
7314
|
}
|
|
@@ -7317,10 +7321,10 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7317
7321
|
j,
|
|
7318
7322
|
M,
|
|
7319
7323
|
N
|
|
7320
|
-
]),
|
|
7324
|
+
]), Tn = useCallback(() => {
|
|
7321
7325
|
for (let e of R.current.values()) e.destroy();
|
|
7322
7326
|
R.current.clear();
|
|
7323
|
-
}, []),
|
|
7327
|
+
}, []), En = useCallback((e) => {
|
|
7324
7328
|
let t = e.getStyle();
|
|
7325
7329
|
if (!t?.layers) return;
|
|
7326
7330
|
let n = [
|
|
@@ -7336,10 +7340,10 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7336
7340
|
"attack-direction-"
|
|
7337
7341
|
];
|
|
7338
7342
|
for (let e of t.layers) if (n.some((t) => e.id.startsWith(t))) return e.id;
|
|
7339
|
-
}, []),
|
|
7343
|
+
}, []), Dn = useCallback((e) => {
|
|
7340
7344
|
let t = C, n = { "raster-opacity": e.opacity ?? 1 }, r = e.brightness ?? t?.brightness, i = e.saturation ?? t?.saturation, a = e.contrast ?? t?.contrast, o = e.hueRotate ?? t?.hueRotate;
|
|
7341
7345
|
return r !== void 0 && (n["raster-brightness-min"] = 0, n["raster-brightness-max"] = r), i !== void 0 && (n["raster-saturation"] = i), a !== void 0 && (n["raster-contrast"] = a), o !== void 0 && (n["raster-hue-rotate"] = o), n;
|
|
7342
|
-
}, [C]),
|
|
7346
|
+
}, [C]), On = useCallback((e, t) => {
|
|
7343
7347
|
let n = `base-layer-source-${t.id}`, r = `base-layer-${t.id}`, i = {
|
|
7344
7348
|
type: "raster",
|
|
7345
7349
|
tiles: [t.url],
|
|
@@ -7349,19 +7353,19 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7349
7353
|
scheme: t.scheme ?? "xyz"
|
|
7350
7354
|
};
|
|
7351
7355
|
t.bounds && (i.bounds = t.bounds), t.attribution && (i.attribution = t.attribution), e.addSource(n, i);
|
|
7352
|
-
let a =
|
|
7356
|
+
let a = En(e);
|
|
7353
7357
|
e.addLayer({
|
|
7354
7358
|
id: r,
|
|
7355
7359
|
type: "raster",
|
|
7356
7360
|
source: n,
|
|
7357
|
-
paint:
|
|
7361
|
+
paint: Dn(t),
|
|
7358
7362
|
layout: { visibility: t.visible === !1 ? "none" : "visible" }
|
|
7359
7363
|
}, a);
|
|
7360
|
-
}, [
|
|
7364
|
+
}, [En, Dn]), kn = useCallback(async (e, t) => {
|
|
7361
7365
|
try {
|
|
7362
7366
|
let n = await (await fetch(t.url)).json(), r = `base-layer-source-${t.id}`, i = `base-layer-${t.id}`;
|
|
7363
7367
|
if (!Ge.current.has(t.id)) return;
|
|
7364
|
-
let a = n.format === "pbf" || n.vector_layers, o =
|
|
7368
|
+
let a = n.format === "pbf" || n.vector_layers, o = En(e);
|
|
7365
7369
|
if (a) {
|
|
7366
7370
|
let t = {
|
|
7367
7371
|
type: "vector",
|
|
@@ -7382,13 +7386,13 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7382
7386
|
id: i,
|
|
7383
7387
|
type: "raster",
|
|
7384
7388
|
source: r,
|
|
7385
|
-
paint:
|
|
7389
|
+
paint: Dn(t),
|
|
7386
7390
|
layout: { visibility: t.visible === !1 ? "none" : "visible" }
|
|
7387
7391
|
}, o);
|
|
7388
7392
|
} catch (e) {
|
|
7389
7393
|
console.error(`Failed to load TileJSON from ${t.url}:`, e);
|
|
7390
7394
|
}
|
|
7391
|
-
}, [
|
|
7395
|
+
}, [En, Dn]), An = useCallback(async (e, t) => {
|
|
7392
7396
|
try {
|
|
7393
7397
|
let n = await (await fetch(t.url)).json();
|
|
7394
7398
|
if (!Ge.current.has(t.id)) return;
|
|
@@ -7396,7 +7400,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7396
7400
|
let n = `base-layer-source-${t.id}-${r}`;
|
|
7397
7401
|
e.getSource(n) || e.addSource(n, i);
|
|
7398
7402
|
}
|
|
7399
|
-
let r =
|
|
7403
|
+
let r = En(e);
|
|
7400
7404
|
if (n.layers) for (let i of n.layers) {
|
|
7401
7405
|
let n = `base-layer-${t.id}-${i.id}`;
|
|
7402
7406
|
if (e.getLayer(n)) continue;
|
|
@@ -7407,7 +7411,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7407
7411
|
};
|
|
7408
7412
|
i.type === "raster" && (a.paint = {
|
|
7409
7413
|
...a.paint,
|
|
7410
|
-
...
|
|
7414
|
+
...Dn(t)
|
|
7411
7415
|
}), t.visible === !1 && (a.layout = {
|
|
7412
7416
|
...a.layout,
|
|
7413
7417
|
visibility: "none"
|
|
@@ -7420,50 +7424,50 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7420
7424
|
} catch (e) {
|
|
7421
7425
|
console.error(`Failed to load Style JSON from ${t.url}:`, e);
|
|
7422
7426
|
}
|
|
7423
|
-
}, [
|
|
7427
|
+
}, [En, Dn]), jn = useCallback((e, t) => {
|
|
7424
7428
|
let n = e.getStyle();
|
|
7425
7429
|
if (!n) return;
|
|
7426
7430
|
let r = `base-layer-${t}`, i = n.layers?.filter((e) => e.id.startsWith(r)) ?? [];
|
|
7427
7431
|
for (let t of i) e.getLayer(t.id) && e.removeLayer(t.id);
|
|
7428
7432
|
let a = `base-layer-source-${t}`, o = n.sources ?? {};
|
|
7429
7433
|
for (let t of Object.keys(o)) t.startsWith(a) && e.getSource(t) && e.removeSource(t);
|
|
7430
|
-
}, []),
|
|
7434
|
+
}, []), Mn = useCallback((e) => {
|
|
7431
7435
|
let t = L.current;
|
|
7432
7436
|
if (!t) return;
|
|
7433
7437
|
let n = new Set(e.map((e) => e.id)), r = Ge.current;
|
|
7434
|
-
for (let e of r) n.has(e) || (
|
|
7438
|
+
for (let e of r) n.has(e) || (jn(t, e), r.delete(e));
|
|
7435
7439
|
for (let n of e) if (r.has(n.id)) {
|
|
7436
7440
|
let e = `base-layer-${n.id}`;
|
|
7437
7441
|
if (t.getLayer(e)) {
|
|
7438
|
-
let r =
|
|
7442
|
+
let r = Dn(n);
|
|
7439
7443
|
for (let [n, i] of Object.entries(r)) t.setPaintProperty(e, n, i);
|
|
7440
7444
|
t.setLayoutProperty(e, "visibility", n.visible === !1 ? "none" : "visible");
|
|
7441
7445
|
}
|
|
7442
7446
|
} else switch (r.add(n.id), n.type) {
|
|
7443
7447
|
case "raster":
|
|
7444
|
-
|
|
7448
|
+
On(t, n);
|
|
7445
7449
|
break;
|
|
7446
7450
|
case "tilejson":
|
|
7447
|
-
|
|
7451
|
+
kn(t, n);
|
|
7448
7452
|
break;
|
|
7449
7453
|
case "style":
|
|
7450
|
-
|
|
7454
|
+
An(t, n);
|
|
7451
7455
|
break;
|
|
7452
7456
|
default: {
|
|
7453
7457
|
let e = n;
|
|
7454
|
-
e.url &&
|
|
7458
|
+
e.url && On(t, {
|
|
7455
7459
|
...e,
|
|
7456
7460
|
type: "raster"
|
|
7457
7461
|
});
|
|
7458
7462
|
}
|
|
7459
7463
|
}
|
|
7460
7464
|
}, [
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
]),
|
|
7465
|
+
On,
|
|
7466
|
+
kn,
|
|
7467
|
+
An,
|
|
7468
|
+
jn,
|
|
7469
|
+
Dn
|
|
7470
|
+
]), Nn = useCallback((e) => {
|
|
7467
7471
|
let t = e;
|
|
7468
7472
|
for (; t;) {
|
|
7469
7473
|
let e = t.getAttribute?.("data-entity-id");
|
|
@@ -7471,140 +7475,140 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7471
7475
|
t = t.parentElement;
|
|
7472
7476
|
}
|
|
7473
7477
|
return null;
|
|
7474
|
-
}, []),
|
|
7478
|
+
}, []), Pn = useCallback((e) => {
|
|
7475
7479
|
let t = [e.lngLat.lng, e.lngLat.lat], n = {
|
|
7476
7480
|
x: e.point.x,
|
|
7477
7481
|
y: e.point.y
|
|
7478
|
-
}, r =
|
|
7482
|
+
}, r = Hn.current;
|
|
7479
7483
|
if (r === "picker") {
|
|
7480
7484
|
let e = {
|
|
7481
7485
|
lng: t[0],
|
|
7482
7486
|
lat: t[1]
|
|
7483
7487
|
};
|
|
7484
|
-
it(e),
|
|
7488
|
+
it(e), Bt(t), Un.current?.(e), It.current && (It.current(e), It.current = null, zt({}), Vt(), it(null), hn(Lt.current));
|
|
7485
7489
|
return;
|
|
7486
7490
|
}
|
|
7487
|
-
if (
|
|
7488
|
-
if (r === "edit") {
|
|
7489
|
-
let e =
|
|
7491
|
+
if (xt.current) return;
|
|
7492
|
+
if (r === "edit" || W.current) {
|
|
7493
|
+
let e = Gn.current;
|
|
7490
7494
|
if (e === "rectangle") {
|
|
7491
|
-
let e =
|
|
7495
|
+
let e = Kn.current;
|
|
7492
7496
|
if (!e) lt(t);
|
|
7493
7497
|
else {
|
|
7494
|
-
let n =
|
|
7498
|
+
let n = ft.current, r = applyEntityConfig({
|
|
7495
7499
|
...n,
|
|
7496
|
-
id: n?.id ??
|
|
7500
|
+
id: n?.id ?? Ht(),
|
|
7497
7501
|
type: "rectangle",
|
|
7498
7502
|
bounds: [e, t]
|
|
7499
7503
|
}, D);
|
|
7500
|
-
|
|
7504
|
+
qt();
|
|
7501
7505
|
let i = L.current;
|
|
7502
7506
|
if (i && !R.current.has(r.id)) {
|
|
7503
7507
|
let e = new RectangleRenderer(i, r, O, k, j, N);
|
|
7504
7508
|
R.current.set(r.id, e);
|
|
7505
7509
|
}
|
|
7506
|
-
Q.current.onRectangleAdd?.(r), lt(null),
|
|
7510
|
+
Q.current.onRectangleAdd?.(r), Sn(r), lt(null), ft.current = null, W.current && (W.current = !1, U(null), i && (i.getCanvas().style.cursor = ""));
|
|
7507
7511
|
}
|
|
7508
7512
|
return;
|
|
7509
7513
|
}
|
|
7510
7514
|
if (e === "circle") {
|
|
7511
|
-
let e =
|
|
7512
|
-
if (!e)
|
|
7515
|
+
let e = mt.current;
|
|
7516
|
+
if (!e) mt.current = { center: t };
|
|
7513
7517
|
else {
|
|
7514
|
-
let n =
|
|
7518
|
+
let n = Xt(e.center, t), r = G.current, i = applyEntityConfig({
|
|
7515
7519
|
...r,
|
|
7516
|
-
id: r?.id ??
|
|
7520
|
+
id: r?.id ?? Ht(),
|
|
7517
7521
|
type: "circle",
|
|
7518
7522
|
center: e.center,
|
|
7519
7523
|
radius: n
|
|
7520
7524
|
}, D);
|
|
7521
|
-
|
|
7525
|
+
Qt();
|
|
7522
7526
|
let a = L.current;
|
|
7523
7527
|
if (a && !R.current.has(i.id)) {
|
|
7524
7528
|
let e = new CircleRenderer(a, i, O, k, j, M);
|
|
7525
7529
|
R.current.set(i.id, e);
|
|
7526
7530
|
}
|
|
7527
|
-
Q.current.onCircleAdd?.(i),
|
|
7531
|
+
Q.current.onCircleAdd?.(i), Sn(i), mt.current = null, G.current = null, W.current && (W.current = !1, U(null), a && (a.getCanvas().style.cursor = ""));
|
|
7528
7532
|
}
|
|
7529
7533
|
return;
|
|
7530
7534
|
}
|
|
7531
7535
|
if (e === "polygon") {
|
|
7532
|
-
let e =
|
|
7536
|
+
let e = ht.current;
|
|
7533
7537
|
if (e.length >= 3) {
|
|
7534
7538
|
let n = e[0];
|
|
7535
|
-
if (
|
|
7539
|
+
if (Xt(n, t) < 20) {
|
|
7536
7540
|
let t = K.current, n = applyEntityConfig({
|
|
7537
7541
|
...t,
|
|
7538
|
-
id: t?.id ??
|
|
7542
|
+
id: t?.id ?? Ht(),
|
|
7539
7543
|
type: "polygon",
|
|
7540
7544
|
coordinates: [...e]
|
|
7541
7545
|
}, D);
|
|
7542
|
-
|
|
7546
|
+
nn();
|
|
7543
7547
|
let r = L.current;
|
|
7544
7548
|
if (r && !R.current.has(n.id)) {
|
|
7545
7549
|
let e = new PolygonRenderer(r, n, O, k, j, N);
|
|
7546
7550
|
R.current.set(n.id, e);
|
|
7547
7551
|
}
|
|
7548
|
-
Q.current.onPolygonAdd?.(n),
|
|
7552
|
+
Q.current.onPolygonAdd?.(n), Sn(n), ht.current = [], K.current = null, W.current && (W.current = !1, U(null), r && (r.getCanvas().style.cursor = ""));
|
|
7549
7553
|
return;
|
|
7550
7554
|
}
|
|
7551
7555
|
}
|
|
7552
|
-
|
|
7556
|
+
ht.current = [...e, t];
|
|
7553
7557
|
return;
|
|
7554
7558
|
}
|
|
7555
7559
|
if (e === "square") {
|
|
7556
|
-
let e =
|
|
7557
|
-
if (!e)
|
|
7560
|
+
let e = _t.current;
|
|
7561
|
+
if (!e) _t.current = { center: t };
|
|
7558
7562
|
else {
|
|
7559
|
-
let n =
|
|
7563
|
+
let n = Xt(e.center, t) * 2, r = gt.current, i = applyEntityConfig({
|
|
7560
7564
|
...r,
|
|
7561
|
-
id: r?.id ??
|
|
7565
|
+
id: r?.id ?? Ht(),
|
|
7562
7566
|
type: "square",
|
|
7563
7567
|
center: e.center,
|
|
7564
7568
|
length: n
|
|
7565
7569
|
}, D);
|
|
7566
|
-
|
|
7570
|
+
cn();
|
|
7567
7571
|
let a = L.current;
|
|
7568
7572
|
if (a && !R.current.has(i.id)) {
|
|
7569
7573
|
let e = new SquareRenderer(a, i, O, k, j, N);
|
|
7570
7574
|
R.current.set(i.id, e);
|
|
7571
7575
|
}
|
|
7572
|
-
Q.current.onSquareAdd?.(i),
|
|
7576
|
+
Q.current.onSquareAdd?.(i), Sn(i), _t.current = null, gt.current = null, W.current && (W.current = !1, U(null), a && (a.getCanvas().style.cursor = ""));
|
|
7573
7577
|
}
|
|
7574
7578
|
return;
|
|
7575
7579
|
}
|
|
7576
7580
|
if (e === "polyline") {
|
|
7577
|
-
|
|
7581
|
+
yt.current = [...yt.current, t];
|
|
7578
7582
|
return;
|
|
7579
7583
|
}
|
|
7580
|
-
let n =
|
|
7584
|
+
let n = pt.current;
|
|
7581
7585
|
if (n && n.src && n.width) {
|
|
7582
7586
|
let e = {
|
|
7583
7587
|
...n,
|
|
7584
|
-
id: n.id ??
|
|
7588
|
+
id: n.id ?? Ht(),
|
|
7585
7589
|
type: "marker",
|
|
7586
7590
|
center: t,
|
|
7587
7591
|
src: n.src,
|
|
7588
7592
|
width: n.width
|
|
7589
7593
|
};
|
|
7590
|
-
Q.current.onMarkerAdd?.(e), H(null), U(null), Y(),
|
|
7594
|
+
Q.current.onMarkerAdd?.(e), Sn(e), H(null), U(null), Y(), pt.current = null, W.current = !1;
|
|
7591
7595
|
return;
|
|
7592
7596
|
}
|
|
7593
|
-
let r =
|
|
7597
|
+
let r = Wn.current;
|
|
7594
7598
|
if (r) {
|
|
7595
7599
|
let e = {
|
|
7596
|
-
id:
|
|
7600
|
+
id: Ht(),
|
|
7597
7601
|
type: "marker",
|
|
7598
7602
|
name: r.name,
|
|
7599
7603
|
center: t,
|
|
7600
7604
|
src: r.icon,
|
|
7601
7605
|
width: r.size || r.width || 32
|
|
7602
7606
|
};
|
|
7603
|
-
r.customData !== void 0 && (e.customData = r.customData), Q.current.onMarkerAdd?.(e), H(null), U(null), Y(), W.current = !1;
|
|
7607
|
+
r.customData !== void 0 && (e.customData = r.customData), Q.current.onMarkerAdd?.(e), Sn(e), H(null), U(null), Y(), W.current = !1;
|
|
7604
7608
|
return;
|
|
7605
7609
|
}
|
|
7606
7610
|
}
|
|
7607
|
-
if (
|
|
7611
|
+
if (wt.current.length > 0) {
|
|
7608
7612
|
let e = L.current?.getZoom() ?? 12;
|
|
7609
7613
|
if (q.current) {
|
|
7610
7614
|
let { entityId: e, activeHandle: n } = q.current, r = R.current.get(e);
|
|
@@ -7615,7 +7619,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7615
7619
|
q.current = null;
|
|
7616
7620
|
return;
|
|
7617
7621
|
}
|
|
7618
|
-
for (let n of
|
|
7622
|
+
for (let n of wt.current) {
|
|
7619
7623
|
let r = R.current.get(n);
|
|
7620
7624
|
if (!r?.getEditHandleAt) continue;
|
|
7621
7625
|
let i = r.getEditHandleAt(t, e);
|
|
@@ -7638,7 +7642,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7638
7642
|
}
|
|
7639
7643
|
}
|
|
7640
7644
|
}
|
|
7641
|
-
let i =
|
|
7645
|
+
let i = zn.current, a = Bn.current, o = Vn.current, s = Nn(e.originalEvent.target);
|
|
7642
7646
|
if (s) {
|
|
7643
7647
|
let e = i.find((e) => String(e.id) === s);
|
|
7644
7648
|
if (e) {
|
|
@@ -7675,25 +7679,25 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7675
7679
|
}, [
|
|
7676
7680
|
I,
|
|
7677
7681
|
Fe,
|
|
7678
|
-
|
|
7679
|
-
]),
|
|
7682
|
+
Nn
|
|
7683
|
+
]), Fn = useCallback((e) => {
|
|
7680
7684
|
let t = [e.lngLat.lng, e.lngLat.lat];
|
|
7681
7685
|
if (q.current) {
|
|
7682
7686
|
let { entityId: e, activeHandle: n } = q.current;
|
|
7683
7687
|
R.current.get(e)?.updateEditPreview?.(n, t);
|
|
7684
7688
|
return;
|
|
7685
7689
|
}
|
|
7686
|
-
let n =
|
|
7687
|
-
n === "rectangle" && r &&
|
|
7688
|
-
let i =
|
|
7689
|
-
n === "circle" && i &&
|
|
7690
|
-
let a =
|
|
7691
|
-
n === "polygon" && a.length > 0 &&
|
|
7692
|
-
let o =
|
|
7693
|
-
n === "square" && o &&
|
|
7694
|
-
let s =
|
|
7695
|
-
n === "polyline" && s.length > 0 &&
|
|
7696
|
-
let c =
|
|
7690
|
+
let n = Gn.current, r = Kn.current;
|
|
7691
|
+
n === "rectangle" && r && Kt(r, t);
|
|
7692
|
+
let i = mt.current;
|
|
7693
|
+
n === "circle" && i && Zt(i.center, t);
|
|
7694
|
+
let a = ht.current;
|
|
7695
|
+
n === "polygon" && a.length > 0 && tn(a, t);
|
|
7696
|
+
let o = _t.current;
|
|
7697
|
+
n === "square" && o && sn(o.center, t);
|
|
7698
|
+
let s = yt.current;
|
|
7699
|
+
n === "polyline" && s.length > 0 && dn(s, t);
|
|
7700
|
+
let c = zn.current, l = Vn.current;
|
|
7697
7701
|
for (let [e, n] of R.current) if (n.isPointInEntity(t)) {
|
|
7698
7702
|
let t = c.find((t) => t.id === e);
|
|
7699
7703
|
if (!t?.popup) continue;
|
|
@@ -7709,32 +7713,32 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7709
7713
|
}
|
|
7710
7714
|
if (Ye.current &&= (clearTimeout(Ye.current), null), B?.openedBy === "hover") {
|
|
7711
7715
|
let e = R.current.get(B.entityId);
|
|
7712
|
-
e && !e.isPointInEntity(t) &&
|
|
7716
|
+
e && !e.isPointInEntity(t) && At(B.entityId);
|
|
7713
7717
|
}
|
|
7714
7718
|
}, [
|
|
7715
7719
|
I,
|
|
7716
7720
|
Fe,
|
|
7717
7721
|
B,
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
]),
|
|
7725
|
-
if (e.preventDefault(),
|
|
7726
|
-
|
|
7722
|
+
At,
|
|
7723
|
+
Kt,
|
|
7724
|
+
Zt,
|
|
7725
|
+
tn,
|
|
7726
|
+
sn,
|
|
7727
|
+
dn
|
|
7728
|
+
]), In = useCallback((e) => {
|
|
7729
|
+
if (e.preventDefault(), It.current) {
|
|
7730
|
+
It.current(null), It.current = null, zt({}), Vt(), it(null), hn(Lt.current);
|
|
7727
7731
|
return;
|
|
7728
7732
|
}
|
|
7729
|
-
if (
|
|
7730
|
-
if (
|
|
7733
|
+
if (xt.current) return;
|
|
7734
|
+
if (wt.current.length > 0) {
|
|
7731
7735
|
let t = [e.lngLat.lng, e.lngLat.lat];
|
|
7732
7736
|
if (q.current) {
|
|
7733
7737
|
R.current.get(q.current.entityId)?.cancelEditPreview?.(), q.current = null;
|
|
7734
7738
|
return;
|
|
7735
7739
|
}
|
|
7736
7740
|
let n = L.current?.getZoom() ?? 12;
|
|
7737
|
-
for (let e of
|
|
7741
|
+
for (let e of wt.current) {
|
|
7738
7742
|
let r = R.current.get(e);
|
|
7739
7743
|
if (!r?.getEditHandleAt || !r.deleteVertex) continue;
|
|
7740
7744
|
let i = r.getEditHandleAt(t, n);
|
|
@@ -7745,14 +7749,13 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7745
7749
|
}
|
|
7746
7750
|
}
|
|
7747
7751
|
}
|
|
7748
|
-
if (
|
|
7749
|
-
if (Bn.current) {
|
|
7752
|
+
if (Wn.current) {
|
|
7750
7753
|
H(null), U(null), Y();
|
|
7751
7754
|
return;
|
|
7752
7755
|
}
|
|
7753
|
-
let t =
|
|
7756
|
+
let t = Gn.current;
|
|
7754
7757
|
if (t === "rectangle") {
|
|
7755
|
-
if (
|
|
7758
|
+
if (Kn.current) lt(null), qt();
|
|
7756
7759
|
else {
|
|
7757
7760
|
U(null);
|
|
7758
7761
|
let e = L.current;
|
|
@@ -7761,7 +7764,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7761
7764
|
return;
|
|
7762
7765
|
}
|
|
7763
7766
|
if (t === "circle") {
|
|
7764
|
-
if (
|
|
7767
|
+
if (mt.current) mt.current = null, Qt();
|
|
7765
7768
|
else {
|
|
7766
7769
|
U(null);
|
|
7767
7770
|
let e = L.current;
|
|
@@ -7770,22 +7773,22 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7770
7773
|
return;
|
|
7771
7774
|
}
|
|
7772
7775
|
if (t === "polygon") {
|
|
7773
|
-
let e =
|
|
7776
|
+
let e = ht.current;
|
|
7774
7777
|
if (e.length >= 3) {
|
|
7775
7778
|
let t = K.current, n = applyEntityConfig({
|
|
7776
7779
|
...t,
|
|
7777
|
-
id: t?.id ??
|
|
7780
|
+
id: t?.id ?? Ht(),
|
|
7778
7781
|
type: "polygon",
|
|
7779
7782
|
coordinates: [...e]
|
|
7780
7783
|
}, D);
|
|
7781
|
-
|
|
7784
|
+
nn();
|
|
7782
7785
|
let r = L.current;
|
|
7783
7786
|
if (r && !R.current.has(n.id)) {
|
|
7784
7787
|
let e = new PolygonRenderer(r, n, O, k, j, N);
|
|
7785
7788
|
R.current.set(n.id, e);
|
|
7786
7789
|
}
|
|
7787
|
-
Q.current.onPolygonAdd?.(n),
|
|
7788
|
-
} else if (e.length > 0)
|
|
7790
|
+
Q.current.onPolygonAdd?.(n), Sn(n), ht.current = [], K.current = null, W.current && (W.current = !1, U(null), r && (r.getCanvas().style.cursor = ""));
|
|
7791
|
+
} else if (e.length > 0) W.current &&= (Cn("cancelled: insufficient points for polygon"), !1), ht.current = [], nn();
|
|
7789
7792
|
else {
|
|
7790
7793
|
U(null);
|
|
7791
7794
|
let e = L.current;
|
|
@@ -7794,7 +7797,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7794
7797
|
return;
|
|
7795
7798
|
}
|
|
7796
7799
|
if (t === "square") {
|
|
7797
|
-
if (
|
|
7800
|
+
if (_t.current) _t.current = null, cn();
|
|
7798
7801
|
else {
|
|
7799
7802
|
U(null);
|
|
7800
7803
|
let e = L.current;
|
|
@@ -7803,22 +7806,22 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7803
7806
|
return;
|
|
7804
7807
|
}
|
|
7805
7808
|
if (t === "polyline") {
|
|
7806
|
-
let e =
|
|
7809
|
+
let e = yt.current;
|
|
7807
7810
|
if (e.length >= 2) {
|
|
7808
|
-
let t =
|
|
7811
|
+
let t = vt.current, n = applyEntityConfig({
|
|
7809
7812
|
...t,
|
|
7810
|
-
id: t?.id ??
|
|
7813
|
+
id: t?.id ?? Ht(),
|
|
7811
7814
|
type: "polyline",
|
|
7812
7815
|
coordinates: [...e]
|
|
7813
7816
|
}, D);
|
|
7814
|
-
|
|
7817
|
+
fn();
|
|
7815
7818
|
let r = L.current;
|
|
7816
7819
|
if (r && !R.current.has(n.id)) {
|
|
7817
7820
|
let e = new PolylineRenderer(r, n, O, k, N);
|
|
7818
7821
|
R.current.set(n.id, e);
|
|
7819
7822
|
}
|
|
7820
|
-
Q.current.onPolylineAdd?.(n),
|
|
7821
|
-
} else if (e.length > 0)
|
|
7823
|
+
Q.current.onPolylineAdd?.(n), Sn(n), yt.current = [], vt.current = null, W.current && (W.current = !1, U(null), r && (r.getCanvas().style.cursor = ""));
|
|
7824
|
+
} else if (e.length > 0) W.current &&= (Cn("cancelled: insufficient points for polyline"), !1), yt.current = [], fn();
|
|
7822
7825
|
else {
|
|
7823
7826
|
U(null);
|
|
7824
7827
|
let e = L.current;
|
|
@@ -7829,11 +7832,11 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7829
7832
|
let n = [e.lngLat.lng, e.lngLat.lat], r = {
|
|
7830
7833
|
x: e.point.x,
|
|
7831
7834
|
y: e.point.y
|
|
7832
|
-
}, i =
|
|
7835
|
+
}, i = zn.current, a = Nn(e.originalEvent.target);
|
|
7833
7836
|
if (a) {
|
|
7834
7837
|
let e = i.find((e) => String(e.id) === a);
|
|
7835
7838
|
if (e) {
|
|
7836
|
-
|
|
7839
|
+
Ln(e, r, n);
|
|
7837
7840
|
return;
|
|
7838
7841
|
}
|
|
7839
7842
|
}
|
|
@@ -7842,7 +7845,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7842
7845
|
if (o && L.current?.getLayer(o) && L.current.queryRenderedFeatures(e.point, { layers: [o] }).length > 0) {
|
|
7843
7846
|
let e = i.find((e) => e.id === t);
|
|
7844
7847
|
if (e) {
|
|
7845
|
-
|
|
7848
|
+
Ln(e, r, n);
|
|
7846
7849
|
return;
|
|
7847
7850
|
}
|
|
7848
7851
|
}
|
|
@@ -7850,19 +7853,19 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7850
7853
|
for (let [e, t] of R.current) if (t.isPointInEntity(n)) {
|
|
7851
7854
|
let t = i.find((t) => t.id === e);
|
|
7852
7855
|
if (t) {
|
|
7853
|
-
|
|
7856
|
+
Ln(t, r, n);
|
|
7854
7857
|
return;
|
|
7855
7858
|
}
|
|
7856
7859
|
}
|
|
7857
7860
|
}, [
|
|
7858
|
-
|
|
7861
|
+
Nn,
|
|
7859
7862
|
Y,
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
]),
|
|
7863
|
+
qt,
|
|
7864
|
+
Qt,
|
|
7865
|
+
nn,
|
|
7866
|
+
cn,
|
|
7867
|
+
fn
|
|
7868
|
+
]), Ln = useCallback((e, t, n) => {
|
|
7866
7869
|
let r = He.current?.getBoundingClientRect(), i = r ? {
|
|
7867
7870
|
x: t.x + r.left,
|
|
7868
7871
|
y: t.y + r.top
|
|
@@ -7887,7 +7890,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7887
7890
|
}
|
|
7888
7891
|
}]
|
|
7889
7892
|
});
|
|
7890
|
-
}, []),
|
|
7893
|
+
}, []), Rn = useCallback(() => {
|
|
7891
7894
|
Ze(null);
|
|
7892
7895
|
}, []);
|
|
7893
7896
|
useEffect(() => {
|
|
@@ -7917,57 +7920,57 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7917
7920
|
document.body.contains(e) && document.body.removeChild(e);
|
|
7918
7921
|
};
|
|
7919
7922
|
}, [I?.zIndex]);
|
|
7920
|
-
let
|
|
7921
|
-
|
|
7922
|
-
let
|
|
7923
|
-
|
|
7924
|
-
let
|
|
7925
|
-
|
|
7926
|
-
let
|
|
7927
|
-
|
|
7928
|
-
let
|
|
7929
|
-
|
|
7930
|
-
let
|
|
7931
|
-
|
|
7932
|
-
let
|
|
7933
|
-
|
|
7934
|
-
let
|
|
7935
|
-
|
|
7923
|
+
let zn = useRef(T);
|
|
7924
|
+
zn.current = T;
|
|
7925
|
+
let Bn = useRef(Le);
|
|
7926
|
+
Bn.current = Le;
|
|
7927
|
+
let Vn = useRef(kt);
|
|
7928
|
+
Vn.current = kt;
|
|
7929
|
+
let Hn = useRef(V);
|
|
7930
|
+
Hn.current = V;
|
|
7931
|
+
let Un = useRef(b);
|
|
7932
|
+
Un.current = b;
|
|
7933
|
+
let Wn = useRef(ot);
|
|
7934
|
+
Wn.current = ot;
|
|
7935
|
+
let Gn = useRef(st);
|
|
7936
|
+
Gn.current = st;
|
|
7937
|
+
let Kn = useRef(ct);
|
|
7938
|
+
Kn.current = ct;
|
|
7936
7939
|
let Q = useRef(v);
|
|
7937
7940
|
Q.current = v;
|
|
7938
|
-
let
|
|
7939
|
-
|
|
7941
|
+
let qn = useRef(D);
|
|
7942
|
+
qn.current = D, useEffect(() => {
|
|
7940
7943
|
let e = (e) => {
|
|
7941
7944
|
if (e.key === "Escape" && q.current) {
|
|
7942
7945
|
R.current.get(q.current.entityId)?.cancelEditPreview?.(), q.current = null;
|
|
7943
7946
|
return;
|
|
7944
7947
|
}
|
|
7945
|
-
if (e.key === "Escape" && V === "edit") {
|
|
7946
|
-
if (ot && (H(null), U(null), Y()), st === "rectangle") if (ct) lt(null),
|
|
7948
|
+
if (e.key === "Escape" && (V === "edit" || W.current)) {
|
|
7949
|
+
if (W.current &&= (Cn("cancelled: escape"), !1), ot && (H(null), U(null), Y()), st === "rectangle") if (ct) lt(null), qt();
|
|
7947
7950
|
else {
|
|
7948
7951
|
U(null);
|
|
7949
7952
|
let e = L.current;
|
|
7950
7953
|
e && (e.getCanvas().style.cursor = "");
|
|
7951
7954
|
}
|
|
7952
|
-
if (st === "circle") if (
|
|
7955
|
+
if (st === "circle") if (mt.current) mt.current = null, Qt();
|
|
7953
7956
|
else {
|
|
7954
7957
|
U(null);
|
|
7955
7958
|
let e = L.current;
|
|
7956
7959
|
e && (e.getCanvas().style.cursor = "");
|
|
7957
7960
|
}
|
|
7958
|
-
if (st === "polygon") if (
|
|
7961
|
+
if (st === "polygon") if (ht.current.length > 0) ht.current = [], nn();
|
|
7959
7962
|
else {
|
|
7960
7963
|
U(null);
|
|
7961
7964
|
let e = L.current;
|
|
7962
7965
|
e && (e.getCanvas().style.cursor = "");
|
|
7963
7966
|
}
|
|
7964
|
-
if (st === "square") if (
|
|
7967
|
+
if (st === "square") if (_t.current) _t.current = null, cn();
|
|
7965
7968
|
else {
|
|
7966
7969
|
U(null);
|
|
7967
7970
|
let e = L.current;
|
|
7968
7971
|
e && (e.getCanvas().style.cursor = "");
|
|
7969
7972
|
}
|
|
7970
|
-
if (st === "polyline") if (
|
|
7973
|
+
if (st === "polyline") if (yt.current.length > 0) yt.current = [], fn();
|
|
7971
7974
|
else {
|
|
7972
7975
|
U(null);
|
|
7973
7976
|
let e = L.current;
|
|
@@ -7984,18 +7987,19 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
7984
7987
|
st,
|
|
7985
7988
|
ct,
|
|
7986
7989
|
Y,
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7990
|
+
qt,
|
|
7991
|
+
Qt,
|
|
7992
|
+
nn,
|
|
7993
|
+
cn,
|
|
7994
|
+
fn,
|
|
7995
|
+
Cn
|
|
7992
7996
|
]), useEffect(() => {
|
|
7993
7997
|
let e = L.current;
|
|
7994
7998
|
if (!e || !B) return;
|
|
7995
7999
|
let t = B.entityId, n = B.config, r = () => {
|
|
7996
|
-
let r =
|
|
8000
|
+
let r = zn.current.find((e) => e.id === t);
|
|
7997
8001
|
if (!r) {
|
|
7998
|
-
|
|
8002
|
+
jt();
|
|
7999
8003
|
return;
|
|
8000
8004
|
}
|
|
8001
8005
|
let { position: i } = calculatePopupPosition(r, n, e, void 0, Je.current);
|
|
@@ -8006,13 +8010,13 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
8006
8010
|
return e.on("move", r), e.on("zoom", r), e.on("rotate", r), e.on("pitch", r), () => {
|
|
8007
8011
|
clearTimeout(i), e.off("move", r), e.off("zoom", r), e.off("rotate", r), e.off("pitch", r);
|
|
8008
8012
|
};
|
|
8009
|
-
}, [B?.entityId,
|
|
8013
|
+
}, [B?.entityId, jt]), useEffect(() => {
|
|
8010
8014
|
let e = L.current, t = He.current;
|
|
8011
8015
|
if (!e || !Xe || !t) return;
|
|
8012
8016
|
let n = Xe.lngLat, r = () => {
|
|
8013
8017
|
let r = e.project(n), i = t.clientWidth, a = t.clientHeight;
|
|
8014
8018
|
if (r.x < 0 || r.x > i || r.y < 0 || r.y > a) {
|
|
8015
|
-
|
|
8019
|
+
Rn();
|
|
8016
8020
|
return;
|
|
8017
8021
|
}
|
|
8018
8022
|
let o = t.getBoundingClientRect(), s = r.x + o.left, c = r.y + o.top;
|
|
@@ -8021,7 +8025,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
8021
8025
|
return e.on("move", r), e.on("zoom", r), e.on("rotate", r), e.on("pitch", r), () => {
|
|
8022
8026
|
e.off("move", r), e.off("zoom", r), e.off("rotate", r), e.off("pitch", r);
|
|
8023
8027
|
};
|
|
8024
|
-
}, [Xe?.lngLat,
|
|
8028
|
+
}, [Xe?.lngLat, Rn]), useEffect(() => {
|
|
8025
8029
|
if (!He.current) return;
|
|
8026
8030
|
let e = {
|
|
8027
8031
|
version: 8,
|
|
@@ -8062,9 +8066,9 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
8062
8066
|
}
|
|
8063
8067
|
z.current.clear(), T.forEach((e) => {
|
|
8064
8068
|
z.current.set(e.id, e);
|
|
8065
|
-
}),
|
|
8066
|
-
}), _.on("click",
|
|
8067
|
-
_.off("click",
|
|
8069
|
+
}), Mn(S), wn(), Gt(), Jt(), en(), an(), un(), tt(_), Ie?.(_);
|
|
8070
|
+
}), _.on("click", Pn), _.on("mousemove", Fn), _.on("contextmenu", In), () => {
|
|
8071
|
+
_.off("click", Pn), _.off("mousemove", Fn), _.off("contextmenu", In), Tn(), Vt(), Y(), X(), Z(), _.remove(), L.current = null;
|
|
8068
8072
|
};
|
|
8069
8073
|
}, []), useEffect(() => {
|
|
8070
8074
|
if (L.current) {
|
|
@@ -8072,53 +8076,53 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
8072
8076
|
L.current.once("load", () => {
|
|
8073
8077
|
z.current.clear(), T.forEach((e) => {
|
|
8074
8078
|
z.current.set(e.id, e);
|
|
8075
|
-
}),
|
|
8079
|
+
}), wn();
|
|
8076
8080
|
});
|
|
8077
8081
|
return;
|
|
8078
8082
|
}
|
|
8079
8083
|
z.current.clear(), T.forEach((e) => {
|
|
8080
8084
|
z.current.set(e.id, e);
|
|
8081
|
-
}),
|
|
8085
|
+
}), wn();
|
|
8082
8086
|
}
|
|
8083
|
-
}, [T,
|
|
8084
|
-
!L.current || !L.current.isStyleLoaded() || (
|
|
8087
|
+
}, [T, wn]), useEffect(() => {
|
|
8088
|
+
!L.current || !L.current.isStyleLoaded() || (Tn(), wn());
|
|
8085
8089
|
}, [
|
|
8086
8090
|
O,
|
|
8087
8091
|
k,
|
|
8088
8092
|
j,
|
|
8089
8093
|
M,
|
|
8090
8094
|
N,
|
|
8091
|
-
|
|
8092
|
-
|
|
8095
|
+
Tn,
|
|
8096
|
+
wn
|
|
8093
8097
|
]), useEffect(() => {
|
|
8094
8098
|
if (L.current) {
|
|
8095
8099
|
if (!L.current.isStyleLoaded()) {
|
|
8096
8100
|
L.current.once("load", () => {
|
|
8097
|
-
|
|
8101
|
+
Mn(S);
|
|
8098
8102
|
});
|
|
8099
8103
|
return;
|
|
8100
8104
|
}
|
|
8101
|
-
|
|
8102
|
-
}
|
|
8103
|
-
}, [S,
|
|
8104
|
-
let
|
|
8105
|
-
|
|
8106
|
-
let
|
|
8107
|
-
|
|
8108
|
-
let
|
|
8109
|
-
|
|
8110
|
-
let
|
|
8111
|
-
|
|
8112
|
-
let
|
|
8113
|
-
|
|
8114
|
-
let
|
|
8115
|
-
|
|
8116
|
-
let
|
|
8117
|
-
|
|
8118
|
-
let
|
|
8119
|
-
|
|
8120
|
-
let
|
|
8121
|
-
|
|
8105
|
+
Mn(S);
|
|
8106
|
+
}
|
|
8107
|
+
}, [S, Mn]);
|
|
8108
|
+
let Jn = useRef(void 0), Yn = useRef(!0), Xn = useRef(S);
|
|
8109
|
+
Xn.current = S;
|
|
8110
|
+
let Zn = useRef(Mn);
|
|
8111
|
+
Zn.current = Mn;
|
|
8112
|
+
let Qn = useRef(Tn);
|
|
8113
|
+
Qn.current = Tn;
|
|
8114
|
+
let $n = useRef(wn);
|
|
8115
|
+
$n.current = wn;
|
|
8116
|
+
let er = useRef(Gt);
|
|
8117
|
+
er.current = Gt;
|
|
8118
|
+
let tr = useRef(Jt);
|
|
8119
|
+
tr.current = Jt;
|
|
8120
|
+
let nr = useRef(en);
|
|
8121
|
+
nr.current = en;
|
|
8122
|
+
let rr = useRef(an);
|
|
8123
|
+
rr.current = an;
|
|
8124
|
+
let ir = useRef(un);
|
|
8125
|
+
ir.current = un, useEffect(() => {
|
|
8122
8126
|
let e = L.current;
|
|
8123
8127
|
if (!e) return;
|
|
8124
8128
|
let t = p || {
|
|
@@ -8126,27 +8130,27 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
8126
8130
|
sources: {},
|
|
8127
8131
|
layers: []
|
|
8128
8132
|
};
|
|
8129
|
-
if (
|
|
8130
|
-
|
|
8133
|
+
if (Yn.current) {
|
|
8134
|
+
Yn.current = !1, Jn.current = p;
|
|
8131
8135
|
return;
|
|
8132
8136
|
}
|
|
8133
|
-
|
|
8137
|
+
Jn.current !== p && (Jn.current = p, e.setStyle(t), e.once("style.load", () => {
|
|
8134
8138
|
if (!e.getStyle().glyphs) {
|
|
8135
8139
|
let t = e.style, n = "/gis-fonts/{fontstack}/{range}.pbf";
|
|
8136
8140
|
t.glyphs = n, t.stylesheet && (t.stylesheet.glyphs = n);
|
|
8137
8141
|
}
|
|
8138
|
-
Ge.current.clear(),
|
|
8142
|
+
Ge.current.clear(), Zn.current(Xn.current), Qn.current(), $n.current(), er.current(), tr.current(), nr.current(), rr.current(), ir.current();
|
|
8139
8143
|
}));
|
|
8140
8144
|
}, [p]), useEffect(() => {
|
|
8141
8145
|
let e = new Set(E.map(String));
|
|
8142
8146
|
for (let [t, n] of R.current) n.setSelected(e.has(String(t)));
|
|
8143
8147
|
}, [E]);
|
|
8144
|
-
let
|
|
8148
|
+
let ar = useRef({});
|
|
8145
8149
|
useEffect(() => {
|
|
8146
8150
|
let e = L.current;
|
|
8147
8151
|
if (!e) return;
|
|
8148
|
-
let t =
|
|
8149
|
-
!n && !r && !i && !a || (
|
|
8152
|
+
let t = ar.current, n = l && (t.center?.[0] !== l[0] || t.center?.[1] !== l[1]), r = t.zoom !== u, i = t.pitch !== d, a = t.bearing !== f;
|
|
8153
|
+
!n && !r && !i && !a || (ar.current = {
|
|
8150
8154
|
center: l,
|
|
8151
8155
|
zoom: u,
|
|
8152
8156
|
pitch: d,
|
|
@@ -8163,7 +8167,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
8163
8167
|
d,
|
|
8164
8168
|
f
|
|
8165
8169
|
]);
|
|
8166
|
-
let
|
|
8170
|
+
let or = (() => we === !1 ? null : we === !0 ? { enabled: !0 } : we)(), sr = (() => P === !1 ? null : P === !0 ? { enabled: !0 } : P)(), cr = (() => Te === !1 ? null : Te === !0 ? { enabled: !0 } : Te)(), $ = (() => {
|
|
8167
8171
|
if (Ee === !1) return null;
|
|
8168
8172
|
let e, t, n;
|
|
8169
8173
|
if (S && S.length > 0) {
|
|
@@ -8188,7 +8192,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
8188
8192
|
sourceLayer: Ee.sourceLayer || t,
|
|
8189
8193
|
classField: Ee.classField || n
|
|
8190
8194
|
};
|
|
8191
|
-
})(),
|
|
8195
|
+
})(), lr = (() => F ? F === !0 ? { enabled: !0 } : F : null)(), ur = (() => Oe ? Oe === !0 ? { enabled: !0 } : Oe : null)(), dr = (() => Me || null)(), fr = useMemo(() => {
|
|
8192
8196
|
let e = [];
|
|
8193
8197
|
for (let t of S) if (t.applyRasterPaint) if (t.type === "style") {
|
|
8194
8198
|
let n = L.current;
|
|
@@ -8198,7 +8202,7 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
8198
8202
|
}
|
|
8199
8203
|
} else e.push(`base-layer-${t.id}`);
|
|
8200
8204
|
return e;
|
|
8201
|
-
}, [S, et]),
|
|
8205
|
+
}, [S, et]), pr = useMemo(() => {
|
|
8202
8206
|
if (V !== "picker") return;
|
|
8203
8207
|
let e = J.cursorImage;
|
|
8204
8208
|
if (!e) return;
|
|
@@ -8233,13 +8237,13 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
8233
8237
|
break;
|
|
8234
8238
|
}
|
|
8235
8239
|
return `url(${e.url}) ${i} ${a}, crosshair`;
|
|
8236
|
-
}, [V, J.cursorImage]),
|
|
8240
|
+
}, [V, J.cursorImage]), mr = useMemo(() => pr ? {
|
|
8237
8241
|
...Ve,
|
|
8238
|
-
"--mapbox-picker-cursor":
|
|
8239
|
-
} : Ve, [Ve,
|
|
8242
|
+
"--mapbox-picker-cursor": pr
|
|
8243
|
+
} : Ve, [Ve, pr]);
|
|
8240
8244
|
return /* @__PURE__ */ jsxs("div", {
|
|
8241
8245
|
className: `comp-mapbox ${V === "picker" ? "comp-mapbox--picker-mode" : ""} ${Be}`,
|
|
8242
|
-
style:
|
|
8246
|
+
style: mr,
|
|
8243
8247
|
children: [
|
|
8244
8248
|
/* @__PURE__ */ jsx("div", {
|
|
8245
8249
|
ref: He,
|
|
@@ -8256,14 +8260,14 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
8256
8260
|
})]
|
|
8257
8261
|
}),
|
|
8258
8262
|
/* @__PURE__ */ jsxs("div", {
|
|
8259
|
-
className: `comp-mapbox__edit-controls${V === "edit" && v.showEditTools !== !1 && (v.markerTemplates && v.markerTemplates.length > 0 || v.showRectangleTool || v.showCircleTool || v.showPolygonTool || v.showSquareTool || v.showPolylineTool) || $ && $.enabled !== !1 ||
|
|
8263
|
+
className: `comp-mapbox__edit-controls${V === "edit" && v.showEditTools !== !1 && (v.markerTemplates && v.markerTemplates.length > 0 || v.showRectangleTool || v.showCircleTool || v.showPolygonTool || v.showSquareTool || v.showPolylineTool) || $ && $.enabled !== !1 || dr && dr.enabled !== !1 ? "" : " comp-mapbox__edit-controls--hidden"}`,
|
|
8260
8264
|
children: [
|
|
8261
8265
|
V === "edit" && v.showEditTools !== !1 && (v.markerTemplates && v.markerTemplates.length > 0 || v.showRectangleTool || v.showCircleTool || v.showPolygonTool || v.showSquareTool || v.showPolylineTool) && /* @__PURE__ */ jsx(EditControl, {
|
|
8262
8266
|
markerTemplates: v.markerTemplates || [],
|
|
8263
8267
|
selectedTemplate: ot,
|
|
8264
|
-
onTemplateSelect:
|
|
8268
|
+
onTemplateSelect: pn,
|
|
8265
8269
|
drawMode: st,
|
|
8266
|
-
onDrawModeChange:
|
|
8270
|
+
onDrawModeChange: mn,
|
|
8267
8271
|
showRectangleTool: v.showRectangleTool,
|
|
8268
8272
|
showCircleTool: v.showCircleTool,
|
|
8269
8273
|
showPolygonTool: v.showPolygonTool,
|
|
@@ -8283,75 +8287,75 @@ const Mapbox = forwardRef((e, c) => {
|
|
|
8283
8287
|
className: $?.className,
|
|
8284
8288
|
style: $?.style
|
|
8285
8289
|
}),
|
|
8286
|
-
|
|
8290
|
+
dr && dr.enabled !== !1 && /* @__PURE__ */ jsx(RoutePlanningControl, {
|
|
8287
8291
|
ref: Ue,
|
|
8288
8292
|
map: et,
|
|
8289
|
-
pointCount:
|
|
8290
|
-
showPointCountInput:
|
|
8291
|
-
visualType:
|
|
8292
|
-
onSelectFinished:
|
|
8293
|
+
pointCount: dr.pointCount,
|
|
8294
|
+
showPointCountInput: dr.showPointCountInput,
|
|
8295
|
+
visualType: dr.visualType,
|
|
8296
|
+
onSelectFinished: dr.onSelectFinished
|
|
8293
8297
|
})
|
|
8294
8298
|
]
|
|
8295
8299
|
}),
|
|
8296
|
-
(
|
|
8300
|
+
(or?.enabled !== !1 || sr?.enabled !== !1 || cr?.enabled !== !1 || lr && lr.enabled !== !1 || ur && ur.enabled !== !1) && /* @__PURE__ */ jsxs("div", {
|
|
8297
8301
|
className: "comp-mapbox__controls",
|
|
8298
8302
|
children: [
|
|
8299
|
-
|
|
8303
|
+
or && or.enabled !== !1 && /* @__PURE__ */ jsx(CoordinateDisplay, {
|
|
8300
8304
|
map: et,
|
|
8301
|
-
precision:
|
|
8302
|
-
className:
|
|
8303
|
-
style:
|
|
8305
|
+
precision: or.precision,
|
|
8306
|
+
className: or.className,
|
|
8307
|
+
style: or.style
|
|
8304
8308
|
}),
|
|
8305
|
-
|
|
8309
|
+
sr && sr.enabled !== !1 && /* @__PURE__ */ jsx(ScaleControl, {
|
|
8306
8310
|
map: et,
|
|
8307
|
-
maxWidth:
|
|
8308
|
-
unit:
|
|
8309
|
-
className:
|
|
8310
|
-
style:
|
|
8311
|
+
maxWidth: sr.maxWidth,
|
|
8312
|
+
unit: sr.unit,
|
|
8313
|
+
className: sr.className,
|
|
8314
|
+
style: sr.style
|
|
8311
8315
|
}),
|
|
8312
|
-
|
|
8316
|
+
lr && lr.enabled !== !1 && /* @__PURE__ */ jsx(MeasureControl, {
|
|
8313
8317
|
map: et,
|
|
8314
8318
|
entityConfig: D,
|
|
8315
8319
|
onDrawModeChange: (e) => {
|
|
8316
|
-
|
|
8320
|
+
xt.current = e;
|
|
8317
8321
|
},
|
|
8318
|
-
className:
|
|
8319
|
-
style:
|
|
8322
|
+
className: lr.className,
|
|
8323
|
+
style: lr.style
|
|
8320
8324
|
}),
|
|
8321
|
-
|
|
8325
|
+
ur && ur.enabled !== !1 && /* @__PURE__ */ jsx(RasterPaintControl, {
|
|
8322
8326
|
map: et,
|
|
8323
8327
|
value: C,
|
|
8324
8328
|
onChange: Ne,
|
|
8325
|
-
rasterPaintLayerIds:
|
|
8326
|
-
className:
|
|
8327
|
-
style:
|
|
8329
|
+
rasterPaintLayerIds: fr,
|
|
8330
|
+
className: ur.className,
|
|
8331
|
+
style: ur.style
|
|
8328
8332
|
}),
|
|
8329
|
-
|
|
8333
|
+
cr && cr.enabled !== !1 && /* @__PURE__ */ jsx(ResetViewControl, {
|
|
8330
8334
|
map: et,
|
|
8331
8335
|
initialCenter: l,
|
|
8332
8336
|
initialZoom: u,
|
|
8333
8337
|
initialPitch: d,
|
|
8334
8338
|
initialBearing: f,
|
|
8335
|
-
duration:
|
|
8336
|
-
className:
|
|
8337
|
-
style:
|
|
8339
|
+
duration: cr.duration,
|
|
8340
|
+
className: cr.className,
|
|
8341
|
+
style: cr.style
|
|
8338
8342
|
})
|
|
8339
8343
|
]
|
|
8340
8344
|
}),
|
|
8341
|
-
!(
|
|
8345
|
+
!(dr && dr.enabled !== !1) && /* @__PURE__ */ jsx(RoutePlanningControl, {
|
|
8342
8346
|
ref: Ue,
|
|
8343
8347
|
map: et,
|
|
8344
8348
|
showButton: !1
|
|
8345
8349
|
}),
|
|
8346
8350
|
B && qe.current && /* @__PURE__ */ jsx(EntityPopup, {
|
|
8347
8351
|
popupState: B,
|
|
8348
|
-
onClose: () =>
|
|
8352
|
+
onClose: () => At(B.entityId),
|
|
8349
8353
|
portalContainer: qe.current,
|
|
8350
8354
|
popupRef: Je
|
|
8351
8355
|
}),
|
|
8352
8356
|
Xe && Qe.current && /* @__PURE__ */ jsx(ContextMenu, {
|
|
8353
8357
|
menuState: Xe,
|
|
8354
|
-
onClose:
|
|
8358
|
+
onClose: Rn,
|
|
8355
8359
|
portalContainer: Qe.current,
|
|
8356
8360
|
menuRef: $e
|
|
8357
8361
|
})
|