GithubHelp home page GithubHelp logo

undo & redo support about fabric.js HOT 4 CLOSED

fabricjs avatar fabricjs commented on May 20, 2024
undo & redo support

from fabric.js.

Comments (4)

kangax avatar kangax commented on May 20, 2024

The undo/redo support is somewhat unrelated to fabric itself. The behavior of history management will likely vary based on your needs. Which actions are added to history stack? When an object is moved, is every pixel tracked and added to a history? Or is move action added to history only when object is "stopped" (mouse up)? How about other object modifications — scaling, rotation — are they considered undoable actions as well?

I think that history management should be implemented separately of fabric, according to specific requirements. It can be plugged into fabric via events that library exposes — http://kangax.github.com/fabric.js/demos/events/

from fabric.js.

raichu avatar raichu commented on May 20, 2024

There argument here is that here is no "one true way", but it's not true.
I don't think there are any ambiguities here at all.
Other that "every pixel tracked" action, everything you mentioned is undoable in all (vector) image editing tools I have ever seen.
It's the norm to consider mouse drag actions to start with mouse down and and end with mouse up. And simply down event for buttons. Mouse buttons don't auto-repeat, and keyboard auto-repeat is handled by the window manager such that the application received a stream of button down events.

It'd solve the problem for users.

from fabric.js.

raichu avatar raichu commented on May 20, 2024

for reference: #23 and #582

from fabric.js.

deveshsinghal22 avatar deveshsinghal22 commented on May 20, 2024

This Fiddle can be useful
http://jsfiddle.net/SpgGV/9/

from fabric.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.