Browse Source

currentPanoTour

zhouenguang 3 years ago
parent
commit
6998ffa8f9
1 changed files with 29 additions and 11 deletions
  1. 29 11
      web/public/static/js/main_2020_show.js

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

@@ -4786,7 +4786,8 @@ window.Modernizr = function(n, e, t) {
                 //音频 
                 
                 var musicInfo = this.model.heroLocations[this.destinationItem[0]].musicInfo
-                if(musicInfo && musicInfo.music){
+                // 手动导览不播放音频
+                if(musicInfo && musicInfo.music && !e){
                     let src = musicInfo.music.includes(g_Prefix.slice(-10)) ? musicInfo.music :  g_Prefix + musicInfo.music;
                     let audioObj = SoundManager.list.find(e=>e.name == 'tour')
                     let audioSrc1 = common.getFileNameFromUrl(audioObj.src);  
@@ -4822,9 +4823,11 @@ window.Modernizr = function(n, e, t) {
                 if (this.player.flying || this.player.isWarping())
                     A.warn("Cannot go to new destination while player is flying or warping.");
                 else {
+
                     var r = this.model.getHeroDescriptorByIndex(this.destinationItem)
                       , o = null
                       , a1 = null;
+                    //   console.error(this.destinationItem)
                     if (r.isPano()) {
                     
                         //var s = 0 === this.destinationItem || e ? u.BLACK : this.nextWarpStyle;
@@ -5056,18 +5059,33 @@ window.Modernizr = function(n, e, t) {
             n.prototype.tourAdvance = function(e) {//e是1或-1
                 
                 A.debug("tourAdvance(" + e + ")") 
+                // 周恩光加 从当前pano进行自动导览
+                let currentPanoDestinations = []
+                this.model.heroLocations.forEach( (value, index) => {
+                    if(value.heroLocations.find( hl => hl.panoId == this.player.currentPano.id )) {
+                        currentPanoDestinations.push(index)
+                    }
+                })
+                if(!currentPanoDestinations[0]) { currentPanoDestinations.push(0) }
+
                 if(null === this.currentItem || void 0 === this.currentItem){
-                    this.setDestinationItem(this.firstDestination()) 
+                    // this.setDestinationItem(this.firstDestination()) 
+                    this.setDestinationItem([currentPanoDestinations[0], 0]) 
                 }else{ 
-                    var item    
-                    if(e == 1){
-                        item = this.nextItem(this.currentItem)
-                    }else if(e == -1){
-                        item = this.prevItem(this.currentItem)    
-                        
-                    }  
-                    this.setDestinationItem(item) 
+                    if(currentPanoDestinations.indexOf(this.currentItem[0]) == -1) {
+                        this.setDestinationItem([currentPanoDestinations[0], 0])
+                    } else {
+                        var item    
+                        if(e == 1){
+                            item = this.nextItem(this.currentItem)
+                        }else if(e == -1){
+                            item = this.prevItem(this.currentItem)    
+                            
+                        }
+                        this.setDestinationItem(item) 
+                    }
                 }
+                
                 if(this.itemCompare(this.destinationItem, this.finalDestination(), 'equal')[0] < 0 ){ 
                     this.useSpecialTransition("reverse-looping to end") 
                 }else if(this.itemCompare(this.destinationItem, this.firstDestination(), 'equal')){ 
@@ -19777,7 +19795,7 @@ window.Modernizr = function(n, e, t) {
             n.prototype.getHeroIndexFromPanoId = function(e) {
                 for (var t = 0; t < this.model.heroLocations.length; t++) {
                     var i = this.model.heroLocations[t]
-                      , n = this.getHeroId(i);
+                    , n = this.getHeroId(i);
                     if (n && n === e)
                         return t
                 }