|
@@ -49,9 +49,9 @@ import Edit from './edit.vue'
|
|
import TagingSign from './sign.vue'
|
|
import TagingSign from './sign.vue'
|
|
import { Message } from 'bill/index'
|
|
import { Message } from 'bill/index'
|
|
import { RightFillPano } from '@/layout'
|
|
import { RightFillPano } from '@/layout'
|
|
-import { togetherCallback } from '@/utils'
|
|
|
|
|
|
+import { asyncTimeout, togetherCallback } from '@/utils'
|
|
import { useViewStack } from '@/hook'
|
|
import { useViewStack } from '@/hook'
|
|
-import { computed, ref, watch } from 'vue';
|
|
|
|
|
|
+import { computed, nextTick, ref, watch } from 'vue';
|
|
import { sdk } from '@/sdk'
|
|
import { sdk } from '@/sdk'
|
|
import {
|
|
import {
|
|
taggings,
|
|
taggings,
|
|
@@ -65,7 +65,8 @@ import {
|
|
getModelShowVariable,
|
|
getModelShowVariable,
|
|
getTaggingPositions,
|
|
getTaggingPositions,
|
|
taggingPositions,
|
|
taggingPositions,
|
|
- createTaggingPosition
|
|
|
|
|
|
+ createTaggingPosition,
|
|
|
|
+models
|
|
} from '@/store'
|
|
} from '@/store'
|
|
import {
|
|
import {
|
|
custom,
|
|
custom,
|
|
@@ -148,37 +149,30 @@ watch(selectTagging, (a, b, onCleanup) => {
|
|
if (selectTagging.value) {
|
|
if (selectTagging.value) {
|
|
const leave = () => selectTagging.value = null
|
|
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(currentModel)),
|
|
|
|
showRightCtrlPanoStack.push(ref(false)),
|
|
showRightCtrlPanoStack.push(ref(false)),
|
|
showRightPanoStack.push(ref(false))
|
|
showRightPanoStack.push(ref(false))
|
|
])
|
|
])
|
|
|
|
|
|
- const clickHandler = (ev: MouseEvent) => {
|
|
|
|
- const position = sdk.getPositionByScreen({
|
|
|
|
- x: ev.clientX,
|
|
|
|
- y: ev.clientY
|
|
|
|
- }, custom.currentModel?.id)
|
|
|
|
-
|
|
|
|
- if (!position) {
|
|
|
|
|
|
+ const clickHandler = async (ev: MouseEvent) => {
|
|
|
|
+ await nextTick()
|
|
|
|
+ await asyncTimeout()
|
|
|
|
+ const positions = models.value.
|
|
|
|
+ map(model =>
|
|
|
|
+ sdk.getPositionByScreen({
|
|
|
|
+ x: ev.clientX,
|
|
|
|
+ y: ev.clientY
|
|
|
|
+ }, model.id)
|
|
|
|
+ )
|
|
|
|
+ .filter(pos => pos)
|
|
|
|
+
|
|
|
|
+ if (!positions.length) {
|
|
Message.error('当前位置无法添加')
|
|
Message.error('当前位置无法添加')
|
|
} else if (selectTagging.value) {
|
|
} else if (selectTagging.value) {
|
|
const storePosition = createTaggingPosition({
|
|
const storePosition = createTaggingPosition({
|
|
- ...position,
|
|
|
|
|
|
+ ...positions[0],
|
|
taggingId: selectTagging.value.id
|
|
taggingId: selectTagging.value.id
|
|
})
|
|
})
|
|
taggingPositions.value.push(storePosition)
|
|
taggingPositions.value.push(storePosition)
|