diff --git a/app/web/src/components/IdeViewer/IdeViewer.tsx b/app/web/src/components/IdeViewer/IdeViewer.tsx index 4a03670..7b2611b 100644 --- a/app/web/src/components/IdeViewer/IdeViewer.tsx +++ b/app/web/src/components/IdeViewer/IdeViewer.tsx @@ -53,18 +53,27 @@ function Asset({ const zoomToFit = () => { const { center, radius } = bSphere const { camera } = threeInstance - const offset = 4 + const offset = 3 controlsRef.current.reset() controlsRef.current.target.copy(center) - camera.position.copy(center.clone().add(new THREE.Vector3(offset * radius, -offset * radius, offset * radius))) + camera.position.copy( + center + .clone() + .add( + new THREE.Vector3( + offset * radius, + -offset * radius, + offset * radius + ) + ) + ) camera.updateProjectionMatrix() } - if(initZoom){ + if (initZoom) { zoomToFit() setInitZoom(false) } - }, [incomingGeo, dataType]) const PrimitiveArray = React.useMemo( () => @@ -171,7 +180,11 @@ function Controls({ onCameraChange, onDragStart, onInit, controlsRef }) { }, [camera, controlsRef]) return ( - + ) } @@ -304,7 +317,11 @@ export function PureIdeViewer({ )} {dataType !== 'png' && artifact && ( - + )}