cytoscape.js disable grab&moving nodes

我只是一个虾纸丫 提交于 2020-02-02 06:29:06

问题


I'm having trouble building a graph network with cytoscapeJS. I can add nodes and handle them which is quite easy, but I'm not able to configure cytospace to disable Dragging/Moving nodes.

I have found a JSbin from somebody where you can try: http://jsbin.com/vasenatimu/2/edit?html,js,output

Have a look at http://js.cytoscape.org under 'Initialisation options', I tried all the options, but they dont solve my problem (I set nearly all options to false and I can still grab and select nodes).

Can you help me with this?


回答1:


initOptions.autoungrabify: true or cy.nodes().ungrabify()




回答2:


You can also disable selected nodes using their configuration. For example:

cytoscape({
  elements: {
    nodes: [
      { 
        data: { id: "node1" }, 
        grabbable: false,
      },
    ],
  },
});



回答3:


I faced the same problem and I found out this is the solution to the problem for me:

cytoscape({
  autolock: true, <== this did the trick for me
  elements: {
    nodes: [
      { 

      },
    ],
  },
});

I hope this will help you as well.

Regards Edgar



来源:https://stackoverflow.com/questions/30234551/cytoscape-js-disable-grabmoving-nodes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!