|
@@ -36,6 +36,7 @@ import {
|
|
|
} from '@/store'
|
|
|
|
|
|
import type { TaggingPosition } from '@/store'
|
|
|
+import { distance } from '@/utils/math'
|
|
|
|
|
|
const tagging = computed(() => getTagging(router.currentRoute.value.params.id as string))
|
|
|
const positions = computed(() => tagging.value && getTaggingPositions(tagging.value))
|
|
@@ -64,6 +65,9 @@ const deletePosition = (position: TaggingPosition) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const cameraPos = ref<SceneLocalPos>()
|
|
|
+sdk.sceneBus.on('cameraChange', pos => cameraPos.value = pos)
|
|
|
+
|
|
|
watchEffect((onCleanup) => {
|
|
|
if (tagging.value) {
|
|
|
const clickHandler = async (ev: MouseEvent) => {
|
|
@@ -82,6 +86,11 @@ watchEffect((onCleanup) => {
|
|
|
taggingId: tagging.value!.id
|
|
|
})
|
|
|
taggingPositions.value.push(storePosition)
|
|
|
+
|
|
|
+
|
|
|
+ if (cameraPos.value && distance(cameraPos.value, position.worldPos) > 8) {
|
|
|
+ flyTaggingPosition(storePosition)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
sdk.layout.addEventListener('click', clickHandler, false)
|