@tscircuit/pcb-viewer 1.11.387 → 1.11.388
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 +290 -729
- 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,
|
|
@@ -12386,419 +12367,10 @@ var EditPlacementOverlay = ({
|
|
|
12386
12367
|
);
|
|
12387
12368
|
};
|
|
12388
12369
|
|
|
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
12370
|
// src/components/ErrorOverlay.tsx
|
|
12799
|
-
import { useRef as
|
|
12800
|
-
import { css
|
|
12801
|
-
import { applyToPoint as
|
|
12371
|
+
import { useRef as useRef7, Fragment as Fragment2 } from "react";
|
|
12372
|
+
import { css } from "@emotion/css";
|
|
12373
|
+
import { applyToPoint as applyToPoint9, identity as identity5 } from "transformation-matrix";
|
|
12802
12374
|
|
|
12803
12375
|
// src/lib/util/getPopupPosition.ts
|
|
12804
12376
|
var getPopupPosition = (errorCenter, containerRef) => {
|
|
@@ -12835,10 +12407,10 @@ var getPopupPosition = (errorCenter, containerRef) => {
|
|
|
12835
12407
|
};
|
|
12836
12408
|
|
|
12837
12409
|
// src/components/FocusMarkerSVG.tsx
|
|
12838
|
-
import { jsx as
|
|
12410
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
12839
12411
|
var FocusMarkerSVG = ({
|
|
12840
12412
|
center
|
|
12841
|
-
}) => /* @__PURE__ */
|
|
12413
|
+
}) => /* @__PURE__ */ jsxs5(
|
|
12842
12414
|
"svg",
|
|
12843
12415
|
{
|
|
12844
12416
|
style: {
|
|
@@ -12852,7 +12424,7 @@ var FocusMarkerSVG = ({
|
|
|
12852
12424
|
width: "100%",
|
|
12853
12425
|
height: "100%",
|
|
12854
12426
|
children: [
|
|
12855
|
-
/* @__PURE__ */
|
|
12427
|
+
/* @__PURE__ */ jsx7(
|
|
12856
12428
|
"circle",
|
|
12857
12429
|
{
|
|
12858
12430
|
cx: center.x,
|
|
@@ -12864,8 +12436,8 @@ var FocusMarkerSVG = ({
|
|
|
12864
12436
|
opacity: 0.95
|
|
12865
12437
|
}
|
|
12866
12438
|
),
|
|
12867
|
-
/* @__PURE__ */
|
|
12868
|
-
/* @__PURE__ */
|
|
12439
|
+
/* @__PURE__ */ jsx7("circle", { cx: center.x, cy: center.y, r: 4.5, fill: "#ff6b6b", opacity: 0.95 }),
|
|
12440
|
+
/* @__PURE__ */ jsx7(
|
|
12869
12441
|
"line",
|
|
12870
12442
|
{
|
|
12871
12443
|
x1: center.x - 18,
|
|
@@ -12876,7 +12448,7 @@ var FocusMarkerSVG = ({
|
|
|
12876
12448
|
strokeWidth: 2
|
|
12877
12449
|
}
|
|
12878
12450
|
),
|
|
12879
|
-
/* @__PURE__ */
|
|
12451
|
+
/* @__PURE__ */ jsx7(
|
|
12880
12452
|
"line",
|
|
12881
12453
|
{
|
|
12882
12454
|
x1: center.x + 8,
|
|
@@ -12887,7 +12459,7 @@ var FocusMarkerSVG = ({
|
|
|
12887
12459
|
strokeWidth: 2
|
|
12888
12460
|
}
|
|
12889
12461
|
),
|
|
12890
|
-
/* @__PURE__ */
|
|
12462
|
+
/* @__PURE__ */ jsx7(
|
|
12891
12463
|
"line",
|
|
12892
12464
|
{
|
|
12893
12465
|
x1: center.x,
|
|
@@ -12898,7 +12470,7 @@ var FocusMarkerSVG = ({
|
|
|
12898
12470
|
strokeWidth: 2
|
|
12899
12471
|
}
|
|
12900
12472
|
),
|
|
12901
|
-
/* @__PURE__ */
|
|
12473
|
+
/* @__PURE__ */ jsx7(
|
|
12902
12474
|
"line",
|
|
12903
12475
|
{
|
|
12904
12476
|
x1: center.x,
|
|
@@ -12914,11 +12486,11 @@ var FocusMarkerSVG = ({
|
|
|
12914
12486
|
);
|
|
12915
12487
|
|
|
12916
12488
|
// src/components/ErrorOverlay.tsx
|
|
12917
|
-
import { jsx as
|
|
12489
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
12918
12490
|
var ErrorMarkerSVG = ({
|
|
12919
12491
|
errorCenter,
|
|
12920
12492
|
isHighlighted = false
|
|
12921
|
-
}) => /* @__PURE__ */
|
|
12493
|
+
}) => /* @__PURE__ */ jsx8(
|
|
12922
12494
|
"svg",
|
|
12923
12495
|
{
|
|
12924
12496
|
style: {
|
|
@@ -12931,7 +12503,7 @@ var ErrorMarkerSVG = ({
|
|
|
12931
12503
|
},
|
|
12932
12504
|
width: "100%",
|
|
12933
12505
|
height: "100%",
|
|
12934
|
-
children: /* @__PURE__ */
|
|
12506
|
+
children: /* @__PURE__ */ jsx8(
|
|
12935
12507
|
"rect",
|
|
12936
12508
|
{
|
|
12937
12509
|
x: errorCenter.x - 7,
|
|
@@ -12946,7 +12518,7 @@ var ErrorMarkerSVG = ({
|
|
|
12946
12518
|
)
|
|
12947
12519
|
}
|
|
12948
12520
|
);
|
|
12949
|
-
var errorMessageStyles =
|
|
12521
|
+
var errorMessageStyles = css`
|
|
12950
12522
|
opacity: 0;
|
|
12951
12523
|
pointer-events: none;
|
|
12952
12524
|
background-color: rgba(0, 0, 0, 0.8);
|
|
@@ -12962,10 +12534,10 @@ var errorMessageStyles = css2`
|
|
|
12962
12534
|
`;
|
|
12963
12535
|
var ErrorOverlay = ({
|
|
12964
12536
|
children,
|
|
12965
|
-
transform =
|
|
12537
|
+
transform = identity5(),
|
|
12966
12538
|
elements
|
|
12967
12539
|
}) => {
|
|
12968
|
-
const containerRef =
|
|
12540
|
+
const containerRef = useRef7(null);
|
|
12969
12541
|
const { isShowingDRCErrors, hoveredErrorId, focusedErrorId } = useGlobalStore(
|
|
12970
12542
|
(state) => ({
|
|
12971
12543
|
isShowingDRCErrors: state.is_showing_drc_errors,
|
|
@@ -12975,7 +12547,7 @@ var ErrorOverlay = ({
|
|
|
12975
12547
|
);
|
|
12976
12548
|
const activeErrorId = focusedErrorId ?? hoveredErrorId;
|
|
12977
12549
|
if (!elements) {
|
|
12978
|
-
return /* @__PURE__ */
|
|
12550
|
+
return /* @__PURE__ */ jsx8("div", { style: { position: "relative" }, ref: containerRef, children });
|
|
12979
12551
|
}
|
|
12980
12552
|
const traceErrors = elements.filter(
|
|
12981
12553
|
(el) => el.type === "pcb_trace_error" && !el.message?.includes("Multiple components found with name")
|
|
@@ -12996,7 +12568,7 @@ var ErrorOverlay = ({
|
|
|
12996
12568
|
if (!focusCenter || typeof focusCenter.x !== "number" || typeof focusCenter.y !== "number") {
|
|
12997
12569
|
return null;
|
|
12998
12570
|
}
|
|
12999
|
-
const screenCenter =
|
|
12571
|
+
const screenCenter = applyToPoint9(transform, focusCenter);
|
|
13000
12572
|
if (Number.isNaN(screenCenter.x) || Number.isNaN(screenCenter.y)) {
|
|
13001
12573
|
return null;
|
|
13002
12574
|
}
|
|
@@ -13008,7 +12580,7 @@ var ErrorOverlay = ({
|
|
|
13008
12580
|
focusedErrorElement
|
|
13009
12581
|
);
|
|
13010
12582
|
}
|
|
13011
|
-
return /* @__PURE__ */
|
|
12583
|
+
return /* @__PURE__ */ jsxs6("div", { style: { position: "relative" }, ref: containerRef, children: [
|
|
13012
12584
|
children,
|
|
13013
12585
|
traceErrors.map((el, index) => {
|
|
13014
12586
|
const errorId = getErrorId(el, index);
|
|
@@ -13017,15 +12589,15 @@ var ErrorOverlay = ({
|
|
|
13017
12589
|
const errorCenter = getScreenErrorCenter(el);
|
|
13018
12590
|
if (!errorCenter) return null;
|
|
13019
12591
|
const popupPosition = getPopupPosition(errorCenter, containerRef);
|
|
13020
|
-
return /* @__PURE__ */
|
|
13021
|
-
/* @__PURE__ */
|
|
12592
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
12593
|
+
/* @__PURE__ */ jsx8(
|
|
13022
12594
|
ErrorMarkerSVG,
|
|
13023
12595
|
{
|
|
13024
12596
|
errorCenter,
|
|
13025
12597
|
isHighlighted
|
|
13026
12598
|
}
|
|
13027
12599
|
),
|
|
13028
|
-
/* @__PURE__ */
|
|
12600
|
+
/* @__PURE__ */ jsx8(
|
|
13029
12601
|
"div",
|
|
13030
12602
|
{
|
|
13031
12603
|
style: {
|
|
@@ -13060,7 +12632,7 @@ var ErrorOverlay = ({
|
|
|
13060
12632
|
}
|
|
13061
12633
|
}
|
|
13062
12634
|
),
|
|
13063
|
-
/* @__PURE__ */
|
|
12635
|
+
/* @__PURE__ */ jsx8(
|
|
13064
12636
|
"div",
|
|
13065
12637
|
{
|
|
13066
12638
|
style: {
|
|
@@ -13078,7 +12650,7 @@ var ErrorOverlay = ({
|
|
|
13078
12650
|
pointerEvents: "none",
|
|
13079
12651
|
transform: popupPosition.transform
|
|
13080
12652
|
},
|
|
13081
|
-
children: /* @__PURE__ */
|
|
12653
|
+
children: /* @__PURE__ */ jsx8(
|
|
13082
12654
|
"div",
|
|
13083
12655
|
{
|
|
13084
12656
|
className: `error-message ${errorMessageStyles}`,
|
|
@@ -13103,15 +12675,15 @@ var ErrorOverlay = ({
|
|
|
13103
12675
|
{ x: errorCenter.x, y: errorCenter.y },
|
|
13104
12676
|
containerRef
|
|
13105
12677
|
);
|
|
13106
|
-
return /* @__PURE__ */
|
|
13107
|
-
/* @__PURE__ */
|
|
12678
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
12679
|
+
/* @__PURE__ */ jsx8(
|
|
13108
12680
|
ErrorMarkerSVG,
|
|
13109
12681
|
{
|
|
13110
12682
|
errorCenter,
|
|
13111
12683
|
isHighlighted
|
|
13112
12684
|
}
|
|
13113
12685
|
),
|
|
13114
|
-
/* @__PURE__ */
|
|
12686
|
+
/* @__PURE__ */ jsx8(
|
|
13115
12687
|
"div",
|
|
13116
12688
|
{
|
|
13117
12689
|
style: {
|
|
@@ -13146,7 +12718,7 @@ var ErrorOverlay = ({
|
|
|
13146
12718
|
}
|
|
13147
12719
|
}
|
|
13148
12720
|
),
|
|
13149
|
-
/* @__PURE__ */
|
|
12721
|
+
/* @__PURE__ */ jsx8(
|
|
13150
12722
|
"div",
|
|
13151
12723
|
{
|
|
13152
12724
|
style: {
|
|
@@ -13164,7 +12736,7 @@ var ErrorOverlay = ({
|
|
|
13164
12736
|
pointerEvents: "none",
|
|
13165
12737
|
transform: popupPosition.transform
|
|
13166
12738
|
},
|
|
13167
|
-
children: /* @__PURE__ */
|
|
12739
|
+
children: /* @__PURE__ */ jsx8(
|
|
13168
12740
|
"div",
|
|
13169
12741
|
{
|
|
13170
12742
|
className: `error-message ${errorMessageStyles}`,
|
|
@@ -13201,7 +12773,7 @@ var ErrorOverlay = ({
|
|
|
13201
12773
|
if (pcbComp && pcbComp.type === "pcb_component")
|
|
13202
12774
|
center = pcbComp.center || { x: 0, y: 0 };
|
|
13203
12775
|
}
|
|
13204
|
-
const screenCenter =
|
|
12776
|
+
const screenCenter = applyToPoint9(transform, center);
|
|
13205
12777
|
if (Number.isNaN(screenCenter.x) || Number.isNaN(screenCenter.y))
|
|
13206
12778
|
return null;
|
|
13207
12779
|
const scale7 = Math.abs(transform.a);
|
|
@@ -13213,8 +12785,8 @@ var ErrorOverlay = ({
|
|
|
13213
12785
|
Math.min(maxRadius, baseRadius * scale7)
|
|
13214
12786
|
);
|
|
13215
12787
|
const popupPosition = getPopupPosition(screenCenter, containerRef);
|
|
13216
|
-
return /* @__PURE__ */
|
|
13217
|
-
/* @__PURE__ */
|
|
12788
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
12789
|
+
/* @__PURE__ */ jsx8(
|
|
13218
12790
|
"svg",
|
|
13219
12791
|
{
|
|
13220
12792
|
style: {
|
|
@@ -13227,13 +12799,13 @@ var ErrorOverlay = ({
|
|
|
13227
12799
|
},
|
|
13228
12800
|
width: "100%",
|
|
13229
12801
|
height: "100%",
|
|
13230
|
-
children: isHighlighted ? /* @__PURE__ */
|
|
12802
|
+
children: isHighlighted ? /* @__PURE__ */ jsx8(
|
|
13231
12803
|
"polygon",
|
|
13232
12804
|
{
|
|
13233
12805
|
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
12806
|
fill: "#ff4444"
|
|
13235
12807
|
}
|
|
13236
|
-
) : /* @__PURE__ */
|
|
12808
|
+
) : /* @__PURE__ */ jsx8(
|
|
13237
12809
|
"circle",
|
|
13238
12810
|
{
|
|
13239
12811
|
cx: screenCenter.x,
|
|
@@ -13247,7 +12819,7 @@ var ErrorOverlay = ({
|
|
|
13247
12819
|
)
|
|
13248
12820
|
}
|
|
13249
12821
|
),
|
|
13250
|
-
/* @__PURE__ */
|
|
12822
|
+
/* @__PURE__ */ jsx8(
|
|
13251
12823
|
"div",
|
|
13252
12824
|
{
|
|
13253
12825
|
style: {
|
|
@@ -13282,7 +12854,7 @@ var ErrorOverlay = ({
|
|
|
13282
12854
|
}
|
|
13283
12855
|
}
|
|
13284
12856
|
),
|
|
13285
|
-
/* @__PURE__ */
|
|
12857
|
+
/* @__PURE__ */ jsx8(
|
|
13286
12858
|
"div",
|
|
13287
12859
|
{
|
|
13288
12860
|
style: {
|
|
@@ -13300,7 +12872,7 @@ var ErrorOverlay = ({
|
|
|
13300
12872
|
pointerEvents: "none",
|
|
13301
12873
|
transform: popupPosition.transform
|
|
13302
12874
|
},
|
|
13303
|
-
children: /* @__PURE__ */
|
|
12875
|
+
children: /* @__PURE__ */ jsx8(
|
|
13304
12876
|
"div",
|
|
13305
12877
|
{
|
|
13306
12878
|
className: `error-message ${errorMessageStyles}`,
|
|
@@ -13316,7 +12888,7 @@ var ErrorOverlay = ({
|
|
|
13316
12888
|
] }, `${errorId}_${compIndex}`);
|
|
13317
12889
|
});
|
|
13318
12890
|
}),
|
|
13319
|
-
focusScreenCenter && /* @__PURE__ */
|
|
12891
|
+
focusScreenCenter && /* @__PURE__ */ jsx8(FocusMarkerSVG, { center: focusScreenCenter })
|
|
13320
12892
|
] });
|
|
13321
12893
|
};
|
|
13322
12894
|
|
|
@@ -13331,8 +12903,8 @@ function ifSetsMatchExactly(set1, set2) {
|
|
|
13331
12903
|
}
|
|
13332
12904
|
|
|
13333
12905
|
// src/components/MouseElementTracker.tsx
|
|
13334
|
-
import { useEffect as
|
|
13335
|
-
import { applyToPoint as
|
|
12906
|
+
import { useEffect as useEffect10, useMemo as useMemo5, useState as useState7 } from "react";
|
|
12907
|
+
import { applyToPoint as applyToPoint12, inverse as inverse4 } from "transformation-matrix";
|
|
13336
12908
|
|
|
13337
12909
|
// src/components/AnchorOffsetOverlay/common/guards.ts
|
|
13338
12910
|
var isPcbComponent = (element) => element?.type === "pcb_component";
|
|
@@ -13341,7 +12913,7 @@ var isPcbPanel = (element) => element?.type === "pcb_panel";
|
|
|
13341
12913
|
var isPcbBoard = (element) => element?.type === "pcb_board";
|
|
13342
12914
|
|
|
13343
12915
|
// src/components/AnchorOffsetOverlay/AnchorOffsetOverlay.tsx
|
|
13344
|
-
import { applyToPoint as
|
|
12916
|
+
import { applyToPoint as applyToPoint10 } from "transformation-matrix";
|
|
13345
12917
|
|
|
13346
12918
|
// src/components/AnchorOffsetOverlay/common/constants.ts
|
|
13347
12919
|
var VISUAL_CONFIG = {
|
|
@@ -13367,7 +12939,7 @@ var COLORS = {
|
|
|
13367
12939
|
};
|
|
13368
12940
|
|
|
13369
12941
|
// src/components/AnchorOffsetOverlay/AnchorOffsetOverlay.tsx
|
|
13370
|
-
import { Fragment as
|
|
12942
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
13371
12943
|
var AnchorOffsetOverlay = ({
|
|
13372
12944
|
targets,
|
|
13373
12945
|
transform,
|
|
@@ -13386,11 +12958,11 @@ var AnchorOffsetOverlay = ({
|
|
|
13386
12958
|
const anchorScreens = /* @__PURE__ */ new Map();
|
|
13387
12959
|
targets.forEach((target) => {
|
|
13388
12960
|
if (!anchorScreens.has(target.anchor_id)) {
|
|
13389
|
-
const screenPoint =
|
|
12961
|
+
const screenPoint = applyToPoint10(transform, target.anchor);
|
|
13390
12962
|
anchorScreens.set(target.anchor_id, screenPoint);
|
|
13391
12963
|
}
|
|
13392
12964
|
});
|
|
13393
|
-
return /* @__PURE__ */
|
|
12965
|
+
return /* @__PURE__ */ jsx9(
|
|
13394
12966
|
"div",
|
|
13395
12967
|
{
|
|
13396
12968
|
style: {
|
|
@@ -13403,7 +12975,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13403
12975
|
pointerEvents: "none",
|
|
13404
12976
|
zIndex: zIndexMap.dimensionOverlay
|
|
13405
12977
|
},
|
|
13406
|
-
children: /* @__PURE__ */
|
|
12978
|
+
children: /* @__PURE__ */ jsxs7(
|
|
13407
12979
|
"svg",
|
|
13408
12980
|
{
|
|
13409
12981
|
style: {
|
|
@@ -13420,7 +12992,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13420
12992
|
const anchorKey = target.anchor_id;
|
|
13421
12993
|
const targetCenter = target.target;
|
|
13422
12994
|
const anchorMarkerScreen = anchorScreens.get(anchorKey);
|
|
13423
|
-
const targetScreen =
|
|
12995
|
+
const targetScreen = applyToPoint10(transform, targetCenter);
|
|
13424
12996
|
const offsetX = targetCenter.x - anchorPosition.x;
|
|
13425
12997
|
const offsetY = targetCenter.y - anchorPosition.y;
|
|
13426
12998
|
const xLineLength = Math.abs(targetScreen.x - anchorMarkerScreen.x);
|
|
@@ -13433,8 +13005,8 @@ var AnchorOffsetOverlay = ({
|
|
|
13433
13005
|
const shouldShowYLabel = yLineLength > VISUAL_CONFIG.MIN_LINE_LENGTH_FOR_LABEL;
|
|
13434
13006
|
const xLabelText = `${target.display_offset_x ?? offsetX.toFixed(2)}mm`;
|
|
13435
13007
|
const yLabelText = `${target.display_offset_y ?? offsetY.toFixed(2)}mm`;
|
|
13436
|
-
return /* @__PURE__ */
|
|
13437
|
-
/* @__PURE__ */
|
|
13008
|
+
return /* @__PURE__ */ jsxs7("g", { children: [
|
|
13009
|
+
/* @__PURE__ */ jsx9(
|
|
13438
13010
|
"line",
|
|
13439
13011
|
{
|
|
13440
13012
|
x1: anchorMarkerScreen.x,
|
|
@@ -13446,7 +13018,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13446
13018
|
strokeDasharray: VISUAL_CONFIG.LINE_DASH_PATTERN
|
|
13447
13019
|
}
|
|
13448
13020
|
),
|
|
13449
|
-
/* @__PURE__ */
|
|
13021
|
+
/* @__PURE__ */ jsx9(
|
|
13450
13022
|
"line",
|
|
13451
13023
|
{
|
|
13452
13024
|
x1: targetScreen.x,
|
|
@@ -13458,7 +13030,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13458
13030
|
strokeDasharray: VISUAL_CONFIG.LINE_DASH_PATTERN
|
|
13459
13031
|
}
|
|
13460
13032
|
),
|
|
13461
|
-
target.type === "component" || target.type === "board" ? /* @__PURE__ */
|
|
13033
|
+
target.type === "component" || target.type === "board" ? /* @__PURE__ */ jsx9(
|
|
13462
13034
|
"circle",
|
|
13463
13035
|
{
|
|
13464
13036
|
cx: targetScreen.x,
|
|
@@ -13470,8 +13042,8 @@ var AnchorOffsetOverlay = ({
|
|
|
13470
13042
|
}
|
|
13471
13043
|
) : (
|
|
13472
13044
|
// assumes "group"
|
|
13473
|
-
/* @__PURE__ */
|
|
13474
|
-
/* @__PURE__ */
|
|
13045
|
+
/* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
13046
|
+
/* @__PURE__ */ jsx9(
|
|
13475
13047
|
"line",
|
|
13476
13048
|
{
|
|
13477
13049
|
x1: targetScreen.x - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
|
|
@@ -13482,7 +13054,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13482
13054
|
strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
|
|
13483
13055
|
}
|
|
13484
13056
|
),
|
|
13485
|
-
/* @__PURE__ */
|
|
13057
|
+
/* @__PURE__ */ jsx9(
|
|
13486
13058
|
"line",
|
|
13487
13059
|
{
|
|
13488
13060
|
x1: targetScreen.x,
|
|
@@ -13495,7 +13067,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13495
13067
|
)
|
|
13496
13068
|
] })
|
|
13497
13069
|
),
|
|
13498
|
-
shouldShowXLabel && /* @__PURE__ */
|
|
13070
|
+
shouldShowXLabel && /* @__PURE__ */ jsx9(
|
|
13499
13071
|
"foreignObject",
|
|
13500
13072
|
{
|
|
13501
13073
|
x: Math.min(anchorMarkerScreen.x, targetScreen.x),
|
|
@@ -13503,10 +13075,10 @@ var AnchorOffsetOverlay = ({
|
|
|
13503
13075
|
width: Math.abs(targetScreen.x - anchorMarkerScreen.x),
|
|
13504
13076
|
height: 20,
|
|
13505
13077
|
style: { overflow: "visible" },
|
|
13506
|
-
children: /* @__PURE__ */
|
|
13078
|
+
children: /* @__PURE__ */ jsx9("div", { style: { ...labelStyle, textAlign: "center" }, children: xLabelText })
|
|
13507
13079
|
}
|
|
13508
13080
|
),
|
|
13509
|
-
shouldShowYLabel && /* @__PURE__ */
|
|
13081
|
+
shouldShowYLabel && /* @__PURE__ */ jsx9(
|
|
13510
13082
|
"foreignObject",
|
|
13511
13083
|
{
|
|
13512
13084
|
x: targetScreen.x + yLabelOffset,
|
|
@@ -13514,7 +13086,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13514
13086
|
width: VISUAL_CONFIG.Y_LABEL_MIN_WIDTH,
|
|
13515
13087
|
height: Math.abs(targetScreen.y - anchorMarkerScreen.y),
|
|
13516
13088
|
style: { overflow: "visible" },
|
|
13517
|
-
children: /* @__PURE__ */
|
|
13089
|
+
children: /* @__PURE__ */ jsx9(
|
|
13518
13090
|
"div",
|
|
13519
13091
|
{
|
|
13520
13092
|
style: {
|
|
@@ -13533,8 +13105,8 @@ var AnchorOffsetOverlay = ({
|
|
|
13533
13105
|
)
|
|
13534
13106
|
] }, target.id);
|
|
13535
13107
|
}),
|
|
13536
|
-
Array.from(anchorScreens.entries()).map(([anchorId, anchorScreen]) => /* @__PURE__ */
|
|
13537
|
-
/* @__PURE__ */
|
|
13108
|
+
Array.from(anchorScreens.entries()).map(([anchorId, anchorScreen]) => /* @__PURE__ */ jsxs7("g", { children: [
|
|
13109
|
+
/* @__PURE__ */ jsx9(
|
|
13538
13110
|
"line",
|
|
13539
13111
|
{
|
|
13540
13112
|
x1: anchorScreen.x - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
|
|
@@ -13545,7 +13117,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13545
13117
|
strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
|
|
13546
13118
|
}
|
|
13547
13119
|
),
|
|
13548
|
-
/* @__PURE__ */
|
|
13120
|
+
/* @__PURE__ */ jsx9(
|
|
13549
13121
|
"line",
|
|
13550
13122
|
{
|
|
13551
13123
|
x1: anchorScreen.x,
|
|
@@ -13565,7 +13137,7 @@ var AnchorOffsetOverlay = ({
|
|
|
13565
13137
|
};
|
|
13566
13138
|
|
|
13567
13139
|
// src/components/AnchorOffsetOverlay/BoardAnchorOffsetOverlay.tsx
|
|
13568
|
-
import { jsx as
|
|
13140
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
13569
13141
|
var BoardAnchorOffsetOverlay = ({
|
|
13570
13142
|
elements,
|
|
13571
13143
|
highlightedPrimitives,
|
|
@@ -13652,7 +13224,7 @@ var BoardAnchorOffsetOverlay = ({
|
|
|
13652
13224
|
display_offset_y: target.group.display_offset_y
|
|
13653
13225
|
};
|
|
13654
13226
|
}).filter((t) => Boolean(t));
|
|
13655
|
-
return /* @__PURE__ */
|
|
13227
|
+
return /* @__PURE__ */ jsx10(
|
|
13656
13228
|
AnchorOffsetOverlay,
|
|
13657
13229
|
{
|
|
13658
13230
|
targets: sharedTargets,
|
|
@@ -13664,7 +13236,7 @@ var BoardAnchorOffsetOverlay = ({
|
|
|
13664
13236
|
};
|
|
13665
13237
|
|
|
13666
13238
|
// src/components/AnchorOffsetOverlay/GroupAnchorOffsetOverlay.tsx
|
|
13667
|
-
import { jsx as
|
|
13239
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
13668
13240
|
var GroupAnchorOffsetOverlay = ({
|
|
13669
13241
|
elements,
|
|
13670
13242
|
highlightedPrimitives,
|
|
@@ -13780,7 +13352,7 @@ var GroupAnchorOffsetOverlay = ({
|
|
|
13780
13352
|
display_offset_y: target.group.display_offset_y
|
|
13781
13353
|
};
|
|
13782
13354
|
}).filter((t) => Boolean(t));
|
|
13783
|
-
return /* @__PURE__ */
|
|
13355
|
+
return /* @__PURE__ */ jsx11(
|
|
13784
13356
|
AnchorOffsetOverlay,
|
|
13785
13357
|
{
|
|
13786
13358
|
targets: sharedTargets,
|
|
@@ -13792,8 +13364,8 @@ var GroupAnchorOffsetOverlay = ({
|
|
|
13792
13364
|
};
|
|
13793
13365
|
|
|
13794
13366
|
// src/components/AnchorOffsetOverlay/ComponentBoundingBoxOverlay.tsx
|
|
13795
|
-
import { applyToPoint as
|
|
13796
|
-
import { jsx as
|
|
13367
|
+
import { applyToPoint as applyToPoint11 } from "transformation-matrix";
|
|
13368
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
13797
13369
|
var calculateComponentBoundingBox = (component, elements) => {
|
|
13798
13370
|
const componentId = component.pcb_component_id;
|
|
13799
13371
|
const padsAndHoles = elements.filter(
|
|
@@ -13836,7 +13408,7 @@ var ComponentBoundingBoxOverlay = ({
|
|
|
13836
13408
|
renderData.push({ component, bbox, group });
|
|
13837
13409
|
}
|
|
13838
13410
|
if (renderData.length === 0) return null;
|
|
13839
|
-
return /* @__PURE__ */
|
|
13411
|
+
return /* @__PURE__ */ jsx12(
|
|
13840
13412
|
"div",
|
|
13841
13413
|
{
|
|
13842
13414
|
style: {
|
|
@@ -13849,18 +13421,18 @@ var ComponentBoundingBoxOverlay = ({
|
|
|
13849
13421
|
pointerEvents: "none",
|
|
13850
13422
|
zIndex: zIndexMap.dimensionOverlay
|
|
13851
13423
|
},
|
|
13852
|
-
children: /* @__PURE__ */
|
|
13424
|
+
children: /* @__PURE__ */ jsx12(
|
|
13853
13425
|
"svg",
|
|
13854
13426
|
{
|
|
13855
13427
|
style: { position: "absolute", left: 0, top: 0, pointerEvents: "none" },
|
|
13856
13428
|
width: containerWidth,
|
|
13857
13429
|
height: containerHeight,
|
|
13858
13430
|
children: renderData.map(({ component, bbox, group }) => {
|
|
13859
|
-
const topLeft =
|
|
13431
|
+
const topLeft = applyToPoint11(transform, {
|
|
13860
13432
|
x: bbox.minX,
|
|
13861
13433
|
y: bbox.maxY
|
|
13862
13434
|
});
|
|
13863
|
-
const bottomRight =
|
|
13435
|
+
const bottomRight = applyToPoint11(transform, {
|
|
13864
13436
|
x: bbox.maxX,
|
|
13865
13437
|
y: bbox.minY
|
|
13866
13438
|
});
|
|
@@ -13874,9 +13446,9 @@ var ComponentBoundingBoxOverlay = ({
|
|
|
13874
13446
|
x: (bbox.minX + bbox.maxX) / 2,
|
|
13875
13447
|
y: (bbox.minY + bbox.maxY) / 2
|
|
13876
13448
|
};
|
|
13877
|
-
const componentCenterScreen =
|
|
13878
|
-
return /* @__PURE__ */
|
|
13879
|
-
/* @__PURE__ */
|
|
13449
|
+
const componentCenterScreen = applyToPoint11(transform, componentCenter);
|
|
13450
|
+
return /* @__PURE__ */ jsxs8("g", { children: [
|
|
13451
|
+
/* @__PURE__ */ jsx12(
|
|
13880
13452
|
"rect",
|
|
13881
13453
|
{
|
|
13882
13454
|
x: screenBbox.x,
|
|
@@ -13889,7 +13461,7 @@ var ComponentBoundingBoxOverlay = ({
|
|
|
13889
13461
|
strokeDasharray: "4,4"
|
|
13890
13462
|
}
|
|
13891
13463
|
),
|
|
13892
|
-
/* @__PURE__ */
|
|
13464
|
+
/* @__PURE__ */ jsx12(
|
|
13893
13465
|
"line",
|
|
13894
13466
|
{
|
|
13895
13467
|
x1: componentCenterScreen.x - 6,
|
|
@@ -13900,7 +13472,7 @@ var ComponentBoundingBoxOverlay = ({
|
|
|
13900
13472
|
strokeWidth: 1.5
|
|
13901
13473
|
}
|
|
13902
13474
|
),
|
|
13903
|
-
/* @__PURE__ */
|
|
13475
|
+
/* @__PURE__ */ jsx12(
|
|
13904
13476
|
"line",
|
|
13905
13477
|
{
|
|
13906
13478
|
x1: componentCenterScreen.x,
|
|
@@ -13911,7 +13483,7 @@ var ComponentBoundingBoxOverlay = ({
|
|
|
13911
13483
|
strokeWidth: 1.5
|
|
13912
13484
|
}
|
|
13913
13485
|
),
|
|
13914
|
-
/* @__PURE__ */
|
|
13486
|
+
/* @__PURE__ */ jsx12(
|
|
13915
13487
|
"circle",
|
|
13916
13488
|
{
|
|
13917
13489
|
cx: componentCenterScreen.x,
|
|
@@ -13931,7 +13503,7 @@ var ComponentBoundingBoxOverlay = ({
|
|
|
13931
13503
|
};
|
|
13932
13504
|
|
|
13933
13505
|
// src/components/AnchorOffsetOverlay/PanelAnchorOffsetOverlay.tsx
|
|
13934
|
-
import { jsx as
|
|
13506
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
13935
13507
|
var PanelAnchorOffsetOverlay = ({
|
|
13936
13508
|
elements,
|
|
13937
13509
|
highlightedPrimitives,
|
|
@@ -13980,7 +13552,7 @@ var PanelAnchorOffsetOverlay = ({
|
|
|
13980
13552
|
display_offset_y: target.board.display_offset_y
|
|
13981
13553
|
};
|
|
13982
13554
|
}).filter((t) => Boolean(t));
|
|
13983
|
-
return /* @__PURE__ */
|
|
13555
|
+
return /* @__PURE__ */ jsx13(
|
|
13984
13556
|
AnchorOffsetOverlay,
|
|
13985
13557
|
{
|
|
13986
13558
|
targets: sharedTargets,
|
|
@@ -14069,8 +13641,8 @@ function filterTracesIfMultiple(filterTraces) {
|
|
|
14069
13641
|
}
|
|
14070
13642
|
|
|
14071
13643
|
// src/components/ElementOverlayBox.tsx
|
|
14072
|
-
import { useEffect as
|
|
14073
|
-
import { jsx as
|
|
13644
|
+
import { useEffect as useEffect9, useState as useState6 } from "react";
|
|
13645
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
14074
13646
|
var containerStyle = {
|
|
14075
13647
|
position: "absolute",
|
|
14076
13648
|
left: 0,
|
|
@@ -14133,9 +13705,9 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
14133
13705
|
mousePos,
|
|
14134
13706
|
elements
|
|
14135
13707
|
}) => {
|
|
14136
|
-
const [finalState, setFinalState] =
|
|
13708
|
+
const [finalState, setFinalState] = useState6(false);
|
|
14137
13709
|
const primitiveElement = primitive._element;
|
|
14138
|
-
|
|
13710
|
+
useEffect9(() => {
|
|
14139
13711
|
setTimeout(() => {
|
|
14140
13712
|
setFinalState(true);
|
|
14141
13713
|
}, 100);
|
|
@@ -14161,7 +13733,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
14161
13733
|
const traceTextContext = { primitiveElement, elements };
|
|
14162
13734
|
const overlayInfo = getTraceOverlayInfo(traceTextContext);
|
|
14163
13735
|
if (!overlayInfo) return null;
|
|
14164
|
-
return /* @__PURE__ */
|
|
13736
|
+
return /* @__PURE__ */ jsx14(
|
|
14165
13737
|
"div",
|
|
14166
13738
|
{
|
|
14167
13739
|
style: {
|
|
@@ -14172,7 +13744,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
14172
13744
|
color: color7,
|
|
14173
13745
|
pointerEvents: "none"
|
|
14174
13746
|
},
|
|
14175
|
-
children: /* @__PURE__ */
|
|
13747
|
+
children: /* @__PURE__ */ jsxs9(
|
|
14176
13748
|
"div",
|
|
14177
13749
|
{
|
|
14178
13750
|
style: {
|
|
@@ -14189,8 +13761,8 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
14189
13761
|
whiteSpace: "nowrap"
|
|
14190
13762
|
},
|
|
14191
13763
|
children: [
|
|
14192
|
-
overlayInfo.text && /* @__PURE__ */
|
|
14193
|
-
overlayInfo.name && /* @__PURE__ */
|
|
13764
|
+
overlayInfo.text && /* @__PURE__ */ jsx14("div", { children: overlayInfo.text }),
|
|
13765
|
+
overlayInfo.name && /* @__PURE__ */ jsx14(
|
|
14194
13766
|
"div",
|
|
14195
13767
|
{
|
|
14196
13768
|
style: {
|
|
@@ -14209,7 +13781,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
14209
13781
|
if (label.trim().length === 0) {
|
|
14210
13782
|
return null;
|
|
14211
13783
|
}
|
|
14212
|
-
return /* @__PURE__ */
|
|
13784
|
+
return /* @__PURE__ */ jsx14(
|
|
14213
13785
|
"div",
|
|
14214
13786
|
{
|
|
14215
13787
|
style: {
|
|
@@ -14223,7 +13795,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
14223
13795
|
transform: `rotate(${-rotation}deg)`,
|
|
14224
13796
|
transformOrigin: "center center"
|
|
14225
13797
|
},
|
|
14226
|
-
children: /* @__PURE__ */
|
|
13798
|
+
children: /* @__PURE__ */ jsx14(
|
|
14227
13799
|
"div",
|
|
14228
13800
|
{
|
|
14229
13801
|
style: {
|
|
@@ -14239,7 +13811,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
14239
13811
|
opacity: finalState ? 1 : si === 0 ? 1 : 0,
|
|
14240
13812
|
transition: "width 0.2s, height 0.2s, margin-left 0.2s, margin-top 0.2s, opacity 0.2s"
|
|
14241
13813
|
},
|
|
14242
|
-
children: /* @__PURE__ */
|
|
13814
|
+
children: /* @__PURE__ */ jsx14(
|
|
14243
13815
|
"div",
|
|
14244
13816
|
{
|
|
14245
13817
|
style: {
|
|
@@ -14287,7 +13859,7 @@ var ElementOverlayBox = ({
|
|
|
14287
13859
|
is_showing_multiple_traces_length,
|
|
14288
13860
|
elements
|
|
14289
13861
|
});
|
|
14290
|
-
return /* @__PURE__ */
|
|
13862
|
+
return /* @__PURE__ */ jsx14("div", { style: containerStyle, children: !is_moving_component && primitives.map((primitive) => /* @__PURE__ */ jsx14(
|
|
14291
13863
|
HighlightedPrimitiveBoxWithText,
|
|
14292
13864
|
{
|
|
14293
13865
|
primitive,
|
|
@@ -14299,7 +13871,7 @@ var ElementOverlayBox = ({
|
|
|
14299
13871
|
};
|
|
14300
13872
|
|
|
14301
13873
|
// src/components/MouseElementTracker.tsx
|
|
14302
|
-
import { Fragment as
|
|
13874
|
+
import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
14303
13875
|
var getPolygonBoundingBox = (points) => {
|
|
14304
13876
|
if (points.length === 0) return null;
|
|
14305
13877
|
let minX = points[0].x;
|
|
@@ -14415,10 +13987,10 @@ var MouseElementTracker = ({
|
|
|
14415
13987
|
selectedLayer,
|
|
14416
13988
|
onMouseHoverOverPrimitives
|
|
14417
13989
|
}) => {
|
|
14418
|
-
const [mousedPrimitives, setMousedPrimitives] =
|
|
14419
|
-
const [mousePos, setMousePos] =
|
|
13990
|
+
const [mousedPrimitives, setMousedPrimitives] = useState7([]);
|
|
13991
|
+
const [mousePos, setMousePos] = useState7({ x: 0, y: 0 });
|
|
14420
13992
|
const [containerRef, { width, height }] = useMeasure_default();
|
|
14421
|
-
|
|
13993
|
+
useEffect10(() => {
|
|
14422
13994
|
setMousedPrimitives([]);
|
|
14423
13995
|
onMouseHoverOverPrimitives([]);
|
|
14424
13996
|
}, [selectedLayer, onMouseHoverOverPrimitives]);
|
|
@@ -14461,7 +14033,7 @@ var MouseElementTracker = ({
|
|
|
14461
14033
|
h = "h" in primitive ? primitive.h : "r" in primitive ? primitive.r * 2 : "rX" in primitive && "rY" in primitive ? primitive.rY * 2 : 0;
|
|
14462
14034
|
}
|
|
14463
14035
|
if (!basePoint) continue;
|
|
14464
|
-
const screenPos =
|
|
14036
|
+
const screenPos = applyToPoint12(transform, basePoint);
|
|
14465
14037
|
const screenSize = {
|
|
14466
14038
|
w: w * transform.a,
|
|
14467
14039
|
h: h * transform.a
|
|
@@ -14486,7 +14058,7 @@ var MouseElementTracker = ({
|
|
|
14486
14058
|
}, [mousedPrimitives, transform]);
|
|
14487
14059
|
const handleInteraction = (x, y, transform2, primitives2) => {
|
|
14488
14060
|
setMousePos({ x, y });
|
|
14489
|
-
const rwPoint =
|
|
14061
|
+
const rwPoint = applyToPoint12(inverse4(transform2), { x, y });
|
|
14490
14062
|
const newMousedPrimitives = getPrimitivesUnderPoint(
|
|
14491
14063
|
primitives2,
|
|
14492
14064
|
rwPoint,
|
|
@@ -14502,7 +14074,7 @@ var MouseElementTracker = ({
|
|
|
14502
14074
|
setMousedPrimitives(newMousedPrimitives);
|
|
14503
14075
|
onMouseHoverOverPrimitives(newMousedPrimitives);
|
|
14504
14076
|
};
|
|
14505
|
-
return /* @__PURE__ */
|
|
14077
|
+
return /* @__PURE__ */ jsxs10(
|
|
14506
14078
|
"div",
|
|
14507
14079
|
{
|
|
14508
14080
|
ref: containerRef,
|
|
@@ -14526,7 +14098,7 @@ var MouseElementTracker = ({
|
|
|
14526
14098
|
},
|
|
14527
14099
|
children: [
|
|
14528
14100
|
children,
|
|
14529
|
-
/* @__PURE__ */
|
|
14101
|
+
/* @__PURE__ */ jsx15(
|
|
14530
14102
|
ElementOverlayBox,
|
|
14531
14103
|
{
|
|
14532
14104
|
elements,
|
|
@@ -14534,8 +14106,8 @@ var MouseElementTracker = ({
|
|
|
14534
14106
|
highlightedPrimitives
|
|
14535
14107
|
}
|
|
14536
14108
|
),
|
|
14537
|
-
transform && /* @__PURE__ */
|
|
14538
|
-
/* @__PURE__ */
|
|
14109
|
+
transform && /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
14110
|
+
/* @__PURE__ */ jsx15(
|
|
14539
14111
|
BoardAnchorOffsetOverlay,
|
|
14540
14112
|
{
|
|
14541
14113
|
elements,
|
|
@@ -14545,7 +14117,7 @@ var MouseElementTracker = ({
|
|
|
14545
14117
|
containerHeight: height
|
|
14546
14118
|
}
|
|
14547
14119
|
),
|
|
14548
|
-
/* @__PURE__ */
|
|
14120
|
+
/* @__PURE__ */ jsx15(
|
|
14549
14121
|
GroupAnchorOffsetOverlay,
|
|
14550
14122
|
{
|
|
14551
14123
|
elements,
|
|
@@ -14555,7 +14127,7 @@ var MouseElementTracker = ({
|
|
|
14555
14127
|
containerHeight: height
|
|
14556
14128
|
}
|
|
14557
14129
|
),
|
|
14558
|
-
/* @__PURE__ */
|
|
14130
|
+
/* @__PURE__ */ jsx15(
|
|
14559
14131
|
ComponentBoundingBoxOverlay,
|
|
14560
14132
|
{
|
|
14561
14133
|
elements,
|
|
@@ -14565,7 +14137,7 @@ var MouseElementTracker = ({
|
|
|
14565
14137
|
containerHeight: height
|
|
14566
14138
|
}
|
|
14567
14139
|
),
|
|
14568
|
-
/* @__PURE__ */
|
|
14140
|
+
/* @__PURE__ */ jsx15(
|
|
14569
14141
|
PanelAnchorOffsetOverlay,
|
|
14570
14142
|
{
|
|
14571
14143
|
elements,
|
|
@@ -14582,10 +14154,10 @@ var MouseElementTracker = ({
|
|
|
14582
14154
|
};
|
|
14583
14155
|
|
|
14584
14156
|
// src/components/PcbGroupOverlay.tsx
|
|
14585
|
-
import { applyToPoint as
|
|
14586
|
-
import { identity as
|
|
14587
|
-
import { useRef as
|
|
14588
|
-
import { jsx as
|
|
14157
|
+
import { applyToPoint as applyToPoint13 } from "transformation-matrix";
|
|
14158
|
+
import { identity as identity6 } from "transformation-matrix";
|
|
14159
|
+
import { useRef as useRef8, useEffect as useEffect11 } from "react";
|
|
14160
|
+
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
14589
14161
|
var GROUP_COLORS = [
|
|
14590
14162
|
"rgb(255, 100, 100)",
|
|
14591
14163
|
"rgb(100, 255, 100)",
|
|
@@ -14600,12 +14172,12 @@ var GROUP_COLORS = [
|
|
|
14600
14172
|
];
|
|
14601
14173
|
var PcbGroupOverlay = ({
|
|
14602
14174
|
children,
|
|
14603
|
-
transform =
|
|
14175
|
+
transform = identity6(),
|
|
14604
14176
|
elements = [],
|
|
14605
14177
|
hoveredComponentIds = []
|
|
14606
14178
|
}) => {
|
|
14607
14179
|
const [containerRef, { width, height }] = useMeasure_default();
|
|
14608
|
-
const canvasRef =
|
|
14180
|
+
const canvasRef = useRef8(null);
|
|
14609
14181
|
const {
|
|
14610
14182
|
is_showing_pcb_groups,
|
|
14611
14183
|
pcb_group_view_mode,
|
|
@@ -14615,7 +14187,7 @@ var PcbGroupOverlay = ({
|
|
|
14615
14187
|
pcb_group_view_mode: s.pcb_group_view_mode,
|
|
14616
14188
|
is_showing_group_anchor_offsets: s.is_showing_group_anchor_offsets
|
|
14617
14189
|
}));
|
|
14618
|
-
|
|
14190
|
+
useEffect11(() => {
|
|
14619
14191
|
const canvas = canvasRef.current;
|
|
14620
14192
|
if (!canvas || !width || !height) return;
|
|
14621
14193
|
canvas.width = width;
|
|
@@ -14743,10 +14315,10 @@ var PcbGroupOverlay = ({
|
|
|
14743
14315
|
minY -= totalPadding;
|
|
14744
14316
|
maxY += totalPadding;
|
|
14745
14317
|
}
|
|
14746
|
-
const topLeft =
|
|
14747
|
-
const topRight =
|
|
14748
|
-
const bottomLeft =
|
|
14749
|
-
const bottomRight =
|
|
14318
|
+
const topLeft = applyToPoint13(transform, { x: minX, y: maxY });
|
|
14319
|
+
const topRight = applyToPoint13(transform, { x: maxX, y: maxY });
|
|
14320
|
+
const bottomLeft = applyToPoint13(transform, { x: minX, y: minY });
|
|
14321
|
+
const bottomRight = applyToPoint13(transform, { x: maxX, y: minY });
|
|
14750
14322
|
const groupColor = GROUP_COLORS[groupIndex % GROUP_COLORS.length];
|
|
14751
14323
|
ctx.strokeStyle = groupColor;
|
|
14752
14324
|
ctx.lineWidth = 2;
|
|
@@ -14796,7 +14368,7 @@ var PcbGroupOverlay = ({
|
|
|
14796
14368
|
x: group.anchor_position[0] ?? 0,
|
|
14797
14369
|
y: group.anchor_position[1] ?? 0
|
|
14798
14370
|
} : { x: group.anchor_position.x, y: group.anchor_position.y };
|
|
14799
|
-
const anchorScreenPos =
|
|
14371
|
+
const anchorScreenPos = applyToPoint13(transform, anchorPositionValue);
|
|
14800
14372
|
ctx.strokeStyle = "white";
|
|
14801
14373
|
ctx.lineWidth = 1.5;
|
|
14802
14374
|
ctx.setLineDash([]);
|
|
@@ -14821,14 +14393,14 @@ var PcbGroupOverlay = ({
|
|
|
14821
14393
|
is_showing_group_anchor_offsets,
|
|
14822
14394
|
hoveredComponentIds
|
|
14823
14395
|
]);
|
|
14824
|
-
return /* @__PURE__ */
|
|
14396
|
+
return /* @__PURE__ */ jsxs11(
|
|
14825
14397
|
"div",
|
|
14826
14398
|
{
|
|
14827
14399
|
ref: containerRef,
|
|
14828
14400
|
style: { position: "relative", width: "100%", height: "100%" },
|
|
14829
14401
|
children: [
|
|
14830
14402
|
children,
|
|
14831
|
-
/* @__PURE__ */
|
|
14403
|
+
/* @__PURE__ */ jsx16(
|
|
14832
14404
|
"canvas",
|
|
14833
14405
|
{
|
|
14834
14406
|
ref: canvasRef,
|
|
@@ -14848,9 +14420,9 @@ var PcbGroupOverlay = ({
|
|
|
14848
14420
|
};
|
|
14849
14421
|
|
|
14850
14422
|
// src/components/RatsNestOverlay.tsx
|
|
14851
|
-
import { applyToPoint as
|
|
14423
|
+
import { applyToPoint as applyToPoint14, identity as identity7 } from "transformation-matrix";
|
|
14852
14424
|
import { useMemo as useMemo6 } from "react";
|
|
14853
|
-
import { jsx as
|
|
14425
|
+
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
14854
14426
|
var RatsNestOverlay = ({ transform, soup, children }) => {
|
|
14855
14427
|
const isShowingRatsNest = useGlobalStore((s) => s.is_showing_rats_nest);
|
|
14856
14428
|
const { netMap, idToNetMap } = useMemo6(
|
|
@@ -14912,10 +14484,10 @@ var RatsNestOverlay = ({ transform, soup, children }) => {
|
|
|
14912
14484
|
return lines;
|
|
14913
14485
|
}, [soup, netMap, idToNetMap, isShowingRatsNest]);
|
|
14914
14486
|
if (!soup || !isShowingRatsNest) return children;
|
|
14915
|
-
if (!transform) transform =
|
|
14916
|
-
return /* @__PURE__ */
|
|
14487
|
+
if (!transform) transform = identity7();
|
|
14488
|
+
return /* @__PURE__ */ jsxs12("div", { style: { position: "relative" }, children: [
|
|
14917
14489
|
children,
|
|
14918
|
-
/* @__PURE__ */
|
|
14490
|
+
/* @__PURE__ */ jsx17(
|
|
14919
14491
|
"svg",
|
|
14920
14492
|
{
|
|
14921
14493
|
style: {
|
|
@@ -14929,9 +14501,9 @@ var RatsNestOverlay = ({ transform, soup, children }) => {
|
|
|
14929
14501
|
zIndex: zIndexMap.ratsNestOverlay
|
|
14930
14502
|
},
|
|
14931
14503
|
children: ratsNestLines.map(({ key, startPoint, endPoint, isInNet }) => {
|
|
14932
|
-
const transformedStart =
|
|
14933
|
-
const transformedEnd =
|
|
14934
|
-
return /* @__PURE__ */
|
|
14504
|
+
const transformedStart = applyToPoint14(transform, startPoint);
|
|
14505
|
+
const transformedEnd = applyToPoint14(transform, endPoint);
|
|
14506
|
+
return /* @__PURE__ */ jsx17(
|
|
14935
14507
|
"line",
|
|
14936
14508
|
{
|
|
14937
14509
|
x1: transformedStart.x,
|
|
@@ -14952,18 +14524,18 @@ var RatsNestOverlay = ({ transform, soup, children }) => {
|
|
|
14952
14524
|
|
|
14953
14525
|
// src/components/ToolbarOverlay.tsx
|
|
14954
14526
|
import {
|
|
14955
|
-
useEffect as
|
|
14956
|
-
useState as
|
|
14527
|
+
useEffect as useEffect15,
|
|
14528
|
+
useState as useState10,
|
|
14957
14529
|
useCallback as useCallback10,
|
|
14958
|
-
useRef as
|
|
14530
|
+
useRef as useRef12,
|
|
14959
14531
|
useLayoutEffect as useLayoutEffect2
|
|
14960
14532
|
} from "react";
|
|
14961
|
-
import { css as
|
|
14533
|
+
import { css as css2 } from "@emotion/css";
|
|
14962
14534
|
|
|
14963
14535
|
// package.json
|
|
14964
14536
|
var package_default = {
|
|
14965
14537
|
name: "@tscircuit/pcb-viewer",
|
|
14966
|
-
version: "1.11.
|
|
14538
|
+
version: "1.11.387",
|
|
14967
14539
|
main: "dist/index.js",
|
|
14968
14540
|
type: "module",
|
|
14969
14541
|
repository: "tscircuit/pcb-viewer",
|
|
@@ -15028,20 +14600,20 @@ var package_default = {
|
|
|
15028
14600
|
};
|
|
15029
14601
|
|
|
15030
14602
|
// src/hooks/useHotKey.ts
|
|
15031
|
-
import { useEffect as
|
|
14603
|
+
import { useEffect as useEffect12, useRef as useRef9 } from "react";
|
|
15032
14604
|
var useHotKey = (key, onUse, containerRef) => {
|
|
15033
14605
|
const isMouseOverContainer = useGlobalStore(
|
|
15034
14606
|
(s) => s.is_mouse_over_container
|
|
15035
14607
|
);
|
|
15036
|
-
const isMouseOverContainerRef =
|
|
15037
|
-
const onUseRef =
|
|
15038
|
-
|
|
14608
|
+
const isMouseOverContainerRef = useRef9(isMouseOverContainer);
|
|
14609
|
+
const onUseRef = useRef9(onUse);
|
|
14610
|
+
useEffect12(() => {
|
|
15039
14611
|
isMouseOverContainerRef.current = isMouseOverContainer;
|
|
15040
14612
|
}, [isMouseOverContainer]);
|
|
15041
|
-
|
|
14613
|
+
useEffect12(() => {
|
|
15042
14614
|
onUseRef.current = onUse;
|
|
15043
14615
|
}, [onUse]);
|
|
15044
|
-
|
|
14616
|
+
useEffect12(() => {
|
|
15045
14617
|
if (!key) return;
|
|
15046
14618
|
const handleKeyDown = (event) => {
|
|
15047
14619
|
const target = event.target;
|
|
@@ -15069,10 +14641,10 @@ var useHotKey = (key, onUse, containerRef) => {
|
|
|
15069
14641
|
};
|
|
15070
14642
|
|
|
15071
14643
|
// src/hooks/useIsSmallScreen.ts
|
|
15072
|
-
import { useEffect as
|
|
14644
|
+
import { useEffect as useEffect13, useState as useState8 } from "react";
|
|
15073
14645
|
var useIsSmallScreen = () => {
|
|
15074
|
-
const [isSmallScreen, setIsSmallScreen] =
|
|
15075
|
-
|
|
14646
|
+
const [isSmallScreen, setIsSmallScreen] = useState8(false);
|
|
14647
|
+
useEffect13(() => {
|
|
15076
14648
|
const checkIsMobile = () => {
|
|
15077
14649
|
setIsSmallScreen(window.innerWidth <= 768);
|
|
15078
14650
|
};
|
|
@@ -15086,10 +14658,10 @@ var useIsSmallScreen = () => {
|
|
|
15086
14658
|
// src/hooks/useMobileTouch.ts
|
|
15087
14659
|
import {
|
|
15088
14660
|
useCallback as useCallback7,
|
|
15089
|
-
useRef as
|
|
14661
|
+
useRef as useRef10
|
|
15090
14662
|
} from "react";
|
|
15091
14663
|
var useMobileTouch = (onClick, options = { stopPropagation: true }) => {
|
|
15092
|
-
const lastInteractionRef =
|
|
14664
|
+
const lastInteractionRef = useRef10(0);
|
|
15093
14665
|
const handleInteraction = useCallback7(
|
|
15094
14666
|
(e) => {
|
|
15095
14667
|
if (options.stopPropagation) {
|
|
@@ -15118,7 +14690,7 @@ var useMobileTouch = (onClick, options = { stopPropagation: true }) => {
|
|
|
15118
14690
|
};
|
|
15119
14691
|
|
|
15120
14692
|
// src/components/ToolbarButton.tsx
|
|
15121
|
-
import { jsx as
|
|
14693
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
15122
14694
|
var ToolbarButton = ({
|
|
15123
14695
|
children,
|
|
15124
14696
|
isSmallScreen,
|
|
@@ -15126,7 +14698,7 @@ var ToolbarButton = ({
|
|
|
15126
14698
|
...props
|
|
15127
14699
|
}) => {
|
|
15128
14700
|
const { style: touchStyle, ...touchHandlers } = useMobileTouch(onClick);
|
|
15129
|
-
return /* @__PURE__ */
|
|
14701
|
+
return /* @__PURE__ */ jsx18(
|
|
15130
14702
|
"div",
|
|
15131
14703
|
{
|
|
15132
14704
|
...props,
|
|
@@ -15154,7 +14726,7 @@ var ToolbarButton = ({
|
|
|
15154
14726
|
};
|
|
15155
14727
|
|
|
15156
14728
|
// src/components/ToolbarErrorDropdown.tsx
|
|
15157
|
-
import { useCallback as useCallback9, useMemo as useMemo7, useState as
|
|
14729
|
+
import { useCallback as useCallback9, useMemo as useMemo7, useState as useState9 } from "react";
|
|
15158
14730
|
|
|
15159
14731
|
// src/lib/util/group-errors-by-type.ts
|
|
15160
14732
|
var groupErrorsByType = (errors) => {
|
|
@@ -15176,16 +14748,16 @@ var groupErrorsByType = (errors) => {
|
|
|
15176
14748
|
};
|
|
15177
14749
|
|
|
15178
14750
|
// src/components/useToolbarErrorFocus.ts
|
|
15179
|
-
import { useCallback as useCallback8, useEffect as
|
|
14751
|
+
import { useCallback as useCallback8, useEffect as useEffect14, useRef as useRef11 } from "react";
|
|
15180
14752
|
var useToolbarErrorFocus = ({
|
|
15181
14753
|
onClose,
|
|
15182
14754
|
setHoveredErrorId,
|
|
15183
14755
|
setFocusedErrorId,
|
|
15184
14756
|
highlightDurationMs = 3e3
|
|
15185
14757
|
}) => {
|
|
15186
|
-
const clearHighlightTimeoutRef =
|
|
15187
|
-
const focusRequestRef =
|
|
15188
|
-
const selectedErrorIdRef =
|
|
14758
|
+
const clearHighlightTimeoutRef = useRef11(null);
|
|
14759
|
+
const focusRequestRef = useRef11(null);
|
|
14760
|
+
const selectedErrorIdRef = useRef11(null);
|
|
15189
14761
|
const clearPendingSelection = useCallback8(() => {
|
|
15190
14762
|
if (clearHighlightTimeoutRef.current !== null) {
|
|
15191
14763
|
window.clearTimeout(clearHighlightTimeoutRef.current);
|
|
@@ -15196,7 +14768,7 @@ var useToolbarErrorFocus = ({
|
|
|
15196
14768
|
focusRequestRef.current = null;
|
|
15197
14769
|
}
|
|
15198
14770
|
}, []);
|
|
15199
|
-
|
|
14771
|
+
useEffect14(() => clearPendingSelection, [clearPendingSelection]);
|
|
15200
14772
|
const handleErrorSelect = useCallback8(
|
|
15201
14773
|
(errorId) => {
|
|
15202
14774
|
clearPendingSelection();
|
|
@@ -15234,7 +14806,7 @@ var useToolbarErrorFocus = ({
|
|
|
15234
14806
|
};
|
|
15235
14807
|
|
|
15236
14808
|
// src/components/ToolbarErrorDropdown.tsx
|
|
15237
|
-
import { jsx as
|
|
14809
|
+
import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
15238
14810
|
var CopyErrorButton = ({
|
|
15239
14811
|
errorId,
|
|
15240
14812
|
errorMessage,
|
|
@@ -15244,7 +14816,7 @@ var CopyErrorButton = ({
|
|
|
15244
14816
|
const { style: touchStyle, ...touchHandlers } = useMobileTouch(
|
|
15245
14817
|
() => onCopy(errorMessage, errorId)
|
|
15246
14818
|
);
|
|
15247
|
-
return /* @__PURE__ */
|
|
14819
|
+
return /* @__PURE__ */ jsx19(
|
|
15248
14820
|
"button",
|
|
15249
14821
|
{
|
|
15250
14822
|
type: "button",
|
|
@@ -15264,7 +14836,7 @@ var CopyErrorButton = ({
|
|
|
15264
14836
|
...touchStyle
|
|
15265
14837
|
},
|
|
15266
14838
|
...touchHandlers,
|
|
15267
|
-
children: copiedErrorId === errorId ? /* @__PURE__ */
|
|
14839
|
+
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
14840
|
}
|
|
15269
14841
|
);
|
|
15270
14842
|
};
|
|
@@ -15277,11 +14849,11 @@ var ToolbarErrorDropdown = ({
|
|
|
15277
14849
|
setHoveredErrorId,
|
|
15278
14850
|
setFocusedErrorId
|
|
15279
14851
|
}) => {
|
|
15280
|
-
const [copiedErrorId, setCopiedErrorId] =
|
|
15281
|
-
const [collapsedErrorGroups, setCollapsedErrorGroups] =
|
|
14852
|
+
const [copiedErrorId, setCopiedErrorId] = useState9(null);
|
|
14853
|
+
const [collapsedErrorGroups, setCollapsedErrorGroups] = useState9(
|
|
15282
14854
|
/* @__PURE__ */ new Set()
|
|
15283
14855
|
);
|
|
15284
|
-
const [expandedErrorIds, setExpandedErrorIds] =
|
|
14856
|
+
const [expandedErrorIds, setExpandedErrorIds] = useState9(
|
|
15285
14857
|
/* @__PURE__ */ new Set()
|
|
15286
14858
|
);
|
|
15287
14859
|
const [, copyToClipboard] = useCopyToClipboard_default();
|
|
@@ -15323,20 +14895,20 @@ var ToolbarErrorDropdown = ({
|
|
|
15323
14895
|
return next;
|
|
15324
14896
|
});
|
|
15325
14897
|
}, []);
|
|
15326
|
-
return /* @__PURE__ */
|
|
15327
|
-
/* @__PURE__ */
|
|
14898
|
+
return /* @__PURE__ */ jsxs13("div", { style: { position: "relative" }, children: [
|
|
14899
|
+
/* @__PURE__ */ jsx19(
|
|
15328
14900
|
ToolbarButton,
|
|
15329
14901
|
{
|
|
15330
14902
|
isSmallScreen,
|
|
15331
14903
|
style: errorCount > 0 ? { color: "red" } : void 0,
|
|
15332
14904
|
onClick: onToggle,
|
|
15333
|
-
children: /* @__PURE__ */
|
|
14905
|
+
children: /* @__PURE__ */ jsxs13("div", { children: [
|
|
15334
14906
|
errorCount,
|
|
15335
14907
|
" errors"
|
|
15336
14908
|
] })
|
|
15337
14909
|
}
|
|
15338
14910
|
),
|
|
15339
|
-
isOpen && errorCount > 0 && /* @__PURE__ */
|
|
14911
|
+
isOpen && errorCount > 0 && /* @__PURE__ */ jsx19(
|
|
15340
14912
|
"div",
|
|
15341
14913
|
{
|
|
15342
14914
|
style: {
|
|
@@ -15356,14 +14928,14 @@ var ToolbarErrorDropdown = ({
|
|
|
15356
14928
|
},
|
|
15357
14929
|
children: groupedErrorElements.map(({ errorType, errors }, groupIndex) => {
|
|
15358
14930
|
const isGroupCollapsed = collapsedErrorGroups.has(errorType);
|
|
15359
|
-
return /* @__PURE__ */
|
|
14931
|
+
return /* @__PURE__ */ jsxs13(
|
|
15360
14932
|
"div",
|
|
15361
14933
|
{
|
|
15362
14934
|
style: {
|
|
15363
14935
|
borderBottom: groupIndex < groupedErrorElements.length - 1 ? "1px solid #444" : "none"
|
|
15364
14936
|
},
|
|
15365
14937
|
children: [
|
|
15366
|
-
/* @__PURE__ */
|
|
14938
|
+
/* @__PURE__ */ jsxs13(
|
|
15367
14939
|
"div",
|
|
15368
14940
|
{
|
|
15369
14941
|
style: {
|
|
@@ -15400,7 +14972,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15400
14972
|
toggleErrorGroup(errorType);
|
|
15401
14973
|
},
|
|
15402
14974
|
children: [
|
|
15403
|
-
/* @__PURE__ */
|
|
14975
|
+
/* @__PURE__ */ jsxs13(
|
|
15404
14976
|
"div",
|
|
15405
14977
|
{
|
|
15406
14978
|
style: {
|
|
@@ -15410,7 +14982,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15410
14982
|
color: "#ff6b6b"
|
|
15411
14983
|
},
|
|
15412
14984
|
children: [
|
|
15413
|
-
/* @__PURE__ */
|
|
14985
|
+
/* @__PURE__ */ jsx19(
|
|
15414
14986
|
"div",
|
|
15415
14987
|
{
|
|
15416
14988
|
style: {
|
|
@@ -15423,7 +14995,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15423
14995
|
children: "\u203A"
|
|
15424
14996
|
}
|
|
15425
14997
|
),
|
|
15426
|
-
/* @__PURE__ */
|
|
14998
|
+
/* @__PURE__ */ jsx19(
|
|
15427
14999
|
"div",
|
|
15428
15000
|
{
|
|
15429
15001
|
style: {
|
|
@@ -15436,7 +15008,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15436
15008
|
]
|
|
15437
15009
|
}
|
|
15438
15010
|
),
|
|
15439
|
-
/* @__PURE__ */
|
|
15011
|
+
/* @__PURE__ */ jsx19(
|
|
15440
15012
|
"div",
|
|
15441
15013
|
{
|
|
15442
15014
|
style: {
|
|
@@ -15454,14 +15026,14 @@ var ToolbarErrorDropdown = ({
|
|
|
15454
15026
|
!isGroupCollapsed && errors.map(({ error, index, errorId }) => {
|
|
15455
15027
|
const isExpanded = expandedErrorIds.has(errorId);
|
|
15456
15028
|
const errorMessage = error.message ?? "No error message";
|
|
15457
|
-
return /* @__PURE__ */
|
|
15029
|
+
return /* @__PURE__ */ jsxs13(
|
|
15458
15030
|
"div",
|
|
15459
15031
|
{
|
|
15460
15032
|
style: {
|
|
15461
15033
|
borderTop: "1px solid #3a3a3a"
|
|
15462
15034
|
},
|
|
15463
15035
|
children: [
|
|
15464
|
-
/* @__PURE__ */
|
|
15036
|
+
/* @__PURE__ */ jsxs13(
|
|
15465
15037
|
"div",
|
|
15466
15038
|
{
|
|
15467
15039
|
style: {
|
|
@@ -15500,7 +15072,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15500
15072
|
handleErrorSelect(errorId);
|
|
15501
15073
|
},
|
|
15502
15074
|
children: [
|
|
15503
|
-
/* @__PURE__ */
|
|
15075
|
+
/* @__PURE__ */ jsx19(
|
|
15504
15076
|
"div",
|
|
15505
15077
|
{
|
|
15506
15078
|
style: {
|
|
@@ -15516,7 +15088,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15516
15088
|
children: errorMessage
|
|
15517
15089
|
}
|
|
15518
15090
|
),
|
|
15519
|
-
/* @__PURE__ */
|
|
15091
|
+
/* @__PURE__ */ jsx19(
|
|
15520
15092
|
"button",
|
|
15521
15093
|
{
|
|
15522
15094
|
type: "button",
|
|
@@ -15548,7 +15120,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15548
15120
|
]
|
|
15549
15121
|
}
|
|
15550
15122
|
),
|
|
15551
|
-
isExpanded && /* @__PURE__ */
|
|
15123
|
+
isExpanded && /* @__PURE__ */ jsxs13(
|
|
15552
15124
|
"div",
|
|
15553
15125
|
{
|
|
15554
15126
|
"data-error-id": index,
|
|
@@ -15560,7 +15132,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15560
15132
|
position: "relative"
|
|
15561
15133
|
},
|
|
15562
15134
|
children: [
|
|
15563
|
-
/* @__PURE__ */
|
|
15135
|
+
/* @__PURE__ */ jsx19(
|
|
15564
15136
|
"div",
|
|
15565
15137
|
{
|
|
15566
15138
|
style: {
|
|
@@ -15578,7 +15150,7 @@ var ToolbarErrorDropdown = ({
|
|
|
15578
15150
|
children: errorMessage
|
|
15579
15151
|
}
|
|
15580
15152
|
),
|
|
15581
|
-
/* @__PURE__ */
|
|
15153
|
+
/* @__PURE__ */ jsx19(
|
|
15582
15154
|
CopyErrorButton,
|
|
15583
15155
|
{
|
|
15584
15156
|
errorId,
|
|
@@ -15610,13 +15182,13 @@ var ToolbarErrorDropdown = ({
|
|
|
15610
15182
|
};
|
|
15611
15183
|
|
|
15612
15184
|
// src/components/ToolbarOverlay.tsx
|
|
15613
|
-
import { jsx as
|
|
15185
|
+
import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
15614
15186
|
var LayerButton = ({ name, selected, onClick }) => {
|
|
15615
15187
|
const { style: touchStyle, ...touchHandlers } = useMobileTouch(onClick);
|
|
15616
|
-
return /* @__PURE__ */
|
|
15188
|
+
return /* @__PURE__ */ jsxs14(
|
|
15617
15189
|
"div",
|
|
15618
15190
|
{
|
|
15619
|
-
className:
|
|
15191
|
+
className: css2`
|
|
15620
15192
|
margin-top: 2px;
|
|
15621
15193
|
padding: 4px;
|
|
15622
15194
|
padding-left: 8px;
|
|
@@ -15630,8 +15202,8 @@ var LayerButton = ({ name, selected, onClick }) => {
|
|
|
15630
15202
|
...touchHandlers,
|
|
15631
15203
|
style: touchStyle,
|
|
15632
15204
|
children: [
|
|
15633
|
-
/* @__PURE__ */
|
|
15634
|
-
/* @__PURE__ */
|
|
15205
|
+
/* @__PURE__ */ jsx20("span", { style: { marginRight: 2, opacity: selected ? 1 : 0 }, children: "\u2022" }),
|
|
15206
|
+
/* @__PURE__ */ jsx20(
|
|
15635
15207
|
"span",
|
|
15636
15208
|
{
|
|
15637
15209
|
style: {
|
|
@@ -15652,10 +15224,10 @@ var CheckboxMenuItem = ({
|
|
|
15652
15224
|
onClick
|
|
15653
15225
|
}) => {
|
|
15654
15226
|
const { style: touchStyle, ...touchHandlers } = useMobileTouch(onClick);
|
|
15655
|
-
return /* @__PURE__ */
|
|
15227
|
+
return /* @__PURE__ */ jsxs14(
|
|
15656
15228
|
"div",
|
|
15657
15229
|
{
|
|
15658
|
-
className:
|
|
15230
|
+
className: css2`
|
|
15659
15231
|
margin-top: 2px;
|
|
15660
15232
|
padding: 4px;
|
|
15661
15233
|
padding-left: 8px;
|
|
@@ -15672,19 +15244,19 @@ var CheckboxMenuItem = ({
|
|
|
15672
15244
|
...touchHandlers,
|
|
15673
15245
|
style: touchStyle,
|
|
15674
15246
|
children: [
|
|
15675
|
-
/* @__PURE__ */
|
|
15247
|
+
/* @__PURE__ */ jsx20("input", { type: "checkbox", checked, onChange: () => {
|
|
15676
15248
|
}, readOnly: true }),
|
|
15677
|
-
/* @__PURE__ */
|
|
15249
|
+
/* @__PURE__ */ jsx20("span", { style: { color: "#eee" }, children: label })
|
|
15678
15250
|
]
|
|
15679
15251
|
}
|
|
15680
15252
|
);
|
|
15681
15253
|
};
|
|
15682
15254
|
var RadioMenuItem = ({ label, checked, onClick }) => {
|
|
15683
15255
|
const { style: touchStyle, ...touchHandlers } = useMobileTouch(onClick);
|
|
15684
|
-
return /* @__PURE__ */
|
|
15256
|
+
return /* @__PURE__ */ jsxs14(
|
|
15685
15257
|
"div",
|
|
15686
15258
|
{
|
|
15687
|
-
className:
|
|
15259
|
+
className: css2`
|
|
15688
15260
|
margin-top: 2px;
|
|
15689
15261
|
padding: 4px;
|
|
15690
15262
|
padding-left: 8px;
|
|
@@ -15701,9 +15273,9 @@ var RadioMenuItem = ({ label, checked, onClick }) => {
|
|
|
15701
15273
|
...touchHandlers,
|
|
15702
15274
|
style: touchStyle,
|
|
15703
15275
|
children: [
|
|
15704
|
-
/* @__PURE__ */
|
|
15276
|
+
/* @__PURE__ */ jsx20("input", { type: "radio", checked, onChange: () => {
|
|
15705
15277
|
}, readOnly: true }),
|
|
15706
|
-
/* @__PURE__ */
|
|
15278
|
+
/* @__PURE__ */ jsx20("span", { style: { color: "#eee" }, children: label })
|
|
15707
15279
|
]
|
|
15708
15280
|
}
|
|
15709
15281
|
);
|
|
@@ -15767,12 +15339,12 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15767
15339
|
setHoveredErrorId: s.setHoveredErrorId,
|
|
15768
15340
|
setFocusedErrorId: s.setFocusedErrorId
|
|
15769
15341
|
}));
|
|
15770
|
-
const [isViewMenuOpen, setViewMenuOpen] =
|
|
15771
|
-
const [isLayerMenuOpen, setLayerMenuOpen] =
|
|
15772
|
-
const [isErrorsOpen, setErrorsOpen] =
|
|
15773
|
-
const [measureToolArmed, setMeasureToolArmed] =
|
|
15774
|
-
const [boundsToolArmed, setBoundsToolArmed] =
|
|
15775
|
-
|
|
15342
|
+
const [isViewMenuOpen, setViewMenuOpen] = useState10(false);
|
|
15343
|
+
const [isLayerMenuOpen, setLayerMenuOpen] = useState10(false);
|
|
15344
|
+
const [isErrorsOpen, setErrorsOpen] = useState10(false);
|
|
15345
|
+
const [measureToolArmed, setMeasureToolArmed] = useState10(false);
|
|
15346
|
+
const [boundsToolArmed, setBoundsToolArmed] = useState10(false);
|
|
15347
|
+
useEffect15(() => {
|
|
15776
15348
|
const arm = () => setMeasureToolArmed(true);
|
|
15777
15349
|
const disarm = () => setMeasureToolArmed(false);
|
|
15778
15350
|
const armBounds = () => setBoundsToolArmed(true);
|
|
@@ -15790,8 +15362,8 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15790
15362
|
}, []);
|
|
15791
15363
|
const availableLayers = getCopperLayerRefsFromElements(elements ?? []);
|
|
15792
15364
|
const processedLayers = availableLayers;
|
|
15793
|
-
const hasRunInitialMouseCheck =
|
|
15794
|
-
const hotkeyBoundaryRef =
|
|
15365
|
+
const hasRunInitialMouseCheck = useRef12(false);
|
|
15366
|
+
const hotkeyBoundaryRef = useRef12(null);
|
|
15795
15367
|
const hotKeyCallbacks = {
|
|
15796
15368
|
"1": availableLayers[0] ? () => selectLayer(availableLayers[0]) : () => {
|
|
15797
15369
|
},
|
|
@@ -15898,7 +15470,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15898
15470
|
},
|
|
15899
15471
|
[]
|
|
15900
15472
|
);
|
|
15901
|
-
return /* @__PURE__ */
|
|
15473
|
+
return /* @__PURE__ */ jsxs14(
|
|
15902
15474
|
"div",
|
|
15903
15475
|
{
|
|
15904
15476
|
ref: hotkeyBoundaryRef,
|
|
@@ -15908,7 +15480,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15908
15480
|
onMouseMove: handleMouseMove,
|
|
15909
15481
|
children: [
|
|
15910
15482
|
children,
|
|
15911
|
-
/* @__PURE__ */
|
|
15483
|
+
/* @__PURE__ */ jsxs14(
|
|
15912
15484
|
"div",
|
|
15913
15485
|
{
|
|
15914
15486
|
style: {
|
|
@@ -15929,7 +15501,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15929
15501
|
]
|
|
15930
15502
|
}
|
|
15931
15503
|
),
|
|
15932
|
-
/* @__PURE__ */
|
|
15504
|
+
/* @__PURE__ */ jsxs14(
|
|
15933
15505
|
"div",
|
|
15934
15506
|
{
|
|
15935
15507
|
"data-toolbar-overlay": true,
|
|
@@ -15960,7 +15532,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15960
15532
|
fontFamily: "sans-serif"
|
|
15961
15533
|
},
|
|
15962
15534
|
children: [
|
|
15963
|
-
/* @__PURE__ */
|
|
15535
|
+
/* @__PURE__ */ jsxs14(
|
|
15964
15536
|
ToolbarButton,
|
|
15965
15537
|
{
|
|
15966
15538
|
isSmallScreen,
|
|
@@ -15971,10 +15543,10 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15971
15543
|
}
|
|
15972
15544
|
},
|
|
15973
15545
|
children: [
|
|
15974
|
-
/* @__PURE__ */
|
|
15546
|
+
/* @__PURE__ */ jsxs14("div", { children: [
|
|
15975
15547
|
"layer:",
|
|
15976
15548
|
" ",
|
|
15977
|
-
/* @__PURE__ */
|
|
15549
|
+
/* @__PURE__ */ jsx20(
|
|
15978
15550
|
"span",
|
|
15979
15551
|
{
|
|
15980
15552
|
style: {
|
|
@@ -15986,7 +15558,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
15986
15558
|
}
|
|
15987
15559
|
)
|
|
15988
15560
|
] }),
|
|
15989
|
-
isLayerMenuOpen && /* @__PURE__ */
|
|
15561
|
+
isLayerMenuOpen && /* @__PURE__ */ jsx20("div", { style: { marginTop: 4, minWidth: 120 }, children: processedLayers.map((layer) => /* @__PURE__ */ jsx20(
|
|
15990
15562
|
LayerButton,
|
|
15991
15563
|
{
|
|
15992
15564
|
name: layer,
|
|
@@ -16000,7 +15572,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16000
15572
|
]
|
|
16001
15573
|
}
|
|
16002
15574
|
),
|
|
16003
|
-
/* @__PURE__ */
|
|
15575
|
+
/* @__PURE__ */ jsx20(
|
|
16004
15576
|
ToolbarErrorDropdown,
|
|
16005
15577
|
{
|
|
16006
15578
|
elements,
|
|
@@ -16012,43 +15584,43 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16012
15584
|
setFocusedErrorId
|
|
16013
15585
|
}
|
|
16014
15586
|
),
|
|
16015
|
-
/* @__PURE__ */
|
|
15587
|
+
/* @__PURE__ */ jsx20(
|
|
16016
15588
|
ToolbarButton,
|
|
16017
15589
|
{
|
|
16018
15590
|
isSmallScreen,
|
|
16019
15591
|
style: {},
|
|
16020
15592
|
onClick: handleRatsNestToggle,
|
|
16021
|
-
children: /* @__PURE__ */
|
|
15593
|
+
children: /* @__PURE__ */ jsxs14("div", { children: [
|
|
16022
15594
|
viewSettings.is_showing_rats_nest ? "\u2716 " : "",
|
|
16023
15595
|
"Rats Nest"
|
|
16024
15596
|
] })
|
|
16025
15597
|
}
|
|
16026
15598
|
),
|
|
16027
|
-
/* @__PURE__ */
|
|
15599
|
+
/* @__PURE__ */ jsx20(
|
|
16028
15600
|
ToolbarButton,
|
|
16029
15601
|
{
|
|
16030
15602
|
isSmallScreen,
|
|
16031
15603
|
style: measureToolArmed ? { backgroundColor: "#444" } : {},
|
|
16032
15604
|
onClick: handleMeasureToolClick,
|
|
16033
|
-
children: /* @__PURE__ */
|
|
15605
|
+
children: /* @__PURE__ */ jsx20("div", { children: "\u{1F4CF}" })
|
|
16034
15606
|
}
|
|
16035
15607
|
),
|
|
16036
|
-
/* @__PURE__ */
|
|
15608
|
+
/* @__PURE__ */ jsx20(
|
|
16037
15609
|
ToolbarButton,
|
|
16038
15610
|
{
|
|
16039
15611
|
isSmallScreen,
|
|
16040
15612
|
style: boundsToolArmed ? { backgroundColor: "#444" } : {},
|
|
16041
15613
|
onClick: handleBoundsToolClick,
|
|
16042
|
-
children: /* @__PURE__ */
|
|
15614
|
+
children: /* @__PURE__ */ jsx20("div", { children: "Bounds" })
|
|
16043
15615
|
}
|
|
16044
15616
|
),
|
|
16045
|
-
/* @__PURE__ */
|
|
15617
|
+
/* @__PURE__ */ jsx20(
|
|
16046
15618
|
ToolbarButton,
|
|
16047
15619
|
{
|
|
16048
15620
|
isSmallScreen,
|
|
16049
15621
|
onClick: handleViewMenuToggle,
|
|
16050
|
-
children: /* @__PURE__ */
|
|
16051
|
-
/* @__PURE__ */
|
|
15622
|
+
children: /* @__PURE__ */ jsxs14("div", { children: [
|
|
15623
|
+
/* @__PURE__ */ jsxs14(
|
|
16052
15624
|
"div",
|
|
16053
15625
|
{
|
|
16054
15626
|
style: {
|
|
@@ -16058,7 +15630,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16058
15630
|
},
|
|
16059
15631
|
children: [
|
|
16060
15632
|
"View",
|
|
16061
|
-
/* @__PURE__ */
|
|
15633
|
+
/* @__PURE__ */ jsx20(
|
|
16062
15634
|
"span",
|
|
16063
15635
|
{
|
|
16064
15636
|
style: {
|
|
@@ -16073,8 +15645,8 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16073
15645
|
]
|
|
16074
15646
|
}
|
|
16075
15647
|
),
|
|
16076
|
-
isViewMenuOpen && /* @__PURE__ */
|
|
16077
|
-
/* @__PURE__ */
|
|
15648
|
+
isViewMenuOpen && /* @__PURE__ */ jsxs14("div", { style: { marginTop: 4, minWidth: 120 }, children: [
|
|
15649
|
+
/* @__PURE__ */ jsx20(
|
|
16078
15650
|
CheckboxMenuItem,
|
|
16079
15651
|
{
|
|
16080
15652
|
label: "Show All Trace Lengths",
|
|
@@ -16086,7 +15658,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16086
15658
|
}
|
|
16087
15659
|
}
|
|
16088
15660
|
),
|
|
16089
|
-
/* @__PURE__ */
|
|
15661
|
+
/* @__PURE__ */ jsx20(
|
|
16090
15662
|
CheckboxMenuItem,
|
|
16091
15663
|
{
|
|
16092
15664
|
label: "Show Autorouting Animation",
|
|
@@ -16098,7 +15670,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16098
15670
|
}
|
|
16099
15671
|
}
|
|
16100
15672
|
),
|
|
16101
|
-
/* @__PURE__ */
|
|
15673
|
+
/* @__PURE__ */ jsx20(
|
|
16102
15674
|
CheckboxMenuItem,
|
|
16103
15675
|
{
|
|
16104
15676
|
label: "Show DRC Errors",
|
|
@@ -16108,7 +15680,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16108
15680
|
}
|
|
16109
15681
|
}
|
|
16110
15682
|
),
|
|
16111
|
-
/* @__PURE__ */
|
|
15683
|
+
/* @__PURE__ */ jsx20(
|
|
16112
15684
|
CheckboxMenuItem,
|
|
16113
15685
|
{
|
|
16114
15686
|
label: "Show Copper Pours",
|
|
@@ -16120,7 +15692,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16120
15692
|
}
|
|
16121
15693
|
}
|
|
16122
15694
|
),
|
|
16123
|
-
/* @__PURE__ */
|
|
15695
|
+
/* @__PURE__ */ jsx20(
|
|
16124
15696
|
CheckboxMenuItem,
|
|
16125
15697
|
{
|
|
16126
15698
|
label: "Show Courtyards",
|
|
@@ -16130,7 +15702,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16130
15702
|
}
|
|
16131
15703
|
}
|
|
16132
15704
|
),
|
|
16133
|
-
/* @__PURE__ */
|
|
15705
|
+
/* @__PURE__ */ jsx20(
|
|
16134
15706
|
CheckboxMenuItem,
|
|
16135
15707
|
{
|
|
16136
15708
|
label: "Show Solder Mask",
|
|
@@ -16140,7 +15712,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16140
15712
|
}
|
|
16141
15713
|
}
|
|
16142
15714
|
),
|
|
16143
|
-
/* @__PURE__ */
|
|
15715
|
+
/* @__PURE__ */ jsx20(
|
|
16144
15716
|
CheckboxMenuItem,
|
|
16145
15717
|
{
|
|
16146
15718
|
label: "Show Silkscreen",
|
|
@@ -16150,7 +15722,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16150
15722
|
}
|
|
16151
15723
|
}
|
|
16152
15724
|
),
|
|
16153
|
-
/* @__PURE__ */
|
|
15725
|
+
/* @__PURE__ */ jsx20(
|
|
16154
15726
|
CheckboxMenuItem,
|
|
16155
15727
|
{
|
|
16156
15728
|
label: "Show Fabrication Notes",
|
|
@@ -16162,7 +15734,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16162
15734
|
}
|
|
16163
15735
|
}
|
|
16164
15736
|
),
|
|
16165
|
-
/* @__PURE__ */
|
|
15737
|
+
/* @__PURE__ */ jsx20(
|
|
16166
15738
|
CheckboxMenuItem,
|
|
16167
15739
|
{
|
|
16168
15740
|
label: "Show PCB Notes",
|
|
@@ -16172,7 +15744,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16172
15744
|
}
|
|
16173
15745
|
}
|
|
16174
15746
|
),
|
|
16175
|
-
/* @__PURE__ */
|
|
15747
|
+
/* @__PURE__ */ jsx20(
|
|
16176
15748
|
CheckboxMenuItem,
|
|
16177
15749
|
{
|
|
16178
15750
|
label: "Show Group Anchor Offsets",
|
|
@@ -16184,7 +15756,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16184
15756
|
}
|
|
16185
15757
|
}
|
|
16186
15758
|
),
|
|
16187
|
-
/* @__PURE__ */
|
|
15759
|
+
/* @__PURE__ */ jsx20(
|
|
16188
15760
|
CheckboxMenuItem,
|
|
16189
15761
|
{
|
|
16190
15762
|
label: "Show PCB Groups",
|
|
@@ -16194,8 +15766,8 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16194
15766
|
}
|
|
16195
15767
|
}
|
|
16196
15768
|
),
|
|
16197
|
-
viewSettings.is_showing_pcb_groups && /* @__PURE__ */
|
|
16198
|
-
/* @__PURE__ */
|
|
15769
|
+
viewSettings.is_showing_pcb_groups && /* @__PURE__ */ jsxs14("div", { style: { marginLeft: 16 }, children: [
|
|
15770
|
+
/* @__PURE__ */ jsx20(
|
|
16199
15771
|
RadioMenuItem,
|
|
16200
15772
|
{
|
|
16201
15773
|
label: "Show All Groups",
|
|
@@ -16205,7 +15777,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16205
15777
|
}
|
|
16206
15778
|
}
|
|
16207
15779
|
),
|
|
16208
|
-
/* @__PURE__ */
|
|
15780
|
+
/* @__PURE__ */ jsx20(
|
|
16209
15781
|
RadioMenuItem,
|
|
16210
15782
|
{
|
|
16211
15783
|
label: "Show Named Groups",
|
|
@@ -16229,17 +15801,17 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
16229
15801
|
};
|
|
16230
15802
|
|
|
16231
15803
|
// src/components/WarningGraphicsOverlay.tsx
|
|
16232
|
-
import { useEffect as
|
|
16233
|
-
import { applyToPoint as
|
|
16234
|
-
import { jsx as
|
|
15804
|
+
import { useEffect as useEffect16, useRef as useRef13 } from "react";
|
|
15805
|
+
import { applyToPoint as applyToPoint15, identity as identity8 } from "transformation-matrix";
|
|
15806
|
+
import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
16235
15807
|
var WarningGraphicsOverlay = ({
|
|
16236
15808
|
children,
|
|
16237
|
-
transform =
|
|
15809
|
+
transform = identity8(),
|
|
16238
15810
|
elements = []
|
|
16239
15811
|
}) => {
|
|
16240
15812
|
const [containerRef, { width, height }] = useMeasure_default();
|
|
16241
|
-
const canvasRef =
|
|
16242
|
-
|
|
15813
|
+
const canvasRef = useRef13(null);
|
|
15814
|
+
useEffect16(() => {
|
|
16243
15815
|
const canvas = canvasRef.current;
|
|
16244
15816
|
if (!canvas || !width || !height) return;
|
|
16245
15817
|
canvas.width = width;
|
|
@@ -16261,7 +15833,7 @@ var WarningGraphicsOverlay = ({
|
|
|
16261
15833
|
);
|
|
16262
15834
|
if (!component) return;
|
|
16263
15835
|
const { width: width2, height: height2, center } = component;
|
|
16264
|
-
const transformedCenter =
|
|
15836
|
+
const transformedCenter = applyToPoint15(transform, center);
|
|
16265
15837
|
const scaledWidth = width2 * Math.abs(transform.a);
|
|
16266
15838
|
const scaledHeight = height2 * Math.abs(transform.d);
|
|
16267
15839
|
const boxPadding = 0.1 * Math.abs(transform.a);
|
|
@@ -16291,14 +15863,14 @@ var WarningGraphicsOverlay = ({
|
|
|
16291
15863
|
ctx.fillText(labelText, labelX + labelWidth / 2, labelY + labelHeight / 2);
|
|
16292
15864
|
});
|
|
16293
15865
|
}, [elements, transform, width, height]);
|
|
16294
|
-
return /* @__PURE__ */
|
|
15866
|
+
return /* @__PURE__ */ jsxs15(
|
|
16295
15867
|
"div",
|
|
16296
15868
|
{
|
|
16297
15869
|
ref: containerRef,
|
|
16298
15870
|
style: { position: "relative", width: "100%", height: "100%" },
|
|
16299
15871
|
children: [
|
|
16300
15872
|
children,
|
|
16301
|
-
/* @__PURE__ */
|
|
15873
|
+
/* @__PURE__ */ jsx21(
|
|
16302
15874
|
"canvas",
|
|
16303
15875
|
{
|
|
16304
15876
|
ref: canvasRef,
|
|
@@ -16317,7 +15889,7 @@ var WarningGraphicsOverlay = ({
|
|
|
16317
15889
|
};
|
|
16318
15890
|
|
|
16319
15891
|
// src/components/CanvasElementsRenderer.tsx
|
|
16320
|
-
import { jsx as
|
|
15892
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
16321
15893
|
var CanvasElementsRenderer = (props) => {
|
|
16322
15894
|
const { transform, elements } = props;
|
|
16323
15895
|
const {
|
|
@@ -16345,13 +15917,13 @@ var CanvasElementsRenderer = (props) => {
|
|
|
16345
15917
|
);
|
|
16346
15918
|
return [primitivesWithoutInteractionMetadata2, connectivityMap2];
|
|
16347
15919
|
}, [elementsToRender, props.elements]);
|
|
16348
|
-
const [hoverState, setHoverState] =
|
|
15920
|
+
const [hoverState, setHoverState] = useState11({
|
|
16349
15921
|
drawingObjectIdsWithMouseOver: /* @__PURE__ */ new Set(),
|
|
16350
15922
|
primitiveIdsInMousedOverNet: []
|
|
16351
15923
|
});
|
|
16352
|
-
const [hoveredComponentIds, setHoveredComponentIds] =
|
|
16353
|
-
const currentTransformRef =
|
|
16354
|
-
const zoomAnimationFrameRef =
|
|
15924
|
+
const [hoveredComponentIds, setHoveredComponentIds] = useState11([]);
|
|
15925
|
+
const currentTransformRef = useRef14(transform ?? null);
|
|
15926
|
+
const zoomAnimationFrameRef = useRef14(null);
|
|
16355
15927
|
const elementIndexes = useMemo8(
|
|
16356
15928
|
() => buildErrorPreviewElementIndexes(elements),
|
|
16357
15929
|
[elements]
|
|
@@ -16367,17 +15939,17 @@ var CanvasElementsRenderer = (props) => {
|
|
|
16367
15939
|
if (!activeError) return [];
|
|
16368
15940
|
return getRelatedIdsForError(activeError);
|
|
16369
15941
|
}, [activeErrorId, elements]);
|
|
16370
|
-
|
|
15942
|
+
useEffect17(() => {
|
|
16371
15943
|
if (transform) {
|
|
16372
15944
|
currentTransformRef.current = transform;
|
|
16373
15945
|
}
|
|
16374
15946
|
}, [transform]);
|
|
16375
|
-
|
|
15947
|
+
useEffect17(() => {
|
|
16376
15948
|
return () => {
|
|
16377
15949
|
cancelTransformAnimation(zoomAnimationFrameRef.current);
|
|
16378
15950
|
};
|
|
16379
15951
|
}, []);
|
|
16380
|
-
|
|
15952
|
+
useEffect17(() => {
|
|
16381
15953
|
if (!props.width || !props.height || !props.setTransform || !focusedErrorId)
|
|
16382
15954
|
return;
|
|
16383
15955
|
const focusedError = findErrorElementById(elements, focusedErrorId);
|
|
@@ -16459,7 +16031,7 @@ var CanvasElementsRenderer = (props) => {
|
|
|
16459
16031
|
},
|
|
16460
16032
|
[connectivityMap]
|
|
16461
16033
|
);
|
|
16462
|
-
return /* @__PURE__ */
|
|
16034
|
+
return /* @__PURE__ */ jsx22(
|
|
16463
16035
|
MouseElementTracker,
|
|
16464
16036
|
{
|
|
16465
16037
|
elements: elementsToRender,
|
|
@@ -16467,7 +16039,7 @@ var CanvasElementsRenderer = (props) => {
|
|
|
16467
16039
|
primitives: primitivesWithoutInteractionMetadata,
|
|
16468
16040
|
selectedLayer,
|
|
16469
16041
|
onMouseHoverOverPrimitives: onMouseOverPrimitives,
|
|
16470
|
-
children: /* @__PURE__ */
|
|
16042
|
+
children: /* @__PURE__ */ jsx22(
|
|
16471
16043
|
EditPlacementOverlay,
|
|
16472
16044
|
{
|
|
16473
16045
|
disabled: !props.allowEditing,
|
|
@@ -16476,58 +16048,47 @@ var CanvasElementsRenderer = (props) => {
|
|
|
16476
16048
|
cancelPanDrag: props.cancelPanDrag,
|
|
16477
16049
|
onCreateEditEvent: props.onCreateEditEvent,
|
|
16478
16050
|
onModifyEditEvent: props.onModifyEditEvent,
|
|
16479
|
-
children: /* @__PURE__ */
|
|
16480
|
-
|
|
16051
|
+
children: /* @__PURE__ */ jsx22(
|
|
16052
|
+
DimensionOverlay,
|
|
16481
16053
|
{
|
|
16482
|
-
disabled: !props.allowEditing,
|
|
16483
16054
|
transform,
|
|
16484
|
-
|
|
16055
|
+
focusOnHover: props.focusOnHover,
|
|
16056
|
+
primitives: primitivesWithoutInteractionMetadata,
|
|
16057
|
+
onBoundsSelected: props.onBoundsSelected,
|
|
16485
16058
|
cancelPanDrag: props.cancelPanDrag,
|
|
16486
|
-
|
|
16487
|
-
|
|
16488
|
-
children: /* @__PURE__ */ jsx24(
|
|
16489
|
-
DimensionOverlay,
|
|
16059
|
+
children: /* @__PURE__ */ jsx22(ToolbarOverlay, { elements, children: /* @__PURE__ */ jsx22(ErrorOverlay, { transform, elements, children: /* @__PURE__ */ jsx22(RatsNestOverlay, { transform, soup: elements, children: /* @__PURE__ */ jsx22(
|
|
16060
|
+
PcbGroupOverlay,
|
|
16490
16061
|
{
|
|
16491
16062
|
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,
|
|
16063
|
+
elements,
|
|
16064
|
+
hoveredComponentIds,
|
|
16065
|
+
children: /* @__PURE__ */ jsx22(
|
|
16066
|
+
DebugGraphicsOverlay,
|
|
16498
16067
|
{
|
|
16499
16068
|
transform,
|
|
16500
|
-
|
|
16501
|
-
|
|
16502
|
-
|
|
16503
|
-
DebugGraphicsOverlay,
|
|
16069
|
+
debugGraphics: props.debugGraphics,
|
|
16070
|
+
children: /* @__PURE__ */ jsx22(
|
|
16071
|
+
WarningGraphicsOverlay,
|
|
16504
16072
|
{
|
|
16505
16073
|
transform,
|
|
16506
|
-
|
|
16507
|
-
children: /* @__PURE__ */
|
|
16508
|
-
|
|
16074
|
+
elements,
|
|
16075
|
+
children: /* @__PURE__ */ jsx22(
|
|
16076
|
+
CanvasPrimitiveRenderer,
|
|
16509
16077
|
{
|
|
16510
16078
|
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
|
-
)
|
|
16079
|
+
primitives,
|
|
16080
|
+
elements: elementsToRender,
|
|
16081
|
+
width: props.width,
|
|
16082
|
+
height: props.height,
|
|
16083
|
+
grid: props.grid
|
|
16523
16084
|
}
|
|
16524
16085
|
)
|
|
16525
16086
|
}
|
|
16526
16087
|
)
|
|
16527
16088
|
}
|
|
16528
|
-
)
|
|
16089
|
+
)
|
|
16529
16090
|
}
|
|
16530
|
-
)
|
|
16091
|
+
) }) }) })
|
|
16531
16092
|
}
|
|
16532
16093
|
)
|
|
16533
16094
|
}
|
|
@@ -16591,7 +16152,7 @@ var calculateBoardSizeKey = (circuitJson) => {
|
|
|
16591
16152
|
};
|
|
16592
16153
|
|
|
16593
16154
|
// src/PCBViewer.tsx
|
|
16594
|
-
import { jsx as
|
|
16155
|
+
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
16595
16156
|
var defaultTransform = compose8(translate12(400, 300), scale6(40, -40));
|
|
16596
16157
|
var PCBViewer = ({
|
|
16597
16158
|
circuitJson,
|
|
@@ -16606,11 +16167,11 @@ var PCBViewer = ({
|
|
|
16606
16167
|
clickToInteractEnabled = false,
|
|
16607
16168
|
disablePcbGroups = false
|
|
16608
16169
|
}) => {
|
|
16609
|
-
const [isInteractionEnabled, setIsInteractionEnabled] =
|
|
16170
|
+
const [isInteractionEnabled, setIsInteractionEnabled] = useState12(
|
|
16610
16171
|
!clickToInteractEnabled
|
|
16611
16172
|
);
|
|
16612
16173
|
const [ref, refDimensions] = useMeasure_default();
|
|
16613
|
-
const [transform, setTransformInternal] =
|
|
16174
|
+
const [transform, setTransformInternal] = useState12(defaultTransform);
|
|
16614
16175
|
const shouldAllowCanvasInteraction = useCallback12(
|
|
16615
16176
|
(event) => {
|
|
16616
16177
|
const target = event.target;
|
|
@@ -16629,10 +16190,10 @@ var PCBViewer = ({
|
|
|
16629
16190
|
enabled: isInteractionEnabled,
|
|
16630
16191
|
shouldDrag: shouldAllowCanvasInteraction
|
|
16631
16192
|
});
|
|
16632
|
-
let [editEvents, setEditEvents] =
|
|
16193
|
+
let [editEvents, setEditEvents] = useState12([]);
|
|
16633
16194
|
editEvents = editEventsProp ?? editEvents;
|
|
16634
|
-
const initialRenderCompleted =
|
|
16635
|
-
const touchStartRef =
|
|
16195
|
+
const initialRenderCompleted = useRef15(false);
|
|
16196
|
+
const touchStartRef = useRef15(null);
|
|
16636
16197
|
const circuitJsonKey = useMemo9(
|
|
16637
16198
|
() => calculateCircuitJsonKey(circuitJson),
|
|
16638
16199
|
[circuitJson]
|
|
@@ -16658,7 +16219,7 @@ var PCBViewer = ({
|
|
|
16658
16219
|
setTransform(targetTransform);
|
|
16659
16220
|
return;
|
|
16660
16221
|
};
|
|
16661
|
-
|
|
16222
|
+
useEffect18(() => {
|
|
16662
16223
|
if (!refDimensions?.width) return;
|
|
16663
16224
|
if (!circuitJson) return;
|
|
16664
16225
|
if (circuitJson.length === 0) return;
|
|
@@ -16667,7 +16228,7 @@ var PCBViewer = ({
|
|
|
16667
16228
|
initialRenderCompleted.current = true;
|
|
16668
16229
|
}
|
|
16669
16230
|
}, [circuitJson, refDimensions]);
|
|
16670
|
-
|
|
16231
|
+
useEffect18(() => {
|
|
16671
16232
|
if (initialRenderCompleted.current === true) {
|
|
16672
16233
|
resetTransform();
|
|
16673
16234
|
}
|
|
@@ -16701,20 +16262,20 @@ var PCBViewer = ({
|
|
|
16701
16262
|
}),
|
|
16702
16263
|
[initialState, disablePcbGroups]
|
|
16703
16264
|
);
|
|
16704
|
-
return /* @__PURE__ */
|
|
16265
|
+
return /* @__PURE__ */ jsxs16(
|
|
16705
16266
|
"div",
|
|
16706
16267
|
{
|
|
16707
16268
|
ref: transformRef,
|
|
16708
16269
|
style: { position: "relative" },
|
|
16709
16270
|
onContextMenu: (event) => event.preventDefault(),
|
|
16710
16271
|
children: [
|
|
16711
|
-
/* @__PURE__ */
|
|
16272
|
+
/* @__PURE__ */ jsx23("div", { ref, children: /* @__PURE__ */ jsxs16(
|
|
16712
16273
|
ContextProviders,
|
|
16713
16274
|
{
|
|
16714
16275
|
initialState: mergedInitialState,
|
|
16715
16276
|
disablePcbGroups,
|
|
16716
16277
|
children: [
|
|
16717
|
-
/* @__PURE__ */
|
|
16278
|
+
/* @__PURE__ */ jsx23(
|
|
16718
16279
|
CanvasElementsRenderer,
|
|
16719
16280
|
{
|
|
16720
16281
|
transform,
|
|
@@ -16741,11 +16302,11 @@ var PCBViewer = ({
|
|
|
16741
16302
|
},
|
|
16742
16303
|
refDimensions.width
|
|
16743
16304
|
),
|
|
16744
|
-
/* @__PURE__ */
|
|
16305
|
+
/* @__PURE__ */ jsx23(ToastContainer, {})
|
|
16745
16306
|
]
|
|
16746
16307
|
}
|
|
16747
16308
|
) }),
|
|
16748
|
-
clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */
|
|
16309
|
+
clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */ jsx23(
|
|
16749
16310
|
"div",
|
|
16750
16311
|
{
|
|
16751
16312
|
onClick: () => {
|
|
@@ -16782,7 +16343,7 @@ var PCBViewer = ({
|
|
|
16782
16343
|
justifyContent: "center",
|
|
16783
16344
|
touchAction: "pan-x pan-y pinch-zoom"
|
|
16784
16345
|
},
|
|
16785
|
-
children: /* @__PURE__ */
|
|
16346
|
+
children: /* @__PURE__ */ jsx23(
|
|
16786
16347
|
"div",
|
|
16787
16348
|
{
|
|
16788
16349
|
style: {
|