johnnyflinn / ngCytoscape

Angular directive for cytoscape.js
http://johnnyflinn.github.io/ngCytoscape
MIT License
17 stars 18 forks source link

layout refresh position of element after node was added #11

Closed kikki closed 8 years ago

kikki commented 8 years ago

Hello I have one problem. When I add new node or edge so cy moved all elements in init position. Example: https://plnkr.co/edit/oUTVzMrIuAutK6siC4aP?p=preview workflow--> (1) Button click "add element" (2) move element to new position (3) Button click "add element" (4) element reset position

hope you can help me..

johnnyflinn commented 8 years ago

I'm sorry, but I don't understand your issue. The plunker seems to have several errors so it's difficult for me to replicate.

kikki commented 8 years ago

Hello johnnyflinn thanks for answer, hope this little Example works. https://plnkr.co/edit/ouccJsCAND0mFv1oJtKA?p=preview (I use firefox 44.0)

johnnyflinn commented 8 years ago

Ah. Yes, this was due to the default layout being run after elements were added. I just changed it. Just be aware that if no position is specified, all newly added nodes will stack at position x:0. y:0.

see plunker: https://plnkr.co/edit/WV849PAZYsLDeRyMExCS?p=preview