feat: 支持用户自定义锚点连接,提供配置来禁用拖动锚点到节点中会不断触发校验规则,插入节点时自动找到最近锚点连接 #2331
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix:目前将连线拖动到节点释放后会连接最近的锚点,如何禁用此功能 #810
解决方案: 提供anchorOnlyConnectValidate配置,默认值为false。当设置为true时,禁用拖动锚点到节点中会不断触发校验规则的现象,变成只有拖动到锚点附近时才会触发校验规则。具体使用如下
lf.updateEditConfig({ anchorOnlyConnectValidate: true }) // 默认值为falsefix:[Feature] 在手动连接2个节点,在目标节点上释放时,需要能让业务代码有机会来决定连接到哪个锚点 #791
解决方案: 支持用户自定义锚点连接指向,也提供了setTargetAnchorId方法支持用户直接使用。当两者同时存在时,优先使用传入的自定义函数实现锚点连接指向。两个方法的具体使用如下:
调用setTargetAnchorId方法设置连接锚点,第一个参数是想改变锚点连接指向的节点,第二个参数是你想要指向锚点的id,当不传递第二个参数时,则代表着删除nodeid设置的对应连接锚点,恢复默认行为
自定义锚点指向,在节点上添加customTargetAnchor方法,用户没有传递时,则默认连接最近的锚点
[Bug report]自动插入节点功能,使用addEdge绘制的连线上无法触发自动插入节点功能 #723
解决方案: 当插入节点时,允许一定误差,节点锚点没有严格对齐连线也可以插入进连线里,并且会连接到最近的锚点。