mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-05 20:54:31 +13:00
Don't store move speed in region capture options
This commit is contained in:
parent
b166fe2ef6
commit
8926d113cc
2 changed files with 15 additions and 23 deletions
|
@ -49,6 +49,7 @@ public class RegionCaptureOptions
|
||||||
new SnapSize(1280, 720), // 720p
|
new SnapSize(1280, 720), // 720p
|
||||||
new SnapSize(1920, 1080) // 1080p
|
new SnapSize(1920, 1080) // 1080p
|
||||||
};
|
};
|
||||||
|
public int SnapDistance = 30;
|
||||||
|
|
||||||
public AnnotationOptions AnnotationOptions = new AnnotationOptions();
|
public AnnotationOptions AnnotationOptions = new AnnotationOptions();
|
||||||
public bool ShowTips = true;
|
public bool ShowTips = true;
|
||||||
|
@ -65,8 +66,5 @@ public class RegionCaptureOptions
|
||||||
public ShapeType LastRegionTool = ShapeType.RegionRectangle;
|
public ShapeType LastRegionTool = ShapeType.RegionRectangle;
|
||||||
public ShapeType LastAnnotationTool = ShapeType.DrawingRectangle;
|
public ShapeType LastAnnotationTool = ShapeType.DrawingRectangle;
|
||||||
public bool ShowMenuTip = true;
|
public bool ShowMenuTip = true;
|
||||||
public int MinMoveSpeed = 1;
|
|
||||||
public int MaxMoveSpeed = 10;
|
|
||||||
public int SnapDistance = 20;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -32,6 +32,9 @@ namespace ShareX.ScreenCaptureLib
|
||||||
{
|
{
|
||||||
public class ResizeManager
|
public class ResizeManager
|
||||||
{
|
{
|
||||||
|
public const int MinMoveSpeed = 1;
|
||||||
|
public const int MaxMoveSpeed = 10;
|
||||||
|
|
||||||
private bool visible;
|
private bool visible;
|
||||||
|
|
||||||
public bool Visible
|
public bool Visible
|
||||||
|
@ -76,26 +79,17 @@ public bool Visible
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsResizing { get; private set; }
|
public bool IsResizing { get; private set; }
|
||||||
public int MaxMoveSpeed { get; set; }
|
|
||||||
public int MinMoveSpeed { get; set; }
|
|
||||||
public bool IsBottomRightResizing { get; set; }
|
public bool IsBottomRightResizing { get; set; }
|
||||||
|
|
||||||
private bool IsUpPressed { get; set; }
|
|
||||||
private bool IsDownPressed { get; set; }
|
|
||||||
private bool IsLeftPressed { get; set; }
|
|
||||||
private bool IsRightPressed { get; set; }
|
|
||||||
|
|
||||||
private ShapeManager shapeManager;
|
private ShapeManager shapeManager;
|
||||||
private NodeObject[] nodes;
|
private NodeObject[] nodes;
|
||||||
|
private bool isUpPressed, isDownPressed, isLeftPressed, isRightPressed;
|
||||||
private Rectangle tempRect;
|
private Rectangle tempRect;
|
||||||
|
|
||||||
public ResizeManager(BaseRegionForm form, ShapeManager shapeManager)
|
public ResizeManager(BaseRegionForm form, ShapeManager shapeManager)
|
||||||
{
|
{
|
||||||
this.shapeManager = shapeManager;
|
this.shapeManager = shapeManager;
|
||||||
|
|
||||||
MinMoveSpeed = form.Config.MinMoveSpeed;
|
|
||||||
MaxMoveSpeed = form.Config.MaxMoveSpeed;
|
|
||||||
|
|
||||||
form.KeyDown += form_KeyDown;
|
form.KeyDown += form_KeyDown;
|
||||||
form.KeyUp += form_KeyUp;
|
form.KeyUp += form_KeyUp;
|
||||||
|
|
||||||
|
@ -202,16 +196,16 @@ private void form_KeyDown(object sender, KeyEventArgs e)
|
||||||
switch (e.KeyCode)
|
switch (e.KeyCode)
|
||||||
{
|
{
|
||||||
case Keys.Up:
|
case Keys.Up:
|
||||||
IsUpPressed = true;
|
isUpPressed = true;
|
||||||
break;
|
break;
|
||||||
case Keys.Down:
|
case Keys.Down:
|
||||||
IsDownPressed = true;
|
isDownPressed = true;
|
||||||
break;
|
break;
|
||||||
case Keys.Left:
|
case Keys.Left:
|
||||||
IsLeftPressed = true;
|
isLeftPressed = true;
|
||||||
break;
|
break;
|
||||||
case Keys.Right:
|
case Keys.Right:
|
||||||
IsRightPressed = true;
|
isRightPressed = true;
|
||||||
break;
|
break;
|
||||||
case Keys.Menu:
|
case Keys.Menu:
|
||||||
IsBottomRightResizing = true;
|
IsBottomRightResizing = true;
|
||||||
|
@ -220,8 +214,8 @@ private void form_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
|
||||||
// Calculate cursor movement
|
// Calculate cursor movement
|
||||||
int speed = e.Shift ? MaxMoveSpeed : MinMoveSpeed;
|
int speed = e.Shift ? MaxMoveSpeed : MinMoveSpeed;
|
||||||
int y = IsUpPressed && IsDownPressed ? 0 : IsDownPressed ? speed : IsUpPressed ? -speed : 0;
|
int y = isUpPressed && isDownPressed ? 0 : isDownPressed ? speed : isUpPressed ? -speed : 0;
|
||||||
int x = IsLeftPressed && IsRightPressed ? 0 : IsRightPressed ? speed : IsLeftPressed ? -speed : 0;
|
int x = isLeftPressed && isRightPressed ? 0 : isRightPressed ? speed : isLeftPressed ? -speed : 0;
|
||||||
|
|
||||||
// Move the cursor
|
// Move the cursor
|
||||||
if (shapeManager.CurrentShape == null || shapeManager.IsCreating)
|
if (shapeManager.CurrentShape == null || shapeManager.IsCreating)
|
||||||
|
@ -246,16 +240,16 @@ private void form_KeyUp(object sender, KeyEventArgs e)
|
||||||
switch (e.KeyCode)
|
switch (e.KeyCode)
|
||||||
{
|
{
|
||||||
case Keys.Up:
|
case Keys.Up:
|
||||||
IsUpPressed = false;
|
isUpPressed = false;
|
||||||
break;
|
break;
|
||||||
case Keys.Down:
|
case Keys.Down:
|
||||||
IsDownPressed = false;
|
isDownPressed = false;
|
||||||
break;
|
break;
|
||||||
case Keys.Left:
|
case Keys.Left:
|
||||||
IsLeftPressed = false;
|
isLeftPressed = false;
|
||||||
break;
|
break;
|
||||||
case Keys.Right:
|
case Keys.Right:
|
||||||
IsRightPressed = false;
|
isRightPressed = false;
|
||||||
break;
|
break;
|
||||||
case Keys.Menu:
|
case Keys.Menu:
|
||||||
IsBottomRightResizing = false;
|
IsBottomRightResizing = false;
|
||||||
|
|
Loading…
Reference in a new issue