@tscircuit/pcb-viewer 1.11.361 → 1.11.363
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.js +513 -369
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6788,7 +6788,7 @@ var ToastContainer = () => {
|
|
|
6788
6788
|
};
|
|
6789
6789
|
|
|
6790
6790
|
// src/PCBViewer.tsx
|
|
6791
|
-
import { useCallback as
|
|
6791
|
+
import { useCallback as useCallback11, useEffect as useEffect17, useMemo as useMemo9, useRef as useRef14, useState as useState13 } from "react";
|
|
6792
6792
|
|
|
6793
6793
|
// node_modules/react-use/esm/useMountedState.js
|
|
6794
6794
|
import { useCallback as useCallback2, useEffect as useEffect2, useRef } from "react";
|
|
@@ -7427,7 +7427,7 @@ function addInteractionMetadataToPrimitives({
|
|
|
7427
7427
|
}
|
|
7428
7428
|
|
|
7429
7429
|
// src/components/CanvasElementsRenderer.tsx
|
|
7430
|
-
import { useCallback as
|
|
7430
|
+
import { useCallback as useCallback10, useMemo as useMemo8, useState as useState12 } from "react";
|
|
7431
7431
|
|
|
7432
7432
|
// src/lib/util/expand-stroke.ts
|
|
7433
7433
|
function getExpandedStroke(strokeInput, defaultWidth) {
|
|
@@ -8821,19 +8821,16 @@ var Drawer = class {
|
|
|
8821
8821
|
...associatedFabrication ? [associatedFabrication] : [],
|
|
8822
8822
|
...associatedCourtyard ? [associatedCourtyard] : []
|
|
8823
8823
|
];
|
|
8824
|
-
const drillBeforeForeground = foregroundLayer === "drill" ? [] : ["drill"];
|
|
8825
|
-
const drillAfterForeground = foregroundLayer === "drill" ? ["drill"] : [];
|
|
8826
8824
|
const order = [
|
|
8827
8825
|
...DEFAULT_DRAW_ORDER.filter((l) => !layersToShiftToTop.includes(l)),
|
|
8828
|
-
...
|
|
8829
|
-
foregroundLayer,
|
|
8826
|
+
...foregroundLayer === "drill" ? [] : [foregroundLayer],
|
|
8830
8827
|
...associatedSoldermask ? [associatedSoldermask] : [],
|
|
8831
|
-
...drillAfterForeground,
|
|
8832
8828
|
"edge_cuts",
|
|
8833
8829
|
...associatedSilkscreen ? [associatedSilkscreen] : [],
|
|
8834
8830
|
...associatedNotes ? [associatedNotes] : [],
|
|
8835
8831
|
...associatedFabrication ? [associatedFabrication] : [],
|
|
8836
|
-
...associatedCourtyard ? [associatedCourtyard] : []
|
|
8832
|
+
...associatedCourtyard ? [associatedCourtyard] : [],
|
|
8833
|
+
"drill"
|
|
8837
8834
|
];
|
|
8838
8835
|
order.forEach((layer, i) => {
|
|
8839
8836
|
const canvas = canvasLayerMap[layer];
|
|
@@ -14361,8 +14358,8 @@ var RatsNestOverlay = ({ transform, soup, children }) => {
|
|
|
14361
14358
|
// src/components/ToolbarOverlay.tsx
|
|
14362
14359
|
import {
|
|
14363
14360
|
useEffect as useEffect16,
|
|
14364
|
-
useState as
|
|
14365
|
-
useCallback as
|
|
14361
|
+
useState as useState11,
|
|
14362
|
+
useCallback as useCallback9,
|
|
14366
14363
|
useRef as useRef13,
|
|
14367
14364
|
useLayoutEffect as useLayoutEffect2
|
|
14368
14365
|
} from "react";
|
|
@@ -14371,7 +14368,7 @@ import { css as css3 } from "@emotion/css";
|
|
|
14371
14368
|
// package.json
|
|
14372
14369
|
var package_default = {
|
|
14373
14370
|
name: "@tscircuit/pcb-viewer",
|
|
14374
|
-
version: "1.11.
|
|
14371
|
+
version: "1.11.362",
|
|
14375
14372
|
main: "dist/index.js",
|
|
14376
14373
|
type: "module",
|
|
14377
14374
|
repository: "tscircuit/pcb-viewer",
|
|
@@ -14525,43 +14522,8 @@ var useMobileTouch = (onClick, options = { stopPropagation: true }) => {
|
|
|
14525
14522
|
};
|
|
14526
14523
|
};
|
|
14527
14524
|
|
|
14528
|
-
// src/components/
|
|
14529
|
-
import { jsx as jsx20
|
|
14530
|
-
var LayerButton = ({ name, selected, onClick }) => {
|
|
14531
|
-
const { style: touchStyle, ...touchHandlers } = useMobileTouch(onClick);
|
|
14532
|
-
return /* @__PURE__ */ jsxs14(
|
|
14533
|
-
"div",
|
|
14534
|
-
{
|
|
14535
|
-
className: css3`
|
|
14536
|
-
margin-top: 2px;
|
|
14537
|
-
padding: 4px;
|
|
14538
|
-
padding-left: 8px;
|
|
14539
|
-
padding-right: 18px;
|
|
14540
|
-
cursor: pointer;
|
|
14541
|
-
|
|
14542
|
-
&:hover {
|
|
14543
|
-
background-color: rgba(255, 255, 255, 0.1);
|
|
14544
|
-
}
|
|
14545
|
-
`,
|
|
14546
|
-
...touchHandlers,
|
|
14547
|
-
style: touchStyle,
|
|
14548
|
-
children: [
|
|
14549
|
-
/* @__PURE__ */ jsx20("span", { style: { marginRight: 2, opacity: selected ? 1 : 0 }, children: "\u2022" }),
|
|
14550
|
-
/* @__PURE__ */ jsx20(
|
|
14551
|
-
"span",
|
|
14552
|
-
{
|
|
14553
|
-
style: {
|
|
14554
|
-
marginLeft: 2,
|
|
14555
|
-
fontWeight: 500,
|
|
14556
|
-
color: LAYER_NAME_TO_COLOR[name.replace(/-/, "")]
|
|
14557
|
-
},
|
|
14558
|
-
children: name
|
|
14559
|
-
}
|
|
14560
|
-
)
|
|
14561
|
-
]
|
|
14562
|
-
}
|
|
14563
|
-
);
|
|
14564
|
-
};
|
|
14525
|
+
// src/components/ToolbarButton.tsx
|
|
14526
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
14565
14527
|
var ToolbarButton = ({
|
|
14566
14528
|
children,
|
|
14567
14529
|
isSmallScreen,
|
|
@@ -14595,13 +14557,425 @@ var ToolbarButton = ({
|
|
|
14595
14557
|
}
|
|
14596
14558
|
);
|
|
14597
14559
|
};
|
|
14560
|
+
|
|
14561
|
+
// src/components/ToolbarErrorDropdown.tsx
|
|
14562
|
+
import { useCallback as useCallback8, useMemo as useMemo7, useState as useState10 } from "react";
|
|
14563
|
+
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
14564
|
+
var CopyErrorButton = ({
|
|
14565
|
+
errorId,
|
|
14566
|
+
errorMessage,
|
|
14567
|
+
copiedErrorId,
|
|
14568
|
+
onCopy
|
|
14569
|
+
}) => {
|
|
14570
|
+
const { style: touchStyle, ...touchHandlers } = useMobileTouch(
|
|
14571
|
+
() => onCopy(errorMessage, errorId)
|
|
14572
|
+
);
|
|
14573
|
+
return /* @__PURE__ */ jsx21(
|
|
14574
|
+
"button",
|
|
14575
|
+
{
|
|
14576
|
+
type: "button",
|
|
14577
|
+
"aria-label": copiedErrorId === errorId ? "Error message copied" : "Copy error message",
|
|
14578
|
+
style: {
|
|
14579
|
+
position: "absolute",
|
|
14580
|
+
top: 12,
|
|
14581
|
+
right: 16,
|
|
14582
|
+
cursor: "pointer",
|
|
14583
|
+
color: "#888",
|
|
14584
|
+
fontSize: 16,
|
|
14585
|
+
background: "none",
|
|
14586
|
+
border: "none",
|
|
14587
|
+
padding: 0,
|
|
14588
|
+
display: "flex",
|
|
14589
|
+
alignItems: "center",
|
|
14590
|
+
...touchStyle
|
|
14591
|
+
},
|
|
14592
|
+
...touchHandlers,
|
|
14593
|
+
children: copiedErrorId === errorId ? /* @__PURE__ */ jsx21("span", { style: { color: "#4caf50", fontSize: 12 }, children: "Copied!" }) : /* @__PURE__ */ jsx21("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx21("path", { d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" }) })
|
|
14594
|
+
}
|
|
14595
|
+
);
|
|
14596
|
+
};
|
|
14597
|
+
var ToolbarErrorDropdown = ({
|
|
14598
|
+
elements,
|
|
14599
|
+
isOpen,
|
|
14600
|
+
isSmallScreen,
|
|
14601
|
+
onToggle,
|
|
14602
|
+
setHoveredErrorId
|
|
14603
|
+
}) => {
|
|
14604
|
+
const [copiedErrorId, setCopiedErrorId] = useState10(null);
|
|
14605
|
+
const [collapsedErrorGroups, setCollapsedErrorGroups] = useState10(
|
|
14606
|
+
/* @__PURE__ */ new Set()
|
|
14607
|
+
);
|
|
14608
|
+
const [expandedErrorIds, setExpandedErrorIds] = useState10(
|
|
14609
|
+
/* @__PURE__ */ new Set()
|
|
14610
|
+
);
|
|
14611
|
+
const [, copyToClipboard] = useCopyToClipboard_default();
|
|
14612
|
+
const errorElements = useMemo7(
|
|
14613
|
+
() => elements?.filter(
|
|
14614
|
+
(el) => el.type.includes("error")
|
|
14615
|
+
) ?? [],
|
|
14616
|
+
[elements]
|
|
14617
|
+
);
|
|
14618
|
+
const errorCount = errorElements.length;
|
|
14619
|
+
const getErrorId = useCallback8(
|
|
14620
|
+
(error, index) => {
|
|
14621
|
+
return error.pcb_trace_error_id || `error_${index}_${error.error_type}_${error.message?.slice(0, 20)}`;
|
|
14622
|
+
},
|
|
14623
|
+
[]
|
|
14624
|
+
);
|
|
14625
|
+
const groupedErrorElements = useMemo7(() => {
|
|
14626
|
+
const groups = /* @__PURE__ */ new Map();
|
|
14627
|
+
errorElements.forEach((error, index) => {
|
|
14628
|
+
const errorType = error.error_type || "unknown_error";
|
|
14629
|
+
const existingGroup = groups.get(errorType) || [];
|
|
14630
|
+
existingGroup.push({
|
|
14631
|
+
error,
|
|
14632
|
+
index,
|
|
14633
|
+
errorId: getErrorId(error, index)
|
|
14634
|
+
});
|
|
14635
|
+
groups.set(errorType, existingGroup);
|
|
14636
|
+
});
|
|
14637
|
+
return Array.from(groups.entries()).map(([errorType, errors]) => ({
|
|
14638
|
+
errorType,
|
|
14639
|
+
errors
|
|
14640
|
+
}));
|
|
14641
|
+
}, [errorElements, getErrorId]);
|
|
14642
|
+
const toggleErrorGroup = useCallback8((errorType) => {
|
|
14643
|
+
setCollapsedErrorGroups((prev) => {
|
|
14644
|
+
const next = new Set(prev);
|
|
14645
|
+
if (next.has(errorType)) {
|
|
14646
|
+
next.delete(errorType);
|
|
14647
|
+
} else {
|
|
14648
|
+
next.add(errorType);
|
|
14649
|
+
}
|
|
14650
|
+
return next;
|
|
14651
|
+
});
|
|
14652
|
+
}, []);
|
|
14653
|
+
const toggleExpandedError = useCallback8((errorId) => {
|
|
14654
|
+
setExpandedErrorIds((prev) => {
|
|
14655
|
+
const next = new Set(prev);
|
|
14656
|
+
if (next.has(errorId)) {
|
|
14657
|
+
next.delete(errorId);
|
|
14658
|
+
} else {
|
|
14659
|
+
next.add(errorId);
|
|
14660
|
+
}
|
|
14661
|
+
return next;
|
|
14662
|
+
});
|
|
14663
|
+
}, []);
|
|
14664
|
+
return /* @__PURE__ */ jsxs14("div", { style: { position: "relative" }, children: [
|
|
14665
|
+
/* @__PURE__ */ jsx21(
|
|
14666
|
+
ToolbarButton,
|
|
14667
|
+
{
|
|
14668
|
+
isSmallScreen,
|
|
14669
|
+
style: errorCount > 0 ? { color: "red" } : void 0,
|
|
14670
|
+
onClick: onToggle,
|
|
14671
|
+
children: /* @__PURE__ */ jsxs14("div", { children: [
|
|
14672
|
+
errorCount,
|
|
14673
|
+
" errors"
|
|
14674
|
+
] })
|
|
14675
|
+
}
|
|
14676
|
+
),
|
|
14677
|
+
isOpen && errorCount > 0 && /* @__PURE__ */ jsx21(
|
|
14678
|
+
"div",
|
|
14679
|
+
{
|
|
14680
|
+
style: {
|
|
14681
|
+
position: "absolute",
|
|
14682
|
+
top: "100%",
|
|
14683
|
+
left: 0,
|
|
14684
|
+
backgroundColor: "#2a2a2a",
|
|
14685
|
+
border: "1px solid #666",
|
|
14686
|
+
borderRadius: 4,
|
|
14687
|
+
marginTop: 4,
|
|
14688
|
+
zIndex: 1e3,
|
|
14689
|
+
minWidth: isSmallScreen ? "280px" : "400px",
|
|
14690
|
+
maxWidth: isSmallScreen ? "90vw" : "600px",
|
|
14691
|
+
maxHeight: "400px",
|
|
14692
|
+
overflow: "auto",
|
|
14693
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.3)"
|
|
14694
|
+
},
|
|
14695
|
+
children: groupedErrorElements.map(({ errorType, errors }, groupIndex) => {
|
|
14696
|
+
const isGroupCollapsed = collapsedErrorGroups.has(errorType);
|
|
14697
|
+
return /* @__PURE__ */ jsxs14(
|
|
14698
|
+
"div",
|
|
14699
|
+
{
|
|
14700
|
+
style: {
|
|
14701
|
+
borderBottom: groupIndex < groupedErrorElements.length - 1 ? "1px solid #444" : "none"
|
|
14702
|
+
},
|
|
14703
|
+
children: [
|
|
14704
|
+
/* @__PURE__ */ jsxs14(
|
|
14705
|
+
"div",
|
|
14706
|
+
{
|
|
14707
|
+
style: {
|
|
14708
|
+
display: "flex",
|
|
14709
|
+
alignItems: "center",
|
|
14710
|
+
justifyContent: "space-between",
|
|
14711
|
+
padding: "12px 16px",
|
|
14712
|
+
cursor: "pointer",
|
|
14713
|
+
backgroundColor: "#232323",
|
|
14714
|
+
transition: "background-color 0.2s ease",
|
|
14715
|
+
touchAction: "manipulation",
|
|
14716
|
+
position: "sticky",
|
|
14717
|
+
top: 0,
|
|
14718
|
+
zIndex: 1
|
|
14719
|
+
},
|
|
14720
|
+
onMouseEnter: (e) => {
|
|
14721
|
+
e.currentTarget.style.backgroundColor = "#303030";
|
|
14722
|
+
},
|
|
14723
|
+
onMouseLeave: (e) => {
|
|
14724
|
+
e.currentTarget.style.backgroundColor = "#232323";
|
|
14725
|
+
},
|
|
14726
|
+
onTouchStart: (e) => {
|
|
14727
|
+
e.stopPropagation();
|
|
14728
|
+
e.currentTarget.style.backgroundColor = "#303030";
|
|
14729
|
+
},
|
|
14730
|
+
onTouchEnd: (e) => {
|
|
14731
|
+
e.stopPropagation();
|
|
14732
|
+
e.preventDefault();
|
|
14733
|
+
e.currentTarget.style.backgroundColor = "#232323";
|
|
14734
|
+
toggleErrorGroup(errorType);
|
|
14735
|
+
},
|
|
14736
|
+
onClick: (e) => {
|
|
14737
|
+
e.stopPropagation();
|
|
14738
|
+
toggleErrorGroup(errorType);
|
|
14739
|
+
},
|
|
14740
|
+
children: [
|
|
14741
|
+
/* @__PURE__ */ jsxs14(
|
|
14742
|
+
"div",
|
|
14743
|
+
{
|
|
14744
|
+
style: {
|
|
14745
|
+
display: "flex",
|
|
14746
|
+
alignItems: "center",
|
|
14747
|
+
gap: 8,
|
|
14748
|
+
color: "#ff6b6b"
|
|
14749
|
+
},
|
|
14750
|
+
children: [
|
|
14751
|
+
/* @__PURE__ */ jsx21(
|
|
14752
|
+
"div",
|
|
14753
|
+
{
|
|
14754
|
+
style: {
|
|
14755
|
+
color: "#888",
|
|
14756
|
+
fontSize: "16px",
|
|
14757
|
+
transform: isGroupCollapsed ? "rotate(90deg)" : "rotate(0deg)",
|
|
14758
|
+
transition: "transform 0.2s ease",
|
|
14759
|
+
flexShrink: 0
|
|
14760
|
+
},
|
|
14761
|
+
children: "\u203A"
|
|
14762
|
+
}
|
|
14763
|
+
),
|
|
14764
|
+
/* @__PURE__ */ jsx21(
|
|
14765
|
+
"div",
|
|
14766
|
+
{
|
|
14767
|
+
style: {
|
|
14768
|
+
fontWeight: "bold",
|
|
14769
|
+
fontSize: isSmallScreen ? "12px" : "13px"
|
|
14770
|
+
},
|
|
14771
|
+
children: errorType
|
|
14772
|
+
}
|
|
14773
|
+
)
|
|
14774
|
+
]
|
|
14775
|
+
}
|
|
14776
|
+
),
|
|
14777
|
+
/* @__PURE__ */ jsx21(
|
|
14778
|
+
"div",
|
|
14779
|
+
{
|
|
14780
|
+
style: {
|
|
14781
|
+
fontSize: isSmallScreen ? "12px" : "13px",
|
|
14782
|
+
color: "#aaa",
|
|
14783
|
+
whiteSpace: "nowrap",
|
|
14784
|
+
marginLeft: 12
|
|
14785
|
+
},
|
|
14786
|
+
children: errors.length
|
|
14787
|
+
}
|
|
14788
|
+
)
|
|
14789
|
+
]
|
|
14790
|
+
}
|
|
14791
|
+
),
|
|
14792
|
+
!isGroupCollapsed && errors.map(({ error, index, errorId }) => {
|
|
14793
|
+
const isExpanded = expandedErrorIds.has(errorId);
|
|
14794
|
+
const errorMessage = error.message ?? "No error message";
|
|
14795
|
+
return /* @__PURE__ */ jsxs14(
|
|
14796
|
+
"div",
|
|
14797
|
+
{
|
|
14798
|
+
style: {
|
|
14799
|
+
borderTop: "1px solid #3a3a3a"
|
|
14800
|
+
},
|
|
14801
|
+
children: [
|
|
14802
|
+
/* @__PURE__ */ jsxs14(
|
|
14803
|
+
"div",
|
|
14804
|
+
{
|
|
14805
|
+
style: {
|
|
14806
|
+
display: "flex",
|
|
14807
|
+
alignItems: "center",
|
|
14808
|
+
gap: 12,
|
|
14809
|
+
padding: "12px 16px 12px 24px",
|
|
14810
|
+
cursor: "pointer",
|
|
14811
|
+
backgroundColor: "#2a2a2a",
|
|
14812
|
+
transition: "background-color 0.2s ease",
|
|
14813
|
+
touchAction: "manipulation"
|
|
14814
|
+
},
|
|
14815
|
+
onMouseEnter: (e) => {
|
|
14816
|
+
e.currentTarget.style.backgroundColor = "#333";
|
|
14817
|
+
setHoveredErrorId(errorId);
|
|
14818
|
+
},
|
|
14819
|
+
onMouseLeave: (e) => {
|
|
14820
|
+
e.currentTarget.style.backgroundColor = "#2a2a2a";
|
|
14821
|
+
setHoveredErrorId(null);
|
|
14822
|
+
},
|
|
14823
|
+
onTouchStart: (e) => {
|
|
14824
|
+
e.stopPropagation();
|
|
14825
|
+
e.currentTarget.style.backgroundColor = "#333";
|
|
14826
|
+
setHoveredErrorId(errorId);
|
|
14827
|
+
},
|
|
14828
|
+
onTouchEnd: (e) => {
|
|
14829
|
+
e.stopPropagation();
|
|
14830
|
+
e.preventDefault();
|
|
14831
|
+
e.currentTarget.style.backgroundColor = "#2a2a2a";
|
|
14832
|
+
setHoveredErrorId(null);
|
|
14833
|
+
toggleExpandedError(errorId);
|
|
14834
|
+
},
|
|
14835
|
+
onClick: (e) => {
|
|
14836
|
+
e.stopPropagation();
|
|
14837
|
+
toggleExpandedError(errorId);
|
|
14838
|
+
},
|
|
14839
|
+
children: [
|
|
14840
|
+
/* @__PURE__ */ jsx21(
|
|
14841
|
+
"div",
|
|
14842
|
+
{
|
|
14843
|
+
style: {
|
|
14844
|
+
flex: 1,
|
|
14845
|
+
fontSize: isSmallScreen ? "12px" : "13px",
|
|
14846
|
+
color: "#ddd",
|
|
14847
|
+
lineHeight: 1.4,
|
|
14848
|
+
overflow: "hidden",
|
|
14849
|
+
textOverflow: "ellipsis",
|
|
14850
|
+
whiteSpace: "nowrap",
|
|
14851
|
+
userSelect: "text"
|
|
14852
|
+
},
|
|
14853
|
+
onMouseDown: (event) => event.stopPropagation(),
|
|
14854
|
+
onClick: (event) => event.stopPropagation(),
|
|
14855
|
+
children: errorMessage
|
|
14856
|
+
}
|
|
14857
|
+
),
|
|
14858
|
+
/* @__PURE__ */ jsx21(
|
|
14859
|
+
"div",
|
|
14860
|
+
{
|
|
14861
|
+
style: {
|
|
14862
|
+
color: "#888",
|
|
14863
|
+
fontSize: "16px",
|
|
14864
|
+
transform: isExpanded ? "rotate(0deg)" : "rotate(90deg)",
|
|
14865
|
+
transition: "transform 0.2s ease",
|
|
14866
|
+
flexShrink: 0
|
|
14867
|
+
},
|
|
14868
|
+
children: "\u203A"
|
|
14869
|
+
}
|
|
14870
|
+
)
|
|
14871
|
+
]
|
|
14872
|
+
}
|
|
14873
|
+
),
|
|
14874
|
+
isExpanded && /* @__PURE__ */ jsxs14(
|
|
14875
|
+
"div",
|
|
14876
|
+
{
|
|
14877
|
+
"data-error-id": index,
|
|
14878
|
+
style: {
|
|
14879
|
+
display: "block",
|
|
14880
|
+
padding: "12px 16px 12px 24px",
|
|
14881
|
+
backgroundColor: "#1a1a1a",
|
|
14882
|
+
borderTop: "1px solid #444",
|
|
14883
|
+
position: "relative"
|
|
14884
|
+
},
|
|
14885
|
+
children: [
|
|
14886
|
+
/* @__PURE__ */ jsx21(
|
|
14887
|
+
"div",
|
|
14888
|
+
{
|
|
14889
|
+
style: {
|
|
14890
|
+
fontSize: isSmallScreen ? "11px" : "12px",
|
|
14891
|
+
color: "#ccc",
|
|
14892
|
+
lineHeight: 1.5,
|
|
14893
|
+
wordWrap: "break-word",
|
|
14894
|
+
overflowWrap: "break-word",
|
|
14895
|
+
hyphens: "auto",
|
|
14896
|
+
userSelect: "text",
|
|
14897
|
+
paddingRight: 30
|
|
14898
|
+
},
|
|
14899
|
+
onMouseDown: (event) => event.stopPropagation(),
|
|
14900
|
+
onClick: (event) => event.stopPropagation(),
|
|
14901
|
+
children: errorMessage
|
|
14902
|
+
}
|
|
14903
|
+
),
|
|
14904
|
+
/* @__PURE__ */ jsx21(
|
|
14905
|
+
CopyErrorButton,
|
|
14906
|
+
{
|
|
14907
|
+
errorId,
|
|
14908
|
+
errorMessage,
|
|
14909
|
+
copiedErrorId,
|
|
14910
|
+
onCopy: (message, id) => {
|
|
14911
|
+
copyToClipboard(message);
|
|
14912
|
+
setCopiedErrorId(id);
|
|
14913
|
+
setTimeout(() => setCopiedErrorId(null), 2e3);
|
|
14914
|
+
}
|
|
14915
|
+
}
|
|
14916
|
+
)
|
|
14917
|
+
]
|
|
14918
|
+
}
|
|
14919
|
+
)
|
|
14920
|
+
]
|
|
14921
|
+
},
|
|
14922
|
+
errorId
|
|
14923
|
+
);
|
|
14924
|
+
})
|
|
14925
|
+
]
|
|
14926
|
+
},
|
|
14927
|
+
errorType
|
|
14928
|
+
);
|
|
14929
|
+
})
|
|
14930
|
+
}
|
|
14931
|
+
)
|
|
14932
|
+
] });
|
|
14933
|
+
};
|
|
14934
|
+
|
|
14935
|
+
// src/components/ToolbarOverlay.tsx
|
|
14936
|
+
import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
14937
|
+
var LayerButton = ({ name, selected, onClick }) => {
|
|
14938
|
+
const { style: touchStyle, ...touchHandlers } = useMobileTouch(onClick);
|
|
14939
|
+
return /* @__PURE__ */ jsxs15(
|
|
14940
|
+
"div",
|
|
14941
|
+
{
|
|
14942
|
+
className: css3`
|
|
14943
|
+
margin-top: 2px;
|
|
14944
|
+
padding: 4px;
|
|
14945
|
+
padding-left: 8px;
|
|
14946
|
+
padding-right: 18px;
|
|
14947
|
+
cursor: pointer;
|
|
14948
|
+
|
|
14949
|
+
&:hover {
|
|
14950
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
14951
|
+
}
|
|
14952
|
+
`,
|
|
14953
|
+
...touchHandlers,
|
|
14954
|
+
style: touchStyle,
|
|
14955
|
+
children: [
|
|
14956
|
+
/* @__PURE__ */ jsx22("span", { style: { marginRight: 2, opacity: selected ? 1 : 0 }, children: "\u2022" }),
|
|
14957
|
+
/* @__PURE__ */ jsx22(
|
|
14958
|
+
"span",
|
|
14959
|
+
{
|
|
14960
|
+
style: {
|
|
14961
|
+
marginLeft: 2,
|
|
14962
|
+
fontWeight: 500,
|
|
14963
|
+
color: LAYER_NAME_TO_COLOR[name.replace(/-/, "")]
|
|
14964
|
+
},
|
|
14965
|
+
children: name
|
|
14966
|
+
}
|
|
14967
|
+
)
|
|
14968
|
+
]
|
|
14969
|
+
}
|
|
14970
|
+
);
|
|
14971
|
+
};
|
|
14598
14972
|
var CheckboxMenuItem = ({
|
|
14599
14973
|
label,
|
|
14600
14974
|
checked,
|
|
14601
14975
|
onClick
|
|
14602
14976
|
}) => {
|
|
14603
14977
|
const { style: touchStyle, ...touchHandlers } = useMobileTouch(onClick);
|
|
14604
|
-
return /* @__PURE__ */
|
|
14978
|
+
return /* @__PURE__ */ jsxs15(
|
|
14605
14979
|
"div",
|
|
14606
14980
|
{
|
|
14607
14981
|
className: css3`
|
|
@@ -14621,16 +14995,16 @@ var CheckboxMenuItem = ({
|
|
|
14621
14995
|
...touchHandlers,
|
|
14622
14996
|
style: touchStyle,
|
|
14623
14997
|
children: [
|
|
14624
|
-
/* @__PURE__ */
|
|
14998
|
+
/* @__PURE__ */ jsx22("input", { type: "checkbox", checked, onChange: () => {
|
|
14625
14999
|
}, readOnly: true }),
|
|
14626
|
-
/* @__PURE__ */
|
|
15000
|
+
/* @__PURE__ */ jsx22("span", { style: { color: "#eee" }, children: label })
|
|
14627
15001
|
]
|
|
14628
15002
|
}
|
|
14629
15003
|
);
|
|
14630
15004
|
};
|
|
14631
15005
|
var RadioMenuItem = ({ label, checked, onClick }) => {
|
|
14632
15006
|
const { style: touchStyle, ...touchHandlers } = useMobileTouch(onClick);
|
|
14633
|
-
return /* @__PURE__ */
|
|
15007
|
+
return /* @__PURE__ */ jsxs15(
|
|
14634
15008
|
"div",
|
|
14635
15009
|
{
|
|
14636
15010
|
className: css3`
|
|
@@ -14650,46 +15024,13 @@ var RadioMenuItem = ({ label, checked, onClick }) => {
|
|
|
14650
15024
|
...touchHandlers,
|
|
14651
15025
|
style: touchStyle,
|
|
14652
15026
|
children: [
|
|
14653
|
-
/* @__PURE__ */
|
|
15027
|
+
/* @__PURE__ */ jsx22("input", { type: "radio", checked, onChange: () => {
|
|
14654
15028
|
}, readOnly: true }),
|
|
14655
|
-
/* @__PURE__ */
|
|
15029
|
+
/* @__PURE__ */ jsx22("span", { style: { color: "#eee" }, children: label })
|
|
14656
15030
|
]
|
|
14657
15031
|
}
|
|
14658
15032
|
);
|
|
14659
15033
|
};
|
|
14660
|
-
var CopyErrorButton = ({
|
|
14661
|
-
errorId,
|
|
14662
|
-
errorMessage,
|
|
14663
|
-
copiedErrorId,
|
|
14664
|
-
onCopy
|
|
14665
|
-
}) => {
|
|
14666
|
-
const { style: touchStyle, ...touchHandlers } = useMobileTouch(
|
|
14667
|
-
() => onCopy(errorMessage, errorId)
|
|
14668
|
-
);
|
|
14669
|
-
return /* @__PURE__ */ jsx20(
|
|
14670
|
-
"button",
|
|
14671
|
-
{
|
|
14672
|
-
type: "button",
|
|
14673
|
-
"aria-label": copiedErrorId === errorId ? "Error message copied" : "Copy error message",
|
|
14674
|
-
style: {
|
|
14675
|
-
position: "absolute",
|
|
14676
|
-
top: 12,
|
|
14677
|
-
right: 16,
|
|
14678
|
-
cursor: "pointer",
|
|
14679
|
-
color: "#888",
|
|
14680
|
-
fontSize: 16,
|
|
14681
|
-
background: "none",
|
|
14682
|
-
border: "none",
|
|
14683
|
-
padding: 0,
|
|
14684
|
-
display: "flex",
|
|
14685
|
-
alignItems: "center",
|
|
14686
|
-
...touchStyle
|
|
14687
|
-
},
|
|
14688
|
-
...touchHandlers,
|
|
14689
|
-
children: copiedErrorId === errorId ? /* @__PURE__ */ jsx20("span", { style: { color: "#4caf50", fontSize: 12 }, children: "Copied!" }) : /* @__PURE__ */ jsx20("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx20("path", { d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" }) })
|
|
14690
|
-
}
|
|
14691
|
-
);
|
|
14692
|
-
};
|
|
14693
15034
|
var ToolbarOverlay = ({ children, elements }) => {
|
|
14694
15035
|
const isSmallScreen = useIsSmallScreen();
|
|
14695
15036
|
const {
|
|
@@ -14751,14 +15092,10 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
14751
15092
|
setPcbGroupViewMode: s.setPcbGroupViewMode,
|
|
14752
15093
|
setHoveredErrorId: s.setHoveredErrorId
|
|
14753
15094
|
}));
|
|
14754
|
-
const [isViewMenuOpen, setViewMenuOpen] =
|
|
14755
|
-
const [isLayerMenuOpen, setLayerMenuOpen] =
|
|
14756
|
-
const [isErrorsOpen, setErrorsOpen] =
|
|
14757
|
-
const [measureToolArmed, setMeasureToolArmed] =
|
|
14758
|
-
const [copiedErrorId, setCopiedErrorId] = useState10(null);
|
|
14759
|
-
const [, copyToClipboard] = useCopyToClipboard_default();
|
|
14760
|
-
const errorElementsRef = useRef13(/* @__PURE__ */ new Map());
|
|
14761
|
-
const arrowElementsRef = useRef13(/* @__PURE__ */ new Map());
|
|
15095
|
+
const [isViewMenuOpen, setViewMenuOpen] = useState11(false);
|
|
15096
|
+
const [isLayerMenuOpen, setLayerMenuOpen] = useState11(false);
|
|
15097
|
+
const [isErrorsOpen, setErrorsOpen] = useState11(false);
|
|
15098
|
+
const [measureToolArmed, setMeasureToolArmed] = useState11(false);
|
|
14762
15099
|
useEffect16(() => {
|
|
14763
15100
|
const arm = () => setMeasureToolArmed(true);
|
|
14764
15101
|
const disarm = () => setMeasureToolArmed(false);
|
|
@@ -14769,8 +15106,6 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
14769
15106
|
window.removeEventListener("disarm-dimension-tool", disarm);
|
|
14770
15107
|
};
|
|
14771
15108
|
}, []);
|
|
14772
|
-
const errorCount = elements?.filter((e) => e.type.includes("error")).length ?? 0;
|
|
14773
|
-
const errorElements = elements?.filter((el) => el.type.includes("error")) || [];
|
|
14774
15109
|
const pcbBoard = elements?.find((el) => el.type === "pcb_board");
|
|
14775
15110
|
const numLayers = pcbBoard?.num_layers || 2;
|
|
14776
15111
|
const availableLayers = numLayers <= 2 ? ["top", "bottom"] : [
|
|
@@ -14825,25 +15160,25 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
14825
15160
|
document.removeEventListener("mousemove", checkMousePosition);
|
|
14826
15161
|
};
|
|
14827
15162
|
}, [setIsMouseOverContainer]);
|
|
14828
|
-
const handleMouseEnter =
|
|
15163
|
+
const handleMouseEnter = useCallback9(() => {
|
|
14829
15164
|
setIsMouseOverContainer(true);
|
|
14830
15165
|
}, [setIsMouseOverContainer]);
|
|
14831
|
-
const handleMouseMove =
|
|
15166
|
+
const handleMouseMove = useCallback9(() => {
|
|
14832
15167
|
if (!isMouseOverContainer) {
|
|
14833
15168
|
setIsMouseOverContainer(true);
|
|
14834
15169
|
}
|
|
14835
15170
|
}, [isMouseOverContainer, setIsMouseOverContainer]);
|
|
14836
|
-
const handleMouseLeave =
|
|
15171
|
+
const handleMouseLeave = useCallback9(() => {
|
|
14837
15172
|
setIsMouseOverContainer(false);
|
|
14838
15173
|
setLayerMenuOpen(false);
|
|
14839
15174
|
setViewMenuOpen(false);
|
|
14840
15175
|
setErrorsOpen(false);
|
|
14841
15176
|
setHoveredErrorId(null);
|
|
14842
15177
|
}, [setIsMouseOverContainer, setHoveredErrorId]);
|
|
14843
|
-
const handleLayerMenuToggle =
|
|
15178
|
+
const handleLayerMenuToggle = useCallback9(() => {
|
|
14844
15179
|
setLayerMenuOpen(!isLayerMenuOpen);
|
|
14845
15180
|
}, [isLayerMenuOpen]);
|
|
14846
|
-
const handleErrorsToggle =
|
|
15181
|
+
const handleErrorsToggle = useCallback9(() => {
|
|
14847
15182
|
const newErrorsOpen = !isErrorsOpen;
|
|
14848
15183
|
setErrorsOpen(newErrorsOpen);
|
|
14849
15184
|
if (newErrorsOpen) {
|
|
@@ -14853,33 +15188,33 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
14853
15188
|
setHoveredErrorId(null);
|
|
14854
15189
|
}
|
|
14855
15190
|
}, [isErrorsOpen, setHoveredErrorId]);
|
|
14856
|
-
const handleEditTraceToggle =
|
|
15191
|
+
const handleEditTraceToggle = useCallback9(() => {
|
|
14857
15192
|
setEditMode(editModes.in_draw_trace_mode ? "off" : "draw_trace");
|
|
14858
15193
|
}, [editModes.in_draw_trace_mode, setEditMode]);
|
|
14859
|
-
const handleMoveComponentToggle =
|
|
15194
|
+
const handleMoveComponentToggle = useCallback9(() => {
|
|
14860
15195
|
setEditMode(editModes.in_move_footprint_mode ? "off" : "move_footprint");
|
|
14861
15196
|
}, [editModes.in_move_footprint_mode, setEditMode]);
|
|
14862
|
-
const handleRatsNestToggle =
|
|
15197
|
+
const handleRatsNestToggle = useCallback9(() => {
|
|
14863
15198
|
setIsShowingRatsNest(!viewSettings.is_showing_rats_nest);
|
|
14864
15199
|
}, [viewSettings.is_showing_rats_nest, setIsShowingRatsNest]);
|
|
14865
|
-
const handleMeasureToolClick =
|
|
15200
|
+
const handleMeasureToolClick = useCallback9(() => {
|
|
14866
15201
|
setMeasureToolArmed(true);
|
|
14867
15202
|
window.dispatchEvent(new Event("arm-dimension-tool"));
|
|
14868
15203
|
}, []);
|
|
14869
|
-
const handleViewMenuToggle =
|
|
15204
|
+
const handleViewMenuToggle = useCallback9(() => {
|
|
14870
15205
|
const newViewMenuOpen = !isViewMenuOpen;
|
|
14871
15206
|
setViewMenuOpen(newViewMenuOpen);
|
|
14872
15207
|
if (newViewMenuOpen) {
|
|
14873
15208
|
setErrorsOpen(false);
|
|
14874
15209
|
}
|
|
14875
15210
|
}, [isViewMenuOpen]);
|
|
14876
|
-
const stopCanvasInteractionPropagation =
|
|
15211
|
+
const stopCanvasInteractionPropagation = useCallback9(
|
|
14877
15212
|
(event) => {
|
|
14878
15213
|
event.stopPropagation();
|
|
14879
15214
|
},
|
|
14880
15215
|
[]
|
|
14881
15216
|
);
|
|
14882
|
-
return /* @__PURE__ */
|
|
15217
|
+
return /* @__PURE__ */ jsxs15(
|
|
14883
15218
|
"div",
|
|
14884
15219
|
{
|
|
14885
15220
|
ref: hotkeyBoundaryRef,
|
|
@@ -14889,7 +15224,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
14889
15224
|
onMouseMove: handleMouseMove,
|
|
14890
15225
|
children: [
|
|
14891
15226
|
children,
|
|
14892
|
-
/* @__PURE__ */
|
|
15227
|
+
/* @__PURE__ */ jsxs15(
|
|
14893
15228
|
"div",
|
|
14894
15229
|
{
|
|
14895
15230
|
style: {
|
|
@@ -14910,7 +15245,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
14910
15245
|
]
|
|
14911
15246
|
}
|
|
14912
15247
|
),
|
|
14913
|
-
/* @__PURE__ */
|
|
15248
|
+
/* @__PURE__ */ jsxs15(
|
|
14914
15249
|
"div",
|
|
14915
15250
|
{
|
|
14916
15251
|
"data-toolbar-overlay": true,
|
|
@@ -14940,7 +15275,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
14940
15275
|
fontFamily: "sans-serif"
|
|
14941
15276
|
},
|
|
14942
15277
|
children: [
|
|
14943
|
-
/* @__PURE__ */
|
|
15278
|
+
/* @__PURE__ */ jsxs15(
|
|
14944
15279
|
ToolbarButton,
|
|
14945
15280
|
{
|
|
14946
15281
|
isSmallScreen,
|
|
@@ -14951,10 +15286,10 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
14951
15286
|
}
|
|
14952
15287
|
},
|
|
14953
15288
|
children: [
|
|
14954
|
-
/* @__PURE__ */
|
|
15289
|
+
/* @__PURE__ */ jsxs15("div", { children: [
|
|
14955
15290
|
"layer:",
|
|
14956
15291
|
" ",
|
|
14957
|
-
/* @__PURE__ */
|
|
15292
|
+
/* @__PURE__ */ jsx22(
|
|
14958
15293
|
"span",
|
|
14959
15294
|
{
|
|
14960
15295
|
style: {
|
|
@@ -14966,7 +15301,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
14966
15301
|
}
|
|
14967
15302
|
)
|
|
14968
15303
|
] }),
|
|
14969
|
-
isLayerMenuOpen && /* @__PURE__ */
|
|
15304
|
+
isLayerMenuOpen && /* @__PURE__ */ jsx22("div", { style: { marginTop: 4, minWidth: 120 }, children: processedLayers.map((layer) => /* @__PURE__ */ jsx22(
|
|
14970
15305
|
LayerButton,
|
|
14971
15306
|
{
|
|
14972
15307
|
name: layer,
|
|
@@ -14980,259 +15315,68 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
14980
15315
|
]
|
|
14981
15316
|
}
|
|
14982
15317
|
),
|
|
14983
|
-
/* @__PURE__ */
|
|
14984
|
-
|
|
15318
|
+
/* @__PURE__ */ jsx22(
|
|
15319
|
+
ToolbarErrorDropdown,
|
|
14985
15320
|
{
|
|
15321
|
+
elements,
|
|
15322
|
+
isOpen: isErrorsOpen,
|
|
14986
15323
|
isSmallScreen,
|
|
14987
|
-
|
|
14988
|
-
|
|
14989
|
-
...errorCount > 0 ? { color: "red" } : {}
|
|
14990
|
-
},
|
|
14991
|
-
onClick: handleErrorsToggle,
|
|
14992
|
-
children: /* @__PURE__ */ jsxs14("div", { children: [
|
|
14993
|
-
errorCount,
|
|
14994
|
-
" errors"
|
|
14995
|
-
] })
|
|
15324
|
+
onToggle: handleErrorsToggle,
|
|
15325
|
+
setHoveredErrorId
|
|
14996
15326
|
}
|
|
14997
15327
|
),
|
|
14998
|
-
|
|
14999
|
-
"div",
|
|
15000
|
-
{
|
|
15001
|
-
style: {
|
|
15002
|
-
position: "absolute",
|
|
15003
|
-
top: "100%",
|
|
15004
|
-
left: 0,
|
|
15005
|
-
backgroundColor: "#2a2a2a",
|
|
15006
|
-
border: "1px solid #666",
|
|
15007
|
-
borderRadius: 4,
|
|
15008
|
-
marginTop: 4,
|
|
15009
|
-
zIndex: 1e3,
|
|
15010
|
-
minWidth: isSmallScreen ? "280px" : "400px",
|
|
15011
|
-
maxWidth: isSmallScreen ? "90vw" : "600px",
|
|
15012
|
-
maxHeight: "400px",
|
|
15013
|
-
overflow: "auto",
|
|
15014
|
-
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.3)"
|
|
15015
|
-
},
|
|
15016
|
-
children: errorElements.map((e, i) => {
|
|
15017
|
-
const errorId = e.pcb_trace_error_id || `error_${i}_${e.error_type}_${e.message?.slice(0, 20)}`;
|
|
15018
|
-
return /* @__PURE__ */ jsxs14(
|
|
15019
|
-
"div",
|
|
15020
|
-
{
|
|
15021
|
-
style: {
|
|
15022
|
-
borderBottom: i < errorElements.length - 1 ? "1px solid #444" : "none"
|
|
15023
|
-
},
|
|
15024
|
-
children: [
|
|
15025
|
-
/* @__PURE__ */ jsxs14(
|
|
15026
|
-
"div",
|
|
15027
|
-
{
|
|
15028
|
-
style: {
|
|
15029
|
-
display: "flex",
|
|
15030
|
-
alignItems: "center",
|
|
15031
|
-
gap: 12,
|
|
15032
|
-
padding: "12px 16px",
|
|
15033
|
-
cursor: "pointer",
|
|
15034
|
-
backgroundColor: "#2a2a2a",
|
|
15035
|
-
transition: "background-color 0.2s ease",
|
|
15036
|
-
touchAction: "manipulation"
|
|
15037
|
-
},
|
|
15038
|
-
onMouseEnter: (e2) => {
|
|
15039
|
-
e2.currentTarget.style.backgroundColor = "#333";
|
|
15040
|
-
setHoveredErrorId(errorId);
|
|
15041
|
-
},
|
|
15042
|
-
onMouseLeave: (e2) => {
|
|
15043
|
-
e2.currentTarget.style.backgroundColor = "#2a2a2a";
|
|
15044
|
-
setHoveredErrorId(null);
|
|
15045
|
-
},
|
|
15046
|
-
onTouchStart: (e2) => {
|
|
15047
|
-
e2.stopPropagation();
|
|
15048
|
-
e2.currentTarget.style.backgroundColor = "#333";
|
|
15049
|
-
setHoveredErrorId(errorId);
|
|
15050
|
-
},
|
|
15051
|
-
onTouchEnd: (e2) => {
|
|
15052
|
-
e2.stopPropagation();
|
|
15053
|
-
e2.preventDefault();
|
|
15054
|
-
e2.currentTarget.style.backgroundColor = "#2a2a2a";
|
|
15055
|
-
setHoveredErrorId(null);
|
|
15056
|
-
const errorElement = errorElementsRef.current.get(i);
|
|
15057
|
-
const arrow = arrowElementsRef.current.get(i);
|
|
15058
|
-
if (errorElement && arrow) {
|
|
15059
|
-
const isVisible = errorElement.style.display !== "none";
|
|
15060
|
-
errorElement.style.display = isVisible ? "none" : "block";
|
|
15061
|
-
arrow.style.transform = isVisible ? "rotate(90deg)" : "rotate(0deg)";
|
|
15062
|
-
}
|
|
15063
|
-
},
|
|
15064
|
-
onClick: (e2) => {
|
|
15065
|
-
e2.stopPropagation();
|
|
15066
|
-
const errorElement = errorElementsRef.current.get(i);
|
|
15067
|
-
const arrow = arrowElementsRef.current.get(i);
|
|
15068
|
-
if (errorElement && arrow) {
|
|
15069
|
-
const isVisible = errorElement.style.display !== "none";
|
|
15070
|
-
errorElement.style.display = isVisible ? "none" : "block";
|
|
15071
|
-
arrow.style.transform = isVisible ? "rotate(90deg)" : "rotate(0deg)";
|
|
15072
|
-
}
|
|
15073
|
-
},
|
|
15074
|
-
children: [
|
|
15075
|
-
/* @__PURE__ */ jsx20(
|
|
15076
|
-
"div",
|
|
15077
|
-
{
|
|
15078
|
-
style: {
|
|
15079
|
-
fontWeight: "bold",
|
|
15080
|
-
fontSize: isSmallScreen ? "12px" : "13px",
|
|
15081
|
-
whiteSpace: "nowrap",
|
|
15082
|
-
flexShrink: 0,
|
|
15083
|
-
color: "#ff6b6b",
|
|
15084
|
-
display: isSmallScreen ? "none" : "block"
|
|
15085
|
-
},
|
|
15086
|
-
children: e.error_type
|
|
15087
|
-
}
|
|
15088
|
-
),
|
|
15089
|
-
/* @__PURE__ */ jsx20(
|
|
15090
|
-
"div",
|
|
15091
|
-
{
|
|
15092
|
-
style: {
|
|
15093
|
-
flex: 1,
|
|
15094
|
-
fontSize: isSmallScreen ? "12px" : "13px",
|
|
15095
|
-
color: "#ddd",
|
|
15096
|
-
lineHeight: 1.4,
|
|
15097
|
-
overflow: "hidden",
|
|
15098
|
-
textOverflow: "ellipsis",
|
|
15099
|
-
whiteSpace: "nowrap",
|
|
15100
|
-
userSelect: "text"
|
|
15101
|
-
},
|
|
15102
|
-
onMouseDown: (event) => event.stopPropagation(),
|
|
15103
|
-
onClick: (event) => event.stopPropagation(),
|
|
15104
|
-
children: e.message
|
|
15105
|
-
}
|
|
15106
|
-
),
|
|
15107
|
-
/* @__PURE__ */ jsx20(
|
|
15108
|
-
"div",
|
|
15109
|
-
{
|
|
15110
|
-
ref: (el) => {
|
|
15111
|
-
if (el) arrowElementsRef.current.set(i, el);
|
|
15112
|
-
},
|
|
15113
|
-
"data-arrow-id": i,
|
|
15114
|
-
style: {
|
|
15115
|
-
color: "#888",
|
|
15116
|
-
fontSize: "16px",
|
|
15117
|
-
transform: "rotate(90deg)",
|
|
15118
|
-
transition: "transform 0.2s ease",
|
|
15119
|
-
flexShrink: 0
|
|
15120
|
-
},
|
|
15121
|
-
children: "\u203A"
|
|
15122
|
-
}
|
|
15123
|
-
)
|
|
15124
|
-
]
|
|
15125
|
-
}
|
|
15126
|
-
),
|
|
15127
|
-
/* @__PURE__ */ jsxs14(
|
|
15128
|
-
"div",
|
|
15129
|
-
{
|
|
15130
|
-
ref: (el) => {
|
|
15131
|
-
if (el) errorElementsRef.current.set(i, el);
|
|
15132
|
-
},
|
|
15133
|
-
"data-error-id": i,
|
|
15134
|
-
style: {
|
|
15135
|
-
display: "none",
|
|
15136
|
-
padding: "12px 16px",
|
|
15137
|
-
backgroundColor: "#1a1a1a",
|
|
15138
|
-
borderTop: "1px solid #444",
|
|
15139
|
-
position: "relative"
|
|
15140
|
-
},
|
|
15141
|
-
children: [
|
|
15142
|
-
/* @__PURE__ */ jsx20(
|
|
15143
|
-
"div",
|
|
15144
|
-
{
|
|
15145
|
-
style: {
|
|
15146
|
-
fontSize: isSmallScreen ? "11px" : "12px",
|
|
15147
|
-
color: "#ccc",
|
|
15148
|
-
lineHeight: 1.5,
|
|
15149
|
-
wordWrap: "break-word",
|
|
15150
|
-
overflowWrap: "break-word",
|
|
15151
|
-
hyphens: "auto",
|
|
15152
|
-
userSelect: "text",
|
|
15153
|
-
paddingRight: 30
|
|
15154
|
-
// Space for the copy icon
|
|
15155
|
-
},
|
|
15156
|
-
onMouseDown: (event) => event.stopPropagation(),
|
|
15157
|
-
onClick: (event) => event.stopPropagation(),
|
|
15158
|
-
children: e.message
|
|
15159
|
-
}
|
|
15160
|
-
),
|
|
15161
|
-
/* @__PURE__ */ jsx20(
|
|
15162
|
-
CopyErrorButton,
|
|
15163
|
-
{
|
|
15164
|
-
errorId,
|
|
15165
|
-
errorMessage: e.message,
|
|
15166
|
-
copiedErrorId,
|
|
15167
|
-
onCopy: (msg, id) => {
|
|
15168
|
-
copyToClipboard(msg);
|
|
15169
|
-
setCopiedErrorId(id);
|
|
15170
|
-
setTimeout(() => setCopiedErrorId(null), 2e3);
|
|
15171
|
-
}
|
|
15172
|
-
}
|
|
15173
|
-
)
|
|
15174
|
-
]
|
|
15175
|
-
}
|
|
15176
|
-
)
|
|
15177
|
-
]
|
|
15178
|
-
},
|
|
15179
|
-
errorId
|
|
15180
|
-
);
|
|
15181
|
-
})
|
|
15182
|
-
}
|
|
15183
|
-
),
|
|
15184
|
-
/* @__PURE__ */ jsx20(
|
|
15328
|
+
/* @__PURE__ */ jsx22(
|
|
15185
15329
|
ToolbarButton,
|
|
15186
15330
|
{
|
|
15187
15331
|
isSmallScreen,
|
|
15188
15332
|
style: {},
|
|
15189
15333
|
onClick: handleEditTraceToggle,
|
|
15190
|
-
children: /* @__PURE__ */
|
|
15334
|
+
children: /* @__PURE__ */ jsxs15("div", { children: [
|
|
15191
15335
|
editModes.in_draw_trace_mode ? "\u2716 " : "",
|
|
15192
15336
|
"Edit Traces"
|
|
15193
15337
|
] })
|
|
15194
15338
|
}
|
|
15195
15339
|
),
|
|
15196
|
-
/* @__PURE__ */
|
|
15340
|
+
/* @__PURE__ */ jsx22(
|
|
15197
15341
|
ToolbarButton,
|
|
15198
15342
|
{
|
|
15199
15343
|
isSmallScreen,
|
|
15200
15344
|
style: {},
|
|
15201
15345
|
onClick: handleMoveComponentToggle,
|
|
15202
|
-
children: /* @__PURE__ */
|
|
15346
|
+
children: /* @__PURE__ */ jsxs15("div", { children: [
|
|
15203
15347
|
editModes.in_move_footprint_mode ? "\u2716 " : "",
|
|
15204
15348
|
"Move Components"
|
|
15205
15349
|
] })
|
|
15206
15350
|
}
|
|
15207
15351
|
),
|
|
15208
|
-
/* @__PURE__ */
|
|
15352
|
+
/* @__PURE__ */ jsx22(
|
|
15209
15353
|
ToolbarButton,
|
|
15210
15354
|
{
|
|
15211
15355
|
isSmallScreen,
|
|
15212
15356
|
style: {},
|
|
15213
15357
|
onClick: handleRatsNestToggle,
|
|
15214
|
-
children: /* @__PURE__ */
|
|
15358
|
+
children: /* @__PURE__ */ jsxs15("div", { children: [
|
|
15215
15359
|
viewSettings.is_showing_rats_nest ? "\u2716 " : "",
|
|
15216
15360
|
"Rats Nest"
|
|
15217
15361
|
] })
|
|
15218
15362
|
}
|
|
15219
15363
|
),
|
|
15220
|
-
/* @__PURE__ */
|
|
15364
|
+
/* @__PURE__ */ jsx22(
|
|
15221
15365
|
ToolbarButton,
|
|
15222
15366
|
{
|
|
15223
15367
|
isSmallScreen,
|
|
15224
15368
|
style: measureToolArmed ? { backgroundColor: "#444" } : {},
|
|
15225
15369
|
onClick: handleMeasureToolClick,
|
|
15226
|
-
children: /* @__PURE__ */
|
|
15370
|
+
children: /* @__PURE__ */ jsx22("div", { children: "\u{1F4CF}" })
|
|
15227
15371
|
}
|
|
15228
15372
|
),
|
|
15229
|
-
/* @__PURE__ */
|
|
15373
|
+
/* @__PURE__ */ jsx22(
|
|
15230
15374
|
ToolbarButton,
|
|
15231
15375
|
{
|
|
15232
15376
|
isSmallScreen,
|
|
15233
15377
|
onClick: handleViewMenuToggle,
|
|
15234
|
-
children: /* @__PURE__ */
|
|
15235
|
-
/* @__PURE__ */
|
|
15378
|
+
children: /* @__PURE__ */ jsxs15("div", { children: [
|
|
15379
|
+
/* @__PURE__ */ jsxs15(
|
|
15236
15380
|
"div",
|
|
15237
15381
|
{
|
|
15238
15382
|
style: {
|
|
@@ -15242,7 +15386,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15242
15386
|
},
|
|
15243
15387
|
children: [
|
|
15244
15388
|
"View",
|
|
15245
|
-
/* @__PURE__ */
|
|
15389
|
+
/* @__PURE__ */ jsx22(
|
|
15246
15390
|
"span",
|
|
15247
15391
|
{
|
|
15248
15392
|
style: {
|
|
@@ -15257,8 +15401,8 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15257
15401
|
]
|
|
15258
15402
|
}
|
|
15259
15403
|
),
|
|
15260
|
-
isViewMenuOpen && /* @__PURE__ */
|
|
15261
|
-
/* @__PURE__ */
|
|
15404
|
+
isViewMenuOpen && /* @__PURE__ */ jsxs15("div", { style: { marginTop: 4, minWidth: 120 }, children: [
|
|
15405
|
+
/* @__PURE__ */ jsx22(
|
|
15262
15406
|
CheckboxMenuItem,
|
|
15263
15407
|
{
|
|
15264
15408
|
label: "Show All Trace Lengths",
|
|
@@ -15270,7 +15414,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15270
15414
|
}
|
|
15271
15415
|
}
|
|
15272
15416
|
),
|
|
15273
|
-
/* @__PURE__ */
|
|
15417
|
+
/* @__PURE__ */ jsx22(
|
|
15274
15418
|
CheckboxMenuItem,
|
|
15275
15419
|
{
|
|
15276
15420
|
label: "Show Autorouting Animation",
|
|
@@ -15282,7 +15426,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15282
15426
|
}
|
|
15283
15427
|
}
|
|
15284
15428
|
),
|
|
15285
|
-
/* @__PURE__ */
|
|
15429
|
+
/* @__PURE__ */ jsx22(
|
|
15286
15430
|
CheckboxMenuItem,
|
|
15287
15431
|
{
|
|
15288
15432
|
label: "Show DRC Errors",
|
|
@@ -15292,7 +15436,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15292
15436
|
}
|
|
15293
15437
|
}
|
|
15294
15438
|
),
|
|
15295
|
-
/* @__PURE__ */
|
|
15439
|
+
/* @__PURE__ */ jsx22(
|
|
15296
15440
|
CheckboxMenuItem,
|
|
15297
15441
|
{
|
|
15298
15442
|
label: "Show Copper Pours",
|
|
@@ -15304,7 +15448,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15304
15448
|
}
|
|
15305
15449
|
}
|
|
15306
15450
|
),
|
|
15307
|
-
/* @__PURE__ */
|
|
15451
|
+
/* @__PURE__ */ jsx22(
|
|
15308
15452
|
CheckboxMenuItem,
|
|
15309
15453
|
{
|
|
15310
15454
|
label: "Show Courtyards",
|
|
@@ -15314,7 +15458,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15314
15458
|
}
|
|
15315
15459
|
}
|
|
15316
15460
|
),
|
|
15317
|
-
/* @__PURE__ */
|
|
15461
|
+
/* @__PURE__ */ jsx22(
|
|
15318
15462
|
CheckboxMenuItem,
|
|
15319
15463
|
{
|
|
15320
15464
|
label: "Show Solder Mask",
|
|
@@ -15324,7 +15468,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15324
15468
|
}
|
|
15325
15469
|
}
|
|
15326
15470
|
),
|
|
15327
|
-
/* @__PURE__ */
|
|
15471
|
+
/* @__PURE__ */ jsx22(
|
|
15328
15472
|
CheckboxMenuItem,
|
|
15329
15473
|
{
|
|
15330
15474
|
label: "Show Silkscreen",
|
|
@@ -15334,7 +15478,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15334
15478
|
}
|
|
15335
15479
|
}
|
|
15336
15480
|
),
|
|
15337
|
-
/* @__PURE__ */
|
|
15481
|
+
/* @__PURE__ */ jsx22(
|
|
15338
15482
|
CheckboxMenuItem,
|
|
15339
15483
|
{
|
|
15340
15484
|
label: "Show Fabrication Notes",
|
|
@@ -15346,7 +15490,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15346
15490
|
}
|
|
15347
15491
|
}
|
|
15348
15492
|
),
|
|
15349
|
-
/* @__PURE__ */
|
|
15493
|
+
/* @__PURE__ */ jsx22(
|
|
15350
15494
|
CheckboxMenuItem,
|
|
15351
15495
|
{
|
|
15352
15496
|
label: "Show Group Anchor Offsets",
|
|
@@ -15358,7 +15502,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15358
15502
|
}
|
|
15359
15503
|
}
|
|
15360
15504
|
),
|
|
15361
|
-
/* @__PURE__ */
|
|
15505
|
+
/* @__PURE__ */ jsx22(
|
|
15362
15506
|
CheckboxMenuItem,
|
|
15363
15507
|
{
|
|
15364
15508
|
label: "Show PCB Groups",
|
|
@@ -15368,8 +15512,8 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15368
15512
|
}
|
|
15369
15513
|
}
|
|
15370
15514
|
),
|
|
15371
|
-
viewSettings.is_showing_pcb_groups && /* @__PURE__ */
|
|
15372
|
-
/* @__PURE__ */
|
|
15515
|
+
viewSettings.is_showing_pcb_groups && /* @__PURE__ */ jsxs15("div", { style: { marginLeft: 16 }, children: [
|
|
15516
|
+
/* @__PURE__ */ jsx22(
|
|
15373
15517
|
RadioMenuItem,
|
|
15374
15518
|
{
|
|
15375
15519
|
label: "Show All Groups",
|
|
@@ -15379,7 +15523,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15379
15523
|
}
|
|
15380
15524
|
}
|
|
15381
15525
|
),
|
|
15382
|
-
/* @__PURE__ */
|
|
15526
|
+
/* @__PURE__ */ jsx22(
|
|
15383
15527
|
RadioMenuItem,
|
|
15384
15528
|
{
|
|
15385
15529
|
label: "Show Named Groups",
|
|
@@ -15403,18 +15547,18 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15403
15547
|
};
|
|
15404
15548
|
|
|
15405
15549
|
// src/components/CanvasElementsRenderer.tsx
|
|
15406
|
-
import { jsx as
|
|
15550
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
15407
15551
|
var CanvasElementsRenderer = (props) => {
|
|
15408
15552
|
const { transform, elements } = props;
|
|
15409
15553
|
const hoveredErrorId = useGlobalStore((state) => state.hovered_error_id);
|
|
15410
15554
|
const isShowingCopperPours = useGlobalStore(
|
|
15411
15555
|
(state) => state.is_showing_copper_pours
|
|
15412
15556
|
);
|
|
15413
|
-
const elementsToRender =
|
|
15557
|
+
const elementsToRender = useMemo8(
|
|
15414
15558
|
() => isShowingCopperPours ? elements : elements.filter((elm) => elm.type !== "pcb_copper_pour"),
|
|
15415
15559
|
[elements, isShowingCopperPours]
|
|
15416
15560
|
);
|
|
15417
|
-
const [primitivesWithoutInteractionMetadata, connectivityMap] =
|
|
15561
|
+
const [primitivesWithoutInteractionMetadata, connectivityMap] = useMemo8(() => {
|
|
15418
15562
|
const primitivesWithoutInteractionMetadata2 = elementsToRender.flatMap(
|
|
15419
15563
|
(elm) => convertElementToPrimitives(elm, props.elements)
|
|
15420
15564
|
);
|
|
@@ -15423,12 +15567,12 @@ var CanvasElementsRenderer = (props) => {
|
|
|
15423
15567
|
);
|
|
15424
15568
|
return [primitivesWithoutInteractionMetadata2, connectivityMap2];
|
|
15425
15569
|
}, [elementsToRender, props.elements]);
|
|
15426
|
-
const [hoverState, setHoverState] =
|
|
15570
|
+
const [hoverState, setHoverState] = useState12({
|
|
15427
15571
|
drawingObjectIdsWithMouseOver: /* @__PURE__ */ new Set(),
|
|
15428
15572
|
primitiveIdsInMousedOverNet: []
|
|
15429
15573
|
});
|
|
15430
|
-
const [hoveredComponentIds, setHoveredComponentIds] =
|
|
15431
|
-
const errorRelatedIds =
|
|
15574
|
+
const [hoveredComponentIds, setHoveredComponentIds] = useState12([]);
|
|
15575
|
+
const errorRelatedIds = useMemo8(() => {
|
|
15432
15576
|
if (!hoveredErrorId) return [];
|
|
15433
15577
|
const errorElements = elements.filter(
|
|
15434
15578
|
(el) => el.type.includes("error")
|
|
@@ -15447,7 +15591,7 @@ var CanvasElementsRenderer = (props) => {
|
|
|
15447
15591
|
}
|
|
15448
15592
|
return relatedIds;
|
|
15449
15593
|
}, [hoveredErrorId, elements]);
|
|
15450
|
-
const primitives =
|
|
15594
|
+
const primitives = useMemo8(() => {
|
|
15451
15595
|
const combinedPrimitiveIds = [
|
|
15452
15596
|
...hoverState.primitiveIdsInMousedOverNet,
|
|
15453
15597
|
...errorRelatedIds
|
|
@@ -15458,7 +15602,7 @@ var CanvasElementsRenderer = (props) => {
|
|
|
15458
15602
|
primitiveIdsInMousedOverNet: combinedPrimitiveIds
|
|
15459
15603
|
});
|
|
15460
15604
|
}, [primitivesWithoutInteractionMetadata, hoverState, errorRelatedIds]);
|
|
15461
|
-
const onMouseOverPrimitives =
|
|
15605
|
+
const onMouseOverPrimitives = useCallback10(
|
|
15462
15606
|
(primitivesHoveredOver) => {
|
|
15463
15607
|
const primitiveIdsInMousedOverNet = [];
|
|
15464
15608
|
for (const primitive of primitivesHoveredOver) {
|
|
@@ -15491,14 +15635,14 @@ var CanvasElementsRenderer = (props) => {
|
|
|
15491
15635
|
},
|
|
15492
15636
|
[connectivityMap]
|
|
15493
15637
|
);
|
|
15494
|
-
return /* @__PURE__ */
|
|
15638
|
+
return /* @__PURE__ */ jsx23(
|
|
15495
15639
|
MouseElementTracker,
|
|
15496
15640
|
{
|
|
15497
15641
|
elements: elementsToRender,
|
|
15498
15642
|
transform,
|
|
15499
15643
|
primitives: primitivesWithoutInteractionMetadata,
|
|
15500
15644
|
onMouseHoverOverPrimitives: onMouseOverPrimitives,
|
|
15501
|
-
children: /* @__PURE__ */
|
|
15645
|
+
children: /* @__PURE__ */ jsx23(
|
|
15502
15646
|
EditPlacementOverlay,
|
|
15503
15647
|
{
|
|
15504
15648
|
disabled: !props.allowEditing,
|
|
@@ -15507,7 +15651,7 @@ var CanvasElementsRenderer = (props) => {
|
|
|
15507
15651
|
cancelPanDrag: props.cancelPanDrag,
|
|
15508
15652
|
onCreateEditEvent: props.onCreateEditEvent,
|
|
15509
15653
|
onModifyEditEvent: props.onModifyEditEvent,
|
|
15510
|
-
children: /* @__PURE__ */
|
|
15654
|
+
children: /* @__PURE__ */ jsx23(
|
|
15511
15655
|
EditTraceHintOverlay,
|
|
15512
15656
|
{
|
|
15513
15657
|
disabled: !props.allowEditing,
|
|
@@ -15516,29 +15660,29 @@ var CanvasElementsRenderer = (props) => {
|
|
|
15516
15660
|
cancelPanDrag: props.cancelPanDrag,
|
|
15517
15661
|
onCreateEditEvent: props.onCreateEditEvent,
|
|
15518
15662
|
onModifyEditEvent: props.onModifyEditEvent,
|
|
15519
|
-
children: /* @__PURE__ */
|
|
15663
|
+
children: /* @__PURE__ */ jsx23(
|
|
15520
15664
|
DimensionOverlay,
|
|
15521
15665
|
{
|
|
15522
15666
|
transform,
|
|
15523
15667
|
focusOnHover: props.focusOnHover,
|
|
15524
15668
|
primitives: primitivesWithoutInteractionMetadata,
|
|
15525
|
-
children: /* @__PURE__ */
|
|
15669
|
+
children: /* @__PURE__ */ jsx23(ToolbarOverlay, { elements, children: /* @__PURE__ */ jsx23(ErrorOverlay, { transform, elements, children: /* @__PURE__ */ jsx23(RatsNestOverlay, { transform, soup: elements, children: /* @__PURE__ */ jsx23(
|
|
15526
15670
|
PcbGroupOverlay,
|
|
15527
15671
|
{
|
|
15528
15672
|
transform,
|
|
15529
15673
|
elements,
|
|
15530
15674
|
hoveredComponentIds,
|
|
15531
|
-
children: /* @__PURE__ */
|
|
15675
|
+
children: /* @__PURE__ */ jsx23(
|
|
15532
15676
|
DebugGraphicsOverlay,
|
|
15533
15677
|
{
|
|
15534
15678
|
transform,
|
|
15535
15679
|
debugGraphics: props.debugGraphics,
|
|
15536
|
-
children: /* @__PURE__ */
|
|
15680
|
+
children: /* @__PURE__ */ jsx23(
|
|
15537
15681
|
WarningGraphicsOverlay,
|
|
15538
15682
|
{
|
|
15539
15683
|
transform,
|
|
15540
15684
|
elements,
|
|
15541
|
-
children: /* @__PURE__ */
|
|
15685
|
+
children: /* @__PURE__ */ jsx23(
|
|
15542
15686
|
CanvasPrimitiveRenderer,
|
|
15543
15687
|
{
|
|
15544
15688
|
transform,
|
|
@@ -15620,7 +15764,7 @@ var calculateBoardSizeKey = (circuitJson) => {
|
|
|
15620
15764
|
};
|
|
15621
15765
|
|
|
15622
15766
|
// src/PCBViewer.tsx
|
|
15623
|
-
import { jsx as
|
|
15767
|
+
import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
15624
15768
|
var defaultTransform = compose7(translate11(400, 300), scale5(40, -40));
|
|
15625
15769
|
var PCBViewer = ({
|
|
15626
15770
|
circuitJson,
|
|
@@ -15634,12 +15778,12 @@ var PCBViewer = ({
|
|
|
15634
15778
|
clickToInteractEnabled = false,
|
|
15635
15779
|
disablePcbGroups = false
|
|
15636
15780
|
}) => {
|
|
15637
|
-
const [isInteractionEnabled, setIsInteractionEnabled] =
|
|
15781
|
+
const [isInteractionEnabled, setIsInteractionEnabled] = useState13(
|
|
15638
15782
|
!clickToInteractEnabled
|
|
15639
15783
|
);
|
|
15640
15784
|
const [ref, refDimensions] = useMeasure_default();
|
|
15641
|
-
const [transform, setTransformInternal] =
|
|
15642
|
-
const shouldAllowCanvasInteraction =
|
|
15785
|
+
const [transform, setTransformInternal] = useState13(defaultTransform);
|
|
15786
|
+
const shouldAllowCanvasInteraction = useCallback11(
|
|
15643
15787
|
(event) => {
|
|
15644
15788
|
const target = event.target;
|
|
15645
15789
|
if (!(target instanceof Element)) return true;
|
|
@@ -15657,11 +15801,11 @@ var PCBViewer = ({
|
|
|
15657
15801
|
enabled: isInteractionEnabled,
|
|
15658
15802
|
shouldDrag: shouldAllowCanvasInteraction
|
|
15659
15803
|
});
|
|
15660
|
-
let [editEvents, setEditEvents] =
|
|
15804
|
+
let [editEvents, setEditEvents] = useState13([]);
|
|
15661
15805
|
editEvents = editEventsProp ?? editEvents;
|
|
15662
15806
|
const initialRenderCompleted = useRef14(false);
|
|
15663
15807
|
const touchStartRef = useRef14(null);
|
|
15664
|
-
const circuitJsonKey =
|
|
15808
|
+
const circuitJsonKey = useMemo9(
|
|
15665
15809
|
() => calculateCircuitJsonKey(circuitJson),
|
|
15666
15810
|
[circuitJson]
|
|
15667
15811
|
);
|
|
@@ -15700,12 +15844,12 @@ var PCBViewer = ({
|
|
|
15700
15844
|
resetTransform();
|
|
15701
15845
|
}
|
|
15702
15846
|
}, [boardSizeKey]);
|
|
15703
|
-
const pcbElmsPreEdit =
|
|
15847
|
+
const pcbElmsPreEdit = useMemo9(() => {
|
|
15704
15848
|
return circuitJson?.filter(
|
|
15705
15849
|
(e) => e.type.startsWith("pcb_") || e.type.startsWith("source_")
|
|
15706
15850
|
) ?? [];
|
|
15707
15851
|
}, [circuitJsonKey]);
|
|
15708
|
-
const elements =
|
|
15852
|
+
const elements = useMemo9(() => {
|
|
15709
15853
|
return applyEditEvents({
|
|
15710
15854
|
circuitJson: pcbElmsPreEdit,
|
|
15711
15855
|
editEvents
|
|
@@ -15722,27 +15866,27 @@ var PCBViewer = ({
|
|
|
15722
15866
|
setEditEvents(newEditEvents);
|
|
15723
15867
|
onEditEventsChanged?.(newEditEvents);
|
|
15724
15868
|
};
|
|
15725
|
-
const mergedInitialState =
|
|
15869
|
+
const mergedInitialState = useMemo9(
|
|
15726
15870
|
() => ({
|
|
15727
15871
|
...initialState,
|
|
15728
15872
|
...disablePcbGroups && { is_showing_pcb_groups: false }
|
|
15729
15873
|
}),
|
|
15730
15874
|
[initialState, disablePcbGroups]
|
|
15731
15875
|
);
|
|
15732
|
-
return /* @__PURE__ */
|
|
15876
|
+
return /* @__PURE__ */ jsxs16(
|
|
15733
15877
|
"div",
|
|
15734
15878
|
{
|
|
15735
15879
|
ref: transformRef,
|
|
15736
15880
|
style: { position: "relative" },
|
|
15737
15881
|
onContextMenu: (event) => event.preventDefault(),
|
|
15738
15882
|
children: [
|
|
15739
|
-
/* @__PURE__ */
|
|
15883
|
+
/* @__PURE__ */ jsx24("div", { ref, children: /* @__PURE__ */ jsxs16(
|
|
15740
15884
|
ContextProviders,
|
|
15741
15885
|
{
|
|
15742
15886
|
initialState: mergedInitialState,
|
|
15743
15887
|
disablePcbGroups,
|
|
15744
15888
|
children: [
|
|
15745
|
-
/* @__PURE__ */
|
|
15889
|
+
/* @__PURE__ */ jsx24(
|
|
15746
15890
|
CanvasElementsRenderer,
|
|
15747
15891
|
{
|
|
15748
15892
|
transform,
|
|
@@ -15767,11 +15911,11 @@ var PCBViewer = ({
|
|
|
15767
15911
|
},
|
|
15768
15912
|
refDimensions.width
|
|
15769
15913
|
),
|
|
15770
|
-
/* @__PURE__ */
|
|
15914
|
+
/* @__PURE__ */ jsx24(ToastContainer, {})
|
|
15771
15915
|
]
|
|
15772
15916
|
}
|
|
15773
15917
|
) }),
|
|
15774
|
-
clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */
|
|
15918
|
+
clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */ jsx24(
|
|
15775
15919
|
"div",
|
|
15776
15920
|
{
|
|
15777
15921
|
onClick: () => {
|
|
@@ -15808,7 +15952,7 @@ var PCBViewer = ({
|
|
|
15808
15952
|
justifyContent: "center",
|
|
15809
15953
|
touchAction: "pan-x pan-y pinch-zoom"
|
|
15810
15954
|
},
|
|
15811
|
-
children: /* @__PURE__ */
|
|
15955
|
+
children: /* @__PURE__ */ jsx24(
|
|
15812
15956
|
"div",
|
|
15813
15957
|
{
|
|
15814
15958
|
style: {
|