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]: Node dragging abnormal #6667

Open
3 of 10 tasks
liuchangheng opened this issue Dec 25, 2024 · 2 comments
Open
3 of 10 tasks

[Bug]: Node dragging abnormal #6667

liuchangheng opened this issue Dec 25, 2024 · 2 comments
Labels
status: waiting for maintainer These issues have not yet been reviewed by a maintainer

Comments

@liuchangheng
Copy link

Describe the bug / 问题描述

问题1: 当自定义节点中使用 Rect 作为一部分时, 鼠标移动到这个 Rect上,按下,拖拽节点,会直接报错,导致程序异常,无法继续操作
问题2: 当自定义节点中使用Label实现一个badge效果时,鼠标移动到badge上,按下,拖拽节点,这时,节点可以拖动,但是松开鼠标后,移动鼠标,节点依然跟着鼠标移动

Reproduction link / 复现链接

https://codesandbox.io/p/sandbox/clever-kate-hygh6l

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 / 其他
@liuchangheng liuchangheng added the status: waiting for maintainer These issues have not yet been reviewed by a maintainer label Dec 25, 2024
Copy link

感谢您提供详细的错误描述和复现链接。关于您提到的两个问题:

  1. 问题1:当自定义节点中使用 Rect 作为一部分时,拖拽节点会导致程序异常。
  2. 问题2:自定义节点中使用 Label 实现 badge 效果时,拖拽后节点会跟随鼠标移动。

这两个问题可能与 G6 的事件处理机制有关,特别是在自定义节点中使用特定图形元素时。

我建议您检查以下几点:

  • 确保在自定义节点中正确处理了拖拽事件,尤其是在 mousedownmousemovemouseup 事件中。
  • 检查是否在自定义节点的 updatesetState 方法中正确更新了节点的状态。

如果问题依然存在,您可以尝试在 G6 的 GitHub 仓库中查看是否有类似的问题报告,或者提供更多的代码细节以便进一步分析。

如果您需要,我可以帮助您在 GitHub 上搜索相关问题,看看是否有解决方案。请告诉我您的决定。

🪧 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]: 节点拖拽异常 [Bug]: Node dragging abnormal Dec 25, 2024
@WolfVerrron18
Copy link

WolfVerrron18 commented Dec 26, 2024

The problem is that Circle,Diamond,Donut,Rect,Ellipse,Hexagon,HTML,Image,Star,Triangle are of type ‘Node’ and G6 tries to get it by identifier at the specified case, but they have no identifier

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

2 participants