diff --git a/.github/workflows/dotnet-format.yaml b/.github/workflows/dotnet-format.yaml new file mode 100644 index 000000000000..075c1db4488f --- /dev/null +++ b/.github/workflows/dotnet-format.yaml @@ -0,0 +1,27 @@ +name: dotnet format + +on: + pull_request: + branches: [ master ] + paths: + - '**.cs' + - '.editorconfig' + +jobs: + check-format: + runs-on: windows-latest + + steps: + - name: check out code + uses: actions/checkout@v2 + + - name: Setup .NET Core 3.1 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.x + + - name: Install format tool + run: dotnet tool install -g dotnet-format + + - name: dotnet format + run: dotnet-format --folder --check --fix-style --fix-whitespace --verbosity diag diff --git a/Files/UserControls/Selection/RectangleSelection.cs b/Files/UserControls/Selection/RectangleSelection.cs index 69dec3091cf7..9adf23813304 100644 --- a/Files/UserControls/Selection/RectangleSelection.cs +++ b/Files/UserControls/Selection/RectangleSelection.cs @@ -66,45 +66,45 @@ public enum SelectionState Active } - protected void DrawRectangle(PointerPoint currentPoint, Point originDragPointShifted) + protected void DrawRectangle(PointerPoint CurrentPoint, Point originDragPointShifted) { // Redraw selection rectangle according to the new point - if (currentPoint.Position.X >= originDragPointShifted.X) + if (CurrentPoint.Position.X >= originDragPointShifted.X) { - if (currentPoint.Position.Y <= originDragPointShifted.Y) + if (CurrentPoint.Position.Y <= originDragPointShifted.Y) { // Pointer was moved up and right Canvas.SetLeft(selectionRectangle, Math.Max(0, originDragPointShifted.X)); - Canvas.SetTop(selectionRectangle, Math.Max(0, currentPoint.Position.Y)); - selectionRectangle.Width = Math.Max(0, currentPoint.Position.X - Math.Max(0, originDragPointShifted.X)); - selectionRectangle.Height = Math.Max(0, originDragPointShifted.Y - Math.Max(0, currentPoint.Position.Y)); + Canvas.SetTop(selectionRectangle, Math.Max(0, CurrentPoint.Position.Y)); + selectionRectangle.Width = Math.Max(0, CurrentPoint.Position.X - Math.Max(0, originDragPointShifted.X)); + selectionRectangle.Height = Math.Max(0, originDragPointShifted.Y - Math.Max(0, CurrentPoint.Position.Y)); } else { // Pointer was moved down and right Canvas.SetLeft(selectionRectangle, Math.Max(0, originDragPointShifted.X)); Canvas.SetTop(selectionRectangle, Math.Max(0, originDragPointShifted.Y)); - selectionRectangle.Width = Math.Max(0, currentPoint.Position.X - Math.Max(0, originDragPointShifted.X)); - selectionRectangle.Height = Math.Max(0, currentPoint.Position.Y - Math.Max(0, originDragPointShifted.Y)); + selectionRectangle.Width = Math.Max(0, CurrentPoint.Position.X - Math.Max(0, originDragPointShifted.X)); + selectionRectangle.Height = Math.Max(0, CurrentPoint.Position.Y - Math.Max(0, originDragPointShifted.Y)); } } else { - if (currentPoint.Position.Y <= originDragPointShifted.Y) + if (CurrentPoint.Position.Y <= originDragPointShifted.Y) { // Pointer was moved up and left - Canvas.SetLeft(selectionRectangle, Math.Max(0, currentPoint.Position.X)); - Canvas.SetTop(selectionRectangle, Math.Max(0, currentPoint.Position.Y)); - selectionRectangle.Width = Math.Max(0, originDragPointShifted.X - Math.Max(0, currentPoint.Position.X)); - selectionRectangle.Height = Math.Max(0, originDragPointShifted.Y - Math.Max(0, currentPoint.Position.Y)); + Canvas.SetLeft(selectionRectangle, Math.Max(0, CurrentPoint.Position.X)); + Canvas.SetTop(selectionRectangle, Math.Max(0, CurrentPoint.Position.Y)); + selectionRectangle.Width = Math.Max(0, originDragPointShifted.X - Math.Max(0, CurrentPoint.Position.X)); + selectionRectangle.Height = Math.Max(0, originDragPointShifted.Y - Math.Max(0, CurrentPoint.Position.Y)); } else { // Pointer was moved down and left - Canvas.SetLeft(selectionRectangle, Math.Max(0, currentPoint.Position.X)); + Canvas.SetLeft(selectionRectangle, Math.Max(0, CurrentPoint.Position.X)); Canvas.SetTop(selectionRectangle, Math.Max(0, originDragPointShifted.Y)); - selectionRectangle.Width = Math.Max(0, originDragPointShifted.X - Math.Max(0, currentPoint.Position.X)); - selectionRectangle.Height = Math.Max(0, currentPoint.Position.Y - Math.Max(0, originDragPointShifted.Y)); + selectionRectangle.Width = Math.Max(0, originDragPointShifted.X - Math.Max(0, CurrentPoint.Position.X)); + selectionRectangle.Height = Math.Max(0, CurrentPoint.Position.Y - Math.Max(0, originDragPointShifted.Y)); } } }