zhouenguang před 3 roky
rodič
revize
1dd5a05ff8
1 změnil soubory, kde provedl 40 přidání a 29 odebrání
  1. 40 29
      web/public/static/js/main_2020_show.js

+ 40 - 29
web/public/static/js/main_2020_show.js

@@ -4818,7 +4818,7 @@ window.Modernizr = function(n, e, t) {
                     let audioSrc2 = common.getFileNameFromUrl(src)
                
                     if(audioSrc1 == audioSrc2){//应该是继续播放该folder 
-                        if(this.destinationItem[1] == 1){//从头开始播放 因为可能暂停后然后再点该缩略图播    // 周恩光改 开头为1
+                        if(this.destinationItem[1] == 0){//从头开始播放 因为可能暂停后然后再点该缩略图播    // 周恩光改 开头为1
                             SoundManager.play('tour',null,0)  // currentTime = 0; 
                         }else if( audioObj.audio.paused && audioObj.audio.currentTime < audioObj.audio.duration   ){//未播完
                             SoundManager.play('tour')//继续播。为什么会有暂停的情况?如果手动切换到bgm了呢?
@@ -4899,6 +4899,7 @@ window.Modernizr = function(n, e, t) {
                         this.player.tourInterlude(this.nextItem(this.currentItem),this.actionComplete.bind(this))
                     }
                     .bind(this), function(){
+                        this.currentItem = [0,0],
                         this.stopTour(true),
                         this.emit(p.TourEnd)
                     }.bind(this)),
@@ -4910,7 +4911,33 @@ window.Modernizr = function(n, e, t) {
             }
             ,
             n.prototype.playTour = function() {
-                if (!this.bounceable())
+                if (!this.bounceable()) {
+
+                    if(this.currentItem[0] != 0 || this.destinationItem[0]!= this.nItems-1){
+                        // 周恩光加 从当前pano进行自动导览
+                        let currentPanoDestinations = this.panoIdMap.get(this.player.currentPano.id)
+                        // this.model.heroLocations.forEach( (value, index) => {
+                            // if(value.heroLocations.find( hl => hl.panoId == this.player.currentPano.id )) {
+                            //     currentPanoDestinations.push(index)
+                            // }
+                        // })
+
+                        if(!currentPanoDestinations) { 
+                            // let panoIndex = this.model.panos.list.findIndex( pano => pano.id == this.player.currentPano.id )
+                            let panoIndex = this.model.panos.list.indexOf( this.player.currentPano )
+                            let neighbourIndex = [ panoIndex + 1, panoIndex - 1, panoIndex + 2, panoIndex - 2 ]
+                            for(var i = 0; i < neighbourIndex.length; i++) {
+                                currentPanoDestinations = this.panoIdMap.get(this.model.panos.list[neighbourIndex[i]].id)
+                                if(currentPanoDestinations) break
+                            }
+                            if(!currentPanoDestinations) 
+                            currentPanoDestinations.push(0) 
+                        }
+                        if(currentPanoDestinations.indexOf(this.currentItem[0]) == -1) {
+                            this.currentItem[0] = currentPanoDestinations[0]
+                        }
+                    }
+
                     return this.tourIsPlaying ? void A.info("tour is already playing") : void (this.wouldInterrupt() || (this.player.emit("tour_auto", this.defaultWarpStyle),
                     this.tourInProgress = !0,
                     this.reachSource = "play",
@@ -4921,8 +4948,10 @@ window.Modernizr = function(n, e, t) {
                     this.emit("update.controls"),
                     this.emit(p.TourStart),
                     this.player.enablePreRendering(),
+                    this.currentItem[1] = null,
                     this.walkingSectionPaused ? (this.clearWalkingSectionPaused(),
                     this.goToDestination()) : this.goNext()))
+                }
             } 
 			,
 			/* n.prototype.bgmReplay = function() {//xzw add  结束tour后可能要继续播放背景音乐
@@ -5060,7 +5089,7 @@ window.Modernizr = function(n, e, t) {
                 var currentChildNum = currentLocation.heroLocations ? currentLocation.heroLocations.length : 1
                 var item;
                 if(this.currentItem[1] >= currentChildNum - 1){//子目录中最后一个
-                    item = [currentItem[0] + 1, 1] //结果可能超出nItems // 周恩光 导览片段从1开始
+                    item = [currentItem[0] + 1, 0] //结果可能超出nItems // 周恩光 导览片段从1开始
                 }else{
                     item = [currentItem[0] , currentItem[1]+1]
                 }
@@ -5080,7 +5109,7 @@ window.Modernizr = function(n, e, t) {
                 else{
                     var lastChildNum = lastLocation.heroLocations ? lastLocation.heroLocations.length : 1
             
-                    if(this.currentItem[1] == 1){//子目录中第一个 
+                    if(this.currentItem[1] == 0){//子目录中第一个 
                         return [currentItem[0] - 1, lastChildNum-1]
                     }else{
                         return [currentItem[0], currentItem[1]-1]
@@ -5095,35 +5124,18 @@ window.Modernizr = function(n, e, t) {
             n.prototype.tourAdvance = function(e) {//e是1或-1
                 
                 A.debug("tourAdvance(" + e + ")") 
-                // 周恩光加 从当前pano进行自动导览
-                let currentPanoDestinations = this.panoIdMap.get(this.player.currentPano.id)
-                // this.model.heroLocations.forEach( (value, index) => {
-                    // if(value.heroLocations.find( hl => hl.panoId == this.player.currentPano.id )) {
-                    //     currentPanoDestinations.push(index)
-                    // }
-                // })
-
-                if(!currentPanoDestinations) { 
-                    // let panoIndex = this.model.panos.list.findIndex( pano => pano.id == this.player.currentPano.id )
-                    let panoIndex = this.model.panos.list.indexOf( this.player.currentPano )
-                    let neighbourIndex = [ panoIndex + 1, panoIndex - 1, panoIndex + 2, panoIndex - 2 ]
-                    for(var i = 0; i < neighbourIndex.length; i++) {
-                        currentPanoDestinations = this.panoIdMap.get(this.model.panos.list[neighbourIndex[i]].id)
-                        if(currentPanoDestinations) break
-                    }
-                    if(!currentPanoDestinations) 
-                    currentPanoDestinations.push(0) 
-                }
 
                 // 周恩光改 导览片段应该从1开始,而不是0
                 if(null === this.currentItem || void 0 === this.currentItem){
                     // this.setDestinationItem(this.firstDestination()) 
                     // this.setDestinationItem([currentPanoDestinations[0], 0]) 
-                    this.setDestinationItem([currentPanoDestinations[0], 1]) 
-                }else{ 
-                    if(currentPanoDestinations.indexOf(this.currentItem[0]) == -1) {
-                        this.setDestinationItem([currentPanoDestinations[0], 1])
-                    } else {
+                    this.setDestinationItem([this.currentItem[0], 0]) 
+                }
+                else if(this.currentItem[1] == null) {
+                    this.setDestinationItem([this.currentItem[0], 0])
+                }
+                else{ 
+                    
                         var item    
                         if(e == 1){
                             item = this.nextItem(this.currentItem)
@@ -5132,7 +5144,6 @@ window.Modernizr = function(n, e, t) {
                             
                         }
                         this.setDestinationItem(item) 
-                    }
                 }
                 
                 if(this.itemCompare(this.destinationItem, this.finalDestination(), 'equal')[0] < 0 ){