mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 21:13:23 -07:00
Changes for the animation after discussions with Thomas. Mainly that the animation of the interactive capture STARTS from the Mouse-Cursor outwards.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2348 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
03cba68f61
commit
672590cd3b
2 changed files with 45 additions and 26 deletions
|
@ -448,7 +448,7 @@ namespace Greenshot.Forms {
|
|||
if (captureMode == CaptureMode.Window) {
|
||||
// Using a 50 Pixel offset to the left, top, to make sure the text is invalidated too
|
||||
const int SAFETY_SIZE = 25;
|
||||
if (windowAnimator.hasNext) {
|
||||
if (windowAnimator != null && windowAnimator.hasNext) {
|
||||
Rectangle invalidateRectangle = windowAnimator.Current;
|
||||
invalidateRectangle.Inflate(SAFETY_SIZE, SAFETY_SIZE);
|
||||
Invalidate(invalidateRectangle);
|
||||
|
@ -458,7 +458,11 @@ namespace Greenshot.Forms {
|
|||
}
|
||||
if (selectedCaptureWindow != null && !selectedCaptureWindow.Equals(lastWindow)) {
|
||||
// Window changes, make new animation from current to target
|
||||
windowAnimator.ChangeDestination(captureRect, 14);
|
||||
if (windowAnimator.Last.Size == Size.Empty) {
|
||||
windowAnimator = new RectangleAnimator(new Rectangle(cursorPos, Size.Empty), captureRect, 10, EasingType.Quintic, EasingMode.EaseOut);
|
||||
} else {
|
||||
windowAnimator.ChangeDestination(captureRect, 10);
|
||||
}
|
||||
Rectangle invalidateRectangle = new Rectangle(lastCaptureRect.Location, lastCaptureRect.Size);
|
||||
invalidateRectangle.Inflate(SAFETY_SIZE, SAFETY_SIZE);
|
||||
Invalidate(invalidateRectangle);
|
||||
|
@ -518,7 +522,7 @@ namespace Greenshot.Forms {
|
|||
screenBounds.Location = WindowCapture.GetLocationRelativeToScreenBounds(screenBounds.Location);
|
||||
|
||||
|
||||
Rectangle targetRectangle = zoomAnimator.Last;
|
||||
Rectangle targetRectangle = zoomAnimator.Final;
|
||||
targetRectangle.Offset(pos);
|
||||
if (screenBounds.Contains(targetRectangle)) {
|
||||
// All okay
|
||||
|
@ -538,8 +542,10 @@ namespace Greenshot.Forms {
|
|||
} else {
|
||||
destinationLocation = new Point(-zoomOffset.X - zoomSize.Width, -zoomOffset.Y - zoomSize.Width);
|
||||
}
|
||||
zoomAnimator.ChangeDestination(new Rectangle(new Point(-10, -10), new Size(20, 20)));
|
||||
zoomAnimator.QueueDestination(new Rectangle(destinationLocation, zoomSize));
|
||||
// Change animation to destination "small with the mouse-cursor at the center"
|
||||
//zoomAnimator.ChangeDestination(new Rectangle(new Point(-10, -10), new Size(20, 20)));
|
||||
//zoomAnimator.QueueDestinationLeg(new Rectangle(destinationLocation, zoomSize));
|
||||
zoomAnimator.ChangeDestination(new Rectangle(destinationLocation, zoomSize));
|
||||
ret = zoomAnimator.Next();
|
||||
}
|
||||
return ret;
|
||||
|
|
|
@ -37,6 +37,23 @@ namespace Greenshot.Helpers {
|
|||
protected double frames;
|
||||
protected double currentFrame = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="first"></param>
|
||||
/// <param name="last"></param>
|
||||
/// <param name="frames"></param>
|
||||
/// <param name="easingType"></param>
|
||||
/// <param name="easingMode"></param>
|
||||
public AnimatorBase(T first, T last, int frames, EasingType easingType, EasingMode easingMode) {
|
||||
this.first = first;
|
||||
this.last = last;
|
||||
this.frames = frames;
|
||||
this.current = first;
|
||||
this.EasingType = easingType;
|
||||
this.EasingMode = easingMode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The amount of frames
|
||||
/// </summary>
|
||||
|
@ -59,12 +76,24 @@ namespace Greenshot.Helpers {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Last animation value
|
||||
/// Last animation value, of this "leg"
|
||||
/// </summary>
|
||||
public T Last {
|
||||
get { return last; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Final animation value, this is including the legs
|
||||
/// </summary>
|
||||
public T Final {
|
||||
get {
|
||||
if (queue.Count == 0) {
|
||||
return last;
|
||||
}
|
||||
return queue.ToArray()[queue.Count - 1];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This restarts the current animation and changes the last frame
|
||||
/// </summary>
|
||||
|
@ -83,13 +112,14 @@ namespace Greenshot.Helpers {
|
|||
this.currentFrame = 0;
|
||||
this.frames = frames;
|
||||
this.last = newDestination;
|
||||
queue.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Queue the destination, it will be used after the current animation is finished
|
||||
/// </summary>
|
||||
/// <param name="queuedDestination"></param>
|
||||
public void QueueDestination(T queuedDestination) {
|
||||
public void QueueDestinationLeg(T queuedDestination) {
|
||||
queue.Enqueue(queuedDestination);
|
||||
}
|
||||
|
||||
|
@ -126,23 +156,6 @@ namespace Greenshot.Helpers {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="first"></param>
|
||||
/// <param name="last"></param>
|
||||
/// <param name="frames"></param>
|
||||
/// <param name="easingType"></param>
|
||||
/// <param name="easingMode"></param>
|
||||
public AnimatorBase(T first, T last, int frames, EasingType easingType, EasingMode easingMode) {
|
||||
this.first = first;
|
||||
this.last = last;
|
||||
this.frames = frames;
|
||||
this.current = first;
|
||||
this.EasingType = easingType;
|
||||
this.EasingMode = easingMode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the current (previous) frame object
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue