diff --git a/front/src/components/Promo/load_models.vue b/front/src/components/Promo/load_models.vue index 1561453..7f2fa1c 100644 --- a/front/src/components/Promo/load_models.vue +++ b/front/src/components/Promo/load_models.vue @@ -83,6 +83,7 @@ const setControls = () => { const d = targetDistance.max * 0.5 camera.value?.position.set(d, d, d); + camera.value?.updateMatrixWorld(); (controls.value as any).target = new Vector3(0, 0, 0); (controls.value as any).autoRotate = false; @@ -234,12 +235,9 @@ const loadModels = async () => { const gotoCenterAndDistance = () => { targetDistance.min = mobileAndTabletCheck() ? raw_dataStore.data.min_distance * 0.5 : raw_dataStore.data.min_distance; targetDistance.max = raw_dataStore.data.max_distance; + const d = raw_dataStore.data.max_distance * 0.5 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 - )) + set_moveto(smooth_move, new Vector3(d, d, d)) } watch(() => props.source, () => { @@ -377,7 +375,6 @@ timer.timer_func = () => { (controls.value as any).autoRotate = true; (controls.value as any).autoRotateSpeed = 0.5; - timer.startTimer() home_timer.startTimer() } } diff --git a/front/src/stores/timer.ts b/front/src/stores/timer.ts index 3c0b1f1..93b8e92 100644 --- a/front/src/stores/timer.ts +++ b/front/src/stores/timer.ts @@ -19,14 +19,16 @@ export const useTimer = defineStore('timer', { actions: { startTimer() { this.is_enabled = true + clearInterval(this.timer_el) this.resetTimer() this.timer_el = this.countdownTimer() }, stopTimer() { this.is_enabled = false - clearInterval(this.timer_el) + if (this.timer_func) { this.timer_func() + this.startTimer() } }, resetTimer() { diff --git a/front/src/stores/timer_home.ts b/front/src/stores/timer_home.ts index da251c5..a297c23 100644 --- a/front/src/stores/timer_home.ts +++ b/front/src/stores/timer_home.ts @@ -18,14 +18,15 @@ export const useTimerHome = defineStore('timer_home', { actions: { startTimer() { this.is_enabled = true + clearInterval(this.timer_el) this.resetTimer() this.timer_el = this.countdownTimer() }, stopTimer() { this.is_enabled = false - clearInterval(this.timer_el) if (this.timer_func) { this.timer_func() + this.startTimer() } }, resetTimer() {