|
@@ -31,6 +31,7 @@
|
|
@edit="editTagging = tagging"
|
|
@edit="editTagging = tagging"
|
|
@delete="deleteTagging(tagging)"
|
|
@delete="deleteTagging(tagging)"
|
|
@select="selectTagging = tagging"
|
|
@select="selectTagging = tagging"
|
|
|
|
+ @flyPositions="flyTaggingPositions(tagging)"
|
|
/>
|
|
/>
|
|
</ui-group>
|
|
</ui-group>
|
|
</RightFillPano>
|
|
</RightFillPano>
|
|
@@ -50,11 +51,20 @@ import { Message } from 'bill/index'
|
|
import { RightFillPano } from '@/layout'
|
|
import { RightFillPano } from '@/layout'
|
|
import { togetherCallback } from '@/utils'
|
|
import { togetherCallback } from '@/utils'
|
|
import { useViewStack } from '@/hook'
|
|
import { useViewStack } from '@/hook'
|
|
-import { taggings, TemploraryID, Tagging, autoSaveTaggings, createTagging, models, enterEdit } from '@/store'
|
|
|
|
import { ref, watch } from 'vue';
|
|
import { ref, watch } from 'vue';
|
|
import { sdk } from '@/sdk'
|
|
import { sdk } from '@/sdk'
|
|
import {
|
|
import {
|
|
|
|
+ taggings,
|
|
|
|
+ isTemploraryID,
|
|
|
|
+ Tagging,
|
|
|
|
+ autoSaveTaggings,
|
|
|
|
+ createTagging,
|
|
|
|
+ enterEdit,
|
|
|
|
+Model
|
|
|
|
+} from '@/store'
|
|
|
|
+import {
|
|
custom,
|
|
custom,
|
|
|
|
+ showTaggingPositionsStack,
|
|
showLeftCtrlPanoStack,
|
|
showLeftCtrlPanoStack,
|
|
showLeftPanoStack,
|
|
showLeftPanoStack,
|
|
currentModelStack,
|
|
currentModelStack,
|
|
@@ -66,7 +76,7 @@ import {
|
|
const editTagging = ref<Tagging | null>(null)
|
|
const editTagging = ref<Tagging | null>(null)
|
|
const saveHandler = (tagging: Tagging) => {
|
|
const saveHandler = (tagging: Tagging) => {
|
|
if (!editTagging.value) return;
|
|
if (!editTagging.value) return;
|
|
- if (editTagging.value.id === TemploraryID) {
|
|
|
|
|
|
+ if (isTemploraryID(editTagging.value.id)) {
|
|
taggings.value.push(tagging)
|
|
taggings.value.push(tagging)
|
|
} else {
|
|
} else {
|
|
Object.assign(editTagging.value, tagging)
|
|
Object.assign(editTagging.value, tagging)
|
|
@@ -79,18 +89,67 @@ const deleteTagging = (tagging: Tagging) => {
|
|
taggings.value.splice(index, 1)
|
|
taggings.value.splice(index, 1)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+let stopFlyTaggingPositions: () => void
|
|
|
|
+const flyTaggingPositions = (tagging: Tagging) => {
|
|
|
|
+ stopFlyTaggingPositions && stopFlyTaggingPositions()
|
|
|
|
+
|
|
|
|
+ let isStop = false
|
|
|
|
+
|
|
|
|
+ const flyIndex = (i: number) => {
|
|
|
|
+ if (isStop || i >= tagging.positions.length) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ const position = tagging.positions[i]
|
|
|
|
+ const pop = showTaggingPositionsStack.push(ref(new WeakSet([position])))
|
|
|
|
+ sdk.comeTo({
|
|
|
|
+ position: position.localPos,
|
|
|
|
+ modelId: position.modelId,
|
|
|
|
+ dur: 300
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ console.log('改变了', custom.showTaggingPositions.has(position))
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ pop()
|
|
|
|
+ flyIndex(i + 1)
|
|
|
|
+ }, 2000)
|
|
|
|
+ }
|
|
|
|
+ flyIndex(0)
|
|
|
|
+ stopFlyTaggingPositions = () => isStop = true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const stopFlyKeyupHandler = (ev: KeyboardEvent) => {
|
|
|
|
+ ev.code === 'Escape' && stopFlyTaggingPositions && stopFlyTaggingPositions()
|
|
|
|
+}
|
|
|
|
+useViewStack(() => {
|
|
|
|
+ document.documentElement.addEventListener('keyup', stopFlyKeyupHandler, false)
|
|
|
|
+ return () => document.documentElement.removeEventListener('keydown', stopFlyKeyupHandler, false)
|
|
|
|
+})
|
|
|
|
|
|
const selectTagging = ref<Tagging | null>(null)
|
|
const selectTagging = ref<Tagging | null>(null)
|
|
watch(selectTagging, (a, b, onCleanup) => {
|
|
watch(selectTagging, (a, b, onCleanup) => {
|
|
if (selectTagging.value) {
|
|
if (selectTagging.value) {
|
|
|
|
+ const leave = () => selectTagging.value = null
|
|
|
|
+
|
|
|
|
+ let currentModel: Model | null = custom.currentModel
|
|
|
|
+ if (!currentModel) {
|
|
|
|
+ for (const [model, show] of custom.showModelsMap.entries()) {
|
|
|
|
+ show && (currentModel = model)
|
|
|
|
+ }
|
|
|
|
+ if (!currentModel) {
|
|
|
|
+ Message.error('请显示要添加热点的模型')
|
|
|
|
+ leave()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
const pop = togetherCallback([
|
|
const pop = togetherCallback([
|
|
showLeftCtrlPanoStack.push(ref(true)),
|
|
showLeftCtrlPanoStack.push(ref(true)),
|
|
showLeftPanoStack.push(ref(true)),
|
|
showLeftPanoStack.push(ref(true)),
|
|
- currentModelStack.push(ref(custom.currentModel || models.value[0])),
|
|
|
|
|
|
+ currentModelStack.push(ref(currentModel)),
|
|
showRightCtrlPanoStack.push(ref(false)),
|
|
showRightCtrlPanoStack.push(ref(false)),
|
|
showRightPanoStack.push(ref(false))
|
|
showRightPanoStack.push(ref(false))
|
|
])
|
|
])
|
|
- const leave = () => selectTagging.value = null
|
|
|
|
|
|
+
|
|
const clickHandler = (ev: MouseEvent) => {
|
|
const clickHandler = (ev: MouseEvent) => {
|
|
const position = sdk.getPositionByScreen({
|
|
const position = sdk.getPositionByScreen({
|
|
x: ev.clientX,
|
|
x: ev.clientX,
|