From 8e83a89698bfbd882e1cde5bffdb2f0e97dd3b91 Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Tue, 3 Sep 2024 12:52:19 +0300 Subject: [PATCH] camera --- front/src/components/Promo/load_models.vue | 25 ++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/front/src/components/Promo/load_models.vue b/front/src/components/Promo/load_models.vue index b7838df..9fdc3f2 100644 --- a/front/src/components/Promo/load_models.vue +++ b/front/src/components/Promo/load_models.vue @@ -43,6 +43,9 @@ type smooth = { const smooth_target = reactive({}) as smooth const smooth_move = reactive({}) as smooth const smooth_rotate = reactive({}) as smooth +const temp_smooth_target = reactive({}) as smooth +const temp_smooth_move = reactive({}) as smooth +const temp_smooth_rotate = reactive({}) as smooth const vis_target = ref() @@ -279,8 +282,16 @@ watch(() => sidebar.is_open && sidebar.id_clickable, () => { )); set_moveto(smooth_rotate, quaternion) - set_moveto(smooth_target, target_vector) - set_moveto(smooth_move, target_vector) + + set_moveto(temp_smooth_target, target_vector) + set_moveto(temp_smooth_move, target_vector) + + set_moveto(smooth_target, new Vector3(0, 0, 0)) + set_moveto(smooth_move, new Vector3( + raw_dataStore.data.max_distance * 0.5, + raw_dataStore.data.max_distance * 0.5, + raw_dataStore.data.max_distance * 0.5 + )) vis_target.value = target_vector; } } @@ -307,6 +318,11 @@ onAfterRender(() => { smooth_target.count -= 1 if (smooth_target.count == 0) { set_moveto(smooth_target, undefined) + + if (temp_smooth_target) { + set_moveto(smooth_target, temp_smooth_target.value) + set_moveto(temp_smooth_target, undefined) + } } } if (smooth_move.value) { @@ -316,6 +332,11 @@ onAfterRender(() => { if (smooth_move.count == 0) { // camera.value?.lookAt(camera_moveto.value) set_moveto(smooth_move, undefined) + + if (temp_smooth_move) { + set_moveto(smooth_move, temp_smooth_move.value) + set_moveto(temp_smooth_move, undefined) + } } } if (smooth_rotate.value) {