Browse Source

Fixed ActiveLayer index bug and select tool undo bug WIP

flabbet 4 years ago
parent
commit
f94e2c09e3

+ 1 - 1
PixiEditor/Models/DataHolders/Document.cs

@@ -506,7 +506,7 @@ namespace PixiEditor.Models.DataHolders
                 bool wasActive = layer.IsActive;
                 bool wasActive = layer.IsActive;
                 Layers.Remove(layer);
                 Layers.Remove(layer);
 
 
-                if (wasActive)
+                if (wasActive || ActiveLayerIndex >= index)
                 {
                 {
                     SetNextLayerAsActive(index);
                     SetNextLayerAsActive(index);
                 }
                 }

+ 5 - 4
PixiEditor/Models/Tools/Tools/SelectTool.cs

@@ -1,5 +1,6 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Linq;
 using System.Linq;
 using System.Windows.Controls;
 using System.Windows.Controls;
 using System.Windows.Input;
 using System.Windows.Input;
@@ -50,11 +51,11 @@ namespace PixiEditor.Models.Tools.Tools
 
 
             ViewModelMain.Current.BitmapManager.ActiveDocument.UndoManager.AddUndoChange(
             ViewModelMain.Current.BitmapManager.ActiveDocument.UndoManager.AddUndoChange(
                 new Change(
                 new Change(
-                    "ActiveSelection",
-                    oldSelection,
-                    ViewModelMain.Current.BitmapManager.ActiveDocument.ActiveSelection,
+                    "SelectedPoints",
+                    oldSelection.SelectedPoints,
+                    new ObservableCollection<Coordinates>(ViewModelMain.Current.BitmapManager.ActiveDocument.ActiveSelection.SelectedPoints),
                     "Select pixels",
                     "Select pixels",
-                    ViewModelMain.Current.SelectionSubViewModel));
+                    ViewModelMain.Current.BitmapManager.ActiveDocument.ActiveSelection));
         }
         }
 
 
         public override void Use(Coordinates[] pixels)
         public override void Use(Coordinates[] pixels)