javascript - 使用 cytoscape 修复父级内的节点

标签 javascript graph cytoscape.js

我正在尝试使用 Cytoscape.js 做这样的事情:diagram

我希望模块可拖动,但内部节点必须固定相对位置且不可选择。我找不到任何解决方案来做到这一点。感谢您的帮助!

我正在使用这个 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/

相关文章:

algorithm - 表明顶点覆盖的启发式解最多是最优解的两倍

javascript - 在鼠标光标位置添加 cytoscape 节点

class - 如何否定 Cytoscape.js 中的类选择器?

java - 通过邻接表进行前序遍历

javascript - javascript中的对象集

javascript - Web组件中嵌套槽的内容不可见

javascript - 通过 window.open 打开另一个 HTML 文件

javascript - d3.js 箭头定向图 : adding nodes/links on the fly

javascript - 使用 jquery 自定义自动完成