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

Implement undo/redo #11

Open
ThomWright opened this issue Sep 4, 2015 · 1 comment
Open

Implement undo/redo #11

ThomWright opened this issue Sep 4, 2015 · 1 comment

Comments

@ThomWright
Copy link
Member

Fairly low-priority at the moment, but should be fairly trivial using redux middleware.

Look at this? - https://gist.github.com/gaearon/2b3ee315bb6a3b280b7c

@ThomWright
Copy link
Member Author

In the state object, views contains:

  • Static state - component types, positions etc.
  • Transient state - current and voltage

The 'transient state' changes during each main loop cycle.

The 'static state' should be undoable, i.e. each change added to a history stack. Moving the transient state out would help make this possible.

For example:

{
  views: {
    id: {
      typeID,
      props: {
        id,
        dragPoints: [Vector], // 2 drag points
        connectors: [Vector],

        resistance|current|...
      }
    }
  },
  NAME_ME: {
    id: {
      currents,
      voltages
    }
  }
}

This still leaves the problem of adding/moving components - history stack should be updated at the end of adding/moving, not during, even though the views state will change a lot during moving.

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

No branches or pull requests

1 participant