Exemple #1
0
        private void NewObject()
        {
            LastCommand?.Deactivate(Application.Current.MainWindow);
            var o = CurrentScene.CreateNew();

            LastCommand    = new CreateNewObject(Application.Current.MainWindow, o);
            SelectedObject = o;
            CurrentScene.Redraw();
        }
Exemple #2
0
 private void ScaleObject()
 {
     LastCommand?.Deactivate(Application.Current.MainWindow);
     LastCommand          = new ScaleCommand(Application.Current.MainWindow, SelectedObject);
     LastCommand.OnApply += () =>
     {
         LastCommand.Deactivate(Application.Current.MainWindow);
         LastCommand = null;
     };
 }
Exemple #3
0
        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();
        }