Skip to content

Commit

Permalink
fix(zoom out): fixed increase zoom out for 3rd option (sphere)
Browse files Browse the repository at this point in the history
  • Loading branch information
aliraza556 committed Dec 20, 2023
1 parent d29f0ab commit 81ae99e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/Universe/Controls/CameraAnimations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const useCameraAnimations = (
const disableCameraRotation = useDataStore((s) => s.disableCameraRotation)

const data = useDataStore((s) => s.data)
const graphStyle = useDataStore((s) => s.graphStyle)
const graphRadius = useDataStore((s) => s.graphRadius)
const setNearbyNodeIds = useDataStore((s) => s.setNearbyNodeIds)

Expand Down Expand Up @@ -81,11 +82,18 @@ export const useCameraAnimations = (
cameraControlsRef.current.maxDistance = cameraControlsRef.current.getDistanceToFitSphere(graphRadius + 200)
}

if (graphStyle === 'sphere' && cameraControlsRef.current && graphRadius) {
cameraControlsRef.current.maxDistance = cameraControlsRef.current.getDistanceToFitSphere(graphRadius + 200)
cameraControlsRef.current.maxDistance = 8000;
cameraControlsRef.current.minDistance = 200;
cameraControlsRef.current?.setTarget(0, 0, 500, true);
}

if (enabled) {
doIntroAnimation()
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [graphRadius])
}, [graphRadius, graphStyle, cameraControlsRef])

useEffect(() => {
if (!selectedNode && cameraControlsRef.current) {
Expand Down

0 comments on commit 81ae99e

Please sign in to comment.