GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing maxgraph.github.io — UndoManager | @maxgraph/core
Class UndoManagerImplements a command history. When changing the graph model, an UndoableEdit object is created at the start of the transaction (when model.beginUpdate is called). All atomic changes are then added to this object until the last model.endUpdate call, at which point the UndoableEdit is dispatched in an event, and added to the history inside UndoManager. This is done by an event listener in Editor.installUndoHandler. Each atomic change of the model is represented by an object (e.g. RootChange, ChildChange, TerminalChange, etc.) which contains the complete undo information. The UndoManager also listens to the GraphView and stores its changes to the current root as insignificant undoable changes, so that drilling (step into, step up) is undone. This means when you execute an atomic change on the model, then change the current root on the view and click undo, the change of the root will be undone together with the change of the model so that the display represents the state at which the model was changed. However, these changes are not transmitted for sharing as they do not represent a state change. ExampleWhen adding an undo manager to a graph, make sure to add it to the model and the view as well to maintain a consistent display across multiple undo/redo steps.
The code creates a function that informs the undoManager of an undoable edit and binds it to the undo event of GraphDataModel and GraphView using EventSource.addListener. Event: InternalEvent.CLEARFires after clear was invoked. This event has no properties. Event: InternalEvent.UNDOFires afer a significant edit was undone in undo. The Event: InternalEvent.REDOFires afer a significant edit was redone in redo. The Event: InternalEvent.ADDFires after an undoable edit was added to the history. The Hierarchy (View Summary)
|
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |