-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Comments
感谢您提供详细的错误描述和复现链接。关于您提到的两个问题:
这两个问题可能与 G6 的事件处理机制有关,特别是在自定义节点中使用特定图形元素时。 我建议您检查以下几点:
如果问题依然存在,您可以尝试在 G6 的 GitHub 仓库中查看是否有类似的问题报告,或者提供更多的代码细节以便进一步分析。 如果您需要,我可以帮助您在 GitHub 上搜索相关问题,看看是否有解决方案。请告诉我您的决定。 🪧 TipsFor further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me. |
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 |
需要如何解决? |
当前在render时,将使用rect的keyshape,通过getShape方法,拿到其对象,然后将其type值赋值为空字符串即可解决问题1 |
drawProcessBarShape(attributes, container) { This is where you use Rect, that is inserting a node, another node, you need to insert a shape GRect |
我不希望在引用@antv/g这个库,我目前已找到临时方案来解决改问题,在render函数中增加代码 this.getShape('process-bar').type = ''就能实现rect的拖动 render(attributes = this.parsedAttributes, container) {
} |
looks like an option |
暂时没有研究源码,但是从不同shape的信息上看,只有这个区别 |
I solved the problem of inheritance ID from the BaseShape class and using GRect in the upsert function |
good! |
也可以通过以下方式使用 GRect,我们已经在 G6 内部注册过该图形了
|
按照你的描述,我使用 |
Describe the bug / 问题描述
问题1: 当自定义节点中使用 Rect 作为一部分时, 鼠标移动到这个 Rect上,按下,拖拽节点,会直接报错,导致程序异常,无法继续操作
问题2: 当自定义节点中使用Label实现一个badge效果时,鼠标移动到badge上,按下,拖拽节点,这时,节点可以拖动,但是松开鼠标后,移动鼠标,节点依然跟着鼠标移动
Kapture.2024-12-27.at.17.42.16.mp4
Kapture.2024-12-27.at.17.47.56.mp4
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 / 操作系统
Browser / 浏览器
The text was updated successfully, but these errors were encountered: