mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 17:56:51 +13:00
Factor out the affected area display rectangle for CutOutTool visual
This commit is contained in:
parent
74a16fd317
commit
888db53d83
1 changed files with 17 additions and 8 deletions
|
@ -49,6 +49,22 @@ public override bool IsValidShape {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RectangleF CutOutRectangle
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (IsHorizontalTrim)
|
||||||
|
{
|
||||||
|
return new RectangleF(Rectangle.X, Manager.Form.CanvasRectangle.Y, Rectangle.Width, Manager.Form.CanvasRectangle.Height);
|
||||||
|
}
|
||||||
|
if (IsVerticalTrim)
|
||||||
|
{
|
||||||
|
return new RectangleF(Manager.Form.CanvasRectangle.X, Rectangle.Y, Manager.Form.CanvasRectangle.Width, Rectangle.Height);
|
||||||
|
}
|
||||||
|
return RectangleF.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ImageEditorButton confirmButton, cancelButton;
|
private ImageEditorButton confirmButton, cancelButton;
|
||||||
private Size buttonSize = new Size(80, 40);
|
private Size buttonSize = new Size(80, 40);
|
||||||
private int buttonOffset = 15;
|
private int buttonOffset = 15;
|
||||||
|
@ -121,14 +137,7 @@ public override void OnDraw(Graphics g)
|
||||||
using (Image selectionHighlightPattern = ImageHelpers.CreateCheckerPattern(8, 8, Color.FromArgb(128, Color.White), Color.FromArgb(128, Color.Gray)))
|
using (Image selectionHighlightPattern = ImageHelpers.CreateCheckerPattern(8, 8, Color.FromArgb(128, Color.White), Color.FromArgb(128, Color.Gray)))
|
||||||
using (Brush selectionHighlightBrush = new TextureBrush(selectionHighlightPattern, System.Drawing.Drawing2D.WrapMode.Tile))
|
using (Brush selectionHighlightBrush = new TextureBrush(selectionHighlightPattern, System.Drawing.Drawing2D.WrapMode.Tile))
|
||||||
{
|
{
|
||||||
if (IsHorizontalTrim)
|
g.FillRectangle(selectionHighlightBrush, CutOutRectangle);
|
||||||
{
|
|
||||||
g.FillRectangle(selectionHighlightBrush, new RectangleF(Rectangle.X, Math.Max(g.ClipBounds.Y, Manager.Form.CanvasRectangle.Y), Rectangle.Width, Math.Min(g.ClipBounds.Height, Manager.Form.CanvasRectangle.Height)));
|
|
||||||
}
|
|
||||||
else if (IsVerticalTrim)
|
|
||||||
{
|
|
||||||
g.FillRectangle(selectionHighlightBrush, new RectangleF(Math.Max(g.ClipBounds.X, Manager.Form.CanvasRectangle.X), Rectangle.Y, Math.Min(g.ClipBounds.Width, Manager.Form.CanvasRectangle.Width), Rectangle.Height));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue