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

Undo/redo #34

Closed
nielshoogendoorn opened this issue Jun 29, 2017 · 4 comments
Closed

Undo/redo #34

nielshoogendoorn opened this issue Jun 29, 2017 · 4 comments

Comments

@nielshoogendoorn
Copy link

Would really appreciate an undo/redo feature.

I guess that in order for this to work, we need to

  • save snapshots of the canvas, (example) or
  • save objects / user actions in an array and redraw canvas. (example)

Any thoughts? Any volunteers? 😃

@jakubfiala
Copy link
Owner

@nielshoogendoorn thanks for the suggestion!

Personally I think this could be advanced enough to be a separate library – I like things modular and atrament already does a lot of different things.

I could imagine a solution with two canvases, you capture individual strokes on the top one, and copy them over to the bottom one on mouseup.

My question is: if there was to be a separate package – how would atrament have to change/what things would it need to expose in order for it to work?

@dethe
Copy link
Contributor

dethe commented Aug 9, 2019

I'm interested in working on undo/redo, as well as adding some additional drawing tools and features (like line simplifying). Would you prefer I add those in my own branch only (and if so , would you like me to rename it to prevent confusion), or would you like PRs for these things?

I think the two canvas thing you mention is how other tools manage. I think if we add more events into the Atrament drawing, then another tool could handle undo/redo. A bunch of what atrament.js currently does is mouse management, which could be pushed into the mouse.js so that the main file is mostly managing state and actual canvas drawing.

My overall goal is to use Atrament as the drawing component for an animation tool, with onionskinning and .gif export.

@jakubfiala
Copy link
Owner

@dethe this is great to hear, your use case is really cool. I'd be up for discussing the extra features you're proposing. My goal with Atrament is to make sure it conforms to "do one thing and do it well", but we already have the concept of different drawing modes (draw, fill, erase) so other tools could make sense, too.

I think we can treat undo/redo as a separate feature & track it in this issue, and discuss additional drawing tools separately. If you're willing to collaborate on these, I'd be happy to add you as a co-author. Could you please drop me an email (on my GH profile) about the new features you were envisaging?

thanks, Jakub

@jakubfiala
Copy link
Owner

Hi folks, just FYI Undo/redo is now possible to implement with Atrament 1.0.0 - see README, there is now a recordStrokes option and a strokerecorded event. Using the stroke data you should be able to store all strokes and redraw them as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants