如何防止节点重叠
如何防止图中的节点相互堆叠?我希望节点之间有一个最小距离,如果有人将一个节点拖到另一个节点上,图表会向用户抛出错误。我看到了这个解决方案并尝试了它,但它不起作用 防止 JGraphX 中的节点重叠
我会很感激任何想法。
How do I prevent nodes in a graph from stacking on each other? I want there to be a minimum distance between nodes and if someone was to drag a node over another the graph throws an error to the user. I saw this solution and tried it but it doesnt work Prevent node overlap in JGraphX
I'll appreciate any ideas.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要自动重新排列图表并使其之间有一定距离,您可以尝试使用类似以下的方法:
mxHierarchicalLayout 方法将自动重新排列当前节点。其他两个设置将在它们之间提供间距(水平和垂直)
此外,在渲染屏幕之前运行此设置,或者如果您想在显示已经渲染后进行更改,只需 this.graph.refresh() (如果需要)
For rearranging your diagram automatically with some distance between them you can try to use something like this:
The mxHierarchicalLayout method will automatically rearrange your current nodes. The other two settings will give spacing between them ( horizontally and vertically )
Also, run this before rendering the screen or if you want to change after the display has already rendered, just this.graph.refresh() if needed