public void saveState(StateChange state) { if (state == null) { throw new ArgumentNullException(); } removeStatesAfter(currentState); savedStates.AddLast(state); currentState = savedStates.Last; }
private void startStateChange(IEnumerable<RigidBody> bodies) { //if (bodies == null) // Console.WriteLine("start with body count: null"); //else // Console.WriteLine("start with body count: " + bodies.Count()); stateInChange = new StateChange(bodies); }
private void undo() { if (moveMode != MoveMode.None) { finishStateChange(selected); //in case of dragging } Paused = true; selected.Clear(); stateInChange = states.undo(); }
private void finishStateChange(IEnumerable<RigidBody> bodies) { moveMode = MoveMode.None; if (stateInChange != null) { stateInChange.After = bodies; states.saveState(stateInChange); stateInChange = null; } //if (selectedButNotMoving.Count != 0) //{ // selected.Add(selectedButNotMoving); // selectedButNotMoving = Selection.Empty; //} }