Giter VIP home page Giter VIP logo

Comments (6)

perryjsteward avatar perryjsteward commented on June 13, 2024 1

Hey this is working great now! thanks very much for looking into this. I think my problem was cached modules. after removing them and reinstalling it all worked fine.

from fabric-history.

alimozdemir avatar alimozdemir commented on June 13, 2024

Hi,

Thank you ! Each operation is a history point. Your code will trigger the history event separately. Therefore, the undo operation is working separately. FabricJS doesn't have 'removeAll' function for your expectation. Maybe we can do a trick about this one but I have to do some research.

from fabric-history.

perryjsteward avatar perryjsteward commented on June 13, 2024

I think i understand. Would you expect the undo to have to be peformed twice for a case where two objects where deleted in one delete?

from fabric-history.

alimozdemir avatar alimozdemir commented on June 13, 2024

Yes, because you are looping through them. I will try to implement history toggle for such kind of needs. And, it would fit for this situation.

from fabric-history.

alimozdemir avatar alimozdemir commented on June 13, 2024

Hello again,

I have implemented the on/off history functions in 1.6.0. You may use like this,

function removeActiveObject() {
    const activeObjects = canvas.getActiveObjects();

    // remove objects
    if (activeObjects.length > 0) {
        canvas.offHistory();

        for (var i = 0; i < activeObjects.length; i++) {
            if (!activeObjects[i].isEditing) {
                canvas.remove(activeObjects[i]);
            }
        }

        canvas.onHistory();
    }
}

I think this is what you need !

from fabric-history.

perryjsteward avatar perryjsteward commented on June 13, 2024

Hi sorry for the late reply. Thanks for looking into this! I think im not following is the onHistory / offHistory an implementation of fabricjs or fabric-history as im getting an error for undefined.

from fabric-history.

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.