Skip to content

Conversation

@Manuel-Pol
Copy link
Collaborator

No description provided.

Manuel-Pol and others added 11 commits January 3, 2025 01:04
- Implemented undo and redo functionality for moving devices by integrating with the UndoRedoManager.
- Moves are now registered in the UndoRedoManager through the ViewGraph's `registerMove` method.

Note:
- Known bugs persist in the undo/redo functionality for adding devices. These issues need to be addressed in a future commit.
- Added `reset` method to clear undo/redo buffers and notify listeners.
- Implemented undo/redo functionality for deleting devices, including restoring connections.

Known issue:
- Connections remain statically drawn on the screen after device removal and do not update when objects are moved.
- AddEdgeMove and RemoveEdgeMove created for UndoRedoManager.

Known issue:
- Removing a device with connections register both the removing of the device and the removing of the connections as different UR moves. Unexpected behavior occurs.

Co-authored-by: Pedro Gallino <[email protected]>
Notes:
- Known bugs persisted.
Updated the drawEdge method to accept an optional EdgeId parameter. If provided, the specified EdgeId is used; otherwise, a new ID is generated automatically.
Modified the addEdge method to support custom EdgeId input while maintaining compatibility with auto-generated IDs.
Adjusted undo and redo logic for addEdge and removeEdge to utilize the optional EdgeId parameter, ensuring consistent edge restoration.
Enhanced the undo logic for removeDevice to use the optional EdgeId when re-establishing device connections, preserving original edge IDs during reconstruction.
- When removing a device with connection, a unique UR move is registered (RemoveDeviceMove)
- Refactor: AddDeviceMove and RemoveDeviceMove extends superclass AddRemoveDeviceMove. Same for edges.
- Undo/Redo icons change opacity when canUndo/canRedo.

Co-authored-by: Pedro Gallino <[email protected]>
@Manuel-Pol Manuel-Pol linked an issue Jan 16, 2025 that may be closed by this pull request
@MegaRedHand MegaRedHand merged commit 50f6f82 into main Jan 18, 2025
3 checks passed
@MegaRedHand MegaRedHand deleted the undo-redo branch January 18, 2025 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add undo/redo functionality

4 participants