zhouenguang 3 lat temu
rodzic
commit
3d85727d57
1 zmienionych plików z 31 dodań i 6 usunięć
  1. 31 6
      web/public/static/js/main_2020_show.js

+ 31 - 6
web/public/static/js/main_2020_show.js

@@ -4534,6 +4534,21 @@ window.Modernizr = function(n, e, t) {
                 this.updateModel(),
                 this.resetAll(),
                 this.bindEvents()
+                
+                // 周恩光 查询pano对应的导览片段
+                if(!this.panoIdMap) {
+                    this.panoIdMap = new Map()
+                    this.model.heroLocations.forEach( (value, index) => {
+                        value.heroLocations.forEach( hl => {
+                            let arr = this.panoIdMap.get(hl.panoId)
+                            if(arr){
+                                this.panoIdMap.set(hl.panoId, [...arr, index])
+                            } else {
+                                this.panoIdMap.set(hl.panoId, [index])
+                            }
+                        })
+                    })
+                }
             }
             ,
             n.prototype.resetAll = function() {
@@ -5061,13 +5076,23 @@ window.Modernizr = function(n, e, t) {
                 
                 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)
+                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 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[0]) { currentPanoDestinations.push(0) }
+                    if(!currentPanoDestinations) 
+                    currentPanoDestinations.push(0) 
+                }
 
                 if(null === this.currentItem || void 0 === this.currentItem){
                     // this.setDestinationItem(this.firstDestination())