bx-1379-redesign #15
|
@ -44,6 +44,7 @@ $boxShadow: 0px 0px 8px rgba(0, 0, 0, .25);
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
color: #484848;
|
color: #484848;
|
||||||
|
pointer-events: none;
|
||||||
|
|
||||||
&.open {
|
&.open {
|
||||||
right: 0;
|
right: 0;
|
||||||
|
@ -55,6 +56,7 @@ $boxShadow: 0px 0px 8px rgba(0, 0, 0, .25);
|
||||||
}
|
}
|
||||||
|
|
||||||
&-content {
|
&-content {
|
||||||
|
pointer-events: all;
|
||||||
background-color: $bg;
|
background-color: $bg;
|
||||||
border-top-left-radius: 0.5rem;
|
border-top-left-radius: 0.5rem;
|
||||||
border-bottom-left-radius: 0.5rem;
|
border-bottom-left-radius: 0.5rem;
|
||||||
|
|
|
@ -22,10 +22,11 @@ import { useLoading } from '../../stores/loading';
|
||||||
import { mobileAndTabletCheck } from '../../helpers';
|
import { mobileAndTabletCheck } from '../../helpers';
|
||||||
import { useTimer } from '../../stores/timer';
|
import { useTimer } from '../../stores/timer';
|
||||||
import { useRawData } from '../../stores/raw_data';
|
import { useRawData } from '../../stores/raw_data';
|
||||||
|
import { OrbitControlsProps } from '@tresjs/cientos/dist/core/controls/OrbitControls.vue.js';
|
||||||
|
|
||||||
const props = defineProps(['source', 'loaded_pan'])
|
const props = defineProps(['source', 'loaded_pan'])
|
||||||
const CON_MOVETO_COUNT = 150;
|
const CON_MOVETO_COUNT = 150;
|
||||||
const CAM_MOVETO_COUNT = 100;
|
const CAM_MOVETO_COUNT = 10;
|
||||||
|
|
||||||
const models = ref<model3DType[]>([])
|
const models = ref<model3DType[]>([])
|
||||||
const clickable_items = ref<any[]>([])
|
const clickable_items = ref<any[]>([])
|
||||||
|
@ -128,12 +129,14 @@ const makeGround = () => {
|
||||||
ground.name = "ground"
|
ground.name = "ground"
|
||||||
models.value.push({ name: 'ground', modelFile: ground })
|
models.value.push({ name: 'ground', modelFile: ground })
|
||||||
}
|
}
|
||||||
|
|
||||||
const clearValues = () => {
|
const clearValues = () => {
|
||||||
clickable_items.value = []
|
clickable_items.value = []
|
||||||
clickable_refs.value = []
|
clickable_refs.value = []
|
||||||
sidebar_clickable = []
|
sidebar_clickable = []
|
||||||
sidebar_visible = []
|
sidebar_visible = []
|
||||||
}
|
}
|
||||||
|
|
||||||
const loadModels = async () => {
|
const loadModels = async () => {
|
||||||
if (!props.source) return
|
if (!props.source) return
|
||||||
if (!raw_dataStore.data) return
|
if (!raw_dataStore.data) return
|
||||||
|
@ -290,10 +293,12 @@ watch(() => props.source, () => {
|
||||||
}
|
}
|
||||||
}, { deep: true })
|
}, { deep: true })
|
||||||
|
|
||||||
watch(() => sidebar, () => {
|
watch(() => sidebar.is_open, () => {
|
||||||
if (sidebar.is_open == false) {
|
if (sidebar.is_open == false) {
|
||||||
gotoCenterAndDistance();
|
gotoCenterAndDistance();
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
watch(() => sidebar.is_open && sidebar.id_clickable, () => {
|
||||||
if (sidebar.is_open && sidebar.id_clickable) {
|
if (sidebar.is_open && sidebar.id_clickable) {
|
||||||
const clickable = useClickable()
|
const clickable = useClickable()
|
||||||
const target = clickable.list.find(el => el.id == sidebar.id_clickable)
|
const target = clickable.list.find(el => el.id == sidebar.id_clickable)
|
||||||
|
@ -306,7 +311,14 @@ watch(() => sidebar, () => {
|
||||||
|
|
||||||
el.getWorldPosition(target_vector);
|
el.getWorldPosition(target_vector);
|
||||||
controls_targetto.value = target_vector;
|
controls_targetto.value = target_vector;
|
||||||
camera_rotatetoto.value = new Quaternion(Math.PI * 0.5, Math.PI * 0.5, Math.PI * 0.5, Math.PI * 0.5)
|
|
||||||
|
const distance = (controls.value as any).target.distanceTo(target_vector)
|
||||||
|
controls_targetto_count.value = parseInt(distance) * 10
|
||||||
|
|
||||||
|
const quaternion = new Quaternion();
|
||||||
|
quaternion.setFromAxisAngle(new Vector3(1, 0, 0), -45 * 4 * (Math.PI / 180));
|
||||||
|
// camera.value?.applyQuaternion(quaternion)
|
||||||
|
camera_rotatetoto.value = quaternion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, { deep: true })
|
}, { deep: true })
|
||||||
|
@ -350,10 +362,10 @@ onAfterRender(() => {
|
||||||
camera_moveto.value = undefined
|
camera_moveto.value = undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (camera_rotatetoto.value) {
|
if (camera_rotatetoto.value && !controls_targetto.value) {
|
||||||
timer.stopTimer();
|
timer.stopTimer();
|
||||||
camera.value?.quaternion.slerp(camera_rotatetoto.value, 0.01);
|
camera.value?.quaternion.slerp(camera_rotatetoto.value, 0.01);
|
||||||
camera.value?.quaternion.normalize();
|
// camera.value?.quaternion.normalize();
|
||||||
camera_rotatetoto_count.value -= 1;
|
camera_rotatetoto_count.value -= 1;
|
||||||
if (camera_rotatetoto_count.value == 0) {
|
if (camera_rotatetoto_count.value == 0) {
|
||||||
camera_rotatetoto_count.value = CAM_MOVETO_COUNT
|
camera_rotatetoto_count.value = CAM_MOVETO_COUNT
|
||||||
|
@ -381,6 +393,8 @@ const stopTimer = () => {
|
||||||
|
|
||||||
const pointer = reactive({ x: 0, y: 0 })
|
const pointer = reactive({ x: 0, y: 0 })
|
||||||
const clickEvent = (event: MouseEvent) => {
|
const clickEvent = (event: MouseEvent) => {
|
||||||
|
if (event.target && !(event.target as HTMLElement).closest('canvas')) return
|
||||||
|
|
||||||
const x = (event.clientX / window.innerWidth) * 2 - 1
|
const x = (event.clientX / window.innerWidth) * 2 - 1
|
||||||
const y = - (event.clientY / window.innerHeight) * 2 + 1
|
const y = - (event.clientY / window.innerHeight) * 2 + 1
|
||||||
if (x == pointer.x && y == pointer.y) return
|
if (x == pointer.x && y == pointer.y) return
|
||||||
|
|
Loading…
Reference in New Issue