cytoscape.js-grid-guide icon indicating copy to clipboard operation
cytoscape.js-grid-guide copied to clipboard

snapToGridDuringDrag interferes with undo/redo

Open tsi opened this issue 5 years ago • 2 comments

Seems like setting snapToGridDuringDrag: true somehow messes with the undo stack of https://github.com/iVis-at-Bilkent/cytoscape.js-undo-redo

Here's what I get:

  • selected multiple elements
  • drag to move them all
  • press cmd+z to undo
  • only a single (the last) item moved back to previous position

This doesn't happen with snapToGridDuringDrag: false

Thanks!!

tsi avatar Dec 04 '19 09:12 tsi

The real bug is not related to undo/redo. The real bug is actually "some nodes being unselected for no reason".

When snapToGridDuringDrag option is true, after moving selected items only one stays selected. They should stay selected. They do stay selected when snapToGridDuringDrag is false. Can be seen in the below screencast. In the video, for no reason, a node becomes unselected.

https://user-images.githubusercontent.com/8426741/154209942-7e4358f6-dfe1-456a-a7de-9952a61fe695.mp4

Interestingly if you delete line https://github.com/iVis-at-Bilkent/cytoscape.js-grid-guide/blob/296adb1ba35295352501e5d7fc94476ebe2d4c57/src/snap_during_drag.js#L72 "being unselected for no reason" bug is not happening. I cannot understand why.

canbax avatar Feb 16 '22 06:02 canbax

Nice timing=)

kubitre avatar Feb 16 '22 18:02 kubitre