@tscircuit/pcb-viewer 1.11.403 → 1.11.405
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +62 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4354,6 +4354,27 @@ function getXRayDisplayName(element, elements, connectivityMap) {
|
|
|
4354
4354
|
}
|
|
4355
4355
|
return "Net";
|
|
4356
4356
|
}
|
|
4357
|
+
function getXRayGroups(netId, elements, connectivityMap) {
|
|
4358
|
+
return elements.flatMap((element) => {
|
|
4359
|
+
if (element.type !== "source_bus") return [];
|
|
4360
|
+
const netIds = [
|
|
4361
|
+
...new Set(
|
|
4362
|
+
element.source_trace_ids.flatMap((id) => {
|
|
4363
|
+
const net = connectivityMap.getNetConnectedToId(id);
|
|
4364
|
+
return net ? [net] : [];
|
|
4365
|
+
})
|
|
4366
|
+
)
|
|
4367
|
+
];
|
|
4368
|
+
if (!netIds.includes(netId)) return [];
|
|
4369
|
+
return [
|
|
4370
|
+
{
|
|
4371
|
+
id: element.source_bus_id,
|
|
4372
|
+
name: element.name?.trim() || "Bus",
|
|
4373
|
+
netIds
|
|
4374
|
+
}
|
|
4375
|
+
];
|
|
4376
|
+
});
|
|
4377
|
+
}
|
|
4357
4378
|
|
|
4358
4379
|
// src/lib/webgpu/create-worker.ts
|
|
4359
4380
|
var createWebGpuWorker = async () => {
|
|
@@ -10521,8 +10542,7 @@ var MouseElementTracker = ({
|
|
|
10521
10542
|
transform,
|
|
10522
10543
|
primitives,
|
|
10523
10544
|
selectedLayer,
|
|
10524
|
-
onMouseHoverOverPrimitives
|
|
10525
|
-
disableHoverHighlights = false
|
|
10545
|
+
onMouseHoverOverPrimitives
|
|
10526
10546
|
}) => {
|
|
10527
10547
|
const [mousedPrimitives, setMousedPrimitives] = useState8([]);
|
|
10528
10548
|
const [mousePos, setMousePos] = useState8({ x: 0, y: 0 });
|
|
@@ -10530,10 +10550,9 @@ var MouseElementTracker = ({
|
|
|
10530
10550
|
useEffect11(() => {
|
|
10531
10551
|
setMousedPrimitives([]);
|
|
10532
10552
|
onMouseHoverOverPrimitives([]);
|
|
10533
|
-
}, [selectedLayer, onMouseHoverOverPrimitives]);
|
|
10553
|
+
}, [selectedLayer, primitives, onMouseHoverOverPrimitives]);
|
|
10534
10554
|
const highlightedPrimitives = useMemo7(() => {
|
|
10535
10555
|
const highlightedPrimitives2 = [];
|
|
10536
|
-
if (disableHoverHighlights) return highlightedPrimitives2;
|
|
10537
10556
|
for (const primitive of mousedPrimitives) {
|
|
10538
10557
|
if (primitive._element?.type === "pcb_via") continue;
|
|
10539
10558
|
if (primitive._element?.type === "pcb_component") continue;
|
|
@@ -10593,7 +10612,7 @@ var MouseElementTracker = ({
|
|
|
10593
10612
|
});
|
|
10594
10613
|
}
|
|
10595
10614
|
return highlightedPrimitives2;
|
|
10596
|
-
}, [mousedPrimitives, transform
|
|
10615
|
+
}, [mousedPrimitives, transform]);
|
|
10597
10616
|
const handleInteraction = (x, y, transform2, primitives2) => {
|
|
10598
10617
|
setMousePos({ x, y });
|
|
10599
10618
|
const rwPoint = applyToPoint15(inverse5(transform2), { x, y });
|
|
@@ -11073,7 +11092,7 @@ import { css as css3 } from "@emotion/css";
|
|
|
11073
11092
|
// package.json
|
|
11074
11093
|
var package_default = {
|
|
11075
11094
|
name: "@tscircuit/pcb-viewer",
|
|
11076
|
-
version: "1.11.
|
|
11095
|
+
version: "1.11.404",
|
|
11077
11096
|
main: "dist/index.js",
|
|
11078
11097
|
type: "module",
|
|
11079
11098
|
repository: {
|
|
@@ -11270,6 +11289,8 @@ var VisibilityContextMenu = ({
|
|
|
11270
11289
|
position,
|
|
11271
11290
|
onClose,
|
|
11272
11291
|
onXRayNet,
|
|
11292
|
+
xRayGroups = [],
|
|
11293
|
+
onXRayGroup,
|
|
11273
11294
|
xRayDisplayName = "Net",
|
|
11274
11295
|
onExitXRayNet
|
|
11275
11296
|
}) => {
|
|
@@ -11392,6 +11413,24 @@ var VisibilityContextMenu = ({
|
|
|
11392
11413
|
]
|
|
11393
11414
|
}
|
|
11394
11415
|
),
|
|
11416
|
+
onXRayGroup && xRayGroups.map((group) => /* @__PURE__ */ jsxs15(
|
|
11417
|
+
"button",
|
|
11418
|
+
{
|
|
11419
|
+
type: "button",
|
|
11420
|
+
role: "menuitem",
|
|
11421
|
+
className: itemStyle,
|
|
11422
|
+
style: { whiteSpace: "normal", overflowWrap: "anywhere" },
|
|
11423
|
+
onClick: () => {
|
|
11424
|
+
onXRayGroup(group);
|
|
11425
|
+
onClose();
|
|
11426
|
+
},
|
|
11427
|
+
children: [
|
|
11428
|
+
"X-Ray ",
|
|
11429
|
+
group.name
|
|
11430
|
+
]
|
|
11431
|
+
},
|
|
11432
|
+
group.id
|
|
11433
|
+
)),
|
|
11395
11434
|
onExitXRayNet && /* @__PURE__ */ jsx20(
|
|
11396
11435
|
"button",
|
|
11397
11436
|
{
|
|
@@ -12228,6 +12267,7 @@ var ToolbarOverlay = ({
|
|
|
12228
12267
|
setFocusedErrorId: s.setFocusedErrorId
|
|
12229
12268
|
}));
|
|
12230
12269
|
const [contextMenuPosition, setContextMenuPosition] = useState12(null);
|
|
12270
|
+
const [contextGroups, setContextGroups] = useState12([]);
|
|
12231
12271
|
const [contextNetId, setContextNetId] = useState12();
|
|
12232
12272
|
const [contextNetDisplayName, setContextNetDisplayName] = useState12("Net");
|
|
12233
12273
|
const pointerStart = useRef14(null);
|
|
@@ -12398,6 +12438,7 @@ var ToolbarOverlay = ({
|
|
|
12398
12438
|
} else {
|
|
12399
12439
|
setContextNetId(net);
|
|
12400
12440
|
setContextNetDisplayName(hit.displayName);
|
|
12441
|
+
setContextGroups(hit.groups);
|
|
12401
12442
|
onContextMenuOpenChange?.(true);
|
|
12402
12443
|
setContextMenuPosition({ x: event.clientX, y: event.clientY });
|
|
12403
12444
|
}
|
|
@@ -12412,6 +12453,7 @@ var ToolbarOverlay = ({
|
|
|
12412
12453
|
const hit = netAtEvent(event);
|
|
12413
12454
|
setContextNetId(hit?.netId);
|
|
12414
12455
|
setContextNetDisplayName(hit?.displayName ?? "Net");
|
|
12456
|
+
setContextGroups(hit?.groups ?? []);
|
|
12415
12457
|
onContextMenuOpenChange?.(true);
|
|
12416
12458
|
setContextMenuPosition({ x: event.clientX, y: event.clientY });
|
|
12417
12459
|
},
|
|
@@ -12427,6 +12469,10 @@ var ToolbarOverlay = ({
|
|
|
12427
12469
|
position: contextMenuPosition,
|
|
12428
12470
|
onClose: closeContextMenu,
|
|
12429
12471
|
xRayDisplayName: contextNetDisplayName,
|
|
12472
|
+
xRayGroups: contextGroups.filter(
|
|
12473
|
+
(group) => group.netIds.some((id) => !xRayNetIds.includes(id))
|
|
12474
|
+
),
|
|
12475
|
+
onXRayGroup: (group) => onXRayNetsChange?.([.../* @__PURE__ */ new Set([...xRayNetIds, ...group.netIds])]),
|
|
12430
12476
|
onXRayNet: contextNetId && !xRayNetIds.includes(contextNetId) ? () => onXRayNetsChange?.([...xRayNetIds, contextNetId]) : void 0,
|
|
12431
12477
|
onExitXRayNet: xRayNetIds.length > 0 ? () => onXRayNetsChange?.([]) : void 0
|
|
12432
12478
|
}
|
|
@@ -12913,11 +12959,19 @@ var CanvasElementsRenderer = (props) => {
|
|
|
12913
12959
|
) : void 0,
|
|
12914
12960
|
[elementsToRender, connectivityMap, xRayNetIds]
|
|
12915
12961
|
);
|
|
12962
|
+
const hoverPrimitives = useMemo10(() => {
|
|
12963
|
+
if (!xRayElements) return primitivesWithoutInteractionMetadata;
|
|
12964
|
+
const selectedElements = new Set(xRayElements);
|
|
12965
|
+
return primitivesWithoutInteractionMetadata.filter(
|
|
12966
|
+
(primitive) => (primitive._element?.type === "pcb_smtpad" || primitive._element?.type === "pcb_plated_hole") && selectedElements.has(primitive._element)
|
|
12967
|
+
);
|
|
12968
|
+
}, [primitivesWithoutInteractionMetadata, xRayElements]);
|
|
12916
12969
|
const getNetAtPoint = (point) => {
|
|
12917
12970
|
if (!transform) return void 0;
|
|
12918
12971
|
const describeNet = (netId, element) => ({
|
|
12919
12972
|
netId,
|
|
12920
|
-
displayName: getXRayDisplayName(element, elements, connectivityMap)
|
|
12973
|
+
displayName: getXRayDisplayName(element, elements, connectivityMap),
|
|
12974
|
+
groups: getXRayGroups(netId, elements, connectivityMap)
|
|
12921
12975
|
});
|
|
12922
12976
|
const hits = getPrimitivesUnderPoint(
|
|
12923
12977
|
primitivesWithoutInteractionMetadata,
|
|
@@ -13067,9 +13121,8 @@ var CanvasElementsRenderer = (props) => {
|
|
|
13067
13121
|
{
|
|
13068
13122
|
elements: elementsToRender,
|
|
13069
13123
|
transform,
|
|
13070
|
-
primitives:
|
|
13124
|
+
primitives: hoverPrimitives,
|
|
13071
13125
|
selectedLayer,
|
|
13072
|
-
disableHoverHighlights: xRayNetIds.length > 0,
|
|
13073
13126
|
onMouseHoverOverPrimitives: onMouseOverPrimitives,
|
|
13074
13127
|
children: /* @__PURE__ */ jsx25(
|
|
13075
13128
|
EditPlacementOverlay,
|