From 407bc8fb147ffff63419e9f4ccdf1145593d14cc Mon Sep 17 00:00:00 2001 From: ChenX Date: Thu, 9 May 2019 11:36:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20=E9=80=89=E6=8B=A9`LineSeg?= =?UTF-8?q?ment`=E6=97=B6=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Editor/SelectBase.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Editor/SelectBase.ts b/src/Editor/SelectBase.ts index 569001b2b..31fc34a13 100644 --- a/src/Editor/SelectBase.ts +++ b/src/Editor/SelectBase.ts @@ -1,4 +1,4 @@ -import { BufferGeometry, Face3, Frustum, Geometry, Matrix4, Object3D, PerspectiveCamera, Vector3, Line3 } from 'three'; +import { BufferGeometry, Face3, Frustum, Geometry, Line3, LineSegments, Matrix4, Object3D, PerspectiveCamera, Vector3 } from 'three'; import { GetEntity, IsEntity } from '../Common/Utils'; import { Entity } from '../DatabaseServices/Entity'; import { IViewer } from '../GraphicsSystem/IView'; @@ -110,7 +110,7 @@ export class SelectSetBase { let pts: Array = []; let faces: Array = []; - this.GetGeometrVerticesAndFaces(obj, pts, faces) + this.GetGeometrVerticesAndFaces(obj, pts, faces); return { pts, faces }; } private GetGeometrVerticesAndFaces(obj: Object3D, pts: Vector3[], faces: Face3[]) @@ -191,9 +191,10 @@ export class SelectSetBase screenPts.push(p); } - if (faces.length == 0) + if (faces.length === 0) { - for (let index = 0; index < pts.length - 1; index++) + let add = (obj instanceof LineSegments) ? 2 : 1; + for (let index = 0; index < pts.length - 1; index += add) { if (this.IntersectLineBase(index, index + 1, screenPts, pts)) return true;