|
|
@ -59,6 +59,29 @@ export default class ToolboxLine extends Toolbox { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
onMouseClicked(e: MouseEvent): THREE.Vector3 | undefined { |
|
|
onMouseClicked(e: MouseEvent): THREE.Vector3 | undefined { |
|
|
|
|
|
|
|
|
|
|
|
const point = this.lastMovePosition |
|
|
|
|
|
// 如果正式的点命中到同类型的节点上,则不添加新的点,只牵线到该点
|
|
|
|
|
|
if (point) { |
|
|
|
|
|
let catchPoint = null |
|
|
|
|
|
const vv = this.itemType.pointArray.some(p => { |
|
|
|
|
|
if (p.position.x === point.x && p.position.z === point.z) { |
|
|
|
|
|
catchPoint = p |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
if (vv && catchPoint) { |
|
|
|
|
|
// 如果捕获到点,则将线条连接到该点
|
|
|
|
|
|
if (this.startPoint) { |
|
|
|
|
|
this.afterAddPoint(this.startPoint, catchPoint) |
|
|
|
|
|
} |
|
|
|
|
|
this.tempLine && this.viewport.scene.remove(this.tempLine) |
|
|
|
|
|
this.tempLine = undefined |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const r = super.onMouseClicked(e) |
|
|
const r = super.onMouseClicked(e) |
|
|
if (!r) { |
|
|
if (!r) { |
|
|
return |
|
|
return |
|
|
|