Cytoscape position ignored if locked: false

倖福魔咒の 提交于 2019-12-25 16:57:37

问题


When I add a position property on a node, it is ignored unless I also specify locked: true. I would like to specify initial positions on some nodes, yet still allow the user to move those nodes around.

Related (I think) - is there a way to let Cytoscape use a layout to determine node positions, then do a second pass and change them for any nodes that have a position property specified? It would also work to have the layout ignore or not process any nodes that have positions specified. That's what currently happens when I have locked set to true, but I'd like for it to happen if I have locked set to false on a node.

Perhaps another solution would be, how can I manually alter the positions after the layout is finished rendering?


回答1:


Don't run a layout on nodes you don't want moved. Note that you have a layout specified in the init options.

Use preset at init, and make your own explicit cy.layout() and/or eles.layout() calls. (The preset layout acts pretty much like a nop if all you specify is { name: 'preset' }.)

Or keep your existing workflow and just unlock the nodes when the layout is done.



来源:https://stackoverflow.com/questions/41005224/cytoscape-position-ignored-if-locked-false

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