xzw 4 years ago
parent
commit
20f50ec2f5
5 changed files with 86 additions and 19 deletions
  1. 10 6
      js/main_2020_edit.js
  2. 71 9
      js/main_2020_show.js
  3. 2 2
      js/myShow-edit.js
  4. 2 2
      js/myShow.js
  5. 1 0
      js/showHardware.js

+ 10 - 6
js/main_2020_edit.js

@@ -1,6 +1,6 @@
 
 
-
+hardwareHotList = {}
 
 //热点  设备控制
 
@@ -3310,14 +3310,18 @@ function o(a, s, l) {
         }
         var r, o, a, s = e("three"), l = e("../settings"), c = e("./OutsideControls"), h = e("../enum/ControlActions"), u = e("../enum/MouseButton"), d = e("../util/math"), p = e("../util/browser");
         (n.prototype = Object.create(c.prototype)).zoomToContain = function(e) {
-            var t = Math.max(e.x, e.z)
-              , i = Math.min(e.x, e.z)
-              , n = Math.max(t, i * this.camera.aspect)
-              , r = Math.max(i, t * this.camera.aspect);
-            this.absoluteScale = (p.aspectRatio() < 1 ? r : n) / 2 / l.orthoBase * 1.2,
+            this.absoluteScale = this.getDefaultAbsoluteScale(e);
             this.currentScale = this.absoluteScale
         }
         ,
+        n.prototype.getDefaultAbsoluteScale = function(modelSize) {
+            var t = Math.max(modelSize.x, modelSize.z)
+              , i = Math.min(modelSize.x, modelSize.z)
+              , n = Math.max(t, i * this.camera.aspect)
+              , r = Math.max(i, t * this.camera.aspect);
+            this.absoluteScale = (p.aspectRatio() < 1 ? r : n) / 2 / l.orthoBase * 1.2 
+            return absoluteScale
+        },
         n.prototype.rotateToView = function(e, t) {
             var i = 0;
             p.aspectRatio() < 1 == e.x < e.z ? 0 < t.z && (i = Math.PI) : i = 0 < t.x ? Math.PI / 2 : -Math.PI / 2,

+ 71 - 9
js/main_2020_show.js

@@ -3404,14 +3404,20 @@ window.Modernizr = function(n, e, t) {
           , h = e("../util/browser");
         n.prototype = Object.create(a.prototype),
         n.prototype.zoomToContain = function(e) {
-            var t = Math.max(e.x, e.z)
-              , i = Math.min(e.x, e.z)
-              , n = Math.max(t, i * this.camera.aspect)
-              , r = Math.max(i, t * this.camera.aspect);
-            this.absoluteScale = (h.aspectRatio() < 1 ? r : n) / 2 / o.orthoBase * 1.2,
+            this.absoluteScale = this.getDefaultAbsoluteScale(e);
             this.currentScale = this.absoluteScale
         }
         ,
+        n.prototype.getDefaultAbsoluteScale = function(modelSize) {
+            var t = Math.max(modelSize.x, modelSize.z)
+              , i = Math.min(modelSize.x, modelSize.z)
+              , n = Math.max(t, i * this.camera.aspect)
+              , r = Math.max(i, t * this.camera.aspect);
+            var absoluteScale = (h.aspectRatio() < 1 ? r : n) / 2 / o.orthoBase * 1.2 
+            return absoluteScale
+        },
+        
+        
         n.prototype.rotateToView = function(e, t) {
             var i = 0
               , n = h.aspectRatio() < 1
@@ -15428,7 +15434,13 @@ window.Modernizr = function(n, e, t) {
                 }else{
                     this.createTitleElem(d.infoAttribute.title)  
                 }
-               
+                if(d.infoAttribute.hardware){
+                    var Code = d.infoAttribute.deviceCode;
+                    if(Code!= void 0){
+                        window.hardwareHotList[Code] = this
+                    }
+                }
+                
             } 
              
             this.changeTex()
@@ -15519,14 +15531,24 @@ window.Modernizr = function(n, e, t) {
         } 
         
         
-        hot.prototype.showPannel = function(){
+        hot.prototype.showPannel = function(o={}){
             var hardware = this.infoAttribute.hardware
             if(hardware && hardware.id!=void 0){
                 $("#hotPannel>div").css("display","block");
-                $("#hotPannel .title").text(hardware.name);
-                
+                $("#hotPannel .title").text(hardware.name); 
                 this.updatePannel()
                 window.hotNeedUpdatePannel = this
+                
+                if(o.focus){
+                    if(player.mode == 'panorama'){
+                        this.examine(player)
+                    }else if(player.mode != 'transitioning'){
+                        player.focusPoint({/* modelSize: size,  */aim: this.mesh.position})
+                    }
+                    
+                }
+                
+                
             }else{
                 $("#hotPannel>div").css("display","");
             }
@@ -22870,6 +22892,46 @@ window.Modernizr = function(n, e, t) {
             }
             ,
             
+            window._tranOutsideFocus = 4399 
+            n.prototype.focusPoint = function(o={}){//当在外时,聚焦相机到这一点 
+                console.log("focusPoint")
+                if(this.mode == "floorplan"){
+                    var modelSize = o.modelSize || new THREE.Vector3(8,8,8);//可视范围
+                    var control = player.cameraControls.controls.floorplan;
+                    var absoluteScale = control.getDefaultAbsoluteScale(modelSize)
+                    var currentScale = control.absoluteScale;
+                    var currentTarget = control.target.clone()
+                        
+                    y.cancelById(window._tranOutsideFocus, true);
+                    y.start(function(progress){ 
+                        control.absoluteScale = absoluteScale*progress + currentScale*(1-progress);
+                        control.target = o.aim.clone().multiplyScalar(progress).add(currentTarget.clone().multiplyScalar(1-progress))
+                        control.camera.position.copy(control.target.clone().add(control.offset)) //维持角度
+                    }.bind(this) , o.dur || 600, null/* cancelFuc */, 0, A[f.transition.movementEasing], "outsideFocus", window._tranOutsideFocus, null/* cancelFuc */);	 
+                
+                }else if(player.mode == "dollhouse"){
+                    var control = player.cameraControls.controls.dollhouse;
+                    var radius = o.radius || 8;
+                    var currentTarget = control.target.clone()
+                    var dir = control.offset.clone().normalize()
+                    var currentRadius = control.offset.length();
+                    
+                    
+                    y.cancelById(window._tranOutsideFocus, true);
+                    y.start(function(progress){  
+                        control.target = o.aim.clone().multiplyScalar(progress).add(currentTarget.clone().multiplyScalar(1-progress))
+                        let radius_ = radius*progress+currentRadius*(1-progress)
+                        control.camera.position.copy(control.target.clone().add(dir.clone().multiplyScalar(radius_)))  
+                    }.bind(this) , o.dur || 600, null/* cancelFuc */, 0, A[f.transition.movementEasing], "outsideFocus", window._tranOutsideFocus, null/* cancelFuc */);	 
+                }
+                
+            }
+                    
+                    
+                    
+                    
+            
+            
             
             
             window._transitionPosId = 9999

+ 2 - 2
js/myShow-edit.js

@@ -1,7 +1,7 @@
 var g_ProjectName=window.location.pathname.substring(window.location.pathname.indexOf("/")+1,window.location.pathname.lastIndexOf("/"));
-// var g_Prefix="http://super.4dage.com/";
+ var g_Prefix="http://super.4dage.com/";
 // var g_Prefix=window.location.href.substring(0,window.location.href.indexOf("/edit.html")+1);
-var g_Prefix=window.location.origin+'/';
+//var g_Prefix=window.location.origin+'/';
 
 var s = window.location.href.split('/');
 s.pop();

+ 2 - 2
js/myShow.js

@@ -1,7 +1,7 @@
 var g_ProjectName=window.location.pathname.substring(window.location.pathname.indexOf("/")+1,window.location.pathname.lastIndexOf("/"));
-// var g_Prefix="https://super.4dage.com/";
+ var g_Prefix="https://super.4dage.com/";
 // var g_Prefix=window.location.href.substring(0,window.location.href.indexOf("/index.html")+1);
-var g_Prefix=window.location.origin+'/';
+//var g_Prefix=window.location.origin+'/';
 
 var s = window.location.href.split('/');
 s.pop();

+ 1 - 0
js/showHardware.js

@@ -53,6 +53,7 @@ $(function () {
   $(grtable).on('click', '.plugin-action', function(e) {
     const row = GridManager.getRowData(gName, e.currentTarget.parentElement.parentElement);
     console.log(row);
+    window.hardwareHotList[row.code] && window.hardwareHotList[row.code].showPannel({focus:true})
   });
 
 let getList = function(params) {