mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-07 07:26:05 +12:00
Merge remote-tracking branch 'remotes/upstream/master'
This commit is contained in:
commit
a1039ee6de
|
@ -75,6 +75,7 @@ public class AnnotationOptions
|
||||||
|
|
||||||
// Image drawing
|
// Image drawing
|
||||||
public ImageEditorInterpolationMode ImageInterpolationMode = ImageEditorInterpolationMode.NearestNeighbor;
|
public ImageEditorInterpolationMode ImageInterpolationMode = ImageEditorInterpolationMode.NearestNeighbor;
|
||||||
|
public string LastImageFilePath { get; set; }
|
||||||
|
|
||||||
// Step drawing
|
// Step drawing
|
||||||
public Color StepBorderColor { get; set; } = SecondaryColor;
|
public Color StepBorderColor { get; set; } = SecondaryColor;
|
||||||
|
@ -87,7 +88,7 @@ public class AnnotationOptions
|
||||||
public List<StickerPackInfo> StickerPacks = new List<StickerPackInfo>();
|
public List<StickerPackInfo> StickerPacks = new List<StickerPackInfo>();
|
||||||
public int SelectedStickerPack = 0;
|
public int SelectedStickerPack = 0;
|
||||||
public int StickerSize { get; set; } = 64;
|
public int StickerSize { get; set; } = 64;
|
||||||
public bool StickerQuickMode { get; set; } = false;
|
public string LastStickerPath { get; set; }
|
||||||
|
|
||||||
// Blur effect
|
// Blur effect
|
||||||
public int BlurRadius { get; set; } = 15;
|
public int BlurRadius { get; set; } = 15;
|
||||||
|
|
|
@ -35,15 +35,20 @@ public override void OnCreating()
|
||||||
Point pos = InputManager.ClientMousePosition;
|
Point pos = InputManager.ClientMousePosition;
|
||||||
Rectangle = new Rectangle(pos.X, pos.Y, 1, 1);
|
Rectangle = new Rectangle(pos.X, pos.Y, 1, 1);
|
||||||
|
|
||||||
if (!OpenImageDialog(true))
|
if (Manager.IsCornerMoving && LoadImageFile(AnnotationOptions.LastImageFilePath, true))
|
||||||
{
|
{
|
||||||
Remove();
|
OnCreated();
|
||||||
|
Manager.IsMoving = true;
|
||||||
}
|
}
|
||||||
else
|
else if (OpenImageDialog(true))
|
||||||
{
|
{
|
||||||
OnCreated();
|
OnCreated();
|
||||||
ShowNodes();
|
ShowNodes();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnDoubleClicked()
|
public override void OnDoubleClicked()
|
||||||
|
@ -54,15 +59,20 @@ public override void OnDoubleClicked()
|
||||||
private bool OpenImageDialog(bool centerImage)
|
private bool OpenImageDialog(bool centerImage)
|
||||||
{
|
{
|
||||||
Manager.IsMoving = false;
|
Manager.IsMoving = false;
|
||||||
|
|
||||||
string filepath = ImageHelpers.OpenImageFileDialog(Manager.Form);
|
string filepath = ImageHelpers.OpenImageFileDialog(Manager.Form);
|
||||||
|
return LoadImageFile(filepath, centerImage);
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(filepath))
|
private bool LoadImageFile(string filePath, bool centerImage)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(filePath))
|
||||||
{
|
{
|
||||||
Image img = ImageHelpers.LoadImage(filepath);
|
Image img = ImageHelpers.LoadImage(filePath);
|
||||||
|
|
||||||
if (img != null)
|
if (img != null)
|
||||||
{
|
{
|
||||||
|
AnnotationOptions.LastImageFilePath = filePath;
|
||||||
|
|
||||||
SetImage(img, centerImage);
|
SetImage(img, centerImage);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -50,7 +50,37 @@ public override void ShowNodes()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenStickerForm(bool creating)
|
public override void OnCreating()
|
||||||
|
{
|
||||||
|
Point pos = InputManager.ClientMousePosition;
|
||||||
|
Rectangle = new Rectangle(pos.X, pos.Y, 1, 1);
|
||||||
|
|
||||||
|
if (Manager.IsCornerMoving && LoadSticker(AnnotationOptions.LastStickerPath, AnnotationOptions.StickerSize))
|
||||||
|
{
|
||||||
|
OnCreated();
|
||||||
|
Manager.IsMoving = true;
|
||||||
|
}
|
||||||
|
else if (OpenStickerForm())
|
||||||
|
{
|
||||||
|
OnCreated();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnDoubleClicked()
|
||||||
|
{
|
||||||
|
OpenStickerForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Resize(int x, int y, bool fromBottomRight)
|
||||||
|
{
|
||||||
|
Move(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool OpenStickerForm()
|
||||||
{
|
{
|
||||||
Manager.Form.Pause();
|
Manager.Form.Pause();
|
||||||
|
|
||||||
|
@ -63,27 +93,16 @@ private void OpenStickerForm(bool creating)
|
||||||
AnnotationOptions.SelectedStickerPack = stickerForm.SelectedStickerPack;
|
AnnotationOptions.SelectedStickerPack = stickerForm.SelectedStickerPack;
|
||||||
AnnotationOptions.StickerSize = stickerForm.StickerSize;
|
AnnotationOptions.StickerSize = stickerForm.StickerSize;
|
||||||
|
|
||||||
if (LoadSticker(stickerForm.SelectedImageFile, stickerForm.StickerSize))
|
return LoadSticker(stickerForm.SelectedImageFile, stickerForm.StickerSize);
|
||||||
{
|
|
||||||
if (creating)
|
|
||||||
{
|
|
||||||
OnCreated();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (creating)
|
|
||||||
{
|
|
||||||
Remove();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Manager.Form.Resume();
|
Manager.Form.Resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool LoadSticker(string filePath, int stickerSize)
|
private bool LoadSticker(string filePath, int stickerSize)
|
||||||
|
@ -94,7 +113,7 @@ private bool LoadSticker(string filePath, int stickerSize)
|
||||||
|
|
||||||
if (img != null)
|
if (img != null)
|
||||||
{
|
{
|
||||||
Manager.LastStickerPath = filePath;
|
AnnotationOptions.LastStickerPath = filePath;
|
||||||
|
|
||||||
img = ImageHelpers.ResizeImageLimit(img, stickerSize);
|
img = ImageHelpers.ResizeImageLimit(img, stickerSize);
|
||||||
|
|
||||||
|
@ -106,31 +125,5 @@ private bool LoadSticker(string filePath, int stickerSize)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnCreating()
|
|
||||||
{
|
|
||||||
Point pos = InputManager.ClientMousePosition;
|
|
||||||
Rectangle = new Rectangle(pos.X, pos.Y, 1, 1);
|
|
||||||
|
|
||||||
if (AnnotationOptions.StickerQuickMode && LoadSticker(Manager.LastStickerPath, AnnotationOptions.StickerSize))
|
|
||||||
{
|
|
||||||
OnCreated();
|
|
||||||
Manager.IsMoving = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OpenStickerForm(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnDoubleClicked()
|
|
||||||
{
|
|
||||||
OpenStickerForm(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Resize(int x, int y, bool fromBottomRight)
|
|
||||||
{
|
|
||||||
Move(x, y);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -157,8 +157,11 @@ private set
|
||||||
public bool IsMoving { get; set; }
|
public bool IsMoving { get; set; }
|
||||||
public bool IsPanning { get; set; }
|
public bool IsPanning { get; set; }
|
||||||
public bool IsResizing { get; set; }
|
public bool IsResizing { get; set; }
|
||||||
|
// Is holding Ctrl?
|
||||||
public bool IsCornerMoving { get; private set; }
|
public bool IsCornerMoving { get; private set; }
|
||||||
|
// Is holding Shift?
|
||||||
public bool IsProportionalResizing { get; private set; }
|
public bool IsProportionalResizing { get; private set; }
|
||||||
|
// Is holding Alt?
|
||||||
public bool IsSnapResizing { get; private set; }
|
public bool IsSnapResizing { get; private set; }
|
||||||
public bool IsRenderingOutput { get; private set; }
|
public bool IsRenderingOutput { get; private set; }
|
||||||
|
|
||||||
|
@ -217,7 +220,6 @@ public bool NodesVisible
|
||||||
public event Action<BaseShape> ShapeCreated;
|
public event Action<BaseShape> ShapeCreated;
|
||||||
|
|
||||||
internal RegionCaptureForm Form { get; private set; }
|
internal RegionCaptureForm Form { get; private set; }
|
||||||
internal string LastStickerPath { get; set; }
|
|
||||||
|
|
||||||
private bool isLeftPressed, isRightPressed, isUpPressed, isDownPressed;
|
private bool isLeftPressed, isRightPressed, isUpPressed, isDownPressed;
|
||||||
|
|
||||||
|
@ -1044,6 +1046,7 @@ private BaseShape CheckHover()
|
||||||
case ShapeType.DrawingSpeechBalloon:
|
case ShapeType.DrawingSpeechBalloon:
|
||||||
case ShapeType.DrawingStep:
|
case ShapeType.DrawingStep:
|
||||||
case ShapeType.DrawingImage:
|
case ShapeType.DrawingImage:
|
||||||
|
case ShapeType.DrawingSticker:
|
||||||
case ShapeType.DrawingCursor:
|
case ShapeType.DrawingCursor:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue