diff --git a/src/core/Constract.ts b/src/core/Constract.ts
index afd4a7e..a957ae6 100644
--- a/src/core/Constract.ts
+++ b/src/core/Constract.ts
@@ -13,7 +13,7 @@ export default Object.freeze({
// 测量相关的光标模式
CursorModeMeasure: 'measure',
- CursorModeConveyor: 'conveyor',
+ CursorModeWay: 'way',
// 选择模式
CursorModeSelectByRec: 'selectByRec'
diff --git a/src/core/base/BaseInteraction.ts b/src/core/base/BaseInteraction.ts
index 6082099..dfb8ad7 100644
--- a/src/core/base/BaseInteraction.ts
+++ b/src/core/base/BaseInteraction.ts
@@ -119,7 +119,7 @@ export default abstract class BaseInteraction {
this.viewerDom = this.viewport.viewerDom
this.canvas = this.viewport.renderer.domElement
- if (option.startPoint) {
+ if (option?.startPoint) {
this.linkStartPointId = option.startPoint
}
if (this.linkStartPointId) {
@@ -264,15 +264,18 @@ export default abstract class BaseInteraction {
}
this.lastClickTime = now
- const from = this.viewport.stateManager.findItemById(this.linkStartPointId)
- if (!from) {
- system.showErrorDialog(`Cannot find state item: ${this.linkStartPointId}`)
- return
- }
-
// 如果正式的点命中到同类型的节点上,则不添加新的点,只牵线到该点
let catchPoint: ItemJson | null = this.viewport.stateManager.findItemByPosition(point, this.itemTypeName)
+ let from: ItemJson | undefined = undefined
+ if (this.linkStartPointId) {
+ from = this.viewport.stateManager.findItemById(this.linkStartPointId)
+ if (!from) {
+ system.showErrorDialog(`Cannot find state item: ${this.linkStartPointId}`)
+ return
+ }
+ }
+
if (catchPoint) {
// 连线到目标点
if (this.linkStartPointId === catchPoint.id) {
@@ -323,8 +326,13 @@ export default abstract class BaseInteraction {
stateManager.beginStateUpdate({ createFromInteraction: true })
// 关联2个点
stateManager.vdata.items.push(catchPoint)
- catchPoint.dt.center.push(this.linkStartPointId)
- from.dt.center.push(catchPoint.id)
+ if (from) {
+ catchPoint.dt.center.push(this.linkStartPointId)
+ from.dt.center.push(catchPoint.id)
+
+ } else {
+ stateManager.vdata.items.push(catchPoint)
+ }
stateManager.endStateUpdate()
}
diff --git a/src/editor/Model2DEditor.vue b/src/editor/Model2DEditor.vue
index d2201fd..7999e48 100644
--- a/src/editor/Model2DEditor.vue
+++ b/src/editor/Model2DEditor.vue
@@ -39,9 +39,9 @@
:type="state?.cursorMode===Constract.CursorModeMeasure?'primary':''"
@click="()=>state.cursorMode = Constract.CursorModeMeasure">
-