fixed #2435: Added region capture animation option

This commit is contained in:
Jaex 2017-04-17 17:19:23 +03:00
parent df73c45c6e
commit 6cd580f627
3 changed files with 18 additions and 8 deletions

View file

@ -498,18 +498,21 @@ private void Draw(Graphics g)
// Draw animated rectangle on hover area
if (ShapeManager.IsCurrentHoverShapeValid)
{
if (!ShapeManager.PreviousHoverRectangle.IsEmpty && ShapeManager.CurrentHoverShape.Rectangle != ShapeManager.PreviousHoverRectangle)
if (Config.EnableAnimations)
{
regionAnimation.FromRectangle = ShapeManager.PreviousHoverRectangle;
regionAnimation.ToRectangle = ShapeManager.CurrentHoverShape.Rectangle;
regionAnimation.Start();
}
if (!ShapeManager.PreviousHoverRectangle.IsEmpty && ShapeManager.CurrentHoverShape.Rectangle != ShapeManager.PreviousHoverRectangle)
{
regionAnimation.FromRectangle = ShapeManager.PreviousHoverRectangle;
regionAnimation.ToRectangle = ShapeManager.CurrentHoverShape.Rectangle;
regionAnimation.Start();
}
regionAnimation.Update();
regionAnimation.Update();
}
using (GraphicsPath hoverDrawPath = new GraphicsPath { FillMode = FillMode.Winding })
{
if (regionAnimation.IsActive && regionAnimation.CurrentRectangle.Width > 2 && regionAnimation.CurrentRectangle.Height > 2)
if (Config.EnableAnimations && regionAnimation.IsActive && regionAnimation.CurrentRectangle.Width > 2 && regionAnimation.CurrentRectangle.Height > 2)
{
ShapeManager.CurrentHoverShape.OnShapePathRequested(hoverDrawPath, regionAnimation.CurrentRectangle.SizeOffset(-1));
}
@ -588,7 +591,7 @@ private void Draw(Graphics g)
}
// Draw animation under toolbar on startup
if (toolbarAnimation != null && toolbarAnimation2 != null && toolbarAnimation.IsActive)
if (Config.EnableAnimations && toolbarAnimation != null && toolbarAnimation2 != null && toolbarAnimation.IsActive)
{
using (Pen toolbarAnimationPen = new Pen(Color.FromArgb(5, 100, 255), 4))
{

View file

@ -63,6 +63,7 @@ public class RegionCaptureOptions
public int MagnifierPixelCount = 15; // Must be odd number like 11, 13, 15 etc.
public int MagnifierPixelSize = 10;
public bool ShowCrosshair = false;
public bool EnableAnimations = true;
public bool IsFixedSize = false;
public Size FixedSize = new Size(250, 250);
public bool ShowFPS = false;

View file

@ -684,6 +684,12 @@ private void CreateToolbar()
tsmiShowCrosshair.Click += (sender, e) => Config.ShowCrosshair = tsmiShowCrosshair.Checked;
tsddbOptions.DropDownItems.Add(tsmiShowCrosshair);
ToolStripMenuItem tsmiEnableAnimations = new ToolStripMenuItem("Enable animations"); // TODO: Translate
tsmiEnableAnimations.Checked = Config.EnableAnimations;
tsmiEnableAnimations.CheckOnClick = true;
tsmiEnableAnimations.Click += (sender, e) => Config.EnableAnimations = tsmiEnableAnimations.Checked;
tsddbOptions.DropDownItems.Add(tsmiEnableAnimations);
ToolStripMenuItem tsmiFixedSize = new ToolStripMenuItem(Resources.ShapeManager_CreateContextMenu_Fixed_size_region_mode);
tsmiFixedSize.Checked = Config.IsFixedSize;
tsmiFixedSize.CheckOnClick = true;