timer redirect

This commit is contained in:
Kseninia Mikhaylova 2024-09-05 17:02:34 +03:00
parent be475a96cd
commit aa568d3cbd
3 changed files with 11 additions and 7 deletions

View File

@ -44,8 +44,8 @@ const cameraPosition = ref([1, 1, 1]) as unknown as Ref<Vector3>
const controlsState = reactive({ const controlsState = reactive({
enableDamping: true, enableDamping: true,
maxPolarAngle: (Math.PI / 2) - 0.07, maxPolarAngle: (60) * (Math.PI / 180),
minAzimuthAngle: (Math.PI / 2) - 0.20, minAzimuthAngle: (75) * (Math.PI / 180),
}) })
const raw_dataStore = useRawData() const raw_dataStore = useRawData()

View File

@ -107,7 +107,7 @@ const loadModels = async () => {
loading_store.status = 'loading' loading_store.status = 'loading'
process_loading.value = props.source process_loading.value = props.source
await raw_dataStore.load(props) await raw_dataStore.load(props)
raw_dataStore.data.loading = true raw_dataStore.data.loading = true
document.title = `${raw_dataStore.data.name} - ${title}` document.title = `${raw_dataStore.data.name} - ${title}`
@ -309,7 +309,7 @@ watch(() => sidebar.is_open && sidebar.id_clickable, () => {
const { onBeforeRender } = useLoop() const { onBeforeRender } = useLoop()
onBeforeRender(() => { onBeforeRender(() => {
clickable_refs.value.map(el => { clickable_refs.value.map(el => {
el.value[0].visible = (camera.value?.position?.y as number) < raw_dataStore.data.min_distance ? false : true; el.value[0].visible = (camera.value?.position as Vector3).distanceTo(controls.value.target) < raw_dataStore.data.min_distance ? false : true;
if (el.value[0] && el.value[0].children) { if (el.value[0] && el.value[0].children) {
el.value[0].children[0].lookAt(camera.value?.position); el.value[0].children[0].lookAt(camera.value?.position);
el.value[0].children[0].rotateX(90 * (Math.PI / 180)); el.value[0].children[0].rotateX(90 * (Math.PI / 180));
@ -344,7 +344,8 @@ onBeforeRender(() => {
] ]
smoothy.forEach(element => { smoothy.forEach(element => {
if (element.el.value) { if (element.el.value) {
timer.resetTimer(); timer.resetTimer()
home_timer.resetTimer()
element.f() element.f()
element.el.count -= 1 element.el.count -= 1
if (element.el.count == 1) { if (element.el.count == 1) {
@ -372,10 +373,10 @@ timer.timer_func = () => {
} else { } else {
gotoCenterAndDistance(); gotoCenterAndDistance();
} }
home_timer.startTimer();
(controls.value as any).autoRotate = true; (controls.value as any).autoRotate = true;
(controls.value as any).autoRotateSpeed = 0.5; (controls.value as any).autoRotateSpeed = 0.5;
home_timer.startTimer()
} }
} }

View File

@ -29,6 +29,9 @@ export const useTimerHome = defineStore('timer_home', {
this.startTimer() this.startTimer()
} }
}, },
pauseTimer() {
this.is_enabled = !this.is_enabled
},
resetTimer() { resetTimer() {
this.seconds_left = BASE_TIMER this.seconds_left = BASE_TIMER
}, },