Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/dotnet-format.yaml
Original file line number Diff line number Diff line change
@@ -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
32 changes: 16 additions & 16 deletions Files/UserControls/Selection/RectangleSelection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}
Expand Down