iVis-at-Bilkent / cytoscape.js-grid-guide

A Cytsocape.js extension to provide a framework for grid interactions such as grid lines and snapping to grid, and guidelines and snap support for alignment of nodes.
MIT License
59 stars 9 forks source link

snapToGridDuringDrag interferes with undo/redo #43

Open tsi opened 4 years ago

tsi commented 4 years ago

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:

This doesn't happen with snapToGridDuringDrag: false

Thanks!!

canbax commented 2 years ago

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.

kubitre commented 2 years ago

Nice timing=)