jinx 1 rok temu
rodzic
commit
f8d530f6b5

+ 18 - 0
scene/src/assets/image/icon/new-icon/icon_pause_n.svg

@@ -0,0 +1,18 @@
+<svg width="56" height="56" viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g id="icon_play">
+<g id="Rectangle 5">
+<rect x="1" y="1" width="54" height="54" rx="27" fill="#373635" fill-opacity="0.6"/>
+<rect x="0.5" y="0.5" width="55" height="55" rx="27.5" stroke="#805454" stroke-opacity="0.6"/>
+</g>
+<rect id="Rectangle 469" x="20" y="18" width="4" height="19" rx="2" fill="#C7A770"/>
+<rect id="Rectangle 470" x="32" y="18" width="4" height="19" rx="2" fill="#C7A770"/>
+<g id="Mask group">
+<mask id="mask0_327_1143" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="20" y="18" width="16" height="19">
+<path id="Union" fill-rule="evenodd" clip-rule="evenodd" d="M22 18C20.8954 18 20 18.8954 20 20V35C20 36.1046 20.8954 37 22 37C23.1046 37 24 36.1046 24 35V20C24 18.8954 23.1046 18 22 18ZM34 18C32.8954 18 32 18.8954 32 20V35C32 36.1046 32.8954 37 34 37C35.1046 37 36 36.1046 36 35V20C36 18.8954 35.1046 18 34 18Z" fill="#D9D9D9"/>
+</mask>
+<g mask="url(#mask0_327_1143)">
+<rect id="Rectangle 466" x="15" y="28" width="30" height="17" fill="#A88959"/>
+</g>
+</g>
+</g>
+</svg>

+ 4 - 0
scene/src/store/index.js

@@ -11,6 +11,7 @@ const store = new Vuex.Store({
     showGuide: false,
     guideIsPlay: false,
     guideIsPlay: false,
+    guidePlayIndex:0,
   },
   getters: {
     points(state) {
@@ -25,6 +26,9 @@ const store = new Vuex.Store({
     guideIsPlay(state) {
       return state.guideIsPlay;
     },
+    guidePlayIndex(state) {
+      return state.guidePlayIndex;
+    },
   },
   mutations: {
     setData(state, payload) {

+ 19 - 11
scene/src/views/gui/components/guide.vue

@@ -15,22 +15,21 @@
     <!-- <div class="swcon" v-swiper:mySwiper="swiperOption"  ref="floor1Swiper"> -->
     <div class="swcon" ref="mySwiper">
       <ul class="swiper-wrapper swiper-wrapper-n">
-        <div class="swiper-slide" :class="{ active: index == activeIndex }" v-for="(i, index) in tourList">
+        <div class="swiper-slide" :class="{ active: index == guidePlayIndex }" v-for="(i, index) in tourList">
           <img :src="i.heroLocations[0].thumbUrl" alt="" />
           <div class="sl-item" :data-v="JSON.stringify({ data: i.heroLocations[0], index })">
             <span>{{ i.heroLocations[0].name }}</span>
           </div>
-          {{ index }}
         </div>
       </ul>
     </div>
 
     <div class="progress-box">
       <div class="info">
-        <span>{{ activeIndex + 1 }}</span
+        <span>{{ guidePlayIndex + 1 }}</span
         >of<span>{{ tourList.length }}</span>
       </div>
-      <div class="bar-box"><div :style="`width:${100 / tourList.length}%;left:${(activeIndex * 100) / tourList.length}%;`" class="current-box"></div></div>
+      <div class="bar-box"><div :style="`width:${100 / tourList.length}%;left:${(guidePlayIndex * 100) / tourList.length}%;`" class="current-box"></div></div>
     </div>
   </div>
 </template>
@@ -49,13 +48,14 @@ export default {
   props: ["tourList"],
   data() {
     //这里存放数据
-    return { activeIndex: 5 };
+    return {};
   },
   //监听属性 类似于data概念
   computed: {
     ...mapGetters({
       panoId: "panoId",
       guideIsPlay: "guideIsPlay",
+      guidePlayIndex: "guidePlayIndex",
     }),
   },
   //监控data中的数据变化
@@ -64,14 +64,18 @@ export default {
   methods: {
     ...mapMutations(["setData", "setPanoOver"]),
     handleTour() {
+      if (this.guideIsPlay) {
+        player.director.tourInProgress && (player.director.stopTour(), player.director.endTourProgress());
+      } else {
+        settings.playTourNearBy ? player.director.playTourNearBy() : player.director.playTour();
+      }
       this.setData({ guideIsPlay: !this.guideIsPlay });
     },
     closeGuide() {
       this.setData({ showGuide: false });
     },
     changeGuide(i, index) {
-      console.error(i);
-      this.activeIndex = index;
+      this.guidePlayIndex = index;
     },
     initSwiper() {
       new Swiper(this.$refs.mySwiper, {
@@ -85,6 +89,10 @@ export default {
         centerInsufficientSlides: true,
         centeredSlidesBounds: true,
         on: {
+          init: () => {
+            console.error("init");
+            settings.playTourNearBy ? player.director.playTourNearBy() : player.director.playTour();
+          },
           slideChangeTransitionEnd: function () {
             // that.mbactive = this.realIndex;
           },
@@ -93,12 +101,12 @@ export default {
               // 这里的 obj 就是当前点击图片所对应的信息
 
               let { index, data } = JSON.parse(event.target.getAttribute("data-v"));
-              console.error(data, index);
-              this.activeIndex = index;
+              this.setData({ guidePlayIndex: index });
+              player.director.goToHighlight([index, 0]);
               // let { panoId, quaternion } = data.heroLocations[0];
-              let { panoId, quaternion } = data;
+              // let { panoId, quaternion } = data;
               // player.model.heroLocations里的那些item
-              player.blackToPano({ pano: player.model.panos.get(panoId), quaternion: new THREE.Quaternion(quaternion._x, quaternion._y, quaternion._z, quaternion._w) });
+              // player.blackToPano({ pano: player.model.panos.get(panoId), quaternion: new THREE.Quaternion(quaternion._x, quaternion._y, quaternion._z, quaternion._w) });
             }
           },
         },

+ 27 - 10
scene/src/views/gui/menu.vue

@@ -155,10 +155,10 @@
     <div class="guide-progress" v-if="!showGuide && guideIsPlay">
       <div class="progress-box">
         <div class="info">
-          <span>{{ 1 }}</span
+          <span>{{ guidePlayIndex + 1 }}</span
           >of<span>{{ tourList.length }}</span>
         </div>
-        <div class="bar-box"><div :style="`width:${100 / tourList.length}%;left:${(activeIndex * 100) / tourList.length}%;`" class="current-box"></div></div>
+        <div class="bar-box"><div :style="`width:${100 / tourList.length}%;left:${(guidePlayIndex * 100) / tourList.length}%;`" class="current-box"></div></div>
       </div>
     </div>
 
@@ -166,8 +166,13 @@
     <div class="minimap-controls" :class="{ open: !miniMapStatus, mobile: isMobile }" @click="toggleMiniMap"></div>
     <template v-if="!isMobile">
       <transition name="fade" enter-active-class="animate__animated animate__fadeInUp animate__faster" leave-active-class="animate__animated animate__fadeOutDown animate__faster">
-        <div v-show="openType != 'immersive' && !showGuide" class="left-btn" :class="{}">
-          <div class="button-item" :class="getActive(i.type)" v-if="i.type == 'model' || mode == 'panorama'" v-for="(i, index) in leftButtons" @click.stop="hanlderButtons(i, i.type)">
+        <div v-show="openType != 'immersive' && !showGuide" class="left-btn">
+          <div class="button-item" :class="getActive(i.type)" v-show="i.type == 'model' || mode == 'panorama'" v-for="(i, index) in leftButtons" @click.stop="hanlderButtons(i, i.type)">
+            <img class="normal" :src="i.normalIcon" alt="" />
+            <img class="active" :src="i.activeIcon" alt="" />
+            <div class="tip-box">{{ i.name }}</div>
+          </div>
+          <div class="button-item" v-if="(i.action == 'play' && !guideIsPlay) || (i.action == 'pause' && guideIsPlay)" v-for="(i, index) in playButtons" @click.stop="hanlderButtons(i, i.type)">
             <img class="normal" :src="i.normalIcon" alt="" />
             <img class="active" :src="i.activeIcon" alt="" />
             <div class="tip-box">{{ i.name }}</div>
@@ -272,6 +277,23 @@ export default {
       // vr---热点列表---分享
       openInd: 0,
       isFullscreen: false,
+      playButtons: [
+        {
+          normalIcon: require("@/assets/image/icon/new-icon/icon_play.svg"),
+          activeIcon: require("@/assets/image/icon/new-icon/icon_play.svg"),
+          name: "自动导览",
+          action: "play",
+          type: "guide",
+        },
+        {
+          normalIcon: require("@/assets/image/icon/new-icon/icon_pause_n.svg"),
+          activeIcon: require("@/assets/image/icon/new-icon/icon_pause_n.svg"),
+          name: "自动导览",
+          action: "pause",
+          type: "guide",
+        },
+      ],
+
       leftButtons: [
         {
           normalIcon: require("@/assets/image/icon/new-icon/icon_dollhouse.svg"),
@@ -315,12 +337,6 @@ export default {
           name: "沉浸看展",
           type: "immersive",
         },
-        {
-          normalIcon: require("@/assets/image/icon/new-icon/icon_play.svg"),
-          activeIcon: require("@/assets/image/icon/new-icon/icon_play.svg"),
-          name: "自动导览",
-          type: "guide",
-        },
       ],
       rightButtons: [
         {
@@ -390,6 +406,7 @@ export default {
       points: "points",
       showGuide: "showGuide",
       guideIsPlay: "guideIsPlay",
+      guidePlayIndex: "guidePlayIndex",
     }),
   },
   mounted() {