xzw vor 9 Monaten
Ursprung
Commit
70d7d66472
1 geänderte Dateien mit 42 neuen und 6 gelöschten Zeilen
  1. 42 6
      src/custom/objects/tool/Path.js

+ 42 - 6
src/custom/objects/tool/Path.js

@@ -38,7 +38,7 @@ const depthProps = {
 const planeGeo = new THREE.PlaneBufferGeometry(1,1)
 const voidGeometry = new THREE.BufferGeometry() 
 
-let markerMats  
+let markerMats, dragPointMat  
 const getMarkerMat = function (name) { 
      if(!markerMats){
          markerMats = {
@@ -148,6 +148,9 @@ export class Path extends ctrlPolygon{
         this.selectStates = {}
         this.setFadeFar(null)
         this.geoPoints = []
+        this.titleLineHeight = titleLineHeight || prop.titleLineHeight
+        
+        
         {
             let group = new THREE.Object3D;     group.name = 'titleGroup'
             this.titleLabel = new TextSprite(Object.assign({}, depthProps,{
@@ -165,16 +168,33 @@ export class Path extends ctrlPolygon{
                 textAlign: Potree.settings.isOfficial && 'left'
             }))
             this.titleLabel.sprite.material.depthTest = false
-            let line = LineDraw.createFatLine([new THREE.Vector3(0,0,0), new THREE.Vector3(0,0,titleLineHeight)],  Object.assign({},depthProps,{color: '#ffffff', lineWidth: 1, transparent:true, fadeFar: this.fadeFar}))
+            let line = LineDraw.createFatLine([new THREE.Vector3(0,0,0), new THREE.Vector3(0,0, this.titleLineHeight)],  Object.assign({},depthProps,{color: '#ffffff', lineWidth: 1, transparent:true, fadeFar: this.fadeFar}))
             line.renderOrder = Potree.config.renderOrders.line
             this.titleLine = line
             group.add(line)
             group.add(this.titleLabel)
-            this.titleLabel.position.z = titleLineHeight
+            this.titleLabel.position.z = this.titleLineHeight
             this.add(group);
             this.setTitleVisi(this.titleLabel.parent, false,  'noPoint')            
             this.setTitle(Potree.settings.isOfficial ? '' : 'title' )
-       
+            
+            if(!dragPointMat){ 
+                let map = texLoader.load(Potree.resourcePath+'/textures/whiteCircle.png',()=>{})
+                dragPointMat = {
+                    default: new THREE.MeshBasicMaterial({
+                        map, transparent:true, color:'#0fe', opacity:0, depthTest:false, 
+                    }),   
+                    hover: new THREE.MeshBasicMaterial({
+                        map, transparent:true, color:'#0fe', opacity:0.4, depthTest:false, 
+                    })
+                }
+            }
+            this.lineDragPoint = new THREE.Mesh(planeGeo, dragPointMat.default) //修改线高度时出现的小圆点
+            this.lineDragPoint.scale.set(0.15,0.15,0.15); 
+            this.lineDragPoint.name = 'lineDragPoint' 
+            this.lineDragPoint.renderOrder = this.lineDragPoint.pickOrder = 10;
+            this.titleLabel.add(this.lineDragPoint) 
+            
             
             line.addEventListener('mouseover',(e)=>{ 
                 this.editEnable && CursorDeal.add('hoverGrab') 
@@ -202,6 +222,20 @@ export class Path extends ctrlPolygon{
                     this.dispatchEvent({type:'titlePosChanged',  position ,  root:e.intersect?.pointcloud || e.intersect?.object})
                 }
             });
+            
+            
+            
+          
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
         }
         
         {//和measure不同的是它的边是连在一起的一整条
@@ -460,8 +494,8 @@ export class Path extends ctrlPolygon{
         viewer.dispatchEvent('content_changed')
     }
     
-    setLineLength(len){
-        this.lineLength = parseFloat(len)
+    setTitleLineHeight(len){
+        this.titleLineHeight = parseFloat(len)
         
     }
     
@@ -484,6 +518,8 @@ export class Path extends ctrlPolygon{
         this.dispatchEvent('dragLineLen')
             
     }
+    
+    
     updateEdge(){ 
         if(this.lastUpdatePoints_ && Potree.Common.ifSame(this.lastUpdatePoints_,this.points) && this.halfPathWidth == this.lastHalfPathWidth) return //没变 不更新
         //this.edge.geometry = MeshDraw.getExtrudeGeo(edgeExtrudePoints, null,  {extrudePath: this.points, openEnded:true, shapeDontClose:true/* , dontSmooth:true, steps: this.points.length-1 */})