@tscircuit/3d-viewer 0.0.447 → 0.0.449
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 +10 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28464,7 +28464,7 @@ import * as THREE15 from "three";
|
|
|
28464
28464
|
// package.json
|
|
28465
28465
|
var package_default = {
|
|
28466
28466
|
name: "@tscircuit/3d-viewer",
|
|
28467
|
-
version: "0.0.
|
|
28467
|
+
version: "0.0.448",
|
|
28468
28468
|
main: "./dist/index.js",
|
|
28469
28469
|
module: "./dist/index.js",
|
|
28470
28470
|
type: "module",
|
|
@@ -28647,8 +28647,12 @@ var CameraControllerProvider = ({ children, defaultTarget, initialCameraPosition
|
|
|
28647
28647
|
defaultTarget.y,
|
|
28648
28648
|
defaultTarget.z
|
|
28649
28649
|
];
|
|
28650
|
-
const
|
|
28651
|
-
const
|
|
28650
|
+
const camera = mainCameraRef.current;
|
|
28651
|
+
const controls = controlsRef.current;
|
|
28652
|
+
let distance2 = baseDistance;
|
|
28653
|
+
if (camera && controls) {
|
|
28654
|
+
distance2 = camera.position.distanceTo(controls.target);
|
|
28655
|
+
}
|
|
28652
28656
|
switch (preset) {
|
|
28653
28657
|
case "Top Center Angled": {
|
|
28654
28658
|
const angledOffset = distance2 / Math.sqrt(2);
|
|
@@ -28727,7 +28731,7 @@ var CameraControllerProvider = ({ children, defaultTarget, initialCameraPosition
|
|
|
28727
28731
|
return null;
|
|
28728
28732
|
}
|
|
28729
28733
|
},
|
|
28730
|
-
[baseDistance, defaultTarget]
|
|
28734
|
+
[baseDistance, defaultTarget, mainCameraRef, controlsRef]
|
|
28731
28735
|
);
|
|
28732
28736
|
const handleControlsChange = useCallback4(
|
|
28733
28737
|
(controls) => {
|
|
@@ -32171,11 +32175,12 @@ function addFauxBoardIfNeeded(circuitJson) {
|
|
|
32171
32175
|
if (element.type === "cad_component") {
|
|
32172
32176
|
const cadComponent = element;
|
|
32173
32177
|
if (cadComponent.position) {
|
|
32178
|
+
const positionZOffset = cadComponent.position.z ?? 0;
|
|
32174
32179
|
return {
|
|
32175
32180
|
...cadComponent,
|
|
32176
32181
|
position: {
|
|
32177
32182
|
...cadComponent.position,
|
|
32178
|
-
z: componentZ
|
|
32183
|
+
z: positionZOffset + componentZ
|
|
32179
32184
|
}
|
|
32180
32185
|
};
|
|
32181
32186
|
}
|