mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 13:33:27 -07:00
Trying out a workaround for the Slack issue, the capture form will be resized back to the desired size.
This commit is contained in:
parent
37b42aaadb
commit
d57fe900e5
1 changed files with 26 additions and 8 deletions
|
@ -153,12 +153,9 @@ namespace Greenshot.Forms
|
|||
|
||||
_currentForm = this;
|
||||
|
||||
// Enable the AnimatingForm
|
||||
EnableAnimation = true;
|
||||
|
||||
// clean up
|
||||
FormClosed += ClosedHandler;
|
||||
|
||||
Resize += CaptureForm_Resize;
|
||||
_capture = capture;
|
||||
_windows = windows;
|
||||
_captureMode = capture.CaptureDetails.CaptureMode;
|
||||
|
@ -171,6 +168,8 @@ namespace Greenshot.Forms
|
|||
DoubleBuffered = !IsTerminalServerSession;
|
||||
Text = @"Greenshot capture form";
|
||||
|
||||
SetSize();
|
||||
|
||||
// Make sure we never capture the capture-form
|
||||
WindowDetails.RegisterIgnoreHandle(Handle);
|
||||
// Un-register at close
|
||||
|
@ -188,9 +187,27 @@ namespace Greenshot.Forms
|
|||
// Set the zoomer animation
|
||||
InitializeZoomer(Conf.ZoomerEnabled);
|
||||
|
||||
Log.DebugFormat("Opening CaptureForm with dimensions {0}", capture.ScreenBounds);
|
||||
// Enable the AnimatingForm
|
||||
EnableAnimation = true;
|
||||
}
|
||||
|
||||
private void CaptureForm_Resize(object sender, EventArgs e)
|
||||
{
|
||||
Log.DebugFormat("Resize was called, new size: {0}", this.Bounds);
|
||||
if (Bounds.Equals(_capture.ScreenBounds))
|
||||
{
|
||||
// We have the correct size
|
||||
return;
|
||||
}
|
||||
// Initiate resize
|
||||
SetSize();
|
||||
}
|
||||
|
||||
private void SetSize()
|
||||
{
|
||||
Log.DebugFormat("Setting CaptureForm with dimensions {0}", _capture.ScreenBounds);
|
||||
SuspendLayout();
|
||||
Bounds = capture.ScreenBounds;
|
||||
Bounds = _capture.ScreenBounds;
|
||||
ResumeLayout();
|
||||
|
||||
// Fix missing focus
|
||||
|
@ -203,15 +220,16 @@ namespace Greenshot.Forms
|
|||
/// </summary>
|
||||
private void InitializeZoomer(bool isOn)
|
||||
{
|
||||
var startingPosition = new Rectangle(_cursorPos, Size.Empty);
|
||||
if (isOn)
|
||||
{
|
||||
// Initialize the zoom with a invalid position
|
||||
_zoomAnimator = new RectangleAnimator(Rectangle.Empty, new Rectangle(int.MaxValue, int.MaxValue, 0, 0), FramesForMillis(1000), EasingType.Quintic, EasingMode.EaseOut);
|
||||
_zoomAnimator = new RectangleAnimator( startingPosition , new Rectangle(int.MaxValue, int.MaxValue, 0, 0), FramesForMillis(1000), EasingType.Quintic, EasingMode.EaseOut);
|
||||
VerifyZoomAnimation(_cursorPos, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_zoomAnimator?.ChangeDestination(new Rectangle(Point.Empty, Size.Empty), FramesForMillis(1000));
|
||||
_zoomAnimator?.ChangeDestination(startingPosition, FramesForMillis(1000));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue