Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cytoscape : how to disable node and edge selection?

Tags:

cytoscape.js

How can I disable some nodes/edges in a cytoscape.js graph to be selected? the 'unselectable: true' option doesn't work. Can anyone link a working example?

Thanks

like image 341
user1403546 Avatar asked Oct 15 '25 17:10

user1403546


1 Answers

You can prevent the user from grabbing or moving a node or lock the nodes position:

If you want to lock the node, use this: nodes.lock()

If you want to make the node ungrabbable, use this: nodes.ungrabify()

If your goal is to make the nodes not selectable, you can always use the function provided by Cytoscape:

Enable:

cy.autounselectify( true );

Disable:

cy.autounselectify( false );

I really can't find anything about unselectable: true, did you confuse it with the :unselectable state from here?

like image 180
Stephan T. Avatar answered Oct 18 '25 16:10

Stephan T.