Grab compound nodes when a child node is grabbed

▼魔方 西西 提交于 2019-12-11 10:13:12

问题


I'm currently trying to implement the developp the following behavior in my application embedding Cytoscape.js : I would like that when a particular child node of a compound node is grabbed, the whole compound node is grabbed.
If tried using this code but it does not work as I expect :

cy.$(mySubNodeSelector)
                        .on('grab', function(){ 
                            this.ungrabify();
                            this.parent().select();
                            this.parent().grabify();
                        });

Does anybody has an advice about how to implement this behavior ? Thanks a lot.


回答1:


Disable events on the child: http://js.cytoscape.org/#style/events

Your code doesn't do anything because (1) you're mutating grabbability after elements have been grabbed and (2) you conflate grabifying (allowing grabbing) with grabbing (a user gesture).



来源:https://stackoverflow.com/questions/34785598/grab-compound-nodes-when-a-child-node-is-grabbed

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