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

After using a custom React node, the layout of the edges is skewed #6352

Closed
resetsix opened this issue Sep 19, 2024 · 2 comments
Closed

After using a custom React node, the layout of the edges is skewed #6352

resetsix opened this issue Sep 19, 2024 · 2 comments

Comments

@resetsix
Copy link
Contributor

Describe the bug / 问题描述

背景描述

在使用自定义 React 节点和内置的 dagre 布局算法时,发现边的布局效果与预期不符。具体表现为:

  1. 使用内置节点时,边的控制点折线后是水平的。
  2. 使用自定义 React 节点后,边的控制点折线后变成了斜线。

预期效果

(使用自定义节点)边的布局效果应与使用内置节点时相同,控制点折线后应为水平线。

图片

实际效果

边的控制点折线后呈斜线,与预期不符。

图片

Reproduction link / 重现链接

https://codesandbox.io/p/sandbox/73mjj4

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

  1. 使用 @antv/g6-extension-react 中的 ReactNode 创建自定义节点
  2. 在图配置中设置 node.type: "reactNode"
  3. 使用 antv-dagre 布局,设置 rankdir: "LR"
  4. 渲染图形

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

macOS

Browser / 浏览器

Chrome, Firefox

Additional context / 补充说明

No response

@github-actions github-actions bot changed the title 使用自定义 React 节点后,边的布局出现偏差 After using a custom React node, the layout of the edges is skewed Sep 19, 2024
@yvonneyx
Copy link
Contributor

html 节点原点在左上角,这里需要额外处理一下,添加属性 { "dx": -size[0]/2, "dy": -size[1]/2 }

@resetsix
Copy link
Contributor Author

html 节点原点在左上角,这里需要额外处理一下,添加属性 { "dx": -size[0]/2, "dy": -size[1]/2 }

好的解决了。感觉跟 #6351 问题很像,都是自定义节点后 edge 出现问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants