@tscircuit/3d-viewer 0.0.425 → 0.0.427

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.
Files changed (2) hide show
  1. package/dist/index.js +22 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -26789,7 +26789,7 @@ import * as THREE14 from "three";
26789
26789
  // package.json
26790
26790
  var package_default = {
26791
26791
  name: "@tscircuit/3d-viewer",
26792
- version: "0.0.424",
26792
+ version: "0.0.426",
26793
26793
  main: "./dist/index.js",
26794
26794
  module: "./dist/index.js",
26795
26795
  type: "module",
@@ -27501,7 +27501,7 @@ var useCameraController = ({
27501
27501
  }) => {
27502
27502
  const controlsRef = useRef5(null);
27503
27503
  const baseDistance = useMemo14(() => {
27504
- const [x, y, z133] = initialCameraPosition ?? [5, 5, 5];
27504
+ const [x, y, z133] = initialCameraPosition ?? [5, -5, 5];
27505
27505
  const distance2 = Math.hypot(
27506
27506
  x - defaultTarget.x,
27507
27507
  y - defaultTarget.y,
@@ -27649,7 +27649,7 @@ var RotationTracker = () => {
27649
27649
  var CadViewerContainer = forwardRef2(
27650
27650
  ({
27651
27651
  children,
27652
- initialCameraPosition = [5, 5, 5],
27652
+ initialCameraPosition = [5, -5, 5],
27653
27653
  autoRotateDisabled,
27654
27654
  clickToInteractEnabled = false,
27655
27655
  boardDimensions,
@@ -29930,22 +29930,22 @@ var CadViewerJscad = forwardRef3(
29930
29930
  }, [soup, circuitJson, childrenSoup]);
29931
29931
  const boardGeom = useBoardGeomBuilder(internalCircuitJson);
29932
29932
  const initialCameraPosition = useMemo19(() => {
29933
- if (!internalCircuitJson) return [5, 5, 5];
29933
+ if (!internalCircuitJson) return [5, -5, 5];
29934
29934
  try {
29935
29935
  const board = su4(internalCircuitJson).pcb_board.list()[0];
29936
- if (!board) return [5, 5, 5];
29936
+ if (!board) return [5, -5, 5];
29937
29937
  const { width: width10, height: height10 } = board;
29938
29938
  if (!width10 && !height10) {
29939
- return [5, 5, 5];
29939
+ return [5, -5, 5];
29940
29940
  }
29941
29941
  const minCameraDistance = 5;
29942
29942
  const adjustedBoardWidth = Math.max(width10, minCameraDistance);
29943
29943
  const adjustedBoardHeight = Math.max(height10, minCameraDistance);
29944
29944
  const largestDim = Math.max(adjustedBoardWidth, adjustedBoardHeight);
29945
- return [largestDim / 2, largestDim / 2, largestDim];
29945
+ return [largestDim / 2, -largestDim / 2, largestDim];
29946
29946
  } catch (e) {
29947
29947
  console.error(e);
29948
- return [5, 5, 5];
29948
+ return [5, -5, 5];
29949
29949
  }
29950
29950
  }, [internalCircuitJson]);
29951
29951
  const boardDimensions = useMemo19(() => {
@@ -31355,7 +31355,17 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson) => {
31355
31355
  setError(null);
31356
31356
  const Manifold = manifoldJSModule.Manifold;
31357
31357
  const CrossSection = manifoldJSModule.CrossSection;
31358
- manifoldInstancesForCleanup.current.forEach((inst) => inst.delete());
31358
+ const safeDelete = (inst) => {
31359
+ if (!inst || typeof inst.delete !== "function") return;
31360
+ try {
31361
+ inst.delete();
31362
+ } catch (error2) {
31363
+ if (!(error2 instanceof Error) || !error2.message?.includes("Manifold instance already deleted")) {
31364
+ console.warn("Failed to delete Manifold instance", error2);
31365
+ }
31366
+ }
31367
+ };
31368
+ manifoldInstancesForCleanup.current.forEach(safeDelete);
31359
31369
  manifoldInstancesForCleanup.current = [];
31360
31370
  let boardManifold = null;
31361
31371
  const currentGeoms = {};
@@ -31559,7 +31569,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson) => {
31559
31569
  setIsLoading(false);
31560
31570
  }
31561
31571
  return () => {
31562
- manifoldInstancesForCleanup.current.forEach((inst) => inst.delete());
31572
+ manifoldInstancesForCleanup.current.forEach(safeDelete);
31563
31573
  manifoldInstancesForCleanup.current = [];
31564
31574
  };
31565
31575
  }, [manifoldJSModule, circuitJson, boardData]);
@@ -31874,12 +31884,12 @@ try {
31874
31884
  return { x: center.x, y: center.y };
31875
31885
  }, [boardData]);
31876
31886
  const initialCameraPosition = useMemo21(() => {
31877
- if (!boardData) return [5, 5, 5];
31887
+ if (!boardData) return [5, -5, 5];
31878
31888
  const { width: width10 = 0, height: height10 = 0 } = boardData;
31879
31889
  const safeWidth = Math.max(width10, 1);
31880
31890
  const safeHeight = Math.max(height10, 1);
31881
31891
  const largestDim = Math.max(safeWidth, safeHeight, 5);
31882
- return [largestDim * 0.75, largestDim * 0.75, largestDim * 0.75];
31892
+ return [largestDim * 0.75, -largestDim * 0.75, largestDim * 0.75];
31883
31893
  }, [boardData]);
31884
31894
  if (manifoldLoadingError) {
31885
31895
  return /* @__PURE__ */ jsxs7(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/3d-viewer",
3
- "version": "0.0.425",
3
+ "version": "0.0.427",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",