iVis-at-Bilkent / cytoscape.js-undo-redo

A Cytoscape.js extension to provide an undo-redo framework
MIT License
46 stars 9 forks source link

Using default action "move" to remove nodes' parent isn't undoable #23

Closed Suges closed 2 years ago

Suges commented 2 years ago

Hello there and thanks for this extremely helpful plugin!

If you do:

ur.do(
  'move',
  {
    eles: cy.$(':selected'),
    location: { parent: null }
  }
)

...undoing after doesn't "do" anything. The reason you would want to do this is to pop nodes out of a compound node.

hasanbalci commented 2 years ago

Hi @Suges , Yes, I confirm your issue. It seems that the default action move currently does a better job for moving edge endpoints. You can instead use the default action changeParent to change parents of the nodes, which I believe works more consistently.

ur.do(
  'changeParent',
  {
    parentData: null,
    nodes: cy.$(':selected'),
    posDiffX: 0,
    posDiffY: 0,
  }
)

See details of the changeParent action here.

Suges commented 2 years ago

Hi @hasanbalci,

Thank you! Works perfectly.