xzw 2 дней назад
Родитель
Сommit
3a1259edc6
1 измененных файлов с 55 добавлено и 6 удалено
  1. 55 6
      js/main_2020_show.js

+ 55 - 6
js/main_2020_show.js

@@ -3,7 +3,7 @@
   */
  
 
-
+const dontStopTourWhenClickItem = false
 
 
 let highMapAddColor = 0//true
@@ -5119,7 +5119,7 @@ window.Modernizr = function(n, e, t) {
                 this.emit(p.TourEnd)
             }
             ,
-            n.prototype.goToHighlight = function(e) {
+             n.prototype.goToHighlight_old = function(e) {
                 if (this.wouldInterrupt())
                     this.itemCompare(this.destinationItem,e,'equal') ? this.interrupt() : this.redirectToItem(e, "goToHighlight");
                 else {
@@ -5134,8 +5134,55 @@ window.Modernizr = function(n, e, t) {
                         reach_source: "thumb"
                     })
                 }
+            },
+             
+            
+            n.prototype.goToHighlight = function(e) { // 切换导览时(点击列表item),不要停止导览 (故宫项目)
+                
+                if (this.wouldInterrupt()){
+                    
+                    if(dontStopTourWhenClickItem){
+                        this.waitHighlight = e //add
+                        let soon
+                        if(this.itemCompare(this.destinationItem,e,'equal') ){
+                            this.interrupt() 
+                            soon = true
+                        }else{
+                            this.redirectToItem(e, "goToHighlight") 
+                        }
+                        setTimeout(()=>{
+                            this.once(soon ? "tour.end" : "warp.end",()=>{ 
+                                console.log(this.currentItem)
+                                setTimeout(()=>{
+                                    this.waitHighlight = null
+                                    this.playTour() // 切换导览时(点击列表item),不要停止导览 
+                                },700) 
+                            }) 
+                        },10) 
+                    }else{
+                        this.itemCompare(this.destinationItem,e,'equal') ? this.interrupt() : this.redirectToItem(e, "goToHighlight");
+
+                    }
+                    
+                }else { 
+                    if (A.debug("<tour.goto " + e + ">"),
+                    this.isInterrupted())
+                        return;
+                    this.clearWalkingSectionPaused(),
+                    this.setDestinationItem(e),
+                    this.useSpecialTransition("Hilight")
+                    this.goToDestination(true),//add true
+                    h.trackAlways("reach_highlight", {
+                        reach_source: "thumb"
+                    })
+                    this.once('warp.end',()=>{
+                        this.waitHighlight = null //add
+                    })
+                 }
             }
-            ,
+             
+            
+            
             n.prototype.prevHighlight = function() {
                 this.bounceable() || (this.player.emit("tour_manual", "prev"),
                 this.interrupt(g.BEGINNING) || this.isInterrupted() || (this.clearWalkingSectionPaused(),
@@ -7100,7 +7147,7 @@ window.Modernizr = function(n, e, t) {
                 t.on("update.controls", function() {//导览控制
                     var n = t.describe();
                     
-                    if(n.tourIsPlaying || i.isWarping()){
+                    if(n.tourIsPlaying || i.isWarping() || t.waitHighlight){
                         
                         if(je.tourControls.visible){
                             l.hide() //play button
@@ -9141,7 +9188,7 @@ window.Modernizr = function(n, e, t) {
                 /* S.forEach(function(t) {//会触发导览停止  
                     t.addEventListener(e, stopTour, !0)
                 })  */
-                $("#drawer img").on(e, stopTour)
+                 $("#drawer img").on(e, stopTour)
             }) 
             document.addEventListener("keydown", u.bind(this, !1), !0) 
              
@@ -9169,7 +9216,8 @@ window.Modernizr = function(n, e, t) {
             }, p.tourInteraction.allowNextClick)) 
         }
         function stopTour() { //a
-            C.tourInProgress && (C.stopTour(),
+            if(dontStopTourWhenClickItem) return
+            C.tourInProgress && (C.stopTour(),   //interrupt函数也会停止
             C.endTourProgress(),
             E.classList.remove("playing")) 
         }
@@ -24574,6 +24622,7 @@ window.Modernizr = function(n, e, t) {
             }
             ,
             n.prototype.tourInterlude = function(e, t) {
+               //return //xzw add
                 this.history.invalidate();
                 this.path.discardSlow();
 				//xzw: