xzw 3 лет назад
Родитель
Сommit
29fa9f923e
2 измененных файлов с 66 добавлено и 27 удалено
  1. 18 3
      public/static/js/Hot.js
  2. 48 24
      public/static/js/main_2020_show.js

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

@@ -1,6 +1,6 @@
 //合并热点和展览
 g_currentHot = null;
-
+const playVideoWhenFlyOut = false
 window.initHot = function(model) {
   var objLoader = new THREE.OBJLoader();
   var _planeGeometry = new THREE.PlaneGeometry(1, 1);
@@ -287,7 +287,7 @@ window.initHot = function(model) {
           var video = $(
             `<video  controls="controls" loop autoplay x5-playsinline="" webkit-playsinline="true" playsinline="true" controlslist="nodownload"></video>`
           )[0];
-          video.src = manage.dealURL(this.info.texSrc);
+          //video.src = manage.dealURL(this.info.texSrc);
           video.name = this.info.fileName;
         }
 
@@ -786,6 +786,13 @@ window.initHot = function(model) {
 
         var cornerPointInfo = this.getCornerPoint();
         var cornerPoint;
+        
+        if(cornerPointInfo.diffLon < 3  || cornerPointInfo.diffLat < 3 ){
+            console.log('two far and small')
+            return false
+        }
+
+        
         if (cornerPointInfo.diffLon < 15 && cornerPointInfo.diffLat < 15) {
           //当很小的时候,只判断中心点即可
           cornerPoint = [cornerPointInfo.cornerPoint[0]];
@@ -801,7 +808,7 @@ window.initHot = function(model) {
         }
       } else {
         //飞出要判断模型阻挡,有点耗时就算了
-        return true;
+        return playVideoWhenFlyOut;
       }
     }
 
@@ -853,6 +860,13 @@ window.initHot = function(model) {
       this.videoControl(state);
     }
 
+    loadVideo(video){
+        if(video.src)return 
+        video.src = manage.dealURL(this.info.texSrc); 
+    }
+
+
+
     videoControl(state) {
       if (this.texType != "video" || !this.material_.map) return;
       var video = this.material_.map.image;
@@ -867,6 +881,7 @@ window.initHot = function(model) {
         }
       } else if (state) {
         if (video.paused) {
+            this.loadVideo(video)
           video.play();
           //console.log("play " + this.sid)
         }

+ 48 - 24
public/static/js/main_2020_show.js

@@ -5804,6 +5804,8 @@ window.Modernizr = function(n, e, t) {
             }
             ,
             n.prototype.getMomentTour = function(destinationItem) {//add
+            
+                //return 'std' 
                 var wholeMomentTour = window.DATA.momentTour || "walk"; //最外层
                  
                 if(!destinationItem) return wholeMomentTour
@@ -18265,30 +18267,51 @@ window.Modernizr = function(n, e, t) {
                     }else{  
                         g_data2 = hotMatcher(e);
                         this.hotsCount = 0; 
-                        
-                        //因为热点保存后在hots里的顺序会被修改,所以使用order来记录顺序,这里要重排序:
-                        if(e.hots){  
-                            var sids = Object.keys(e.hots).sort((a,b)=>{return e.hots[a].order - e.hots[b].order});
-                            sids.forEach((sid)=>{
-                                e.hots[sid].sid = sid
-                                new Hot(e.hots[sid], e.hots[sid].version != 'multi' && "byHot" )
-                            })
+                        let create = ()=>{
+                            
+                            //因为热点保存后在hots里的顺序会被修改,所以使用order来记录顺序,这里要重排序:
+                            if(e.hots){  
+                                var sids = Object.keys(e.hots).sort((a,b)=>{return e.hots[a].order - e.hots[b].order});
+                                sids.forEach((sid)=>{
+                                    e.hots[sid].sid = sid
+                                    
+                                    //if(e.hots[sid].texType == "shine" || e.hots[sid].texType == "photo" ){
+                                        
+                                        //e.hots[sid].styleImg = []
+                                        
+                                        
+                                        new Hot(e.hots[sid], e.hots[sid].version != 'multi' && "byHot" )
+                                    //}
+                                })
+                            } 
+                            
+                            if(e.overlays){
+                                e.overlays.forEach((info)=>{ 
+                                    //if(info.file.includes('m/data/762/edit/20210312_112357584.mp4') )return;
+                                    new Hot(info, 'byOverlay')  
+                                })
+                            } 
+                            Hot.createHotList();
+                            Hot.startLoad()  
+                            if(DATA.roomLabels){
+                                DATA.roomLabels.forEach((data)=>{
+                                    this.roomLabels.push(new RoomLabel(data))
+                                })
+                            }
+                            
+                            
                         }
-                        
-                        if(e.overlays){
-                            e.overlays.forEach((info)=>{ 
-                                //if(info.file.includes('m/data/762/edit/20210312_112357584.mp4') )return;
-                                new Hot(info, 'byOverlay')  
-                            })
-                        } 
-                        Hot.createHotList();
-                        Hot.startLoad()  
-                        if(DATA.roomLabels){
-                            DATA.roomLabels.forEach((data)=>{
-                                this.roomLabels.push(new RoomLabel(data))
-                            })
+                        if(player.currentPano){
+                            create()
+                        }else{
+                            let f = ()=>{
+                                window.bus.removeEventListener('playerAndModelReady',f) 
+                                create() 
+                            }
+                            window.bus.addEventListener('playerAndModelReady',f) 
                         }
                         
+                        
                         g_index = w.valueFromHash("m");
                          
                         
@@ -21990,7 +22013,7 @@ window.Modernizr = function(n, e, t) {
                 this.updateModel()
                 this.modeTran = ''
                 
-                window.bus.dispatchEvent({type:'playerAndModelReady'})
+                
             }
 			 
 			
@@ -22628,6 +22651,7 @@ window.Modernizr = function(n, e, t) {
             n.prototype.startInside = function(e, t, i, n, r) {
                 r = r || $.Deferred(),
                 this.currentPano = e;
+                window.bus.dispatchEvent({type:'playerAndModelReady'})
                 var o = e && !e.isAligned();
                 if (t = o ? e.position : t || e.position,
                 i = i || e.quaternion,
@@ -24060,11 +24084,11 @@ window.Modernizr = function(n, e, t) {
                 e = g.deepExtend({}, f[i], f[p + "-" + i]);
                 var I = void 0 !== o ? o : e.transitionTime;
                 this.emit(w.ModeChanging, p, i, n, I),
-                n && (this.currentPano = n),
+                n && (this.currentPano = n), 
                 this.switchCameraMode(i, c),
                 y.cancelById(V.LookTransition);
                 
-                
+                window.bus.dispatchEvent({type:'playerAndModelReady'}) 
                 
                  //before fly---------------------