@tscircuit/pcb-viewer 1.11.387 → 1.11.389
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.d.ts +1 -4
- package/dist/index.js +292 -738
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5112,10 +5112,10 @@ var require_src = __commonJS({
|
|
|
5112
5112
|
var js_beautify = require_javascript();
|
|
5113
5113
|
var css_beautify = require_css();
|
|
5114
5114
|
var html_beautify = require_html();
|
|
5115
|
-
function style_html(html_source, options, js,
|
|
5115
|
+
function style_html(html_source, options, js, css3) {
|
|
5116
5116
|
js = js || js_beautify;
|
|
5117
|
-
|
|
5118
|
-
return html_beautify(html_source, options, js,
|
|
5117
|
+
css3 = css3 || css_beautify;
|
|
5118
|
+
return html_beautify(html_source, options, js, css3);
|
|
5119
5119
|
}
|
|
5120
5120
|
style_html.defaultOptions = html_beautify.defaultOptions;
|
|
5121
5121
|
module.exports.js = js_beautify;
|
|
@@ -6667,9 +6667,7 @@ var createStore = (initialState = {}, disablePcbGroups = false) => createZustand
|
|
|
6667
6667
|
pcb_viewer_id: `pcb_viewer_${Math.random().toString().slice(2, 10)}`,
|
|
6668
6668
|
in_edit_mode: false,
|
|
6669
6669
|
in_move_footprint_mode: false,
|
|
6670
|
-
in_draw_trace_mode: false,
|
|
6671
6670
|
is_moving_component: false,
|
|
6672
|
-
is_drawing_trace: false,
|
|
6673
6671
|
is_mouse_over_container: false,
|
|
6674
6672
|
is_showing_multiple_traces_length: false,
|
|
6675
6673
|
is_showing_rats_nest: false,
|
|
@@ -6715,13 +6713,10 @@ var createStore = (initialState = {}, disablePcbGroups = false) => createZustand
|
|
|
6715
6713
|
setEditMode: (mode) => set({
|
|
6716
6714
|
in_edit_mode: mode !== "off",
|
|
6717
6715
|
in_move_footprint_mode: mode === "move_footprint",
|
|
6718
|
-
|
|
6719
|
-
is_moving_component: false,
|
|
6720
|
-
is_drawing_trace: false
|
|
6716
|
+
is_moving_component: false
|
|
6721
6717
|
}),
|
|
6722
6718
|
setIsShowingRatsNest: (is_showing) => set({ is_showing_rats_nest: is_showing }),
|
|
6723
6719
|
setIsMovingComponent: (is_moving) => set({ is_moving_component: is_moving }),
|
|
6724
|
-
setIsDrawingTrace: (is_drawing) => set({ is_drawing_trace: is_drawing }),
|
|
6725
6720
|
setIsMouseOverContainer: (is_focused) => set({ is_mouse_over_container: is_focused }),
|
|
6726
6721
|
setIsShowingMultipleTracesLength: (is_showing) => set({ is_showing_multiple_traces_length: is_showing }),
|
|
6727
6722
|
setIsShowingAutorouting: (is_showing) => set({ is_showing_autorouting: is_showing }),
|
|
@@ -6802,19 +6797,6 @@ import {
|
|
|
6802
6797
|
} from "react-toastify";
|
|
6803
6798
|
import { injectStyle } from "react-toastify/dist/inject-style";
|
|
6804
6799
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
6805
|
-
var useToast = () => {
|
|
6806
|
-
const pcb_viewer_id = useGlobalStore((s) => s.pcb_viewer_id);
|
|
6807
|
-
const toast = (message, opts) => ogToast(message, {
|
|
6808
|
-
containerId: pcb_viewer_id,
|
|
6809
|
-
...opts
|
|
6810
|
-
});
|
|
6811
|
-
toast.error = (message, opts) => ogToast.error(message, {
|
|
6812
|
-
containerId: pcb_viewer_id,
|
|
6813
|
-
...opts
|
|
6814
|
-
});
|
|
6815
|
-
toast.promise = ogToast.promise;
|
|
6816
|
-
return toast;
|
|
6817
|
-
};
|
|
6818
6800
|
var ToastContainer = () => {
|
|
6819
6801
|
useEffect(() => {
|
|
6820
6802
|
injectStyle();
|
|
@@ -6824,7 +6806,7 @@ var ToastContainer = () => {
|
|
|
6824
6806
|
};
|
|
6825
6807
|
|
|
6826
6808
|
// src/PCBViewer.tsx
|
|
6827
|
-
import { useCallback as useCallback12, useEffect as
|
|
6809
|
+
import { useCallback as useCallback12, useEffect as useEffect18, useMemo as useMemo9, useRef as useRef15, useState as useState12 } from "react";
|
|
6828
6810
|
|
|
6829
6811
|
// node_modules/react-use/esm/useMountedState.js
|
|
6830
6812
|
import { useCallback as useCallback2, useEffect as useEffect2, useRef } from "react";
|
|
@@ -8621,7 +8603,7 @@ var animateTransform = ({
|
|
|
8621
8603
|
};
|
|
8622
8604
|
|
|
8623
8605
|
// src/components/CanvasElementsRenderer.tsx
|
|
8624
|
-
import { useCallback as useCallback11, useEffect as
|
|
8606
|
+
import { useCallback as useCallback11, useEffect as useEffect17, useMemo as useMemo8, useRef as useRef14, useState as useState11 } from "react";
|
|
8625
8607
|
|
|
8626
8608
|
// src/lib/Drawer.ts
|
|
8627
8609
|
import colorParser from "color";
|
|
@@ -8884,7 +8866,6 @@ var scaleOnly = (mat, value = 1) => {
|
|
|
8884
8866
|
var zIndexMap = {
|
|
8885
8867
|
elementOverlay: 40,
|
|
8886
8868
|
dimensionOverlay: 40,
|
|
8887
|
-
editTraceHintOverlay: 40,
|
|
8888
8869
|
errorOverlay: 40,
|
|
8889
8870
|
pcbGroupOverlay: 35,
|
|
8890
8871
|
ratsNestOverlay: 30,
|
|
@@ -9802,12 +9783,9 @@ var showTraceSegmentsInsideHiddenCopperPours = (trace) => ({
|
|
|
9802
9783
|
});
|
|
9803
9784
|
var getTraceClipContextElements = (elements, showCopperPours) => showCopperPours ? elements : [];
|
|
9804
9785
|
var getHighlightedTraceElementIds = ({
|
|
9805
|
-
primitives
|
|
9806
|
-
targetLayers,
|
|
9807
|
-
selectedLayer
|
|
9786
|
+
primitives
|
|
9808
9787
|
}) => {
|
|
9809
9788
|
const highlightedElementIds = /* @__PURE__ */ new Set();
|
|
9810
|
-
if (!targetLayers.has(selectedLayer)) return highlightedElementIds;
|
|
9811
9789
|
for (const primitive of primitives) {
|
|
9812
9790
|
if ((primitive.is_mouse_over || primitive.is_in_highlighted_net) && primitive._element?.type === "pcb_trace") {
|
|
9813
9791
|
highlightedElementIds.add(primitive._element.pcb_trace_id);
|
|
@@ -9819,7 +9797,6 @@ function drawPcbTraceElementsForLayer({
|
|
|
9819
9797
|
canvas,
|
|
9820
9798
|
elements,
|
|
9821
9799
|
layers,
|
|
9822
|
-
selectedLayer,
|
|
9823
9800
|
realToCanvasMat,
|
|
9824
9801
|
primitives,
|
|
9825
9802
|
showCopperPours
|
|
@@ -9830,9 +9807,7 @@ function drawPcbTraceElementsForLayer({
|
|
|
9830
9807
|
);
|
|
9831
9808
|
if (traceElements.length === 0) return;
|
|
9832
9809
|
const highlightedElementIds = getHighlightedTraceElementIds({
|
|
9833
|
-
primitives: primitives ?? []
|
|
9834
|
-
targetLayers,
|
|
9835
|
-
selectedLayer
|
|
9810
|
+
primitives: primitives ?? []
|
|
9836
9811
|
});
|
|
9837
9812
|
const highlightedElements = [];
|
|
9838
9813
|
const nonHighlightedElements = [];
|
|
@@ -10575,7 +10550,6 @@ var CanvasPrimitiveRenderer = ({
|
|
|
10575
10550
|
canvas,
|
|
10576
10551
|
elements,
|
|
10577
10552
|
layers: [copperLayer],
|
|
10578
|
-
selectedLayer,
|
|
10579
10553
|
realToCanvasMat: transform,
|
|
10580
10554
|
primitives,
|
|
10581
10555
|
showCopperPours: isShowingCopperPours
|
|
@@ -12386,419 +12360,10 @@ var EditPlacementOverlay = ({
|
|
|
12386
12360
|
);
|
|
12387
12361
|
};
|
|
12388
12362
|
|
|
12389
|
-
// src/components/EditTraceHintOverlay.tsx
|
|
12390
|
-
import { Fragment as Fragment2, useEffect as useEffect10, useRef as useRef7, useState as useState6 } from "react";
|
|
12391
|
-
import {
|
|
12392
|
-
applyToPoint as applyToPoint9,
|
|
12393
|
-
identity as identity5,
|
|
12394
|
-
inverse as inverse4
|
|
12395
|
-
} from "transformation-matrix";
|
|
12396
|
-
|
|
12397
|
-
// src/components/HotkeyActionMenu.tsx
|
|
12398
|
-
import { css } from "@emotion/css";
|
|
12399
|
-
import { useEffect as useEffect9 } from "react";
|
|
12400
|
-
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
12401
|
-
var HotkeyActionMenu = ({
|
|
12402
|
-
hotkeys
|
|
12403
|
-
}) => {
|
|
12404
|
-
useEffect9(() => {
|
|
12405
|
-
const handleKeyDown = (event) => {
|
|
12406
|
-
hotkeys.forEach((hotkey) => {
|
|
12407
|
-
if (event.key === hotkey.key) {
|
|
12408
|
-
hotkey.onUse();
|
|
12409
|
-
}
|
|
12410
|
-
});
|
|
12411
|
-
};
|
|
12412
|
-
window.addEventListener("keydown", handleKeyDown);
|
|
12413
|
-
return () => {
|
|
12414
|
-
window.removeEventListener("keydown", handleKeyDown);
|
|
12415
|
-
};
|
|
12416
|
-
}, [hotkeys]);
|
|
12417
|
-
return /* @__PURE__ */ jsx7(
|
|
12418
|
-
"div",
|
|
12419
|
-
{
|
|
12420
|
-
className: css`
|
|
12421
|
-
display: flex;
|
|
12422
|
-
flex-direction: column;
|
|
12423
|
-
font-family: sans-serif;
|
|
12424
|
-
font-size: 12px;
|
|
12425
|
-
margin: 8px;
|
|
12426
|
-
`,
|
|
12427
|
-
children: hotkeys.map((hotkey) => {
|
|
12428
|
-
return /* @__PURE__ */ jsxs5(
|
|
12429
|
-
"div",
|
|
12430
|
-
{
|
|
12431
|
-
className: css`
|
|
12432
|
-
display: flex;
|
|
12433
|
-
align-items: center;
|
|
12434
|
-
margin: 2px;
|
|
12435
|
-
|
|
12436
|
-
& .key {
|
|
12437
|
-
padding: 1px;
|
|
12438
|
-
margin: 2px;
|
|
12439
|
-
color: rgba(255, 255, 255, 0.8);
|
|
12440
|
-
font-size: 9px;
|
|
12441
|
-
border-radius: 3px;
|
|
12442
|
-
text-align: center;
|
|
12443
|
-
width: 20px;
|
|
12444
|
-
background-color: #444;
|
|
12445
|
-
}
|
|
12446
|
-
|
|
12447
|
-
& .name {
|
|
12448
|
-
margin-left: 4px;
|
|
12449
|
-
color: rgba(255, 255, 255, 0.8);
|
|
12450
|
-
}
|
|
12451
|
-
`,
|
|
12452
|
-
children: [
|
|
12453
|
-
/* @__PURE__ */ jsx7("div", { className: "key", children: hotkey.key }),
|
|
12454
|
-
" ",
|
|
12455
|
-
/* @__PURE__ */ jsx7("div", { className: "name", children: hotkey.name })
|
|
12456
|
-
]
|
|
12457
|
-
},
|
|
12458
|
-
hotkey.name
|
|
12459
|
-
);
|
|
12460
|
-
})
|
|
12461
|
-
}
|
|
12462
|
-
);
|
|
12463
|
-
};
|
|
12464
|
-
|
|
12465
|
-
// src/components/EditTraceHintOverlay.tsx
|
|
12466
|
-
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
12467
|
-
var isInsideOfSmtpad = (elm, point, padding = 0) => {
|
|
12468
|
-
if (elm.shape === "circle" || elm.shape === "polygon") {
|
|
12469
|
-
return false;
|
|
12470
|
-
}
|
|
12471
|
-
const halfWidth = elm.width / 2;
|
|
12472
|
-
const halfHeight = elm.height / 2;
|
|
12473
|
-
const left = elm.x - halfWidth - padding;
|
|
12474
|
-
const right = elm.x + halfWidth + padding;
|
|
12475
|
-
const top = elm.y - halfHeight - padding;
|
|
12476
|
-
const bottom = elm.y + halfHeight + padding;
|
|
12477
|
-
return point.x > left && point.x < right && point.y > top && point.y < bottom;
|
|
12478
|
-
};
|
|
12479
|
-
var isInsideOfPlatedHole = (hole, point, padding = 0) => {
|
|
12480
|
-
if (hole.shape === "circle") {
|
|
12481
|
-
const distance3 = Math.sqrt(
|
|
12482
|
-
(point.x - hole.x) ** 2 + (point.y - hole.y) ** 2
|
|
12483
|
-
);
|
|
12484
|
-
return distance3 <= hole.outer_diameter / 2 + padding;
|
|
12485
|
-
} else if (hole.shape === "circular_hole_with_rect_pad") {
|
|
12486
|
-
const dx = Math.abs(point.x - hole.x);
|
|
12487
|
-
const dy = Math.abs(point.y - hole.y);
|
|
12488
|
-
if (dx < hole.rect_pad_width / 2 + padding && dy < hole.rect_pad_height / 2 + padding) {
|
|
12489
|
-
return true;
|
|
12490
|
-
}
|
|
12491
|
-
return false;
|
|
12492
|
-
} else if (hole.shape === "oval" || hole.shape === "pill") {
|
|
12493
|
-
const halfWidth = hole.hole_width / 2;
|
|
12494
|
-
const halfHeight = hole.hole_height / 2;
|
|
12495
|
-
const left = hole.x - halfWidth - padding;
|
|
12496
|
-
const right = hole.x + halfWidth + padding;
|
|
12497
|
-
const top = hole.y - halfHeight - padding;
|
|
12498
|
-
const bottom = hole.y + halfHeight + padding;
|
|
12499
|
-
return point.x > left && point.x < right && point.y > top && point.y < bottom;
|
|
12500
|
-
}
|
|
12501
|
-
return false;
|
|
12502
|
-
};
|
|
12503
|
-
var EditTraceHintOverlay = ({
|
|
12504
|
-
children,
|
|
12505
|
-
disabled: disabledProp,
|
|
12506
|
-
transform,
|
|
12507
|
-
soup,
|
|
12508
|
-
cancelPanDrag,
|
|
12509
|
-
onCreateEditEvent,
|
|
12510
|
-
onModifyEditEvent
|
|
12511
|
-
}) => {
|
|
12512
|
-
if (!transform) transform = identity5();
|
|
12513
|
-
const containerRef = useRef7(null);
|
|
12514
|
-
const containerBounds = containerRef.current?.getBoundingClientRect();
|
|
12515
|
-
const [selectedElement, setSelectedElement] = useState6(null);
|
|
12516
|
-
const toast = useToast();
|
|
12517
|
-
const [dragState, setDragState] = useState6(null);
|
|
12518
|
-
const [shouldCreateAsVia, setShouldCreateAsVia] = useState6(false);
|
|
12519
|
-
const isElementSelected = selectedElement !== null;
|
|
12520
|
-
const in_edit_trace_mode = useGlobalStore((s) => s.in_draw_trace_mode);
|
|
12521
|
-
const disabled = disabledProp || !in_edit_trace_mode;
|
|
12522
|
-
let ogCenterScreen, dragEndScreen;
|
|
12523
|
-
if (dragState?.originalCenter && dragState?.dragEnd) {
|
|
12524
|
-
ogCenterScreen = applyToPoint9(transform, dragState?.originalCenter);
|
|
12525
|
-
dragEndScreen = applyToPoint9(transform, dragState?.dragEnd);
|
|
12526
|
-
}
|
|
12527
|
-
useEffect10(() => {
|
|
12528
|
-
if (!isElementSelected) return;
|
|
12529
|
-
function keyDown(e) {
|
|
12530
|
-
if (e.key === "Escape") {
|
|
12531
|
-
setSelectedElement(null);
|
|
12532
|
-
setDragState(null);
|
|
12533
|
-
}
|
|
12534
|
-
}
|
|
12535
|
-
window.addEventListener("keydown", keyDown);
|
|
12536
|
-
return () => window.removeEventListener("keydown", keyDown);
|
|
12537
|
-
}, [isElementSelected]);
|
|
12538
|
-
return /* @__PURE__ */ jsxs6(
|
|
12539
|
-
"div",
|
|
12540
|
-
{
|
|
12541
|
-
ref: containerRef,
|
|
12542
|
-
style: {
|
|
12543
|
-
position: "relative",
|
|
12544
|
-
overflow: "hidden"
|
|
12545
|
-
},
|
|
12546
|
-
onMouseDown: (e) => {
|
|
12547
|
-
if (disabled) return;
|
|
12548
|
-
const rect = e.currentTarget.getBoundingClientRect();
|
|
12549
|
-
const x = e.clientX - rect.left;
|
|
12550
|
-
const y = e.clientY - rect.top;
|
|
12551
|
-
if (isNaN(x) || isNaN(y)) return;
|
|
12552
|
-
const rwMousePoint = applyToPoint9(inverse4(transform), { x, y });
|
|
12553
|
-
if (!isElementSelected) {
|
|
12554
|
-
for (const e2 of soup) {
|
|
12555
|
-
if (e2.type === "pcb_smtpad" && isInsideOfSmtpad(e2, rwMousePoint, 10 / transform.a) || e2.type === "pcb_plated_hole" && isInsideOfPlatedHole(e2, rwMousePoint, 10 / transform.a)) {
|
|
12556
|
-
if (!e2.pcb_port_id) {
|
|
12557
|
-
toast.error(`pcb_port_id is null on the selected "${e2.type}"`);
|
|
12558
|
-
return;
|
|
12559
|
-
}
|
|
12560
|
-
const pcb_port = su(soup).pcb_port.get(e2.pcb_port_id);
|
|
12561
|
-
if (!pcb_port) {
|
|
12562
|
-
toast.error(
|
|
12563
|
-
`Could not find associated pcb_port for "${e2.pcb_port_id}"`
|
|
12564
|
-
);
|
|
12565
|
-
return;
|
|
12566
|
-
}
|
|
12567
|
-
setSelectedElement(e2);
|
|
12568
|
-
setShouldCreateAsVia(false);
|
|
12569
|
-
setDragState({
|
|
12570
|
-
dragStart: rwMousePoint,
|
|
12571
|
-
originalCenter: { x: pcb_port.x, y: pcb_port.y },
|
|
12572
|
-
dragEnd: rwMousePoint,
|
|
12573
|
-
editEvent: {
|
|
12574
|
-
pcb_edit_event_type: "edit_trace_hint",
|
|
12575
|
-
pcb_port_id: e2.pcb_port_id,
|
|
12576
|
-
pcb_trace_hint_id: Math.random().toString(),
|
|
12577
|
-
route: [],
|
|
12578
|
-
created_at: Date.now(),
|
|
12579
|
-
edit_event_id: Math.random().toString(),
|
|
12580
|
-
in_progress: true
|
|
12581
|
-
},
|
|
12582
|
-
shouldDrawRouteHint: false
|
|
12583
|
-
});
|
|
12584
|
-
cancelPanDrag();
|
|
12585
|
-
break;
|
|
12586
|
-
}
|
|
12587
|
-
}
|
|
12588
|
-
} else {
|
|
12589
|
-
setDragState({
|
|
12590
|
-
...dragState,
|
|
12591
|
-
dragStart: rwMousePoint,
|
|
12592
|
-
shouldDrawRouteHint: true
|
|
12593
|
-
});
|
|
12594
|
-
}
|
|
12595
|
-
},
|
|
12596
|
-
onMouseMove: (e) => {
|
|
12597
|
-
if (!isElementSelected || !dragState) return;
|
|
12598
|
-
const rect = e.currentTarget.getBoundingClientRect();
|
|
12599
|
-
const x = e.clientX - rect.left;
|
|
12600
|
-
const y = e.clientY - rect.top;
|
|
12601
|
-
if (isNaN(x) || isNaN(y)) return;
|
|
12602
|
-
const rwMousePoint = applyToPoint9(inverse4(transform), { x, y });
|
|
12603
|
-
setDragState({
|
|
12604
|
-
...dragState,
|
|
12605
|
-
dragEnd: rwMousePoint
|
|
12606
|
-
});
|
|
12607
|
-
},
|
|
12608
|
-
onMouseUp: (e) => {
|
|
12609
|
-
if (!isElementSelected) return;
|
|
12610
|
-
if (!dragState?.shouldDrawRouteHint) return;
|
|
12611
|
-
const { dragStart, dragEnd } = dragState;
|
|
12612
|
-
const rwDist = Math.sqrt(
|
|
12613
|
-
(dragEnd.x - dragStart.x) ** 2 + (dragEnd.y - dragStart.y) ** 2
|
|
12614
|
-
);
|
|
12615
|
-
const screenDist = rwDist * transform.a;
|
|
12616
|
-
if (screenDist > 20) return;
|
|
12617
|
-
const rect = e.currentTarget.getBoundingClientRect();
|
|
12618
|
-
const x = e.clientX - rect.left;
|
|
12619
|
-
const y = e.clientY - rect.top;
|
|
12620
|
-
if (isNaN(x) || isNaN(y)) return;
|
|
12621
|
-
const rwMousePoint = applyToPoint9(inverse4(transform), { x, y });
|
|
12622
|
-
if (dragState) {
|
|
12623
|
-
cancelPanDrag();
|
|
12624
|
-
const lastPointScreen = applyToPoint9(
|
|
12625
|
-
transform,
|
|
12626
|
-
dragState.editEvent.route.slice(-1)[0] ?? dragState.originalCenter
|
|
12627
|
-
);
|
|
12628
|
-
const distanceFromLastPoint = Math.sqrt(
|
|
12629
|
-
(x - lastPointScreen.x) ** 2 + (y - lastPointScreen.y) ** 2
|
|
12630
|
-
);
|
|
12631
|
-
if (distanceFromLastPoint < 20) {
|
|
12632
|
-
onCreateEditEvent({
|
|
12633
|
-
...dragState.editEvent,
|
|
12634
|
-
in_progress: false
|
|
12635
|
-
});
|
|
12636
|
-
setDragState(null);
|
|
12637
|
-
setSelectedElement(null);
|
|
12638
|
-
return;
|
|
12639
|
-
}
|
|
12640
|
-
setDragState({
|
|
12641
|
-
...dragState,
|
|
12642
|
-
editEvent: {
|
|
12643
|
-
...dragState.editEvent,
|
|
12644
|
-
route: [
|
|
12645
|
-
...dragState.editEvent.route,
|
|
12646
|
-
{ ...rwMousePoint, via: shouldCreateAsVia }
|
|
12647
|
-
]
|
|
12648
|
-
}
|
|
12649
|
-
});
|
|
12650
|
-
}
|
|
12651
|
-
},
|
|
12652
|
-
children: [
|
|
12653
|
-
children,
|
|
12654
|
-
in_edit_trace_mode && dragState?.editEvent && ogCenterScreen && dragEndScreen && /* @__PURE__ */ jsxs6(
|
|
12655
|
-
"svg",
|
|
12656
|
-
{
|
|
12657
|
-
style: {
|
|
12658
|
-
position: "absolute",
|
|
12659
|
-
left: 0,
|
|
12660
|
-
top: 0,
|
|
12661
|
-
pointerEvents: "none",
|
|
12662
|
-
mixBlendMode: "difference",
|
|
12663
|
-
zIndex: zIndexMap.editTraceHintOverlay
|
|
12664
|
-
},
|
|
12665
|
-
width: containerBounds?.width,
|
|
12666
|
-
height: containerBounds?.height,
|
|
12667
|
-
children: [
|
|
12668
|
-
/* @__PURE__ */ jsx8(
|
|
12669
|
-
"path",
|
|
12670
|
-
{
|
|
12671
|
-
stroke: "red",
|
|
12672
|
-
d: `M ${ogCenterScreen.x} ${ogCenterScreen.y} ${dragState?.editEvent.route.map((p) => applyToPoint9(transform, p)).map((p) => `L ${p.x} ${p.y}`).join(" ")} L ${dragEndScreen.x} ${dragEndScreen.y}`
|
|
12673
|
-
}
|
|
12674
|
-
),
|
|
12675
|
-
dragState?.editEvent.route.map((r, i) => {
|
|
12676
|
-
const rScreen = applyToPoint9(transform, r);
|
|
12677
|
-
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
12678
|
-
r.via && /* @__PURE__ */ jsx8("circle", { cx: rScreen.x, cy: rScreen.y, r: 16, stroke: "red" }),
|
|
12679
|
-
/* @__PURE__ */ jsx8("circle", { cx: rScreen.x, cy: rScreen.y, r: 8, stroke: "red" })
|
|
12680
|
-
] }, `r-${i}`);
|
|
12681
|
-
}),
|
|
12682
|
-
shouldCreateAsVia && /* @__PURE__ */ jsx8(
|
|
12683
|
-
"circle",
|
|
12684
|
-
{
|
|
12685
|
-
cx: dragEndScreen.x,
|
|
12686
|
-
cy: dragEndScreen.y,
|
|
12687
|
-
r: 16,
|
|
12688
|
-
stroke: "red"
|
|
12689
|
-
},
|
|
12690
|
-
"via-outer-circle"
|
|
12691
|
-
),
|
|
12692
|
-
/* @__PURE__ */ jsx8(
|
|
12693
|
-
"circle",
|
|
12694
|
-
{
|
|
12695
|
-
cx: dragEndScreen.x,
|
|
12696
|
-
cy: dragEndScreen.y,
|
|
12697
|
-
r: 8,
|
|
12698
|
-
stroke: "red"
|
|
12699
|
-
}
|
|
12700
|
-
)
|
|
12701
|
-
]
|
|
12702
|
-
}
|
|
12703
|
-
),
|
|
12704
|
-
!disabled && /* @__PURE__ */ jsx8(
|
|
12705
|
-
"svg",
|
|
12706
|
-
{
|
|
12707
|
-
style: {
|
|
12708
|
-
position: "absolute",
|
|
12709
|
-
left: 0,
|
|
12710
|
-
top: 0,
|
|
12711
|
-
pointerEvents: "none",
|
|
12712
|
-
mixBlendMode: "difference",
|
|
12713
|
-
zIndex: zIndexMap.editTraceHintOverlay
|
|
12714
|
-
},
|
|
12715
|
-
width: containerBounds?.width,
|
|
12716
|
-
height: containerBounds?.height,
|
|
12717
|
-
children: soup.filter((e) => e.type === "pcb_trace_hint").map((e) => {
|
|
12718
|
-
const { route } = e;
|
|
12719
|
-
const pcb_port = su(soup).pcb_port.get(e.pcb_port_id);
|
|
12720
|
-
const pcb_port_screen = applyToPoint9(transform, pcb_port);
|
|
12721
|
-
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
12722
|
-
/* @__PURE__ */ jsx8(
|
|
12723
|
-
"rect",
|
|
12724
|
-
{
|
|
12725
|
-
x: pcb_port_screen.x - 10,
|
|
12726
|
-
y: pcb_port_screen.y - 10,
|
|
12727
|
-
width: 20,
|
|
12728
|
-
height: 20,
|
|
12729
|
-
stroke: "red"
|
|
12730
|
-
},
|
|
12731
|
-
`rect-${e.pcb_port_id}`
|
|
12732
|
-
),
|
|
12733
|
-
/* @__PURE__ */ jsx8(
|
|
12734
|
-
"path",
|
|
12735
|
-
{
|
|
12736
|
-
stroke: "red",
|
|
12737
|
-
d: `M ${pcb_port_screen.x} ${pcb_port_screen.y} ${route.map((r) => applyToPoint9(transform, r)).map((r) => `L ${r.x} ${r.y}`).join(" ")}`
|
|
12738
|
-
},
|
|
12739
|
-
`path-${e.pcb_port_id}`
|
|
12740
|
-
),
|
|
12741
|
-
route.map((r) => ({ ...r, ...applyToPoint9(transform, r) })).map((r, i) => /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
12742
|
-
/* @__PURE__ */ jsx8("circle", { cx: r.x, cy: r.y, r: 8, stroke: "red" }),
|
|
12743
|
-
r.via && /* @__PURE__ */ jsx8(
|
|
12744
|
-
"circle",
|
|
12745
|
-
{
|
|
12746
|
-
cx: r.x,
|
|
12747
|
-
cy: r.y,
|
|
12748
|
-
r: 16,
|
|
12749
|
-
stroke: "red",
|
|
12750
|
-
fill: "transparent"
|
|
12751
|
-
}
|
|
12752
|
-
)
|
|
12753
|
-
] }, i))
|
|
12754
|
-
] }, e.pcb_trace_hint_id);
|
|
12755
|
-
})
|
|
12756
|
-
},
|
|
12757
|
-
"pcb-trace-hints"
|
|
12758
|
-
),
|
|
12759
|
-
/* @__PURE__ */ jsx8(
|
|
12760
|
-
"div",
|
|
12761
|
-
{
|
|
12762
|
-
style: {
|
|
12763
|
-
position: "absolute",
|
|
12764
|
-
right: 0,
|
|
12765
|
-
bottom: 0
|
|
12766
|
-
},
|
|
12767
|
-
children: isElementSelected && /* @__PURE__ */ jsx8(
|
|
12768
|
-
HotkeyActionMenu,
|
|
12769
|
-
{
|
|
12770
|
-
hotkeys: [
|
|
12771
|
-
{
|
|
12772
|
-
key: "v",
|
|
12773
|
-
name: "Toggle Via",
|
|
12774
|
-
onUse: () => {
|
|
12775
|
-
setShouldCreateAsVia(!shouldCreateAsVia);
|
|
12776
|
-
}
|
|
12777
|
-
}
|
|
12778
|
-
// {
|
|
12779
|
-
// key: "del",
|
|
12780
|
-
// name: "Delete Node",
|
|
12781
|
-
// onUse: () => {},
|
|
12782
|
-
// },
|
|
12783
|
-
// {
|
|
12784
|
-
// key: "r",
|
|
12785
|
-
// name: "Delete Route",
|
|
12786
|
-
// onUse: () => {},
|
|
12787
|
-
// },
|
|
12788
|
-
]
|
|
12789
|
-
}
|
|
12790
|
-
)
|
|
12791
|
-
}
|
|
12792
|
-
)
|
|
12793
|
-
]
|
|
12794
|
-
}
|
|
12795
|
-
);
|
|
12796
|
-
};
|
|
12797
|
-
|
|
12798
12363
|
// src/components/ErrorOverlay.tsx
|
|
12799
|
-
import { useRef as
|
|
12800
|
-
import { css
|
|
12801
|
-
import { applyToPoint as
|
|
12364
|
+
import { useRef as useRef7, Fragment as Fragment2 } from "react";
|
|
12365
|
+
import { css } from "@emotion/css";
|
|
12366
|
+
import { applyToPoint as applyToPoint9, identity as identity5 } from "transformation-matrix";
|
|
12802
12367
|
|
|
12803
12368
|
// src/lib/util/getPopupPosition.ts
|
|
12804
12369
|
var getPopupPosition = (errorCenter, containerRef) => {
|
|
@@ -12835,10 +12400,10 @@ var getPopupPosition = (errorCenter, containerRef) => {
|
|
|
12835
12400
|
};
|
|
12836
12401
|
|
|
12837
12402
|
// src/components/FocusMarkerSVG.tsx
|
|
12838
|
-
import { jsx as
|
|
12403
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
12839
12404
|
var FocusMarkerSVG = ({
|
|
12840
12405
|
center
|
|
12841
|
-
}) => /* @__PURE__ */
|
|
12406
|
+
}) => /* @__PURE__ */ jsxs5(
|
|
12842
12407
|
"svg",
|
|
12843
12408
|
{
|
|
12844
12409
|
style: {
|
|
@@ -12852,7 +12417,7 @@ var FocusMarkerSVG = ({
|
|
|
12852
12417
|
width: "100%",
|
|
12853
12418
|
height: "100%",
|
|
12854
12419
|
children: [
|
|
12855
|
-
/* @__PURE__ */
|
|
12420
|
+
/* @__PURE__ */ jsx7(
|
|
12856
12421
|
"circle",
|
|
12857
12422
|
{
|
|
12858
12423
|
cx: center.x,
|
|
@@ -12864,8 +12429,8 @@ var FocusMarkerSVG = ({
|
|
|
12864
12429
|
opacity: 0.95
|
|
12865
12430
|
}
|
|
12866
12431
|
),
|
|
12867
|
-
/* @__PURE__ */
|
|
12868
|
-
/* @__PURE__ */
|
|
12432
|
+
/* @__PURE__ */ jsx7("circle", { cx: center.x, cy: center.y, r: 4.5, fill: "#ff6b6b", opacity: 0.95 }),
|
|
12433
|
+
/* @__PURE__ */ jsx7(
|
|
12869
12434
|
"line",
|
|
12870
12435
|
{
|
|
12871
12436
|
x1: center.x - 18,
|
|
@@ -12876,7 +12441,7 @@ var FocusMarkerSVG = ({
|
|
|
12876
12441
|
strokeWidth: 2
|
|
12877
12442
|
}
|
|
12878
12443
|
),
|
|
12879
|
-
/* @__PURE__ */
|
|
12444
|
+
/* @__PURE__ */ jsx7(
|
|
12880
12445
|
"line",
|
|
12881
12446
|
{
|
|
12882
12447
|
x1: center.x + 8,
|
|
@@ -12887,7 +12452,7 @@ var FocusMarkerSVG = ({
|
|
|
12887
12452
|
strokeWidth: 2
|
|
12888
12453
|
}
|
|
12889
12454
|
),
|
|
12890
|
-
/* @__PURE__ */
|
|
12455
|
+
/* @__PURE__ */ jsx7(
|
|
12891
12456
|
"line",
|
|
12892
12457
|
{
|
|
12893
12458
|
x1: center.x,
|
|
@@ -12898,7 +12463,7 @@ var FocusMarkerSVG = ({
|
|
|
12898
12463
|
strokeWidth: 2
|
|
12899
12464
|
}
|
|
12900
12465
|
),
|
|
12901
|
-
/* @__PURE__ */
|
|
12466
|
+
/* @__PURE__ */ jsx7(
|
|
12902
12467
|
"line",
|
|
12903
12468
|
{
|
|
12904
12469
|
x1: center.x,
|
|
@@ -12914,11 +12479,11 @@ var FocusMarkerSVG = ({
|
|
|
12914
12479
|
);
|
|
12915
12480
|
|
|
12916
12481
|
// src/components/ErrorOverlay.tsx
|
|
12917
|
-
import { jsx as
|
|
12482
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
12918
12483
|
var ErrorMarkerSVG = ({
|
|
12919
12484
|
errorCenter,
|
|
12920
12485
|
isHighlighted = false
|
|
12921
|
-
}) => /* @__PURE__ */
|
|
12486
|
+
}) => /* @__PURE__ */ jsx8(
|
|
12922
12487
|
"svg",
|
|
12923
12488
|
{
|
|
12924
12489
|
style: {
|
|
@@ -12931,7 +12496,7 @@ var ErrorMarkerSVG = ({
|
|
|
12931
12496
|
},
|
|
12932
12497
|
width: "100%",
|
|
12933
12498
|
height: "100%",
|
|
12934
|
-
children: /* @__PURE__ */
|
|
12499
|
+
children: /* @__PURE__ */ jsx8(
|
|
12935
12500
|
"rect",
|
|
12936
12501
|
{
|
|
12937
12502
|
x: errorCenter.x - 7,
|
|
@@ -12946,7 +12511,7 @@ var ErrorMarkerSVG = ({
|
|
|
12946
12511
|
)
|
|
12947
12512
|
}
|
|
12948
12513
|
);
|
|
12949
|
-
var errorMessageStyles =
|
|
12514
|
+
var errorMessageStyles = css`
|
|
12950
12515
|
opacity: 0;
|
|
12951
12516
|
pointer-events: none;
|
|
12952
12517
|
background-color: rgba(0, 0, 0, 0.8);
|
|
@@ -12962,10 +12527,10 @@ var errorMessageStyles = css2`
|
|
|
12962
12527
|
`;
|
|
12963
12528
|
var ErrorOverlay = ({
|
|
12964
12529
|
children,
|
|
12965
|
-
transform =
|
|
12530
|
+
transform = identity5(),
|
|
12966
12531
|
elements
|
|
12967
12532
|
}) => {
|
|
12968
|
-
const containerRef =
|
|
12533
|
+
const containerRef = useRef7(null);
|
|
12969
12534
|
const { isShowingDRCErrors, hoveredErrorId, focusedErrorId } = useGlobalStore(
|
|
12970
12535
|
(state) => ({
|
|
12971
12536
|
isShowingDRCErrors: state.is_showing_drc_errors,
|
|
@@ -12975,7 +12540,7 @@ var ErrorOverlay = ({
|
|
|
12975
12540
|
);
|
|
12976
12541
|
const activeErrorId = focusedErrorId ?? hoveredErrorId;
|
|
12977
12542
|
if (!elements) {
|
|
12978
|
-
return /* @__PURE__ */
|
|
12543
|
+
return /* @__PURE__ */ jsx8("div", { style: { position: "relative" }, ref: containerRef, children });
|
|
12979
12544
|
}
|
|
12980
12545
|
const traceErrors = elements.filter(
|
|
12981
12546
|
(el) => el.type === "pcb_trace_error" && !el.message?.includes("Multiple components found with name")
|
|
@@ -12996,7 +12561,7 @@ var ErrorOverlay = ({
|
|
|
12996
12561
|
if (!focusCenter || typeof focusCenter.x !== "number" || typeof focusCenter.y !== "number") {
|
|
12997
12562
|
return null;
|
|
12998
12563
|
}
|
|
12999
|
-
const screenCenter =
|
|
12564
|
+
const screenCenter = applyToPoint9(transform, focusCenter);
|
|
13000
12565
|
if (Number.isNaN(screenCenter.x) || Number.isNaN(screenCenter.y)) {
|
|
13001
12566
|
return null;
|
|
13002
12567
|
}
|
|
@@ -13008,7 +12573,7 @@ var ErrorOverlay = ({
|
|
|
13008
12573
|
focusedErrorElement
|
|
13009
12574
|
);
|
|
13010
12575
|
}
|
|
13011
|
-
return /* @__PURE__ */
|
|
12576
|
+
return /* @__PURE__ */ jsxs6("div", { style: { position: "relative" }, ref: containerRef, children: [
|
|
13012
12577
|
children,
|
|
13013
12578
|
traceErrors.map((el, index) => {
|
|
13014
12579
|
const errorId = getErrorId(el, index);
|
|
@@ -13017,15 +12582,15 @@ var ErrorOverlay = ({
|
|
|
13017
12582
|
const errorCenter = getScreenErrorCenter(el);
|
|
13018
12583
|
if (!errorCenter) return null;
|
|
13019
12584
|
const popupPosition = getPopupPosition(errorCenter, containerRef);
|
|
13020
|
-
return /* @__PURE__ */
|
|
13021
|
-
/* @__PURE__ */
|
|
12585
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
12586
|
+
/* @__PURE__ */ jsx8(
|
|
13022
12587
|
ErrorMarkerSVG,
|
|
13023
12588
|
{
|
|
13024
12589
|
errorCenter,
|
|
13025
12590
|
isHighlighted
|
|
13026
12591
|
}
|
|
13027
12592
|
),
|
|
13028
|
-
/* @__PURE__ */
|
|
12593
|
+
/* @__PURE__ */ jsx8(
|
|
13029
12594
|
"div",
|
|
13030
12595
|
{
|
|
13031
12596
|
style: {
|
|
@@ -13060,7 +12625,7 @@ var ErrorOverlay = ({
|
|
|
13060
12625
|
}
|
|
13061
12626
|
}
|
|
13062
12627
|
),
|
|
13063
|
-
/* @__PURE__ */
|
|
12628
|
+
/* @__PURE__ */ jsx8(
|
|
13064
12629
|
"div",
|
|
13065
12630
|
{
|
|
13066
12631
|
style: {
|
|
@@ -13078,7 +12643,7 @@ var ErrorOverlay = ({
|
|
|
13078
12643
|
pointerEvents: "none",
|
|
13079
12644
|
transform: popupPosition.transform
|
|
13080
12645
|
},
|
|
13081
|
-
children: /* @__PURE__ */
|
|
12646
|
+
children: /* @__PURE__ */ jsx8(
|
|
13082
12647
|
"div",
|
|
13083
12648
|
{
|
|
13084
12649
|
className: `error-message ${errorMessageStyles}`,
|
|
@@ -13103,15 +12668,15 @@ var ErrorOverlay = ({
|
|
|
13103
12668
|
{ x: errorCenter.x, y: errorCenter.y },
|
|
13104
12669
|
containerRef
|
|
13105
12670
|
);
|
|
13106
|
-
return /* @__PURE__ */
|
|
13107
|
-
/* @__PURE__ */
|
|
12671
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
12672
|
+
/* @__PURE__ */ jsx8(
|
|
13108
12673
|
ErrorMarkerSVG,
|
|
13109
12674
|
{
|
|
13110
12675
|
errorCenter,
|
|
13111
12676
|
isHighlighted
|
|
13112
12677
|
}
|
|
13113
12678
|
),
|
|
13114
|
-
/* @__PURE__ */
|
|
12679
|
+
/* @__PURE__ */ jsx8(
|
|
13115
12680
|
"div",
|
|
13116
12681
|
{
|
|
13117
12682
|
style: {
|
|
@@ -13146,7 +12711,7 @@ var ErrorOverlay = ({
|
|
|
13146
12711
|
}
|
|
13147
12712
|
}
|
|
13148
12713
|
),
|
|
13149
|
-
/* @__PURE__ */
|
|
12714
|
+
/* @__PURE__ */ jsx8(
|
|
13150
12715
|
"div",
|
|
13151
12716
|
{
|
|
13152
12717
|
style: {
|
|
@@ -13164,7 +12729,7 @@ var ErrorOverlay = ({
|
|
|
13164
12729
|
pointerEvents: "none",
|
|
13165
12730
|
transform: popupPosition.transform
|
|
13166
12731
|
},
|
|
13167
|
-
children: /* @__PURE__ */
|
|
12732
|
+
children: /* @__PURE__ */ jsx8(
|
|
13168
12733
|
"div",
|
|
13169
12734
|
{
|
|
13170
12735
|
className: `error-message ${errorMessageStyles}`,
|
|
@@ -13201,7 +12766,7 @@ var ErrorOverlay = ({
|
|
|
13201
12766
|
if (pcbComp && pcbComp.type === "pcb_component")
|
|
13202
12767
|
center = pcbComp.center || { x: 0, y: 0 };
|
|
13203
12768
|
}
|
|
13204
|
-
const screenCenter =
|
|
12769
|
+
const screenCenter = applyToPoint9(transform, center);
|
|
13205
12770
|
if (Number.isNaN(screenCenter.x) || Number.isNaN(screenCenter.y))
|
|
13206
12771
|
return null;
|
|
13207
12772
|
const scale7 = Math.abs(transform.a);
|
|
@@ -13213,8 +12778,8 @@ var ErrorOverlay = ({
|
|
|
13213
12778
|
Math.min(maxRadius, baseRadius * scale7)
|
|
13214
12779
|
);
|
|
13215
12780
|
const popupPosition = getPopupPosition(screenCenter, containerRef);
|
|
13216
|
-
return /* @__PURE__ */
|
|
13217
|
-
/* @__PURE__ */
|
|
12781
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
12782
|
+
/* @__PURE__ */ jsx8(
|
|
13218
12783
|
"svg",
|
|
13219
12784
|
{
|
|
13220
12785
|
style: {
|
|
@@ -13227,13 +12792,13 @@ var ErrorOverlay = ({
|
|
|
13227
12792
|
},
|
|
13228
12793
|
width: "100%",
|
|
13229
12794
|
height: "100%",
|
|
13230
|
-
children: isHighlighted ? /* @__PURE__ */
|
|
12795
|
+
children: isHighlighted ? /* @__PURE__ */ jsx8(
|
|
13231
12796
|
"polygon",
|
|
13232
12797
|
{
|
|
13233
12798
|
points: `${screenCenter.x},${screenCenter.y - scaledRadius * 1.25} ${screenCenter.x + scaledRadius},${screenCenter.y} ${screenCenter.x},${screenCenter.y + scaledRadius * 1.25} ${screenCenter.x - scaledRadius},${screenCenter.y}`,
|
|
13234
12799
|
fill: "#ff4444"
|
|
13235
12800
|
}
|
|
13236
|
-
) : /* @__PURE__ */
|
|
12801
|
+
) : /* @__PURE__ */ jsx8(
|
|
13237
12802
|
"circle",
|
|
13238
12803
|
{
|
|
13239
12804
|
cx: screenCenter.x,
|
|
@@ -13247,7 +12812,7 @@ var ErrorOverlay = ({
|
|
|
13247
12812
|
)
|
|
13248
12813
|
}
|
|
13249
12814
|
),
|
|
13250
|
-
/* @__PURE__ */
|
|
12815
|
+
/* @__PURE__ */ jsx8(
|
|
13251
12816
|
"div",
|
|
13252
12817
|
{
|
|
13253
12818
|
style: {
|
|
@@ -13282,7 +12847,7 @@ var ErrorOverlay = ({
|
|
|
13282
12847
|
}
|
|
13283
12848
|
}
|
|
13284
12849
|
),
|
|
13285
|
-
/* @__PURE__ */
|
|
12850
|
+
/* @__PURE__ */ jsx8(
|
|
13286
12851
|
"div",
|
|
13287
12852
|
{
|
|
13288
12853
|
style: {
|
|
@@ -13300,7 +12865,7 @@ var ErrorOverlay = ({
|
|
|
13300
12865
|
pointerEvents: "none",
|
|
13301
12866
|
transform: popupPosition.transform
|
|
13302
12867
|
},
|
|
13303
|
-
children: /* @__PURE__ */
|
|
12868
|
+
children: /* @__PURE__ */ jsx8(
|
|
13304
12869
|
"div",
|
|
13305
12870
|
{
|
|
13306
12871
|
className: `error-message ${errorMessageStyles}`,
|
|
@@ -13316,7 +12881,7 @@ var ErrorOverlay = ({
|
|
|
13316
12881
|
] }, `${errorId}_${compIndex}`);
|
|
13317
12882
|
});
|
|
13318
12883
|
}),
|
|
13319
|
-
focusScreenCenter && /* @__PURE__ */
|
|
12884
|
+
focusScreenCenter && /* @__PURE__ */ jsx8(FocusMarkerSVG, { center: focusScreenCenter })
|
|
13320
12885
|
] });
|
|
13321
12886
|
};
|
|
13322
12887
|
|
|
@@ -13331,8 +12896,8 @@ function ifSetsMatchExactly(set1, set2) {
|
|
|
13331
12896
|
}
|
|
13332
12897
|
|
|
13333
12898
|
// src/components/MouseElementTracker.tsx
|
|
13334
|
-
import { useEffect as
|
|
13335
|
-
import { applyToPoint as
|
|
12899
|
+
import { useEffect as useEffect10, useMemo as useMemo5, useState as useState7 } from "react";
|
|
12900
|
+
import { applyToPoint as applyToPoint12, inverse as inverse4 } from "transformation-matrix";
|
|
13336
12901
|
|
|
13337
12902
|
// src/components/AnchorOffsetOverlay/common/guards.ts
|
|
13338
12903
|
var isPcbComponent = (element) => element?.type === "pcb_component";
|
|
@@ -13341,7 +12906,7 @@ var isPcbPanel = (element) => element?.type === "pcb_panel";
|
|
|
13341
12906
|
var isPcbBoard = (element) => element?.type === "pcb_board";
|
|
13342
12907
|
|
|
13343
12908
|
// src/components/AnchorOffsetOverlay/AnchorOffsetOverlay.tsx
|
|
13344
|
-
import { applyToPoint as
|
|
12909
|
+
import { applyToPoint as applyToPoint10 } from "transformation-matrix";
|
|
13345
12910
|
|
|
13346
12911
|
// src/components/AnchorOffsetOverlay/common/constants.ts
|
|
13347
12912
|
var VISUAL_CONFIG = {
|
|
@@ -13367,7 +12932,7 @@ var COLORS = {
|
|
|
13367
12932
|
};
|
|
13368
12933
|
|
|
13369
12934
|
// src/components/AnchorOffsetOverlay/AnchorOffsetOverlay.tsx
|
|
13370
|
-
import { Fragment as
|
|
12935
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
13371
12936
|
var AnchorOffsetOverlay = ({
|
|
13372
12937
|
targets,
|
|
13373
12938
|
transform,
|
|
@@ -13386,11 +12951,11 @@ var AnchorOffsetOverlay = ({
|
|
|
13386
12951
|
const anchorScreens = /* @__PURE__ */ new Map();
|
|
13387
12952
|
targets.forEach((target) => {
|
|
13388
12953
|
if (!anchorScreens.has(target.anchor_id)) {
|
|
13389
|
-
const screenPoint =
|
|
12954
|
+
const screenPoint = applyToPoint10(transform, target.anchor);
|
|
13390
12955
|
anchorScreens.set(target.anchor_id, screenPoint);
|
|
13391
12956
|
}
|
|
13392
12957
|
});
|
|
13393
|
-
return /* @__PURE__ */
|
|
12958
|
+
return /* @__PURE__ */ jsx9(
|
|
13394
12959
|
"div",
|
|
13395
12960
|
{
|
|
13396
12961
|
style: {
|
|
@@ -13403,7 +12968,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13403
12968
|
pointerEvents: "none",
|
|
13404
12969
|
zIndex: zIndexMap.dimensionOverlay
|
|
13405
12970
|
},
|
|
13406
|
-
children: /* @__PURE__ */
|
|
12971
|
+
children: /* @__PURE__ */ jsxs7(
|
|
13407
12972
|
"svg",
|
|
13408
12973
|
{
|
|
13409
12974
|
style: {
|
|
@@ -13420,7 +12985,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13420
12985
|
const anchorKey = target.anchor_id;
|
|
13421
12986
|
const targetCenter = target.target;
|
|
13422
12987
|
const anchorMarkerScreen = anchorScreens.get(anchorKey);
|
|
13423
|
-
const targetScreen =
|
|
12988
|
+
const targetScreen = applyToPoint10(transform, targetCenter);
|
|
13424
12989
|
const offsetX = targetCenter.x - anchorPosition.x;
|
|
13425
12990
|
const offsetY = targetCenter.y - anchorPosition.y;
|
|
13426
12991
|
const xLineLength = Math.abs(targetScreen.x - anchorMarkerScreen.x);
|
|
@@ -13433,8 +12998,8 @@ var AnchorOffsetOverlay = ({
|
|
|
13433
12998
|
const shouldShowYLabel = yLineLength > VISUAL_CONFIG.MIN_LINE_LENGTH_FOR_LABEL;
|
|
13434
12999
|
const xLabelText = `${target.display_offset_x ?? offsetX.toFixed(2)}mm`;
|
|
13435
13000
|
const yLabelText = `${target.display_offset_y ?? offsetY.toFixed(2)}mm`;
|
|
13436
|
-
return /* @__PURE__ */
|
|
13437
|
-
/* @__PURE__ */
|
|
13001
|
+
return /* @__PURE__ */ jsxs7("g", { children: [
|
|
13002
|
+
/* @__PURE__ */ jsx9(
|
|
13438
13003
|
"line",
|
|
13439
13004
|
{
|
|
13440
13005
|
x1: anchorMarkerScreen.x,
|
|
@@ -13446,7 +13011,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13446
13011
|
strokeDasharray: VISUAL_CONFIG.LINE_DASH_PATTERN
|
|
13447
13012
|
}
|
|
13448
13013
|
),
|
|
13449
|
-
/* @__PURE__ */
|
|
13014
|
+
/* @__PURE__ */ jsx9(
|
|
13450
13015
|
"line",
|
|
13451
13016
|
{
|
|
13452
13017
|
x1: targetScreen.x,
|
|
@@ -13458,7 +13023,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13458
13023
|
strokeDasharray: VISUAL_CONFIG.LINE_DASH_PATTERN
|
|
13459
13024
|
}
|
|
13460
13025
|
),
|
|
13461
|
-
target.type === "component" || target.type === "board" ? /* @__PURE__ */
|
|
13026
|
+
target.type === "component" || target.type === "board" ? /* @__PURE__ */ jsx9(
|
|
13462
13027
|
"circle",
|
|
13463
13028
|
{
|
|
13464
13029
|
cx: targetScreen.x,
|
|
@@ -13470,8 +13035,8 @@ var AnchorOffsetOverlay = ({
|
|
|
13470
13035
|
}
|
|
13471
13036
|
) : (
|
|
13472
13037
|
// assumes "group"
|
|
13473
|
-
/* @__PURE__ */
|
|
13474
|
-
/* @__PURE__ */
|
|
13038
|
+
/* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
13039
|
+
/* @__PURE__ */ jsx9(
|
|
13475
13040
|
"line",
|
|
13476
13041
|
{
|
|
13477
13042
|
x1: targetScreen.x - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
|
|
@@ -13482,7 +13047,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13482
13047
|
strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
|
|
13483
13048
|
}
|
|
13484
13049
|
),
|
|
13485
|
-
/* @__PURE__ */
|
|
13050
|
+
/* @__PURE__ */ jsx9(
|
|
13486
13051
|
"line",
|
|
13487
13052
|
{
|
|
13488
13053
|
x1: targetScreen.x,
|
|
@@ -13495,7 +13060,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13495
13060
|
)
|
|
13496
13061
|
] })
|
|
13497
13062
|
),
|
|
13498
|
-
shouldShowXLabel && /* @__PURE__ */
|
|
13063
|
+
shouldShowXLabel && /* @__PURE__ */ jsx9(
|
|
13499
13064
|
"foreignObject",
|
|
13500
13065
|
{
|
|
13501
13066
|
x: Math.min(anchorMarkerScreen.x, targetScreen.x),
|
|
@@ -13503,10 +13068,10 @@ var AnchorOffsetOverlay = ({
|
|
|
13503
13068
|
width: Math.abs(targetScreen.x - anchorMarkerScreen.x),
|
|
13504
13069
|
height: 20,
|
|
13505
13070
|
style: { overflow: "visible" },
|
|
13506
|
-
children: /* @__PURE__ */
|
|
13071
|
+
children: /* @__PURE__ */ jsx9("div", { style: { ...labelStyle, textAlign: "center" }, children: xLabelText })
|
|
13507
13072
|
}
|
|
13508
13073
|
),
|
|
13509
|
-
shouldShowYLabel && /* @__PURE__ */
|
|
13074
|
+
shouldShowYLabel && /* @__PURE__ */ jsx9(
|
|
13510
13075
|
"foreignObject",
|
|
13511
13076
|
{
|
|
13512
13077
|
x: targetScreen.x + yLabelOffset,
|
|
@@ -13514,7 +13079,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13514
13079
|
width: VISUAL_CONFIG.Y_LABEL_MIN_WIDTH,
|
|
13515
13080
|
height: Math.abs(targetScreen.y - anchorMarkerScreen.y),
|
|
13516
13081
|
style: { overflow: "visible" },
|
|
13517
|
-
children: /* @__PURE__ */
|
|
13082
|
+
children: /* @__PURE__ */ jsx9(
|
|
13518
13083
|
"div",
|
|
13519
13084
|
{
|
|
13520
13085
|
style: {
|
|
@@ -13533,8 +13098,8 @@ var AnchorOffsetOverlay = ({
|
|
|
13533
13098
|
)
|
|
13534
13099
|
] }, target.id);
|
|
13535
13100
|
}),
|
|
13536
|
-
Array.from(anchorScreens.entries()).map(([anchorId, anchorScreen]) => /* @__PURE__ */
|
|
13537
|
-
/* @__PURE__ */
|
|
13101
|
+
Array.from(anchorScreens.entries()).map(([anchorId, anchorScreen]) => /* @__PURE__ */ jsxs7("g", { children: [
|
|
13102
|
+
/* @__PURE__ */ jsx9(
|
|
13538
13103
|
"line",
|
|
13539
13104
|
{
|
|
13540
13105
|
x1: anchorScreen.x - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
|
|
@@ -13545,7 +13110,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13545
13110
|
strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
|
|
13546
13111
|
}
|
|
13547
13112
|
),
|
|
13548
|
-
/* @__PURE__ */
|
|
13113
|
+
/* @__PURE__ */ jsx9(
|
|
13549
13114
|
"line",
|
|
13550
13115
|
{
|
|
13551
13116
|
x1: anchorScreen.x,
|
|
@@ -13565,7 +13130,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13565
13130
|
};
|
|
13566
13131
|
|
|
13567
13132
|
// src/components/AnchorOffsetOverlay/BoardAnchorOffsetOverlay.tsx
|
|
13568
|
-
import { jsx as
|
|
13133
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
13569
13134
|
var BoardAnchorOffsetOverlay = ({
|
|
13570
13135
|
elements,
|
|
13571
13136
|
highlightedPrimitives,
|
|
@@ -13652,7 +13217,7 @@ var BoardAnchorOffsetOverlay = ({
|
|
|
13652
13217
|
display_offset_y: target.group.display_offset_y
|
|
13653
13218
|
};
|
|
13654
13219
|
}).filter((t) => Boolean(t));
|
|
13655
|
-
return /* @__PURE__ */
|
|
13220
|
+
return /* @__PURE__ */ jsx10(
|
|
13656
13221
|
AnchorOffsetOverlay,
|
|
13657
13222
|
{
|
|
13658
13223
|
targets: sharedTargets,
|
|
@@ -13664,7 +13229,7 @@ var BoardAnchorOffsetOverlay = ({
|
|
|
13664
13229
|
};
|
|
13665
13230
|
|
|
13666
13231
|
// src/components/AnchorOffsetOverlay/GroupAnchorOffsetOverlay.tsx
|
|
13667
|
-
import { jsx as
|
|
13232
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
13668
13233
|
var GroupAnchorOffsetOverlay = ({
|
|
13669
13234
|
elements,
|
|
13670
13235
|
highlightedPrimitives,
|
|
@@ -13780,7 +13345,7 @@ var GroupAnchorOffsetOverlay = ({
|
|
|
13780
13345
|
display_offset_y: target.group.display_offset_y
|
|
13781
13346
|
};
|
|
13782
13347
|
}).filter((t) => Boolean(t));
|
|
13783
|
-
return /* @__PURE__ */
|
|
13348
|
+
return /* @__PURE__ */ jsx11(
|
|
13784
13349
|
AnchorOffsetOverlay,
|
|
13785
13350
|
{
|
|
13786
13351
|
targets: sharedTargets,
|
|
@@ -13792,8 +13357,8 @@ var GroupAnchorOffsetOverlay = ({
|
|
|
13792
13357
|
};
|
|
13793
13358
|
|
|
13794
13359
|
// src/components/AnchorOffsetOverlay/ComponentBoundingBoxOverlay.tsx
|
|
13795
|
-
import { applyToPoint as
|
|
13796
|
-
import { jsx as
|
|
13360
|
+
import { applyToPoint as applyToPoint11 } from "transformation-matrix";
|
|
13361
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
13797
13362
|
var calculateComponentBoundingBox = (component, elements) => {
|
|
13798
13363
|
const componentId = component.pcb_component_id;
|
|
13799
13364
|
const padsAndHoles = elements.filter(
|
|
@@ -13836,7 +13401,7 @@ var ComponentBoundingBoxOverlay = ({
|
|
|
13836
13401
|
renderData.push({ component, bbox, group });
|
|
13837
13402
|
}
|
|
13838
13403
|
if (renderData.length === 0) return null;
|
|
13839
|
-
return /* @__PURE__ */
|
|
13404
|
+
return /* @__PURE__ */ jsx12(
|
|
13840
13405
|
"div",
|
|
13841
13406
|
{
|
|
13842
13407
|
style: {
|
|
@@ -13849,18 +13414,18 @@ var ComponentBoundingBoxOverlay = ({
|
|
|
13849
13414
|
pointerEvents: "none",
|
|
13850
13415
|
zIndex: zIndexMap.dimensionOverlay
|
|
13851
13416
|
},
|
|
13852
|
-
children: /* @__PURE__ */
|
|
13417
|
+
children: /* @__PURE__ */ jsx12(
|
|
13853
13418
|
"svg",
|
|
13854
13419
|
{
|
|
13855
13420
|
style: { position: "absolute", left: 0, top: 0, pointerEvents: "none" },
|
|
13856
13421
|
width: containerWidth,
|
|
13857
13422
|
height: containerHeight,
|
|
13858
13423
|
children: renderData.map(({ component, bbox, group }) => {
|
|
13859
|
-
const topLeft =
|
|
13424
|
+
const topLeft = applyToPoint11(transform, {
|
|
13860
13425
|
x: bbox.minX,
|
|
13861
13426
|
y: bbox.maxY
|
|
13862
13427
|
});
|
|
13863
|
-
const bottomRight =
|
|
13428
|
+
const bottomRight = applyToPoint11(transform, {
|
|
13864
13429
|
x: bbox.maxX,
|
|
13865
13430
|
y: bbox.minY
|
|
13866
13431
|
});
|
|
@@ -13874,9 +13439,9 @@ var ComponentBoundingBoxOverlay = ({
|
|
|
13874
13439
|
x: (bbox.minX + bbox.maxX) / 2,
|
|
13875
13440
|
y: (bbox.minY + bbox.maxY) / 2
|
|
13876
13441
|
};
|
|
13877
|
-
const componentCenterScreen =
|
|
13878
|
-
return /* @__PURE__ */
|
|
13879
|
-
/* @__PURE__ */
|
|
13442
|
+
const componentCenterScreen = applyToPoint11(transform, componentCenter);
|
|
13443
|
+
return /* @__PURE__ */ jsxs8("g", { children: [
|
|
13444
|
+
/* @__PURE__ */ jsx12(
|
|
13880
13445
|
"rect",
|
|
13881
13446
|
{
|
|
13882
13447
|
x: screenBbox.x,
|
|
@@ -13889,7 +13454,7 @@ var ComponentBoundingBoxOverlay = ({
|
|
|
13889
13454
|
strokeDasharray: "4,4"
|
|
13890
13455
|
}
|
|
13891
13456
|
),
|
|
13892
|
-
/* @__PURE__ */
|
|
13457
|
+
/* @__PURE__ */ jsx12(
|
|
13893
13458
|
"line",
|
|
13894
13459
|
{
|
|
13895
13460
|
x1: componentCenterScreen.x - 6,
|
|
@@ -13900,7 +13465,7 @@ var ComponentBoundingBoxOverlay = ({
|
|
|
13900
13465
|
strokeWidth: 1.5
|
|
13901
13466
|
}
|
|
13902
13467
|
),
|
|
13903
|
-
/* @__PURE__ */
|
|
13468
|
+
/* @__PURE__ */ jsx12(
|
|
13904
13469
|
"line",
|
|
13905
13470
|
{
|
|
13906
13471
|
x1: componentCenterScreen.x,
|
|
@@ -13911,7 +13476,7 @@ var ComponentBoundingBoxOverlay = ({
|
|
|
13911
13476
|
strokeWidth: 1.5
|
|
13912
13477
|
}
|
|
13913
13478
|
),
|
|
13914
|
-
/* @__PURE__ */
|
|
13479
|
+
/* @__PURE__ */ jsx12(
|
|
13915
13480
|
"circle",
|
|
13916
13481
|
{
|
|
13917
13482
|
cx: componentCenterScreen.x,
|
|
@@ -13931,7 +13496,7 @@ var ComponentBoundingBoxOverlay = ({
|
|
|
13931
13496
|
};
|
|
13932
13497
|
|
|
13933
13498
|
// src/components/AnchorOffsetOverlay/PanelAnchorOffsetOverlay.tsx
|
|
13934
|
-
import { jsx as
|
|
13499
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
13935
13500
|
var PanelAnchorOffsetOverlay = ({
|
|
13936
13501
|
elements,
|
|
13937
13502
|
highlightedPrimitives,
|
|
@@ -13980,7 +13545,7 @@ var PanelAnchorOffsetOverlay = ({
|
|
|
13980
13545
|
display_offset_y: target.board.display_offset_y
|
|
13981
13546
|
};
|
|
13982
13547
|
}).filter((t) => Boolean(t));
|
|
13983
|
-
return /* @__PURE__ */
|
|
13548
|
+
return /* @__PURE__ */ jsx13(
|
|
13984
13549
|
AnchorOffsetOverlay,
|
|
13985
13550
|
{
|
|
13986
13551
|
targets: sharedTargets,
|
|
@@ -14069,8 +13634,8 @@ function filterTracesIfMultiple(filterTraces) {
|
|
|
14069
13634
|
}
|
|
14070
13635
|
|
|
14071
13636
|
// src/components/ElementOverlayBox.tsx
|
|
14072
|
-
import { useEffect as
|
|
14073
|
-
import { jsx as
|
|
13637
|
+
import { useEffect as useEffect9, useState as useState6 } from "react";
|
|
13638
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
14074
13639
|
var containerStyle = {
|
|
14075
13640
|
position: "absolute",
|
|
14076
13641
|
left: 0,
|
|
@@ -14133,9 +13698,9 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
14133
13698
|
mousePos,
|
|
14134
13699
|
elements
|
|
14135
13700
|
}) => {
|
|
14136
|
-
const [finalState, setFinalState] =
|
|
13701
|
+
const [finalState, setFinalState] = useState6(false);
|
|
14137
13702
|
const primitiveElement = primitive._element;
|
|
14138
|
-
|
|
13703
|
+
useEffect9(() => {
|
|
14139
13704
|
setTimeout(() => {
|
|
14140
13705
|
setFinalState(true);
|
|
14141
13706
|
}, 100);
|
|
@@ -14161,7 +13726,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
14161
13726
|
const traceTextContext = { primitiveElement, elements };
|
|
14162
13727
|
const overlayInfo = getTraceOverlayInfo(traceTextContext);
|
|
14163
13728
|
if (!overlayInfo) return null;
|
|
14164
|
-
return /* @__PURE__ */
|
|
13729
|
+
return /* @__PURE__ */ jsx14(
|
|
14165
13730
|
"div",
|
|
14166
13731
|
{
|
|
14167
13732
|
style: {
|
|
@@ -14172,7 +13737,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
14172
13737
|
color: color7,
|
|
14173
13738
|
pointerEvents: "none"
|
|
14174
13739
|
},
|
|
14175
|
-
children: /* @__PURE__ */
|
|
13740
|
+
children: /* @__PURE__ */ jsxs9(
|
|
14176
13741
|
"div",
|
|
14177
13742
|
{
|
|
14178
13743
|
style: {
|
|
@@ -14189,8 +13754,8 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
14189
13754
|
whiteSpace: "nowrap"
|
|
14190
13755
|
},
|
|
14191
13756
|
children: [
|
|
14192
|
-
overlayInfo.text && /* @__PURE__ */
|
|
14193
|
-
overlayInfo.name && /* @__PURE__ */
|
|
13757
|
+
overlayInfo.text && /* @__PURE__ */ jsx14("div", { children: overlayInfo.text }),
|
|
13758
|
+
overlayInfo.name && /* @__PURE__ */ jsx14(
|
|
14194
13759
|
"div",
|
|
14195
13760
|
{
|
|
14196
13761
|
style: {
|
|
@@ -14209,7 +13774,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
14209
13774
|
if (label.trim().length === 0) {
|
|
14210
13775
|
return null;
|
|
14211
13776
|
}
|
|
14212
|
-
return /* @__PURE__ */
|
|
13777
|
+
return /* @__PURE__ */ jsx14(
|
|
14213
13778
|
"div",
|
|
14214
13779
|
{
|
|
14215
13780
|
style: {
|
|
@@ -14223,7 +13788,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
14223
13788
|
transform: `rotate(${-rotation}deg)`,
|
|
14224
13789
|
transformOrigin: "center center"
|
|
14225
13790
|
},
|
|
14226
|
-
children: /* @__PURE__ */
|
|
13791
|
+
children: /* @__PURE__ */ jsx14(
|
|
14227
13792
|
"div",
|
|
14228
13793
|
{
|
|
14229
13794
|
style: {
|
|
@@ -14239,7 +13804,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
14239
13804
|
opacity: finalState ? 1 : si === 0 ? 1 : 0,
|
|
14240
13805
|
transition: "width 0.2s, height 0.2s, margin-left 0.2s, margin-top 0.2s, opacity 0.2s"
|
|
14241
13806
|
},
|
|
14242
|
-
children: /* @__PURE__ */
|
|
13807
|
+
children: /* @__PURE__ */ jsx14(
|
|
14243
13808
|
"div",
|
|
14244
13809
|
{
|
|
14245
13810
|
style: {
|
|
@@ -14287,7 +13852,7 @@ var ElementOverlayBox = ({
|
|
|
14287
13852
|
is_showing_multiple_traces_length,
|
|
14288
13853
|
elements
|
|
14289
13854
|
});
|
|
14290
|
-
return /* @__PURE__ */
|
|
13855
|
+
return /* @__PURE__ */ jsx14("div", { style: containerStyle, children: !is_moving_component && primitives.map((primitive) => /* @__PURE__ */ jsx14(
|
|
14291
13856
|
HighlightedPrimitiveBoxWithText,
|
|
14292
13857
|
{
|
|
14293
13858
|
primitive,
|
|
@@ -14299,7 +13864,7 @@ var ElementOverlayBox = ({
|
|
|
14299
13864
|
};
|
|
14300
13865
|
|
|
14301
13866
|
// src/components/MouseElementTracker.tsx
|
|
14302
|
-
import { Fragment as
|
|
13867
|
+
import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
14303
13868
|
var getPolygonBoundingBox = (points) => {
|
|
14304
13869
|
if (points.length === 0) return null;
|
|
14305
13870
|
let minX = points[0].x;
|
|
@@ -14415,10 +13980,10 @@ var MouseElementTracker = ({
|
|
|
14415
13980
|
selectedLayer,
|
|
14416
13981
|
onMouseHoverOverPrimitives
|
|
14417
13982
|
}) => {
|
|
14418
|
-
const [mousedPrimitives, setMousedPrimitives] =
|
|
14419
|
-
const [mousePos, setMousePos] =
|
|
13983
|
+
const [mousedPrimitives, setMousedPrimitives] = useState7([]);
|
|
13984
|
+
const [mousePos, setMousePos] = useState7({ x: 0, y: 0 });
|
|
14420
13985
|
const [containerRef, { width, height }] = useMeasure_default();
|
|
14421
|
-
|
|
13986
|
+
useEffect10(() => {
|
|
14422
13987
|
setMousedPrimitives([]);
|
|
14423
13988
|
onMouseHoverOverPrimitives([]);
|
|
14424
13989
|
}, [selectedLayer, onMouseHoverOverPrimitives]);
|
|
@@ -14461,7 +14026,7 @@ var MouseElementTracker = ({
|
|
|
14461
14026
|
h = "h" in primitive ? primitive.h : "r" in primitive ? primitive.r * 2 : "rX" in primitive && "rY" in primitive ? primitive.rY * 2 : 0;
|
|
14462
14027
|
}
|
|
14463
14028
|
if (!basePoint) continue;
|
|
14464
|
-
const screenPos =
|
|
14029
|
+
const screenPos = applyToPoint12(transform, basePoint);
|
|
14465
14030
|
const screenSize = {
|
|
14466
14031
|
w: w * transform.a,
|
|
14467
14032
|
h: h * transform.a
|
|
@@ -14486,7 +14051,7 @@ var MouseElementTracker = ({
|
|
|
14486
14051
|
}, [mousedPrimitives, transform]);
|
|
14487
14052
|
const handleInteraction = (x, y, transform2, primitives2) => {
|
|
14488
14053
|
setMousePos({ x, y });
|
|
14489
|
-
const rwPoint =
|
|
14054
|
+
const rwPoint = applyToPoint12(inverse4(transform2), { x, y });
|
|
14490
14055
|
const newMousedPrimitives = getPrimitivesUnderPoint(
|
|
14491
14056
|
primitives2,
|
|
14492
14057
|
rwPoint,
|
|
@@ -14502,7 +14067,7 @@ var MouseElementTracker = ({
|
|
|
14502
14067
|
setMousedPrimitives(newMousedPrimitives);
|
|
14503
14068
|
onMouseHoverOverPrimitives(newMousedPrimitives);
|
|
14504
14069
|
};
|
|
14505
|
-
return /* @__PURE__ */
|
|
14070
|
+
return /* @__PURE__ */ jsxs10(
|
|
14506
14071
|
"div",
|
|
14507
14072
|
{
|
|
14508
14073
|
ref: containerRef,
|
|
@@ -14526,7 +14091,7 @@ var MouseElementTracker = ({
|
|
|
14526
14091
|
},
|
|
14527
14092
|
children: [
|
|
14528
14093
|
children,
|
|
14529
|
-
/* @__PURE__ */
|
|
14094
|
+
/* @__PURE__ */ jsx15(
|
|
14530
14095
|
ElementOverlayBox,
|
|
14531
14096
|
{
|
|
14532
14097
|
elements,
|
|
@@ -14534,8 +14099,8 @@ var MouseElementTracker = ({
|
|
|
14534
14099
|
highlightedPrimitives
|
|
14535
14100
|
}
|
|
14536
14101
|
),
|
|
14537
|
-
transform && /* @__PURE__ */
|
|
14538
|
-
/* @__PURE__ */
|
|
14102
|
+
transform && /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
14103
|
+
/* @__PURE__ */ jsx15(
|
|
14539
14104
|
BoardAnchorOffsetOverlay,
|
|
14540
14105
|
{
|
|
14541
14106
|
elements,
|
|
@@ -14545,7 +14110,7 @@ var MouseElementTracker = ({
|
|
|
14545
14110
|
containerHeight: height
|
|
14546
14111
|
}
|
|
14547
14112
|
),
|
|
14548
|
-
/* @__PURE__ */
|
|
14113
|
+
/* @__PURE__ */ jsx15(
|
|
14549
14114
|
GroupAnchorOffsetOverlay,
|
|
14550
14115
|
{
|
|
14551
14116
|
elements,
|
|
@@ -14555,7 +14120,7 @@ var MouseElementTracker = ({
|
|
|
14555
14120
|
containerHeight: height
|
|
14556
14121
|
}
|
|
14557
14122
|
),
|
|
14558
|
-
/* @__PURE__ */
|
|
14123
|
+
/* @__PURE__ */ jsx15(
|
|
14559
14124
|
ComponentBoundingBoxOverlay,
|
|
14560
14125
|
{
|
|
14561
14126
|
elements,
|
|
@@ -14565,7 +14130,7 @@ var MouseElementTracker = ({
|
|
|
14565
14130
|
containerHeight: height
|
|
14566
14131
|
}
|
|
14567
14132
|
),
|
|
14568
|
-
/* @__PURE__ */
|
|
14133
|
+
/* @__PURE__ */ jsx15(
|
|
14569
14134
|
PanelAnchorOffsetOverlay,
|
|
14570
14135
|
{
|
|
14571
14136
|
elements,
|
|
@@ -14582,10 +14147,10 @@ var MouseElementTracker = ({
|
|
|
14582
14147
|
};
|
|
14583
14148
|
|
|
14584
14149
|
// src/components/PcbGroupOverlay.tsx
|
|
14585
|
-
import { applyToPoint as
|
|
14586
|
-
import { identity as
|
|
14587
|
-
import { useRef as
|
|
14588
|
-
import { jsx as
|
|
14150
|
+
import { applyToPoint as applyToPoint13 } from "transformation-matrix";
|
|
14151
|
+
import { identity as identity6 } from "transformation-matrix";
|
|
14152
|
+
import { useRef as useRef8, useEffect as useEffect11 } from "react";
|
|
14153
|
+
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
14589
14154
|
var GROUP_COLORS = [
|
|
14590
14155
|
"rgb(255, 100, 100)",
|
|
14591
14156
|
"rgb(100, 255, 100)",
|
|
@@ -14600,12 +14165,12 @@ var GROUP_COLORS = [
|
|
|
14600
14165
|
];
|
|
14601
14166
|
var PcbGroupOverlay = ({
|
|
14602
14167
|
children,
|
|
14603
|
-
transform =
|
|
14168
|
+
transform = identity6(),
|
|
14604
14169
|
elements = [],
|
|
14605
14170
|
hoveredComponentIds = []
|
|
14606
14171
|
}) => {
|
|
14607
14172
|
const [containerRef, { width, height }] = useMeasure_default();
|
|
14608
|
-
const canvasRef =
|
|
14173
|
+
const canvasRef = useRef8(null);
|
|
14609
14174
|
const {
|
|
14610
14175
|
is_showing_pcb_groups,
|
|
14611
14176
|
pcb_group_view_mode,
|
|
@@ -14615,7 +14180,7 @@ var PcbGroupOverlay = ({
|
|
|
14615
14180
|
pcb_group_view_mode: s.pcb_group_view_mode,
|
|
14616
14181
|
is_showing_group_anchor_offsets: s.is_showing_group_anchor_offsets
|
|
14617
14182
|
}));
|
|
14618
|
-
|
|
14183
|
+
useEffect11(() => {
|
|
14619
14184
|
const canvas = canvasRef.current;
|
|
14620
14185
|
if (!canvas || !width || !height) return;
|
|
14621
14186
|
canvas.width = width;
|
|
@@ -14743,10 +14308,10 @@ var PcbGroupOverlay = ({
|
|
|
14743
14308
|
minY -= totalPadding;
|
|
14744
14309
|
maxY += totalPadding;
|
|
14745
14310
|
}
|
|
14746
|
-
const topLeft =
|
|
14747
|
-
const topRight =
|
|
14748
|
-
const bottomLeft =
|
|
14749
|
-
const bottomRight =
|
|
14311
|
+
const topLeft = applyToPoint13(transform, { x: minX, y: maxY });
|
|
14312
|
+
const topRight = applyToPoint13(transform, { x: maxX, y: maxY });
|
|
14313
|
+
const bottomLeft = applyToPoint13(transform, { x: minX, y: minY });
|
|
14314
|
+
const bottomRight = applyToPoint13(transform, { x: maxX, y: minY });
|
|
14750
14315
|
const groupColor = GROUP_COLORS[groupIndex % GROUP_COLORS.length];
|
|
14751
14316
|
ctx.strokeStyle = groupColor;
|
|
14752
14317
|
ctx.lineWidth = 2;
|
|
@@ -14796,7 +14361,7 @@ var PcbGroupOverlay = ({
|
|
|
14796
14361
|
x: group.anchor_position[0] ?? 0,
|
|
14797
14362
|
y: group.anchor_position[1] ?? 0
|
|
14798
14363
|
} : { x: group.anchor_position.x, y: group.anchor_position.y };
|
|
14799
|
-
const anchorScreenPos =
|
|
14364
|
+
const anchorScreenPos = applyToPoint13(transform, anchorPositionValue);
|
|
14800
14365
|
ctx.strokeStyle = "white";
|
|
14801
14366
|
ctx.lineWidth = 1.5;
|
|
14802
14367
|
ctx.setLineDash([]);
|
|
@@ -14821,14 +14386,14 @@ var PcbGroupOverlay = ({
|
|
|
14821
14386
|
is_showing_group_anchor_offsets,
|
|
14822
14387
|
hoveredComponentIds
|
|
14823
14388
|
]);
|
|
14824
|
-
return /* @__PURE__ */
|
|
14389
|
+
return /* @__PURE__ */ jsxs11(
|
|
14825
14390
|
"div",
|
|
14826
14391
|
{
|
|
14827
14392
|
ref: containerRef,
|
|
14828
14393
|
style: { position: "relative", width: "100%", height: "100%" },
|
|
14829
14394
|
children: [
|
|
14830
14395
|
children,
|
|
14831
|
-
/* @__PURE__ */
|
|
14396
|
+
/* @__PURE__ */ jsx16(
|
|
14832
14397
|
"canvas",
|
|
14833
14398
|
{
|
|
14834
14399
|
ref: canvasRef,
|
|
@@ -14848,9 +14413,9 @@ var PcbGroupOverlay = ({
|
|
|
14848
14413
|
};
|
|
14849
14414
|
|
|
14850
14415
|
// src/components/RatsNestOverlay.tsx
|
|
14851
|
-
import { applyToPoint as
|
|
14416
|
+
import { applyToPoint as applyToPoint14, identity as identity7 } from "transformation-matrix";
|
|
14852
14417
|
import { useMemo as useMemo6 } from "react";
|
|
14853
|
-
import { jsx as
|
|
14418
|
+
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
14854
14419
|
var RatsNestOverlay = ({ transform, soup, children }) => {
|
|
14855
14420
|
const isShowingRatsNest = useGlobalStore((s) => s.is_showing_rats_nest);
|
|
14856
14421
|
const { netMap, idToNetMap } = useMemo6(
|
|
@@ -14912,10 +14477,10 @@ var RatsNestOverlay = ({ transform, soup, children }) => {
|
|
|
14912
14477
|
return lines;
|
|
14913
14478
|
}, [soup, netMap, idToNetMap, isShowingRatsNest]);
|
|
14914
14479
|
if (!soup || !isShowingRatsNest) return children;
|
|
14915
|
-
if (!transform) transform =
|
|
14916
|
-
return /* @__PURE__ */
|
|
14480
|
+
if (!transform) transform = identity7();
|
|
14481
|
+
return /* @__PURE__ */ jsxs12("div", { style: { position: "relative" }, children: [
|
|
14917
14482
|
children,
|
|
14918
|
-
/* @__PURE__ */
|
|
14483
|
+
/* @__PURE__ */ jsx17(
|
|
14919
14484
|
"svg",
|
|
14920
14485
|
{
|
|
14921
14486
|
style: {
|
|
@@ -14929,9 +14494,9 @@ var RatsNestOverlay = ({ transform, soup, children }) => {
|
|
|
14929
14494
|
zIndex: zIndexMap.ratsNestOverlay
|
|
14930
14495
|
},
|
|
14931
14496
|
children: ratsNestLines.map(({ key, startPoint, endPoint, isInNet }) => {
|
|
14932
|
-
const transformedStart =
|
|
14933
|
-
const transformedEnd =
|
|
14934
|
-
return /* @__PURE__ */
|
|
14497
|
+
const transformedStart = applyToPoint14(transform, startPoint);
|
|
14498
|
+
const transformedEnd = applyToPoint14(transform, endPoint);
|
|
14499
|
+
return /* @__PURE__ */ jsx17(
|
|
14935
14500
|
"line",
|
|
14936
14501
|
{
|
|
14937
14502
|
x1: transformedStart.x,
|
|
@@ -14952,18 +14517,18 @@ var RatsNestOverlay = ({ transform, soup, children }) => {
|
|
|
14952
14517
|
|
|
14953
14518
|
// src/components/ToolbarOverlay.tsx
|
|
14954
14519
|
import {
|
|
14955
|
-
useEffect as
|
|
14956
|
-
useState as
|
|
14520
|
+
useEffect as useEffect15,
|
|
14521
|
+
useState as useState10,
|
|
14957
14522
|
useCallback as useCallback10,
|
|
14958
|
-
useRef as
|
|
14523
|
+
useRef as useRef12,
|
|
14959
14524
|
useLayoutEffect as useLayoutEffect2
|
|
14960
14525
|
} from "react";
|
|
14961
|
-
import { css as
|
|
14526
|
+
import { css as css2 } from "@emotion/css";
|
|
14962
14527
|
|
|
14963
14528
|
// package.json
|
|
14964
14529
|
var package_default = {
|
|
14965
14530
|
name: "@tscircuit/pcb-viewer",
|
|
14966
|
-
version: "1.11.
|
|
14531
|
+
version: "1.11.388",
|
|
14967
14532
|
main: "dist/index.js",
|
|
14968
14533
|
type: "module",
|
|
14969
14534
|
repository: "tscircuit/pcb-viewer",
|
|
@@ -15028,20 +14593,20 @@ var package_default = {
|
|
|
15028
14593
|
};
|
|
15029
14594
|
|
|
15030
14595
|
// src/hooks/useHotKey.ts
|
|
15031
|
-
import { useEffect as
|
|
14596
|
+
import { useEffect as useEffect12, useRef as useRef9 } from "react";
|
|
15032
14597
|
var useHotKey = (key, onUse, containerRef) => {
|
|
15033
14598
|
const isMouseOverContainer = useGlobalStore(
|
|
15034
14599
|
(s) => s.is_mouse_over_container
|
|
15035
14600
|
);
|
|
15036
|
-
const isMouseOverContainerRef =
|
|
15037
|
-
const onUseRef =
|
|
15038
|
-
|
|
14601
|
+
const isMouseOverContainerRef = useRef9(isMouseOverContainer);
|
|
14602
|
+
const onUseRef = useRef9(onUse);
|
|
14603
|
+
useEffect12(() => {
|
|
15039
14604
|
isMouseOverContainerRef.current = isMouseOverContainer;
|
|
15040
14605
|
}, [isMouseOverContainer]);
|
|
15041
|
-
|
|
14606
|
+
useEffect12(() => {
|
|
15042
14607
|
onUseRef.current = onUse;
|
|
15043
14608
|
}, [onUse]);
|
|
15044
|
-
|
|
14609
|
+
useEffect12(() => {
|
|
15045
14610
|
if (!key) return;
|
|
15046
14611
|
const handleKeyDown = (event) => {
|
|
15047
14612
|
const target = event.target;
|
|
@@ -15069,10 +14634,10 @@ var useHotKey = (key, onUse, containerRef) => {
|
|
|
15069
14634
|
};
|
|
15070
14635
|
|
|
15071
14636
|
// src/hooks/useIsSmallScreen.ts
|
|
15072
|
-
import { useEffect as
|
|
14637
|
+
import { useEffect as useEffect13, useState as useState8 } from "react";
|
|
15073
14638
|
var useIsSmallScreen = () => {
|
|
15074
|
-
const [isSmallScreen, setIsSmallScreen] =
|
|
15075
|
-
|
|
14639
|
+
const [isSmallScreen, setIsSmallScreen] = useState8(false);
|
|
14640
|
+
useEffect13(() => {
|
|
15076
14641
|
const checkIsMobile = () => {
|
|
15077
14642
|
setIsSmallScreen(window.innerWidth <= 768);
|
|
15078
14643
|
};
|
|
@@ -15086,10 +14651,10 @@ var useIsSmallScreen = () => {
|
|
|
15086
14651
|
// src/hooks/useMobileTouch.ts
|
|
15087
14652
|
import {
|
|
15088
14653
|
useCallback as useCallback7,
|
|
15089
|
-
useRef as
|
|
14654
|
+
useRef as useRef10
|
|
15090
14655
|
} from "react";
|
|
15091
14656
|
var useMobileTouch = (onClick, options = { stopPropagation: true }) => {
|
|
15092
|
-
const lastInteractionRef =
|
|
14657
|
+
const lastInteractionRef = useRef10(0);
|
|
15093
14658
|
const handleInteraction = useCallback7(
|
|
15094
14659
|
(e) => {
|
|
15095
14660
|
if (options.stopPropagation) {
|
|
@@ -15118,7 +14683,7 @@ var useMobileTouch = (onClick, options = { stopPropagation: true }) => {
|
|
|
15118
14683
|
};
|
|
15119
14684
|
|
|
15120
14685
|
// src/components/ToolbarButton.tsx
|
|
15121
|
-
import { jsx as
|
|
14686
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
15122
14687
|
var ToolbarButton = ({
|
|
15123
14688
|
children,
|
|
15124
14689
|
isSmallScreen,
|
|
@@ -15126,7 +14691,7 @@ var ToolbarButton = ({
|
|
|
15126
14691
|
...props
|
|
15127
14692
|
}) => {
|
|
15128
14693
|
const { style: touchStyle, ...touchHandlers } = useMobileTouch(onClick);
|
|
15129
|
-
return /* @__PURE__ */
|
|
14694
|
+
return /* @__PURE__ */ jsx18(
|
|
15130
14695
|
"div",
|
|
15131
14696
|
{
|
|
15132
14697
|
...props,
|
|
@@ -15154,7 +14719,7 @@ var ToolbarButton = ({
|
|
|
15154
14719
|
};
|
|
15155
14720
|
|
|
15156
14721
|
// src/components/ToolbarErrorDropdown.tsx
|
|
15157
|
-
import { useCallback as useCallback9, useMemo as useMemo7, useState as
|
|
14722
|
+
import { useCallback as useCallback9, useMemo as useMemo7, useState as useState9 } from "react";
|
|
15158
14723
|
|
|
15159
14724
|
// src/lib/util/group-errors-by-type.ts
|
|
15160
14725
|
var groupErrorsByType = (errors) => {
|
|
@@ -15176,16 +14741,16 @@ var groupErrorsByType = (errors) => {
|
|
|
15176
14741
|
};
|
|
15177
14742
|
|
|
15178
14743
|
// src/components/useToolbarErrorFocus.ts
|
|
15179
|
-
import { useCallback as useCallback8, useEffect as
|
|
14744
|
+
import { useCallback as useCallback8, useEffect as useEffect14, useRef as useRef11 } from "react";
|
|
15180
14745
|
var useToolbarErrorFocus = ({
|
|
15181
14746
|
onClose,
|
|
15182
14747
|
setHoveredErrorId,
|
|
15183
14748
|
setFocusedErrorId,
|
|
15184
14749
|
highlightDurationMs = 3e3
|
|
15185
14750
|
}) => {
|
|
15186
|
-
const clearHighlightTimeoutRef =
|
|
15187
|
-
const focusRequestRef =
|
|
15188
|
-
const selectedErrorIdRef =
|
|
14751
|
+
const clearHighlightTimeoutRef = useRef11(null);
|
|
14752
|
+
const focusRequestRef = useRef11(null);
|
|
14753
|
+
const selectedErrorIdRef = useRef11(null);
|
|
15189
14754
|
const clearPendingSelection = useCallback8(() => {
|
|
15190
14755
|
if (clearHighlightTimeoutRef.current !== null) {
|
|
15191
14756
|
window.clearTimeout(clearHighlightTimeoutRef.current);
|
|
@@ -15196,7 +14761,7 @@ var useToolbarErrorFocus = ({
|
|
|
15196
14761
|
focusRequestRef.current = null;
|
|
15197
14762
|
}
|
|
15198
14763
|
}, []);
|
|
15199
|
-
|
|
14764
|
+
useEffect14(() => clearPendingSelection, [clearPendingSelection]);
|
|
15200
14765
|
const handleErrorSelect = useCallback8(
|
|
15201
14766
|
(errorId) => {
|
|
15202
14767
|
clearPendingSelection();
|
|
@@ -15234,7 +14799,7 @@ var useToolbarErrorFocus = ({
|
|
|
15234
14799
|
};
|
|
15235
14800
|
|
|
15236
14801
|
// src/components/ToolbarErrorDropdown.tsx
|
|
15237
|
-
import { jsx as
|
|
14802
|
+
import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
15238
14803
|
var CopyErrorButton = ({
|
|
15239
14804
|
errorId,
|
|
15240
14805
|
errorMessage,
|
|
@@ -15244,7 +14809,7 @@ var CopyErrorButton = ({
|
|
|
15244
14809
|
const { style: touchStyle, ...touchHandlers } = useMobileTouch(
|
|
15245
14810
|
() => onCopy(errorMessage, errorId)
|
|
15246
14811
|
);
|
|
15247
|
-
return /* @__PURE__ */
|
|
14812
|
+
return /* @__PURE__ */ jsx19(
|
|
15248
14813
|
"button",
|
|
15249
14814
|
{
|
|
15250
14815
|
type: "button",
|
|
@@ -15264,7 +14829,7 @@ var CopyErrorButton = ({
|
|
|
15264
14829
|
...touchStyle
|
|
15265
14830
|
},
|
|
15266
14831
|
...touchHandlers,
|
|
15267
|
-
children: copiedErrorId === errorId ? /* @__PURE__ */
|
|
14832
|
+
children: copiedErrorId === errorId ? /* @__PURE__ */ jsx19("span", { style: { color: "#4caf50", fontSize: 12 }, children: "Copied!" }) : /* @__PURE__ */ jsx19("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx19("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" }) })
|
|
15268
14833
|
}
|
|
15269
14834
|
);
|
|
15270
14835
|
};
|
|
@@ -15277,11 +14842,11 @@ var ToolbarErrorDropdown = ({
|
|
|
15277
14842
|
setHoveredErrorId,
|
|
15278
14843
|
setFocusedErrorId
|
|
15279
14844
|
}) => {
|
|
15280
|
-
const [copiedErrorId, setCopiedErrorId] =
|
|
15281
|
-
const [collapsedErrorGroups, setCollapsedErrorGroups] =
|
|
14845
|
+
const [copiedErrorId, setCopiedErrorId] = useState9(null);
|
|
14846
|
+
const [collapsedErrorGroups, setCollapsedErrorGroups] = useState9(
|
|
15282
14847
|
/* @__PURE__ */ new Set()
|
|
15283
14848
|
);
|
|
15284
|
-
const [expandedErrorIds, setExpandedErrorIds] =
|
|
14849
|
+
const [expandedErrorIds, setExpandedErrorIds] = useState9(
|
|
15285
14850
|
/* @__PURE__ */ new Set()
|
|
15286
14851
|
);
|
|
15287
14852
|
const [, copyToClipboard] = useCopyToClipboard_default();
|
|
@@ -15323,20 +14888,20 @@ var ToolbarErrorDropdown = ({
|
|
|
15323
14888
|
return next;
|
|
15324
14889
|
});
|
|
15325
14890
|
}, []);
|
|
15326
|
-
return /* @__PURE__ */
|
|
15327
|
-
/* @__PURE__ */
|
|
14891
|
+
return /* @__PURE__ */ jsxs13("div", { style: { position: "relative" }, children: [
|
|
14892
|
+
/* @__PURE__ */ jsx19(
|
|
15328
14893
|
ToolbarButton,
|
|
15329
14894
|
{
|
|
15330
14895
|
isSmallScreen,
|
|
15331
14896
|
style: errorCount > 0 ? { color: "red" } : void 0,
|
|
15332
14897
|
onClick: onToggle,
|
|
15333
|
-
children: /* @__PURE__ */
|
|
14898
|
+
children: /* @__PURE__ */ jsxs13("div", { children: [
|
|
15334
14899
|
errorCount,
|
|
15335
14900
|
" errors"
|
|
15336
14901
|
] })
|
|
15337
14902
|
}
|
|
15338
14903
|
),
|
|
15339
|
-
isOpen && errorCount > 0 && /* @__PURE__ */
|
|
14904
|
+
isOpen && errorCount > 0 && /* @__PURE__ */ jsx19(
|
|
15340
14905
|
"div",
|
|
15341
14906
|
{
|
|
15342
14907
|
style: {
|
|
@@ -15356,14 +14921,14 @@ var ToolbarErrorDropdown = ({
|
|
|
15356
14921
|
},
|
|
15357
14922
|
children: groupedErrorElements.map(({ errorType, errors }, groupIndex) => {
|
|
15358
14923
|
const isGroupCollapsed = collapsedErrorGroups.has(errorType);
|
|
15359
|
-
return /* @__PURE__ */
|
|
14924
|
+
return /* @__PURE__ */ jsxs13(
|
|
15360
14925
|
"div",
|
|
15361
14926
|
{
|
|
15362
14927
|
style: {
|
|
15363
14928
|
borderBottom: groupIndex < groupedErrorElements.length - 1 ? "1px solid #444" : "none"
|
|
15364
14929
|
},
|
|
15365
14930
|
children: [
|
|
15366
|
-
/* @__PURE__ */
|
|
14931
|
+
/* @__PURE__ */ jsxs13(
|
|
15367
14932
|
"div",
|
|
15368
14933
|
{
|
|
15369
14934
|
style: {
|
|
@@ -15400,7 +14965,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15400
14965
|
toggleErrorGroup(errorType);
|
|
15401
14966
|
},
|
|
15402
14967
|
children: [
|
|
15403
|
-
/* @__PURE__ */
|
|
14968
|
+
/* @__PURE__ */ jsxs13(
|
|
15404
14969
|
"div",
|
|
15405
14970
|
{
|
|
15406
14971
|
style: {
|
|
@@ -15410,7 +14975,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15410
14975
|
color: "#ff6b6b"
|
|
15411
14976
|
},
|
|
15412
14977
|
children: [
|
|
15413
|
-
/* @__PURE__ */
|
|
14978
|
+
/* @__PURE__ */ jsx19(
|
|
15414
14979
|
"div",
|
|
15415
14980
|
{
|
|
15416
14981
|
style: {
|
|
@@ -15423,7 +14988,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15423
14988
|
children: "\u203A"
|
|
15424
14989
|
}
|
|
15425
14990
|
),
|
|
15426
|
-
/* @__PURE__ */
|
|
14991
|
+
/* @__PURE__ */ jsx19(
|
|
15427
14992
|
"div",
|
|
15428
14993
|
{
|
|
15429
14994
|
style: {
|
|
@@ -15436,7 +15001,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15436
15001
|
]
|
|
15437
15002
|
}
|
|
15438
15003
|
),
|
|
15439
|
-
/* @__PURE__ */
|
|
15004
|
+
/* @__PURE__ */ jsx19(
|
|
15440
15005
|
"div",
|
|
15441
15006
|
{
|
|
15442
15007
|
style: {
|
|
@@ -15454,14 +15019,14 @@ var ToolbarErrorDropdown = ({
|
|
|
15454
15019
|
!isGroupCollapsed && errors.map(({ error, index, errorId }) => {
|
|
15455
15020
|
const isExpanded = expandedErrorIds.has(errorId);
|
|
15456
15021
|
const errorMessage = error.message ?? "No error message";
|
|
15457
|
-
return /* @__PURE__ */
|
|
15022
|
+
return /* @__PURE__ */ jsxs13(
|
|
15458
15023
|
"div",
|
|
15459
15024
|
{
|
|
15460
15025
|
style: {
|
|
15461
15026
|
borderTop: "1px solid #3a3a3a"
|
|
15462
15027
|
},
|
|
15463
15028
|
children: [
|
|
15464
|
-
/* @__PURE__ */
|
|
15029
|
+
/* @__PURE__ */ jsxs13(
|
|
15465
15030
|
"div",
|
|
15466
15031
|
{
|
|
15467
15032
|
style: {
|
|
@@ -15500,7 +15065,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15500
15065
|
handleErrorSelect(errorId);
|
|
15501
15066
|
},
|
|
15502
15067
|
children: [
|
|
15503
|
-
/* @__PURE__ */
|
|
15068
|
+
/* @__PURE__ */ jsx19(
|
|
15504
15069
|
"div",
|
|
15505
15070
|
{
|
|
15506
15071
|
style: {
|
|
@@ -15516,7 +15081,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15516
15081
|
children: errorMessage
|
|
15517
15082
|
}
|
|
15518
15083
|
),
|
|
15519
|
-
/* @__PURE__ */
|
|
15084
|
+
/* @__PURE__ */ jsx19(
|
|
15520
15085
|
"button",
|
|
15521
15086
|
{
|
|
15522
15087
|
type: "button",
|
|
@@ -15548,7 +15113,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15548
15113
|
]
|
|
15549
15114
|
}
|
|
15550
15115
|
),
|
|
15551
|
-
isExpanded && /* @__PURE__ */
|
|
15116
|
+
isExpanded && /* @__PURE__ */ jsxs13(
|
|
15552
15117
|
"div",
|
|
15553
15118
|
{
|
|
15554
15119
|
"data-error-id": index,
|
|
@@ -15560,7 +15125,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15560
15125
|
position: "relative"
|
|
15561
15126
|
},
|
|
15562
15127
|
children: [
|
|
15563
|
-
/* @__PURE__ */
|
|
15128
|
+
/* @__PURE__ */ jsx19(
|
|
15564
15129
|
"div",
|
|
15565
15130
|
{
|
|
15566
15131
|
style: {
|
|
@@ -15578,7 +15143,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15578
15143
|
children: errorMessage
|
|
15579
15144
|
}
|
|
15580
15145
|
),
|
|
15581
|
-
/* @__PURE__ */
|
|
15146
|
+
/* @__PURE__ */ jsx19(
|
|
15582
15147
|
CopyErrorButton,
|
|
15583
15148
|
{
|
|
15584
15149
|
errorId,
|
|
@@ -15610,13 +15175,13 @@ var ToolbarErrorDropdown = ({
|
|
|
15610
15175
|
};
|
|
15611
15176
|
|
|
15612
15177
|
// src/components/ToolbarOverlay.tsx
|
|
15613
|
-
import { jsx as
|
|
15178
|
+
import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
15614
15179
|
var LayerButton = ({ name, selected, onClick }) => {
|
|
15615
15180
|
const { style: touchStyle, ...touchHandlers } = useMobileTouch(onClick);
|
|
15616
|
-
return /* @__PURE__ */
|
|
15181
|
+
return /* @__PURE__ */ jsxs14(
|
|
15617
15182
|
"div",
|
|
15618
15183
|
{
|
|
15619
|
-
className:
|
|
15184
|
+
className: css2`
|
|
15620
15185
|
margin-top: 2px;
|
|
15621
15186
|
padding: 4px;
|
|
15622
15187
|
padding-left: 8px;
|
|
@@ -15630,8 +15195,8 @@ var LayerButton = ({ name, selected, onClick }) => {
|
|
|
15630
15195
|
...touchHandlers,
|
|
15631
15196
|
style: touchStyle,
|
|
15632
15197
|
children: [
|
|
15633
|
-
/* @__PURE__ */
|
|
15634
|
-
/* @__PURE__ */
|
|
15198
|
+
/* @__PURE__ */ jsx20("span", { style: { marginRight: 2, opacity: selected ? 1 : 0 }, children: "\u2022" }),
|
|
15199
|
+
/* @__PURE__ */ jsx20(
|
|
15635
15200
|
"span",
|
|
15636
15201
|
{
|
|
15637
15202
|
style: {
|
|
@@ -15652,10 +15217,10 @@ var CheckboxMenuItem = ({
|
|
|
15652
15217
|
onClick
|
|
15653
15218
|
}) => {
|
|
15654
15219
|
const { style: touchStyle, ...touchHandlers } = useMobileTouch(onClick);
|
|
15655
|
-
return /* @__PURE__ */
|
|
15220
|
+
return /* @__PURE__ */ jsxs14(
|
|
15656
15221
|
"div",
|
|
15657
15222
|
{
|
|
15658
|
-
className:
|
|
15223
|
+
className: css2`
|
|
15659
15224
|
margin-top: 2px;
|
|
15660
15225
|
padding: 4px;
|
|
15661
15226
|
padding-left: 8px;
|
|
@@ -15672,19 +15237,19 @@ var CheckboxMenuItem = ({
|
|
|
15672
15237
|
...touchHandlers,
|
|
15673
15238
|
style: touchStyle,
|
|
15674
15239
|
children: [
|
|
15675
|
-
/* @__PURE__ */
|
|
15240
|
+
/* @__PURE__ */ jsx20("input", { type: "checkbox", checked, onChange: () => {
|
|
15676
15241
|
}, readOnly: true }),
|
|
15677
|
-
/* @__PURE__ */
|
|
15242
|
+
/* @__PURE__ */ jsx20("span", { style: { color: "#eee" }, children: label })
|
|
15678
15243
|
]
|
|
15679
15244
|
}
|
|
15680
15245
|
);
|
|
15681
15246
|
};
|
|
15682
15247
|
var RadioMenuItem = ({ label, checked, onClick }) => {
|
|
15683
15248
|
const { style: touchStyle, ...touchHandlers } = useMobileTouch(onClick);
|
|
15684
|
-
return /* @__PURE__ */
|
|
15249
|
+
return /* @__PURE__ */ jsxs14(
|
|
15685
15250
|
"div",
|
|
15686
15251
|
{
|
|
15687
|
-
className:
|
|
15252
|
+
className: css2`
|
|
15688
15253
|
margin-top: 2px;
|
|
15689
15254
|
padding: 4px;
|
|
15690
15255
|
padding-left: 8px;
|
|
@@ -15701,9 +15266,9 @@ var RadioMenuItem = ({ label, checked, onClick }) => {
|
|
|
15701
15266
|
...touchHandlers,
|
|
15702
15267
|
style: touchStyle,
|
|
15703
15268
|
children: [
|
|
15704
|
-
/* @__PURE__ */
|
|
15269
|
+
/* @__PURE__ */ jsx20("input", { type: "radio", checked, onChange: () => {
|
|
15705
15270
|
}, readOnly: true }),
|
|
15706
|
-
/* @__PURE__ */
|
|
15271
|
+
/* @__PURE__ */ jsx20("span", { style: { color: "#eee" }, children: label })
|
|
15707
15272
|
]
|
|
15708
15273
|
}
|
|
15709
15274
|
);
|
|
@@ -15767,12 +15332,12 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15767
15332
|
setHoveredErrorId: s.setHoveredErrorId,
|
|
15768
15333
|
setFocusedErrorId: s.setFocusedErrorId
|
|
15769
15334
|
}));
|
|
15770
|
-
const [isViewMenuOpen, setViewMenuOpen] =
|
|
15771
|
-
const [isLayerMenuOpen, setLayerMenuOpen] =
|
|
15772
|
-
const [isErrorsOpen, setErrorsOpen] =
|
|
15773
|
-
const [measureToolArmed, setMeasureToolArmed] =
|
|
15774
|
-
const [boundsToolArmed, setBoundsToolArmed] =
|
|
15775
|
-
|
|
15335
|
+
const [isViewMenuOpen, setViewMenuOpen] = useState10(false);
|
|
15336
|
+
const [isLayerMenuOpen, setLayerMenuOpen] = useState10(false);
|
|
15337
|
+
const [isErrorsOpen, setErrorsOpen] = useState10(false);
|
|
15338
|
+
const [measureToolArmed, setMeasureToolArmed] = useState10(false);
|
|
15339
|
+
const [boundsToolArmed, setBoundsToolArmed] = useState10(false);
|
|
15340
|
+
useEffect15(() => {
|
|
15776
15341
|
const arm = () => setMeasureToolArmed(true);
|
|
15777
15342
|
const disarm = () => setMeasureToolArmed(false);
|
|
15778
15343
|
const armBounds = () => setBoundsToolArmed(true);
|
|
@@ -15790,8 +15355,8 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15790
15355
|
}, []);
|
|
15791
15356
|
const availableLayers = getCopperLayerRefsFromElements(elements ?? []);
|
|
15792
15357
|
const processedLayers = availableLayers;
|
|
15793
|
-
const hasRunInitialMouseCheck =
|
|
15794
|
-
const hotkeyBoundaryRef =
|
|
15358
|
+
const hasRunInitialMouseCheck = useRef12(false);
|
|
15359
|
+
const hotkeyBoundaryRef = useRef12(null);
|
|
15795
15360
|
const hotKeyCallbacks = {
|
|
15796
15361
|
"1": availableLayers[0] ? () => selectLayer(availableLayers[0]) : () => {
|
|
15797
15362
|
},
|
|
@@ -15898,7 +15463,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15898
15463
|
},
|
|
15899
15464
|
[]
|
|
15900
15465
|
);
|
|
15901
|
-
return /* @__PURE__ */
|
|
15466
|
+
return /* @__PURE__ */ jsxs14(
|
|
15902
15467
|
"div",
|
|
15903
15468
|
{
|
|
15904
15469
|
ref: hotkeyBoundaryRef,
|
|
@@ -15908,7 +15473,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15908
15473
|
onMouseMove: handleMouseMove,
|
|
15909
15474
|
children: [
|
|
15910
15475
|
children,
|
|
15911
|
-
/* @__PURE__ */
|
|
15476
|
+
/* @__PURE__ */ jsxs14(
|
|
15912
15477
|
"div",
|
|
15913
15478
|
{
|
|
15914
15479
|
style: {
|
|
@@ -15929,7 +15494,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15929
15494
|
]
|
|
15930
15495
|
}
|
|
15931
15496
|
),
|
|
15932
|
-
/* @__PURE__ */
|
|
15497
|
+
/* @__PURE__ */ jsxs14(
|
|
15933
15498
|
"div",
|
|
15934
15499
|
{
|
|
15935
15500
|
"data-toolbar-overlay": true,
|
|
@@ -15960,7 +15525,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15960
15525
|
fontFamily: "sans-serif"
|
|
15961
15526
|
},
|
|
15962
15527
|
children: [
|
|
15963
|
-
/* @__PURE__ */
|
|
15528
|
+
/* @__PURE__ */ jsxs14(
|
|
15964
15529
|
ToolbarButton,
|
|
15965
15530
|
{
|
|
15966
15531
|
isSmallScreen,
|
|
@@ -15971,10 +15536,10 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15971
15536
|
}
|
|
15972
15537
|
},
|
|
15973
15538
|
children: [
|
|
15974
|
-
/* @__PURE__ */
|
|
15539
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
15975
15540
|
"layer:",
|
|
15976
15541
|
" ",
|
|
15977
|
-
/* @__PURE__ */
|
|
15542
|
+
/* @__PURE__ */ jsx20(
|
|
15978
15543
|
"span",
|
|
15979
15544
|
{
|
|
15980
15545
|
style: {
|
|
@@ -15986,7 +15551,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15986
15551
|
}
|
|
15987
15552
|
)
|
|
15988
15553
|
] }),
|
|
15989
|
-
isLayerMenuOpen && /* @__PURE__ */
|
|
15554
|
+
isLayerMenuOpen && /* @__PURE__ */ jsx20("div", { style: { marginTop: 4, minWidth: 120 }, children: processedLayers.map((layer) => /* @__PURE__ */ jsx20(
|
|
15990
15555
|
LayerButton,
|
|
15991
15556
|
{
|
|
15992
15557
|
name: layer,
|
|
@@ -16000,7 +15565,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16000
15565
|
]
|
|
16001
15566
|
}
|
|
16002
15567
|
),
|
|
16003
|
-
/* @__PURE__ */
|
|
15568
|
+
/* @__PURE__ */ jsx20(
|
|
16004
15569
|
ToolbarErrorDropdown,
|
|
16005
15570
|
{
|
|
16006
15571
|
elements,
|
|
@@ -16012,43 +15577,43 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16012
15577
|
setFocusedErrorId
|
|
16013
15578
|
}
|
|
16014
15579
|
),
|
|
16015
|
-
/* @__PURE__ */
|
|
15580
|
+
/* @__PURE__ */ jsx20(
|
|
16016
15581
|
ToolbarButton,
|
|
16017
15582
|
{
|
|
16018
15583
|
isSmallScreen,
|
|
16019
15584
|
style: {},
|
|
16020
15585
|
onClick: handleRatsNestToggle,
|
|
16021
|
-
children: /* @__PURE__ */
|
|
15586
|
+
children: /* @__PURE__ */ jsxs14("div", { children: [
|
|
16022
15587
|
viewSettings.is_showing_rats_nest ? "\u2716 " : "",
|
|
16023
15588
|
"Rats Nest"
|
|
16024
15589
|
] })
|
|
16025
15590
|
}
|
|
16026
15591
|
),
|
|
16027
|
-
/* @__PURE__ */
|
|
15592
|
+
/* @__PURE__ */ jsx20(
|
|
16028
15593
|
ToolbarButton,
|
|
16029
15594
|
{
|
|
16030
15595
|
isSmallScreen,
|
|
16031
15596
|
style: measureToolArmed ? { backgroundColor: "#444" } : {},
|
|
16032
15597
|
onClick: handleMeasureToolClick,
|
|
16033
|
-
children: /* @__PURE__ */
|
|
15598
|
+
children: /* @__PURE__ */ jsx20("div", { children: "\u{1F4CF}" })
|
|
16034
15599
|
}
|
|
16035
15600
|
),
|
|
16036
|
-
/* @__PURE__ */
|
|
15601
|
+
/* @__PURE__ */ jsx20(
|
|
16037
15602
|
ToolbarButton,
|
|
16038
15603
|
{
|
|
16039
15604
|
isSmallScreen,
|
|
16040
15605
|
style: boundsToolArmed ? { backgroundColor: "#444" } : {},
|
|
16041
15606
|
onClick: handleBoundsToolClick,
|
|
16042
|
-
children: /* @__PURE__ */
|
|
15607
|
+
children: /* @__PURE__ */ jsx20("div", { children: "Bounds" })
|
|
16043
15608
|
}
|
|
16044
15609
|
),
|
|
16045
|
-
/* @__PURE__ */
|
|
15610
|
+
/* @__PURE__ */ jsx20(
|
|
16046
15611
|
ToolbarButton,
|
|
16047
15612
|
{
|
|
16048
15613
|
isSmallScreen,
|
|
16049
15614
|
onClick: handleViewMenuToggle,
|
|
16050
|
-
children: /* @__PURE__ */
|
|
16051
|
-
/* @__PURE__ */
|
|
15615
|
+
children: /* @__PURE__ */ jsxs14("div", { children: [
|
|
15616
|
+
/* @__PURE__ */ jsxs14(
|
|
16052
15617
|
"div",
|
|
16053
15618
|
{
|
|
16054
15619
|
style: {
|
|
@@ -16058,7 +15623,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16058
15623
|
},
|
|
16059
15624
|
children: [
|
|
16060
15625
|
"View",
|
|
16061
|
-
/* @__PURE__ */
|
|
15626
|
+
/* @__PURE__ */ jsx20(
|
|
16062
15627
|
"span",
|
|
16063
15628
|
{
|
|
16064
15629
|
style: {
|
|
@@ -16073,8 +15638,8 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16073
15638
|
]
|
|
16074
15639
|
}
|
|
16075
15640
|
),
|
|
16076
|
-
isViewMenuOpen && /* @__PURE__ */
|
|
16077
|
-
/* @__PURE__ */
|
|
15641
|
+
isViewMenuOpen && /* @__PURE__ */ jsxs14("div", { style: { marginTop: 4, minWidth: 120 }, children: [
|
|
15642
|
+
/* @__PURE__ */ jsx20(
|
|
16078
15643
|
CheckboxMenuItem,
|
|
16079
15644
|
{
|
|
16080
15645
|
label: "Show All Trace Lengths",
|
|
@@ -16086,7 +15651,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16086
15651
|
}
|
|
16087
15652
|
}
|
|
16088
15653
|
),
|
|
16089
|
-
/* @__PURE__ */
|
|
15654
|
+
/* @__PURE__ */ jsx20(
|
|
16090
15655
|
CheckboxMenuItem,
|
|
16091
15656
|
{
|
|
16092
15657
|
label: "Show Autorouting Animation",
|
|
@@ -16098,7 +15663,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16098
15663
|
}
|
|
16099
15664
|
}
|
|
16100
15665
|
),
|
|
16101
|
-
/* @__PURE__ */
|
|
15666
|
+
/* @__PURE__ */ jsx20(
|
|
16102
15667
|
CheckboxMenuItem,
|
|
16103
15668
|
{
|
|
16104
15669
|
label: "Show DRC Errors",
|
|
@@ -16108,7 +15673,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16108
15673
|
}
|
|
16109
15674
|
}
|
|
16110
15675
|
),
|
|
16111
|
-
/* @__PURE__ */
|
|
15676
|
+
/* @__PURE__ */ jsx20(
|
|
16112
15677
|
CheckboxMenuItem,
|
|
16113
15678
|
{
|
|
16114
15679
|
label: "Show Copper Pours",
|
|
@@ -16120,7 +15685,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16120
15685
|
}
|
|
16121
15686
|
}
|
|
16122
15687
|
),
|
|
16123
|
-
/* @__PURE__ */
|
|
15688
|
+
/* @__PURE__ */ jsx20(
|
|
16124
15689
|
CheckboxMenuItem,
|
|
16125
15690
|
{
|
|
16126
15691
|
label: "Show Courtyards",
|
|
@@ -16130,7 +15695,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16130
15695
|
}
|
|
16131
15696
|
}
|
|
16132
15697
|
),
|
|
16133
|
-
/* @__PURE__ */
|
|
15698
|
+
/* @__PURE__ */ jsx20(
|
|
16134
15699
|
CheckboxMenuItem,
|
|
16135
15700
|
{
|
|
16136
15701
|
label: "Show Solder Mask",
|
|
@@ -16140,7 +15705,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16140
15705
|
}
|
|
16141
15706
|
}
|
|
16142
15707
|
),
|
|
16143
|
-
/* @__PURE__ */
|
|
15708
|
+
/* @__PURE__ */ jsx20(
|
|
16144
15709
|
CheckboxMenuItem,
|
|
16145
15710
|
{
|
|
16146
15711
|
label: "Show Silkscreen",
|
|
@@ -16150,7 +15715,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16150
15715
|
}
|
|
16151
15716
|
}
|
|
16152
15717
|
),
|
|
16153
|
-
/* @__PURE__ */
|
|
15718
|
+
/* @__PURE__ */ jsx20(
|
|
16154
15719
|
CheckboxMenuItem,
|
|
16155
15720
|
{
|
|
16156
15721
|
label: "Show Fabrication Notes",
|
|
@@ -16162,7 +15727,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16162
15727
|
}
|
|
16163
15728
|
}
|
|
16164
15729
|
),
|
|
16165
|
-
/* @__PURE__ */
|
|
15730
|
+
/* @__PURE__ */ jsx20(
|
|
16166
15731
|
CheckboxMenuItem,
|
|
16167
15732
|
{
|
|
16168
15733
|
label: "Show PCB Notes",
|
|
@@ -16172,7 +15737,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16172
15737
|
}
|
|
16173
15738
|
}
|
|
16174
15739
|
),
|
|
16175
|
-
/* @__PURE__ */
|
|
15740
|
+
/* @__PURE__ */ jsx20(
|
|
16176
15741
|
CheckboxMenuItem,
|
|
16177
15742
|
{
|
|
16178
15743
|
label: "Show Group Anchor Offsets",
|
|
@@ -16184,7 +15749,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16184
15749
|
}
|
|
16185
15750
|
}
|
|
16186
15751
|
),
|
|
16187
|
-
/* @__PURE__ */
|
|
15752
|
+
/* @__PURE__ */ jsx20(
|
|
16188
15753
|
CheckboxMenuItem,
|
|
16189
15754
|
{
|
|
16190
15755
|
label: "Show PCB Groups",
|
|
@@ -16194,8 +15759,8 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16194
15759
|
}
|
|
16195
15760
|
}
|
|
16196
15761
|
),
|
|
16197
|
-
viewSettings.is_showing_pcb_groups && /* @__PURE__ */
|
|
16198
|
-
/* @__PURE__ */
|
|
15762
|
+
viewSettings.is_showing_pcb_groups && /* @__PURE__ */ jsxs14("div", { style: { marginLeft: 16 }, children: [
|
|
15763
|
+
/* @__PURE__ */ jsx20(
|
|
16199
15764
|
RadioMenuItem,
|
|
16200
15765
|
{
|
|
16201
15766
|
label: "Show All Groups",
|
|
@@ -16205,7 +15770,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16205
15770
|
}
|
|
16206
15771
|
}
|
|
16207
15772
|
),
|
|
16208
|
-
/* @__PURE__ */
|
|
15773
|
+
/* @__PURE__ */ jsx20(
|
|
16209
15774
|
RadioMenuItem,
|
|
16210
15775
|
{
|
|
16211
15776
|
label: "Show Named Groups",
|
|
@@ -16229,17 +15794,17 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16229
15794
|
};
|
|
16230
15795
|
|
|
16231
15796
|
// src/components/WarningGraphicsOverlay.tsx
|
|
16232
|
-
import { useEffect as
|
|
16233
|
-
import { applyToPoint as
|
|
16234
|
-
import { jsx as
|
|
15797
|
+
import { useEffect as useEffect16, useRef as useRef13 } from "react";
|
|
15798
|
+
import { applyToPoint as applyToPoint15, identity as identity8 } from "transformation-matrix";
|
|
15799
|
+
import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
16235
15800
|
var WarningGraphicsOverlay = ({
|
|
16236
15801
|
children,
|
|
16237
|
-
transform =
|
|
15802
|
+
transform = identity8(),
|
|
16238
15803
|
elements = []
|
|
16239
15804
|
}) => {
|
|
16240
15805
|
const [containerRef, { width, height }] = useMeasure_default();
|
|
16241
|
-
const canvasRef =
|
|
16242
|
-
|
|
15806
|
+
const canvasRef = useRef13(null);
|
|
15807
|
+
useEffect16(() => {
|
|
16243
15808
|
const canvas = canvasRef.current;
|
|
16244
15809
|
if (!canvas || !width || !height) return;
|
|
16245
15810
|
canvas.width = width;
|
|
@@ -16261,7 +15826,7 @@ var WarningGraphicsOverlay = ({
|
|
|
16261
15826
|
);
|
|
16262
15827
|
if (!component) return;
|
|
16263
15828
|
const { width: width2, height: height2, center } = component;
|
|
16264
|
-
const transformedCenter =
|
|
15829
|
+
const transformedCenter = applyToPoint15(transform, center);
|
|
16265
15830
|
const scaledWidth = width2 * Math.abs(transform.a);
|
|
16266
15831
|
const scaledHeight = height2 * Math.abs(transform.d);
|
|
16267
15832
|
const boxPadding = 0.1 * Math.abs(transform.a);
|
|
@@ -16291,14 +15856,14 @@ var WarningGraphicsOverlay = ({
|
|
|
16291
15856
|
ctx.fillText(labelText, labelX + labelWidth / 2, labelY + labelHeight / 2);
|
|
16292
15857
|
});
|
|
16293
15858
|
}, [elements, transform, width, height]);
|
|
16294
|
-
return /* @__PURE__ */
|
|
15859
|
+
return /* @__PURE__ */ jsxs15(
|
|
16295
15860
|
"div",
|
|
16296
15861
|
{
|
|
16297
15862
|
ref: containerRef,
|
|
16298
15863
|
style: { position: "relative", width: "100%", height: "100%" },
|
|
16299
15864
|
children: [
|
|
16300
15865
|
children,
|
|
16301
|
-
/* @__PURE__ */
|
|
15866
|
+
/* @__PURE__ */ jsx21(
|
|
16302
15867
|
"canvas",
|
|
16303
15868
|
{
|
|
16304
15869
|
ref: canvasRef,
|
|
@@ -16317,7 +15882,7 @@ var WarningGraphicsOverlay = ({
|
|
|
16317
15882
|
};
|
|
16318
15883
|
|
|
16319
15884
|
// src/components/CanvasElementsRenderer.tsx
|
|
16320
|
-
import { jsx as
|
|
15885
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
16321
15886
|
var CanvasElementsRenderer = (props) => {
|
|
16322
15887
|
const { transform, elements } = props;
|
|
16323
15888
|
const {
|
|
@@ -16345,13 +15910,13 @@ var CanvasElementsRenderer = (props) => {
|
|
|
16345
15910
|
);
|
|
16346
15911
|
return [primitivesWithoutInteractionMetadata2, connectivityMap2];
|
|
16347
15912
|
}, [elementsToRender, props.elements]);
|
|
16348
|
-
const [hoverState, setHoverState] =
|
|
15913
|
+
const [hoverState, setHoverState] = useState11({
|
|
16349
15914
|
drawingObjectIdsWithMouseOver: /* @__PURE__ */ new Set(),
|
|
16350
15915
|
primitiveIdsInMousedOverNet: []
|
|
16351
15916
|
});
|
|
16352
|
-
const [hoveredComponentIds, setHoveredComponentIds] =
|
|
16353
|
-
const currentTransformRef =
|
|
16354
|
-
const zoomAnimationFrameRef =
|
|
15917
|
+
const [hoveredComponentIds, setHoveredComponentIds] = useState11([]);
|
|
15918
|
+
const currentTransformRef = useRef14(transform ?? null);
|
|
15919
|
+
const zoomAnimationFrameRef = useRef14(null);
|
|
16355
15920
|
const elementIndexes = useMemo8(
|
|
16356
15921
|
() => buildErrorPreviewElementIndexes(elements),
|
|
16357
15922
|
[elements]
|
|
@@ -16367,17 +15932,17 @@ var CanvasElementsRenderer = (props) => {
|
|
|
16367
15932
|
if (!activeError) return [];
|
|
16368
15933
|
return getRelatedIdsForError(activeError);
|
|
16369
15934
|
}, [activeErrorId, elements]);
|
|
16370
|
-
|
|
15935
|
+
useEffect17(() => {
|
|
16371
15936
|
if (transform) {
|
|
16372
15937
|
currentTransformRef.current = transform;
|
|
16373
15938
|
}
|
|
16374
15939
|
}, [transform]);
|
|
16375
|
-
|
|
15940
|
+
useEffect17(() => {
|
|
16376
15941
|
return () => {
|
|
16377
15942
|
cancelTransformAnimation(zoomAnimationFrameRef.current);
|
|
16378
15943
|
};
|
|
16379
15944
|
}, []);
|
|
16380
|
-
|
|
15945
|
+
useEffect17(() => {
|
|
16381
15946
|
if (!props.width || !props.height || !props.setTransform || !focusedErrorId)
|
|
16382
15947
|
return;
|
|
16383
15948
|
const focusedError = findErrorElementById(elements, focusedErrorId);
|
|
@@ -16459,7 +16024,7 @@ var CanvasElementsRenderer = (props) => {
|
|
|
16459
16024
|
},
|
|
16460
16025
|
[connectivityMap]
|
|
16461
16026
|
);
|
|
16462
|
-
return /* @__PURE__ */
|
|
16027
|
+
return /* @__PURE__ */ jsx22(
|
|
16463
16028
|
MouseElementTracker,
|
|
16464
16029
|
{
|
|
16465
16030
|
elements: elementsToRender,
|
|
@@ -16467,7 +16032,7 @@ var CanvasElementsRenderer = (props) => {
|
|
|
16467
16032
|
primitives: primitivesWithoutInteractionMetadata,
|
|
16468
16033
|
selectedLayer,
|
|
16469
16034
|
onMouseHoverOverPrimitives: onMouseOverPrimitives,
|
|
16470
|
-
children: /* @__PURE__ */
|
|
16035
|
+
children: /* @__PURE__ */ jsx22(
|
|
16471
16036
|
EditPlacementOverlay,
|
|
16472
16037
|
{
|
|
16473
16038
|
disabled: !props.allowEditing,
|
|
@@ -16476,58 +16041,47 @@ var CanvasElementsRenderer = (props) => {
|
|
|
16476
16041
|
cancelPanDrag: props.cancelPanDrag,
|
|
16477
16042
|
onCreateEditEvent: props.onCreateEditEvent,
|
|
16478
16043
|
onModifyEditEvent: props.onModifyEditEvent,
|
|
16479
|
-
children: /* @__PURE__ */
|
|
16480
|
-
|
|
16044
|
+
children: /* @__PURE__ */ jsx22(
|
|
16045
|
+
DimensionOverlay,
|
|
16481
16046
|
{
|
|
16482
|
-
disabled: !props.allowEditing,
|
|
16483
16047
|
transform,
|
|
16484
|
-
|
|
16048
|
+
focusOnHover: props.focusOnHover,
|
|
16049
|
+
primitives: primitivesWithoutInteractionMetadata,
|
|
16050
|
+
onBoundsSelected: props.onBoundsSelected,
|
|
16485
16051
|
cancelPanDrag: props.cancelPanDrag,
|
|
16486
|
-
|
|
16487
|
-
|
|
16488
|
-
children: /* @__PURE__ */ jsx24(
|
|
16489
|
-
DimensionOverlay,
|
|
16052
|
+
children: /* @__PURE__ */ jsx22(ToolbarOverlay, { elements, children: /* @__PURE__ */ jsx22(ErrorOverlay, { transform, elements, children: /* @__PURE__ */ jsx22(RatsNestOverlay, { transform, soup: elements, children: /* @__PURE__ */ jsx22(
|
|
16053
|
+
PcbGroupOverlay,
|
|
16490
16054
|
{
|
|
16491
16055
|
transform,
|
|
16492
|
-
|
|
16493
|
-
|
|
16494
|
-
|
|
16495
|
-
|
|
16496
|
-
children: /* @__PURE__ */ jsx24(ToolbarOverlay, { elements, children: /* @__PURE__ */ jsx24(ErrorOverlay, { transform, elements, children: /* @__PURE__ */ jsx24(RatsNestOverlay, { transform, soup: elements, children: /* @__PURE__ */ jsx24(
|
|
16497
|
-
PcbGroupOverlay,
|
|
16056
|
+
elements,
|
|
16057
|
+
hoveredComponentIds,
|
|
16058
|
+
children: /* @__PURE__ */ jsx22(
|
|
16059
|
+
DebugGraphicsOverlay,
|
|
16498
16060
|
{
|
|
16499
16061
|
transform,
|
|
16500
|
-
|
|
16501
|
-
|
|
16502
|
-
|
|
16503
|
-
DebugGraphicsOverlay,
|
|
16062
|
+
debugGraphics: props.debugGraphics,
|
|
16063
|
+
children: /* @__PURE__ */ jsx22(
|
|
16064
|
+
WarningGraphicsOverlay,
|
|
16504
16065
|
{
|
|
16505
16066
|
transform,
|
|
16506
|
-
|
|
16507
|
-
children: /* @__PURE__ */
|
|
16508
|
-
|
|
16067
|
+
elements,
|
|
16068
|
+
children: /* @__PURE__ */ jsx22(
|
|
16069
|
+
CanvasPrimitiveRenderer,
|
|
16509
16070
|
{
|
|
16510
16071
|
transform,
|
|
16511
|
-
|
|
16512
|
-
|
|
16513
|
-
|
|
16514
|
-
|
|
16515
|
-
|
|
16516
|
-
primitives,
|
|
16517
|
-
elements: elementsToRender,
|
|
16518
|
-
width: props.width,
|
|
16519
|
-
height: props.height,
|
|
16520
|
-
grid: props.grid
|
|
16521
|
-
}
|
|
16522
|
-
)
|
|
16072
|
+
primitives,
|
|
16073
|
+
elements: elementsToRender,
|
|
16074
|
+
width: props.width,
|
|
16075
|
+
height: props.height,
|
|
16076
|
+
grid: props.grid
|
|
16523
16077
|
}
|
|
16524
16078
|
)
|
|
16525
16079
|
}
|
|
16526
16080
|
)
|
|
16527
16081
|
}
|
|
16528
|
-
)
|
|
16082
|
+
)
|
|
16529
16083
|
}
|
|
16530
|
-
)
|
|
16084
|
+
) }) }) })
|
|
16531
16085
|
}
|
|
16532
16086
|
)
|
|
16533
16087
|
}
|
|
@@ -16591,7 +16145,7 @@ var calculateBoardSizeKey = (circuitJson) => {
|
|
|
16591
16145
|
};
|
|
16592
16146
|
|
|
16593
16147
|
// src/PCBViewer.tsx
|
|
16594
|
-
import { jsx as
|
|
16148
|
+
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
16595
16149
|
var defaultTransform = compose8(translate12(400, 300), scale6(40, -40));
|
|
16596
16150
|
var PCBViewer = ({
|
|
16597
16151
|
circuitJson,
|
|
@@ -16606,11 +16160,11 @@ var PCBViewer = ({
|
|
|
16606
16160
|
clickToInteractEnabled = false,
|
|
16607
16161
|
disablePcbGroups = false
|
|
16608
16162
|
}) => {
|
|
16609
|
-
const [isInteractionEnabled, setIsInteractionEnabled] =
|
|
16163
|
+
const [isInteractionEnabled, setIsInteractionEnabled] = useState12(
|
|
16610
16164
|
!clickToInteractEnabled
|
|
16611
16165
|
);
|
|
16612
16166
|
const [ref, refDimensions] = useMeasure_default();
|
|
16613
|
-
const [transform, setTransformInternal] =
|
|
16167
|
+
const [transform, setTransformInternal] = useState12(defaultTransform);
|
|
16614
16168
|
const shouldAllowCanvasInteraction = useCallback12(
|
|
16615
16169
|
(event) => {
|
|
16616
16170
|
const target = event.target;
|
|
@@ -16629,10 +16183,10 @@ var PCBViewer = ({
|
|
|
16629
16183
|
enabled: isInteractionEnabled,
|
|
16630
16184
|
shouldDrag: shouldAllowCanvasInteraction
|
|
16631
16185
|
});
|
|
16632
|
-
let [editEvents, setEditEvents] =
|
|
16186
|
+
let [editEvents, setEditEvents] = useState12([]);
|
|
16633
16187
|
editEvents = editEventsProp ?? editEvents;
|
|
16634
|
-
const initialRenderCompleted =
|
|
16635
|
-
const touchStartRef =
|
|
16188
|
+
const initialRenderCompleted = useRef15(false);
|
|
16189
|
+
const touchStartRef = useRef15(null);
|
|
16636
16190
|
const circuitJsonKey = useMemo9(
|
|
16637
16191
|
() => calculateCircuitJsonKey(circuitJson),
|
|
16638
16192
|
[circuitJson]
|
|
@@ -16658,7 +16212,7 @@ var PCBViewer = ({
|
|
|
16658
16212
|
setTransform(targetTransform);
|
|
16659
16213
|
return;
|
|
16660
16214
|
};
|
|
16661
|
-
|
|
16215
|
+
useEffect18(() => {
|
|
16662
16216
|
if (!refDimensions?.width) return;
|
|
16663
16217
|
if (!circuitJson) return;
|
|
16664
16218
|
if (circuitJson.length === 0) return;
|
|
@@ -16667,7 +16221,7 @@ var PCBViewer = ({
|
|
|
16667
16221
|
initialRenderCompleted.current = true;
|
|
16668
16222
|
}
|
|
16669
16223
|
}, [circuitJson, refDimensions]);
|
|
16670
|
-
|
|
16224
|
+
useEffect18(() => {
|
|
16671
16225
|
if (initialRenderCompleted.current === true) {
|
|
16672
16226
|
resetTransform();
|
|
16673
16227
|
}
|
|
@@ -16701,20 +16255,20 @@ var PCBViewer = ({
|
|
|
16701
16255
|
}),
|
|
16702
16256
|
[initialState, disablePcbGroups]
|
|
16703
16257
|
);
|
|
16704
|
-
return /* @__PURE__ */
|
|
16258
|
+
return /* @__PURE__ */ jsxs16(
|
|
16705
16259
|
"div",
|
|
16706
16260
|
{
|
|
16707
16261
|
ref: transformRef,
|
|
16708
16262
|
style: { position: "relative" },
|
|
16709
16263
|
onContextMenu: (event) => event.preventDefault(),
|
|
16710
16264
|
children: [
|
|
16711
|
-
/* @__PURE__ */
|
|
16265
|
+
/* @__PURE__ */ jsx23("div", { ref, children: /* @__PURE__ */ jsxs16(
|
|
16712
16266
|
ContextProviders,
|
|
16713
16267
|
{
|
|
16714
16268
|
initialState: mergedInitialState,
|
|
16715
16269
|
disablePcbGroups,
|
|
16716
16270
|
children: [
|
|
16717
|
-
/* @__PURE__ */
|
|
16271
|
+
/* @__PURE__ */ jsx23(
|
|
16718
16272
|
CanvasElementsRenderer,
|
|
16719
16273
|
{
|
|
16720
16274
|
transform,
|
|
@@ -16741,11 +16295,11 @@ var PCBViewer = ({
|
|
|
16741
16295
|
},
|
|
16742
16296
|
refDimensions.width
|
|
16743
16297
|
),
|
|
16744
|
-
/* @__PURE__ */
|
|
16298
|
+
/* @__PURE__ */ jsx23(ToastContainer, {})
|
|
16745
16299
|
]
|
|
16746
16300
|
}
|
|
16747
16301
|
) }),
|
|
16748
|
-
clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */
|
|
16302
|
+
clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */ jsx23(
|
|
16749
16303
|
"div",
|
|
16750
16304
|
{
|
|
16751
16305
|
onClick: () => {
|
|
@@ -16782,7 +16336,7 @@ var PCBViewer = ({
|
|
|
16782
16336
|
justifyContent: "center",
|
|
16783
16337
|
touchAction: "pan-x pan-y pinch-zoom"
|
|
16784
16338
|
},
|
|
16785
|
-
children: /* @__PURE__ */
|
|
16339
|
+
children: /* @__PURE__ */ jsx23(
|
|
16786
16340
|
"div",
|
|
16787
16341
|
{
|
|
16788
16342
|
style: {
|