修复模型查看器自动旋转状态可能停在旧值

- 场景创建使用 effect 开始时的 autoRotateRef.current,加载期间 prop 变化时 setAutoRotate 的 effect 因 sceneRef 为空被丢弃
- 场景就绪后按最新的 autoRotateRef.current 重新同步一次,避免旋转状态与 prop 不一致
This commit is contained in:
2026-09-21 15:11:20 +08:00
parent 33cd943ff9
commit ae426df240
@@ -116,6 +116,9 @@ export function Model3DViewer({
}
createdScene = scene;
sceneRef.current = scene;
// 场景创建期间 autoRotate 可能已经变过,而那时 sceneRef 还是空的,
// 只靠 setAutoRotate 的 effect 会丢掉这次更新,所以这里补一次最新值。
scene.setAutoRotate(autoRotateRef.current);
reportStatus('ready', {});
})
.catch((error: unknown) => {