xzw 2 år sedan
förälder
incheckning
a71d38419c
1 ändrade filer med 8 tillägg och 2 borttagningar
  1. 8 2
      js/main_2020_show.js

+ 8 - 2
js/main_2020_show.js

@@ -4926,7 +4926,13 @@ window.Modernizr = function(n, e, t) {
             
             
             n.prototype.findNearestItem = function(endToStart=true){//找到离currentPano最近的导览
+                if(this.atDestinationPano(this.player.currentPano)){//在终点直接从头。但有的场景可能不希望如此,就想跳到所属的展区开始。
+                    return [0,0]
+                }
+                 
+            
                 var result = {item:[0,0], dis:Infinity};
+                
                 var compare = (location, item)=>{
                     if(location.panoId != void 0 && location.panoId!= "outside"){
                         var pano = this.model.panos.index[location.panoId];
@@ -4949,7 +4955,7 @@ window.Modernizr = function(n, e, t) {
                            compare(a, [i,j])
                        }) */
                        var location = e.heroLocations.find(e=>e.panoId != void 0)
-                       location && compare(location, [i,0])
+                       location && compare(location, [i,0]) //跳到此区域开头
                        
                     }else{
                        compare(e, [i,0])
@@ -4960,7 +4966,7 @@ window.Modernizr = function(n, e, t) {
                  
                 
                 if(endToStart && this.atEndOfTour(result.item)){ //如果是最后一个点,直接跳到开头,否则导览开始就在终点的话不会从头开始
-                    return [0,0]
+                    return [0,0]                                  //但注意最后是区域的话result.item是区域开头,除非站在最末最末尾的位置,上面的atDestinationPano直接返回
                 }
                 
                 return result.item