فهرست منبع

fix:就近导览 等

xzw 3 سال پیش
والد
کامیت
3b9015b1a9

BIN
public/static/images/ani/HH_talk01.png


BIN
public/static/images/ani/HH_talk02.png


BIN
public/static/images/ani/HH_talk03.png


BIN
public/static/images/ani/HH_walk02.png


BIN
public/static/images/ani/ZZ_J.png


BIN
public/static/images/ani/ZZ_talk01.png


BIN
public/static/images/ani/ZZ_talk02.png


BIN
public/static/images/ani/ZZ_talk03.png


BIN
public/static/images/ani/ZZ_walk02.png


+ 2 - 3
public/static/js/Hot.js

@@ -1262,8 +1262,7 @@ window.initHot = function(model) {
       var plane = this.plane;
 
       if (type == "photo") {
-        if (this.photoHasRequestLoad || this.texType != "photo") {
-          callback && callback();
+        if (this.photoHasRequestLoad || this.texType != "photo") { 
           return;
         }
         //console.log('overlay beginDownload : ' + this.sid)
@@ -1333,7 +1332,7 @@ window.initHot = function(model) {
               {
                 e._loadDones.forEach((a) => a());
                 e._loadDones = null;
-                e.photoHasRequestLoad = true;
+                //e.photoHasRequestLoad = true;
               }
               e.material_.needsUpdate = true;
             }

+ 70 - 46
public/static/js/main_2020_show.js

@@ -9,9 +9,11 @@
 
 //路线
   
-  var routeArray = ["0","7","6","5","4","8","9","11","32","31","30","28","47","48","61","62","80","77","78","92","117","116","95","94","107","108", "112","111","98","120","121","122","123","124","125","131","132","133","135","136","143","144","174","175","148","161","160","184","185","183","157","180","162","163","182","165","191","199","190","217","215","214","213","212","218","230","231","222","223","224","232","233","234","235","236","237"
-    ]
+  /* var routeArray = ["0","7","6","5","4","8","9","11","32","31","30","28","47","48","61","62","80","77","78","92","117","116","95","94","107","108", "112","111","98","120","121","122","123","124","125","131","132","133","135","136","143","144","174","175","148","161","160","184","185","183","157","180","162","163","182","165","191","199","190","217","215","214","213","212","218","230","231","222","223","224","232","233","234","235","236","237"
+    ] */
     
+ var routeArray =  ["0","7","6","5","4","8","9","32","251","31","30","47","48","61","62","63","64","65","66","96","97","120","121","122","248","247","246","133","134","145","174","175","147","176","179","180","181","187","215","214","213","212","218","230","231","222","223","232","233","234","235","236","237"   
+    ]
 var arrows = []
 
 
@@ -232,7 +234,7 @@ var updateArrow = function(currentPano){//根据当前pano更新
 
  
 
-var addModelBack = function(model){
+/* var addModelBack = function(model){
     let mat = new THREE.MeshBasicMaterial({side:1, color:0xffffff, transparent:true, opacity:0.5,
        
     }) 
@@ -271,7 +273,7 @@ var addModelBack = function(model){
     transparentModel.children[1].geometry.setIndex(new THREE.BufferAttribute(new Uint16Array(newIndex),1))
     //注:面的index在getMouseIntersect中获取
     
-}
+} */
 
 
 
@@ -5520,34 +5522,53 @@ window.Modernizr = function(n, e, t) {
                     .bind(this), this.goNext.bind(this))
             }
             ,
-            n.prototype.playTour = function() {
-                if (!this.bounceable()) {
-
-                    if(!this.currentItem) this.currentItem = []
-                    if(this.currentItem[0] != 0 || this.destinationItem[0]!= this.nItems-1){
-                        // zeg 从当前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, panoIndex + 3, panoIndex - 3 ]
-                            for(var i = 0; i < neighbourIndex.length; i++) {
-                                currentPanoDestinations = this.panoIdMap.get(this.model.panos.list[neighbourIndex[i]]&&this.model.panos.list[neighbourIndex[i]].id)
-                                if(currentPanoDestinations && currentPanoDestinations[0] != 0) break
+            
+            
+            n.prototype.findNearestItem = function(){//找到离currentPano最近的导览
+                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];
+                        var dis = pano.position.distanceTo(this.player.currentPano.position)
+                        if(dis<result.dis){
+                            result.item = item, result.dis = dis
+                        }else if(dis == result.dis){//如果两个位置相同,优先播放在导览条上离激活的最近的那段导览 
+                            /* if(this.itemCompare(item,  this.currentItem, 'equal')){
+                                result.item = item, result.dis = dis
+                            } */ 
+                            if(this.currentItem && Math.abs(item[0]-this.currentItem[0]) < Math.abs(result.item[0]-this.currentItem[0])){
+                                result.item = item, result.dis = dis
                             }
-                            if(!currentPanoDestinations) currentPanoDestinations = [0];
-                        }
-                        if(currentPanoDestinations.indexOf(this.currentItem[0]) == -1) {
-                            this.currentItem[0] = currentPanoDestinations[0]
+                            
+                            
                         }
                     }
-
+                    
+                }
+                this.model.heroLocations.forEach((e,i)=>{
+                    if(e.heroLocations){
+                       /* e.heroLocations.forEach((a,j)=>{
+                           compare(a, [i,j])
+                       }) */
+                       var location = e.heroLocations.find(e=>e.panoId != void 0)
+                       location && compare(location, [i,0])
+                       
+                    }else{
+                       compare(e, [i,0])
+                    }  
+                    
+                })
+                return result.item
+                
+            }
+            
+            
+            
+            
+            
+            
+            n.prototype.playTour = function() { 
+                if (!this.bounceable()){
                     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",
@@ -5558,16 +5579,17 @@ 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()))
-                }
-            } 
+ 
+                    /* this.walkingSectionPaused ? (this.clearWalkingSectionPaused(),
+                    this.goToDestination()) : this.goNext())) */
+                    
+                    
+                    this.setDestinationItem(this.findNearestItem()) , this.goToDestination()) )
+               } 
+                    
+            }             
 			,
-			/* n.prototype.bgmReplay = function() {//xzw add  结束tour后可能要继续播放背景音乐
-			  
-                
-			} */
+			 
 			 
             n.prototype.stopTour = function(isAutoStop) {//停止导览        isAutoStop 希望仅在飞完结束自动停止时的stopTour不停止tourSound, 这样才能完整播放tourSound.  不过似乎会在倒数第二个片段点击按钮停止导览时也视作自动结束的(执行this.interrupt() )。
                 SoundManager.pause('tour'), // zeg 自动导览暂停时同时停止语音
@@ -5736,7 +5758,7 @@ window.Modernizr = function(n, e, t) {
                 A.debug("tourAdvance(" + e + ")") 
 
                 // zeg改
-                if(null === this.currentItem || void 0 === this.currentItem){
+                /* if(null === this.currentItem || void 0 === this.currentItem){
                     // this.setDestinationItem(this.firstDestination()) 
                     // this.setDestinationItem([currentPanoDestinations[0], 0]) 
                     this.setDestinationItem([this.currentItem[0], 0]) 
@@ -5744,8 +5766,10 @@ window.Modernizr = function(n, e, t) {
                 else if(this.currentItem[1] == null) {
                     this.setDestinationItem([this.currentItem[0], 0])
                 }
-                else{ 
-                    
+                else{  */
+                if(null === this.currentItem || void 0 === this.currentItem){
+                    this.setDestinationItem(this.firstDestination()) 
+                }else{ 
                         var item    
                         if(e == 1){
                             item = this.nextItem(this.currentItem)
@@ -5756,7 +5780,7 @@ window.Modernizr = function(n, e, t) {
                         this.setDestinationItem(item) 
                 }
                 
-                if(this.itemCompare(this.destinationItem, this.finalDestination(), 'equal')[0] < 0 ){ 
+                if(this.itemCompare(this.destinationItem, this.finalDestination(), 'equal')){ 
                     this.useSpecialTransition("reverse-looping to end") 
                 }else if(this.itemCompare(this.destinationItem, this.firstDestination(), 'equal')){ 
                     this.useSpecialTransition("looping back to start")
@@ -18554,7 +18578,7 @@ window.Modernizr = function(n, e, t) {
                 }
                 //---------   
                 createGuideAni(this)
-                addModelBack(this)
+                //addModelBack(this)
                 this.createFloorLogo()
                 
                 return O.debug("Done building model"),
@@ -24056,10 +24080,10 @@ window.Modernizr = function(n, e, t) {
                 
                 if(i == "panorama"){  
                     this.transitionPos({type:"beforeFlyIn", pano:n, dur:I})//add  
-                    this.model.transparentModel.visible = false                    
+                    //this.model.transparentModel.visible = false                    
                 }else{
                     Hot.updateVisibles(false)
-                    this.model.transparentModel.visible = true               
+                    //this.model.transparentModel.visible = true               
                     this.transitionPos({type:"beforeFlyOut",  dur:I/2})//add                       
                 }
                 
@@ -24430,7 +24454,7 @@ window.Modernizr = function(n, e, t) {
             ,
             n.prototype.getCurrentNodePanos = function(e) {
                 this.model.panos.map;
-                if (e.length = 0, this.path.nodes){
+                if (e.length = 0, this.path.nodes.length){
                     
                     var momentTour = this.director.getMomentTour(this.director.destinationItem)  
                     if(momentTour == 'black'){ //改 upcomingPanos如果是black的只需要起点和终点