mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-03 02:36:50 +13:00
Merge pull request #2875 from L1Q/windowed-annotate
Fix floating errors when resize panning
This commit is contained in:
commit
3e9d67dc7a
1 changed files with 10 additions and 5 deletions
|
@ -57,7 +57,8 @@ public sealed class RegionCaptureForm : Form
|
|||
public bool IsAnnotated => ShapeManager != null && ShapeManager.IsAnnotated;
|
||||
|
||||
public Point CurrentPosition { get; private set; }
|
||||
public Size OldSize;
|
||||
private Size oldSize;
|
||||
private Vector2 panError = new Vector2(0f, 0f);
|
||||
|
||||
public Color CurrentColor
|
||||
{
|
||||
|
@ -106,7 +107,7 @@ public RegionCaptureForm(RegionCaptureMode mode)
|
|||
Mode = mode;
|
||||
|
||||
ScreenRectangle0Based = CaptureHelpers.GetScreenBounds0Based();
|
||||
OldSize = ScreenRectangle0Based.Size;
|
||||
oldSize = ScreenRectangle0Based.Size;
|
||||
ImageRectangle = ScreenRectangle0Based;
|
||||
|
||||
InitializeComponent();
|
||||
|
@ -302,16 +303,20 @@ private void OnMoved()
|
|||
private void UpdatePan()
|
||||
{
|
||||
Size NewSize = ScreenRectangle0Based.Size;
|
||||
if (OldSize == NewSize)
|
||||
if (oldSize == NewSize)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Point ResizeDelta = new Point((NewSize.Width - OldSize.Width) / 2, (NewSize.Height - OldSize.Height) / 2);
|
||||
panError += new Vector2((float)(NewSize.Width - oldSize.Width) / 2, (float)(NewSize.Height - oldSize.Height) / 2);
|
||||
Point ResizeDelta = new Point((int)panError.X, (int)panError.Y);
|
||||
|
||||
panError.X %= 1;
|
||||
panError.Y %= 1;
|
||||
|
||||
Pan(ResizeDelta);
|
||||
|
||||
OldSize = ScreenRectangle0Based.Size;
|
||||
oldSize = ScreenRectangle0Based.Size;
|
||||
}
|
||||
|
||||
public void SetDefaultCursor()
|
||||
|
|
Loading…
Reference in a new issue