bx-1379-redesign #15

Merged
ksenia_mikhailova merged 124 commits from bx-1379-redesign into dev 2024-09-06 15:39:13 +03:00
2 changed files with 21 additions and 19 deletions
Showing only changes of commit 3379a26036 - Show all commits

View File

@ -5,12 +5,8 @@ import {
MeshStandardMaterial, MeshStandardMaterialParameters, MeshStandardMaterial, MeshStandardMaterialParameters,
Vector2, Vector3, Vector2, Vector3,
CircleGeometry, MeshBasicMaterial, CircleGeometry, MeshBasicMaterial,
Quaternion, Quaternion, AdditiveBlending,
RingGeometry,
MultiplyBlending,
AdditiveBlending,
} from 'three'; } from 'three';
import { useRoute, useRouter } from 'vue-router';
import { useTresContext, useSeek, useTexture, useLoop } from '@tresjs/core'; import { useTresContext, useSeek, useTexture, useLoop } from '@tresjs/core';
import { useGLTF } from '@tresjs/cientos' import { useGLTF } from '@tresjs/cientos'
@ -34,6 +30,7 @@ const clickable_items = ref<any[]>([])
const clickable_refs = ref<any[]>([]) const clickable_refs = ref<any[]>([])
const envVars = reactive({}) as EnvVars const envVars = reactive({}) as EnvVars
const def_distance = reactive({ max: 10, min: 1 }) const def_distance = reactive({ max: 10, min: 1 })
const process_loading = ref(null)
const controls_targetto = ref() as Ref<Vector3 | undefined>; const controls_targetto = ref() as Ref<Vector3 | undefined>;
const controls_targetto_count = ref(CON_MOVETO_COUNT) const controls_targetto_count = ref(CON_MOVETO_COUNT)
@ -56,7 +53,13 @@ const groundTexture = await useTexture({
const pointerTexture = await useTexture({ const pointerTexture = await useTexture({
map: '/pointer_texture.png' map: '/pointer_texture.png'
}) })
const clearData = () => {
models.value = []
clickable_items.value = []
clickable_refs.value = []
}
const loadModels = async () => { const loadModels = async () => {
process_loading.value = props.source
const res = await fetch(`${SERVER_URL}/api/obj/scene/${props.source}/`) const res = await fetch(`${SERVER_URL}/api/obj/scene/${props.source}/`)
const raw_data = await res.json() as scene3D const raw_data = await res.json() as scene3D
loading_store.status = 'other' loading_store.status = 'other'
@ -245,6 +248,8 @@ const loadModels = async () => {
if (controls.value && (controls.value as any).autoRotate) { if (controls.value && (controls.value as any).autoRotate) {
(controls.value as any).autoRotate = false; (controls.value as any).autoRotate = false;
} }
// process_loading.value = null
} }
const gotoCenterAndDistance = () => { const gotoCenterAndDistance = () => {
@ -265,19 +270,16 @@ const gotoCenterAndDistance = () => {
}); });
} }
watch(() => props.source, (s) => { watch(() => [props.source, process_loading.value], ([source, process]) => {
const loaded = seekByName(scene.value, 'loaded') if (source !== process) {
if (loaded) { const loaded = seekByName(scene.value, 'loaded')
loaded.children = [] if (loaded) {
} loaded.children = []
models.value = [] }
clickable_items.value = []
clickable_refs.value = [] sidebar.close()
sidebar.close()
try {
loadModels() loadModels()
} catch (error) {
console.log(error)
} }
}) })

View File

@ -30,13 +30,13 @@ console.log(router)
<div class="nav-group"> <div class="nav-group">
<span class="nav-icon" :class="[{ disabled: router.options.history.state.back == null }]"> <span class="nav-icon" :class="[{ disabled: router.options.history.state.back == null }]">
<RouterLink :to="(router.options.history.state.back as string) ?? '/'" <RouterLink :to="(router.options.history.state.back as string) ?? '/'"
@click.native.prevent="router.back()"> @click.native.prevent="router.back">
<i-mdi:arrow-left /> <i-mdi:arrow-left />
</RouterLink> </RouterLink>
</span> </span>
<span class="nav-icon" :class="[{ disabled: router.options.history.state.forward == null }]"> <span class="nav-icon" :class="[{ disabled: router.options.history.state.forward == null }]">
<RouterLink :to="(router.options.history.state.forward as string) ?? '/'" <RouterLink :to="(router.options.history.state.forward as string) ?? '/'"
@click.native.prevent="router.forward()"> @click.native.prevent="router.forward">
<i-mdi:arrow-right /> <i-mdi:arrow-right />
</RouterLink> </RouterLink>
</span> </span>