jinx 2 anos atrás
pai
commit
d9c9a8609c
2 arquivos alterados com 49 adições e 6 exclusões
  1. 28 4
      src/components/files/index.vue
  2. 21 2
      src/pages/Viewer.vue

+ 28 - 4
src/components/files/index.vue

@@ -1,6 +1,6 @@
 <template>
     <transition name="slide-right" mode="in-out">
-        <div class="files" v-if="showFiles && !isEdit">
+        <div class="files" v-if="showFiles && !isEdit" >
             <div class="info" ref="add$">
                 <button @click="onAdd">{{ $t('tag.addTag') }}</button>
                 <div>
@@ -8,7 +8,7 @@
                     >)
                 </div>
             </div>
-            <div class="list" :style="`height:${listStyle};`">
+            <div class="list" :style="`height:${listStyle};`" :class="{ disabled: isFlying }">
                 <ul>
                     <li v-for="tag in tags" @click="onClick(tag)" :class="{ active: notify?.sid == tag.sid }">
                         <div class="title"><i></i>{{ tag.title }}</div>
@@ -83,8 +83,12 @@ const tags = inject('tags')
 
 const notify = inject('notify')
 const isEdit = inject('isEdit')
+const isFlying = inject('isFlying')
 const onClick = tag => {
-    notify.value = tag //{ event: 'focus', sid: props.tag.sid, tag: props.tag }
+    notify.value = null
+    nextTick(() => {
+        notify.value = tag //{ event: 'focus', sid: props.tag.sid, tag: props.tag }
+    })
 }
 let isAdd = false
 const onAdd = () => {
@@ -259,7 +263,27 @@ watchEffect(() => {
     }
 })
 
-onMounted(() => {})
+onMounted(() => {
+    // app.Camera.on('flying.started', pano => {
+    //     store.commit('setFlying', true)
+    // })
+    // app.Camera.on('flying.ended', ({ targetPano }) => {
+    //     store.commit('setFlying', false)
+    // })
+    // if (window.kankan) {
+    //     console.error(window.kankan)
+    // } else if (window.laser) {
+    //     window.laser.then(res => {
+    //         console.error(res)
+    //     })
+    // }
+    // window[0].Scene.on('loaded', sdk => {
+    //     console.error(e)
+    // })
+    // window[0].loaded.then(sdk => {
+    //     console.error(sdk)
+    // })
+})
 </script>
 <style lang="scss" scoped>
 button {

+ 21 - 2
src/pages/Viewer.vue

@@ -128,10 +128,12 @@ const tags = ref([])
 const notify = ref(null)
 const isEdit = ref(false)
 const isLogin = ref(false)
+const isFlying = ref(false)
 provide('tags', tags)
 provide('notify', notify)
 provide('isEdit', isEdit)
 provide('isLogin', isLogin)
+provide('isFlying', isFlying)
 const userId = ref(localStorage.getItem('userId') || null)
 
 const getUserId = id => {
@@ -308,8 +310,25 @@ const onLoadSource = () => {
     if (source.value.type < 2) {
         window['kankan'] = sourceFrame.value.contentWindow.app
         window['kankan'].TagManager.load(tags.value)
+
+        window['kankan'].Camera.on('flying.started', pano => {
+            isFlying.value = true
+        })
+        window['kankan'].Camera.on('flying.ended', pano => {
+            isFlying.value = false
+        })
     } else {
         window['laser'] = sourceFrame.value.contentWindow.loaded
+        window.laser.then(sdk => {
+            console.error(window[0].viewer)
+
+            window[0].viewer.images360.addEventListener('flyToPano',()=>{
+              isFlying.value = true
+            })
+            window[0].viewer.images360.addEventListener('flyToPanoDone',()=>{
+              isFlying.value = false
+            })
+        })
     }
     loadSourceScene(sourceFrame, source.value.type < 2 ? 'kankan' : 'laser', mode.value)
 }
@@ -557,12 +576,12 @@ const onP2Click = type => {
 const onRuleChecked = () => {
     if (ruleChecked.value) {
         ruleChecked.value = false
-        rules.forEach(rule=>{
+        rules.forEach(rule => {
             rule.clear()
         })
         return
     }
-    if (source.value.type<2) {
+    if (source.value.type < 2) {
         showRules.value = true
         window.kankan.TagManager.startMeasure()
     } else {