@tscircuit/pcb-viewer 1.11.119 → 1.11.121

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
@@ -9511,7 +9511,7 @@ import { css as css3 } from "@emotion/css";
9511
9511
  // package.json
9512
9512
  var package_default = {
9513
9513
  name: "@tscircuit/pcb-viewer",
9514
- version: "1.11.118",
9514
+ version: "1.11.120",
9515
9515
  main: "dist/index.js",
9516
9516
  type: "module",
9517
9517
  repository: "tscircuit/pcb-viewer",
@@ -10111,6 +10111,7 @@ var PCBViewer = ({
10111
10111
  let [editEvents, setEditEvents] = useState10([]);
10112
10112
  editEvents = editEventsProp ?? editEvents;
10113
10113
  const initialRenderCompleted = useRef9(false);
10114
+ const touchStartRef = useRef9(null);
10114
10115
  const circuitJsonKey = `${circuitJson?.length || 0}_${circuitJson?.editCount || 0}`;
10115
10116
  const resetTransform = () => {
10116
10117
  const elmBounds = refDimensions?.width > 0 ? refDimensions : { width: 500, height: 500 };
@@ -10199,6 +10200,26 @@ var PCBViewer = ({
10199
10200
  setIsInteractionEnabled(true);
10200
10201
  resetTransform();
10201
10202
  },
10203
+ onTouchStart: (e) => {
10204
+ const touch = e.touches[0];
10205
+ touchStartRef.current = {
10206
+ x: touch.clientX,
10207
+ y: touch.clientY
10208
+ };
10209
+ },
10210
+ onTouchEnd: (e) => {
10211
+ const touch = e.changedTouches[0];
10212
+ const start = touchStartRef.current;
10213
+ if (!start) return;
10214
+ const deltaX = Math.abs(touch.clientX - start.x);
10215
+ const deltaY = Math.abs(touch.clientY - start.y);
10216
+ if (deltaX < 10 && deltaY < 10) {
10217
+ e.preventDefault();
10218
+ setIsInteractionEnabled(true);
10219
+ resetTransform();
10220
+ }
10221
+ touchStartRef.current = null;
10222
+ },
10202
10223
  style: {
10203
10224
  position: "absolute",
10204
10225
  inset: 0,
@@ -10206,7 +10227,8 @@ var PCBViewer = ({
10206
10227
  zIndex: 10,
10207
10228
  display: "flex",
10208
10229
  alignItems: "center",
10209
- justifyContent: "center"
10230
+ justifyContent: "center",
10231
+ touchAction: "pan-x pan-y pinch-zoom"
10210
10232
  },
10211
10233
  children: /* @__PURE__ */ jsx16(
10212
10234
  "div",
@@ -10219,7 +10241,7 @@ var PCBViewer = ({
10219
10241
  fontSize: "16px",
10220
10242
  pointerEvents: "none"
10221
10243
  },
10222
- children: "Click to Interact"
10244
+ children: typeof window !== "undefined" && ("ontouchstart" in window || navigator.maxTouchPoints > 0) ? "Touch to Interact" : "Click to Interact"
10223
10245
  }
10224
10246
  )
10225
10247
  }