Skip to content

Commit 6c5504a

Browse files
z-pangolinDymoneLewis
authored andcommitted
fix: 去除anchorProximityValidate配置项
1 parent 841c76e commit 6c5504a

2 files changed

Lines changed: 13 additions & 22 deletions

File tree

packages/core/src/model/EditConfigModel.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ export interface IEditConfigType {
2323
* - [number, number, number, number]:[minX, minY, maxX, maxY] 画布可拖动范围
2424
*/
2525
stopMoveGraph:
26-
| boolean
27-
| 'vertical'
28-
| 'horizontal'
29-
| [number, number, number, number]
26+
| boolean
27+
| 'vertical'
28+
| 'horizontal'
29+
| [number, number, number, number]
3030
/**
3131
* 允许调整边
3232
*/
@@ -126,7 +126,6 @@ export interface IEditConfigType {
126126
// 开启网格对齐
127127
snapGrid: boolean
128128
isPinching: boolean
129-
anchorProximityValidate: boolean
130129
}
131130

132131
export type IConfigKeys = keyof IEditConfigType
@@ -189,7 +188,6 @@ const allKeys = [
189188
'nodeTextVertical', // 节点文本是否纵向显示
190189
'edgeTextVertical', // 边文本是否纵向显示
191190
'isPinching', //是否是双指捏合态
192-
'anchorProximityValidate', // 仅在靠近锚点时触发连接校验
193191
] as const
194192

195193
/**
@@ -225,7 +223,6 @@ export class EditConfigModel {
225223
@observable edgeTextDraggable = false
226224
@observable edgeTextMultiple = false // 是否支持多个边文本
227225
@observable edgeTextVertical = false // 边文本朝向是否是纵向
228-
@observable anchorProximityValidate = false // 仅在靠近锚点时触发连接校验
229226
/*********************************************************
230227
* 节点相关配置
231228
********************************************************/

packages/core/src/view/Anchor.tsx

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -314,21 +314,15 @@ class Anchor extends Component<IProps, IState> {
314314
return
315315
}
316316
this.preTargetNode = targetNode
317-
const anchorDist = distance(endX, endY, info.anchor.x, info.anchor.y)
318-
const validateDistance = 10
319-
const { editConfigModel } = graphModel
320-
if (
321-
!editConfigModel.anchorProximityValidate ||
322-
anchorDist <= validateDistance
323-
) {
324-
this.validateAndSetState(
325-
targetNode,
326-
anchorId,
327-
info.anchor,
328-
nodeModel,
329-
anchorData,
330-
)
331-
}
317+
318+
this.validateAndSetState(
319+
targetNode,
320+
anchorId,
321+
info.anchor,
322+
nodeModel,
323+
anchorData,
324+
)
325+
332326
// 人工触发进入目标节点事件,同步设置 hovered 以驱动锚点显隐和样式
333327
if (!targetNode.isHovered) {
334328
const nodeData = targetNode.getData()

0 commit comments

Comments
 (0)