fix(web): improve scene camera and bounds behavior

Update Bounds props to enable fitting and clipping, adjust OrbitControls
minDistance, and set makeDefault to ensure proper interaction.
This commit is contained in:
2026-08-08 18:16:03 +08:00
parent b6bd4612e0
commit ead2ba8c57
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -27,7 +27,7 @@ export default function Scene({ children }: { children: ReactNode }) {
<pointLight position={[0, 3, 0]} intensity={0.3} /> <pointLight position={[0, 3, 0]} intensity={0.3} />
<Suspense fallback={null}> <Suspense fallback={null}>
<Bounds>{children}</Bounds> <Bounds fit observe clip>{children}</Bounds>
</Suspense> </Suspense>
<ContactShadows <ContactShadows
@@ -40,10 +40,10 @@ export default function Scene({ children }: { children: ReactNode }) {
/> />
<OrbitControls <OrbitControls
enablePan={false} enablePan={false}
minDistance={1} minDistance={0.01}
maxDistance={8} maxDistance={8}
autoRotate autoRotate
autoRotateSpeed={1.2} makeDefault
/> />
<EffectComposer> <EffectComposer>
@@ -53,4 +53,4 @@ export default function Scene({ children }: { children: ReactNode }) {
</Canvas> </Canvas>
</div> </div>
); );
} }
@@ -185,4 +185,4 @@ function signedArea(points: number[][]): number {
area += x1! * y2! - x2! * y1!; area += x1! * y2! - x2! * y1!;
} }
return area / 2; return area / 2;
} }