Browse Source

Fix single click not removing selection

Equbuxu 3 years ago
parent
commit
db81989a33

+ 2 - 1
src/PixiEditor.ChangeableDocument/Changes/Selection/SelectEllipse_UpdateableChange.cs

@@ -31,7 +31,8 @@ internal class SelectEllipse_UpdateableChange : UpdateableChange
     private Selection_ChangeInfo CommonApply(Document target)
     {
         using var ellipsePath = new SKPath() { FillType = SKPathFillType.EvenOdd };
-        ellipsePath.AddOval(borders);
+        if (!borders.IsZeroArea)
+            ellipsePath.AddOval(borders);
 
         var toDispose = target.Selection.SelectionPath;
         if (mode == SelectionMode.New)

+ 8 - 5
src/PixiEditor.ChangeableDocument/Changes/Selection/SelectRectangle_UpdateableChange.cs

@@ -30,11 +30,14 @@ internal class SelectRectangle_UpdateableChange : UpdateableChange
     private Selection_ChangeInfo CommonApply(Document target)
     {
         using var rectPath = new SKPath() { FillType = SKPathFillType.EvenOdd };
-        rectPath.MoveTo(rect.TopLeft);
-        rectPath.LineTo(rect.TopRight);
-        rectPath.LineTo(rect.BottomRight);
-        rectPath.LineTo(rect.BottomLeft);
-        rectPath.Close();
+        if (!rect.IsZeroArea)
+        {
+            rectPath.MoveTo(rect.TopLeft);
+            rectPath.LineTo(rect.TopRight);
+            rectPath.LineTo(rect.BottomRight);
+            rectPath.LineTo(rect.BottomLeft);
+            rectPath.Close();
+        }
 
         var toDispose = target.Selection.SelectionPath;
         if (mode == SelectionMode.New)

+ 1 - 1
src/PixiEditor/Models/DocumentModels/UpdateableChangeExecutors/SelectToolExecutor.cs

@@ -32,7 +32,7 @@ internal class SelectToolExecutor : UpdateableChangeExecutor
         selectShape = toolbar.SelectShape;
         selectMode = toolbar.SelectMode;
 
-        IAction action = CreateUpdateAction(selectShape, new RectI(startPos, new(1)), selectMode);
+        IAction action = CreateUpdateAction(selectShape, new RectI(startPos, new(0)), selectMode);
         internals!.ActionAccumulator.AddActions(action);
         
         return ExecutionState.Success;