Skip to content

Commit

Permalink
fix: 修复渐近线插件类型定义报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
boyongjiong committed Nov 26, 2024
1 parent ce5c1e6 commit a29f216
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/extension/src/tools/proximity-connect/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import LogicFlow, {
twoPointDistance,
BaseNodeModel,
BaseEdgeModel,
Point,
} from '@logicflow/core'
import { assign, isEmpty, isEqual, isNil, isFinite, reduce } from 'lodash-es'

import AnchorConfig = Model.AnchorConfig
import Point = LogicFlow.Point

export type ProximityConnectProps = {
enable: boolean
Expand Down Expand Up @@ -104,7 +104,9 @@ export class ProximityConnect {
this.virtualEdge = undefined
}
}
this.findClosestAnchorOfNode(this.currentNode, nodes)
if (this.currentNode) {
this.findClosestAnchorOfNode(this.currentNode, nodes)
}
if (this.currentDistance < this.thresholdDistance) {
this.addVirtualEdge()
}
Expand All @@ -127,7 +129,7 @@ export class ProximityConnect {
y: clientY,
})
if (isNil(x) || isNil(y)) return
const currentPoint = { x, y }
const currentPoint: Point = { x, y }
const { nodes } = graphModel
// 判断当前是否有虚拟连线,有的话判断两点距离是否超过阈值,超过的话删除连线
if (!isNil(this.virtualEdge)) {
Expand Down Expand Up @@ -227,7 +229,7 @@ export class ProximityConnect {
anchorAllowConnect(
node: BaseNodeModel,
anchor: AnchorConfig,
draggingAnchor: AnchorConfig,
draggingAnchor: AnchorConfig | undefined,
) {
const { currentNode } = this
if (!currentNode) return
Expand Down

0 comments on commit a29f216

Please sign in to comment.