|
@@ -1,13 +1,12 @@
|
|
<template>
|
|
<template>
|
|
<div xui_tags_view>
|
|
<div xui_tags_view>
|
|
- <!-- <TagItem v-for="(tag, index) in tags" :tag="tag" :index="index + 1" @action="onAction" :class="{ active: notify && notify.sid == tag.sid }" /> -->
|
|
|
|
|
|
+ <TagItem v-for="(tag, index) in tags" :tag="tag" :index="index + 1" @action="onAction" :class="{ active: notify && notify.sid == tag.sid }" />
|
|
<TagEditor v-if="notify" :notify="notify" @action="onAction" />
|
|
<TagEditor v-if="notify" :notify="notify" @action="onAction" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script setup>
|
|
<script setup>
|
|
import { ref, watchEffect } from 'vue'
|
|
import { ref, watchEffect } from 'vue'
|
|
import TagItem from './TagItem.vue'
|
|
import TagItem from './TagItem.vue'
|
|
-import TagLaserItem from './TagLaserItem.vue'
|
|
|
|
import TagView from './TagView.vue'
|
|
import TagView from './TagView.vue'
|
|
import TagEditor from './TagEditor.vue'
|
|
import TagEditor from './TagEditor.vue'
|
|
|
|
|
|
@@ -16,49 +15,7 @@ let timer = setInterval(() => {
|
|
init(window.kankan)
|
|
init(window.kankan)
|
|
clearInterval(timer)
|
|
clearInterval(timer)
|
|
} else if (window.laser) {
|
|
} else if (window.laser) {
|
|
- window.laser.then(sdk => {
|
|
|
|
- watchEffect(onClean => {
|
|
|
|
- const cleans = tags.value.map((tag, index) => {
|
|
|
|
- console.error(TagLaserItem, tag.position)
|
|
|
|
- return sdk.sceneCarry.use({
|
|
|
|
- components: TagLaserItem,
|
|
|
|
- props: {
|
|
|
|
- pos: tag.position,
|
|
|
|
- tag,
|
|
|
|
- index,
|
|
|
|
- },
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- return onClean(() => {
|
|
|
|
- cleans.forEach(clean => clean())
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- window.laser.then(sdk => {
|
|
|
|
- sdk.addMouseDownEvent(e => {
|
|
|
|
- if (e.button == 2) {
|
|
|
|
- const info = sdk.scene.getPointByScreen({ x: e.clientX, y: e.clientY })
|
|
|
|
- const tag = {
|
|
|
|
- panoId: '0',
|
|
|
|
- createTime: 1658223413176,
|
|
|
|
- icon: 'R7PTZK233714.png',
|
|
|
|
- x: e.clientX,
|
|
|
|
- y: e.clientY,
|
|
|
|
- position: info.position,
|
|
|
|
- media: { link: [{ src: 'https://test.4dkankan.com/#/scene' }] },
|
|
|
|
- type: 'link',
|
|
|
|
- title: '链接热点',
|
|
|
|
- content: '',
|
|
|
|
- sid: 'ctKxOW233013',
|
|
|
|
- visible: true,
|
|
|
|
- scene: 'laser',
|
|
|
|
- }
|
|
|
|
- tags.value.push(tag)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
|
|
+ initLaserTag()
|
|
clearInterval(timer)
|
|
clearInterval(timer)
|
|
}
|
|
}
|
|
}, 50)
|
|
}, 50)
|
|
@@ -139,6 +96,58 @@ const init = sdk => {
|
|
sdk.TagManager.load(tags.value)
|
|
sdk.TagManager.load(tags.value)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const initLaserTag = () => {
|
|
|
|
+ window.laser.then(sdk => {
|
|
|
|
+ // watchEffect(onClean => {
|
|
|
|
+ // const cleans = tags.value.map((tag, index) => {
|
|
|
|
+ // return sdk.sceneCarry.use({
|
|
|
|
+ // component: TagLaserItem,
|
|
|
|
+ // props: {
|
|
|
|
+ // pos: tag.position,
|
|
|
|
+ // tag,
|
|
|
|
+ // index,
|
|
|
|
+ // },
|
|
|
|
+ // })
|
|
|
|
+ // })
|
|
|
|
+
|
|
|
|
+ // return onClean(() => {
|
|
|
|
+ // cleans.forEach(clean => clean())
|
|
|
|
+ // })
|
|
|
|
+ // })
|
|
|
|
+
|
|
|
|
+ sdk.scene.on('posChange', cameraPos => {
|
|
|
|
+ tags.value.forEach(tag=>{
|
|
|
|
+ const info2d = sdk.scene.getScreenByPoint(tag.position)
|
|
|
|
+ tag.x = info2d.pos.x,
|
|
|
|
+ tag.y = info2d.pos.y
|
|
|
|
+ tag.visible = info2d.trueSide
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ sdk.addMouseDownEvent(e => {
|
|
|
|
+ if (e.button == 2) {
|
|
|
|
+ const info3d = sdk.scene.getPointByScreen({ x: e.clientX, y: e.clientY })
|
|
|
|
+ const info2d = sdk.scene.getScreenByPoint(info3d.position)
|
|
|
|
+ const tag = {
|
|
|
|
+ panoId: '0',
|
|
|
|
+ createTime: 1658223413176,
|
|
|
|
+ icon: 'R7PTZK233714.png',
|
|
|
|
+ x: info2d.pos.x,
|
|
|
|
+ y: info2d.pos.y,
|
|
|
|
+ position: info3d.position,
|
|
|
|
+ media: { link: [{ src: 'https://test.4dkankan.com/#/scene' }] },
|
|
|
|
+ type: 'link',
|
|
|
|
+ title: '链接热点',
|
|
|
|
+ content: '',
|
|
|
|
+ sid: 'ctKxOW233013',
|
|
|
|
+ visible: info2d.trueSide,
|
|
|
|
+ }
|
|
|
|
+ tags.value.push(tag)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
const onAction = action => {
|
|
const onAction = action => {
|
|
notify.value = action
|
|
notify.value = action
|
|
}
|
|
}
|