G6 icon indicating copy to clipboard operation
G6 copied to clipboard

两节点连接多条线,箭头会出现重叠效果,求个优化思路,谢谢

Open ByronYan01 opened this issue 2 years ago • 10 comments

问题描述

#3905 issue 情况下,节点连接多条线,箭头会出现重叠效果;看到g6-editor连线效果比较好,求个优化思路,谢谢

重现链接

https://codepen.io/yanliang-code/pen/xxjKYEe

重现步骤

节点连接多个线

预期行为

期望g6-editor连线效果

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]
  • G6 版本: [4.5.1 ... ]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

ByronYan01 avatar Sep 05 '22 02:09 ByronYan01

通过 anchorPoints 实现 https://g6.antv.vision/zh/docs/manual/middle/elements/nodes/anchorpoint/#gatsby-focus-wrapper

一个例子:https://g6.antv.vision/zh/examples/interaction/createEdge#click-link-point

Yanyan-Wang avatar Sep 05 '22 09:09 Yanyan-Wang

Uploading image.png… 现在需求是点击节点,创建连线,再次点击节点,就将两个节点连接上; 使用 anchorPoints,是每个节点内置多个 anchorPoints,但是点击节点时,如何确定线连接哪个anchorPoints 最优呢

ByronYan01 avatar Sep 05 '22 10:09 ByronYan01

image

ByronYan01 avatar Sep 05 '22 10:09 ByronYan01

或者你就在图示例上配置 linkCenter: true ,然后配置箭头的时候通过 d 往外“退”:https://g6.antv.vision/zh/docs/manual/middle/elements/edges/arrow#%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95-1

Yanyan-Wang avatar Sep 05 '22 10:09 Yanyan-Wang

或者你就在图示例上配置 linkCenter: true ,然后配置箭头的时候通过 d 往外“退”:https://g6.antv.vision/zh/docs/manual/middle/elements/edges/arrow#%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95-1

我按照您这个思路,自定义一下箭头,但是如果两个节点距离远箭头与线连接处正常,但是离近了,就偏离了 现象见 :https://codepen.io/yanliang-code/pen/xxjKYEe

ByronYan01 avatar Sep 17 '22 02:09 ByronYan01

Snipaste_2022-09-17_16-28-08

ByronYan01 avatar Sep 17 '22 08:09 ByronYan01

image

要用 d 往后“退”才能沿着路径退哈。你上面的写法是直接改了 path,这样不是沿着路径的

Yanyan-Wang avatar Sep 19 '22 03:09 Yanyan-Wang

image

要用 d 往后“退”才能沿着路径退哈。你上面的写法是直接改了 path,这样不是沿着路径的

按照您这边得说法我改了一下,我发现在拖动节点时,会出现画布被污染得情况,是我哪里使用得不对吗 https://codepen.io/yanliang-code/pen/xxjKYEe

ByronYan01 avatar Sep 19 '22 06:09 ByronYan01

image

ByronYan01 avatar Sep 19 '22 06:09 ByronYan01

image 要用 d 往后“退”才能沿着路径退哈。你上面的写法是直接改了 path,这样不是沿着路径的

按照您这边得说法我改了一下,我发现在拖动节点时,会出现画布被污染得情况,是我哪里使用得不对吗 https://codepen.io/yanliang-code/pen/xxjKYEe

我这边看其他issue,发现 graph.get('canvas').set('localRefresh', false) 可以解决这个问题,但是我想了解一下,我设置这个后会有什么影响吗

ByronYan01 avatar Sep 21 '22 09:09 ByronYan01

小数据集上不会有什么问题,大规模数据时可能一定程度影响性能

Yanyan-Wang avatar Dec 26 '22 08:12 Yanyan-Wang

This issue has been closed because it has been outdate for a long time. Please open a new issue if you still need help.

这个 issue 已经被关闭,因为 它已经过期很久了。 如果你仍然需要帮助,请创建一个新的 issue。

github-actions[bot] avatar Apr 29 '24 02:04 github-actions[bot]