graphics-debug 0.0.83 → 0.0.85
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/{chunk-HU5LL4ZE.js → chunk-5O6JHGHI.js} +2 -2
- package/dist/chunk-5O6JHGHI.js.map +1 -0
- package/dist/{chunk-NYENUFOW.js → chunk-7236NVI2.js} +5 -1
- package/dist/chunk-7236NVI2.js.map +1 -0
- package/dist/chunk-FLFF6QXL.js +89 -0
- package/dist/chunk-FLFF6QXL.js.map +1 -0
- package/dist/{chunk-BQ3ZHEQO.js → chunk-K37Y2KHE.js} +5 -1
- package/dist/chunk-K37Y2KHE.js.map +1 -0
- package/dist/{chunk-PPB7D4OE.js → chunk-ME47RV6O.js} +85 -10
- package/dist/chunk-ME47RV6O.js.map +1 -0
- package/dist/{chunk-GZRUE2GP.js → chunk-OB4CGOL3.js} +6 -1
- package/dist/chunk-OB4CGOL3.js.map +1 -0
- package/dist/{chunk-IOVKI3ZO.js → chunk-PCHDJSKZ.js} +48 -2
- package/dist/chunk-PCHDJSKZ.js.map +1 -0
- package/dist/{chunk-MXOATGTD.js → chunk-PEHHGMS7.js} +4 -4
- package/dist/{chunk-7NMLOZRC.js → chunk-TBTTAU4R.js} +122 -8
- package/dist/chunk-TBTTAU4R.js.map +1 -0
- package/dist/cli/cli.js +9 -8
- package/dist/cli/cli.js.map +1 -1
- package/dist/lib/arrowHelpers.d.ts +27 -1
- package/dist/lib/arrowHelpers.js +5 -3
- package/dist/lib/drawGraphicsToCanvas.js +3 -2
- package/dist/lib/getSvgFromGraphicsObject.d.ts +3 -2
- package/dist/lib/getSvgFromGraphicsObject.js +3 -2
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +9 -8
- package/dist/lib/infiniteLineHelpers.d.ts +7 -0
- package/dist/lib/infiniteLineHelpers.js +9 -0
- package/dist/lib/infiniteLineHelpers.js.map +1 -0
- package/dist/lib/matcher.js +3 -2
- package/dist/lib/matcher.js.map +1 -1
- package/dist/lib/mergeGraphics.js +1 -1
- package/dist/lib/react.d.ts +1 -1
- package/dist/lib/react.js +260 -114
- package/dist/lib/react.js.map +1 -1
- package/dist/lib/setStepOfAllObjects.js +1 -1
- package/dist/lib/stackGraphics.js +6 -5
- package/dist/lib/translateGraphics.js +1 -1
- package/dist/lib/types.d.ts +21 -1
- package/package.json +1 -1
- package/dist/chunk-7NMLOZRC.js.map +0 -1
- package/dist/chunk-BQ3ZHEQO.js.map +0 -1
- package/dist/chunk-GZRUE2GP.js.map +0 -1
- package/dist/chunk-HU5LL4ZE.js.map +0 -1
- package/dist/chunk-IOVKI3ZO.js.map +0 -1
- package/dist/chunk-NYENUFOW.js.map +0 -1
- package/dist/chunk-PPB7D4OE.js.map +0 -1
- /package/dist/{chunk-MXOATGTD.js.map → chunk-PEHHGMS7.js.map} +0 -0
package/dist/lib/react.js
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
import "../chunk-
|
|
2
|
-
import "../chunk-
|
|
3
|
-
import "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-5O6JHGHI.js";
|
|
2
|
+
import "../chunk-OB4CGOL3.js";
|
|
3
|
+
import "../chunk-PEHHGMS7.js";
|
|
4
|
+
import "../chunk-K37Y2KHE.js";
|
|
5
|
+
import "../chunk-7236NVI2.js";
|
|
6
6
|
import {
|
|
7
7
|
defaultColors,
|
|
8
8
|
drawGraphicsToCanvas,
|
|
9
9
|
getBounds
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-ME47RV6O.js";
|
|
11
11
|
import "../chunk-NG6H63SM.js";
|
|
12
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-TBTTAU4R.js";
|
|
13
13
|
import {
|
|
14
14
|
getArrowBoundingBox,
|
|
15
|
-
getArrowGeometry
|
|
16
|
-
|
|
15
|
+
getArrowGeometry,
|
|
16
|
+
getInlineLabelLayout
|
|
17
|
+
} from "../chunk-PCHDJSKZ.js";
|
|
17
18
|
import "../chunk-ZGI74PYD.js";
|
|
19
|
+
import {
|
|
20
|
+
clipInfiniteLineToBounds,
|
|
21
|
+
getViewportBoundsFromMatrix
|
|
22
|
+
} from "../chunk-FLFF6QXL.js";
|
|
18
23
|
|
|
19
24
|
// site/components/InteractiveGraphics/InteractiveGraphics.tsx
|
|
20
25
|
import useResizeObserver from "@react-hook/resize-observer";
|
|
@@ -93,6 +98,7 @@ function getMaxStep(graphics) {
|
|
|
93
98
|
};
|
|
94
99
|
const maxPointStep = getMaxStepFromArray(graphics.points);
|
|
95
100
|
const maxLineStep = getMaxStepFromArray(graphics.lines);
|
|
101
|
+
const maxInfiniteLineStep = getMaxStepFromArray(graphics.infiniteLines);
|
|
96
102
|
const maxRectStep = getMaxStepFromArray(graphics.rects);
|
|
97
103
|
const maxPolygonStep = getMaxStepFromArray(graphics.polygons);
|
|
98
104
|
const maxCircleStep = getMaxStepFromArray(graphics.circles);
|
|
@@ -101,6 +107,7 @@ function getMaxStep(graphics) {
|
|
|
101
107
|
return Math.max(
|
|
102
108
|
maxPointStep,
|
|
103
109
|
maxLineStep,
|
|
110
|
+
maxInfiniteLineStep,
|
|
104
111
|
maxRectStep,
|
|
105
112
|
maxPolygonStep,
|
|
106
113
|
maxCircleStep,
|
|
@@ -114,7 +121,7 @@ var sortRectsByArea = (rects) => rects.slice().sort((a, b) => b.width * b.height
|
|
|
114
121
|
|
|
115
122
|
// site/components/InteractiveGraphics/InteractiveGraphics.tsx
|
|
116
123
|
import {
|
|
117
|
-
applyToPoint as
|
|
124
|
+
applyToPoint as applyToPoint14,
|
|
118
125
|
compose,
|
|
119
126
|
inverse as inverse2,
|
|
120
127
|
scale,
|
|
@@ -488,19 +495,8 @@ var DimensionOverlay = ({ children, transform }) => {
|
|
|
488
495
|
};
|
|
489
496
|
|
|
490
497
|
// site/components/InteractiveGraphics/Arrow.tsx
|
|
491
|
-
import { applyToPoint as applyToPoint2 } from "transformation-matrix";
|
|
492
498
|
import { useMemo as useMemo2, useState as useState2 } from "react";
|
|
493
499
|
|
|
494
|
-
// site/utils/safeLighten.ts
|
|
495
|
-
import { lighten } from "polished";
|
|
496
|
-
var safeLighten = (amount, color) => {
|
|
497
|
-
try {
|
|
498
|
-
return lighten(amount, color);
|
|
499
|
-
} catch (e) {
|
|
500
|
-
return color;
|
|
501
|
-
}
|
|
502
|
-
};
|
|
503
|
-
|
|
504
500
|
// site/utils/distToLineSegment.ts
|
|
505
501
|
var distToLineSegment = (px, py, x1, y1, x2, y2) => {
|
|
506
502
|
const A = px - x1;
|
|
@@ -528,7 +524,18 @@ var distToLineSegment = (px, py, x1, y1, x2, y2) => {
|
|
|
528
524
|
return Math.sqrt(dx * dx + dy * dy);
|
|
529
525
|
};
|
|
530
526
|
|
|
527
|
+
// site/utils/safeLighten.ts
|
|
528
|
+
import { lighten } from "polished";
|
|
529
|
+
var safeLighten = (amount, color) => {
|
|
530
|
+
try {
|
|
531
|
+
return lighten(amount, color);
|
|
532
|
+
} catch (e) {
|
|
533
|
+
return color;
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
|
|
531
537
|
// site/components/InteractiveGraphics/Arrow.tsx
|
|
538
|
+
import { applyToPoint as applyToPoint2 } from "transformation-matrix";
|
|
532
539
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
533
540
|
var Arrow = ({
|
|
534
541
|
arrow,
|
|
@@ -551,6 +558,27 @@ var Arrow = ({
|
|
|
551
558
|
};
|
|
552
559
|
}, [geometry, realToScreen]);
|
|
553
560
|
const scaleFactor = Math.abs(realToScreen.a);
|
|
561
|
+
const fontSize = 12;
|
|
562
|
+
const strokeWidth = geometry.shaftWidth * (scaleFactor || 1);
|
|
563
|
+
const alongSeparation = fontSize * 0.6;
|
|
564
|
+
const inlineLabelLayout = useMemo2(
|
|
565
|
+
() => getInlineLabelLayout(screenPoints.shaftStart, screenPoints.shaftEnd, {
|
|
566
|
+
fontSize,
|
|
567
|
+
strokeWidth,
|
|
568
|
+
normalPadding: 6,
|
|
569
|
+
alongOffset: arrow.label ? alongSeparation : 0
|
|
570
|
+
}),
|
|
571
|
+
[screenPoints, fontSize, strokeWidth, arrow.label, alongSeparation]
|
|
572
|
+
);
|
|
573
|
+
const labelLayout = useMemo2(
|
|
574
|
+
() => getInlineLabelLayout(screenPoints.shaftStart, screenPoints.shaftEnd, {
|
|
575
|
+
fontSize,
|
|
576
|
+
strokeWidth,
|
|
577
|
+
normalPadding: 12,
|
|
578
|
+
alongOffset: arrow.inlineLabel ? -alongSeparation : 0
|
|
579
|
+
}),
|
|
580
|
+
[screenPoints, fontSize, strokeWidth, arrow.inlineLabel, alongSeparation]
|
|
581
|
+
);
|
|
554
582
|
const baseColor = arrow.color || defaultColors[index % defaultColors.length] || "black";
|
|
555
583
|
const displayColor = isHovered ? safeLighten(0.2, baseColor) : baseColor;
|
|
556
584
|
const handleMouseMove = (e) => {
|
|
@@ -605,7 +633,7 @@ var Arrow = ({
|
|
|
605
633
|
x2: screenPoints.shaftEnd.x,
|
|
606
634
|
y2: screenPoints.shaftEnd.y,
|
|
607
635
|
stroke: displayColor,
|
|
608
|
-
strokeWidth
|
|
636
|
+
strokeWidth,
|
|
609
637
|
strokeLinecap: "round",
|
|
610
638
|
pointerEvents: "stroke"
|
|
611
639
|
}
|
|
@@ -617,7 +645,36 @@ var Arrow = ({
|
|
|
617
645
|
fill: displayColor
|
|
618
646
|
},
|
|
619
647
|
headIndex
|
|
620
|
-
))
|
|
648
|
+
)),
|
|
649
|
+
arrow.label && /* @__PURE__ */ jsx2(
|
|
650
|
+
"text",
|
|
651
|
+
{
|
|
652
|
+
x: labelLayout.x,
|
|
653
|
+
y: labelLayout.y,
|
|
654
|
+
fill: displayColor,
|
|
655
|
+
fontSize,
|
|
656
|
+
fontFamily: "sans-serif",
|
|
657
|
+
textAnchor: "middle",
|
|
658
|
+
dominantBaseline: "central",
|
|
659
|
+
pointerEvents: "none",
|
|
660
|
+
children: arrow.label
|
|
661
|
+
}
|
|
662
|
+
),
|
|
663
|
+
arrow.inlineLabel && /* @__PURE__ */ jsx2(
|
|
664
|
+
"text",
|
|
665
|
+
{
|
|
666
|
+
x: inlineLabelLayout.x,
|
|
667
|
+
y: inlineLabelLayout.y,
|
|
668
|
+
fill: displayColor,
|
|
669
|
+
fontSize,
|
|
670
|
+
fontFamily: "sans-serif",
|
|
671
|
+
textAnchor: "middle",
|
|
672
|
+
dominantBaseline: "central",
|
|
673
|
+
transform: `rotate(${inlineLabelLayout.angleDegrees} ${inlineLabelLayout.x} ${inlineLabelLayout.y})`,
|
|
674
|
+
pointerEvents: "none",
|
|
675
|
+
children: arrow.inlineLabel
|
|
676
|
+
}
|
|
677
|
+
)
|
|
621
678
|
]
|
|
622
679
|
}
|
|
623
680
|
);
|
|
@@ -828,10 +885,81 @@ var ContextMenu = ({
|
|
|
828
885
|
] });
|
|
829
886
|
};
|
|
830
887
|
|
|
831
|
-
// site/components/InteractiveGraphics/
|
|
888
|
+
// site/components/InteractiveGraphics/InfiniteLine.tsx
|
|
832
889
|
import { applyToPoint as applyToPoint4 } from "transformation-matrix";
|
|
833
|
-
import { useRef as useRef3, useState as useState4 } from "react";
|
|
834
890
|
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
891
|
+
var InfiniteLine = ({
|
|
892
|
+
infiniteLine,
|
|
893
|
+
index,
|
|
894
|
+
interactiveState,
|
|
895
|
+
size
|
|
896
|
+
}) => {
|
|
897
|
+
const { realToScreen, onObjectClicked } = interactiveState;
|
|
898
|
+
const viewportBounds = getViewportBoundsFromMatrix(
|
|
899
|
+
realToScreen,
|
|
900
|
+
size.width,
|
|
901
|
+
size.height
|
|
902
|
+
);
|
|
903
|
+
const segment = clipInfiniteLineToBounds(infiniteLine, viewportBounds);
|
|
904
|
+
if (!segment) {
|
|
905
|
+
return null;
|
|
906
|
+
}
|
|
907
|
+
const [start, end] = segment;
|
|
908
|
+
const screenStart = applyToPoint4(realToScreen, start);
|
|
909
|
+
const screenEnd = applyToPoint4(realToScreen, end);
|
|
910
|
+
const baseColor = infiniteLine.strokeColor ?? defaultColors[index % defaultColors.length];
|
|
911
|
+
const strokeWidth = (infiniteLine.strokeWidth ?? 1 / Math.abs(realToScreen.a)) * Math.abs(realToScreen.a);
|
|
912
|
+
return /* @__PURE__ */ jsxs4(
|
|
913
|
+
"svg",
|
|
914
|
+
{
|
|
915
|
+
style: {
|
|
916
|
+
position: "absolute",
|
|
917
|
+
top: 0,
|
|
918
|
+
left: 0,
|
|
919
|
+
width: size.width,
|
|
920
|
+
height: size.height,
|
|
921
|
+
pointerEvents: "none"
|
|
922
|
+
},
|
|
923
|
+
children: [
|
|
924
|
+
/* @__PURE__ */ jsx6(
|
|
925
|
+
"line",
|
|
926
|
+
{
|
|
927
|
+
x1: screenStart.x,
|
|
928
|
+
y1: screenStart.y,
|
|
929
|
+
x2: screenEnd.x,
|
|
930
|
+
y2: screenEnd.y,
|
|
931
|
+
stroke: "transparent",
|
|
932
|
+
strokeWidth: strokeWidth + 10,
|
|
933
|
+
pointerEvents: "stroke",
|
|
934
|
+
onClick: () => onObjectClicked?.({
|
|
935
|
+
type: "infinite-line",
|
|
936
|
+
index,
|
|
937
|
+
object: infiniteLine
|
|
938
|
+
})
|
|
939
|
+
}
|
|
940
|
+
),
|
|
941
|
+
/* @__PURE__ */ jsx6(
|
|
942
|
+
"line",
|
|
943
|
+
{
|
|
944
|
+
x1: screenStart.x,
|
|
945
|
+
y1: screenStart.y,
|
|
946
|
+
x2: screenEnd.x,
|
|
947
|
+
y2: screenEnd.y,
|
|
948
|
+
stroke: baseColor,
|
|
949
|
+
strokeWidth,
|
|
950
|
+
strokeDasharray: !infiniteLine.strokeDash ? void 0 : typeof infiniteLine.strokeDash === "string" ? infiniteLine.strokeDash : infiniteLine.strokeDash.map((dash) => dash * Math.abs(realToScreen.a)).join(","),
|
|
951
|
+
pointerEvents: "none"
|
|
952
|
+
}
|
|
953
|
+
)
|
|
954
|
+
]
|
|
955
|
+
}
|
|
956
|
+
);
|
|
957
|
+
};
|
|
958
|
+
|
|
959
|
+
// site/components/InteractiveGraphics/Line.tsx
|
|
960
|
+
import { applyToPoint as applyToPoint5 } from "transformation-matrix";
|
|
961
|
+
import { useRef as useRef3, useState as useState4 } from "react";
|
|
962
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
835
963
|
var Line = ({
|
|
836
964
|
line,
|
|
837
965
|
index,
|
|
@@ -849,7 +977,7 @@ var Line = ({
|
|
|
849
977
|
const [isHovered, setIsHovered] = useState4(false);
|
|
850
978
|
const [mousePos, setMousePos] = useState4({ x: 0, y: 0 });
|
|
851
979
|
const svgRef = useRef3(null);
|
|
852
|
-
const screenPoints = points.map((p) =>
|
|
980
|
+
const screenPoints = points.map((p) => applyToPoint5(realToScreen, p));
|
|
853
981
|
const xs = screenPoints.map((p) => p.x);
|
|
854
982
|
const ys = screenPoints.map((p) => p.y);
|
|
855
983
|
const minX = Math.min(...xs);
|
|
@@ -893,7 +1021,7 @@ var Line = ({
|
|
|
893
1021
|
setIsHovered(isNearLine);
|
|
894
1022
|
};
|
|
895
1023
|
const baseColor = strokeColor ?? defaultColors[index % defaultColors.length];
|
|
896
|
-
return /* @__PURE__ */
|
|
1024
|
+
return /* @__PURE__ */ jsxs5(
|
|
897
1025
|
"svg",
|
|
898
1026
|
{
|
|
899
1027
|
ref: svgRef,
|
|
@@ -906,7 +1034,7 @@ var Line = ({
|
|
|
906
1034
|
pointerEvents: "none"
|
|
907
1035
|
},
|
|
908
1036
|
children: [
|
|
909
|
-
/* @__PURE__ */
|
|
1037
|
+
/* @__PURE__ */ jsx7(
|
|
910
1038
|
"polyline",
|
|
911
1039
|
{
|
|
912
1040
|
points: localPoints.map((p) => `${p.x},${p.y}`).join(" "),
|
|
@@ -924,7 +1052,7 @@ var Line = ({
|
|
|
924
1052
|
}) : void 0
|
|
925
1053
|
}
|
|
926
1054
|
),
|
|
927
|
-
/* @__PURE__ */
|
|
1055
|
+
/* @__PURE__ */ jsx7(
|
|
928
1056
|
"polyline",
|
|
929
1057
|
{
|
|
930
1058
|
points: localPoints.map((p) => `${p.x},${p.y}`).join(" "),
|
|
@@ -936,14 +1064,14 @@ var Line = ({
|
|
|
936
1064
|
pointerEvents: "none"
|
|
937
1065
|
}
|
|
938
1066
|
),
|
|
939
|
-
isHovered && line.label && /* @__PURE__ */
|
|
1067
|
+
isHovered && line.label && /* @__PURE__ */ jsx7(
|
|
940
1068
|
"foreignObject",
|
|
941
1069
|
{
|
|
942
1070
|
x: mousePos.x,
|
|
943
1071
|
y: mousePos.y - 40,
|
|
944
1072
|
width: 300,
|
|
945
1073
|
height: 40,
|
|
946
|
-
children: /* @__PURE__ */
|
|
1074
|
+
children: /* @__PURE__ */ jsx7(Tooltip, { text: line.label })
|
|
947
1075
|
}
|
|
948
1076
|
)
|
|
949
1077
|
]
|
|
@@ -952,11 +1080,11 @@ var Line = ({
|
|
|
952
1080
|
};
|
|
953
1081
|
|
|
954
1082
|
// site/components/InteractiveGraphics/Marker.tsx
|
|
955
|
-
import { applyToPoint as
|
|
956
|
-
import { jsx as
|
|
1083
|
+
import { applyToPoint as applyToPoint6 } from "transformation-matrix";
|
|
1084
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
957
1085
|
var Marker = ({ marker, transform }) => {
|
|
958
|
-
const [screenX, screenY] =
|
|
959
|
-
return /* @__PURE__ */
|
|
1086
|
+
const [screenX, screenY] = applyToPoint6(transform, [marker.x, marker.y]);
|
|
1087
|
+
return /* @__PURE__ */ jsx8(
|
|
960
1088
|
"svg",
|
|
961
1089
|
{
|
|
962
1090
|
style: {
|
|
@@ -966,8 +1094,8 @@ var Marker = ({ marker, transform }) => {
|
|
|
966
1094
|
pointerEvents: "none",
|
|
967
1095
|
zIndex: 900
|
|
968
1096
|
},
|
|
969
|
-
children: /* @__PURE__ */
|
|
970
|
-
/* @__PURE__ */
|
|
1097
|
+
children: /* @__PURE__ */ jsxs6("g", { transform: `translate(${screenX}, ${screenY})`, children: [
|
|
1098
|
+
/* @__PURE__ */ jsx8(
|
|
971
1099
|
"circle",
|
|
972
1100
|
{
|
|
973
1101
|
r: 7,
|
|
@@ -976,16 +1104,16 @@ var Marker = ({ marker, transform }) => {
|
|
|
976
1104
|
strokeWidth: 2
|
|
977
1105
|
}
|
|
978
1106
|
),
|
|
979
|
-
/* @__PURE__ */
|
|
1107
|
+
/* @__PURE__ */ jsx8("circle", { r: 2, fill: "rgba(255, 0, 0, 0.9)" })
|
|
980
1108
|
] })
|
|
981
1109
|
}
|
|
982
1110
|
);
|
|
983
1111
|
};
|
|
984
1112
|
|
|
985
1113
|
// site/components/InteractiveGraphics/Point.tsx
|
|
986
|
-
import { applyToPoint as
|
|
1114
|
+
import { applyToPoint as applyToPoint7 } from "transformation-matrix";
|
|
987
1115
|
import { useState as useState5 } from "react";
|
|
988
|
-
import { jsx as
|
|
1116
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
989
1117
|
var Point = ({
|
|
990
1118
|
point,
|
|
991
1119
|
interactiveState,
|
|
@@ -994,9 +1122,9 @@ var Point = ({
|
|
|
994
1122
|
const { color, label, layer, step } = point;
|
|
995
1123
|
const { activeLayers, activeStep, realToScreen, onObjectClicked } = interactiveState;
|
|
996
1124
|
const [isHovered, setIsHovered] = useState5(false);
|
|
997
|
-
const screenPoint =
|
|
1125
|
+
const screenPoint = applyToPoint7(realToScreen, point);
|
|
998
1126
|
const size = 10;
|
|
999
|
-
return /* @__PURE__ */
|
|
1127
|
+
return /* @__PURE__ */ jsx9(
|
|
1000
1128
|
"div",
|
|
1001
1129
|
{
|
|
1002
1130
|
style: {
|
|
@@ -1020,7 +1148,7 @@ var Point = ({
|
|
|
1020
1148
|
index,
|
|
1021
1149
|
object: point
|
|
1022
1150
|
}),
|
|
1023
|
-
children: isHovered && /* @__PURE__ */
|
|
1151
|
+
children: isHovered && /* @__PURE__ */ jsx9(
|
|
1024
1152
|
"div",
|
|
1025
1153
|
{
|
|
1026
1154
|
style: {
|
|
@@ -1030,7 +1158,7 @@ var Point = ({
|
|
|
1030
1158
|
transform: "translateX(-50%)",
|
|
1031
1159
|
marginBottom: 8
|
|
1032
1160
|
},
|
|
1033
|
-
children: /* @__PURE__ */
|
|
1161
|
+
children: /* @__PURE__ */ jsx9(
|
|
1034
1162
|
Tooltip,
|
|
1035
1163
|
{
|
|
1036
1164
|
text: `${label ? `${label}
|
|
@@ -1045,8 +1173,8 @@ var Point = ({
|
|
|
1045
1173
|
|
|
1046
1174
|
// site/components/InteractiveGraphics/Polygon.tsx
|
|
1047
1175
|
import { useState as useState6 } from "react";
|
|
1048
|
-
import { applyToPoint as
|
|
1049
|
-
import { jsx as
|
|
1176
|
+
import { applyToPoint as applyToPoint8 } from "transformation-matrix";
|
|
1177
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1050
1178
|
var Polygon = ({
|
|
1051
1179
|
polygon,
|
|
1052
1180
|
interactiveState,
|
|
@@ -1056,7 +1184,7 @@ var Polygon = ({
|
|
|
1056
1184
|
const { realToScreen, onObjectClicked } = interactiveState;
|
|
1057
1185
|
const [isHovered, setIsHovered] = useState6(false);
|
|
1058
1186
|
if (!points || points.length === 0) return null;
|
|
1059
|
-
const screenPoints = points.map((p) =>
|
|
1187
|
+
const screenPoints = points.map((p) => applyToPoint8(realToScreen, p));
|
|
1060
1188
|
const xs = screenPoints.map((p) => p.x);
|
|
1061
1189
|
const ys = screenPoints.map((p) => p.y);
|
|
1062
1190
|
const minX = Math.min(...xs);
|
|
@@ -1079,7 +1207,7 @@ var Polygon = ({
|
|
|
1079
1207
|
const displayFill = isHovered ? safeLighten(0.2, baseFill) : baseFill;
|
|
1080
1208
|
const displayStroke = baseStroke ? isHovered ? safeLighten(0.2, baseStroke) : baseStroke : void 0;
|
|
1081
1209
|
const screenStrokeWidth = strokeWidth === void 0 ? void 0 : strokeWidth * realToScreen.a;
|
|
1082
|
-
return /* @__PURE__ */
|
|
1210
|
+
return /* @__PURE__ */ jsxs7(
|
|
1083
1211
|
"div",
|
|
1084
1212
|
{
|
|
1085
1213
|
style: {
|
|
@@ -1091,7 +1219,7 @@ var Polygon = ({
|
|
|
1091
1219
|
pointerEvents: "none"
|
|
1092
1220
|
},
|
|
1093
1221
|
children: [
|
|
1094
|
-
/* @__PURE__ */
|
|
1222
|
+
/* @__PURE__ */ jsx10("svg", { width: svgWidth, height: svgHeight, style: { display: "block" }, children: /* @__PURE__ */ jsx10(
|
|
1095
1223
|
"polygon",
|
|
1096
1224
|
{
|
|
1097
1225
|
points: localPoints.map((p) => `${p.x},${p.y}`).join(" "),
|
|
@@ -1108,7 +1236,7 @@ var Polygon = ({
|
|
|
1108
1236
|
})
|
|
1109
1237
|
}
|
|
1110
1238
|
) }),
|
|
1111
|
-
isHovered && polygon.label && /* @__PURE__ */
|
|
1239
|
+
isHovered && polygon.label && /* @__PURE__ */ jsx10(
|
|
1112
1240
|
"div",
|
|
1113
1241
|
{
|
|
1114
1242
|
style: {
|
|
@@ -1119,7 +1247,7 @@ var Polygon = ({
|
|
|
1119
1247
|
marginBottom: 8,
|
|
1120
1248
|
pointerEvents: "none"
|
|
1121
1249
|
},
|
|
1122
|
-
children: /* @__PURE__ */
|
|
1250
|
+
children: /* @__PURE__ */ jsx10(Tooltip, { text: polygon.label })
|
|
1123
1251
|
}
|
|
1124
1252
|
)
|
|
1125
1253
|
]
|
|
@@ -1128,9 +1256,9 @@ var Polygon = ({
|
|
|
1128
1256
|
};
|
|
1129
1257
|
|
|
1130
1258
|
// site/components/InteractiveGraphics/Rect.tsx
|
|
1131
|
-
import { applyToPoint as
|
|
1259
|
+
import { applyToPoint as applyToPoint9 } from "transformation-matrix";
|
|
1132
1260
|
import { useState as useState7 } from "react";
|
|
1133
|
-
import { jsx as
|
|
1261
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1134
1262
|
var Rect = ({
|
|
1135
1263
|
rect,
|
|
1136
1264
|
interactiveState,
|
|
@@ -1140,7 +1268,7 @@ var Rect = ({
|
|
|
1140
1268
|
let { center, width, height, fill, stroke, layer, step } = rect;
|
|
1141
1269
|
const { activeLayers, activeStep, realToScreen, onObjectClicked } = interactiveState;
|
|
1142
1270
|
const [isHovered, setIsHovered] = useState7(false);
|
|
1143
|
-
const screenCenter =
|
|
1271
|
+
const screenCenter = applyToPoint9(realToScreen, center);
|
|
1144
1272
|
const screenWidth = width * realToScreen.a;
|
|
1145
1273
|
const screenHeight = height * Math.abs(realToScreen.d);
|
|
1146
1274
|
const hasStrokeOrFill = fill !== void 0 || stroke !== void 0;
|
|
@@ -1149,7 +1277,7 @@ var Rect = ({
|
|
|
1149
1277
|
backgroundColor = safeLighten(0.2, backgroundColor);
|
|
1150
1278
|
stroke = safeLighten(0.2, stroke);
|
|
1151
1279
|
}
|
|
1152
|
-
return /* @__PURE__ */
|
|
1280
|
+
return /* @__PURE__ */ jsx11(
|
|
1153
1281
|
"div",
|
|
1154
1282
|
{
|
|
1155
1283
|
style: {
|
|
@@ -1170,7 +1298,7 @@ var Rect = ({
|
|
|
1170
1298
|
index,
|
|
1171
1299
|
object: rect
|
|
1172
1300
|
}),
|
|
1173
|
-
children: isHovered && rect.label && /* @__PURE__ */
|
|
1301
|
+
children: isHovered && rect.label && /* @__PURE__ */ jsx11(
|
|
1174
1302
|
"div",
|
|
1175
1303
|
{
|
|
1176
1304
|
style: {
|
|
@@ -1180,7 +1308,7 @@ var Rect = ({
|
|
|
1180
1308
|
transform: "translateX(-50%)",
|
|
1181
1309
|
marginBottom: 8
|
|
1182
1310
|
},
|
|
1183
|
-
children: /* @__PURE__ */
|
|
1311
|
+
children: /* @__PURE__ */ jsx11(Tooltip, { text: rect.label })
|
|
1184
1312
|
}
|
|
1185
1313
|
)
|
|
1186
1314
|
}
|
|
@@ -1188,8 +1316,8 @@ var Rect = ({
|
|
|
1188
1316
|
};
|
|
1189
1317
|
|
|
1190
1318
|
// site/components/InteractiveGraphics/Text.tsx
|
|
1191
|
-
import { applyToPoint as
|
|
1192
|
-
import { jsx as
|
|
1319
|
+
import { applyToPoint as applyToPoint10 } from "transformation-matrix";
|
|
1320
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1193
1321
|
var Text = ({
|
|
1194
1322
|
textObj,
|
|
1195
1323
|
interactiveState,
|
|
@@ -1197,7 +1325,7 @@ var Text = ({
|
|
|
1197
1325
|
}) => {
|
|
1198
1326
|
const { realToScreen, onObjectClicked } = interactiveState;
|
|
1199
1327
|
const { x, y, text, color, fontSize, anchorSide } = textObj;
|
|
1200
|
-
const screenPos =
|
|
1328
|
+
const screenPos = applyToPoint10(realToScreen, { x, y });
|
|
1201
1329
|
const transformMap = {
|
|
1202
1330
|
top_left: "translate(0%, 0%)",
|
|
1203
1331
|
top_center: "translate(-50%, 0%)",
|
|
@@ -1210,7 +1338,7 @@ var Text = ({
|
|
|
1210
1338
|
bottom_right: "translate(-100%, -100%)"
|
|
1211
1339
|
};
|
|
1212
1340
|
const transform = transformMap[anchorSide ?? "center"];
|
|
1213
|
-
return /* @__PURE__ */
|
|
1341
|
+
return /* @__PURE__ */ jsx12(
|
|
1214
1342
|
"div",
|
|
1215
1343
|
{
|
|
1216
1344
|
style: {
|
|
@@ -1230,18 +1358,18 @@ var Text = ({
|
|
|
1230
1358
|
};
|
|
1231
1359
|
|
|
1232
1360
|
// site/components/InteractiveGraphics/hooks/useIsPointOnScreen.ts
|
|
1233
|
-
import { applyToPoint as
|
|
1361
|
+
import { applyToPoint as applyToPoint12 } from "transformation-matrix";
|
|
1234
1362
|
import { useMemo as useMemo4 } from "react";
|
|
1235
1363
|
|
|
1236
1364
|
// site/components/InteractiveGraphics/hooks/useDoesLineIntersectViewport.ts
|
|
1237
|
-
import { applyToPoint as
|
|
1365
|
+
import { applyToPoint as applyToPoint11 } from "transformation-matrix";
|
|
1238
1366
|
import { useMemo as useMemo3 } from "react";
|
|
1239
1367
|
var OFFSCREEN_MARGIN = 5;
|
|
1240
1368
|
var useDoesLineIntersectViewport = (realToScreen, size) => {
|
|
1241
1369
|
return useMemo3(() => {
|
|
1242
1370
|
return (p1, p2) => {
|
|
1243
|
-
const sp1 =
|
|
1244
|
-
const sp2 =
|
|
1371
|
+
const sp1 = applyToPoint11(realToScreen, p1);
|
|
1372
|
+
const sp2 = applyToPoint11(realToScreen, p2);
|
|
1245
1373
|
const left = -OFFSCREEN_MARGIN;
|
|
1246
1374
|
const right = size.width + OFFSCREEN_MARGIN;
|
|
1247
1375
|
const top = -OFFSCREEN_MARGIN;
|
|
@@ -1271,7 +1399,7 @@ var useDoesLineIntersectViewport = (realToScreen, size) => {
|
|
|
1271
1399
|
var useIsPointOnScreen = (realToScreen, size) => {
|
|
1272
1400
|
return useMemo4(() => {
|
|
1273
1401
|
return (point) => {
|
|
1274
|
-
const screenPoint =
|
|
1402
|
+
const screenPoint = applyToPoint12(realToScreen, point);
|
|
1275
1403
|
return screenPoint.x >= -OFFSCREEN_MARGIN && screenPoint.x <= size.width + OFFSCREEN_MARGIN && screenPoint.y >= -OFFSCREEN_MARGIN && screenPoint.y <= size.height + OFFSCREEN_MARGIN;
|
|
1276
1404
|
};
|
|
1277
1405
|
}, [realToScreen, size]);
|
|
@@ -1349,7 +1477,7 @@ var useFilterRects = ({
|
|
|
1349
1477
|
|
|
1350
1478
|
// site/components/InteractiveGraphics/hooks/useFilterCircles.ts
|
|
1351
1479
|
import { useMemo as useMemo8 } from "react";
|
|
1352
|
-
import { applyToPoint as
|
|
1480
|
+
import { applyToPoint as applyToPoint13 } from "transformation-matrix";
|
|
1353
1481
|
var useFilterCircles = ({
|
|
1354
1482
|
isPointOnScreen,
|
|
1355
1483
|
filterLayerAndStep,
|
|
@@ -1363,7 +1491,7 @@ var useFilterCircles = ({
|
|
|
1363
1491
|
if (isPointOnScreen(center) || isPointOnScreen({ x: center.x + radius, y: center.y }) || isPointOnScreen({ x: center.x - radius, y: center.y }) || isPointOnScreen({ x: center.x, y: center.y + radius }) || isPointOnScreen({ x: center.x, y: center.y - radius })) {
|
|
1364
1492
|
return true;
|
|
1365
1493
|
}
|
|
1366
|
-
const screenCenter =
|
|
1494
|
+
const screenCenter = applyToPoint13(realToScreen, center);
|
|
1367
1495
|
const scale4 = Math.abs(realToScreen.a);
|
|
1368
1496
|
const screenRadius = radius * scale4;
|
|
1369
1497
|
const left = -OFFSCREEN_MARGIN;
|
|
@@ -1459,7 +1587,7 @@ var useFilterPolygons = ({
|
|
|
1459
1587
|
};
|
|
1460
1588
|
|
|
1461
1589
|
// site/components/InteractiveGraphics/InteractiveGraphics.tsx
|
|
1462
|
-
import { jsx as
|
|
1590
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1463
1591
|
var InteractiveGraphics = ({
|
|
1464
1592
|
graphics,
|
|
1465
1593
|
onObjectClicked,
|
|
@@ -1475,6 +1603,7 @@ var InteractiveGraphics = ({
|
|
|
1475
1603
|
const availableLayers = Array.from(
|
|
1476
1604
|
/* @__PURE__ */ new Set([
|
|
1477
1605
|
...graphics.lines?.map((l) => l.layer).filter(Boolean) ?? [],
|
|
1606
|
+
...graphics.infiniteLines?.map((l) => l.layer).filter(Boolean) ?? [],
|
|
1478
1607
|
...graphics.rects?.map((r) => r.layer).filter(Boolean) ?? [],
|
|
1479
1608
|
...graphics.polygons?.map((p) => p.layer).filter(Boolean) ?? [],
|
|
1480
1609
|
...graphics.points?.map((p) => p.layer).filter(Boolean) ?? [],
|
|
@@ -1623,7 +1752,7 @@ var InteractiveGraphics = ({
|
|
|
1623
1752
|
const screenX = screenPoint.x - rect.left;
|
|
1624
1753
|
const screenY = screenPoint.y - rect.top;
|
|
1625
1754
|
const inverseTransform = inverse2(realToScreen);
|
|
1626
|
-
const [realX, realY] =
|
|
1755
|
+
const [realX, realY] = applyToPoint14(inverseTransform, [
|
|
1627
1756
|
screenX,
|
|
1628
1757
|
screenY
|
|
1629
1758
|
]);
|
|
@@ -1708,6 +1837,10 @@ var InteractiveGraphics = ({
|
|
|
1708
1837
|
() => filterAndLimit(graphics.lines, filterLines),
|
|
1709
1838
|
[graphics.lines, filterLines, objectLimit]
|
|
1710
1839
|
);
|
|
1840
|
+
const filteredInfiniteLines = useMemo12(
|
|
1841
|
+
() => filterAndLimit(graphics.infiniteLines, filterLayerAndStep),
|
|
1842
|
+
[graphics.infiniteLines, filterLayerAndStep, objectLimit]
|
|
1843
|
+
);
|
|
1711
1844
|
const filteredRects = useMemo12(
|
|
1712
1845
|
() => sortRectsByArea(filterAndLimit(graphics.rects, filterRects)),
|
|
1713
1846
|
[graphics.rects, filterRects, objectLimit]
|
|
@@ -1732,11 +1865,11 @@ var InteractiveGraphics = ({
|
|
|
1732
1865
|
() => filterAndLimit(graphics.arrows, filterArrows),
|
|
1733
1866
|
[graphics.arrows, filterArrows, objectLimit]
|
|
1734
1867
|
);
|
|
1735
|
-
const totalFilteredObjects = filteredLines.length + filteredRects.length + filteredPolygons.length + filteredPoints.length + filteredCircles.length + filteredTexts.length + filteredArrows.length;
|
|
1868
|
+
const totalFilteredObjects = filteredInfiniteLines.length + filteredLines.length + filteredRects.length + filteredPolygons.length + filteredPoints.length + filteredCircles.length + filteredTexts.length + filteredArrows.length;
|
|
1736
1869
|
const isLimitReached = objectLimit && totalFilteredObjects > objectLimit;
|
|
1737
|
-
return /* @__PURE__ */
|
|
1738
|
-
showToolbar && /* @__PURE__ */
|
|
1739
|
-
availableLayers.length > 1 && /* @__PURE__ */
|
|
1870
|
+
return /* @__PURE__ */ jsxs8("div", { children: [
|
|
1871
|
+
showToolbar && /* @__PURE__ */ jsxs8("div", { style: { margin: 8 }, children: [
|
|
1872
|
+
availableLayers.length > 1 && /* @__PURE__ */ jsxs8(
|
|
1740
1873
|
"select",
|
|
1741
1874
|
{
|
|
1742
1875
|
value: activeLayers ? activeLayers[0] : "",
|
|
@@ -1746,18 +1879,18 @@ var InteractiveGraphics = ({
|
|
|
1746
1879
|
},
|
|
1747
1880
|
style: { marginRight: 8 },
|
|
1748
1881
|
children: [
|
|
1749
|
-
/* @__PURE__ */
|
|
1750
|
-
availableLayers.map((layer) => /* @__PURE__ */
|
|
1882
|
+
/* @__PURE__ */ jsx13("option", { value: "", children: "All Layers" }),
|
|
1883
|
+
availableLayers.map((layer) => /* @__PURE__ */ jsx13("option", { value: layer, children: layer }, layer))
|
|
1751
1884
|
]
|
|
1752
1885
|
}
|
|
1753
1886
|
),
|
|
1754
|
-
maxStep > 0 && /* @__PURE__ */
|
|
1887
|
+
maxStep > 0 && /* @__PURE__ */ jsxs8(
|
|
1755
1888
|
"div",
|
|
1756
1889
|
{
|
|
1757
1890
|
style: { display: "inline-flex", alignItems: "center", gap: 8 },
|
|
1758
1891
|
children: [
|
|
1759
1892
|
"Step:",
|
|
1760
|
-
/* @__PURE__ */
|
|
1893
|
+
/* @__PURE__ */ jsx13(
|
|
1761
1894
|
"input",
|
|
1762
1895
|
{
|
|
1763
1896
|
type: "number",
|
|
@@ -1772,8 +1905,8 @@ var InteractiveGraphics = ({
|
|
|
1772
1905
|
disabled: activeStep === null
|
|
1773
1906
|
}
|
|
1774
1907
|
),
|
|
1775
|
-
/* @__PURE__ */
|
|
1776
|
-
/* @__PURE__ */
|
|
1908
|
+
/* @__PURE__ */ jsxs8("label", { children: [
|
|
1909
|
+
/* @__PURE__ */ jsx13(
|
|
1777
1910
|
"input",
|
|
1778
1911
|
{
|
|
1779
1912
|
type: "checkbox",
|
|
@@ -1787,8 +1920,8 @@ var InteractiveGraphics = ({
|
|
|
1787
1920
|
),
|
|
1788
1921
|
"Filter by step"
|
|
1789
1922
|
] }),
|
|
1790
|
-
/* @__PURE__ */
|
|
1791
|
-
/* @__PURE__ */
|
|
1923
|
+
/* @__PURE__ */ jsxs8("label", { children: [
|
|
1924
|
+
/* @__PURE__ */ jsx13(
|
|
1792
1925
|
"input",
|
|
1793
1926
|
{
|
|
1794
1927
|
type: "checkbox",
|
|
@@ -1802,7 +1935,7 @@ var InteractiveGraphics = ({
|
|
|
1802
1935
|
),
|
|
1803
1936
|
"Show last step"
|
|
1804
1937
|
] }),
|
|
1805
|
-
isLimitReached && /* @__PURE__ */
|
|
1938
|
+
isLimitReached && /* @__PURE__ */ jsxs8("span", { style: { color: "red", fontSize: "12px" }, children: [
|
|
1806
1939
|
"Display limited to ",
|
|
1807
1940
|
objectLimit,
|
|
1808
1941
|
" objects. Received:",
|
|
@@ -1814,7 +1947,7 @@ var InteractiveGraphics = ({
|
|
|
1814
1947
|
}
|
|
1815
1948
|
)
|
|
1816
1949
|
] }),
|
|
1817
|
-
/* @__PURE__ */
|
|
1950
|
+
/* @__PURE__ */ jsxs8(
|
|
1818
1951
|
"div",
|
|
1819
1952
|
{
|
|
1820
1953
|
ref,
|
|
@@ -1825,8 +1958,8 @@ var InteractiveGraphics = ({
|
|
|
1825
1958
|
},
|
|
1826
1959
|
onContextMenu: handleContextMenu,
|
|
1827
1960
|
children: [
|
|
1828
|
-
/* @__PURE__ */
|
|
1829
|
-
filteredArrows.map((arrow) => /* @__PURE__ */
|
|
1961
|
+
/* @__PURE__ */ jsxs8(DimensionOverlay, { transform: realToScreen, children: [
|
|
1962
|
+
filteredArrows.map((arrow) => /* @__PURE__ */ jsx13(
|
|
1830
1963
|
Arrow,
|
|
1831
1964
|
{
|
|
1832
1965
|
arrow,
|
|
@@ -1835,7 +1968,17 @@ var InteractiveGraphics = ({
|
|
|
1835
1968
|
},
|
|
1836
1969
|
arrow.originalIndex
|
|
1837
1970
|
)),
|
|
1838
|
-
|
|
1971
|
+
filteredInfiniteLines.map((infiniteLine) => /* @__PURE__ */ jsx13(
|
|
1972
|
+
InfiniteLine,
|
|
1973
|
+
{
|
|
1974
|
+
infiniteLine,
|
|
1975
|
+
index: infiniteLine.originalIndex,
|
|
1976
|
+
interactiveState,
|
|
1977
|
+
size
|
|
1978
|
+
},
|
|
1979
|
+
infiniteLine.originalIndex
|
|
1980
|
+
)),
|
|
1981
|
+
filteredLines.map((line) => /* @__PURE__ */ jsx13(
|
|
1839
1982
|
Line,
|
|
1840
1983
|
{
|
|
1841
1984
|
line,
|
|
@@ -1844,7 +1987,7 @@ var InteractiveGraphics = ({
|
|
|
1844
1987
|
},
|
|
1845
1988
|
line.originalIndex
|
|
1846
1989
|
)),
|
|
1847
|
-
filteredRects.map((rect) => /* @__PURE__ */
|
|
1990
|
+
filteredRects.map((rect) => /* @__PURE__ */ jsx13(
|
|
1848
1991
|
Rect,
|
|
1849
1992
|
{
|
|
1850
1993
|
rect,
|
|
@@ -1853,7 +1996,7 @@ var InteractiveGraphics = ({
|
|
|
1853
1996
|
},
|
|
1854
1997
|
rect.originalIndex
|
|
1855
1998
|
)),
|
|
1856
|
-
filteredPolygons.map((polygon) => /* @__PURE__ */
|
|
1999
|
+
filteredPolygons.map((polygon) => /* @__PURE__ */ jsx13(
|
|
1857
2000
|
Polygon,
|
|
1858
2001
|
{
|
|
1859
2002
|
polygon,
|
|
@@ -1862,7 +2005,7 @@ var InteractiveGraphics = ({
|
|
|
1862
2005
|
},
|
|
1863
2006
|
polygon.originalIndex
|
|
1864
2007
|
)),
|
|
1865
|
-
filteredPoints.map((point) => /* @__PURE__ */
|
|
2008
|
+
filteredPoints.map((point) => /* @__PURE__ */ jsx13(
|
|
1866
2009
|
Point,
|
|
1867
2010
|
{
|
|
1868
2011
|
point,
|
|
@@ -1871,7 +2014,7 @@ var InteractiveGraphics = ({
|
|
|
1871
2014
|
},
|
|
1872
2015
|
point.originalIndex
|
|
1873
2016
|
)),
|
|
1874
|
-
filteredCircles.map((circle) => /* @__PURE__ */
|
|
2017
|
+
filteredCircles.map((circle) => /* @__PURE__ */ jsx13(
|
|
1875
2018
|
Circle,
|
|
1876
2019
|
{
|
|
1877
2020
|
circle,
|
|
@@ -1880,7 +2023,7 @@ var InteractiveGraphics = ({
|
|
|
1880
2023
|
},
|
|
1881
2024
|
circle.originalIndex
|
|
1882
2025
|
)),
|
|
1883
|
-
filteredTexts.map((txt) => /* @__PURE__ */
|
|
2026
|
+
filteredTexts.map((txt) => /* @__PURE__ */ jsx13(
|
|
1884
2027
|
Text,
|
|
1885
2028
|
{
|
|
1886
2029
|
textObj: txt,
|
|
@@ -1889,7 +2032,7 @@ var InteractiveGraphics = ({
|
|
|
1889
2032
|
},
|
|
1890
2033
|
txt.originalIndex
|
|
1891
2034
|
)),
|
|
1892
|
-
/* @__PURE__ */
|
|
2035
|
+
/* @__PURE__ */ jsx13(
|
|
1893
2036
|
SuperGrid,
|
|
1894
2037
|
{
|
|
1895
2038
|
stringifyCoord: (x, y) => `${x.toFixed(2)}, ${y.toFixed(2)}`,
|
|
@@ -1899,7 +2042,7 @@ var InteractiveGraphics = ({
|
|
|
1899
2042
|
}
|
|
1900
2043
|
)
|
|
1901
2044
|
] }),
|
|
1902
|
-
markers.map((marker, index) => /* @__PURE__ */
|
|
2045
|
+
markers.map((marker, index) => /* @__PURE__ */ jsx13(
|
|
1903
2046
|
Marker,
|
|
1904
2047
|
{
|
|
1905
2048
|
marker,
|
|
@@ -1908,7 +2051,7 @@ var InteractiveGraphics = ({
|
|
|
1908
2051
|
},
|
|
1909
2052
|
index
|
|
1910
2053
|
)),
|
|
1911
|
-
contextMenu && /* @__PURE__ */
|
|
2054
|
+
contextMenu && /* @__PURE__ */ jsx13(
|
|
1912
2055
|
ContextMenu,
|
|
1913
2056
|
{
|
|
1914
2057
|
x: contextMenu.x,
|
|
@@ -1951,6 +2094,9 @@ function getGraphicsFilteredByStep(graphics, {
|
|
|
1951
2094
|
lines: graphics.lines?.filter(
|
|
1952
2095
|
(l) => l.step === void 0 || l.step === selectedStep
|
|
1953
2096
|
),
|
|
2097
|
+
infiniteLines: graphics.infiniteLines?.filter(
|
|
2098
|
+
(l) => l.step === void 0 || l.step === selectedStep
|
|
2099
|
+
),
|
|
1954
2100
|
rects: graphics.rects?.filter(
|
|
1955
2101
|
(r) => r.step === void 0 || r.step === selectedStep
|
|
1956
2102
|
),
|
|
@@ -1981,7 +2127,7 @@ function getGraphicsBoundsWithPadding(graphics) {
|
|
|
1981
2127
|
}
|
|
1982
2128
|
|
|
1983
2129
|
// site/components/InteractiveGraphicsCanvas.tsx
|
|
1984
|
-
import { jsx as
|
|
2130
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1985
2131
|
function InteractiveGraphicsCanvas({
|
|
1986
2132
|
graphics,
|
|
1987
2133
|
showLabelsByDefault = true,
|
|
@@ -2089,11 +2235,11 @@ function InteractiveGraphicsCanvas({
|
|
|
2089
2235
|
useEffect4(() => {
|
|
2090
2236
|
drawCanvas();
|
|
2091
2237
|
}, [transform, size, filteredGraphics, showGrid, showLabels]);
|
|
2092
|
-
return /* @__PURE__ */
|
|
2093
|
-
/* @__PURE__ */
|
|
2094
|
-
/* @__PURE__ */
|
|
2095
|
-
/* @__PURE__ */
|
|
2096
|
-
/* @__PURE__ */
|
|
2238
|
+
return /* @__PURE__ */ jsxs9("div", { style: { display: "flex", flexDirection: "column", gap: "10px" }, children: [
|
|
2239
|
+
/* @__PURE__ */ jsxs9("div", { style: { display: "flex", gap: "12px", alignItems: "center" }, children: [
|
|
2240
|
+
/* @__PURE__ */ jsxs9("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
|
|
2241
|
+
/* @__PURE__ */ jsxs9("label", { children: [
|
|
2242
|
+
/* @__PURE__ */ jsx14(
|
|
2097
2243
|
"input",
|
|
2098
2244
|
{
|
|
2099
2245
|
type: "checkbox",
|
|
@@ -2106,7 +2252,7 @@ function InteractiveGraphicsCanvas({
|
|
|
2106
2252
|
),
|
|
2107
2253
|
"Filter by step"
|
|
2108
2254
|
] }),
|
|
2109
|
-
/* @__PURE__ */
|
|
2255
|
+
/* @__PURE__ */ jsx14(
|
|
2110
2256
|
"input",
|
|
2111
2257
|
{
|
|
2112
2258
|
type: "number",
|
|
@@ -2122,8 +2268,8 @@ function InteractiveGraphicsCanvas({
|
|
|
2122
2268
|
style: { width: "60px" }
|
|
2123
2269
|
}
|
|
2124
2270
|
),
|
|
2125
|
-
/* @__PURE__ */
|
|
2126
|
-
/* @__PURE__ */
|
|
2271
|
+
/* @__PURE__ */ jsxs9("label", { children: [
|
|
2272
|
+
/* @__PURE__ */ jsx14(
|
|
2127
2273
|
"input",
|
|
2128
2274
|
{
|
|
2129
2275
|
type: "checkbox",
|
|
@@ -2138,8 +2284,8 @@ function InteractiveGraphicsCanvas({
|
|
|
2138
2284
|
"Show last step"
|
|
2139
2285
|
] })
|
|
2140
2286
|
] }),
|
|
2141
|
-
/* @__PURE__ */
|
|
2142
|
-
/* @__PURE__ */
|
|
2287
|
+
/* @__PURE__ */ jsx14("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: /* @__PURE__ */ jsxs9("label", { children: [
|
|
2288
|
+
/* @__PURE__ */ jsx14(
|
|
2143
2289
|
"input",
|
|
2144
2290
|
{
|
|
2145
2291
|
type: "checkbox",
|
|
@@ -2153,7 +2299,7 @@ function InteractiveGraphicsCanvas({
|
|
|
2153
2299
|
"Show labels"
|
|
2154
2300
|
] }) })
|
|
2155
2301
|
] }),
|
|
2156
|
-
/* @__PURE__ */
|
|
2302
|
+
/* @__PURE__ */ jsx14(
|
|
2157
2303
|
"div",
|
|
2158
2304
|
{
|
|
2159
2305
|
ref: (node) => {
|
|
@@ -2169,7 +2315,7 @@ function InteractiveGraphicsCanvas({
|
|
|
2169
2315
|
border: "1px solid #ccc",
|
|
2170
2316
|
overflow: "hidden"
|
|
2171
2317
|
},
|
|
2172
|
-
children: /* @__PURE__ */
|
|
2318
|
+
children: /* @__PURE__ */ jsx14(
|
|
2173
2319
|
"canvas",
|
|
2174
2320
|
{
|
|
2175
2321
|
ref: canvasRef,
|
|
@@ -2192,7 +2338,7 @@ import React2, { useRef as useRef5, useEffect as useEffect5, useState as useStat
|
|
|
2192
2338
|
import useMouseMatrixTransform3 from "use-mouse-matrix-transform";
|
|
2193
2339
|
import { compose as compose3, scale as scale3, translate as translate3 } from "transformation-matrix";
|
|
2194
2340
|
import useResizeObserver3 from "@react-hook/resize-observer";
|
|
2195
|
-
import { jsx as
|
|
2341
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2196
2342
|
function TransformContainer({
|
|
2197
2343
|
initialTransform,
|
|
2198
2344
|
children,
|
|
@@ -2204,7 +2350,7 @@ function TransformContainer({
|
|
|
2204
2350
|
useEffect5(() => {
|
|
2205
2351
|
onTransformChange(transform);
|
|
2206
2352
|
}, [transform, onTransformChange]);
|
|
2207
|
-
return /* @__PURE__ */
|
|
2353
|
+
return /* @__PURE__ */ jsx15(
|
|
2208
2354
|
"div",
|
|
2209
2355
|
{
|
|
2210
2356
|
ref,
|
|
@@ -2340,7 +2486,7 @@ var CanvasGraphics = ({
|
|
|
2340
2486
|
useEffect5(() => {
|
|
2341
2487
|
setCurrentTransform(computedInitialTransform);
|
|
2342
2488
|
}, [computedInitialTransform]);
|
|
2343
|
-
return /* @__PURE__ */
|
|
2489
|
+
return /* @__PURE__ */ jsx15(
|
|
2344
2490
|
"div",
|
|
2345
2491
|
{
|
|
2346
2492
|
ref: containerRef,
|
|
@@ -2351,16 +2497,16 @@ var CanvasGraphics = ({
|
|
|
2351
2497
|
border: "1px solid #eee",
|
|
2352
2498
|
overflow: "hidden"
|
|
2353
2499
|
},
|
|
2354
|
-
children: /* @__PURE__ */
|
|
2500
|
+
children: /* @__PURE__ */ jsx15(
|
|
2355
2501
|
TransformContainer,
|
|
2356
2502
|
{
|
|
2357
2503
|
initialTransform: computedInitialTransform,
|
|
2358
2504
|
onTransformChange: handleTransformChange,
|
|
2359
|
-
children: /* @__PURE__ */
|
|
2505
|
+
children: /* @__PURE__ */ jsx15(
|
|
2360
2506
|
DimensionOverlay,
|
|
2361
2507
|
{
|
|
2362
2508
|
transform: currentTransform || computedInitialTransform,
|
|
2363
|
-
children: /* @__PURE__ */
|
|
2509
|
+
children: /* @__PURE__ */ jsx15(
|
|
2364
2510
|
"canvas",
|
|
2365
2511
|
{
|
|
2366
2512
|
ref: canvasRef,
|