我希望模块可拖动,但内部节点必须固定相对位置且不可选择。我找不到任何解决方案来做到这一点。感谢您的帮助!
我正在使用这个 JSON 结构:
elements: {
nodes: [
{ data: { id: 'listener', name: 'Listener' } },
{ data: { id: 'listener-true', parent: 'listener', label: 'true' }, position: { x: 300, y: 55 } },
{ data: { id: 'listener-false', parent: 'listener', label: 'false' }, position: { x: 300, y: 85 } },
{ data: { id: 'configuration', name: 'Configuration' } },
{ data: { id: 'configuration-true', parent: 'configuration', label: 'true' }, position: { x: 100, y: 55 } },
{ data: { id: 'configuration-false', parent: 'configuration', label: 'false' }, position: { x: 100, y: 85 } },
],
edges: [
{ data: { id: 'ad', source: 'configuration-true', target: 'listener' } }
]
}
最佳答案
Ungrabifying 禁用抓取:http://js.cytoscape.org/#nodes.ungrabify
取消选择将禁用选择:http://js.cytoscape.org/#eles.unselectify
events: no
禁用所有事件:http://js.cytoscape.org/#style/events
关于javascript - 使用 cytoscape 修复父级内的节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36218944/