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

如何阻止节点拖入combo? #5106

Open
toddmark opened this issue Nov 1, 2023 · 5 comments
Open

如何阻止节点拖入combo? #5106

toddmark opened this issue Nov 1, 2023 · 5 comments
Labels
good first issue stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed

Comments

@toddmark
Copy link

toddmark commented Nov 1, 2023

问题描述

在我的场景中,有些节点不允许被拖入combo中,请问该如何使用相关API?

重现链接

https://stackblitz.com/

重现步骤

在我的场景中,有些节点不允许被拖入combo中,请问该如何使用相关API?

预期行为

期望能够控制节点能否被拖入combo中的行为。

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]
  • G6 版本: [4.5.1 ... ]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

Copy link

github-actions bot commented Nov 1, 2023

hi @toddmark, welcome!

Copy link

github-actions bot commented Nov 1, 2023

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

@xiaoSS-developer
Copy link

https://g6.antv.antgroup.com/manual/middle/states/default-behavior#drag-node 这里面有个onlyChangeComboSize可以配置不将节点从 Combo 中拖出或将节点拖入到 Combo 中,设置为true就行。
不知道能不能解决你的问题

@Yanyan-Wang
Copy link
Contributor

楼上的方法是对的~,另外 drag-node 的 shouldEnd 和 shouldBegin 也可以尝试一下

@toddmark
Copy link
Author

toddmark commented Nov 8, 2023

@xiaoSS-developer onlyChangeComboSize 这个属性是有效的。不过没有完全解决我的问题。我在拖某类节点A时,需要禁止拖入Combo的行为,但我在拖某类节点B时,需要允许拖入Combo的行为。

由此,如果使用onlyChangeComboSize直接禁用。不满足我拖动B类节点行为。这就带来一个新的问题:需要动态修改 drag-node的配置,可惜,我在setMode中没有找到相关方案。请问如何动态修改 setMode 的配置呢? 比如: setMode("drag-node", {test: true}}

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed
Projects
None yet
Development

No branches or pull requests

3 participants