thechiselgroup / biomixer

BioMixer
http://bio-mixer.appspot.com/
16 stars 13 forks source link

Expansion Redo Refreshes Layout, But Undo Doesn't #409

Closed everbeek closed 9 years ago

everbeek commented 10 years ago

I am not actually done with undo.redo and layout interaction, but currently redoing (adding nodes) triggers layout refreshing. It is probably the case that the addNodes() method in the graph object has a refresh call while removeNodes() doesn't. Fix it even though the undo system will take layout snapshots later.

everbeek commented 9 years ago

Adding a layout refresh call to remove mostly fixed it, but I am not sure if we want that anyway. When people are deleting nodes they don't want the whole layout refreshing, do they?

I will try doing it around the undo/redo level instead.

everbeek commented 9 years ago

Ok, I am going back to #392, which is dealing with layouts over undo/redo. I think I had the realization that the use case that was stressing me out (redo...keep modified layout or apply original) is a narrow use case. Fixing that case will fix this case.

everbeek commented 9 years ago

Via other issues, I made it so that layout snapshots are taken whenever we trigger a new undo command. When undoing to this command, we use its layout snapshot at creation. When going forward, we use the layout snapshot of that state, or in the case of the final graph state, a temporary snapshot created only for this purpose. Creating an undo replaces the temporary layout snapshot with the permanent one, and triggering an undo replaces the temporary layout with a fresh temporary layout.