When drawing freehand region you can hold "Shift" to draw direct lines which will act like polygon region
This commit is contained in:
parent
efa8704879
commit
1315f47340
@ -526,5 +526,24 @@ namespace ShareX.HelpersLib
|
||||
{
|
||||
return Rectangle.Union(rect, new Rectangle(point, new Size(1, 1)));
|
||||
}
|
||||
|
||||
public static Rectangle CreateRectangle(this IEnumerable<Point> points)
|
||||
{
|
||||
Rectangle result = Rectangle.Empty;
|
||||
|
||||
foreach (Point point in points)
|
||||
{
|
||||
if (result.IsEmpty)
|
||||
{
|
||||
result = new Rectangle(point, new Size(1, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = result.AddPoint(point);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
@ -42,12 +42,18 @@ namespace ShareX.ScreenCaptureLib
|
||||
{
|
||||
if (Manager.IsCreating)
|
||||
{
|
||||
if (points.Count == 0 || points.Last() != InputManager.MousePosition0Based)
|
||||
Point pos = InputManager.MousePosition0Based;
|
||||
|
||||
if (points.Count == 0 || (!Manager.IsProportionalResizing && points.Last() != pos))
|
||||
{
|
||||
Point point = InputManager.MousePosition0Based;
|
||||
points.Add(point);
|
||||
Rectangle = Rectangle.AddPoint(point);
|
||||
points.Add(pos);
|
||||
}
|
||||
else if (Manager.IsProportionalResizing)
|
||||
{
|
||||
points[points.Count - 1] = InputManager.MousePosition0Based;
|
||||
}
|
||||
|
||||
Rectangle = points.CreateRectangle();
|
||||
}
|
||||
else if (Manager.IsMoving)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user