Browse Source

Fixed selection bug

flabbet 5 years ago
parent
commit
d4236cc7d9

+ 3 - 2
PixiEditor/Models/Tools/Tools/MoveTool.cs

@@ -42,13 +42,14 @@ namespace PixiEditor.Models.Tools.Tools
             }
 
             Coordinates translation = ImageManipulation.Transform.GetTranslation(_lastMouseMove, end);
-
-                Coordinates[] previousSelection = ViewModelMain.Current.ActiveSelection.SelectedPoints.ToArray();
+            Coordinates[] previousSelection = ViewModelMain.Current.ActiveSelection.SelectedPoints.ToArray();
                 ViewModelMain.Current.ActiveSelection = 
                     new Selection(ImageManipulation.Transform.Translate(previousSelection, translation));
+
             if (_clearedPixels == false)
             {
                 layer.ApplyPixels(BitmapPixelChanges.FromSingleColoredArray(previousSelection, System.Windows.Media.Colors.Transparent));
+
                 _clearedPixels = true;
             }
                 BitmapPixelChanges changes = BitmapPixelChanges.FromArrays(

+ 1 - 1
PixiEditor/Models/Tools/Tools/SelectTool.cs

@@ -17,7 +17,7 @@ namespace PixiEditor.Models.Tools.Tools
         {
             RectangleTool rectangleTool = new RectangleTool();
             List<Coordinates> selection = rectangleTool.CreateRectangle(pixels, 1).ToList();
-            selection.AddRange(rectangleTool.CalculateFillForRectangle(selection[0], selection[^1], 1));
+            selection.AddRange(rectangleTool.CalculateFillForRectangle(pixels[^1], pixels[0], 1));
             ViewModelMain.Current.ActiveSelection = new DataHolders.Selection(selection.ToArray());
         }
     }

+ 3 - 3
PixiEditor/ViewModels/ViewModelMain.cs

@@ -59,7 +59,7 @@ namespace PixiEditor.ViewModels
         }
 
 
-        private Color _primaryColor = Colors.White;
+        private Color _primaryColor = Colors.Black;
 
         public Color PrimaryColor //Primary color, hooked with left mouse button
         {
@@ -75,9 +75,9 @@ namespace PixiEditor.ViewModels
             }
         }
 
-        private Color _secondaryColor = Colors.Black;
+        private Color _secondaryColor = Colors.White;
 
-        public Color SecondaryColor //Secondary color, hooked with right mouse button
+        public Color SecondaryColor
         {
             get => _secondaryColor;
             set { if (_secondaryColor != value) { _secondaryColor = value; RaisePropertyChanged("SecondaryColor"); } }