Giter Club home page Giter Club logo

Comments (4)

Calinou avatar Calinou commented on May 13, 2024 1

For reference, undo/redo support was implemented in #349.

from material-maker.

Calinou avatar Calinou commented on May 13, 2024

If Ctrl + Y isn't used for anything else, it makes sense to support it as a "Redo" shortcut in addition to Ctrl + Shift + Z. There's no real standard here, so supporting both is probably a good idea if possible.

from material-maker.

RodZill4 avatar RodZill4 commented on May 13, 2024

Undo/Redo will not be easy to implement. I tested a simplistic undo/redo but it was pretty bad performance wise. It's definitely on the roadmap, though... I guess I have a smarter solution, but did not have time to implement it yet.

from material-maker.

SolAZDev avatar SolAZDev commented on May 13, 2024

Is there a store state system (I might be using the wrong name; please refer to Vue's Vuex) that could be implemented?
In my mind, (as someone who hasn't seen the source code) I think an int for step counts, and an object detailing what was changed in which node; could be enough for an undo-redo.

Pseudo Code;
In this example code, the change is only for moving a node, and changing a value.

{
    "stepsCount": 0,
    "changes": [
        {
            "nodeId": 0,
            "change": {
                "from": {
                    "node_position": { "x": -84.916977,"y": -75.517273 }
                },
                "to": {
                    "node_position": { "x": 1.58463,"y": -75.517273 }
                }
            }
        },
        {
            "nodeId": 0,
            "change": {
                "from": {
                    "parameters": { "scale_y": 1.3 }
                },
                "to": {
                    "parameters": { "scale_y": 1.5 }
                }
            }
        }
    ]
}

Where, for sake of simplicity, Ctrl+(Shift)+Z changes the stepCount, and then the object at changes[change.length-(stepCount+1)] (accessed backwards for simplicity in this example), and thus the change is applied to the node.

Of course, this requires each node to have an id, which shouldn't be a problem, considering they're in order in the nodes array. Of course, if names are preferred, I don't see why it wouldn't be possible.

If keeping it in memory is a problem, I'm not a fan of the idea, but I think maybe accessing it from a file in the app's folder.

Thank you for your time and patience. I hope this could be of use.

from material-maker.

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.