xzw před 2 roky
rodič
revize
3cba17c664
1 změnil soubory, kde provedl 11 přidání a 8 odebrání
  1. 11 8
      src/custom/viewer/ViewerNew.js

+ 11 - 8
src/custom/viewer/ViewerNew.js

@@ -3526,14 +3526,17 @@ export class Viewer extends ViewerBase{
                 boundSize.x = Math.max(min, boundSize.x)
                 boundSize.y = Math.max(min, boundSize.y)
             }
-            if(camera.type == 'OrthographicCamera'){
-                //dis = boundSize.length()   
-                o.dontChangeCamDir = true //强制不改方向
-                //必须在模型外部
-                this.mainViewport.targetPlane.setFromNormalAndCoplanarPoint(this.mainViewport.view.direction, this.bound.center ) 
-                this.mainViewport.targetPlane.projectPoint(target,  this.mainViewport.shiftTarget ) //得到target在中心面的投影
-                let pos = this.splitScreen.getPosOutOfModel(this.mainViewport, this.bound.size)  //得到观察位置(shiftTarget投影到模型外部)
-                dis = pos.distanceTo(target)   
+            if(camera.type == 'OrthographicCamera'){ 
+                if(o.dontChangeCamDir) {
+                    //必须在模型外部(如点击测量线时)
+                    this.mainViewport.targetPlane.setFromNormalAndCoplanarPoint(this.mainViewport.view.direction, this.bound.center ) 
+                    this.mainViewport.targetPlane.projectPoint(target,  this.mainViewport.shiftTarget ) //得到target在中心面的投影
+                    let pos = this.splitScreen.getPosOutOfModel(this.mainViewport, this.bound.size)  //得到观察位置(shiftTarget投影到模型外部)
+                    dis = pos.distanceTo(target)  
+                }else{
+                    dis = boundSize.length() 
+                }                   
+                
             }else{
                 let aspect = boundSize.x / boundSize.y
                 if(camera.aspect > aspect){//视野更宽则用bound的纵向来决定