Skip to content

Commit a29f216

Browse files
committed
fix: 修复渐近线插件类型定义报错的问题
1 parent ce5c1e6 commit a29f216

File tree

1 file changed

+6
-4
lines changed
  • packages/extension/src/tools/proximity-connect

1 file changed

+6
-4
lines changed

packages/extension/src/tools/proximity-connect/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import LogicFlow, {
33
twoPointDistance,
44
BaseNodeModel,
55
BaseEdgeModel,
6-
Point,
76
} from '@logicflow/core'
87
import { assign, isEmpty, isEqual, isNil, isFinite, reduce } from 'lodash-es'
98

109
import AnchorConfig = Model.AnchorConfig
10+
import Point = LogicFlow.Point
1111

1212
export type ProximityConnectProps = {
1313
enable: boolean
@@ -104,7 +104,9 @@ export class ProximityConnect {
104104
this.virtualEdge = undefined
105105
}
106106
}
107-
this.findClosestAnchorOfNode(this.currentNode, nodes)
107+
if (this.currentNode) {
108+
this.findClosestAnchorOfNode(this.currentNode, nodes)
109+
}
108110
if (this.currentDistance < this.thresholdDistance) {
109111
this.addVirtualEdge()
110112
}
@@ -127,7 +129,7 @@ export class ProximityConnect {
127129
y: clientY,
128130
})
129131
if (isNil(x) || isNil(y)) return
130-
const currentPoint = { x, y }
132+
const currentPoint: Point = { x, y }
131133
const { nodes } = graphModel
132134
// 判断当前是否有虚拟连线,有的话判断两点距离是否超过阈值,超过的话删除连线
133135
if (!isNil(this.virtualEdge)) {
@@ -227,7 +229,7 @@ export class ProximityConnect {
227229
anchorAllowConnect(
228230
node: BaseNodeModel,
229231
anchor: AnchorConfig,
230-
draggingAnchor: AnchorConfig,
232+
draggingAnchor: AnchorConfig | undefined,
231233
) {
232234
const { currentNode } = this
233235
if (!currentNode) return

0 commit comments

Comments
 (0)