xzw 2 years ago
parent
commit
742830efd1
2 changed files with 9 additions and 5 deletions
  1. 6 3
      src/custom/potree.shim.js
  2. 3 2
      src/custom/viewer/viewerBase.js

+ 6 - 3
src/custom/potree.shim.js

@@ -832,9 +832,12 @@ Utils.updateVisible = function(object, reason, ifShow, level=0, type){//当所
     update() 
     update() 
     
     
 } 
 } 
- 
- 
- 
+/* 
+    复杂案例: 如果物体默认隐藏, 当符合任何一个其他条件时可见,则可:
+    Potree.Utils.updateVisible(this, "default", false, 0 ) //默认隐藏    
+    Potree.Utils.updateVisible(this, 条件名,  ifShow, 1, ifShow?'add':'cancel' ) //其他的条件
+*/ 
+
  
  
 Utils.getObjVisiByReason = function(object,reason){//获取在某条件下是否可见.  注: 用户在数据集选择可不可见为"datasetSelection"
 Utils.getObjVisiByReason = function(object,reason){//获取在某条件下是否可见.  注: 用户在数据集选择可不可见为"datasetSelection"
     if(object.visible)return true
     if(object.visible)return true

+ 3 - 2
src/custom/viewer/viewerBase.js

@@ -160,10 +160,11 @@ export class ViewerBase extends THREE.EventDispatcher{
                 
                 
                 var width_ = width * view.width
                 var width_ = width * view.width
                 var height_ = height * view.height
                 var height_ = height * view.height
+                 
+                view.setResolution(Math.ceil(width_), Math.ceil(height_), width, height ) //本来应该是floor,但是这样奇数时会少一个像素,导致向左移一个像素且宽度少1。现在则多绘制1个像素,超出的1个像素应该不会绘制出来(但不知道其他地方是否有偏差,比如pick时)
                 
                 
-                if(height_ == 0)return  //avoid NAN
                 
                 
-                view.setResolution(Math.ceil(width_), Math.ceil(height_), width, height ) //本来应该是floor,但是这样奇数时会少一个像素,导致向左移一个像素且宽度少1。现在则多绘制1个像素,超出的1个像素应该不会绘制出来(但不知道其他地方是否有偏差,比如pick时)
+                if(height_ == 0)return  //avoid NAN
                 let aspect = width_ / height_;  //camera的参数精确些,不用视口的归整的resolution像素值,否则hasChange无法为true, 导致canvasResize了但map没update从而闪烁
                 let aspect = width_ / height_;  //camera的参数精确些,不用视口的归整的resolution像素值,否则hasChange无法为true, 导致canvasResize了但map没update从而闪烁
                 view.camera.aspect = aspect;
                 view.camera.aspect = aspect;