Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Copy/Paste and Undo/Redo editor actions #101

Closed
heisenberg-cooks opened this issue Apr 20, 2024 · 2 comments
Closed

[Feature] Copy/Paste and Undo/Redo editor actions #101

heisenberg-cooks opened this issue Apr 20, 2024 · 2 comments
Assignees
Labels
enhancement New feature or enhancement

Comments

@heisenberg-cooks
Copy link

Describe the solution you'd like
Having a built in method for copy/paste and undo/redo added to the editor would be very convenient for ease of canvas operations and minimization of clicking around.

Describe alternatives you've considered
I currently have a copy method, but it's very limited to just copying nodes only. It simply copies all the properties of an existing node and assigns it a new id on paste, but this gets more complicated with custom controls being embedded in as node inputs. Connections are a little bit more difficult to maintain since you might not be copying the node they are connecting to.

Undo/redo sounds like a similar request since it requires keeping the collection in memory.

With that being said, i'm not sure the scope of the copy/paste and undo/redo when multiple tabs/editors are being used? Perhaps it's only relative to the current editor in focus?

@heisenberg-cooks heisenberg-cooks added the enhancement New feature or enhancement label Apr 20, 2024
@miroiu
Copy link
Owner

miroiu commented Apr 23, 2024

Hi! The provided controls do not hold too much state because everything is intended to be controlled by the view model. Of course, I could have an undo action for basic things like moving a node or zooming the canvas, etc. But that would surely interfere with your custom-made undo-redo solution, over-complicating things. Then we need to think about what stays in memory and for how long, then make sure that the view does not get out of sync with the view model. In the case of copy-paste, how would you validate that copy-paste is allowed? The graph may be read-only or some of the nodes should be unique. These rules are application-specific. Even if I tried implementing something in the library, it wouldn't be generic enough to cover all cases.

However, I had an attempt at creating a separate library at some point in time which would implement most of the common functionality you see in a node editor in a generic way so you can use it as a base. Here's the PR if you are interested: #36 . And here are the relevant files for undo/redo: https://github.com/miroiu/nodify/tree/feature/new-blueprint/Nodifier/UndoRedo

@miroiu
Copy link
Owner

miroiu commented May 11, 2024

Closing this as not planned. Please feel free to reopen the issue if you need more information.

@miroiu miroiu closed this as not planned Won't fix, can't repro, duplicate, stale May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants