antvis/G6

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

zhaoyouxin posted onGitHub

Describe the bug / 问题描述

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

Image

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 / 其他

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

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

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

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

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

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

posted by petercat-assistant[bot] 3 months ago

按照 petercat 的建议试试呢

posted by zhongyunWan about 2 months ago

⚠️ This issue has been automatically closed due to inactivity.

  • If the issue is still relevant and important to you, feel free to:
    1. Reopen with additional information
    2. Create a new issue with updated context
    3. Reference any related issues or discussions

We close inactive issues to keep our backlog manageable and focused on active issues.

Your contribution makes our project better! 🌟


⚠️ 由于长期无活动,此 issue 已被自动关闭。

  • 如果这个问题对您来说仍然重要,您可以:
    1. 重新打开并提供补充信息
    2. 创建一个新的 issue 并更新相关背景
    3. 关联相关的 issue 或讨论

为了更好地维护项目,我们需要定期清理不活跃的问题。

感谢您为开源添砖加瓦!🌟

posted by github-actions[bot] about 2 months ago

Fund this Issue

$0.00
Funded

Pull requests