@tscircuit/pcb-viewer 1.11.359 → 1.11.360

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
@@ -6788,7 +6788,7 @@ var ToastContainer = () => {
6788
6788
  };
6789
6789
 
6790
6790
  // src/PCBViewer.tsx
6791
- import { useEffect as useEffect17, useMemo as useMemo8, useRef as useRef14, useState as useState12 } from "react";
6791
+ import { useCallback as useCallback10, useEffect as useEffect17, useMemo as useMemo8, useRef as useRef14, useState as useState12 } from "react";
6792
6792
 
6793
6793
  // node_modules/react-use/esm/useMountedState.js
6794
6794
  import { useCallback as useCallback2, useEffect as useEffect2, useRef } from "react";
@@ -14371,7 +14371,7 @@ import { css as css3 } from "@emotion/css";
14371
14371
  // package.json
14372
14372
  var package_default = {
14373
14373
  name: "@tscircuit/pcb-viewer",
14374
- version: "1.11.358",
14374
+ version: "1.11.359",
14375
14375
  main: "dist/index.js",
14376
14376
  type: "module",
14377
14377
  repository: "tscircuit/pcb-viewer",
@@ -14873,6 +14873,12 @@ var ToolbarOverlay = ({ children, elements }) => {
14873
14873
  setErrorsOpen(false);
14874
14874
  }
14875
14875
  }, [isViewMenuOpen]);
14876
+ const stopCanvasInteractionPropagation = useCallback8(
14877
+ (event) => {
14878
+ event.stopPropagation();
14879
+ },
14880
+ []
14881
+ );
14876
14882
  return /* @__PURE__ */ jsxs14(
14877
14883
  "div",
14878
14884
  {
@@ -14911,6 +14917,13 @@ var ToolbarOverlay = ({ children, elements }) => {
14911
14917
  onTouchStart: (e) => e.stopPropagation(),
14912
14918
  onTouchEnd: (e) => e.stopPropagation(),
14913
14919
  onTouchMove: (e) => e.stopPropagation(),
14920
+ onMouseDown: stopCanvasInteractionPropagation,
14921
+ onMouseMove: stopCanvasInteractionPropagation,
14922
+ onMouseUp: stopCanvasInteractionPropagation,
14923
+ onPointerDown: stopCanvasInteractionPropagation,
14924
+ onPointerMove: stopCanvasInteractionPropagation,
14925
+ onPointerUp: stopCanvasInteractionPropagation,
14926
+ onWheel: stopCanvasInteractionPropagation,
14914
14927
  style: {
14915
14928
  position: "absolute",
14916
14929
  opacity: isSmallScreen ? 1 : isMouseOverContainer ? 1 : 0,
@@ -15626,6 +15639,14 @@ var PCBViewer = ({
15626
15639
  );
15627
15640
  const [ref, refDimensions] = useMeasure_default();
15628
15641
  const [transform, setTransformInternal] = useState12(defaultTransform);
15642
+ const shouldAllowCanvasInteraction = useCallback10(
15643
+ (event) => {
15644
+ const target = event.target;
15645
+ if (!(target instanceof Element)) return true;
15646
+ return !target.closest("[data-toolbar-overlay]");
15647
+ },
15648
+ []
15649
+ );
15629
15650
  const {
15630
15651
  ref: transformRef,
15631
15652
  setTransform,
@@ -15633,7 +15654,8 @@ var PCBViewer = ({
15633
15654
  } = src_default({
15634
15655
  transform,
15635
15656
  onSetTransform: setTransformInternal,
15636
- enabled: isInteractionEnabled
15657
+ enabled: isInteractionEnabled,
15658
+ shouldDrag: shouldAllowCanvasInteraction
15637
15659
  });
15638
15660
  let [editEvents, setEditEvents] = useState12([]);
15639
15661
  editEvents = editEventsProp ?? editEvents;