graphics-debug 0.0.65 → 0.0.66
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/README.md +14 -0
- package/dist/chunk-62J5EOWN.js +108 -0
- package/dist/chunk-62J5EOWN.js.map +1 -0
- package/dist/{chunk-TJJMMKHI.js → chunk-B2WYIXWQ.js} +2 -1
- package/dist/chunk-B2WYIXWQ.js.map +1 -0
- package/dist/{chunk-K5GFS6QZ.js → chunk-TVUC4YPH.js} +6 -6
- package/dist/{chunk-4LFM7XSX.js → chunk-UD7LT2L3.js} +64 -1
- package/dist/chunk-UD7LT2L3.js.map +1 -0
- package/dist/{chunk-K2IJQPPY.js → chunk-WFPC5ZH3.js} +6 -1
- package/dist/chunk-WFPC5ZH3.js.map +1 -0
- package/dist/{chunk-YWTEDOCO.js → chunk-XGME63R3.js} +2 -2
- package/dist/chunk-XGME63R3.js.map +1 -0
- package/dist/{chunk-ARYXS3GC.js → chunk-ZV4UNKKF.js} +41 -1
- package/dist/chunk-ZV4UNKKF.js.map +1 -0
- package/dist/cli/cli.js +7 -6
- package/dist/cli/cli.js.map +1 -1
- package/dist/lib/arrowHelpers.d.ts +45 -0
- package/dist/lib/arrowHelpers.js +9 -0
- package/dist/lib/arrowHelpers.js.map +1 -0
- package/dist/lib/drawGraphicsToCanvas.js +2 -1
- package/dist/lib/getSvgFromGraphicsObject.js +2 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +9 -8
- package/dist/lib/matcher.js +2 -1
- 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 +296 -143
- package/dist/lib/react.js.map +1 -1
- package/dist/lib/stackGraphics.js +5 -4
- package/dist/lib/translateGraphics.js +1 -1
- package/dist/lib/types.d.ts +14 -1
- package/package.json +1 -1
- package/dist/chunk-4LFM7XSX.js.map +0 -1
- package/dist/chunk-ARYXS3GC.js.map +0 -1
- package/dist/chunk-K2IJQPPY.js.map +0 -1
- package/dist/chunk-TJJMMKHI.js.map +0 -1
- package/dist/chunk-YWTEDOCO.js.map +0 -1
- /package/dist/{chunk-K5GFS6QZ.js.map → chunk-TVUC4YPH.js.map} +0 -0
package/dist/lib/react.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import "../chunk-
|
|
2
|
-
import "../chunk-
|
|
3
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-XGME63R3.js";
|
|
2
|
+
import "../chunk-TVUC4YPH.js";
|
|
3
|
+
import "../chunk-B2WYIXWQ.js";
|
|
4
|
+
import "../chunk-WFPC5ZH3.js";
|
|
4
5
|
import {
|
|
5
6
|
defaultColors,
|
|
6
7
|
drawGraphicsToCanvas,
|
|
7
8
|
getBounds
|
|
8
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-ZV4UNKKF.js";
|
|
9
10
|
import "../chunk-NG6H63SM.js";
|
|
10
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-UD7LT2L3.js";
|
|
12
|
+
import {
|
|
13
|
+
getArrowBoundingBox,
|
|
14
|
+
getArrowGeometry
|
|
15
|
+
} from "../chunk-62J5EOWN.js";
|
|
11
16
|
import "../chunk-ZGI74PYD.js";
|
|
12
|
-
import "../chunk-TJJMMKHI.js";
|
|
13
17
|
|
|
14
18
|
// site/components/InteractiveGraphics/InteractiveGraphics.tsx
|
|
15
19
|
import {
|
|
@@ -17,9 +21,9 @@ import {
|
|
|
17
21
|
scale,
|
|
18
22
|
translate,
|
|
19
23
|
inverse as inverse2,
|
|
20
|
-
applyToPoint as
|
|
24
|
+
applyToPoint as applyToPoint12
|
|
21
25
|
} from "transformation-matrix";
|
|
22
|
-
import { useMemo as
|
|
26
|
+
import { useMemo as useMemo10, useState as useState7, useEffect as useEffect3, useCallback } from "react";
|
|
23
27
|
import useMouseMatrixTransform from "use-mouse-matrix-transform";
|
|
24
28
|
import { SuperGrid } from "react-supergrid";
|
|
25
29
|
import useResizeObserver from "@react-hook/resize-observer";
|
|
@@ -399,6 +403,99 @@ var Text = ({
|
|
|
399
403
|
);
|
|
400
404
|
};
|
|
401
405
|
|
|
406
|
+
// site/components/InteractiveGraphics/Arrow.tsx
|
|
407
|
+
import { applyToPoint as applyToPoint6 } from "transformation-matrix";
|
|
408
|
+
import { useMemo, useState as useState5 } from "react";
|
|
409
|
+
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
410
|
+
var Arrow = ({
|
|
411
|
+
arrow,
|
|
412
|
+
index,
|
|
413
|
+
interactiveState
|
|
414
|
+
}) => {
|
|
415
|
+
const { realToScreen, onObjectClicked } = interactiveState;
|
|
416
|
+
const [isHovered, setIsHovered] = useState5(false);
|
|
417
|
+
const geometry = useMemo(() => getArrowGeometry(arrow), [arrow]);
|
|
418
|
+
const screenPoints = useMemo(() => {
|
|
419
|
+
return {
|
|
420
|
+
shaftStart: applyToPoint6(realToScreen, geometry.shaftStart),
|
|
421
|
+
shaftEnd: applyToPoint6(realToScreen, geometry.shaftEnd),
|
|
422
|
+
heads: geometry.heads.map((head) => ({
|
|
423
|
+
tip: applyToPoint6(realToScreen, head.tip),
|
|
424
|
+
base: applyToPoint6(realToScreen, head.base),
|
|
425
|
+
leftWing: applyToPoint6(realToScreen, head.leftWing),
|
|
426
|
+
rightWing: applyToPoint6(realToScreen, head.rightWing)
|
|
427
|
+
}))
|
|
428
|
+
};
|
|
429
|
+
}, [geometry, realToScreen]);
|
|
430
|
+
const scaleFactor = useMemo(() => Math.hypot(realToScreen.a, realToScreen.b), [
|
|
431
|
+
realToScreen.a,
|
|
432
|
+
realToScreen.b
|
|
433
|
+
]);
|
|
434
|
+
const baseColor = arrow.color || defaultColors[index % defaultColors.length] || "black";
|
|
435
|
+
const displayColor = isHovered ? safeLighten(0.2, baseColor) : baseColor;
|
|
436
|
+
const handleMouseMove = (e) => {
|
|
437
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
438
|
+
const mouseX = e.clientX - rect.left;
|
|
439
|
+
const mouseY = e.clientY - rect.top;
|
|
440
|
+
const hoverThreshold = 10;
|
|
441
|
+
const segments = [
|
|
442
|
+
{ from: screenPoints.shaftStart, to: screenPoints.shaftEnd },
|
|
443
|
+
...screenPoints.heads.flatMap((head) => [
|
|
444
|
+
{ from: head.base, to: head.leftWing },
|
|
445
|
+
{ from: head.leftWing, to: head.tip },
|
|
446
|
+
{ from: head.tip, to: head.rightWing },
|
|
447
|
+
{ from: head.rightWing, to: head.base }
|
|
448
|
+
])
|
|
449
|
+
];
|
|
450
|
+
const isNear = segments.some(({ from, to }) => {
|
|
451
|
+
const distance = distToLineSegment(mouseX, mouseY, from.x, from.y, to.x, to.y);
|
|
452
|
+
return distance < hoverThreshold;
|
|
453
|
+
});
|
|
454
|
+
setIsHovered(isNear);
|
|
455
|
+
};
|
|
456
|
+
return /* @__PURE__ */ jsxs2(
|
|
457
|
+
"svg",
|
|
458
|
+
{
|
|
459
|
+
style: {
|
|
460
|
+
position: "absolute",
|
|
461
|
+
top: 0,
|
|
462
|
+
left: 0,
|
|
463
|
+
width: "100%",
|
|
464
|
+
height: "100%"
|
|
465
|
+
},
|
|
466
|
+
onMouseMove: handleMouseMove,
|
|
467
|
+
onMouseLeave: () => setIsHovered(false),
|
|
468
|
+
onClick: isHovered ? (event) => {
|
|
469
|
+
event.stopPropagation();
|
|
470
|
+
onObjectClicked?.({ type: "arrow", index, object: arrow });
|
|
471
|
+
} : void 0,
|
|
472
|
+
children: [
|
|
473
|
+
/* @__PURE__ */ jsx7(
|
|
474
|
+
"line",
|
|
475
|
+
{
|
|
476
|
+
x1: screenPoints.shaftStart.x,
|
|
477
|
+
y1: screenPoints.shaftStart.y,
|
|
478
|
+
x2: screenPoints.shaftEnd.x,
|
|
479
|
+
y2: screenPoints.shaftEnd.y,
|
|
480
|
+
stroke: displayColor,
|
|
481
|
+
strokeWidth: geometry.shaftWidth * (scaleFactor || 1),
|
|
482
|
+
strokeLinecap: "round",
|
|
483
|
+
pointerEvents: "stroke"
|
|
484
|
+
}
|
|
485
|
+
),
|
|
486
|
+
screenPoints.heads.map((head, headIndex) => /* @__PURE__ */ jsx7(
|
|
487
|
+
"polygon",
|
|
488
|
+
{
|
|
489
|
+
points: `${head.tip.x},${head.tip.y} ${head.leftWing.x},${head.leftWing.y} ${head.rightWing.x},${head.rightWing.y}`,
|
|
490
|
+
fill: displayColor
|
|
491
|
+
},
|
|
492
|
+
headIndex
|
|
493
|
+
))
|
|
494
|
+
]
|
|
495
|
+
}
|
|
496
|
+
);
|
|
497
|
+
};
|
|
498
|
+
|
|
402
499
|
// site/utils/getGraphicsBounds.ts
|
|
403
500
|
var getGraphicsBounds = (graphics) => {
|
|
404
501
|
const bounds = {
|
|
@@ -436,6 +533,13 @@ var getGraphicsBounds = (graphics) => {
|
|
|
436
533
|
bounds.maxX = Math.max(bounds.maxX, circle.center.x + circle.radius);
|
|
437
534
|
bounds.maxY = Math.max(bounds.maxY, circle.center.y + circle.radius);
|
|
438
535
|
}
|
|
536
|
+
for (const arrow of graphics.arrows ?? []) {
|
|
537
|
+
const arrowBounds = getArrowBoundingBox(arrow);
|
|
538
|
+
bounds.minX = Math.min(bounds.minX, arrowBounds.minX);
|
|
539
|
+
bounds.minY = Math.min(bounds.minY, arrowBounds.minY);
|
|
540
|
+
bounds.maxX = Math.max(bounds.maxX, arrowBounds.maxX);
|
|
541
|
+
bounds.maxY = Math.max(bounds.maxY, arrowBounds.maxY);
|
|
542
|
+
}
|
|
439
543
|
for (const text of graphics.texts ?? []) {
|
|
440
544
|
bounds.minX = Math.min(bounds.minX, text.x);
|
|
441
545
|
bounds.minY = Math.min(bounds.minY, text.y);
|
|
@@ -449,18 +553,18 @@ var getGraphicsBounds = (graphics) => {
|
|
|
449
553
|
var sortRectsByArea = (rects) => rects.slice().sort((a, b) => b.width * b.height - a.width * a.height);
|
|
450
554
|
|
|
451
555
|
// site/components/InteractiveGraphics/hooks/useIsPointOnScreen.ts
|
|
452
|
-
import { applyToPoint as
|
|
453
|
-
import { useMemo as
|
|
556
|
+
import { applyToPoint as applyToPoint8 } from "transformation-matrix";
|
|
557
|
+
import { useMemo as useMemo3 } from "react";
|
|
454
558
|
|
|
455
559
|
// site/components/InteractiveGraphics/hooks/useDoesLineIntersectViewport.ts
|
|
456
|
-
import { applyToPoint as
|
|
457
|
-
import { useMemo } from "react";
|
|
560
|
+
import { applyToPoint as applyToPoint7 } from "transformation-matrix";
|
|
561
|
+
import { useMemo as useMemo2 } from "react";
|
|
458
562
|
var OFFSCREEN_MARGIN = 5;
|
|
459
563
|
var useDoesLineIntersectViewport = (realToScreen, size) => {
|
|
460
|
-
return
|
|
564
|
+
return useMemo2(() => {
|
|
461
565
|
return (p1, p2) => {
|
|
462
|
-
const sp1 =
|
|
463
|
-
const sp2 =
|
|
566
|
+
const sp1 = applyToPoint7(realToScreen, p1);
|
|
567
|
+
const sp2 = applyToPoint7(realToScreen, p2);
|
|
464
568
|
const left = -OFFSCREEN_MARGIN;
|
|
465
569
|
const right = size.width + OFFSCREEN_MARGIN;
|
|
466
570
|
const top = -OFFSCREEN_MARGIN;
|
|
@@ -488,18 +592,18 @@ var useDoesLineIntersectViewport = (realToScreen, size) => {
|
|
|
488
592
|
|
|
489
593
|
// site/components/InteractiveGraphics/hooks/useIsPointOnScreen.ts
|
|
490
594
|
var useIsPointOnScreen = (realToScreen, size) => {
|
|
491
|
-
return
|
|
595
|
+
return useMemo3(() => {
|
|
492
596
|
return (point) => {
|
|
493
|
-
const screenPoint =
|
|
597
|
+
const screenPoint = applyToPoint8(realToScreen, point);
|
|
494
598
|
return screenPoint.x >= -OFFSCREEN_MARGIN && screenPoint.x <= size.width + OFFSCREEN_MARGIN && screenPoint.y >= -OFFSCREEN_MARGIN && screenPoint.y <= size.height + OFFSCREEN_MARGIN;
|
|
495
599
|
};
|
|
496
600
|
}, [realToScreen, size]);
|
|
497
601
|
};
|
|
498
602
|
|
|
499
603
|
// site/components/InteractiveGraphics/hooks/useFilterLines.ts
|
|
500
|
-
import { useMemo as
|
|
604
|
+
import { useMemo as useMemo4 } from "react";
|
|
501
605
|
var useFilterLines = (isPointOnScreen, doesLineIntersectViewport, filterLayerAndStep) => {
|
|
502
|
-
return
|
|
606
|
+
return useMemo4(() => {
|
|
503
607
|
return (line) => {
|
|
504
608
|
if (!filterLayerAndStep(line)) return false;
|
|
505
609
|
if (line.points.some((p) => isPointOnScreen(p))) {
|
|
@@ -524,9 +628,9 @@ var useFilterLines = (isPointOnScreen, doesLineIntersectViewport, filterLayerAnd
|
|
|
524
628
|
};
|
|
525
629
|
|
|
526
630
|
// site/components/InteractiveGraphics/hooks/useFilterPoints.ts
|
|
527
|
-
import { useMemo as
|
|
631
|
+
import { useMemo as useMemo5 } from "react";
|
|
528
632
|
var useFilterPoints = (isPointOnScreen, filterLayerAndStep) => {
|
|
529
|
-
return
|
|
633
|
+
return useMemo5(() => {
|
|
530
634
|
return (point) => {
|
|
531
635
|
if (!filterLayerAndStep(point)) return false;
|
|
532
636
|
return isPointOnScreen(point);
|
|
@@ -535,9 +639,9 @@ var useFilterPoints = (isPointOnScreen, filterLayerAndStep) => {
|
|
|
535
639
|
};
|
|
536
640
|
|
|
537
641
|
// site/components/InteractiveGraphics/hooks/useFilterRects.ts
|
|
538
|
-
import { useMemo as
|
|
642
|
+
import { useMemo as useMemo6 } from "react";
|
|
539
643
|
var useFilterRects = (isPointOnScreen, doesLineIntersectViewport, filterLayerAndStep) => {
|
|
540
|
-
return
|
|
644
|
+
return useMemo6(() => {
|
|
541
645
|
return (rect) => {
|
|
542
646
|
if (!filterLayerAndStep(rect)) return false;
|
|
543
647
|
const { center, width, height } = rect;
|
|
@@ -556,17 +660,17 @@ var useFilterRects = (isPointOnScreen, doesLineIntersectViewport, filterLayerAnd
|
|
|
556
660
|
};
|
|
557
661
|
|
|
558
662
|
// site/components/InteractiveGraphics/hooks/useFilterCircles.ts
|
|
559
|
-
import { applyToPoint as
|
|
560
|
-
import { useMemo as
|
|
663
|
+
import { applyToPoint as applyToPoint9 } from "transformation-matrix";
|
|
664
|
+
import { useMemo as useMemo7 } from "react";
|
|
561
665
|
var useFilterCircles = (isPointOnScreen, filterLayerAndStep, realToScreen, size) => {
|
|
562
|
-
return
|
|
666
|
+
return useMemo7(() => {
|
|
563
667
|
return (circle) => {
|
|
564
668
|
if (!filterLayerAndStep(circle)) return false;
|
|
565
669
|
const { center, radius } = circle;
|
|
566
670
|
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 })) {
|
|
567
671
|
return true;
|
|
568
672
|
}
|
|
569
|
-
const screenCenter =
|
|
673
|
+
const screenCenter = applyToPoint9(realToScreen, center);
|
|
570
674
|
const scale4 = Math.abs(realToScreen.a);
|
|
571
675
|
const screenRadius = radius * scale4;
|
|
572
676
|
const left = -OFFSCREEN_MARGIN;
|
|
@@ -595,9 +699,9 @@ var useFilterCircles = (isPointOnScreen, filterLayerAndStep, realToScreen, size)
|
|
|
595
699
|
};
|
|
596
700
|
|
|
597
701
|
// site/components/InteractiveGraphics/hooks/useFilterTexts.ts
|
|
598
|
-
import { useMemo as
|
|
702
|
+
import { useMemo as useMemo8 } from "react";
|
|
599
703
|
var useFilterTexts = (isPointOnScreen, filterLayerAndStep) => {
|
|
600
|
-
return
|
|
704
|
+
return useMemo8(() => {
|
|
601
705
|
return (text) => {
|
|
602
706
|
if (!filterLayerAndStep(text)) return false;
|
|
603
707
|
return isPointOnScreen({ x: text.x, y: text.y });
|
|
@@ -605,16 +709,42 @@ var useFilterTexts = (isPointOnScreen, filterLayerAndStep) => {
|
|
|
605
709
|
}, [isPointOnScreen, filterLayerAndStep]);
|
|
606
710
|
};
|
|
607
711
|
|
|
712
|
+
// site/components/InteractiveGraphics/hooks/useFilterArrows.ts
|
|
713
|
+
import { useMemo as useMemo9 } from "react";
|
|
714
|
+
var useFilterArrows = (isPointOnScreen, doesLineIntersectViewport) => {
|
|
715
|
+
return useMemo9(() => {
|
|
716
|
+
return (arrow) => {
|
|
717
|
+
const geometry = getArrowGeometry(arrow);
|
|
718
|
+
const { shaftStart, shaftEnd, heads } = geometry;
|
|
719
|
+
if (isPointOnScreen(shaftStart) || isPointOnScreen(shaftEnd) || heads.some(
|
|
720
|
+
(head) => isPointOnScreen(head.tip) || isPointOnScreen(head.leftWing) || isPointOnScreen(head.rightWing) || isPointOnScreen(head.base)
|
|
721
|
+
)) {
|
|
722
|
+
return true;
|
|
723
|
+
}
|
|
724
|
+
const segments = [
|
|
725
|
+
[shaftStart, shaftEnd],
|
|
726
|
+
...heads.flatMap((head) => [
|
|
727
|
+
[head.base, head.leftWing],
|
|
728
|
+
[head.leftWing, head.tip],
|
|
729
|
+
[head.tip, head.rightWing],
|
|
730
|
+
[head.rightWing, head.base]
|
|
731
|
+
])
|
|
732
|
+
];
|
|
733
|
+
return segments.some(([p1, p2]) => doesLineIntersectViewport(p1, p2));
|
|
734
|
+
};
|
|
735
|
+
}, [isPointOnScreen, doesLineIntersectViewport]);
|
|
736
|
+
};
|
|
737
|
+
|
|
608
738
|
// site/components/DimensionOverlay.tsx
|
|
609
|
-
import { useEffect, useRef, useState as
|
|
610
|
-
import { applyToPoint as
|
|
611
|
-
import { Fragment, jsx as
|
|
739
|
+
import { useEffect, useRef, useState as useState6 } from "react";
|
|
740
|
+
import { applyToPoint as applyToPoint10, identity, inverse } from "transformation-matrix";
|
|
741
|
+
import { Fragment, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
612
742
|
var DimensionOverlay = ({ children, transform }) => {
|
|
613
743
|
if (!transform) transform = identity();
|
|
614
|
-
const [dimensionToolVisible, setDimensionToolVisible] =
|
|
615
|
-
const [dimensionToolStretching, setDimensionToolStretching] =
|
|
616
|
-
const [dStart, setDStart] =
|
|
617
|
-
const [dEnd, setDEnd] =
|
|
744
|
+
const [dimensionToolVisible, setDimensionToolVisible] = useState6(false);
|
|
745
|
+
const [dimensionToolStretching, setDimensionToolStretching] = useState6(false);
|
|
746
|
+
const [dStart, setDStart] = useState6({ x: 0, y: 0 });
|
|
747
|
+
const [dEnd, setDEnd] = useState6({ x: 0, y: 0 });
|
|
618
748
|
const mousePosRef = useRef({ x: 0, y: 0 });
|
|
619
749
|
const containerRef = useRef(null);
|
|
620
750
|
const container = containerRef.current;
|
|
@@ -661,8 +791,8 @@ var DimensionOverlay = ({ children, transform }) => {
|
|
|
661
791
|
};
|
|
662
792
|
};
|
|
663
793
|
useEffect(bindKeys, [containerBounds?.width, containerBounds?.height]);
|
|
664
|
-
const screenDStart =
|
|
665
|
-
const screenDEnd =
|
|
794
|
+
const screenDStart = applyToPoint10(transform, dStart);
|
|
795
|
+
const screenDEnd = applyToPoint10(transform, dEnd);
|
|
666
796
|
const arrowScreenBounds = {
|
|
667
797
|
left: Math.min(screenDStart.x, screenDEnd.x),
|
|
668
798
|
right: Math.max(screenDStart.x, screenDEnd.x),
|
|
@@ -675,7 +805,7 @@ var DimensionOverlay = ({ children, transform }) => {
|
|
|
675
805
|
};
|
|
676
806
|
arrowScreenBounds.width = arrowScreenBounds.right - arrowScreenBounds.left;
|
|
677
807
|
arrowScreenBounds.height = arrowScreenBounds.bottom - arrowScreenBounds.top;
|
|
678
|
-
return /* @__PURE__ */
|
|
808
|
+
return /* @__PURE__ */ jsxs3(
|
|
679
809
|
"div",
|
|
680
810
|
{
|
|
681
811
|
ref: containerRef,
|
|
@@ -685,7 +815,7 @@ var DimensionOverlay = ({ children, transform }) => {
|
|
|
685
815
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
686
816
|
const x = e.clientX - rect.left;
|
|
687
817
|
const y = e.clientY - rect.top;
|
|
688
|
-
const rwPoint =
|
|
818
|
+
const rwPoint = applyToPoint10(inverse(transform), { x, y });
|
|
689
819
|
mousePosRef.current.x = rwPoint.x;
|
|
690
820
|
mousePosRef.current.y = rwPoint.y;
|
|
691
821
|
if (dimensionToolStretching) {
|
|
@@ -706,8 +836,8 @@ var DimensionOverlay = ({ children, transform }) => {
|
|
|
706
836
|
},
|
|
707
837
|
children: [
|
|
708
838
|
children,
|
|
709
|
-
dimensionToolVisible && /* @__PURE__ */
|
|
710
|
-
/* @__PURE__ */
|
|
839
|
+
dimensionToolVisible && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
840
|
+
/* @__PURE__ */ jsx8(
|
|
711
841
|
"div",
|
|
712
842
|
{
|
|
713
843
|
style: {
|
|
@@ -727,7 +857,7 @@ var DimensionOverlay = ({ children, transform }) => {
|
|
|
727
857
|
children: Math.abs(dStart.x - dEnd.x).toFixed(2)
|
|
728
858
|
}
|
|
729
859
|
),
|
|
730
|
-
/* @__PURE__ */
|
|
860
|
+
/* @__PURE__ */ jsx8(
|
|
731
861
|
"div",
|
|
732
862
|
{
|
|
733
863
|
style: {
|
|
@@ -745,7 +875,7 @@ var DimensionOverlay = ({ children, transform }) => {
|
|
|
745
875
|
fontFamily: "sans-serif",
|
|
746
876
|
zIndex: 30
|
|
747
877
|
},
|
|
748
|
-
children: /* @__PURE__ */
|
|
878
|
+
children: /* @__PURE__ */ jsx8(
|
|
749
879
|
"div",
|
|
750
880
|
{
|
|
751
881
|
style: {
|
|
@@ -757,7 +887,7 @@ var DimensionOverlay = ({ children, transform }) => {
|
|
|
757
887
|
)
|
|
758
888
|
}
|
|
759
889
|
),
|
|
760
|
-
/* @__PURE__ */
|
|
890
|
+
/* @__PURE__ */ jsxs3(
|
|
761
891
|
"svg",
|
|
762
892
|
{
|
|
763
893
|
style: {
|
|
@@ -771,7 +901,7 @@ var DimensionOverlay = ({ children, transform }) => {
|
|
|
771
901
|
width: containerBounds?.width || "100%",
|
|
772
902
|
height: containerBounds?.height || "100%",
|
|
773
903
|
children: [
|
|
774
|
-
/* @__PURE__ */
|
|
904
|
+
/* @__PURE__ */ jsx8("defs", { children: /* @__PURE__ */ jsx8(
|
|
775
905
|
"marker",
|
|
776
906
|
{
|
|
777
907
|
id: "head",
|
|
@@ -780,10 +910,10 @@ var DimensionOverlay = ({ children, transform }) => {
|
|
|
780
910
|
markerHeight: "4",
|
|
781
911
|
refX: "2",
|
|
782
912
|
refY: "2",
|
|
783
|
-
children: /* @__PURE__ */
|
|
913
|
+
children: /* @__PURE__ */ jsx8("path", { d: "M0,0 V4 L2,2 Z", fill: "red" })
|
|
784
914
|
}
|
|
785
915
|
) }),
|
|
786
|
-
/* @__PURE__ */
|
|
916
|
+
/* @__PURE__ */ jsx8(
|
|
787
917
|
"line",
|
|
788
918
|
{
|
|
789
919
|
x1: screenDStart.x,
|
|
@@ -796,7 +926,7 @@ var DimensionOverlay = ({ children, transform }) => {
|
|
|
796
926
|
stroke: "red"
|
|
797
927
|
}
|
|
798
928
|
),
|
|
799
|
-
/* @__PURE__ */
|
|
929
|
+
/* @__PURE__ */ jsx8(
|
|
800
930
|
"line",
|
|
801
931
|
{
|
|
802
932
|
x1: screenDStart.x,
|
|
@@ -809,7 +939,7 @@ var DimensionOverlay = ({ children, transform }) => {
|
|
|
809
939
|
stroke: "red"
|
|
810
940
|
}
|
|
811
941
|
),
|
|
812
|
-
/* @__PURE__ */
|
|
942
|
+
/* @__PURE__ */ jsx8(
|
|
813
943
|
"line",
|
|
814
944
|
{
|
|
815
945
|
x1: screenDEnd.x,
|
|
@@ -825,7 +955,7 @@ var DimensionOverlay = ({ children, transform }) => {
|
|
|
825
955
|
]
|
|
826
956
|
}
|
|
827
957
|
),
|
|
828
|
-
/* @__PURE__ */
|
|
958
|
+
/* @__PURE__ */ jsxs3(
|
|
829
959
|
"div",
|
|
830
960
|
{
|
|
831
961
|
style: {
|
|
@@ -843,13 +973,13 @@ var DimensionOverlay = ({ children, transform }) => {
|
|
|
843
973
|
",",
|
|
844
974
|
dStart.y.toFixed(2),
|
|
845
975
|
")",
|
|
846
|
-
/* @__PURE__ */
|
|
976
|
+
/* @__PURE__ */ jsx8("br", {}),
|
|
847
977
|
"(",
|
|
848
978
|
dEnd.x.toFixed(2),
|
|
849
979
|
",",
|
|
850
980
|
dEnd.y.toFixed(2),
|
|
851
981
|
")",
|
|
852
|
-
/* @__PURE__ */
|
|
982
|
+
/* @__PURE__ */ jsx8("br", {}),
|
|
853
983
|
"dist:",
|
|
854
984
|
" ",
|
|
855
985
|
Math.sqrt(
|
|
@@ -878,18 +1008,20 @@ function getMaxStep(graphics) {
|
|
|
878
1008
|
const maxRectStep = getMaxStepFromArray(graphics.rects);
|
|
879
1009
|
const maxCircleStep = getMaxStepFromArray(graphics.circles);
|
|
880
1010
|
const maxTextStep = getMaxStepFromArray(graphics.texts);
|
|
1011
|
+
const maxArrowStep = getMaxStepFromArray(graphics.arrows);
|
|
881
1012
|
return Math.max(
|
|
882
1013
|
maxPointStep,
|
|
883
1014
|
maxLineStep,
|
|
884
1015
|
maxRectStep,
|
|
885
1016
|
maxCircleStep,
|
|
886
|
-
maxTextStep
|
|
1017
|
+
maxTextStep,
|
|
1018
|
+
maxArrowStep
|
|
887
1019
|
);
|
|
888
1020
|
}
|
|
889
1021
|
|
|
890
1022
|
// site/components/InteractiveGraphics/ContextMenu.tsx
|
|
891
1023
|
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
892
|
-
import { jsx as
|
|
1024
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
893
1025
|
var ContextMenu = ({
|
|
894
1026
|
x,
|
|
895
1027
|
y,
|
|
@@ -937,8 +1069,8 @@ var ContextMenu = ({
|
|
|
937
1069
|
const handleItemLeave = (e) => {
|
|
938
1070
|
e.currentTarget.style.backgroundColor = "";
|
|
939
1071
|
};
|
|
940
|
-
return /* @__PURE__ */
|
|
941
|
-
/* @__PURE__ */
|
|
1072
|
+
return /* @__PURE__ */ jsxs4("div", { ref: menuRef, style: menuStyle, children: [
|
|
1073
|
+
/* @__PURE__ */ jsx9(
|
|
942
1074
|
"div",
|
|
943
1075
|
{
|
|
944
1076
|
style: menuItemStyle,
|
|
@@ -951,7 +1083,7 @@ var ContextMenu = ({
|
|
|
951
1083
|
children: "Save Camera Position"
|
|
952
1084
|
}
|
|
953
1085
|
),
|
|
954
|
-
/* @__PURE__ */
|
|
1086
|
+
/* @__PURE__ */ jsx9(
|
|
955
1087
|
"div",
|
|
956
1088
|
{
|
|
957
1089
|
style: menuItemStyle,
|
|
@@ -964,7 +1096,7 @@ var ContextMenu = ({
|
|
|
964
1096
|
children: "Load Camera Position"
|
|
965
1097
|
}
|
|
966
1098
|
),
|
|
967
|
-
/* @__PURE__ */
|
|
1099
|
+
/* @__PURE__ */ jsx9(
|
|
968
1100
|
"div",
|
|
969
1101
|
{
|
|
970
1102
|
style: menuItemStyle,
|
|
@@ -977,7 +1109,7 @@ var ContextMenu = ({
|
|
|
977
1109
|
children: "Clear Saved Camera Position"
|
|
978
1110
|
}
|
|
979
1111
|
),
|
|
980
|
-
/* @__PURE__ */
|
|
1112
|
+
/* @__PURE__ */ jsx9(
|
|
981
1113
|
"div",
|
|
982
1114
|
{
|
|
983
1115
|
style: menuItemStyle,
|
|
@@ -990,7 +1122,7 @@ var ContextMenu = ({
|
|
|
990
1122
|
children: "Add Mark"
|
|
991
1123
|
}
|
|
992
1124
|
),
|
|
993
|
-
/* @__PURE__ */
|
|
1125
|
+
/* @__PURE__ */ jsx9(
|
|
994
1126
|
"div",
|
|
995
1127
|
{
|
|
996
1128
|
style: menuItemStyle,
|
|
@@ -1007,11 +1139,11 @@ var ContextMenu = ({
|
|
|
1007
1139
|
};
|
|
1008
1140
|
|
|
1009
1141
|
// site/components/InteractiveGraphics/Marker.tsx
|
|
1010
|
-
import { applyToPoint as
|
|
1011
|
-
import { jsx as
|
|
1142
|
+
import { applyToPoint as applyToPoint11 } from "transformation-matrix";
|
|
1143
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1012
1144
|
var Marker = ({ marker, transform }) => {
|
|
1013
|
-
const [screenX, screenY] =
|
|
1014
|
-
return /* @__PURE__ */
|
|
1145
|
+
const [screenX, screenY] = applyToPoint11(transform, [marker.x, marker.y]);
|
|
1146
|
+
return /* @__PURE__ */ jsx10(
|
|
1015
1147
|
"svg",
|
|
1016
1148
|
{
|
|
1017
1149
|
style: {
|
|
@@ -1021,8 +1153,8 @@ var Marker = ({ marker, transform }) => {
|
|
|
1021
1153
|
pointerEvents: "none",
|
|
1022
1154
|
zIndex: 900
|
|
1023
1155
|
},
|
|
1024
|
-
children: /* @__PURE__ */
|
|
1025
|
-
/* @__PURE__ */
|
|
1156
|
+
children: /* @__PURE__ */ jsxs5("g", { transform: `translate(${screenX}, ${screenY})`, children: [
|
|
1157
|
+
/* @__PURE__ */ jsx10(
|
|
1026
1158
|
"circle",
|
|
1027
1159
|
{
|
|
1028
1160
|
r: 7,
|
|
@@ -1031,35 +1163,36 @@ var Marker = ({ marker, transform }) => {
|
|
|
1031
1163
|
strokeWidth: 2
|
|
1032
1164
|
}
|
|
1033
1165
|
),
|
|
1034
|
-
/* @__PURE__ */
|
|
1166
|
+
/* @__PURE__ */ jsx10("circle", { r: 2, fill: "rgba(255, 0, 0, 0.9)" })
|
|
1035
1167
|
] })
|
|
1036
1168
|
}
|
|
1037
1169
|
);
|
|
1038
1170
|
};
|
|
1039
1171
|
|
|
1040
1172
|
// site/components/InteractiveGraphics/InteractiveGraphics.tsx
|
|
1041
|
-
import { jsx as
|
|
1173
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1042
1174
|
var InteractiveGraphics = ({
|
|
1043
1175
|
graphics,
|
|
1044
1176
|
onObjectClicked,
|
|
1045
1177
|
objectLimit
|
|
1046
1178
|
}) => {
|
|
1047
|
-
const [activeLayers, setActiveLayers] =
|
|
1048
|
-
const [activeStep, setActiveStep] =
|
|
1049
|
-
const [showLastStep, setShowLastStep] =
|
|
1050
|
-
const [size, setSize] =
|
|
1051
|
-
const [contextMenu, setContextMenu] =
|
|
1052
|
-
const [markers, setMarkers] =
|
|
1179
|
+
const [activeLayers, setActiveLayers] = useState7(null);
|
|
1180
|
+
const [activeStep, setActiveStep] = useState7(null);
|
|
1181
|
+
const [showLastStep, setShowLastStep] = useState7(true);
|
|
1182
|
+
const [size, setSize] = useState7({ width: 600, height: 600 });
|
|
1183
|
+
const [contextMenu, setContextMenu] = useState7(null);
|
|
1184
|
+
const [markers, setMarkers] = useState7([]);
|
|
1053
1185
|
const availableLayers = Array.from(
|
|
1054
1186
|
/* @__PURE__ */ new Set([
|
|
1055
1187
|
...graphics.lines?.map((l) => l.layer).filter(Boolean) ?? [],
|
|
1056
1188
|
...graphics.rects?.map((r) => r.layer).filter(Boolean) ?? [],
|
|
1057
1189
|
...graphics.points?.map((p) => p.layer).filter(Boolean) ?? [],
|
|
1058
|
-
...graphics.texts?.map((t) => t.layer).filter(Boolean) ?? []
|
|
1190
|
+
...graphics.texts?.map((t) => t.layer).filter(Boolean) ?? [],
|
|
1191
|
+
...graphics.circles?.map((c) => c.layer).filter(Boolean) ?? []
|
|
1059
1192
|
])
|
|
1060
1193
|
);
|
|
1061
1194
|
const maxStep = getMaxStep(graphics);
|
|
1062
|
-
const graphicsBoundsWithPadding =
|
|
1195
|
+
const graphicsBoundsWithPadding = useMemo10(() => {
|
|
1063
1196
|
const actualBounds = getGraphicsBounds(graphics);
|
|
1064
1197
|
const width = actualBounds.maxX - actualBounds.minX;
|
|
1065
1198
|
const height = actualBounds.maxY - actualBounds.minY;
|
|
@@ -1076,18 +1209,21 @@ var InteractiveGraphics = ({
|
|
|
1076
1209
|
return `saved-camera-position-${path}${search}`;
|
|
1077
1210
|
}, []);
|
|
1078
1211
|
const getDefaultTransform = useCallback(() => {
|
|
1212
|
+
const width = Math.max(
|
|
1213
|
+
graphicsBoundsWithPadding.maxX - graphicsBoundsWithPadding.minX,
|
|
1214
|
+
1
|
|
1215
|
+
);
|
|
1216
|
+
const height = Math.max(
|
|
1217
|
+
graphicsBoundsWithPadding.maxY - graphicsBoundsWithPadding.minY,
|
|
1218
|
+
1
|
|
1219
|
+
);
|
|
1220
|
+
const scaleFactor = Math.min(
|
|
1221
|
+
size.width / width,
|
|
1222
|
+
size.height / height
|
|
1223
|
+
);
|
|
1079
1224
|
return compose(
|
|
1080
1225
|
translate(size.width / 2, size.height / 2),
|
|
1081
|
-
scale(
|
|
1082
|
-
Math.min(
|
|
1083
|
-
size.width / (graphicsBoundsWithPadding.maxX - graphicsBoundsWithPadding.minX),
|
|
1084
|
-
size.height / (graphicsBoundsWithPadding.maxY - graphicsBoundsWithPadding.minY)
|
|
1085
|
-
),
|
|
1086
|
-
-Math.min(
|
|
1087
|
-
size.width / (graphicsBoundsWithPadding.maxX - graphicsBoundsWithPadding.minX),
|
|
1088
|
-
size.height / (graphicsBoundsWithPadding.maxY - graphicsBoundsWithPadding.minY)
|
|
1089
|
-
)
|
|
1090
|
-
),
|
|
1226
|
+
scale(scaleFactor, -scaleFactor),
|
|
1091
1227
|
translate(
|
|
1092
1228
|
-(graphicsBoundsWithPadding.maxX + graphicsBoundsWithPadding.minX) / 2,
|
|
1093
1229
|
-(graphicsBoundsWithPadding.maxY + graphicsBoundsWithPadding.minY) / 2
|
|
@@ -1199,7 +1335,7 @@ var InteractiveGraphics = ({
|
|
|
1199
1335
|
const screenX = screenPoint.x - rect.left;
|
|
1200
1336
|
const screenY = screenPoint.y - rect.top;
|
|
1201
1337
|
const inverseTransform = inverse2(realToScreen);
|
|
1202
|
-
const [realX, realY] =
|
|
1338
|
+
const [realX, realY] = applyToPoint12(inverseTransform, [
|
|
1203
1339
|
screenX,
|
|
1204
1340
|
screenY
|
|
1205
1341
|
]);
|
|
@@ -1260,36 +1396,44 @@ var InteractiveGraphics = ({
|
|
|
1260
1396
|
size
|
|
1261
1397
|
);
|
|
1262
1398
|
const filterTexts = useFilterTexts(isPointOnScreen, filterLayerAndStep);
|
|
1399
|
+
const filterArrows = useFilterArrows(
|
|
1400
|
+
isPointOnScreen,
|
|
1401
|
+
doesLineIntersectViewport
|
|
1402
|
+
);
|
|
1263
1403
|
const filterAndLimit = (objects, filterFn) => {
|
|
1264
1404
|
if (!objects) return [];
|
|
1265
1405
|
const filtered = objects.map((obj, index) => ({ ...obj, originalIndex: index })).filter(filterFn);
|
|
1266
1406
|
return objectLimit ? filtered.slice(-objectLimit) : filtered;
|
|
1267
1407
|
};
|
|
1268
|
-
const filteredLines =
|
|
1408
|
+
const filteredLines = useMemo10(
|
|
1269
1409
|
() => filterAndLimit(graphics.lines, filterLines),
|
|
1270
1410
|
[graphics.lines, filterLines, objectLimit]
|
|
1271
1411
|
);
|
|
1272
|
-
const filteredRects =
|
|
1412
|
+
const filteredRects = useMemo10(
|
|
1273
1413
|
() => sortRectsByArea(filterAndLimit(graphics.rects, filterRects)),
|
|
1274
1414
|
[graphics.rects, filterRects, objectLimit]
|
|
1275
1415
|
);
|
|
1276
|
-
const filteredPoints =
|
|
1416
|
+
const filteredPoints = useMemo10(
|
|
1277
1417
|
() => filterAndLimit(graphics.points, filterPoints),
|
|
1278
1418
|
[graphics.points, filterPoints, objectLimit]
|
|
1279
1419
|
);
|
|
1280
|
-
const filteredCircles =
|
|
1420
|
+
const filteredCircles = useMemo10(
|
|
1281
1421
|
() => filterAndLimit(graphics.circles, filterCircles),
|
|
1282
1422
|
[graphics.circles, filterCircles, objectLimit]
|
|
1283
1423
|
);
|
|
1284
|
-
const filteredTexts =
|
|
1424
|
+
const filteredTexts = useMemo10(
|
|
1285
1425
|
() => filterAndLimit(graphics.texts, filterTexts),
|
|
1286
1426
|
[graphics.texts, filterTexts, objectLimit]
|
|
1287
1427
|
);
|
|
1288
|
-
const
|
|
1428
|
+
const filteredArrows = useMemo10(
|
|
1429
|
+
() => filterAndLimit(graphics.arrows, filterArrows),
|
|
1430
|
+
[graphics.arrows, filterArrows, objectLimit]
|
|
1431
|
+
);
|
|
1432
|
+
const totalFilteredObjects = filteredLines.length + filteredRects.length + filteredPoints.length + filteredCircles.length + filteredTexts.length + filteredArrows.length;
|
|
1289
1433
|
const isLimitReached = objectLimit && totalFilteredObjects > objectLimit;
|
|
1290
|
-
return /* @__PURE__ */
|
|
1291
|
-
showToolbar && /* @__PURE__ */
|
|
1292
|
-
availableLayers.length > 1 && /* @__PURE__ */
|
|
1434
|
+
return /* @__PURE__ */ jsxs6("div", { children: [
|
|
1435
|
+
showToolbar && /* @__PURE__ */ jsxs6("div", { style: { margin: 8 }, children: [
|
|
1436
|
+
availableLayers.length > 1 && /* @__PURE__ */ jsxs6(
|
|
1293
1437
|
"select",
|
|
1294
1438
|
{
|
|
1295
1439
|
value: activeLayers ? activeLayers[0] : "",
|
|
@@ -1299,18 +1443,18 @@ var InteractiveGraphics = ({
|
|
|
1299
1443
|
},
|
|
1300
1444
|
style: { marginRight: 8 },
|
|
1301
1445
|
children: [
|
|
1302
|
-
/* @__PURE__ */
|
|
1303
|
-
availableLayers.map((layer) => /* @__PURE__ */
|
|
1446
|
+
/* @__PURE__ */ jsx11("option", { value: "", children: "All Layers" }),
|
|
1447
|
+
availableLayers.map((layer) => /* @__PURE__ */ jsx11("option", { value: layer, children: layer }, layer))
|
|
1304
1448
|
]
|
|
1305
1449
|
}
|
|
1306
1450
|
),
|
|
1307
|
-
maxStep > 0 && /* @__PURE__ */
|
|
1451
|
+
maxStep > 0 && /* @__PURE__ */ jsxs6(
|
|
1308
1452
|
"div",
|
|
1309
1453
|
{
|
|
1310
1454
|
style: { display: "inline-flex", alignItems: "center", gap: 8 },
|
|
1311
1455
|
children: [
|
|
1312
1456
|
"Step:",
|
|
1313
|
-
/* @__PURE__ */
|
|
1457
|
+
/* @__PURE__ */ jsx11(
|
|
1314
1458
|
"input",
|
|
1315
1459
|
{
|
|
1316
1460
|
type: "number",
|
|
@@ -1325,8 +1469,8 @@ var InteractiveGraphics = ({
|
|
|
1325
1469
|
disabled: activeStep === null
|
|
1326
1470
|
}
|
|
1327
1471
|
),
|
|
1328
|
-
/* @__PURE__ */
|
|
1329
|
-
/* @__PURE__ */
|
|
1472
|
+
/* @__PURE__ */ jsxs6("label", { children: [
|
|
1473
|
+
/* @__PURE__ */ jsx11(
|
|
1330
1474
|
"input",
|
|
1331
1475
|
{
|
|
1332
1476
|
type: "checkbox",
|
|
@@ -1340,8 +1484,8 @@ var InteractiveGraphics = ({
|
|
|
1340
1484
|
),
|
|
1341
1485
|
"Filter by step"
|
|
1342
1486
|
] }),
|
|
1343
|
-
/* @__PURE__ */
|
|
1344
|
-
/* @__PURE__ */
|
|
1487
|
+
/* @__PURE__ */ jsxs6("label", { children: [
|
|
1488
|
+
/* @__PURE__ */ jsx11(
|
|
1345
1489
|
"input",
|
|
1346
1490
|
{
|
|
1347
1491
|
type: "checkbox",
|
|
@@ -1355,7 +1499,7 @@ var InteractiveGraphics = ({
|
|
|
1355
1499
|
),
|
|
1356
1500
|
"Show last step"
|
|
1357
1501
|
] }),
|
|
1358
|
-
isLimitReached && /* @__PURE__ */
|
|
1502
|
+
isLimitReached && /* @__PURE__ */ jsxs6("span", { style: { color: "red", fontSize: "12px" }, children: [
|
|
1359
1503
|
"Display limited to ",
|
|
1360
1504
|
objectLimit,
|
|
1361
1505
|
" objects. Received:",
|
|
@@ -1367,7 +1511,7 @@ var InteractiveGraphics = ({
|
|
|
1367
1511
|
}
|
|
1368
1512
|
)
|
|
1369
1513
|
] }),
|
|
1370
|
-
/* @__PURE__ */
|
|
1514
|
+
/* @__PURE__ */ jsxs6(
|
|
1371
1515
|
"div",
|
|
1372
1516
|
{
|
|
1373
1517
|
ref,
|
|
@@ -1378,8 +1522,17 @@ var InteractiveGraphics = ({
|
|
|
1378
1522
|
},
|
|
1379
1523
|
onContextMenu: handleContextMenu,
|
|
1380
1524
|
children: [
|
|
1381
|
-
/* @__PURE__ */
|
|
1382
|
-
|
|
1525
|
+
/* @__PURE__ */ jsxs6(DimensionOverlay, { transform: realToScreen, children: [
|
|
1526
|
+
filteredArrows.map((arrow) => /* @__PURE__ */ jsx11(
|
|
1527
|
+
Arrow,
|
|
1528
|
+
{
|
|
1529
|
+
arrow,
|
|
1530
|
+
index: arrow.originalIndex,
|
|
1531
|
+
interactiveState
|
|
1532
|
+
},
|
|
1533
|
+
arrow.originalIndex
|
|
1534
|
+
)),
|
|
1535
|
+
filteredLines.map((line) => /* @__PURE__ */ jsx11(
|
|
1383
1536
|
Line,
|
|
1384
1537
|
{
|
|
1385
1538
|
line,
|
|
@@ -1388,7 +1541,7 @@ var InteractiveGraphics = ({
|
|
|
1388
1541
|
},
|
|
1389
1542
|
line.originalIndex
|
|
1390
1543
|
)),
|
|
1391
|
-
filteredRects.map((rect) => /* @__PURE__ */
|
|
1544
|
+
filteredRects.map((rect) => /* @__PURE__ */ jsx11(
|
|
1392
1545
|
Rect,
|
|
1393
1546
|
{
|
|
1394
1547
|
rect,
|
|
@@ -1397,7 +1550,7 @@ var InteractiveGraphics = ({
|
|
|
1397
1550
|
},
|
|
1398
1551
|
rect.originalIndex
|
|
1399
1552
|
)),
|
|
1400
|
-
filteredPoints.map((point) => /* @__PURE__ */
|
|
1553
|
+
filteredPoints.map((point) => /* @__PURE__ */ jsx11(
|
|
1401
1554
|
Point,
|
|
1402
1555
|
{
|
|
1403
1556
|
point,
|
|
@@ -1406,7 +1559,7 @@ var InteractiveGraphics = ({
|
|
|
1406
1559
|
},
|
|
1407
1560
|
point.originalIndex
|
|
1408
1561
|
)),
|
|
1409
|
-
filteredCircles.map((circle) => /* @__PURE__ */
|
|
1562
|
+
filteredCircles.map((circle) => /* @__PURE__ */ jsx11(
|
|
1410
1563
|
Circle,
|
|
1411
1564
|
{
|
|
1412
1565
|
circle,
|
|
@@ -1415,7 +1568,7 @@ var InteractiveGraphics = ({
|
|
|
1415
1568
|
},
|
|
1416
1569
|
circle.originalIndex
|
|
1417
1570
|
)),
|
|
1418
|
-
filteredTexts.map((txt) => /* @__PURE__ */
|
|
1571
|
+
filteredTexts.map((txt) => /* @__PURE__ */ jsx11(
|
|
1419
1572
|
Text,
|
|
1420
1573
|
{
|
|
1421
1574
|
textObj: txt,
|
|
@@ -1424,7 +1577,7 @@ var InteractiveGraphics = ({
|
|
|
1424
1577
|
},
|
|
1425
1578
|
txt.originalIndex
|
|
1426
1579
|
)),
|
|
1427
|
-
/* @__PURE__ */
|
|
1580
|
+
/* @__PURE__ */ jsx11(
|
|
1428
1581
|
SuperGrid,
|
|
1429
1582
|
{
|
|
1430
1583
|
stringifyCoord: (x, y) => `${x.toFixed(2)}, ${y.toFixed(2)}`,
|
|
@@ -1434,7 +1587,7 @@ var InteractiveGraphics = ({
|
|
|
1434
1587
|
}
|
|
1435
1588
|
)
|
|
1436
1589
|
] }),
|
|
1437
|
-
markers.map((marker, index) => /* @__PURE__ */
|
|
1590
|
+
markers.map((marker, index) => /* @__PURE__ */ jsx11(
|
|
1438
1591
|
Marker,
|
|
1439
1592
|
{
|
|
1440
1593
|
marker,
|
|
@@ -1443,7 +1596,7 @@ var InteractiveGraphics = ({
|
|
|
1443
1596
|
},
|
|
1444
1597
|
index
|
|
1445
1598
|
)),
|
|
1446
|
-
contextMenu && /* @__PURE__ */
|
|
1599
|
+
contextMenu && /* @__PURE__ */ jsx11(
|
|
1447
1600
|
ContextMenu,
|
|
1448
1601
|
{
|
|
1449
1602
|
x: contextMenu.x,
|
|
@@ -1463,7 +1616,7 @@ var InteractiveGraphics = ({
|
|
|
1463
1616
|
};
|
|
1464
1617
|
|
|
1465
1618
|
// site/components/InteractiveGraphicsCanvas.tsx
|
|
1466
|
-
import { useRef as useRef3, useEffect as useEffect4, useState as
|
|
1619
|
+
import { useRef as useRef3, useEffect as useEffect4, useState as useState8 } from "react";
|
|
1467
1620
|
import useMouseMatrixTransform2 from "use-mouse-matrix-transform";
|
|
1468
1621
|
import { compose as compose2, scale as scale2, translate as translate2 } from "transformation-matrix";
|
|
1469
1622
|
import useResizeObserver2 from "@react-hook/resize-observer";
|
|
@@ -1513,7 +1666,7 @@ function getGraphicsBoundsWithPadding(graphics) {
|
|
|
1513
1666
|
}
|
|
1514
1667
|
|
|
1515
1668
|
// site/components/InteractiveGraphicsCanvas.tsx
|
|
1516
|
-
import { jsx as
|
|
1669
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1517
1670
|
function InteractiveGraphicsCanvas({
|
|
1518
1671
|
graphics,
|
|
1519
1672
|
showLabelsByDefault = true,
|
|
@@ -1523,10 +1676,10 @@ function InteractiveGraphicsCanvas({
|
|
|
1523
1676
|
}) {
|
|
1524
1677
|
const canvasRef = useRef3(null);
|
|
1525
1678
|
const containerRef = useRef3(null);
|
|
1526
|
-
const [size, setSize] =
|
|
1527
|
-
const [activeStep, setActiveStep] =
|
|
1528
|
-
const [showLabels, setShowLabels] =
|
|
1529
|
-
const [showLastStep, setShowLastStep] =
|
|
1679
|
+
const [size, setSize] = useState8({ width: 600, height: 600 });
|
|
1680
|
+
const [activeStep, setActiveStep] = useState8(null);
|
|
1681
|
+
const [showLabels, setShowLabels] = useState8(showLabelsByDefault);
|
|
1682
|
+
const [showLastStep, setShowLastStep] = useState8(true);
|
|
1530
1683
|
const maxStep = getMaxStep(graphics);
|
|
1531
1684
|
const filteredGraphics = getGraphicsFilteredByStep(graphics, {
|
|
1532
1685
|
activeStep,
|
|
@@ -1621,11 +1774,11 @@ function InteractiveGraphicsCanvas({
|
|
|
1621
1774
|
useEffect4(() => {
|
|
1622
1775
|
drawCanvas();
|
|
1623
1776
|
}, [transform, size, filteredGraphics, showGrid, showLabels]);
|
|
1624
|
-
return /* @__PURE__ */
|
|
1625
|
-
/* @__PURE__ */
|
|
1626
|
-
/* @__PURE__ */
|
|
1627
|
-
/* @__PURE__ */
|
|
1628
|
-
/* @__PURE__ */
|
|
1777
|
+
return /* @__PURE__ */ jsxs7("div", { style: { display: "flex", flexDirection: "column", gap: "10px" }, children: [
|
|
1778
|
+
/* @__PURE__ */ jsxs7("div", { style: { display: "flex", gap: "12px", alignItems: "center" }, children: [
|
|
1779
|
+
/* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
|
|
1780
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
1781
|
+
/* @__PURE__ */ jsx12(
|
|
1629
1782
|
"input",
|
|
1630
1783
|
{
|
|
1631
1784
|
type: "checkbox",
|
|
@@ -1638,7 +1791,7 @@ function InteractiveGraphicsCanvas({
|
|
|
1638
1791
|
),
|
|
1639
1792
|
"Filter by step"
|
|
1640
1793
|
] }),
|
|
1641
|
-
/* @__PURE__ */
|
|
1794
|
+
/* @__PURE__ */ jsx12(
|
|
1642
1795
|
"input",
|
|
1643
1796
|
{
|
|
1644
1797
|
type: "number",
|
|
@@ -1654,8 +1807,8 @@ function InteractiveGraphicsCanvas({
|
|
|
1654
1807
|
style: { width: "60px" }
|
|
1655
1808
|
}
|
|
1656
1809
|
),
|
|
1657
|
-
/* @__PURE__ */
|
|
1658
|
-
/* @__PURE__ */
|
|
1810
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
1811
|
+
/* @__PURE__ */ jsx12(
|
|
1659
1812
|
"input",
|
|
1660
1813
|
{
|
|
1661
1814
|
type: "checkbox",
|
|
@@ -1670,8 +1823,8 @@ function InteractiveGraphicsCanvas({
|
|
|
1670
1823
|
"Show last step"
|
|
1671
1824
|
] })
|
|
1672
1825
|
] }),
|
|
1673
|
-
/* @__PURE__ */
|
|
1674
|
-
/* @__PURE__ */
|
|
1826
|
+
/* @__PURE__ */ jsx12("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: /* @__PURE__ */ jsxs7("label", { children: [
|
|
1827
|
+
/* @__PURE__ */ jsx12(
|
|
1675
1828
|
"input",
|
|
1676
1829
|
{
|
|
1677
1830
|
type: "checkbox",
|
|
@@ -1685,7 +1838,7 @@ function InteractiveGraphicsCanvas({
|
|
|
1685
1838
|
"Show labels"
|
|
1686
1839
|
] }) })
|
|
1687
1840
|
] }),
|
|
1688
|
-
/* @__PURE__ */
|
|
1841
|
+
/* @__PURE__ */ jsx12(
|
|
1689
1842
|
"div",
|
|
1690
1843
|
{
|
|
1691
1844
|
ref: (node) => {
|
|
@@ -1701,7 +1854,7 @@ function InteractiveGraphicsCanvas({
|
|
|
1701
1854
|
border: "1px solid #ccc",
|
|
1702
1855
|
overflow: "hidden"
|
|
1703
1856
|
},
|
|
1704
|
-
children: /* @__PURE__ */
|
|
1857
|
+
children: /* @__PURE__ */ jsx12(
|
|
1705
1858
|
"canvas",
|
|
1706
1859
|
{
|
|
1707
1860
|
ref: canvasRef,
|
|
@@ -1720,11 +1873,11 @@ function InteractiveGraphicsCanvas({
|
|
|
1720
1873
|
}
|
|
1721
1874
|
|
|
1722
1875
|
// site/components/CanvasGraphics/CanvasGraphics.tsx
|
|
1723
|
-
import React3, { useRef as useRef4, useEffect as useEffect5, useState as
|
|
1876
|
+
import React3, { useRef as useRef4, useEffect as useEffect5, useState as useState9 } from "react";
|
|
1724
1877
|
import useMouseMatrixTransform3 from "use-mouse-matrix-transform";
|
|
1725
1878
|
import { compose as compose3, scale as scale3, translate as translate3 } from "transformation-matrix";
|
|
1726
1879
|
import useResizeObserver3 from "@react-hook/resize-observer";
|
|
1727
|
-
import { jsx as
|
|
1880
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1728
1881
|
function TransformContainer({
|
|
1729
1882
|
initialTransform,
|
|
1730
1883
|
children,
|
|
@@ -1736,7 +1889,7 @@ function TransformContainer({
|
|
|
1736
1889
|
useEffect5(() => {
|
|
1737
1890
|
onTransformChange(transform);
|
|
1738
1891
|
}, [transform, onTransformChange]);
|
|
1739
|
-
return /* @__PURE__ */
|
|
1892
|
+
return /* @__PURE__ */ jsx13(
|
|
1740
1893
|
"div",
|
|
1741
1894
|
{
|
|
1742
1895
|
ref,
|
|
@@ -1759,8 +1912,8 @@ var CanvasGraphics = ({
|
|
|
1759
1912
|
}) => {
|
|
1760
1913
|
const canvasRef = useRef4(null);
|
|
1761
1914
|
const containerRef = useRef4(null);
|
|
1762
|
-
const [size, setSize] =
|
|
1763
|
-
const [currentTransform, setCurrentTransform] =
|
|
1915
|
+
const [size, setSize] = useState9({ width, height });
|
|
1916
|
+
const [currentTransform, setCurrentTransform] = useState9(null);
|
|
1764
1917
|
const graphicsBoundsWithPadding = React3.useMemo(() => {
|
|
1765
1918
|
const bounds = getBounds(graphics);
|
|
1766
1919
|
const bWidth = bounds.maxX - bounds.minX;
|
|
@@ -1872,7 +2025,7 @@ var CanvasGraphics = ({
|
|
|
1872
2025
|
useEffect5(() => {
|
|
1873
2026
|
setCurrentTransform(computedInitialTransform);
|
|
1874
2027
|
}, [computedInitialTransform]);
|
|
1875
|
-
return /* @__PURE__ */
|
|
2028
|
+
return /* @__PURE__ */ jsx13(
|
|
1876
2029
|
"div",
|
|
1877
2030
|
{
|
|
1878
2031
|
ref: containerRef,
|
|
@@ -1883,16 +2036,16 @@ var CanvasGraphics = ({
|
|
|
1883
2036
|
border: "1px solid #eee",
|
|
1884
2037
|
overflow: "hidden"
|
|
1885
2038
|
},
|
|
1886
|
-
children: /* @__PURE__ */
|
|
2039
|
+
children: /* @__PURE__ */ jsx13(
|
|
1887
2040
|
TransformContainer,
|
|
1888
2041
|
{
|
|
1889
2042
|
initialTransform: computedInitialTransform,
|
|
1890
2043
|
onTransformChange: handleTransformChange,
|
|
1891
|
-
children: /* @__PURE__ */
|
|
2044
|
+
children: /* @__PURE__ */ jsx13(
|
|
1892
2045
|
DimensionOverlay,
|
|
1893
2046
|
{
|
|
1894
2047
|
transform: currentTransform || computedInitialTransform,
|
|
1895
|
-
children: /* @__PURE__ */
|
|
2048
|
+
children: /* @__PURE__ */ jsx13(
|
|
1896
2049
|
"canvas",
|
|
1897
2050
|
{
|
|
1898
2051
|
ref: canvasRef,
|