@tscircuit/pcb-viewer 1.11.408 → 1.11.410

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 CHANGED
@@ -15524,6 +15524,7 @@ var DimensionOverlay = ({
15524
15524
  const [boundsStart, setBoundsStart] = useState5({ x: 0, y: 0 });
15525
15525
  const [boundsEnd, setBoundsEnd] = useState5({ x: 0, y: 0 });
15526
15526
  const mousePosRef = useRef6({ x: 0, y: 0 });
15527
+ const measurementPointerDownRef = useRef6(false);
15527
15528
  const containerRef = useRef6(null);
15528
15529
  const container = containerRef.current;
15529
15530
  const containerBounds = container?.getBoundingClientRect();
@@ -15756,6 +15757,21 @@ var DimensionOverlay = ({
15756
15757
  "data-pcb-viewer": true,
15757
15758
  tabIndex: 0,
15758
15759
  style: { position: "relative", outline: "none" },
15760
+ onMouseDownCapture: () => {
15761
+ measurementPointerDownRef.current = false;
15762
+ },
15763
+ onClickCapture: (event) => {
15764
+ if (!measurementPointerDownRef.current) return;
15765
+ measurementPointerDownRef.current = false;
15766
+ event.stopPropagation();
15767
+ containerRef.current?.focus();
15768
+ },
15769
+ onContextMenuCapture: (event) => {
15770
+ if (!measureToolArmed && !dimensionToolVisible && !measurementPointerDownRef.current)
15771
+ return;
15772
+ event.preventDefault();
15773
+ event.stopPropagation();
15774
+ },
15759
15775
  onMouseEnter: () => {
15760
15776
  if (focusOnHover && containerRef.current) {
15761
15777
  containerRef.current.focus();
@@ -15789,6 +15805,7 @@ var DimensionOverlay = ({
15789
15805
  }
15790
15806
  },
15791
15807
  onMouseDown: (e) => {
15808
+ measurementPointerDownRef.current = measureToolArmed || dimensionToolVisible;
15792
15809
  const rect = e.currentTarget.getBoundingClientRect();
15793
15810
  const x = e.clientX - rect.left;
15794
15811
  const y = e.clientY - rect.top;
@@ -18342,7 +18359,7 @@ import { css as css3 } from "@emotion/css";
18342
18359
  // package.json
18343
18360
  var package_default = {
18344
18361
  name: "@tscircuit/pcb-viewer",
18345
- version: "1.11.407",
18362
+ version: "1.11.409",
18346
18363
  main: "dist/index.js",
18347
18364
  type: "module",
18348
18365
  repository: {
@@ -18359,6 +18376,7 @@ var package_default = {
18359
18376
  cosmos: "cosmos",
18360
18377
  "cosmos-export": "cosmos-export",
18361
18378
  "test:x-ray-net": "bun run build && bun tests/x-ray-net/run.ts",
18379
+ "test:measurement-context-menu": "bun run build && bun tests/measurement-context-menu/run.ts",
18362
18380
  "test:webgpu": "bun run build && bun tests/webgpu/run.ts"
18363
18381
  },
18364
18382
  files: [
@@ -20277,6 +20295,14 @@ var CanvasElementsRenderer = (props) => {
20277
20295
  );
20278
20296
  const [xRayNetIds, setXRayNetIds] = useState13([]);
20279
20297
  useEffect19(() => setXRayNetIds([]), [connectivityMap]);
20298
+ useEffect19(() => {
20299
+ if (xRayNetIds.length === 0) return;
20300
+ const onKeyDown = (event) => {
20301
+ if (event.key === "Escape") setXRayNetIds([]);
20302
+ };
20303
+ window.addEventListener("keydown", onKeyDown, true);
20304
+ return () => window.removeEventListener("keydown", onKeyDown, true);
20305
+ }, [xRayNetIds.length]);
20280
20306
  const xRayElements = useMemo10(
20281
20307
  () => xRayNetIds.length > 0 ? elementsToRender.filter(
20282
20308
  (element) => isXRayCopper(element) && xRayNetIds.includes(