|
@@ -44,7 +44,7 @@
|
|
|
</teleport>
|
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
|
- import { ref, onMounted, nextTick, unref } from 'vue';
|
|
|
+ import { ref, onMounted, nextTick, unref, watch, watchEffect } from 'vue';
|
|
|
import { useSceneStore, tagType } from '/@/store/modules/scene';
|
|
|
import { computed } from 'vue';
|
|
|
import { getApp, useApp } from '/@/hooks/userApp';
|
|
@@ -53,14 +53,14 @@
|
|
|
// import { getApp, useApp } from '@/app';
|
|
|
// import { useStore } from 'vuex';
|
|
|
import { changeUrl } from './common';
|
|
|
- import { watchEffect } from 'vue';
|
|
|
|
|
|
import ShowTag from './show-tag.vue';
|
|
|
+
|
|
|
+ import { ComputedRef } from 'vue';
|
|
|
const sceneStore = useSceneStore();
|
|
|
const tags$ = ref('');
|
|
|
const tags = computed(() => sceneStore.tags);
|
|
|
-
|
|
|
- const currentTag = ref<tagType | null>(null);
|
|
|
+ const currentTag: ComputedRef<tagType | null> = computed(() => sceneStore.currentTag);
|
|
|
const isClick = ref(false);
|
|
|
const showLayer = ref(false);
|
|
|
const emit = defineEmits(['setCurrentTag']);
|
|
@@ -74,33 +74,39 @@
|
|
|
|
|
|
const openLayer = (tag: tagType) => {
|
|
|
showLayer.value = true;
|
|
|
- currentTag.value = tag;
|
|
|
+ // currentTag.value = tag;
|
|
|
emit('setCurrentTag', tag);
|
|
|
+ sceneStore.setCurrentTag(tag);
|
|
|
console.error('open-layer');
|
|
|
};
|
|
|
const closeLayer = () => {
|
|
|
showLayer.value = false;
|
|
|
- currentTag.value = null;
|
|
|
+ // currentTag.value = null;
|
|
|
emit('setCurrentTag', null);
|
|
|
+ sceneStore.setCurrentTag(null);
|
|
|
console.error('close-layer');
|
|
|
};
|
|
|
|
|
|
const closeTag = async () => {
|
|
|
- currentTag.value = null;
|
|
|
+ // currentTag.value = null;
|
|
|
+ emit('setCurrentTag', null);
|
|
|
+ sceneStore.setCurrentTag(null);
|
|
|
isClick.value = false;
|
|
|
};
|
|
|
-
|
|
|
const goTag = (_, item: tagType) => {
|
|
|
console.warn('gototag', item.sid);
|
|
|
+ emit('setCurrentTag', item);
|
|
|
showLayer.value = false;
|
|
|
if (unref(isClick)) {
|
|
|
- currentTag.value = null;
|
|
|
+ // currentTag.value = null;
|
|
|
+ sceneStore.setCurrentTag(null);
|
|
|
isClick.value = false;
|
|
|
} else {
|
|
|
- currentTag.value = item;
|
|
|
+ // currentTag.value = item;
|
|
|
+ sceneStore.setCurrentTag(item);
|
|
|
isClick.value = true;
|
|
|
try {
|
|
|
- focusTag(item);
|
|
|
+ // focusTag(item);
|
|
|
} catch (error) {
|
|
|
console.log('error', error);
|
|
|
}
|
|
@@ -113,14 +119,14 @@
|
|
|
currentTag.value?.sid === tag.sid &&
|
|
|
!unref(showLayer)
|
|
|
) {
|
|
|
- currentTag.value = null;
|
|
|
+ // currentTag.value = null;
|
|
|
sceneStore.setCurrentTag(null);
|
|
|
}
|
|
|
};
|
|
|
const onMouseEnter = (_, tag: tagType) => {
|
|
|
if (!unref(isMobile)) {
|
|
|
sceneStore.setCurrentTag(tag);
|
|
|
- currentTag.value = tag;
|
|
|
+ // currentTag.value = tag;
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -136,6 +142,18 @@
|
|
|
app.TagManager.updatePosition(tags.value);
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ watch(
|
|
|
+ currentTag,
|
|
|
+ (val) => {
|
|
|
+ if (val) {
|
|
|
+ focusTag(val);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
+ );
|
|
|
// app.Camera.on('flying.started', (pano) => {});
|
|
|
// app.Camera.on('flying.ended', ({ targetPano }) => {});
|
|
|
await app.TagManager.tag();
|
|
@@ -161,7 +179,7 @@
|
|
|
const focusTag = (tag: tagType) => {
|
|
|
nextTick(() => {
|
|
|
const app = getApp();
|
|
|
- // console.error('focusTag-1');
|
|
|
+ console.warn('focusTag', tag.sid);
|
|
|
let t = setTimeout(() => {
|
|
|
clearTimeout(t);
|
|
|
let tagBox = document.getElementById(`tagBox_${tag.sid}`);
|
|
@@ -184,6 +202,7 @@
|
|
|
};
|
|
|
|
|
|
let position = isMobile.value ? 'center' : 'left';
|
|
|
+ // console.log('app.TagManager', app.TagManager, position, params);
|
|
|
app.TagManager.focus(params, 'board', position);
|
|
|
} catch (err) {}
|
|
|
}, 300);
|