open-plant 1.2.20 → 1.2.21
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 +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +483 -488
- package/dist/index.js.map +1 -1
- package/dist/types/react/overview-map.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var ei = Object.defineProperty;
|
|
|
2
2
|
var ni = (e, t, n) => t in e ? ei(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var w = (e, t, n) => ni(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { jsx as jt, jsxs as Tr } from "react/jsx-runtime";
|
|
5
|
-
import { useRef as nt, useMemo as j, useCallback as I, useEffect as O, useState as
|
|
5
|
+
import { useRef as nt, useMemo as j, useCallback as I, useEffect as O, useState as Te } from "react";
|
|
6
6
|
function Jn(e, t, n) {
|
|
7
7
|
const r = e.createShader(t);
|
|
8
8
|
if (!r)
|
|
@@ -744,7 +744,7 @@ const vr = [
|
|
|
744
744
|
160,
|
|
745
745
|
255
|
|
746
746
|
];
|
|
747
|
-
function
|
|
747
|
+
function ct(e, t, n) {
|
|
748
748
|
return Math.max(t, Math.min(n, e));
|
|
749
749
|
}
|
|
750
750
|
function _r(e, t, n) {
|
|
@@ -805,7 +805,7 @@ function tr(e, t, n) {
|
|
|
805
805
|
throw new Error(e.getProgramInfoLog(o) || "program link failed");
|
|
806
806
|
return o;
|
|
807
807
|
}
|
|
808
|
-
const Di = "rgba(255, 77, 79, 0.16)", er = "transparent", Oi = 3, Xi = 2, Fr = 96, Yi = 1, nr = [], _e = [], an = 1e3, Ur = 2, Br = 2, ki = 4096, Wi = 0.2, Vi = 1.12, Gi = 0.89, Hi = 32, qi = "#000000", $i = 0.1, Zi = "#FFCF00", Ki = "#FF0000", Ji = 1.5, rr = [2, 2], Qi = 1, ji = 0.25, to = 4, eo = 1, no = 0, ro = 4, io = 0.05, oo = 256, ir = 1.5,
|
|
808
|
+
const Di = "rgba(255, 77, 79, 0.16)", er = "transparent", Oi = 3, Xi = 2, Fr = 96, Yi = 1, nr = [], _e = [], an = 1e3, Ur = 2, Br = 2, ki = 4096, Wi = 0.2, Vi = 1.12, Gi = 0.89, Hi = 32, qi = "#000000", $i = 0.1, Zi = "#FFCF00", Ki = "#FF0000", Ji = 1.5, rr = [2, 2], Qi = 1, ji = 0.25, to = 4, eo = 1, no = 0, ro = 4, io = 0.05, oo = 256, ir = 1.5, oe = {
|
|
809
809
|
color: "#ff4d4f",
|
|
810
810
|
width: 2,
|
|
811
811
|
lineJoin: "round",
|
|
@@ -836,7 +836,7 @@ const Di = "rgba(255, 77, 79, 0.16)", er = "transparent", Oi = 3, Xi = 2, Fr = 9
|
|
|
836
836
|
paddingY: 4,
|
|
837
837
|
offsetY: 10,
|
|
838
838
|
borderRadius: 4
|
|
839
|
-
},
|
|
839
|
+
}, se = {
|
|
840
840
|
fontFamily: "Pretendard, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
841
841
|
fontSize: 13,
|
|
842
842
|
fontWeight: 500,
|
|
@@ -918,10 +918,10 @@ function ar(e, t, n) {
|
|
|
918
918
|
if (!l) throw new Error("Failed to create rectangle");
|
|
919
919
|
a.push(l);
|
|
920
920
|
}
|
|
921
|
-
return
|
|
921
|
+
return zt(a);
|
|
922
922
|
}
|
|
923
923
|
}
|
|
924
|
-
return
|
|
924
|
+
return zt([
|
|
925
925
|
[e[0] - t, e[1] - t],
|
|
926
926
|
[e[0] + t, e[1] - t],
|
|
927
927
|
[e[0] + t, e[1] + t],
|
|
@@ -935,9 +935,9 @@ function wo(e, t, n = Fr) {
|
|
|
935
935
|
const o = i / n * Math.PI * 2;
|
|
936
936
|
r.push([e[0] + Math.cos(o) * t, e[1] + Math.sin(o) * t]);
|
|
937
937
|
}
|
|
938
|
-
return
|
|
938
|
+
return zt(r);
|
|
939
939
|
}
|
|
940
|
-
function
|
|
940
|
+
function zt(e) {
|
|
941
941
|
if (!Array.isArray(e) || e.length < 3) return [];
|
|
942
942
|
const t = e.map(([i, o]) => [i, o]), n = t[0], r = t[t.length - 1];
|
|
943
943
|
return !n || !r ? [] : ((n[0] !== r[0] || n[1] !== r[1]) && t.push([n[0], n[1]]), t);
|
|
@@ -958,10 +958,10 @@ function An(e, t, n) {
|
|
|
958
958
|
if (!c) return An(e, t);
|
|
959
959
|
s.push(c);
|
|
960
960
|
}
|
|
961
|
-
return
|
|
961
|
+
return zt(s);
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
|
-
return
|
|
964
|
+
return zt([
|
|
965
965
|
[e[0], e[1]],
|
|
966
966
|
[t[0], e[1]],
|
|
967
967
|
[t[0], t[1]],
|
|
@@ -977,7 +977,7 @@ function cr(e, t, n = Fr) {
|
|
|
977
977
|
const c = a / n * Math.PI * 2;
|
|
978
978
|
s.push([r + Math.cos(c) * o, i + Math.sin(c) * o]);
|
|
979
979
|
}
|
|
980
|
-
return
|
|
980
|
+
return zt(s);
|
|
981
981
|
}
|
|
982
982
|
function rn(e) {
|
|
983
983
|
if (!Array.isArray(e) || e.length < 4) return 0;
|
|
@@ -1015,14 +1015,14 @@ function yo(e) {
|
|
|
1015
1015
|
return t.length > 0 ? t : er;
|
|
1016
1016
|
}
|
|
1017
1017
|
function Nr(e) {
|
|
1018
|
-
const t = Array.isArray(e?.lineDash) ? e.lineDash.filter((s) => Number.isFinite(s) && s >= 0) : _e, n = typeof e?.width == "number" && Number.isFinite(e.width) ? Math.max(0, e.width) :
|
|
1018
|
+
const t = Array.isArray(e?.lineDash) ? e.lineDash.filter((s) => Number.isFinite(s) && s >= 0) : _e, n = typeof e?.width == "number" && Number.isFinite(e.width) ? Math.max(0, e.width) : oe.width, r = typeof e?.shadowBlur == "number" && Number.isFinite(e.shadowBlur) ? Math.max(0, e.shadowBlur) : oe.shadowBlur, i = typeof e?.shadowOffsetX == "number" && Number.isFinite(e.shadowOffsetX) ? e.shadowOffsetX : oe.shadowOffsetX, o = typeof e?.shadowOffsetY == "number" && Number.isFinite(e.shadowOffsetY) ? e.shadowOffsetY : oe.shadowOffsetY;
|
|
1019
1019
|
return {
|
|
1020
|
-
color: e?.color ||
|
|
1020
|
+
color: e?.color || oe.color,
|
|
1021
1021
|
width: n,
|
|
1022
1022
|
lineDash: t.length ? t : _e,
|
|
1023
|
-
lineJoin: e?.lineJoin ||
|
|
1024
|
-
lineCap: e?.lineCap ||
|
|
1025
|
-
shadowColor: e?.shadowColor ||
|
|
1023
|
+
lineJoin: e?.lineJoin || oe.lineJoin,
|
|
1024
|
+
lineCap: e?.lineCap || oe.lineCap,
|
|
1025
|
+
shadowColor: e?.shadowColor || oe.shadowColor,
|
|
1026
1026
|
shadowBlur: r,
|
|
1027
1027
|
shadowOffsetX: i,
|
|
1028
1028
|
shadowOffsetY: o
|
|
@@ -1073,7 +1073,7 @@ function dr(e, t) {
|
|
|
1073
1073
|
const r = [];
|
|
1074
1074
|
for (const i of n) {
|
|
1075
1075
|
if (i.length < 2) continue;
|
|
1076
|
-
const o = t ?
|
|
1076
|
+
const o = t ? zt(i) : i;
|
|
1077
1077
|
o.length >= (t ? 4 : 2) && r.push(o);
|
|
1078
1078
|
}
|
|
1079
1079
|
return r;
|
|
@@ -1118,13 +1118,13 @@ function Dr(e, t) {
|
|
|
1118
1118
|
}) : e;
|
|
1119
1119
|
}
|
|
1120
1120
|
function To(e) {
|
|
1121
|
-
const t = typeof e?.fontSize == "number" && Number.isFinite(e.fontSize) ? Math.max(8, e.fontSize) :
|
|
1121
|
+
const t = typeof e?.fontSize == "number" && Number.isFinite(e.fontSize) ? Math.max(8, e.fontSize) : se.fontSize, n = typeof e?.borderRadius == "number" && Number.isFinite(e.borderRadius) ? Math.max(0, e.borderRadius) : se.borderRadius, r = typeof e?.paddingX == "number" && Number.isFinite(e.paddingX) ? Math.max(0, e.paddingX) : se.paddingX, i = typeof e?.paddingY == "number" && Number.isFinite(e.paddingY) ? Math.max(0, e.paddingY) : se.paddingY;
|
|
1122
1122
|
return {
|
|
1123
|
-
fontFamily: e?.fontFamily ||
|
|
1123
|
+
fontFamily: e?.fontFamily || se.fontFamily,
|
|
1124
1124
|
fontSize: t,
|
|
1125
|
-
fontWeight: e?.fontWeight ||
|
|
1126
|
-
textColor: e?.textColor ||
|
|
1127
|
-
backgroundColor: e?.backgroundColor ||
|
|
1125
|
+
fontWeight: e?.fontWeight || se.fontWeight,
|
|
1126
|
+
textColor: e?.textColor || se.textColor,
|
|
1127
|
+
backgroundColor: e?.backgroundColor || se.backgroundColor,
|
|
1128
1128
|
borderRadius: n,
|
|
1129
1129
|
paddingX: r,
|
|
1130
1130
|
paddingY: i
|
|
@@ -1219,7 +1219,7 @@ function _o(e, t, n, r, i, o, s, a) {
|
|
|
1219
1219
|
function Ge(e, t, n) {
|
|
1220
1220
|
return [kt(e[0], 0, t), kt(e[1], 0, n)];
|
|
1221
1221
|
}
|
|
1222
|
-
function
|
|
1222
|
+
function ge(e) {
|
|
1223
1223
|
if (!Array.isArray(e) || e.length < 2) return null;
|
|
1224
1224
|
const t = Number(e[0]), n = Number(e[1]);
|
|
1225
1225
|
return !Number.isFinite(t) || !Number.isFinite(n) ? null : [t, n];
|
|
@@ -1245,21 +1245,21 @@ function Fo({
|
|
|
1245
1245
|
regionStrokeStyle: _,
|
|
1246
1246
|
regionStrokeHoverStyle: B,
|
|
1247
1247
|
regionStrokeActiveStyle: N,
|
|
1248
|
-
patchStrokeStyle:
|
|
1248
|
+
patchStrokeStyle: V,
|
|
1249
1249
|
resolveRegionStrokeStyle: F,
|
|
1250
1250
|
resolveRegionLabelStyle: k,
|
|
1251
|
-
overlayShapes:
|
|
1252
|
-
hoveredRegionId:
|
|
1251
|
+
overlayShapes: K,
|
|
1252
|
+
hoveredRegionId: dt = null,
|
|
1253
1253
|
activeRegionId: bt = null,
|
|
1254
1254
|
regionLabelStyle: Pt,
|
|
1255
1255
|
drawAreaTooltip: Ft,
|
|
1256
1256
|
autoLiftRegionLabelAtMaxZoom: Bt = !1,
|
|
1257
|
-
regionLabelAutoLiftOffsetPx:
|
|
1257
|
+
regionLabelAutoLiftOffsetPx: ot,
|
|
1258
1258
|
invalidateRef: Wt,
|
|
1259
|
-
className:
|
|
1260
|
-
style:
|
|
1259
|
+
className: ue,
|
|
1260
|
+
style: le
|
|
1261
1261
|
}) {
|
|
1262
|
-
const tt = nt(null), Vt = nt(!1), $t = nt(/* @__PURE__ */ new Map()),
|
|
1262
|
+
const tt = nt(null), Vt = nt(!1), $t = nt(/* @__PURE__ */ new Map()), be = nt(e), Tt = nt({
|
|
1263
1263
|
isDrawing: !1,
|
|
1264
1264
|
pointerId: null,
|
|
1265
1265
|
start: null,
|
|
@@ -1269,13 +1269,13 @@ function Fo({
|
|
|
1269
1269
|
points: [],
|
|
1270
1270
|
screenPoints: [],
|
|
1271
1271
|
stampCenter: null
|
|
1272
|
-
}),
|
|
1272
|
+
}), st = p ?? e !== "cursor", R = j(() => b && b.length > 0 ? b : !S || S.length === 0 ? nr : S.map((u, h) => ({
|
|
1273
1273
|
id: h,
|
|
1274
1274
|
coordinates: u
|
|
1275
|
-
})), [b, S]),
|
|
1275
|
+
})), [b, S]), E = j(() => m ?? nr, [m]), U = j(() => {
|
|
1276
1276
|
const u = [];
|
|
1277
|
-
for (let h = 0; h <
|
|
1278
|
-
const y =
|
|
1277
|
+
for (let h = 0; h < R.length; h += 1) {
|
|
1278
|
+
const y = R[h], M = mr(y.coordinates);
|
|
1279
1279
|
M.length !== 0 && u.push({
|
|
1280
1280
|
region: y,
|
|
1281
1281
|
regionIndex: h,
|
|
@@ -1284,10 +1284,10 @@ function Fo({
|
|
|
1284
1284
|
});
|
|
1285
1285
|
}
|
|
1286
1286
|
return u;
|
|
1287
|
-
}, [
|
|
1287
|
+
}, [R]), et = j(() => {
|
|
1288
1288
|
const u = [];
|
|
1289
|
-
for (let h = 0; h <
|
|
1290
|
-
const y =
|
|
1289
|
+
for (let h = 0; h < E.length; h += 1) {
|
|
1290
|
+
const y = E[h], M = mr(y.coordinates);
|
|
1291
1291
|
M.length !== 0 && u.push({
|
|
1292
1292
|
region: y,
|
|
1293
1293
|
regionIndex: h,
|
|
@@ -1296,7 +1296,7 @@ function Fo({
|
|
|
1296
1296
|
});
|
|
1297
1297
|
}
|
|
1298
1298
|
return u;
|
|
1299
|
-
}, [
|
|
1299
|
+
}, [E]), W = j(() => Nr(_), [_]), ut = j(() => Ce(W, B), [W, B]), wt = j(() => Ce(W, N), [W, N]), J = j(() => Ce(so, V), [V]), G = j(() => yo(x), [x]), rt = j(() => _n(Pt), [Pt]), lt = j(() => Ro(Ft), [Ft]), Q = j(() => lo(o), [o]), X = j(() => po(s), [s]), mt = j(
|
|
1300
1300
|
() => ({
|
|
1301
1301
|
position: "absolute",
|
|
1302
1302
|
inset: 0,
|
|
@@ -1305,11 +1305,11 @@ function Fo({
|
|
|
1305
1305
|
height: "100%",
|
|
1306
1306
|
display: "block",
|
|
1307
1307
|
touchAction: "none",
|
|
1308
|
-
pointerEvents:
|
|
1309
|
-
cursor:
|
|
1310
|
-
...
|
|
1308
|
+
pointerEvents: st ? "auto" : "none",
|
|
1309
|
+
cursor: st ? e === "brush" ? "none" : "crosshair" : "default",
|
|
1310
|
+
...le
|
|
1311
1311
|
}),
|
|
1312
|
-
[
|
|
1312
|
+
[st, e, le]
|
|
1313
1313
|
), ft = I(() => {
|
|
1314
1314
|
const u = tt.current;
|
|
1315
1315
|
if (!u) return;
|
|
@@ -1321,7 +1321,7 @@ function Fo({
|
|
|
1321
1321
|
if (!h || u.length === 0) return [];
|
|
1322
1322
|
const y = new Array(u.length);
|
|
1323
1323
|
for (let M = 0; M < u.length; M += 1) {
|
|
1324
|
-
const T =
|
|
1324
|
+
const T = ge(h.worldToScreen(u[M][0], u[M][1]));
|
|
1325
1325
|
if (!T) return [];
|
|
1326
1326
|
y[M] = T;
|
|
1327
1327
|
}
|
|
@@ -1332,7 +1332,7 @@ function Fo({
|
|
|
1332
1332
|
(u) => {
|
|
1333
1333
|
const h = a.current, y = tt.current;
|
|
1334
1334
|
if (!h || !y) return null;
|
|
1335
|
-
const M = y.getBoundingClientRect(), T =
|
|
1335
|
+
const M = y.getBoundingClientRect(), T = ge(h.screenToWorld(M.left + u[0], M.top + u[1]));
|
|
1336
1336
|
return T ? Ge(T, t, n) : null;
|
|
1337
1337
|
},
|
|
1338
1338
|
[a, t, n]
|
|
@@ -1340,10 +1340,10 @@ function Fo({
|
|
|
1340
1340
|
const u = a.current, h = u?.getViewState?.().rotationDeg ?? 0;
|
|
1341
1341
|
if (!(Math.abs(h % 360) < 0.01 || !u))
|
|
1342
1342
|
return {
|
|
1343
|
-
worldToScreen: (y, M) =>
|
|
1343
|
+
worldToScreen: (y, M) => ge(u.worldToScreen(y, M)),
|
|
1344
1344
|
screenToWorld: yt
|
|
1345
1345
|
};
|
|
1346
|
-
}, [a, yt]),
|
|
1346
|
+
}, [a, yt]), Dt = I(
|
|
1347
1347
|
(u) => {
|
|
1348
1348
|
if (!Number.isFinite(u) || u <= 0) return 0;
|
|
1349
1349
|
const h = typeof r == "number" && Number.isFinite(r) && r > 0 ? r : 1, y = typeof i == "number" && Number.isFinite(i) ? i : 0, M = a.current?.getViewState?.().zoom, T = typeof M == "number" && Number.isFinite(M) && M > 0 ? M : 1, D = y + Math.log2(T), L = Math.max(1e-9, _r(h, y, D));
|
|
@@ -1362,15 +1362,15 @@ function Fo({
|
|
|
1362
1362
|
const M = bo(y);
|
|
1363
1363
|
let T = [];
|
|
1364
1364
|
if (u === "stamp-rectangle" || u === "stamp-rectangle-2mm2") {
|
|
1365
|
-
const D =
|
|
1365
|
+
const D = Dt(Math.sqrt(M) * 0.5);
|
|
1366
1366
|
T = ar(h, D, Et());
|
|
1367
1367
|
} else if (u === "stamp-circle" || u === "stamp-circle-2mm2" || u === "stamp-circle-hpf-0.2mm2") {
|
|
1368
|
-
const D =
|
|
1368
|
+
const D = Dt(Math.sqrt(M / Math.PI));
|
|
1369
1369
|
T = wo(h, D);
|
|
1370
1370
|
}
|
|
1371
1371
|
return T.length ? T.map((D) => Ge(D, t, n)) : [];
|
|
1372
1372
|
},
|
|
1373
|
-
[
|
|
1373
|
+
[Dt, t, n, Q, Et]
|
|
1374
1374
|
), Ct = I(() => {
|
|
1375
1375
|
const u = Tt.current;
|
|
1376
1376
|
return Ve(e) ? Ot(e, u.stampCenter) : e === "brush" ? [] : u.isDrawing ? e === "freehand" ? u.points : e === "rectangle" ? An(u.start, u.current, Et()) : e === "circular" ? cr(u.start, u.current) : [] : [];
|
|
@@ -1394,11 +1394,11 @@ function Fo({
|
|
|
1394
1394
|
}
|
|
1395
1395
|
},
|
|
1396
1396
|
[X]
|
|
1397
|
-
),
|
|
1397
|
+
), $ = I(
|
|
1398
1398
|
(u) => {
|
|
1399
1399
|
const h = Tt.current, y = h.cursor;
|
|
1400
1400
|
if (!y) return;
|
|
1401
|
-
const M = h.cursorScreen ??
|
|
1401
|
+
const M = h.cursorScreen ?? ge(a.current?.worldToScreen(y[0], y[1]) ?? []);
|
|
1402
1402
|
if (!M) return;
|
|
1403
1403
|
const T = X.radius;
|
|
1404
1404
|
!Number.isFinite(T) || T <= 0 || (u.save(), u.beginPath(), u.arc(M[0], M[1], T, 0, Math.PI * 2), u.strokeStyle = h.isDrawing ? X.cursorActiveColor : X.cursorColor, u.lineWidth = X.cursorLineWidth, u.setLineDash(X.cursorLineDash), u.stroke(), u.setLineDash(_e), u.restore());
|
|
@@ -1413,8 +1413,8 @@ function Fo({
|
|
|
1413
1413
|
const y = Math.max(1, window.devicePixelRatio || 1), M = u.width / y, T = u.height / y;
|
|
1414
1414
|
if (h.setTransform(1, 0, 0, 1, 0, 0), h.clearRect(0, 0, u.width, u.height), h.setTransform(y, 0, 0, y, 0, 0), U.length > 0)
|
|
1415
1415
|
for (const L of U) {
|
|
1416
|
-
const { region: it, polygons:
|
|
1417
|
-
let
|
|
1416
|
+
const { region: it, polygons: Z, regionIndex: Y, regionKey: ht } = L, pt = fr(bt, ht) ? "active" : fr(dt, ht) ? "hover" : "default";
|
|
1417
|
+
let Lt = pt === "active" ? wt : pt === "hover" ? ut : W;
|
|
1418
1418
|
if (F) {
|
|
1419
1419
|
const xt = F({
|
|
1420
1420
|
region: it,
|
|
@@ -1422,39 +1422,39 @@ function Fo({
|
|
|
1422
1422
|
regionIndex: Y,
|
|
1423
1423
|
state: pt
|
|
1424
1424
|
});
|
|
1425
|
-
|
|
1425
|
+
Lt = Ce(Lt, xt || void 0);
|
|
1426
1426
|
}
|
|
1427
|
-
const Rt = pt === "default" ? null : Po(
|
|
1428
|
-
for (const xt of
|
|
1427
|
+
const Rt = pt === "default" ? null : Po(Lt);
|
|
1428
|
+
for (const xt of Z) {
|
|
1429
1429
|
const Gt = H(xt.outer);
|
|
1430
|
-
Gt.length >= 4 && (Rt && Ht(h, Gt, Rt, !0, !1), Ht(h, Gt,
|
|
1430
|
+
Gt.length >= 4 && (Rt && Ht(h, Gt, Rt, !0, !1), Ht(h, Gt, Lt, !0, !1));
|
|
1431
1431
|
for (const Kt of xt.holes) {
|
|
1432
1432
|
const It = H(Kt);
|
|
1433
|
-
It.length >= 4 && (Rt && Ht(h, It, Rt, !0, !1), Ht(h, It,
|
|
1433
|
+
It.length >= 4 && (Rt && Ht(h, It, Rt, !0, !1), Ht(h, It, Lt, !0, !1));
|
|
1434
1434
|
}
|
|
1435
1435
|
}
|
|
1436
1436
|
}
|
|
1437
1437
|
if (et.length > 0)
|
|
1438
1438
|
for (const L of et)
|
|
1439
1439
|
for (const it of L.polygons) {
|
|
1440
|
-
const
|
|
1441
|
-
|
|
1440
|
+
const Z = H(it.outer);
|
|
1441
|
+
Z.length >= 4 && Ht(h, Z, J, !0, !1);
|
|
1442
1442
|
for (const Y of it.holes) {
|
|
1443
1443
|
const ht = H(Y);
|
|
1444
|
-
ht.length >= 4 && Ht(h, ht,
|
|
1444
|
+
ht.length >= 4 && Ht(h, ht, J, !0, !1);
|
|
1445
1445
|
}
|
|
1446
1446
|
}
|
|
1447
|
-
if (Array.isArray(
|
|
1447
|
+
if (Array.isArray(K) && K.length > 0) {
|
|
1448
1448
|
const L = !!globalThis.__OPEN_PLANT_DEBUG_OVERLAY__, it = H(
|
|
1449
|
-
|
|
1449
|
+
zt([
|
|
1450
1450
|
[0, 0],
|
|
1451
1451
|
[t, 0],
|
|
1452
1452
|
[t, n],
|
|
1453
1453
|
[0, n]
|
|
1454
1454
|
])
|
|
1455
1455
|
);
|
|
1456
|
-
for (let
|
|
1457
|
-
const Y =
|
|
1456
|
+
for (let Z = 0; Z < K.length; Z += 1) {
|
|
1457
|
+
const Y = K[Z];
|
|
1458
1458
|
if (!Y?.coordinates?.length || Y.visible === !1) continue;
|
|
1459
1459
|
const ht = Y.closed ?? So(Y.coordinates), pt = dr(Y.coordinates, ht);
|
|
1460
1460
|
if (Y.invertedFill?.fillColor) {
|
|
@@ -1464,9 +1464,9 @@ function Fo({
|
|
|
1464
1464
|
Kt.length >= 4 && Rt.push(Kt);
|
|
1465
1465
|
}
|
|
1466
1466
|
if (L) {
|
|
1467
|
-
const Gt = String(Y.id ??
|
|
1467
|
+
const Gt = String(Y.id ?? Z), Kt = `${it.length}|${xt.length}|${Rt.length}|${Y.invertedFill.fillColor}`;
|
|
1468
1468
|
$t.current.get(Gt) !== Kt && ($t.current.set(Gt, Kt), console.debug("[open-plant] invertedFill", {
|
|
1469
|
-
id: Y.id ??
|
|
1469
|
+
id: Y.id ?? Z,
|
|
1470
1470
|
outerRingPoints: it.length,
|
|
1471
1471
|
sourceRingCount: xt.length,
|
|
1472
1472
|
holeRingCount: Rt.length,
|
|
@@ -1476,66 +1476,66 @@ function Fo({
|
|
|
1476
1476
|
xo(h, it, Rt, Y.invertedFill.fillColor);
|
|
1477
1477
|
}
|
|
1478
1478
|
if (pt.length === 0) continue;
|
|
1479
|
-
const
|
|
1479
|
+
const Lt = Ce(W, Y.stroke ?? Y.strokeStyle);
|
|
1480
1480
|
for (const Rt of pt) {
|
|
1481
1481
|
const xt = H(Rt);
|
|
1482
|
-
xt.length < 2 || Ht(h, xt,
|
|
1482
|
+
xt.length < 2 || Ht(h, xt, Lt, ht, Y.fill ?? !1);
|
|
1483
1483
|
}
|
|
1484
1484
|
}
|
|
1485
1485
|
}
|
|
1486
1486
|
const D = Ct();
|
|
1487
|
-
if (
|
|
1487
|
+
if (st) {
|
|
1488
1488
|
if (e === "brush")
|
|
1489
|
-
St(h),
|
|
1489
|
+
St(h), $(h);
|
|
1490
1490
|
else if (D.length > 0)
|
|
1491
1491
|
if (e === "freehand") {
|
|
1492
1492
|
const L = H(D);
|
|
1493
|
-
L.length >= 2 && Ht(h, L, W, !1, !1), L.length >= 3 && Ht(h, H(
|
|
1493
|
+
L.length >= 2 && Ht(h, L, W, !1, !1), L.length >= 3 && Ht(h, H(zt(D)), W, !0, !0, G);
|
|
1494
1494
|
} else {
|
|
1495
1495
|
const L = H(D);
|
|
1496
|
-
L.length >= 4 && Ht(h, L, W, !0, !0,
|
|
1496
|
+
L.length >= 4 && Ht(h, L, W, !0, !0, G);
|
|
1497
1497
|
}
|
|
1498
1498
|
}
|
|
1499
1499
|
if (U.length > 0) {
|
|
1500
|
-
const L = Math.max(1e-6, a.current?.getViewState?.().zoom ?? 1), it = typeof
|
|
1501
|
-
for (const
|
|
1502
|
-
if (!
|
|
1503
|
-
const Y = Io(
|
|
1500
|
+
const L = Math.max(1e-6, a.current?.getViewState?.().zoom ?? 1), it = typeof ot == "number" && Number.isFinite(ot) ? Math.max(0, ot) : Lr(Bt, L, a.current?.getZoomRange?.());
|
|
1501
|
+
for (const Z of U) {
|
|
1502
|
+
if (!Z.region.label) continue;
|
|
1503
|
+
const Y = Io(Z.polygons);
|
|
1504
1504
|
if (!Y) continue;
|
|
1505
|
-
const ht =
|
|
1505
|
+
const ht = ge(a.current?.worldToScreen(Y[0], Y[1]) ?? []);
|
|
1506
1506
|
if (!ht) continue;
|
|
1507
1507
|
let pt = Dr(
|
|
1508
1508
|
rt,
|
|
1509
1509
|
k?.({
|
|
1510
|
-
region:
|
|
1511
|
-
regionId:
|
|
1512
|
-
regionIndex:
|
|
1510
|
+
region: Z.region,
|
|
1511
|
+
regionId: Z.regionKey,
|
|
1512
|
+
regionIndex: Z.regionIndex,
|
|
1513
1513
|
zoom: L
|
|
1514
1514
|
})
|
|
1515
1515
|
);
|
|
1516
1516
|
it > 0 && (pt = {
|
|
1517
1517
|
...pt,
|
|
1518
1518
|
offsetY: pt.offsetY + it
|
|
1519
|
-
}), vo(h,
|
|
1519
|
+
}), vo(h, Z.region.label, ht, M, T, pt);
|
|
1520
1520
|
}
|
|
1521
1521
|
}
|
|
1522
|
-
if (lt.enabled &&
|
|
1522
|
+
if (lt.enabled && st && (e === "freehand" || e === "rectangle" || e === "circular")) {
|
|
1523
1523
|
const L = Tt.current;
|
|
1524
1524
|
if (L.isDrawing) {
|
|
1525
|
-
const it = e === "freehand" ?
|
|
1525
|
+
const it = e === "freehand" ? zt(D) : D;
|
|
1526
1526
|
if (it.length >= 4) {
|
|
1527
|
-
const
|
|
1527
|
+
const Z = rn(it), Y = typeof r == "number" && Number.isFinite(r) && r > 0 ? r : 0, ht = Y > 0 ? Z * Y * Y / (an * an) : 0;
|
|
1528
1528
|
let pt = Tn(ht);
|
|
1529
1529
|
try {
|
|
1530
1530
|
pt = lt.format(ht);
|
|
1531
1531
|
} catch {
|
|
1532
1532
|
pt = Tn(ht);
|
|
1533
1533
|
}
|
|
1534
|
-
const
|
|
1535
|
-
|
|
1534
|
+
const Lt = L.cursorScreen ?? (L.current ? ge(a.current?.worldToScreen(L.current[0], L.current[1]) ?? []) : null);
|
|
1535
|
+
Lt && _o(
|
|
1536
1536
|
h,
|
|
1537
1537
|
pt,
|
|
1538
|
-
|
|
1538
|
+
Lt,
|
|
1539
1539
|
M,
|
|
1540
1540
|
T,
|
|
1541
1541
|
lt.style,
|
|
@@ -1546,32 +1546,32 @@ function Fo({
|
|
|
1546
1546
|
}
|
|
1547
1547
|
}
|
|
1548
1548
|
}, [
|
|
1549
|
-
|
|
1549
|
+
st,
|
|
1550
1550
|
e,
|
|
1551
1551
|
Ct,
|
|
1552
1552
|
St,
|
|
1553
|
-
|
|
1553
|
+
$,
|
|
1554
1554
|
ft,
|
|
1555
1555
|
H,
|
|
1556
1556
|
t,
|
|
1557
1557
|
n,
|
|
1558
1558
|
a,
|
|
1559
1559
|
U,
|
|
1560
|
-
|
|
1561
|
-
|
|
1560
|
+
K,
|
|
1561
|
+
dt,
|
|
1562
1562
|
bt,
|
|
1563
1563
|
W,
|
|
1564
1564
|
ut,
|
|
1565
1565
|
wt,
|
|
1566
|
-
|
|
1566
|
+
G,
|
|
1567
1567
|
et,
|
|
1568
|
-
|
|
1568
|
+
J,
|
|
1569
1569
|
F,
|
|
1570
1570
|
k,
|
|
1571
1571
|
rt,
|
|
1572
1572
|
lt,
|
|
1573
1573
|
Bt,
|
|
1574
|
-
|
|
1574
|
+
ot,
|
|
1575
1575
|
r
|
|
1576
1576
|
]), z = I(() => {
|
|
1577
1577
|
Vt.current || (Vt.current = !0, requestAnimationFrame(() => {
|
|
@@ -1589,16 +1589,16 @@ function Fo({
|
|
|
1589
1589
|
(u) => {
|
|
1590
1590
|
const h = a.current;
|
|
1591
1591
|
if (!h || t <= 0 || n <= 0) return null;
|
|
1592
|
-
const y =
|
|
1592
|
+
const y = ge(h.screenToWorld(u.clientX, u.clientY));
|
|
1593
1593
|
return y ? Ge(y, t, n) : null;
|
|
1594
1594
|
},
|
|
1595
1595
|
[a, t, n]
|
|
1596
|
-
),
|
|
1596
|
+
), gt = I((u) => {
|
|
1597
1597
|
const h = tt.current;
|
|
1598
1598
|
if (!h) return null;
|
|
1599
1599
|
const y = h.getBoundingClientRect(), M = kt(u.clientX - y.left, 0, y.width), T = kt(u.clientY - y.top, 0, y.height);
|
|
1600
1600
|
return !Number.isFinite(M) || !Number.isFinite(T) ? null : [M, T];
|
|
1601
|
-
}, []),
|
|
1601
|
+
}, []), Re = I(() => {
|
|
1602
1602
|
const u = Tt.current;
|
|
1603
1603
|
if (!u.isDrawing) {
|
|
1604
1604
|
Mt(!0), z();
|
|
@@ -1606,7 +1606,7 @@ function Fo({
|
|
|
1606
1606
|
}
|
|
1607
1607
|
let h = [];
|
|
1608
1608
|
if (e === "freehand")
|
|
1609
|
-
u.points.length >= Oi && (h =
|
|
1609
|
+
u.points.length >= Oi && (h = zt(u.points));
|
|
1610
1610
|
else if (e === "rectangle")
|
|
1611
1611
|
h = An(u.start, u.current, Et());
|
|
1612
1612
|
else if (e === "circular")
|
|
@@ -1627,11 +1627,11 @@ function Fo({
|
|
|
1627
1627
|
simplifyTolerance: T * 0.25,
|
|
1628
1628
|
smoothingPasses: X.edgeSmoothing
|
|
1629
1629
|
}), it = [];
|
|
1630
|
-
for (const
|
|
1631
|
-
const Y = yt(
|
|
1630
|
+
for (const Z of L) {
|
|
1631
|
+
const Y = yt(Z);
|
|
1632
1632
|
Y && it.push(Y);
|
|
1633
1633
|
}
|
|
1634
|
-
h =
|
|
1634
|
+
h = zt(it);
|
|
1635
1635
|
}
|
|
1636
1636
|
(e === "freehand" || e === "rectangle" || e === "circular" || e === "brush") && lr(h) && l && l({
|
|
1637
1637
|
tool: e,
|
|
@@ -1640,7 +1640,7 @@ function Fo({
|
|
|
1640
1640
|
bbox: ur(h),
|
|
1641
1641
|
areaPx: rn(h)
|
|
1642
1642
|
}), Mt(!0), z();
|
|
1643
|
-
}, [e, l, Mt, z, H, yt, Et, X.radius, X.edgeDetail, X.edgeSmoothing, X.clickSelectRoi, c]),
|
|
1643
|
+
}, [e, l, Mt, z, H, yt, Et, X.radius, X.edgeDetail, X.edgeSmoothing, X.clickSelectRoi, c]), te = I(
|
|
1644
1644
|
(u, h) => {
|
|
1645
1645
|
const y = Ot(u, h);
|
|
1646
1646
|
if (!lr(y)) return;
|
|
@@ -1654,7 +1654,7 @@ function Fo({
|
|
|
1654
1654
|
l?.(T), M === "patch" && f && f(T);
|
|
1655
1655
|
},
|
|
1656
1656
|
[Ot, l, f]
|
|
1657
|
-
),
|
|
1657
|
+
), we = I(
|
|
1658
1658
|
(u, h, y) => {
|
|
1659
1659
|
const M = ir * ir, T = u.screenPoints[u.screenPoints.length - 1];
|
|
1660
1660
|
if (!T) {
|
|
@@ -1667,14 +1667,14 @@ function Fo({
|
|
|
1667
1667
|
[]
|
|
1668
1668
|
), Ue = I(
|
|
1669
1669
|
(u) => {
|
|
1670
|
-
if (!
|
|
1670
|
+
if (!st || e === "cursor" || u.button !== 0) return;
|
|
1671
1671
|
const h = at(u);
|
|
1672
1672
|
if (!h) return;
|
|
1673
|
-
const y =
|
|
1673
|
+
const y = gt(u);
|
|
1674
1674
|
if (!y) return;
|
|
1675
1675
|
if (u.preventDefault(), u.stopPropagation(), Ve(e)) {
|
|
1676
1676
|
const D = Tt.current;
|
|
1677
|
-
D.stampCenter = h,
|
|
1677
|
+
D.stampCenter = h, te(e, h), z();
|
|
1678
1678
|
return;
|
|
1679
1679
|
}
|
|
1680
1680
|
const M = tt.current;
|
|
@@ -1682,13 +1682,13 @@ function Fo({
|
|
|
1682
1682
|
const T = Tt.current;
|
|
1683
1683
|
T.isDrawing = !0, T.pointerId = u.pointerId, T.start = h, T.current = h, T.cursor = h, T.cursorScreen = y, T.points = e === "freehand" || e === "brush" ? [h] : [], T.screenPoints = e === "brush" ? [y] : [], z();
|
|
1684
1684
|
},
|
|
1685
|
-
[
|
|
1686
|
-
),
|
|
1685
|
+
[st, e, at, gt, te, z]
|
|
1686
|
+
), fe = I(
|
|
1687
1687
|
(u) => {
|
|
1688
|
-
if (!
|
|
1688
|
+
if (!st || e === "cursor") return;
|
|
1689
1689
|
const h = at(u);
|
|
1690
1690
|
if (!h) return;
|
|
1691
|
-
const y =
|
|
1691
|
+
const y = gt(u);
|
|
1692
1692
|
if (!y) return;
|
|
1693
1693
|
const M = Tt.current;
|
|
1694
1694
|
if (M.cursor = h, M.cursorScreen = y, Ve(e)) {
|
|
@@ -1700,16 +1700,16 @@ function Fo({
|
|
|
1700
1700
|
z();
|
|
1701
1701
|
return;
|
|
1702
1702
|
}
|
|
1703
|
-
u.preventDefault(), u.stopPropagation(),
|
|
1703
|
+
u.preventDefault(), u.stopPropagation(), we(M, h, y), z();
|
|
1704
1704
|
return;
|
|
1705
1705
|
}
|
|
1706
1706
|
if (!(!M.isDrawing || M.pointerId !== u.pointerId)) {
|
|
1707
1707
|
if (u.preventDefault(), u.stopPropagation(), e === "freehand") {
|
|
1708
|
-
const T = a.current, D = Math.max(1e-6, T?.getViewState?.().zoom ?? 1), L = Xi / D, it = L * L,
|
|
1709
|
-
if (!
|
|
1708
|
+
const T = a.current, D = Math.max(1e-6, T?.getViewState?.().zoom ?? 1), L = Xi / D, it = L * L, Z = M.points[M.points.length - 1];
|
|
1709
|
+
if (!Z)
|
|
1710
1710
|
M.points.push(h);
|
|
1711
1711
|
else {
|
|
1712
|
-
const Y = h[0] -
|
|
1712
|
+
const Y = h[0] - Z[0], ht = h[1] - Z[1];
|
|
1713
1713
|
Y * Y + ht * ht >= it && M.points.push(h);
|
|
1714
1714
|
}
|
|
1715
1715
|
} else
|
|
@@ -1717,23 +1717,23 @@ function Fo({
|
|
|
1717
1717
|
z();
|
|
1718
1718
|
}
|
|
1719
1719
|
},
|
|
1720
|
-
[
|
|
1720
|
+
[st, e, at, gt, z, a, we]
|
|
1721
1721
|
), At = I(
|
|
1722
1722
|
(u) => {
|
|
1723
1723
|
const h = Tt.current;
|
|
1724
1724
|
if (!h.isDrawing || h.pointerId !== u.pointerId) return;
|
|
1725
1725
|
u.preventDefault(), u.stopPropagation();
|
|
1726
|
-
const y = at(u), M =
|
|
1727
|
-
y && (h.cursor = y, M && (h.cursorScreen = M), e === "brush" ? M &&
|
|
1726
|
+
const y = at(u), M = gt(u);
|
|
1727
|
+
y && (h.cursor = y, M && (h.cursorScreen = M), e === "brush" ? M && we(h, y, M) : h.current = y);
|
|
1728
1728
|
const T = tt.current;
|
|
1729
1729
|
if (T && T.hasPointerCapture(u.pointerId))
|
|
1730
1730
|
try {
|
|
1731
1731
|
T.releasePointerCapture(u.pointerId);
|
|
1732
1732
|
} catch {
|
|
1733
1733
|
}
|
|
1734
|
-
|
|
1734
|
+
Re();
|
|
1735
1735
|
},
|
|
1736
|
-
[
|
|
1736
|
+
[Re, at, gt, e, we]
|
|
1737
1737
|
), Be = I(() => {
|
|
1738
1738
|
const u = Tt.current;
|
|
1739
1739
|
let h = !1;
|
|
@@ -1750,40 +1750,40 @@ function Fo({
|
|
|
1750
1750
|
h.disconnect();
|
|
1751
1751
|
};
|
|
1752
1752
|
}, [ft, z]), O(() => {
|
|
1753
|
-
|
|
1754
|
-
}, [
|
|
1755
|
-
|
|
1753
|
+
st || Mt(), z();
|
|
1754
|
+
}, [st, z, Mt]), O(() => {
|
|
1755
|
+
be.current !== e && (be.current = e, Mt(), z());
|
|
1756
1756
|
}, [e, Mt, z]), O(() => {
|
|
1757
1757
|
z();
|
|
1758
|
-
}, [d,
|
|
1758
|
+
}, [d, R, K, z]), O(() => {
|
|
1759
1759
|
if (Wt)
|
|
1760
1760
|
return Wt.current = z, () => {
|
|
1761
1761
|
Wt.current === z && (Wt.current = null);
|
|
1762
1762
|
};
|
|
1763
1763
|
}, [Wt, z]), O(() => {
|
|
1764
|
-
if (!
|
|
1764
|
+
if (!st) return;
|
|
1765
1765
|
const u = (h) => {
|
|
1766
1766
|
h.key === "Escape" && (Mt(), z());
|
|
1767
1767
|
};
|
|
1768
1768
|
return window.addEventListener("keydown", u), () => {
|
|
1769
1769
|
window.removeEventListener("keydown", u);
|
|
1770
1770
|
};
|
|
1771
|
-
}, [
|
|
1771
|
+
}, [st, Mt, z]), /* @__PURE__ */ jt(
|
|
1772
1772
|
"canvas",
|
|
1773
1773
|
{
|
|
1774
1774
|
ref: tt,
|
|
1775
|
-
className:
|
|
1776
|
-
style:
|
|
1775
|
+
className: ue,
|
|
1776
|
+
style: mt,
|
|
1777
1777
|
onPointerDown: Ue,
|
|
1778
|
-
onPointerMove:
|
|
1778
|
+
onPointerMove: fe,
|
|
1779
1779
|
onPointerUp: At,
|
|
1780
1780
|
onPointerCancel: At,
|
|
1781
1781
|
onPointerLeave: Be,
|
|
1782
1782
|
onContextMenu: (u) => {
|
|
1783
|
-
|
|
1783
|
+
st && u.preventDefault();
|
|
1784
1784
|
},
|
|
1785
1785
|
onWheel: (u) => {
|
|
1786
|
-
if (!
|
|
1786
|
+
if (!st) return;
|
|
1787
1787
|
const h = tt.current, y = a.current;
|
|
1788
1788
|
if (!h || typeof y?.zoomBy != "function") return;
|
|
1789
1789
|
u.preventDefault(), u.stopPropagation();
|
|
@@ -1873,7 +1873,7 @@ function pr(e, t, n, r) {
|
|
|
1873
1873
|
e.setLineDash([]), e.lineDashOffset = 0;
|
|
1874
1874
|
}
|
|
1875
1875
|
}
|
|
1876
|
-
function
|
|
1876
|
+
function Ee(e, t, n = 1) {
|
|
1877
1877
|
return typeof e != "number" || !Number.isFinite(e) ? t : Math.max(n, e);
|
|
1878
1878
|
}
|
|
1879
1879
|
function He(e) {
|
|
@@ -1910,16 +1910,16 @@ function Lo({
|
|
|
1910
1910
|
const a = nt(null), c = nt(null), l = nt(null), f = nt({
|
|
1911
1911
|
active: !1,
|
|
1912
1912
|
pointerId: null
|
|
1913
|
-
}), p = nt(null), d = nt(!1), b =
|
|
1913
|
+
}), p = nt(null), d = nt(!1), b = Ee(
|
|
1914
1914
|
r?.width,
|
|
1915
1915
|
_t.width,
|
|
1916
1916
|
64
|
|
1917
|
-
), m =
|
|
1917
|
+
), m = Ee(
|
|
1918
1918
|
r?.height,
|
|
1919
1919
|
_t.height,
|
|
1920
1920
|
48
|
|
1921
1921
|
), S = j(() => {
|
|
1922
|
-
const
|
|
1922
|
+
const R = Math.max(1, e.width), E = Math.max(1, e.height), U = R / E, et = b / m;
|
|
1923
1923
|
let W, ut;
|
|
1924
1924
|
return U > et ? (W = b, ut = b / U) : (ut = m, W = m * U), {
|
|
1925
1925
|
x: (b - W) / 2,
|
|
@@ -1927,32 +1927,32 @@ function Lo({
|
|
|
1927
1927
|
w: W,
|
|
1928
1928
|
h: ut
|
|
1929
1929
|
};
|
|
1930
|
-
}, [e.width, e.height, b, m]), x =
|
|
1930
|
+
}, [e.width, e.height, b, m]), x = Ee(
|
|
1931
1931
|
r?.margin,
|
|
1932
1932
|
_t.margin,
|
|
1933
1933
|
0
|
|
1934
|
-
), _ =
|
|
1934
|
+
), _ = Ee(
|
|
1935
1935
|
r?.borderRadius,
|
|
1936
1936
|
_t.borderRadius,
|
|
1937
1937
|
0
|
|
1938
|
-
), B =
|
|
1938
|
+
), B = Ee(
|
|
1939
1939
|
r?.borderWidth,
|
|
1940
1940
|
_t.borderWidth,
|
|
1941
1941
|
0
|
|
1942
1942
|
), N = Math.max(
|
|
1943
1943
|
1,
|
|
1944
1944
|
Math.round(
|
|
1945
|
-
|
|
1945
|
+
Ee(
|
|
1946
1946
|
r?.maxThumbnailTiles,
|
|
1947
1947
|
_t.maxThumbnailTiles,
|
|
1948
1948
|
1
|
|
1949
1949
|
)
|
|
1950
1950
|
)
|
|
1951
|
-
),
|
|
1952
|
-
const
|
|
1953
|
-
return Ft === "top-left" || Ft === "bottom-left" ?
|
|
1951
|
+
), V = r?.backgroundColor || _t.backgroundColor, F = r?.borderColor || _t.borderColor, k = r?.viewportBorderColor || _t.viewportBorderColor, K = r?.viewportBorderStyle === "stroke" || r?.viewportBorderStyle === "dash" ? r.viewportBorderStyle : _t.viewportBorderStyle, dt = r?.viewportFillColor ?? _t.viewportFillColor, bt = r?.interactive ?? _t.interactive, Pt = r?.showThumbnail ?? _t.showThumbnail, Ft = r?.position || _t.position, Bt = r?.onClose, ot = r?.closeIcon, Wt = r?.closeButtonStyle, ue = j(() => {
|
|
1952
|
+
const R = {};
|
|
1953
|
+
return Ft === "top-left" || Ft === "bottom-left" ? R.left = x : R.right = x, Ft === "top-left" || Ft === "top-right" ? R.top = x : R.bottom = x, {
|
|
1954
1954
|
position: "absolute",
|
|
1955
|
-
...
|
|
1955
|
+
...R,
|
|
1956
1956
|
width: b,
|
|
1957
1957
|
height: m,
|
|
1958
1958
|
borderRadius: _,
|
|
@@ -1963,52 +1963,47 @@ function Lo({
|
|
|
1963
1963
|
boxShadow: "0 10px 22px rgba(0, 0, 0, 0.3)",
|
|
1964
1964
|
...s
|
|
1965
1965
|
};
|
|
1966
|
-
}, [x, Ft, b, m, _, bt, s]),
|
|
1967
|
-
const
|
|
1966
|
+
}, [x, Ft, b, m, _, bt, s]), le = I(() => {
|
|
1967
|
+
const R = a.current;
|
|
1968
|
+
if (!R) return;
|
|
1969
|
+
const E = R.getContext("2d");
|
|
1968
1970
|
if (!E) return;
|
|
1969
|
-
const P = E.getContext("2d");
|
|
1970
|
-
if (!P) return;
|
|
1971
1971
|
const U = b, et = m, W = Math.max(1, window.devicePixelRatio || 1), ut = Math.max(1, Math.round(U * W)), wt = Math.max(1, Math.round(et * W));
|
|
1972
|
-
(
|
|
1973
|
-
const { x:
|
|
1974
|
-
Q &&
|
|
1972
|
+
(R.width !== ut || R.height !== wt) && (R.width = ut, R.height = wt), E.setTransform(1, 0, 0, 1, 0, 0), E.clearRect(0, 0, R.width, R.height), E.setTransform(W, 0, 0, W, 0, 0), E.fillStyle = V, E.fillRect(0, 0, U, et);
|
|
1973
|
+
const { x: J, y: G, w: rt, h: lt } = S, Q = c.current;
|
|
1974
|
+
Q && E.drawImage(Q, J, G, rt, lt), E.strokeStyle = F, E.lineWidth = B, E.strokeRect(
|
|
1975
1975
|
B * 0.5,
|
|
1976
1976
|
B * 0.5,
|
|
1977
1977
|
U - B,
|
|
1978
1978
|
et - B
|
|
1979
1979
|
);
|
|
1980
|
-
const X = t.current,
|
|
1980
|
+
const X = t.current, mt = X?.getViewBounds?.(), ft = X?.getViewCorners?.(), H = He(mt) ? mt : He(l.current) ? l.current : null;
|
|
1981
1981
|
if (!H) return;
|
|
1982
1982
|
l.current = H;
|
|
1983
|
-
const yt = rt / Math.max(1, e.width), Et = lt / Math.max(1, e.height),
|
|
1983
|
+
const yt = rt / Math.max(1, e.width), Et = lt / Math.max(1, e.height), Dt = Array.isArray(ft) && ft.length >= 4 && ft.every(
|
|
1984
1984
|
(at) => Array.isArray(at) && at.length >= 2 && Number.isFinite(at[0]) && Number.isFinite(at[1])
|
|
1985
|
-
) ? ft : null, Ot =
|
|
1986
|
-
if (
|
|
1987
|
-
const at =
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
}
|
|
1995
|
-
P.beginPath();
|
|
1996
|
-
for (let dt = 0; dt < at.length; dt += 1)
|
|
1997
|
-
dt === 0 ? P.moveTo(at[dt][0], at[dt][1]) : P.lineTo(at[dt][0], at[dt][1]);
|
|
1998
|
-
P.closePath(), P.fillStyle = mt, P.fill(), P.strokeStyle = k, P.lineWidth = 2.25, Ot ? pr(P, at, 4, 3) : P.stroke();
|
|
1985
|
+
) ? ft : null, Ot = K === "dash";
|
|
1986
|
+
if (Dt) {
|
|
1987
|
+
const at = Dt.map(
|
|
1988
|
+
(gt) => [J + gt[0] * yt, G + gt[1] * Et]
|
|
1989
|
+
);
|
|
1990
|
+
E.save(), E.beginPath(), E.rect(J, G, rt, lt), E.clip(), E.beginPath();
|
|
1991
|
+
for (let gt = 0; gt < at.length; gt += 1)
|
|
1992
|
+
gt === 0 ? E.moveTo(at[gt][0], at[gt][1]) : E.lineTo(at[gt][0], at[gt][1]);
|
|
1993
|
+
E.closePath(), E.fillStyle = dt, E.fill(), E.strokeStyle = k, E.lineWidth = 2.25, Ot ? pr(E, at, 4, 3) : E.stroke(), E.restore();
|
|
1999
1994
|
return;
|
|
2000
1995
|
}
|
|
2001
|
-
const Ct =
|
|
2002
|
-
if (
|
|
1996
|
+
const Ct = ct(J + H[0] * yt, J, J + rt), St = ct(G + H[1] * Et, G, G + lt), $ = ct(J + H[2] * yt, J, J + rt), Zt = ct(G + H[3] * Et, G, G + lt), z = Math.max(1, $ - Ct), Mt = Math.max(1, Zt - St);
|
|
1997
|
+
if (E.fillStyle = dt, E.fillRect(Ct, St, z, Mt), E.strokeStyle = k, E.lineWidth = 2.25, Ot) {
|
|
2003
1998
|
const at = [
|
|
2004
1999
|
[Ct + 0.5, St + 0.5],
|
|
2005
2000
|
[Ct + 0.5 + Math.max(1, z - 1), St + 0.5],
|
|
2006
2001
|
[Ct + 0.5 + Math.max(1, z - 1), St + 0.5 + Math.max(1, Mt - 1)],
|
|
2007
2002
|
[Ct + 0.5, St + 0.5 + Math.max(1, Mt - 1)]
|
|
2008
2003
|
];
|
|
2009
|
-
pr(
|
|
2004
|
+
pr(E, at, 4, 3);
|
|
2010
2005
|
} else
|
|
2011
|
-
|
|
2006
|
+
E.strokeRect(
|
|
2012
2007
|
Ct + 0.5,
|
|
2013
2008
|
St + 0.5,
|
|
2014
2009
|
Math.max(1, z - 1),
|
|
@@ -2018,71 +2013,71 @@ function Lo({
|
|
|
2018
2013
|
b,
|
|
2019
2014
|
m,
|
|
2020
2015
|
S,
|
|
2021
|
-
|
|
2016
|
+
V,
|
|
2022
2017
|
F,
|
|
2023
2018
|
B,
|
|
2024
2019
|
t,
|
|
2025
2020
|
e.width,
|
|
2026
2021
|
e.height,
|
|
2027
|
-
|
|
2022
|
+
dt,
|
|
2028
2023
|
k,
|
|
2029
|
-
|
|
2024
|
+
K
|
|
2030
2025
|
]), tt = I(() => {
|
|
2031
2026
|
d.current || (d.current = !0, p.current = requestAnimationFrame(() => {
|
|
2032
|
-
d.current = !1, p.current = null,
|
|
2027
|
+
d.current = !1, p.current = null, le();
|
|
2033
2028
|
}));
|
|
2034
|
-
}, [
|
|
2035
|
-
(
|
|
2029
|
+
}, [le]), Vt = I(
|
|
2030
|
+
(R, E) => {
|
|
2036
2031
|
const U = a.current;
|
|
2037
2032
|
if (!U) return null;
|
|
2038
2033
|
const et = U.getBoundingClientRect();
|
|
2039
2034
|
if (!et.width || !et.height) return null;
|
|
2040
|
-
const W = et.width / b, ut = et.height / m, wt = S.x * W,
|
|
2035
|
+
const W = et.width / b, ut = et.height / m, wt = S.x * W, J = S.y * ut, G = S.w * W, rt = S.h * ut, lt = ct((R - et.left - wt) / G, 0, 1), Q = ct((E - et.top - J) / rt, 0, 1);
|
|
2041
2036
|
return [lt * e.width, Q * e.height];
|
|
2042
2037
|
},
|
|
2043
2038
|
[e.width, e.height, b, m, S]
|
|
2044
2039
|
), $t = I(
|
|
2045
|
-
(
|
|
2040
|
+
(R, E) => {
|
|
2046
2041
|
const U = t.current;
|
|
2047
2042
|
if (!U) return;
|
|
2048
2043
|
if (U.setViewCenter) {
|
|
2049
|
-
U.setViewCenter(
|
|
2044
|
+
U.setViewCenter(R, E), tt();
|
|
2050
2045
|
return;
|
|
2051
2046
|
}
|
|
2052
2047
|
const et = U.getViewBounds?.(), W = He(et) ? et : He(l.current) ? l.current : null;
|
|
2053
2048
|
if (!W) return;
|
|
2054
2049
|
const ut = Math.max(1e-6, W[2] - W[0]), wt = Math.max(1e-6, W[3] - W[1]);
|
|
2055
2050
|
U.setViewState({
|
|
2056
|
-
offsetX:
|
|
2057
|
-
offsetY:
|
|
2051
|
+
offsetX: R - ut * 0.5,
|
|
2052
|
+
offsetY: E - wt * 0.5
|
|
2058
2053
|
}), tt();
|
|
2059
2054
|
},
|
|
2060
2055
|
[t, tt]
|
|
2061
|
-
),
|
|
2062
|
-
(
|
|
2063
|
-
if (!bt ||
|
|
2064
|
-
const
|
|
2065
|
-
if (!
|
|
2066
|
-
const U = Vt(
|
|
2067
|
-
U && (
|
|
2056
|
+
), be = I(
|
|
2057
|
+
(R) => {
|
|
2058
|
+
if (!bt || R.button !== 0) return;
|
|
2059
|
+
const E = a.current;
|
|
2060
|
+
if (!E) return;
|
|
2061
|
+
const U = Vt(R.clientX, R.clientY);
|
|
2062
|
+
U && (R.preventDefault(), R.stopPropagation(), E.setPointerCapture(R.pointerId), f.current = { active: !0, pointerId: R.pointerId }, $t(U[0], U[1]));
|
|
2068
2063
|
},
|
|
2069
2064
|
[bt, Vt, $t]
|
|
2070
2065
|
), Tt = I(
|
|
2071
|
-
(
|
|
2072
|
-
const
|
|
2073
|
-
if (!
|
|
2074
|
-
const U = Vt(
|
|
2075
|
-
U && (
|
|
2066
|
+
(R) => {
|
|
2067
|
+
const E = f.current;
|
|
2068
|
+
if (!E.active || E.pointerId !== R.pointerId) return;
|
|
2069
|
+
const U = Vt(R.clientX, R.clientY);
|
|
2070
|
+
U && (R.preventDefault(), R.stopPropagation(), $t(U[0], U[1]));
|
|
2076
2071
|
},
|
|
2077
2072
|
[Vt, $t]
|
|
2078
|
-
),
|
|
2079
|
-
(
|
|
2080
|
-
const
|
|
2081
|
-
if (!
|
|
2073
|
+
), st = I(
|
|
2074
|
+
(R) => {
|
|
2075
|
+
const E = f.current;
|
|
2076
|
+
if (!E.active || E.pointerId !== R.pointerId) return;
|
|
2082
2077
|
const U = a.current;
|
|
2083
|
-
if (U && U.hasPointerCapture(
|
|
2078
|
+
if (U && U.hasPointerCapture(R.pointerId))
|
|
2084
2079
|
try {
|
|
2085
|
-
U.releasePointerCapture(
|
|
2080
|
+
U.releasePointerCapture(R.pointerId);
|
|
2086
2081
|
} catch {
|
|
2087
2082
|
}
|
|
2088
2083
|
f.current = { active: !1, pointerId: null }, tt();
|
|
@@ -2090,60 +2085,60 @@ function Lo({
|
|
|
2090
2085
|
[tt]
|
|
2091
2086
|
);
|
|
2092
2087
|
return O(() => {
|
|
2093
|
-
let
|
|
2088
|
+
let R = !1;
|
|
2094
2089
|
c.current = null, tt();
|
|
2095
|
-
const
|
|
2096
|
-
if (!Pt ||
|
|
2090
|
+
const E = 0, U = 2 ** (e.maxTierZoom - E), et = Math.ceil(e.width / U), W = Math.ceil(e.height / U), ut = Math.max(1, Math.ceil(et / e.tileSize)), wt = Math.max(1, Math.ceil(W / e.tileSize)), J = ut * wt;
|
|
2091
|
+
if (!Pt || J > N)
|
|
2097
2092
|
return;
|
|
2098
|
-
const
|
|
2099
|
-
|
|
2100
|
-
const rt =
|
|
2093
|
+
const G = document.createElement("canvas");
|
|
2094
|
+
G.width = Math.max(1, Math.round(S.w)), G.height = Math.max(1, Math.round(S.h));
|
|
2095
|
+
const rt = G.getContext("2d");
|
|
2101
2096
|
if (!rt)
|
|
2102
2097
|
return;
|
|
2103
|
-
rt.fillStyle =
|
|
2098
|
+
rt.fillStyle = V, rt.fillRect(0, 0, G.width, G.height);
|
|
2104
2099
|
const lt = [];
|
|
2105
2100
|
for (let Q = 0; Q < wt; Q += 1)
|
|
2106
2101
|
for (let X = 0; X < ut; X += 1) {
|
|
2107
|
-
const
|
|
2102
|
+
const mt = X * e.tileSize * U, ft = Q * e.tileSize * U, H = Math.min((X + 1) * e.tileSize, et) * U, yt = Math.min((Q + 1) * e.tileSize, W) * U;
|
|
2108
2103
|
lt.push({
|
|
2109
|
-
url: Yr(e,
|
|
2110
|
-
bounds: [
|
|
2104
|
+
url: Yr(e, E, X, Q),
|
|
2105
|
+
bounds: [mt, ft, H, yt]
|
|
2111
2106
|
});
|
|
2112
2107
|
}
|
|
2113
2108
|
return Promise.allSettled(
|
|
2114
2109
|
lt.map(async (Q) => {
|
|
2115
|
-
const X = !!n,
|
|
2110
|
+
const X = !!n, mt = await fetch(Q.url, {
|
|
2116
2111
|
headers: X ? { Authorization: n } : void 0
|
|
2117
2112
|
});
|
|
2118
|
-
if (!
|
|
2119
|
-
throw new Error(`HTTP ${
|
|
2120
|
-
const ft = await createImageBitmap(await
|
|
2113
|
+
if (!mt.ok)
|
|
2114
|
+
throw new Error(`HTTP ${mt.status}`);
|
|
2115
|
+
const ft = await createImageBitmap(await mt.blob());
|
|
2121
2116
|
return { tile: Q, bitmap: ft };
|
|
2122
2117
|
})
|
|
2123
2118
|
).then((Q) => {
|
|
2124
|
-
if (
|
|
2119
|
+
if (R) {
|
|
2125
2120
|
for (const ft of Q)
|
|
2126
2121
|
ft.status === "fulfilled" && ft.value.bitmap.close();
|
|
2127
2122
|
return;
|
|
2128
2123
|
}
|
|
2129
|
-
const X =
|
|
2124
|
+
const X = G.width / Math.max(1, e.width), mt = G.height / Math.max(1, e.height);
|
|
2130
2125
|
for (const ft of Q) {
|
|
2131
2126
|
if (ft.status !== "fulfilled") continue;
|
|
2132
2127
|
const {
|
|
2133
2128
|
tile: { bounds: H },
|
|
2134
2129
|
bitmap: yt
|
|
2135
|
-
} = ft.value, Et = H[0] * X,
|
|
2136
|
-
rt.drawImage(yt, Et,
|
|
2130
|
+
} = ft.value, Et = H[0] * X, Dt = H[1] * mt, Ot = Math.max(1, (H[2] - H[0]) * X), Ct = Math.max(1, (H[3] - H[1]) * mt);
|
|
2131
|
+
rt.drawImage(yt, Et, Dt, Ot, Ct), yt.close();
|
|
2137
2132
|
}
|
|
2138
|
-
c.current =
|
|
2133
|
+
c.current = G, tt();
|
|
2139
2134
|
}), () => {
|
|
2140
|
-
|
|
2135
|
+
R = !0;
|
|
2141
2136
|
};
|
|
2142
2137
|
}, [
|
|
2143
2138
|
e,
|
|
2144
2139
|
n,
|
|
2145
2140
|
S,
|
|
2146
|
-
|
|
2141
|
+
V,
|
|
2147
2142
|
Pt,
|
|
2148
2143
|
N,
|
|
2149
2144
|
tt
|
|
@@ -2159,7 +2154,7 @@ function Lo({
|
|
|
2159
2154
|
f.current = { active: !1, pointerId: null }, p.current !== null && (cancelAnimationFrame(p.current), p.current = null), d.current = !1;
|
|
2160
2155
|
},
|
|
2161
2156
|
[]
|
|
2162
|
-
), /* @__PURE__ */ Tr("div", { className: o, style:
|
|
2157
|
+
), /* @__PURE__ */ Tr("div", { className: o, style: ue, children: [
|
|
2163
2158
|
/* @__PURE__ */ jt(
|
|
2164
2159
|
"canvas",
|
|
2165
2160
|
{
|
|
@@ -2170,15 +2165,15 @@ function Lo({
|
|
|
2170
2165
|
display: "block",
|
|
2171
2166
|
borderRadius: "inherit"
|
|
2172
2167
|
},
|
|
2173
|
-
onPointerDown:
|
|
2168
|
+
onPointerDown: be,
|
|
2174
2169
|
onPointerMove: Tt,
|
|
2175
|
-
onPointerUp:
|
|
2176
|
-
onPointerCancel:
|
|
2177
|
-
onContextMenu: (
|
|
2178
|
-
|
|
2170
|
+
onPointerUp: st,
|
|
2171
|
+
onPointerCancel: st,
|
|
2172
|
+
onContextMenu: (R) => {
|
|
2173
|
+
R.preventDefault();
|
|
2179
2174
|
},
|
|
2180
|
-
onWheel: (
|
|
2181
|
-
|
|
2175
|
+
onWheel: (R) => {
|
|
2176
|
+
R.preventDefault(), R.stopPropagation();
|
|
2182
2177
|
}
|
|
2183
2178
|
}
|
|
2184
2179
|
),
|
|
@@ -2187,11 +2182,11 @@ function Lo({
|
|
|
2187
2182
|
{
|
|
2188
2183
|
type: "button",
|
|
2189
2184
|
"aria-label": "Hide overview map",
|
|
2190
|
-
onClick: (
|
|
2191
|
-
|
|
2185
|
+
onClick: (R) => {
|
|
2186
|
+
R.stopPropagation(), Bt();
|
|
2192
2187
|
},
|
|
2193
2188
|
style: Wt ? { ...Wt } : { ...Bo },
|
|
2194
|
-
children:
|
|
2189
|
+
children: ot ?? "×"
|
|
2195
2190
|
}
|
|
2196
2191
|
)
|
|
2197
2192
|
] });
|
|
@@ -2446,8 +2441,8 @@ async function Vo(e, t, n) {
|
|
|
2446
2441
|
]
|
|
2447
2442
|
}), _ = r.device.createCommandEncoder(), B = _.beginComputePass();
|
|
2448
2443
|
B.setPipeline(r.pipeline), B.setBindGroup(0, x), B.dispatchWorkgroups(Math.ceil(s / 256)), B.end(), _.copyBufferToBuffer(b, 0, S, 0, l), r.device.queue.submit([_.finish()]), await S.mapAsync(ko);
|
|
2449
|
-
const N = S.getMappedRange(),
|
|
2450
|
-
return S.unmap(), p.destroy(), d.destroy(), b.destroy(), m.destroy(), S.destroy(),
|
|
2444
|
+
const N = S.getMappedRange(), V = new Uint32Array(N.slice(0));
|
|
2445
|
+
return S.unmap(), p.destroy(), d.destroy(), b.destroy(), m.destroy(), S.destroy(), V;
|
|
2451
2446
|
}
|
|
2452
2447
|
function Qt() {
|
|
2453
2448
|
return typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now();
|
|
@@ -2503,8 +2498,8 @@ async function Go(e, t, n = {}) {
|
|
|
2503
2498
|
}
|
|
2504
2499
|
const f = new Float32Array(o.length * 4);
|
|
2505
2500
|
for (let F = 0; F < o.length; F += 1) {
|
|
2506
|
-
const k = F * 4,
|
|
2507
|
-
f[k] =
|
|
2501
|
+
const k = F * 4, K = o[F];
|
|
2502
|
+
f[k] = K.minX, f[k + 1] = K.minY, f[k + 2] = K.maxX, f[k + 3] = K.maxY;
|
|
2508
2503
|
}
|
|
2509
2504
|
let p = null, d = !1;
|
|
2510
2505
|
try {
|
|
@@ -2570,18 +2565,18 @@ async function Go(e, t, n = {}) {
|
|
|
2570
2565
|
if (i) {
|
|
2571
2566
|
const F = new Uint32Array(b);
|
|
2572
2567
|
let k = 0;
|
|
2573
|
-
for (let
|
|
2574
|
-
const bt = m[
|
|
2568
|
+
for (let dt = 0; dt < b; dt += 1) {
|
|
2569
|
+
const bt = m[dt] ?? 0, Pt = e.positions[bt * 2], Ft = e.positions[bt * 2 + 1];
|
|
2575
2570
|
sn(Pt, Ft, o) && (F[k] = bt, k += 1);
|
|
2576
2571
|
}
|
|
2577
|
-
const
|
|
2572
|
+
const K = {
|
|
2578
2573
|
count: a,
|
|
2579
2574
|
positions: e.positions.subarray(0, a * 2),
|
|
2580
2575
|
paletteIndices: e.paletteIndices.subarray(0, a),
|
|
2581
2576
|
drawIndices: F.subarray(0, k)
|
|
2582
2577
|
};
|
|
2583
|
-
return c && (
|
|
2584
|
-
data:
|
|
2578
|
+
return c && (K.fillModes = c.subarray(0, a)), l && (K.ids = l.subarray(0, a)), {
|
|
2579
|
+
data: K,
|
|
2585
2580
|
meta: {
|
|
2586
2581
|
mode: "hybrid-webgpu",
|
|
2587
2582
|
durationMs: Qt() - r,
|
|
@@ -2594,16 +2589,16 @@ async function Go(e, t, n = {}) {
|
|
|
2594
2589
|
const S = new Float32Array(b * 2), x = new Uint16Array(b), _ = c ? new Uint8Array(b) : null, B = l ? new Uint32Array(b) : null;
|
|
2595
2590
|
let N = 0;
|
|
2596
2591
|
for (let F = 0; F < b; F += 1) {
|
|
2597
|
-
const k = m[F] ?? 0,
|
|
2598
|
-
sn(
|
|
2592
|
+
const k = m[F] ?? 0, K = e.positions[k * 2], dt = e.positions[k * 2 + 1];
|
|
2593
|
+
sn(K, dt, o) && (S[N * 2] = K, S[N * 2 + 1] = dt, x[N] = e.paletteIndices[k], _ && (_[N] = c[k]), B && (B[N] = l[k]), N += 1);
|
|
2599
2594
|
}
|
|
2600
|
-
const
|
|
2595
|
+
const V = {
|
|
2601
2596
|
count: N,
|
|
2602
2597
|
positions: S.subarray(0, N * 2),
|
|
2603
2598
|
paletteIndices: x.subarray(0, N)
|
|
2604
2599
|
};
|
|
2605
|
-
return _ && (
|
|
2606
|
-
data:
|
|
2600
|
+
return _ && (V.fillModes = _.subarray(0, N)), B && (V.ids = B.subarray(0, N)), {
|
|
2601
|
+
data: V,
|
|
2607
2602
|
meta: {
|
|
2608
2603
|
mode: "hybrid-webgpu",
|
|
2609
2604
|
durationMs: Qt() - r,
|
|
@@ -2614,8 +2609,8 @@ async function Go(e, t, n = {}) {
|
|
|
2614
2609
|
};
|
|
2615
2610
|
}
|
|
2616
2611
|
let Ut = null, En = !0, Vr = 1;
|
|
2617
|
-
const
|
|
2618
|
-
function
|
|
2612
|
+
const ce = /* @__PURE__ */ new Map();
|
|
2613
|
+
function ae() {
|
|
2619
2614
|
return typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now();
|
|
2620
2615
|
}
|
|
2621
2616
|
function Gr() {
|
|
@@ -2635,9 +2630,9 @@ function Gr() {
|
|
|
2635
2630
|
function Fn(e) {
|
|
2636
2631
|
const t = e.data;
|
|
2637
2632
|
if (!t) return;
|
|
2638
|
-
const n =
|
|
2633
|
+
const n = ce.get(t.id);
|
|
2639
2634
|
if (!n) return;
|
|
2640
|
-
if (
|
|
2635
|
+
if (ce.delete(t.id), t.type === "roi-clip-failure") {
|
|
2641
2636
|
n.reject(new Error(t.error || "worker clip failed"));
|
|
2642
2637
|
return;
|
|
2643
2638
|
}
|
|
@@ -2651,7 +2646,7 @@ function Fn(e) {
|
|
|
2651
2646
|
indices: f,
|
|
2652
2647
|
meta: {
|
|
2653
2648
|
mode: "worker",
|
|
2654
|
-
durationMs: Number.isFinite(t.durationMs) ? t.durationMs :
|
|
2649
|
+
durationMs: Number.isFinite(t.durationMs) ? t.durationMs : ae() - n.startMs
|
|
2655
2650
|
}
|
|
2656
2651
|
});
|
|
2657
2652
|
return;
|
|
@@ -2669,22 +2664,22 @@ function Fn(e) {
|
|
|
2669
2664
|
data: c,
|
|
2670
2665
|
meta: {
|
|
2671
2666
|
mode: "worker",
|
|
2672
|
-
durationMs: Number.isFinite(t.durationMs) ? t.durationMs :
|
|
2667
|
+
durationMs: Number.isFinite(t.durationMs) ? t.durationMs : ae() - n.startMs
|
|
2673
2668
|
}
|
|
2674
2669
|
});
|
|
2675
2670
|
}
|
|
2676
2671
|
function Un() {
|
|
2677
2672
|
En = !1, Ut && (Ut.removeEventListener("message", Fn), Ut.removeEventListener("error", Un), Ut.terminate(), Ut = null);
|
|
2678
|
-
for (const [, e] of
|
|
2673
|
+
for (const [, e] of ce)
|
|
2679
2674
|
e.reject(new Error("worker crashed"));
|
|
2680
|
-
|
|
2675
|
+
ce.clear();
|
|
2681
2676
|
}
|
|
2682
2677
|
function Gs() {
|
|
2683
2678
|
if (Ut) {
|
|
2684
2679
|
Ut.removeEventListener("message", Fn), Ut.removeEventListener("error", Un), Ut.terminate(), Ut = null;
|
|
2685
|
-
for (const [, e] of
|
|
2680
|
+
for (const [, e] of ce)
|
|
2686
2681
|
e.reject(new Error("worker terminated"));
|
|
2687
|
-
|
|
2682
|
+
ce.clear();
|
|
2688
2683
|
}
|
|
2689
2684
|
}
|
|
2690
2685
|
async function Ho(e, t) {
|
|
@@ -2695,15 +2690,15 @@ async function Ho(e, t) {
|
|
|
2695
2690
|
};
|
|
2696
2691
|
const n = Gr();
|
|
2697
2692
|
if (!n) {
|
|
2698
|
-
const p =
|
|
2693
|
+
const p = ae();
|
|
2699
2694
|
return {
|
|
2700
2695
|
data: cn(e, t),
|
|
2701
|
-
meta: { mode: "sync", durationMs:
|
|
2696
|
+
meta: { mode: "sync", durationMs: ae() - p }
|
|
2702
2697
|
};
|
|
2703
2698
|
}
|
|
2704
|
-
const r = e.fillModes instanceof Uint8Array ? e.fillModes.length : Number.MAX_SAFE_INTEGER, i = Math.max(0, Math.min(e.count, Math.floor(e.positions.length / 2), e.paletteIndices.length, r)), o = e.positions.slice(0, i * 2), s = e.paletteIndices.slice(0, i), a = e.fillModes instanceof Uint8Array && e.fillModes.length >= i ? e.fillModes.slice(0, i) : null, c = e.ids instanceof Uint32Array && e.ids.length >= i ? e.ids.slice(0, i) : null, l = Vr++, f =
|
|
2699
|
+
const r = e.fillModes instanceof Uint8Array ? e.fillModes.length : Number.MAX_SAFE_INTEGER, i = Math.max(0, Math.min(e.count, Math.floor(e.positions.length / 2), e.paletteIndices.length, r)), o = e.positions.slice(0, i * 2), s = e.paletteIndices.slice(0, i), a = e.fillModes instanceof Uint8Array && e.fillModes.length >= i ? e.fillModes.slice(0, i) : null, c = e.ids instanceof Uint32Array && e.ids.length >= i ? e.ids.slice(0, i) : null, l = Vr++, f = ae();
|
|
2705
2700
|
return new Promise((p, d) => {
|
|
2706
|
-
|
|
2701
|
+
ce.set(l, { kind: "data", resolve: p, reject: d, startMs: f });
|
|
2707
2702
|
const b = {
|
|
2708
2703
|
type: "roi-clip-request",
|
|
2709
2704
|
id: l,
|
|
@@ -2725,15 +2720,15 @@ async function Hs(e, t) {
|
|
|
2725
2720
|
};
|
|
2726
2721
|
const n = Gr();
|
|
2727
2722
|
if (!n) {
|
|
2728
|
-
const c =
|
|
2723
|
+
const c = ae();
|
|
2729
2724
|
return {
|
|
2730
2725
|
indices: No(e, t),
|
|
2731
|
-
meta: { mode: "sync", durationMs:
|
|
2726
|
+
meta: { mode: "sync", durationMs: ae() - c }
|
|
2732
2727
|
};
|
|
2733
2728
|
}
|
|
2734
|
-
const r = e.fillModes instanceof Uint8Array ? e.fillModes.length : Number.MAX_SAFE_INTEGER, i = Math.max(0, Math.min(e.count, Math.floor(e.positions.length / 2), e.paletteIndices.length, r)), o = e.positions.slice(0, i * 2), s = Vr++, a =
|
|
2729
|
+
const r = e.fillModes instanceof Uint8Array ? e.fillModes.length : Number.MAX_SAFE_INTEGER, i = Math.max(0, Math.min(e.count, Math.floor(e.positions.length / 2), e.paletteIndices.length, r)), o = e.positions.slice(0, i * 2), s = Vr++, a = ae();
|
|
2735
2730
|
return new Promise((c, l) => {
|
|
2736
|
-
|
|
2731
|
+
ce.set(s, { kind: "index", resolve: c, reject: l, startMs: a });
|
|
2737
2732
|
const f = {
|
|
2738
2733
|
type: "roi-clip-index-request",
|
|
2739
2734
|
id: s,
|
|
@@ -2815,13 +2810,13 @@ function Zo(e, t, n = {}) {
|
|
|
2815
2810
|
const b = i ? i[d] : d, m = e.positions[b * 2], S = e.positions[b * 2 + 1];
|
|
2816
2811
|
let x = null;
|
|
2817
2812
|
for (const N of s) {
|
|
2818
|
-
let
|
|
2813
|
+
let V = !1;
|
|
2819
2814
|
for (const F of N.polygons)
|
|
2820
2815
|
if (Ir(m, S, F)) {
|
|
2821
|
-
|
|
2816
|
+
V = !0;
|
|
2822
2817
|
break;
|
|
2823
2818
|
}
|
|
2824
|
-
|
|
2819
|
+
V && (!x || N.area < x.area) && (x = N);
|
|
2825
2820
|
}
|
|
2826
2821
|
if (!x) continue;
|
|
2827
2822
|
l += 1;
|
|
@@ -3154,7 +3149,7 @@ function es(e, t) {
|
|
|
3154
3149
|
for (let s = 1; s < t.length; s += 1) {
|
|
3155
3150
|
const a = t[s - 1], c = t[s];
|
|
3156
3151
|
if (e > c.zoom) continue;
|
|
3157
|
-
const l = Math.max(1e-6, c.zoom - a.zoom), f =
|
|
3152
|
+
const l = Math.max(1e-6, c.zoom - a.zoom), f = ct((e - a.zoom) / l, 0, 1);
|
|
3158
3153
|
return a.size + (c.size - a.size) * f;
|
|
3159
3154
|
}
|
|
3160
3155
|
const n = t[t.length - 1], r = t[t.length - 2], i = Math.max(1e-6, n.zoom - r.zoom), o = (n.size - r.size) / i;
|
|
@@ -3162,11 +3157,11 @@ function es(e, t) {
|
|
|
3162
3157
|
}
|
|
3163
3158
|
const ns = 0.1, rs = 5;
|
|
3164
3159
|
function yr(e) {
|
|
3165
|
-
return typeof e != "number" || !Number.isFinite(e) ? 1 :
|
|
3160
|
+
return typeof e != "number" || !Number.isFinite(e) ? 1 : ct(e, ns, rs);
|
|
3166
3161
|
}
|
|
3167
3162
|
const is = -100, os = 100;
|
|
3168
3163
|
function bn(e) {
|
|
3169
|
-
return typeof e != "number" || !Number.isFinite(e) ? 0 :
|
|
3164
|
+
return typeof e != "number" || !Number.isFinite(e) ? 0 : ct(e, is, os);
|
|
3170
3165
|
}
|
|
3171
3166
|
function Sr(e) {
|
|
3172
3167
|
const t = bn(e?.brightness), n = bn(e?.contrast), r = bn(e?.saturation);
|
|
@@ -3181,7 +3176,7 @@ function Hr(e) {
|
|
|
3181
3176
|
return e;
|
|
3182
3177
|
}
|
|
3183
3178
|
function wn(e) {
|
|
3184
|
-
return typeof e != "number" || !Number.isFinite(e) ? 0 :
|
|
3179
|
+
return typeof e != "number" || !Number.isFinite(e) ? 0 : ct(e, 0, ss);
|
|
3185
3180
|
}
|
|
3186
3181
|
function tn(e) {
|
|
3187
3182
|
return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? null : Math.max(1e-6, e);
|
|
@@ -3293,7 +3288,7 @@ class as {
|
|
|
3293
3288
|
}
|
|
3294
3289
|
resolveTargetViewState(t) {
|
|
3295
3290
|
const n = this.camera.getViewState(), r = {
|
|
3296
|
-
zoom: typeof t.zoom == "number" && Number.isFinite(t.zoom) ?
|
|
3291
|
+
zoom: typeof t.zoom == "number" && Number.isFinite(t.zoom) ? ct(t.zoom, this.minZoom, this.maxZoom) : n.zoom,
|
|
3297
3292
|
offsetX: typeof t.offsetX == "number" && Number.isFinite(t.offsetX) ? t.offsetX : n.offsetX,
|
|
3298
3293
|
offsetY: typeof t.offsetY == "number" && Number.isFinite(t.offsetY) ? t.offsetY : n.offsetY,
|
|
3299
3294
|
rotationDeg: typeof t.rotationDeg == "number" && Number.isFinite(t.rotationDeg) ? t.rotationDeg : n.rotationDeg
|
|
@@ -3317,14 +3312,14 @@ class as {
|
|
|
3317
3312
|
const o = () => {
|
|
3318
3313
|
const s = this.viewAnimation;
|
|
3319
3314
|
if (!s) return;
|
|
3320
|
-
const a = Math.max(0, Qe() - s.startMs), c = s.durationMs <= 0 ? 1 :
|
|
3315
|
+
const a = Math.max(0, Qe() - s.startMs), c = s.durationMs <= 0 ? 1 : ct(a / s.durationMs, 0, 1);
|
|
3321
3316
|
let l = c;
|
|
3322
3317
|
try {
|
|
3323
3318
|
l = s.easing(c);
|
|
3324
3319
|
} catch {
|
|
3325
3320
|
l = c;
|
|
3326
3321
|
}
|
|
3327
|
-
Number.isFinite(l) || (l = c), l =
|
|
3322
|
+
Number.isFinite(l) || (l = c), l = ct(l, 0, 1);
|
|
3328
3323
|
const f = {
|
|
3329
3324
|
zoom: s.from.zoom + (s.to.zoom - s.from.zoom) * l,
|
|
3330
3325
|
offsetX: s.from.offsetX + (s.to.offsetX - s.from.offsetX) * l,
|
|
@@ -3505,12 +3500,12 @@ class as {
|
|
|
3505
3500
|
}
|
|
3506
3501
|
getPointSizeByZoom() {
|
|
3507
3502
|
const t = Math.max(1e-6, this.camera.getViewState().zoom), n = this.source.maxTierZoom + Math.log2(t), r = es(n, this.pointSizeStops);
|
|
3508
|
-
return
|
|
3503
|
+
return ct(r, Rn, Qo);
|
|
3509
3504
|
}
|
|
3510
3505
|
fitToImage(t) {
|
|
3511
3506
|
const n = this.canvas.getBoundingClientRect(), r = Math.max(1, n.width || 1), i = Math.max(1, n.height || 1), o = Math.min(r / this.source.width, i / this.source.height), s = Number.isFinite(o) && o > 0 ? o : 1;
|
|
3512
3507
|
this.fitZoom = s, this.applyZoomBounds();
|
|
3513
|
-
const a =
|
|
3508
|
+
const a = ct(s, this.minZoom, this.maxZoom), c = r / a, l = i / a;
|
|
3514
3509
|
this.setViewState(
|
|
3515
3510
|
{
|
|
3516
3511
|
zoom: a,
|
|
@@ -3522,7 +3517,7 @@ class as {
|
|
|
3522
3517
|
);
|
|
3523
3518
|
}
|
|
3524
3519
|
zoomBy(t, n, r, i) {
|
|
3525
|
-
const o = this.camera.getViewState(), s =
|
|
3520
|
+
const o = this.camera.getViewState(), s = ct(o.zoom * t, this.minZoom, this.maxZoom);
|
|
3526
3521
|
if (s === o.zoom) return;
|
|
3527
3522
|
const [a, c] = this.camera.screenToWorld(n, r), l = this.camera.getViewport(), f = n - l.width * 0.5, p = r - l.height * 0.5, d = ve(o.rotationDeg), b = Math.cos(d), m = Math.sin(d), S = f / s * b - p / s * m, x = f / s * m + p / s * b, _ = a - S, B = c - x;
|
|
3528
3523
|
this.setViewState(
|
|
@@ -3535,7 +3530,7 @@ class as {
|
|
|
3535
3530
|
);
|
|
3536
3531
|
}
|
|
3537
3532
|
clampViewState() {
|
|
3538
|
-
const t = this.getViewBounds(), n = Math.max(1e-6, t[2] - t[0]), r = Math.max(1e-6, t[3] - t[1]), i = n * 0.2, o = r * 0.2, [s, a] = this.camera.getCenter(), c = n * 0.5, l = r * 0.5, f = c - i, p = this.source.width - c + i, d = l - o, b = this.source.height - l + o, m = f <= p ?
|
|
3533
|
+
const t = this.getViewBounds(), n = Math.max(1e-6, t[2] - t[0]), r = Math.max(1e-6, t[3] - t[1]), i = n * 0.2, o = r * 0.2, [s, a] = this.camera.getCenter(), c = n * 0.5, l = r * 0.5, f = c - i, p = this.source.width - c + i, d = l - o, b = this.source.height - l + o, m = f <= p ? ct(s, f, p) : this.source.width * 0.5, S = d <= b ? ct(a, d, b) : this.source.height * 0.5;
|
|
3539
3534
|
this.camera.setCenter(m, S);
|
|
3540
3535
|
}
|
|
3541
3536
|
emitViewState() {
|
|
@@ -3543,7 +3538,7 @@ class as {
|
|
|
3543
3538
|
}
|
|
3544
3539
|
selectTier() {
|
|
3545
3540
|
const t = Math.max(1e-6, this.camera.getViewState().zoom), n = this.source.maxTierZoom + Math.log2(t);
|
|
3546
|
-
return
|
|
3541
|
+
return ct(Math.floor(n), 0, this.source.maxTierZoom);
|
|
3547
3542
|
}
|
|
3548
3543
|
getViewBounds() {
|
|
3549
3544
|
const t = this.camera.getViewCorners();
|
|
@@ -3558,19 +3553,19 @@ class as {
|
|
|
3558
3553
|
getVisibleTiles() {
|
|
3559
3554
|
const t = this.selectTier();
|
|
3560
3555
|
this.currentTier = t;
|
|
3561
|
-
const n = this.getViewBounds(), r = Math.pow(2, this.source.maxTierZoom - t), i = Math.ceil(this.source.width / r), o = Math.ceil(this.source.height / r), s = Math.max(1, Math.ceil(i / this.source.tileSize)), a = Math.max(1, Math.ceil(o / this.source.tileSize)), c = n[0], l = n[1], f = n[2], p = n[3], d =
|
|
3556
|
+
const n = this.getViewBounds(), r = Math.pow(2, this.source.maxTierZoom - t), i = Math.ceil(this.source.width / r), o = Math.ceil(this.source.height / r), s = Math.max(1, Math.ceil(i / this.source.tileSize)), a = Math.max(1, Math.ceil(o / this.source.tileSize)), c = n[0], l = n[1], f = n[2], p = n[3], d = ct(
|
|
3562
3557
|
Math.floor(c / r / this.source.tileSize),
|
|
3563
3558
|
0,
|
|
3564
3559
|
s - 1
|
|
3565
|
-
), b =
|
|
3560
|
+
), b = ct(
|
|
3566
3561
|
Math.floor((f - 1) / r / this.source.tileSize),
|
|
3567
3562
|
0,
|
|
3568
3563
|
s - 1
|
|
3569
|
-
), m =
|
|
3564
|
+
), m = ct(
|
|
3570
3565
|
Math.floor(l / r / this.source.tileSize),
|
|
3571
3566
|
0,
|
|
3572
3567
|
a - 1
|
|
3573
|
-
), S =
|
|
3568
|
+
), S = ct(
|
|
3574
3569
|
Math.floor((p - 1) / r / this.source.tileSize),
|
|
3575
3570
|
0,
|
|
3576
3571
|
a - 1
|
|
@@ -3579,19 +3574,19 @@ class as {
|
|
|
3579
3574
|
return [];
|
|
3580
3575
|
const x = (c + f) * 0.5 / r / this.source.tileSize, _ = (l + p) * 0.5 / r / this.source.tileSize, B = [];
|
|
3581
3576
|
for (let N = m; N <= S; N += 1)
|
|
3582
|
-
for (let
|
|
3583
|
-
const F =
|
|
3577
|
+
for (let V = d; V <= b; V += 1) {
|
|
3578
|
+
const F = V * this.source.tileSize * r, k = N * this.source.tileSize * r, K = Math.min((V + 1) * this.source.tileSize, i) * r, dt = Math.min((N + 1) * this.source.tileSize, o) * r, bt = V - x, Pt = N - _;
|
|
3584
3579
|
B.push({
|
|
3585
|
-
key: `${t}/${
|
|
3580
|
+
key: `${t}/${V}/${N}`,
|
|
3586
3581
|
tier: t,
|
|
3587
|
-
x:
|
|
3582
|
+
x: V,
|
|
3588
3583
|
y: N,
|
|
3589
|
-
bounds: [F, k,
|
|
3584
|
+
bounds: [F, k, K, dt],
|
|
3590
3585
|
distance2: bt * bt + Pt * Pt,
|
|
3591
|
-
url: Yr(this.source, t,
|
|
3586
|
+
url: Yr(this.source, t, V, N)
|
|
3592
3587
|
});
|
|
3593
3588
|
}
|
|
3594
|
-
return B.sort((N,
|
|
3589
|
+
return B.sort((N, V) => N.distance2 - V.distance2), B;
|
|
3595
3590
|
}
|
|
3596
3591
|
trimCache() {
|
|
3597
3592
|
if (this.cache.size <= this.maxCacheTiles) return;
|
|
@@ -3988,11 +3983,11 @@ function xs(e, t) {
|
|
|
3988
3983
|
function In(e, t) {
|
|
3989
3984
|
return e.id ?? t;
|
|
3990
3985
|
}
|
|
3991
|
-
function
|
|
3986
|
+
function pe(e, t, n) {
|
|
3992
3987
|
return Math.max(t, Math.min(n, e));
|
|
3993
3988
|
}
|
|
3994
3989
|
function Ts(e) {
|
|
3995
|
-
const t =
|
|
3990
|
+
const t = pe(e, 0, 1);
|
|
3996
3991
|
return t * t * (3 - 2 * t);
|
|
3997
3992
|
}
|
|
3998
3993
|
function vn(e) {
|
|
@@ -4025,7 +4020,7 @@ function Ps(e, t, n, r, i, o) {
|
|
|
4025
4020
|
const m = e - n, S = t - r;
|
|
4026
4021
|
return m * m + S * S;
|
|
4027
4022
|
}
|
|
4028
|
-
const l =
|
|
4023
|
+
const l = pe(((e - n) * s + (t - r) * a) / c, 0, 1), f = n + s * l, p = r + a * l, d = e - f, b = t - p;
|
|
4029
4024
|
return d * d + b * b;
|
|
4030
4025
|
}
|
|
4031
4026
|
function xr(e, t, n, r) {
|
|
@@ -4067,7 +4062,7 @@ function _s(e, t, n, r, i, o) {
|
|
|
4067
4062
|
if (!e.label || !e.labelAnchor) return !1;
|
|
4068
4063
|
const s = vn(n.worldToScreen(e.labelAnchor[0], e.labelAnchor[1]));
|
|
4069
4064
|
if (!s) return !1;
|
|
4070
|
-
const c = vs(e.label, r) + r.paddingX * 2, l = r.fontSize + r.paddingY * 2, f =
|
|
4065
|
+
const c = vs(e.label, r) + r.paddingX * 2, l = r.fontSize + r.paddingY * 2, f = pe(s[0], c * 0.5 + 1, i - c * 0.5 - 1), p = pe(s[1] - r.offsetY, l * 0.5 + 1, o - l * 0.5 - 1), d = f - c * 0.5, b = f + c * 0.5, m = p - l * 0.5, S = p + l * 0.5;
|
|
4071
4066
|
return t[0] >= d && t[0] <= b && t[1] >= m && t[1] <= S;
|
|
4072
4067
|
}
|
|
4073
4068
|
function Fs(e) {
|
|
@@ -4140,51 +4135,51 @@ function qs({
|
|
|
4140
4135
|
pointStrokeScale: _,
|
|
4141
4136
|
minZoom: B,
|
|
4142
4137
|
maxZoom: N,
|
|
4143
|
-
viewTransition:
|
|
4138
|
+
viewTransition: V,
|
|
4144
4139
|
roiRegions: F,
|
|
4145
4140
|
roiPolygons: k,
|
|
4146
|
-
clipPointsToRois:
|
|
4147
|
-
clipMode:
|
|
4141
|
+
clipPointsToRois: K = !1,
|
|
4142
|
+
clipMode: dt = "worker",
|
|
4148
4143
|
onClipStats: bt,
|
|
4149
4144
|
onRoiPointGroups: Pt,
|
|
4150
4145
|
roiPaletteIndexToTermId: Ft,
|
|
4151
4146
|
interactionLock: Bt = !1,
|
|
4152
|
-
drawTool:
|
|
4147
|
+
drawTool: ot = "cursor",
|
|
4153
4148
|
stampOptions: Wt,
|
|
4154
|
-
brushOptions:
|
|
4155
|
-
drawFillColor:
|
|
4149
|
+
brushOptions: ue,
|
|
4150
|
+
drawFillColor: le,
|
|
4156
4151
|
regionStrokeStyle: tt,
|
|
4157
4152
|
regionStrokeHoverStyle: Vt,
|
|
4158
4153
|
regionStrokeActiveStyle: $t,
|
|
4159
|
-
patchStrokeStyle:
|
|
4154
|
+
patchStrokeStyle: be,
|
|
4160
4155
|
resolveRegionStrokeStyle: Tt,
|
|
4161
|
-
resolveRegionLabelStyle:
|
|
4162
|
-
overlayShapes:
|
|
4163
|
-
customLayers:
|
|
4156
|
+
resolveRegionLabelStyle: st,
|
|
4157
|
+
overlayShapes: R,
|
|
4158
|
+
customLayers: E,
|
|
4164
4159
|
patchRegions: U,
|
|
4165
4160
|
regionLabelStyle: et,
|
|
4166
4161
|
drawAreaTooltip: W,
|
|
4167
4162
|
autoLiftRegionLabelAtMaxZoom: ut = !1,
|
|
4168
4163
|
onPointerWorldMove: wt,
|
|
4169
|
-
onPointHover:
|
|
4170
|
-
onPointClick:
|
|
4164
|
+
onPointHover: J,
|
|
4165
|
+
onPointClick: G,
|
|
4171
4166
|
onRegionHover: rt,
|
|
4172
4167
|
onRegionClick: lt,
|
|
4173
4168
|
activeRegionId: Q,
|
|
4174
4169
|
onActiveRegionChange: X,
|
|
4175
|
-
getCellByCoordinatesRef:
|
|
4170
|
+
getCellByCoordinatesRef: mt,
|
|
4176
4171
|
onDrawComplete: ft,
|
|
4177
4172
|
onPatchComplete: H,
|
|
4178
4173
|
overviewMapConfig: yt,
|
|
4179
4174
|
className: Et,
|
|
4180
|
-
style:
|
|
4175
|
+
style: Dt
|
|
4181
4176
|
}) {
|
|
4182
|
-
const Ot = yt?.show ?? !1, Ct = yt?.options, St = nt(null),
|
|
4177
|
+
const Ot = yt?.show ?? !1, Ct = yt?.options, St = nt(null), $ = nt(null), Zt = nt(null), z = nt(null), Mt = nt(r), at = nt(i), gt = nt(c), [Re, te] = Te(null), [we, Ue] = Te(() => Q ?? null), fe = Q !== void 0, At = fe ? Q ?? null : we, [Be, u] = Te(null), [h, y] = Te(null), [M, T] = Te(0), D = nt(null), L = nt(null), it = nt(null), Z = nt(0), Y = nt({
|
|
4183
4178
|
rafId: null,
|
|
4184
4179
|
startMs: 0,
|
|
4185
4180
|
from: 0,
|
|
4186
4181
|
to: 0
|
|
4187
|
-
}), ht = nt(0), pt = F ?? Sn,
|
|
4182
|
+
}), ht = nt(0), pt = F ?? Sn, Lt = U ?? Sn, Rt = k ?? cs, xt = (E?.length ?? 0) > 0, Gt = j(() => ({ position: "relative", width: "100%", height: "100%", ...Dt }), [Dt]), Kt = j(
|
|
4188
4183
|
() => ({
|
|
4189
4184
|
position: "absolute",
|
|
4190
4185
|
top: 8,
|
|
@@ -4209,47 +4204,47 @@ function qs({
|
|
|
4209
4204
|
), It = j(() => pt.length > 0 ? pt : Rt.length === 0 ? Sn : Rt.map((g, A) => ({
|
|
4210
4205
|
id: A,
|
|
4211
4206
|
coordinates: g
|
|
4212
|
-
})), [pt, Rt]),
|
|
4213
|
-
const A =
|
|
4214
|
-
Math.abs(
|
|
4215
|
-
}, []),
|
|
4207
|
+
})), [pt, Rt]), ee = j(() => Fs(It), [It]), Bn = j(() => _n(et), [et]), ye = I((g) => {
|
|
4208
|
+
const A = pe(g, 0, Ar);
|
|
4209
|
+
Math.abs(Z.current - A) < 1e-4 || (Z.current = A, T(A));
|
|
4210
|
+
}, []), he = I(() => {
|
|
4216
4211
|
const g = Y.current;
|
|
4217
4212
|
g.rafId !== null && (cancelAnimationFrame(g.rafId), g.rafId = null);
|
|
4218
4213
|
}, []), un = I(
|
|
4219
4214
|
(g) => {
|
|
4220
|
-
const A =
|
|
4215
|
+
const A = pe(g, 0, Ar), P = Y.current, C = Z.current;
|
|
4221
4216
|
if (Math.abs(C - A) < 1e-4) {
|
|
4222
|
-
|
|
4217
|
+
he(), P.to = A, ye(A);
|
|
4223
4218
|
return;
|
|
4224
4219
|
}
|
|
4225
|
-
|
|
4220
|
+
he(), P.startMs = performance.now(), P.from = C, P.to = A;
|
|
4226
4221
|
const v = (q) => {
|
|
4227
|
-
const vt = Y.current, Jt = Math.max(0, q - vt.startMs),
|
|
4228
|
-
if (
|
|
4229
|
-
vt.rafId = null,
|
|
4222
|
+
const vt = Y.current, Jt = Math.max(0, q - vt.startMs), xe = pe(Jt / ys, 0, 1), De = Ts(xe), Oe = vt.from + (vt.to - vt.from) * De;
|
|
4223
|
+
if (ye(Oe), Zt.current?.(), xe >= 1) {
|
|
4224
|
+
vt.rafId = null, ye(vt.to);
|
|
4230
4225
|
return;
|
|
4231
4226
|
}
|
|
4232
4227
|
vt.rafId = requestAnimationFrame(v);
|
|
4233
4228
|
};
|
|
4234
|
-
|
|
4229
|
+
P.rafId = requestAnimationFrame(v);
|
|
4235
4230
|
},
|
|
4236
|
-
[
|
|
4237
|
-
),
|
|
4231
|
+
[ye, he]
|
|
4232
|
+
), ne = I(
|
|
4238
4233
|
(g) => {
|
|
4239
|
-
const A =
|
|
4234
|
+
const A = $.current;
|
|
4240
4235
|
if (!A || typeof g != "number" || !Number.isFinite(g)) {
|
|
4241
4236
|
un(0);
|
|
4242
4237
|
return;
|
|
4243
4238
|
}
|
|
4244
|
-
const
|
|
4245
|
-
un(
|
|
4239
|
+
const P = Lr(ut, g, A.getZoomRange());
|
|
4240
|
+
un(P);
|
|
4246
4241
|
},
|
|
4247
4242
|
[ut, un]
|
|
4248
|
-
),
|
|
4243
|
+
), de = j(() => It.map((g) => g.coordinates), [It]), [Se, Le] = Te(m);
|
|
4249
4244
|
O(() => {
|
|
4250
4245
|
const g = ++ht.current;
|
|
4251
4246
|
let A = !1;
|
|
4252
|
-
if (!
|
|
4247
|
+
if (!K)
|
|
4253
4248
|
return Le(m), () => {
|
|
4254
4249
|
A = !0;
|
|
4255
4250
|
};
|
|
@@ -4257,9 +4252,9 @@ function qs({
|
|
|
4257
4252
|
return Le(null), () => {
|
|
4258
4253
|
A = !0;
|
|
4259
4254
|
};
|
|
4260
|
-
if (
|
|
4255
|
+
if (de.length === 0)
|
|
4261
4256
|
return Le(us), bt?.({
|
|
4262
|
-
mode:
|
|
4257
|
+
mode: dt,
|
|
4263
4258
|
durationMs: 0,
|
|
4264
4259
|
inputCount: m.count,
|
|
4265
4260
|
outputCount: 0,
|
|
@@ -4267,7 +4262,7 @@ function qs({
|
|
|
4267
4262
|
}), () => {
|
|
4268
4263
|
A = !0;
|
|
4269
4264
|
};
|
|
4270
|
-
const
|
|
4265
|
+
const P = (v, q) => {
|
|
4271
4266
|
if (A || g !== ht.current) return;
|
|
4272
4267
|
const vt = v?.drawIndices ? v.drawIndices.length : v?.count ?? 0;
|
|
4273
4268
|
Le(v), bt?.({
|
|
@@ -4275,24 +4270,24 @@ function qs({
|
|
|
4275
4270
|
durationMs: q.durationMs,
|
|
4276
4271
|
inputCount: m.count,
|
|
4277
4272
|
outputCount: vt,
|
|
4278
|
-
polygonCount:
|
|
4273
|
+
polygonCount: de.length,
|
|
4279
4274
|
usedWebGpu: q.usedWebGpu,
|
|
4280
4275
|
candidateCount: q.candidateCount,
|
|
4281
4276
|
bridgedToDraw: q.bridgedToDraw
|
|
4282
4277
|
});
|
|
4283
4278
|
};
|
|
4284
4279
|
return (async () => {
|
|
4285
|
-
if (
|
|
4286
|
-
const v = performance.now(), q = cn(m,
|
|
4287
|
-
|
|
4280
|
+
if (dt === "sync") {
|
|
4281
|
+
const v = performance.now(), q = cn(m, de);
|
|
4282
|
+
P(q, {
|
|
4288
4283
|
mode: "sync",
|
|
4289
4284
|
durationMs: performance.now() - v
|
|
4290
4285
|
});
|
|
4291
4286
|
return;
|
|
4292
4287
|
}
|
|
4293
|
-
if (
|
|
4294
|
-
const v = await Go(m,
|
|
4295
|
-
|
|
4288
|
+
if (dt === "hybrid-webgpu") {
|
|
4289
|
+
const v = await Go(m, de, { bridgeToDraw: !0 });
|
|
4290
|
+
P(v.data, {
|
|
4296
4291
|
mode: v.meta.mode,
|
|
4297
4292
|
durationMs: v.meta.durationMs,
|
|
4298
4293
|
usedWebGpu: v.meta.usedWebGpu,
|
|
@@ -4302,14 +4297,14 @@ function qs({
|
|
|
4302
4297
|
return;
|
|
4303
4298
|
}
|
|
4304
4299
|
try {
|
|
4305
|
-
const v = await Ho(m,
|
|
4306
|
-
|
|
4300
|
+
const v = await Ho(m, de);
|
|
4301
|
+
P(v.data, {
|
|
4307
4302
|
mode: v.meta.mode,
|
|
4308
4303
|
durationMs: v.meta.durationMs
|
|
4309
4304
|
});
|
|
4310
4305
|
} catch {
|
|
4311
|
-
const v = performance.now(), q = cn(m,
|
|
4312
|
-
|
|
4306
|
+
const v = performance.now(), q = cn(m, de);
|
|
4307
|
+
P(q, {
|
|
4313
4308
|
mode: "sync",
|
|
4314
4309
|
durationMs: performance.now() - v
|
|
4315
4310
|
});
|
|
@@ -4317,89 +4312,89 @@ function qs({
|
|
|
4317
4312
|
})(), () => {
|
|
4318
4313
|
A = !0;
|
|
4319
4314
|
};
|
|
4320
|
-
}, [
|
|
4321
|
-
const Ln = !!(
|
|
4315
|
+
}, [K, dt, m, de, bt]);
|
|
4316
|
+
const Ln = !!(J || G || mt), Nt = j(() => Ln ? xs(Se, e) : null, [Ln, Se, e]), me = I(
|
|
4322
4317
|
(g) => {
|
|
4323
|
-
const A =
|
|
4324
|
-
if (!A || !
|
|
4325
|
-
const
|
|
4326
|
-
if (!Number.isFinite(
|
|
4318
|
+
const A = $.current;
|
|
4319
|
+
if (!A || !Nt) return null;
|
|
4320
|
+
const P = Number(g[0]), C = Number(g[1]);
|
|
4321
|
+
if (!Number.isFinite(P) || !Number.isFinite(C)) return null;
|
|
4327
4322
|
const v = Math.max(1e-6, A.getViewState().zoom), q = A.getPointSizeByZoom(), Jt = Math.max(fs, q * ls) / v;
|
|
4328
4323
|
if (!Number.isFinite(Jt) || Jt <= 0) return null;
|
|
4329
|
-
const
|
|
4324
|
+
const xe = Nt.cellSize, De = Math.floor(P / xe), Oe = Math.floor(C / xe), Xe = Math.max(1, Math.ceil(Jt / xe)), jr = Jt * Jt;
|
|
4330
4325
|
let Ye = -1, kn = jr, Wn = 0, Vn = 0;
|
|
4331
4326
|
for (let ln = De - Xe; ln <= De + Xe; ln += 1) {
|
|
4332
|
-
const Gn =
|
|
4327
|
+
const Gn = Nt.buckets.get(ln);
|
|
4333
4328
|
if (Gn)
|
|
4334
4329
|
for (let fn = Oe - Xe; fn <= Oe + Xe; fn += 1) {
|
|
4335
4330
|
const ke = Gn.get(fn);
|
|
4336
4331
|
if (!(!ke || ke.length === 0))
|
|
4337
4332
|
for (let hn = 0; hn < ke.length; hn += 1) {
|
|
4338
4333
|
const We = ke[hn];
|
|
4339
|
-
if (We >=
|
|
4340
|
-
const Hn =
|
|
4334
|
+
if (We >= Nt.safeCount) continue;
|
|
4335
|
+
const Hn = Nt.positions[We * 2], qn = Nt.positions[We * 2 + 1], $n = Hn - P, Zn = qn - C, Kn = $n * $n + Zn * Zn;
|
|
4341
4336
|
Kn > kn || (kn = Kn, Ye = We, Wn = Hn, Vn = qn);
|
|
4342
4337
|
}
|
|
4343
4338
|
}
|
|
4344
4339
|
}
|
|
4345
4340
|
if (Ye < 0) return null;
|
|
4346
|
-
const ti =
|
|
4341
|
+
const ti = Nt.ids ? Number(Nt.ids[Ye]) : null;
|
|
4347
4342
|
return {
|
|
4348
4343
|
index: Ye,
|
|
4349
4344
|
id: ti,
|
|
4350
|
-
coordinate: [
|
|
4345
|
+
coordinate: [P, C],
|
|
4351
4346
|
pointCoordinate: [Wn, Vn]
|
|
4352
4347
|
};
|
|
4353
4348
|
},
|
|
4354
|
-
[
|
|
4355
|
-
),
|
|
4349
|
+
[Nt]
|
|
4350
|
+
), Me = I(
|
|
4356
4351
|
(g, A) => {
|
|
4357
|
-
if (
|
|
4358
|
-
const
|
|
4359
|
-
L.current ===
|
|
4360
|
-
index:
|
|
4352
|
+
if (!J) return;
|
|
4353
|
+
const P = g?.index ?? null, C = g?.id ?? null;
|
|
4354
|
+
L.current === P && it.current === C || (L.current = P, it.current = C, J({
|
|
4355
|
+
index: P,
|
|
4361
4356
|
id: C,
|
|
4362
4357
|
coordinate: A,
|
|
4363
4358
|
pointCoordinate: g?.pointCoordinate ?? null
|
|
4364
4359
|
}));
|
|
4365
4360
|
},
|
|
4366
|
-
[
|
|
4361
|
+
[J]
|
|
4367
4362
|
), Ne = I(
|
|
4368
4363
|
(g, A) => {
|
|
4369
|
-
if (!
|
|
4370
|
-
const
|
|
4371
|
-
|
|
4372
|
-
...
|
|
4364
|
+
if (!G) return;
|
|
4365
|
+
const P = me(g);
|
|
4366
|
+
P && G({
|
|
4367
|
+
...P,
|
|
4373
4368
|
button: A
|
|
4374
4369
|
});
|
|
4375
4370
|
},
|
|
4376
|
-
[
|
|
4371
|
+
[G, me]
|
|
4377
4372
|
);
|
|
4378
4373
|
O(() => {
|
|
4379
|
-
if (
|
|
4380
|
-
return
|
|
4381
|
-
|
|
4374
|
+
if (mt)
|
|
4375
|
+
return mt.current = me, () => {
|
|
4376
|
+
mt.current === me && (mt.current = null);
|
|
4382
4377
|
};
|
|
4383
|
-
}, [
|
|
4384
|
-
|
|
4385
|
-
}, [
|
|
4386
|
-
const
|
|
4378
|
+
}, [mt, me]), O(() => {
|
|
4379
|
+
fe && Ue(Q ?? null);
|
|
4380
|
+
}, [fe, Q]);
|
|
4381
|
+
const re = I(
|
|
4387
4382
|
(g) => {
|
|
4388
|
-
String(At) !== String(g) && (
|
|
4383
|
+
String(At) !== String(g) && (fe || Ue(g), X?.(g));
|
|
4389
4384
|
},
|
|
4390
|
-
[At,
|
|
4385
|
+
[At, fe, X]
|
|
4391
4386
|
);
|
|
4392
4387
|
O(() => {
|
|
4393
4388
|
Mt.current = r;
|
|
4394
4389
|
}, [r]), O(() => {
|
|
4395
4390
|
at.current = i;
|
|
4396
4391
|
}, [i]), O(() => {
|
|
4397
|
-
|
|
4392
|
+
gt.current = c, c || y(null);
|
|
4398
4393
|
}, [c]), O(() => () => {
|
|
4399
|
-
|
|
4400
|
-
}, [
|
|
4394
|
+
he();
|
|
4395
|
+
}, [he]);
|
|
4401
4396
|
const Nn = I((g) => {
|
|
4402
|
-
at.current?.(g),
|
|
4397
|
+
at.current?.(g), gt.current && y(g);
|
|
4403
4398
|
}, []), qr = j(() => h ? [
|
|
4404
4399
|
`tier ${h.tier} | frame ${h.frameMs?.toFixed(2) ?? "-"} ms | drawCalls ${h.drawCalls ?? "-"}`,
|
|
4405
4400
|
`tiles visible ${h.visible} | rendered ${h.rendered} | fallback ${h.fallback}`,
|
|
@@ -4409,65 +4404,65 @@ function qs({
|
|
|
4409
4404
|
].join(`
|
|
4410
4405
|
`) : "stats: waiting for first frame...", [h]);
|
|
4411
4406
|
O(() => {
|
|
4412
|
-
!(At === null ? !0 : It.some((C, v) => String(In(C, v)) === String(At))) && At !== null &&
|
|
4407
|
+
!(At === null ? !0 : It.some((C, v) => String(In(C, v)) === String(At))) && At !== null && re(null);
|
|
4413
4408
|
const A = D.current;
|
|
4414
|
-
!(A === null ? !0 : It.some((C, v) => String(In(C, v)) === String(A))) && A !== null && (D.current = null,
|
|
4409
|
+
!(A === null ? !0 : It.some((C, v) => String(In(C, v)) === String(A))) && A !== null && (D.current = null, te(null), rt?.({
|
|
4415
4410
|
region: null,
|
|
4416
4411
|
regionId: null,
|
|
4417
4412
|
regionIndex: -1,
|
|
4418
4413
|
coordinate: null
|
|
4419
4414
|
}));
|
|
4420
|
-
}, [It, At, rt,
|
|
4415
|
+
}, [It, At, rt, re]), O(() => {
|
|
4421
4416
|
const g = L.current;
|
|
4422
|
-
g !== null && (
|
|
4417
|
+
g !== null && (Nt && g < Nt.safeCount || (L.current = null, it.current = null, J?.({
|
|
4423
4418
|
index: null,
|
|
4424
4419
|
id: null,
|
|
4425
4420
|
coordinate: null,
|
|
4426
4421
|
pointCoordinate: null
|
|
4427
4422
|
})));
|
|
4428
|
-
}, [
|
|
4423
|
+
}, [Nt, J]);
|
|
4429
4424
|
const zn = I(
|
|
4430
4425
|
(g) => {
|
|
4431
|
-
|
|
4426
|
+
ne(g.zoom), xt && u(g);
|
|
4432
4427
|
const A = Mt.current;
|
|
4433
4428
|
A && A(g), Zt.current?.(), z.current?.();
|
|
4434
4429
|
},
|
|
4435
|
-
[xt,
|
|
4430
|
+
[xt, ne]
|
|
4436
4431
|
);
|
|
4437
4432
|
O(() => {
|
|
4438
|
-
const g =
|
|
4439
|
-
g &&
|
|
4440
|
-
}, [
|
|
4441
|
-
|
|
4433
|
+
const g = $.current;
|
|
4434
|
+
g && ne(g.getViewState().zoom);
|
|
4435
|
+
}, [ne, B, N]), O(() => {
|
|
4436
|
+
ot !== "cursor" && D.current !== null && (D.current = null, te(null), rt?.({
|
|
4442
4437
|
region: null,
|
|
4443
4438
|
regionId: null,
|
|
4444
4439
|
regionIndex: -1,
|
|
4445
4440
|
coordinate: null
|
|
4446
4441
|
}));
|
|
4447
|
-
}, [
|
|
4448
|
-
|
|
4442
|
+
}, [ot, rt]), O(() => {
|
|
4443
|
+
ot !== "cursor" && L.current !== null && (L.current = null, it.current = null, J?.({
|
|
4449
4444
|
index: null,
|
|
4450
4445
|
id: null,
|
|
4451
4446
|
coordinate: null,
|
|
4452
4447
|
pointCoordinate: null
|
|
4453
4448
|
}));
|
|
4454
|
-
}, [
|
|
4455
|
-
const
|
|
4456
|
-
const
|
|
4457
|
-
if (!
|
|
4458
|
-
const C =
|
|
4449
|
+
}, [ot, J]);
|
|
4450
|
+
const ie = I((g, A) => {
|
|
4451
|
+
const P = $.current;
|
|
4452
|
+
if (!P) return null;
|
|
4453
|
+
const C = P.screenToWorld(g, A);
|
|
4459
4454
|
if (!Array.isArray(C) || C.length < 2) return null;
|
|
4460
4455
|
const v = Number(C[0]), q = Number(C[1]);
|
|
4461
4456
|
return !Number.isFinite(v) || !Number.isFinite(q) ? null : [v, q];
|
|
4462
4457
|
}, []), Dn = I((g, A) => {
|
|
4463
|
-
const
|
|
4464
|
-
if (!
|
|
4465
|
-
const C =
|
|
4458
|
+
const P = $.current;
|
|
4459
|
+
if (!P) return null;
|
|
4460
|
+
const C = P.worldToScreen(g, A);
|
|
4466
4461
|
return vn(C);
|
|
4467
4462
|
}, []), ze = I((g, A) => {
|
|
4468
|
-
const
|
|
4469
|
-
if (!
|
|
4470
|
-
const C =
|
|
4463
|
+
const P = St.current;
|
|
4464
|
+
if (!P) return null;
|
|
4465
|
+
const C = P.getBoundingClientRect();
|
|
4471
4466
|
if (!Number.isFinite(C.width) || !Number.isFinite(C.height) || C.width <= 0 || C.height <= 0)
|
|
4472
4467
|
return null;
|
|
4473
4468
|
const v = g - C.left, q = A - C.top;
|
|
@@ -4476,51 +4471,51 @@ function qs({
|
|
|
4476
4471
|
canvasWidth: Math.max(1, C.width),
|
|
4477
4472
|
canvasHeight: Math.max(1, C.height)
|
|
4478
4473
|
};
|
|
4479
|
-
}, []),
|
|
4480
|
-
(g, A,
|
|
4481
|
-
const v =
|
|
4474
|
+
}, []), Ae = I(
|
|
4475
|
+
(g, A, P, C) => {
|
|
4476
|
+
const v = $.current;
|
|
4482
4477
|
return v ? Us(
|
|
4483
4478
|
g,
|
|
4484
4479
|
A,
|
|
4485
|
-
|
|
4480
|
+
ee,
|
|
4486
4481
|
v,
|
|
4487
4482
|
Bn,
|
|
4488
|
-
|
|
4483
|
+
st,
|
|
4489
4484
|
M,
|
|
4490
|
-
|
|
4485
|
+
P,
|
|
4491
4486
|
C
|
|
4492
4487
|
) : null;
|
|
4493
4488
|
},
|
|
4494
|
-
[
|
|
4489
|
+
[ee, Bn, st, M]
|
|
4495
4490
|
), On = I(() => {
|
|
4496
|
-
|
|
4497
|
-
}, []), Xn = j(() => Be ??
|
|
4491
|
+
$.current?.requestRender(), Zt.current?.(), z.current?.();
|
|
4492
|
+
}, []), Xn = j(() => Be ?? $.current?.getViewState() ?? null, [Be]), Yn = j(() => {
|
|
4498
4493
|
if (!e) return null;
|
|
4499
4494
|
const g = Xn;
|
|
4500
4495
|
return g ? {
|
|
4501
4496
|
source: e,
|
|
4502
4497
|
viewState: g,
|
|
4503
|
-
drawTool:
|
|
4498
|
+
drawTool: ot,
|
|
4504
4499
|
interactionLock: Bt,
|
|
4505
4500
|
worldToScreen: Dn,
|
|
4506
|
-
screenToWorld:
|
|
4501
|
+
screenToWorld: ie,
|
|
4507
4502
|
requestRedraw: On
|
|
4508
4503
|
} : null;
|
|
4509
|
-
}, [e, Xn,
|
|
4504
|
+
}, [e, Xn, ot, Bt, Dn, ie, On]), $r = I(
|
|
4510
4505
|
(g) => {
|
|
4511
|
-
const A = g.target === St.current,
|
|
4506
|
+
const A = g.target === St.current, P = ie(g.clientX, g.clientY);
|
|
4512
4507
|
if (wt) {
|
|
4513
|
-
const Jt = !!
|
|
4508
|
+
const Jt = !!P && P[0] >= 0 && P[1] >= 0 && !!e && P[0] <= e.width && P[1] <= e.height;
|
|
4514
4509
|
wt({
|
|
4515
|
-
coordinate:
|
|
4510
|
+
coordinate: P,
|
|
4516
4511
|
clientX: g.clientX,
|
|
4517
4512
|
clientY: g.clientY,
|
|
4518
4513
|
insideImage: Jt
|
|
4519
4514
|
});
|
|
4520
4515
|
}
|
|
4521
|
-
if (
|
|
4516
|
+
if (ot !== "cursor") return;
|
|
4522
4517
|
if (!A) {
|
|
4523
|
-
|
|
4518
|
+
Me(null, null), D.current !== null && (D.current = null, te(null), rt?.({
|
|
4524
4519
|
region: null,
|
|
4525
4520
|
regionId: null,
|
|
4526
4521
|
regionIndex: -1,
|
|
@@ -4528,87 +4523,87 @@ function qs({
|
|
|
4528
4523
|
}));
|
|
4529
4524
|
return;
|
|
4530
4525
|
}
|
|
4531
|
-
if (!
|
|
4532
|
-
|
|
4526
|
+
if (!P) {
|
|
4527
|
+
Me(null, null);
|
|
4533
4528
|
return;
|
|
4534
4529
|
}
|
|
4535
|
-
if (
|
|
4530
|
+
if (J && Me(me(P), P), !ee.length) return;
|
|
4536
4531
|
const C = ze(g.clientX, g.clientY);
|
|
4537
4532
|
if (!C) return;
|
|
4538
|
-
const v =
|
|
4539
|
-
String(vt) !== String(q) && (D.current = q,
|
|
4533
|
+
const v = Ae(P, C.screenCoord, C.canvasWidth, C.canvasHeight), q = v?.regionId ?? null, vt = D.current;
|
|
4534
|
+
String(vt) !== String(q) && (D.current = q, te(q), rt?.({
|
|
4540
4535
|
region: v?.region ?? null,
|
|
4541
4536
|
regionId: q,
|
|
4542
4537
|
regionIndex: v?.regionIndex ?? -1,
|
|
4543
|
-
coordinate:
|
|
4538
|
+
coordinate: P
|
|
4544
4539
|
}));
|
|
4545
4540
|
},
|
|
4546
|
-
[
|
|
4541
|
+
[ot, ee, ie, rt, wt, e, Me, me, J, ze, Ae]
|
|
4547
4542
|
), Zr = I(() => {
|
|
4548
4543
|
wt?.({
|
|
4549
4544
|
coordinate: null,
|
|
4550
4545
|
clientX: -1,
|
|
4551
4546
|
clientY: -1,
|
|
4552
4547
|
insideImage: !1
|
|
4553
|
-
}),
|
|
4548
|
+
}), Me(null, null), D.current !== null && (D.current = null, te(null), rt?.({
|
|
4554
4549
|
region: null,
|
|
4555
4550
|
regionId: null,
|
|
4556
4551
|
regionIndex: -1,
|
|
4557
4552
|
coordinate: null
|
|
4558
4553
|
}));
|
|
4559
|
-
}, [rt, wt,
|
|
4554
|
+
}, [rt, wt, Me]), Kr = I(
|
|
4560
4555
|
(g) => {
|
|
4561
|
-
if (
|
|
4562
|
-
const A =
|
|
4556
|
+
if (ot !== "cursor" || g.target !== St.current) return;
|
|
4557
|
+
const A = ie(g.clientX, g.clientY);
|
|
4563
4558
|
if (!A) return;
|
|
4564
|
-
if (Ne(A, g.button), !
|
|
4565
|
-
|
|
4559
|
+
if (Ne(A, g.button), !ee.length) {
|
|
4560
|
+
re(null);
|
|
4566
4561
|
return;
|
|
4567
4562
|
}
|
|
4568
|
-
const
|
|
4569
|
-
if (!
|
|
4570
|
-
const C =
|
|
4563
|
+
const P = ze(g.clientX, g.clientY);
|
|
4564
|
+
if (!P) return;
|
|
4565
|
+
const C = Ae(A, P.screenCoord, P.canvasWidth, P.canvasHeight);
|
|
4571
4566
|
if (!C) {
|
|
4572
|
-
|
|
4567
|
+
re(null);
|
|
4573
4568
|
return;
|
|
4574
4569
|
}
|
|
4575
4570
|
const v = At !== null && String(At) === String(C.regionId) ? null : C.regionId;
|
|
4576
|
-
|
|
4571
|
+
re(v), lt?.({
|
|
4577
4572
|
region: C.region,
|
|
4578
4573
|
regionId: C.regionId,
|
|
4579
4574
|
regionIndex: C.regionIndex,
|
|
4580
4575
|
coordinate: A
|
|
4581
4576
|
});
|
|
4582
4577
|
},
|
|
4583
|
-
[
|
|
4578
|
+
[ot, ee, ie, lt, At, re, Ne, ze, Ae]
|
|
4584
4579
|
), Jr = I(
|
|
4585
4580
|
(g) => {
|
|
4586
|
-
if (
|
|
4587
|
-
const A =
|
|
4588
|
-
if (!A || !
|
|
4589
|
-
const C =
|
|
4581
|
+
if (ot !== "brush" || ue?.clickSelectRoi !== !0 || !ee.length) return !1;
|
|
4582
|
+
const A = $.current, P = St.current;
|
|
4583
|
+
if (!A || !P) return !1;
|
|
4584
|
+
const C = P.getBoundingClientRect();
|
|
4590
4585
|
if (C.width <= 0 || C.height <= 0) return !1;
|
|
4591
4586
|
const v = vn(A.worldToScreen(g[0], g[1]));
|
|
4592
4587
|
if (!v) return !1;
|
|
4593
|
-
const q =
|
|
4588
|
+
const q = Ae(g, v, C.width, C.height);
|
|
4594
4589
|
if (!q) return !1;
|
|
4595
4590
|
const vt = At !== null && String(At) === String(q.regionId) ? null : q.regionId;
|
|
4596
|
-
return
|
|
4591
|
+
return re(vt), lt?.({
|
|
4597
4592
|
region: q.region,
|
|
4598
4593
|
regionId: q.regionId,
|
|
4599
4594
|
regionIndex: q.regionIndex,
|
|
4600
4595
|
coordinate: g
|
|
4601
4596
|
}), !0;
|
|
4602
4597
|
},
|
|
4603
|
-
[
|
|
4598
|
+
[ot, ue?.clickSelectRoi, ee, At, re, lt, Ae]
|
|
4604
4599
|
), Qr = I(
|
|
4605
4600
|
(g) => {
|
|
4606
|
-
if (!
|
|
4601
|
+
if (!G || ot !== "cursor" || g.target !== St.current) return;
|
|
4607
4602
|
g.preventDefault();
|
|
4608
|
-
const A =
|
|
4603
|
+
const A = ie(g.clientX, g.clientY);
|
|
4609
4604
|
A && Ne(A, g.button);
|
|
4610
4605
|
},
|
|
4611
|
-
[
|
|
4606
|
+
[ot, ie, Ne, G]
|
|
4612
4607
|
);
|
|
4613
4608
|
return O(() => {
|
|
4614
4609
|
const g = St.current;
|
|
@@ -4627,10 +4622,10 @@ function qs({
|
|
|
4627
4622
|
pointStrokeScale: _,
|
|
4628
4623
|
minZoom: B,
|
|
4629
4624
|
maxZoom: N,
|
|
4630
|
-
viewTransition:
|
|
4625
|
+
viewTransition: V
|
|
4631
4626
|
});
|
|
4632
|
-
return
|
|
4633
|
-
|
|
4627
|
+
return $.current = A, t && A.setViewState(t), ne(A.getViewState().zoom), A.setInteractionLock(Bt), xt && u(A.getViewState()), () => {
|
|
4628
|
+
he(), ye(0), A.destroy(), $.current = null;
|
|
4634
4629
|
};
|
|
4635
4630
|
}, [
|
|
4636
4631
|
e,
|
|
@@ -4644,48 +4639,48 @@ function qs({
|
|
|
4644
4639
|
_,
|
|
4645
4640
|
zn,
|
|
4646
4641
|
xt,
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4642
|
+
ne,
|
|
4643
|
+
he,
|
|
4644
|
+
ye
|
|
4650
4645
|
]), O(() => {
|
|
4651
|
-
const g =
|
|
4646
|
+
const g = $.current;
|
|
4652
4647
|
!g || !t || g.setViewState(t);
|
|
4653
4648
|
}, [t]), O(() => {
|
|
4654
|
-
const g =
|
|
4649
|
+
const g = $.current;
|
|
4655
4650
|
g && g.fitToImage();
|
|
4656
4651
|
}, [f]), O(() => {
|
|
4657
|
-
const g =
|
|
4652
|
+
const g = $.current;
|
|
4658
4653
|
g && g.resetRotation();
|
|
4659
4654
|
}, [p]), O(() => {
|
|
4660
|
-
const g =
|
|
4655
|
+
const g = $.current;
|
|
4661
4656
|
!g || !S || g.setPointPalette(S);
|
|
4662
4657
|
}, [S]), O(() => {
|
|
4663
|
-
const g =
|
|
4658
|
+
const g = $.current;
|
|
4664
4659
|
g && g.setPointSizeByZoom(x);
|
|
4665
4660
|
}, [x]), O(() => {
|
|
4666
|
-
const g =
|
|
4661
|
+
const g = $.current;
|
|
4667
4662
|
g && g.setPointStrokeScale(_);
|
|
4668
4663
|
}, [_]), O(() => {
|
|
4669
|
-
const g =
|
|
4670
|
-
g && (g.setZoomRange(B, N),
|
|
4671
|
-
}, [B, N,
|
|
4672
|
-
const g =
|
|
4673
|
-
g && g.setViewTransition(
|
|
4674
|
-
}, [
|
|
4675
|
-
const g =
|
|
4664
|
+
const g = $.current;
|
|
4665
|
+
g && (g.setZoomRange(B, N), ne(g.getViewState().zoom));
|
|
4666
|
+
}, [B, N, ne]), O(() => {
|
|
4667
|
+
const g = $.current;
|
|
4668
|
+
g && g.setViewTransition(V);
|
|
4669
|
+
}, [V]), O(() => {
|
|
4670
|
+
const g = $.current;
|
|
4676
4671
|
g && g.setImageColorSettings(n);
|
|
4677
4672
|
}, [n]), O(() => {
|
|
4678
|
-
const g =
|
|
4679
|
-
g && g.setPointData(
|
|
4680
|
-
}, [
|
|
4673
|
+
const g = $.current;
|
|
4674
|
+
g && g.setPointData(Se);
|
|
4675
|
+
}, [Se]), O(() => {
|
|
4681
4676
|
if (!Pt) return;
|
|
4682
|
-
const A = Zo(
|
|
4677
|
+
const A = Zo(K ? Se : m, It, {
|
|
4683
4678
|
paletteIndexToTermId: Ft,
|
|
4684
4679
|
includeEmptyRegions: !0
|
|
4685
4680
|
});
|
|
4686
4681
|
Pt(A);
|
|
4687
|
-
}, [Pt,
|
|
4688
|
-
const g =
|
|
4682
|
+
}, [Pt, K, m, Se, It, Ft]), O(() => {
|
|
4683
|
+
const g = $.current;
|
|
4689
4684
|
g && g.setInteractionLock(Bt);
|
|
4690
4685
|
}, [Bt]), /* @__PURE__ */ Tr(
|
|
4691
4686
|
"div",
|
|
@@ -4710,11 +4705,11 @@ function qs({
|
|
|
4710
4705
|
height: "100%",
|
|
4711
4706
|
display: "block",
|
|
4712
4707
|
touchAction: "none",
|
|
4713
|
-
cursor:
|
|
4708
|
+
cursor: ot === "cursor" && Re !== null ? "pointer" : Bt ? "crosshair" : "grab"
|
|
4714
4709
|
}
|
|
4715
4710
|
}
|
|
4716
4711
|
),
|
|
4717
|
-
e && Yn && Array.isArray(
|
|
4712
|
+
e && Yn && Array.isArray(E) && E.length > 0 ? E.map((g, A) => /* @__PURE__ */ jt(
|
|
4718
4713
|
"div",
|
|
4719
4714
|
{
|
|
4720
4715
|
className: g.className,
|
|
@@ -4732,28 +4727,28 @@ function qs({
|
|
|
4732
4727
|
e ? /* @__PURE__ */ jt(
|
|
4733
4728
|
Fo,
|
|
4734
4729
|
{
|
|
4735
|
-
tool:
|
|
4736
|
-
enabled:
|
|
4730
|
+
tool: ot,
|
|
4731
|
+
enabled: ot !== "cursor",
|
|
4737
4732
|
imageWidth: e.width,
|
|
4738
4733
|
imageHeight: e.height,
|
|
4739
4734
|
imageMpp: e.mpp,
|
|
4740
4735
|
imageZoom: e.maxTierZoom,
|
|
4741
4736
|
stampOptions: Wt,
|
|
4742
|
-
brushOptions:
|
|
4743
|
-
drawFillColor:
|
|
4744
|
-
projectorRef:
|
|
4737
|
+
brushOptions: ue,
|
|
4738
|
+
drawFillColor: le,
|
|
4739
|
+
projectorRef: $,
|
|
4745
4740
|
onBrushTap: Jr,
|
|
4746
4741
|
viewStateSignal: t,
|
|
4747
4742
|
persistedRegions: It,
|
|
4748
|
-
patchRegions:
|
|
4743
|
+
patchRegions: Lt,
|
|
4749
4744
|
regionStrokeStyle: tt,
|
|
4750
4745
|
regionStrokeHoverStyle: Vt,
|
|
4751
4746
|
regionStrokeActiveStyle: $t,
|
|
4752
|
-
patchStrokeStyle:
|
|
4747
|
+
patchStrokeStyle: be,
|
|
4753
4748
|
resolveRegionStrokeStyle: Tt,
|
|
4754
|
-
resolveRegionLabelStyle:
|
|
4755
|
-
overlayShapes:
|
|
4756
|
-
hoveredRegionId:
|
|
4749
|
+
resolveRegionLabelStyle: st,
|
|
4750
|
+
overlayShapes: R,
|
|
4751
|
+
hoveredRegionId: Re,
|
|
4757
4752
|
activeRegionId: At,
|
|
4758
4753
|
regionLabelStyle: et,
|
|
4759
4754
|
drawAreaTooltip: W,
|
|
@@ -4769,7 +4764,7 @@ function qs({
|
|
|
4769
4764
|
Lo,
|
|
4770
4765
|
{
|
|
4771
4766
|
source: e,
|
|
4772
|
-
projectorRef:
|
|
4767
|
+
projectorRef: $,
|
|
4773
4768
|
authToken: d,
|
|
4774
4769
|
options: Ct,
|
|
4775
4770
|
invalidateRef: z,
|
|
@@ -4793,8 +4788,8 @@ export {
|
|
|
4793
4788
|
Ys as buildTermPalette,
|
|
4794
4789
|
Ds as calcScaleLength,
|
|
4795
4790
|
_r as calcScaleResolution,
|
|
4796
|
-
|
|
4797
|
-
|
|
4791
|
+
ct as clamp,
|
|
4792
|
+
zt as closeRing,
|
|
4798
4793
|
Zo as computeRoiPointGroups,
|
|
4799
4794
|
cr as createCircle,
|
|
4800
4795
|
An as createRectangle,
|