private void NewObject() { LastCommand?.Deactivate(Application.Current.MainWindow); var o = CurrentScene.CreateNew(); LastCommand = new CreateNewObject(Application.Current.MainWindow, o); SelectedObject = o; CurrentScene.Redraw(); }
private void ScaleObject() { LastCommand?.Deactivate(Application.Current.MainWindow); LastCommand = new ScaleCommand(Application.Current.MainWindow, SelectedObject); LastCommand.OnApply += () => { LastCommand.Deactivate(Application.Current.MainWindow); LastCommand = null; }; }
private void DeleteObject() { LastCommand?.Deactivate(Application.Current.MainWindow); LastCommand = null; var index = CurrentScene.Objects.IndexOf(SelectedObject); CurrentScene.Objects.RemoveAt(index); if (CurrentScene.Objects.Count > 0) { SelectedObject = index < CurrentScene.Objects.Count ? CurrentScene.Objects[index] : CurrentScene.Objects[--index]; } else { SelectedObject = null; } CurrentScene.Redraw(); }