From 6aa838b1517b308dccabd54404d12edeb50b097a Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Wed, 2 Oct 2024 15:24:54 +0300 Subject: [PATCH] smooth --- components/model/parametric.vue | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/components/model/parametric.vue b/components/model/parametric.vue index a069d5b..1c7ba1a 100644 --- a/components/model/parametric.vue +++ b/components/model/parametric.vue @@ -17,10 +17,10 @@ const open_calc = use_open_calc() const goto_cam = use_goto_camera() const goto_target = use_goto_target() -const { scene, controls } = useTresContext() +const { scene, controls, camera } = useTresContext() const { seek, seekAll } = useSeek() -const topper_models = {} as {[key:toppersIds]:Object3D} +const topper_models = {} as { [key: toppersIds]: Object3D } for await (const element of toppers) { const { scene } = await useGLTF(getModel(element.id)) topper_models[element.id] = scene @@ -95,13 +95,13 @@ const setTarget = (smooth = false) => { goto_target.value = target goto_cam.value = new Vector3(f, f, f) } else { - (controls.value as OrbitControlsProps).target = target - // camera.value?.position.set(f, f, f) + (controls.value as OrbitControlsProps).target = target; + (controls.value as any).update() + goto_cam.value = new Vector3(f, f, f) } } -setTarget() watch([lamelles_count, fence_section], () => { - setTarget(false) + setTarget() open_calc.value = [] }) @@ -110,7 +110,9 @@ watch(open_calc, () => { setTarget(true) } }) -const min_for_square = 12 +const min_for_square = 12; + +setTarget()