|
@@ -341,7 +341,7 @@ export class Measure extends ctrlPolygon{
|
|
|
setEdgeLabelPos(label,p1,p2){ //调整label的位置,使倾斜后看起来在线的中心,而不要挡住端点
|
|
|
let center = new THREE.Vector3().addVectors(p1,p2).multiplyScalar(0.5);
|
|
|
|
|
|
- if(this.lineDir){
|
|
|
+ if(this.lineDir && this.lineDir.length() > 0){
|
|
|
if(viewer.mainViewport.camera.type == 'OrthographicCamera'){
|
|
|
label.setPos(center)
|
|
|
}else{
|
|
@@ -366,6 +366,9 @@ export class Measure extends ctrlPolygon{
|
|
|
ray.set(nearPoint, cos>0?this.lineDir:this.lineDir.clone().negate())
|
|
|
let camDirPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(dir, eyePos)
|
|
|
nearPoint = ray.ray.intersectPlane(camDirPlane, new THREE.Vector3())
|
|
|
+ if(!nearPoint){//线是垂直的,视线是水平的时候
|
|
|
+ return label.setPos(center)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|