Skip to content

Commit

Permalink
feat: disable zoom via props
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-rpm committed Dec 17, 2024
1 parent 3f1e269 commit 41c09b8
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/components/Avatar/Avatar.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,20 @@ const Avatar: FC<AvatarProps> = ({
useEffect(() => triggerCallback(onLoading), [modelSrc, animationSrc, onLoading]);

const enablePostProcessing = Boolean(effects?.ambientOcclusion || effects?.bloom || effects?.vignette);
const cameraControlsMinDistance = useMemo(() => {
if (controlsMinDistance) {
return controlsMinDistance;
}

return halfBody ? CAMERA.CONTROLS.HALF_BODY.MIN_DISTANCE : CAMERA.CONTROLS.FULL_BODY.MIN_DISTANCE;
}, [controlsMinDistance, halfBody]);
const cameraControlsMsxDistance = useMemo(() => {
if (controlsMaxDistance) {
return controlsMaxDistance;
}

return halfBody ? CAMERA.CONTROLS.HALF_BODY.MAX_DISTANCE : CAMERA.CONTROLS.FULL_BODY.MAX_DISTANCE;
}, [controlsMaxDistance, halfBody]);

return (
<BaseCanvas
Expand All @@ -328,8 +342,8 @@ const Avatar: FC<AvatarProps> = ({
cameraTarget={cameraTarget}
cameraInitialDistance={cameraInitialDistance}
cameraZoomTarget={cameraZoomTarget}
controlsMinDistance={controlsMinDistance}
controlsMaxDistance={controlsMaxDistance}
controlsMinDistance={cameraControlsMinDistance}
controlsMaxDistance={cameraControlsMsxDistance}
updateCameraTargetOnZoom={!halfBody}
/>
{AvatarModel}
Expand Down

0 comments on commit 41c09b8

Please sign in to comment.