Fix for a wrong zoomer position.

This commit is contained in:
Robin 2018-06-08 08:01:53 +02:00
commit 81092aeffb

View file

@ -116,8 +116,11 @@ namespace Greenshot.Forms
Text = "Greenshot capture form"; Text = "Greenshot capture form";
// Unregister at close // Log at close
FormClosing += ClosingHandler; if (Log.IsDebugEnabled())
{
FormClosing += (s, e) => Log.Debug().WriteLine("Closing captureform");
}
// set cursor location // set cursor location
_cursorPos = _mouseMovePos = WindowCapture.GetCursorLocationRelativeToScreenBounds(); _cursorPos = _mouseMovePos = WindowCapture.GetCursorLocationRelativeToScreenBounds();
@ -131,9 +134,7 @@ namespace Greenshot.Forms
// Set the zoomer animation // Set the zoomer animation
InitializeZoomer(_coreConfiguration.ZoomerEnabled); InitializeZoomer(_coreConfiguration.ZoomerEnabled);
SuspendLayout();
Bounds = capture.ScreenBounds; Bounds = capture.ScreenBounds;
ResumeLayout();
// Fix missing focus // Fix missing focus
ToFront = true; ToFront = true;
@ -174,11 +175,6 @@ namespace Greenshot.Forms
} }
} }
private void ClosingHandler(object sender, EventArgs e)
{
Log.Debug().WriteLine("Closing captureform");
}
/// <summary> /// <summary>
/// Create an animation for the zoomer, depending on if it's active or not. /// Create an animation for the zoomer, depending on if it's active or not.
/// </summary> /// </summary>
@ -189,8 +185,9 @@ namespace Greenshot.Forms
var screenBounds = DisplayInfo.GetBounds(MousePosition); var screenBounds = DisplayInfo.GetBounds(MousePosition);
var zoomerSize = CalculateZoomSize(screenBounds); var zoomerSize = CalculateZoomSize(screenBounds);
// Initialize the zoom with a invalid position var initialPosition = new NativePoint(20, 20);
_zoomAnimator = new RectangleAnimator(new NativeRect(_cursorPos, NativeSize.Empty), new NativeRect(_cursorPos, zoomerSize), FramesForMillis(1000), EasingTypes.Quintic, EasingModes.EaseOut); // Initialize the zoom with an initial position
_zoomAnimator = new RectangleAnimator(new NativeRect(initialPosition, NativeSize.Empty), new NativeRect(initialPosition, zoomerSize), FramesForMillis(1000), EasingTypes.Quintic, EasingModes.EaseOut);
VerifyZoomAnimation(_cursorPos, false); VerifyZoomAnimation(_cursorPos, false);
} }
else else