|
@@ -44,23 +44,23 @@
|
|
|
</teleport>
|
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
|
- import { ref, onMounted, nextTick, unref, watch, watchEffect } from 'vue';
|
|
|
+ import { ref, onMounted, nextTick, unref, watchEffect } from 'vue';
|
|
|
import { useSceneStore, tagType } from '/@/store/modules/scene';
|
|
|
import { computed } from 'vue';
|
|
|
import { getApp, useApp } from '/@/hooks/userApp';
|
|
|
import browser from '/@/utils/browser';
|
|
|
import TagView from './tag-view.vue';
|
|
|
- // import { getApp, useApp } from '@/app';
|
|
|
- // import { useStore } from 'vuex';
|
|
|
import { changeUrl } from './common';
|
|
|
|
|
|
import ShowTag from './show-tag.vue';
|
|
|
|
|
|
import { ComputedRef } from 'vue';
|
|
|
+ import { watch } from 'vue';
|
|
|
const sceneStore = useSceneStore();
|
|
|
const tags$ = ref('');
|
|
|
const tags = computed(() => sceneStore.tags);
|
|
|
const currentTag: ComputedRef<tagType | null> = computed(() => sceneStore.currentTag);
|
|
|
+ const currentTagLayerIndex = computed(() => sceneStore.currentTagLayerIndex);
|
|
|
const isClick = ref(false);
|
|
|
const showLayer = computed(() => sceneStore.currentTagLayer);
|
|
|
const emit = defineEmits(['setCurrentTag']);
|
|
@@ -74,30 +74,32 @@
|
|
|
|
|
|
const openLayer = (tag: tagType) => {
|
|
|
// showLayer.value = true;
|
|
|
+ sceneStore.setCurrentTag(tag);
|
|
|
sceneStore.setCurrentTagLayer(true);
|
|
|
// currentTag.value = tag;
|
|
|
- emit('setCurrentTag', tag);
|
|
|
- sceneStore.setCurrentTag(tag);
|
|
|
+ emit('setCurrentTag');
|
|
|
console.error('open-layer');
|
|
|
};
|
|
|
const closeLayer = () => {
|
|
|
- // showLayer.value = false;
|
|
|
sceneStore.setCurrentTagLayer(false);
|
|
|
- // currentTag.value = null;
|
|
|
- emit('setCurrentTag', null);
|
|
|
+
|
|
|
sceneStore.setCurrentTag(null);
|
|
|
+ emit('setCurrentTag');
|
|
|
console.error('close-layer');
|
|
|
+ if (unref(isMobile)) {
|
|
|
+ isClick.value = false;
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
const closeTag = async () => {
|
|
|
// currentTag.value = null;
|
|
|
- emit('setCurrentTag', null);
|
|
|
sceneStore.setCurrentTag(null);
|
|
|
+ sceneStore.setCurrentTagLayer(false);
|
|
|
isClick.value = false;
|
|
|
+ emit('setCurrentTag');
|
|
|
};
|
|
|
const goTag = (_, item: tagType) => {
|
|
|
console.warn('gototag', item.sid);
|
|
|
- emit('setCurrentTag', item);
|
|
|
// showLayer.value = false;
|
|
|
sceneStore.setCurrentTagLayer(false);
|
|
|
if (unref(isClick)) {
|
|
@@ -107,13 +109,10 @@
|
|
|
} else {
|
|
|
// currentTag.value = item;
|
|
|
sceneStore.setCurrentTag(item);
|
|
|
+
|
|
|
isClick.value = true;
|
|
|
- try {
|
|
|
- // focusTag(item);
|
|
|
- } catch (error) {
|
|
|
- console.log('error', error);
|
|
|
- }
|
|
|
}
|
|
|
+ emit('setCurrentTag');
|
|
|
};
|
|
|
const onMouseLeave = (_, tag: tagType) => {
|
|
|
if (
|
|
@@ -122,14 +121,17 @@
|
|
|
currentTag.value?.sid === tag.sid &&
|
|
|
!unref(showLayer)
|
|
|
) {
|
|
|
- // currentTag.value = null;
|
|
|
sceneStore.setCurrentTag(null);
|
|
|
+ emit('setCurrentTag');
|
|
|
}
|
|
|
};
|
|
|
const onMouseEnter = (_, tag: tagType) => {
|
|
|
if (!unref(isMobile)) {
|
|
|
+ if (unref(isClick) && currentTag.value?.sid !== tag.sid) {
|
|
|
+ isClick.value = false;
|
|
|
+ }
|
|
|
sceneStore.setCurrentTag(tag);
|
|
|
- // currentTag.value = tag;
|
|
|
+ emit('setCurrentTag');
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -144,19 +146,20 @@
|
|
|
app.TagManager.load(tags.value);
|
|
|
app.TagManager.updatePosition(tags.value);
|
|
|
}
|
|
|
+ if (currentTag.value) {
|
|
|
+ //用 watch deep由于object prop过多会引起loop
|
|
|
+ if (unref(isMobile)) {
|
|
|
+ focusTag(currentTag.value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (currentTag.value && isClick.value) {
|
|
|
+ //用 watch deep由于object prop过多会引起loop
|
|
|
+ if (!unref(isMobile)) {
|
|
|
+ focusTag(currentTag.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();
|
|
@@ -171,6 +174,9 @@
|
|
|
} else {
|
|
|
// window.addEventListener('click', onClickHandler)
|
|
|
}
|
|
|
+ watch(currentTagLayerIndex, () => {
|
|
|
+ emit('setCurrentTag');
|
|
|
+ });
|
|
|
});
|
|
|
const getUrl = (icon) => {
|
|
|
let url =
|