瀏覽代碼

fix: 测量解决偶尔第一个点飘没了的bug

xzw 2 年之前
父節點
當前提交
5783214d08
共有 2 個文件被更改,包括 37 次插入21 次删除
  1. 36 20
      public/static/lib/potree/potree.js
  2. 1 1
      public/static/lib/potree/potree.js.map

+ 36 - 20
public/static/lib/potree/potree.js

@@ -75416,7 +75416,8 @@ void main()
 	        
 	        
 	        let update = (e)=>{
-	            this.update(e); 
+	            //this.update(e)
+	            this.needsUpdate = true;
 	        };
 	        viewer.mapViewer && viewer.mapViewer.addEventListener("camera_changed",  update); 
 	        viewer.addEventListener("camera_changed",  update); 
@@ -75426,7 +75427,8 @@ void main()
 	         
 	        
 	        let applyMatrix = (e)=>{
-	            this.applyMatrix(e);
+	            if(this.needsUpdate) this.update(e);
+	            else this.applyMatrix(e);
 	        };
 	        viewer.addEventListener("raycaster", applyMatrix);        //before render
 	        viewer.addEventListener("render.begin", applyMatrix); //before render  //magnifier时要禁止吗
@@ -75469,15 +75471,15 @@ void main()
 	            v = false;
 	        }            
 	         
-	        if(!this.latestRealVisi && v){//变为可见后先update 
-	            this.latestRealVisi = true;
+	        /* if(!this.latestRealVisi && v){//变为可见后先update 
+	            this.latestRealVisi = true
 	            setTimeout(()=>{
-	                this.update();
-	            },1);//延迟 防止无限调用
+	                this.update()                           -----删掉是因为更新时返回false导致无法立即更新
+	            },1)//延迟 防止无限调用
 	            return false
-	        }
+	        } 
 	        
-	        this.latestRealVisi = v;
+	        this.latestRealVisi = v*/
 	        return v;
 	    }
 	    
@@ -80373,6 +80375,7 @@ void main()
 	    
 	    
 	    dragChange(intersectPos, i, atMap){
+	        
 	        let len = this.markers.length; 
 	        let oldPoint = this.points[i]; 
 	        if(atMap){
@@ -80380,6 +80383,7 @@ void main()
 	        }
 	        let location = intersectPos.clone();
 	        
+	       
 	        
 	        
 	        if(this.faceDirection && this.maxMarkers == 2 && len == 2){//add 固定方向的点不直接拖拽
@@ -80573,7 +80577,7 @@ void main()
 	    }
 	    
 	    dropMarker(e){
-	        //console.log('dropMarker')
+	         
 	        if (this.isNew && !browser.isMobile() && e.pressDistance>Potree.config.clickMaxDragDis){//拖拽的话返回
 	            return this.continueDrag(null,e)   
 	        } 
@@ -80599,7 +80603,6 @@ void main()
 	            
 	        }
 	         
-	        
 	        if (e.button != MOUSE.RIGHT && (//右键click的话继续执行,因为会停止
 	                this.isIntersectSelf == 'all' && this.isNew //有线相交了
 	                || this.isAtWrongPlace && this.isNew
@@ -80888,7 +80891,7 @@ void main()
 	        this.editStateChange(true);
 	        var timer = setTimeout(()=>{//等 drag=null之后 //右键拖拽结束后需要重新得到drag 
 	            if(this.parent && object.isDragging){
-	                //console.log('continueDrag')        
+	                console.log('continueDrag', object.uuid);        
 	                viewer.inputHandler.startDragging( object ,
 	                    {endDragFun: e.drag.endDragFun, notPressMouse:e.drag.notPressMouse, dragViewport:e.drag.dragViewport} 
 	                );
@@ -82609,6 +82612,8 @@ void main()
 	                    measure.markers[length-1].visible = true;
 	                     
 	                    marker.isDragging = true; 
+	                    
+	                    console.log('continueDrag' , marker.uuid);
 	                    measure.continueDrag(marker, e);    
 	                } 
 					 
@@ -82768,10 +82773,9 @@ void main()
 	                viewer.controls.setEnable(false);
 	            }
 	            
-	            //console.log('measure clicked33', !!e.intersectPoint)
-	             
-	            //var I = e.intersectPoint && (e.intersectPoint.orthoIntersect || e.intersectPoint.location)
-	            var I = e.intersect && (e.intersect.orthoIntersect || e.intersect.location);
+	            
+	              
+	            var I = e.intersect && (/* e.intersect.orthoIntersect ||  */e.intersect.location);
 	            if(!I){
 	                return measure.dispatchEvent('intersectNoPointcloud') 
 	            }
@@ -82790,9 +82794,13 @@ void main()
 	            e.drag.notPressMouse = !isMobile;
 	            
 	            //if(!measure.dragMarker(e) || !measure.dropMarker(e))return
+	            
+	             
 	             
-	            measure.dragMarker(e); 
+	            measure.dragMarker(e);  
 	            measure.dropMarker(e);
+	            this.viewer.inputHandler.drag = null; //否则会继续拖拽
+	            
 	            
 	            if(measure.maxMarkers > 1 ){
 	                measure.markers[1].visible = false;
@@ -88873,7 +88881,7 @@ void main()
 	        this.lastPointerUpTime = 0;
 	        
 	        this.touches = [];
-
+	        this.interactHistory = {move:0}; //add       
 
 	        this.hoverViewport = viewer.viewports[0];
 	        
@@ -88915,7 +88923,9 @@ void main()
 	            }); 
 	        }
 	        
-	        
+	        window.viewer.addEventListener('loopStart',()=>{
+	            this.interactHistory = {};  //清空
+	        });
 		}
 
 		/* addInputListener (listener) {
@@ -89768,6 +89778,12 @@ void main()
 	    }
 
 	    dealPointerMove(e, isTouch){ 
+	    
+	        if(this.interactHistory.move) return  //一帧只触发一次
+	        this.interactHistory.move = 1;
+	         
+	    
+	    
 	        if(isTouch){
 	            var  {  camera, viewport  } = this.updateTouchesInfo(e); 
 	        }else { 
@@ -91831,7 +91847,7 @@ void main()
 	    
 	    
 	    
-	    switchView2(viewInfo){ 
+	    switchView2(viewInfo){ //直接输入view改变
 	        let view = viewer.mainViewport.view;
 	        let startCamera, endCamera; 
 	    
@@ -139819,7 +139835,7 @@ ENDSEC
 			}
 	       
 	        performance.mark('loop-start') ;// 无论有没有reportTimings都要获取,因为getBestCound需要
-	        
+	        this.dispatchEvent('loopStart');
 	       
 	        this.shelterCount = {byTex:0, byCloud:0,   maxByTex: 100, maxByCloud:0   }; //清空 因ifPointBlockedByIntersect可能在任何时候触发,所以需要一开始就定义这个,且每次计算最大可计算次数太麻烦了就定义一个吧。
 	        

File diff suppressed because it is too large
+ 1 - 1
public/static/lib/potree/potree.js.map