antvis / X6

🚀 JavaScript diagramming library that uses SVG and HTML for rendering.
https://x6.antv.antgroup.com
MIT License
5.74k stars 1.7k forks source link

node drag error #4158

Open Cishenn opened 9 months ago

Cishenn commented 9 months ago

Describe the bug

画布中元素的拖拽异常, 表现就是鼠标单击一下,节点会一直跟随鼠标移动。

Your Example Website or App

https://codesandbox.io/s/currying-silence-5lmthm?file=/src/index.tsx

Steps to Reproduce the Bug or Issue

1、单击节点 2、松开鼠标后节点会跟随鼠标移动 3、再次单击节点才会释放

Expected behavior

长按节点才会被拖动,单击只被选中

Screenshots or Videos

No response

Platform

Additional context

No response

x6-bot[bot] commented 9 months ago

👋 @Cishenn

Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. To help make it easier for us to investigate your issue, please follow the contributing guidelines. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

cnyballk commented 9 months ago

react严格模式的问题,做个实例判断就行了

Cishenn commented 9 months ago

请问实例判断是什么意思呐

cnyballk commented 9 months ago

请问实例判断是什么意思呐

就是创建x6实例的时候判断一下有没有创建过,有就不创建了,或者先销毁

Cishenn commented 9 months ago

在严格模式取消的情况下: 错误触发动作: 一开始进入x6渲染的页面可以正常拖动, 但是如果进入另外一个路由 然后浏览器回退回上个页面,也会触发这个错误 试了单例模式解决这个问题

Cishenn commented 8 months ago

很好奇 请问源码为什么创建两次会触发这个错误呐

yby1999 commented 4 months ago

同问