Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: With react node, the edge is not connected to the center of the node #6744

Open
2 of 10 tasks
zhaoyouxin opened this issue Jan 23, 2025 · 1 comment
Open
2 of 10 tasks
Labels
status: waiting for maintainer These issues have not yet been reviewed by a maintainer

Comments

@zhaoyouxin
Copy link

Describe the bug / 问题描述

https://g6.antv.antgroup.com/zh/examples/element/custom-node#react-node
使用官方demo,代码直接拷过来,发现线没有连到节点的中心位置

Image

Reproduction link / 复现链接

No response

Steps to Reproduce the Bug or Issue / 重现步骤

No response

G6 Version / G6 版本

🆕 5.x

OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

Browser / 浏览器

  • Chrome
  • Edge
  • Firefox
  • Safari (Limited support / 有限支持)
  • IE (Nonsupport / 不支持)
  • Others / 其他
@zhaoyouxin zhaoyouxin added the status: waiting for maintainer These issues have not yet been reviewed by a maintainer label Jan 23, 2025
Copy link

您提到在使用 antvis/g6 的 React 节点时,边没有连接到节点的中心位置。这个问题可能与节点的锚点设置有关。通常,节点的锚点决定了边连接到节点的具体位置。

在 G6 中,您可以通过设置节点的 anchorPoints 属性来调整边的连接位置。例如:

const node = {
  type: 'react-node',
  anchorPoints: [
    [0.5, 0], // 顶部中心
    [0.5, 1], // 底部中心
    [0, 0.5], // 左侧中心
    [1, 0.5]  // 右侧中心
  ],
  // 其他节点配置
};

请确保在节点配置中正确设置了 anchorPoints,以便边能够连接到您期望的位置。如果问题仍然存在,可能需要进一步检查节点和边的配置代码。

如果您有更多的代码示例或详细信息,欢迎分享,以便我能更好地帮助您解决问题。

🪧 Tips For further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me.

@github-actions github-actions bot changed the title [Bug]: 使用react节点,edge没有连到节点中心 [Bug]: With react node, the edge is not connected to the center of the node Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for maintainer These issues have not yet been reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

1 participant