antvis/G6

自定义Vue组件转DOM以后,拖拽和drag-canvas 冲突 #5101

LuckyTaoTao posted onGitHub

Describe the bug

自定义组件以后,如果拖拽了drag-canvas,则自定义节点就不会推动了,希望能帮忙看看应该怎么做 https://codesandbox.io/p/sandbox/dreamy-feynman-4sk27q?file=%2Fsrc%2FApp.vue%3A9%2C41

Your Example Website or App

https://codesandbox.io/p/sandbox/dreamy-feynman-4sk27q?file=%2Fsrc%2FApp.vue%3A9%2C41

Steps to Reproduce the Bug or Issue

https://codesandbox.io/p/sandbox/dreamy-feynman-4sk27q?file=%2Fsrc%2FApp.vue%3A9%2C41

Expected behavior

https://codesandbox.io/p/sandbox/dreamy-feynman-4sk27q?file=%2Fsrc%2FApp.vue%3A9%2C41

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response


Hi @LuckyTaoTao, Please star this repo if you find it useful! Thanks :star:! 你好 @LuckyTaoTao。如果该仓库对你有用,可以 star 一下,感谢你的 :star:!

posted by github-actions[bot] over 1 year ago

hi @LuckyTaoTao, welcome!

posted by github-actions[bot] over 1 year ago

不知道我哪里写错了,如果drag-canvas拖动了,则自定义节点就不会拖动了

posted by LuckyTaoTao over 1 year ago

因为 dom 图形在更新之后,内部 dom 会被重新创建,原先绑定的监听可能就消失了,需要在必要的时候重新绑一下监听,例如: <img width="321" alt="image" src="https://github.com/antvis/G6/assets/29593318/c10931ee-4542-4e4c-a0db-5124ea488473">

这也是 dom 节点性能会比较差的一个原因,比较建议用 canvas 来实现

posted by Yanyan-Wang over 1 year ago

This issue has been closed because it has been outdate for a long time. Please open a new issue if you still need help.

这个 issue 已经被关闭,因为 它已经过期很久了。 如果你仍然需要帮助,请创建一个新的 issue。

posted by github-actions[bot] 10 months ago

Fund this Issue

$0.00
Funded

Pull requests