diff --git a/Greenshot/Forms/CaptureForm.cs b/Greenshot/Forms/CaptureForm.cs index 4b691352e..d08faf2f8 100644 --- a/Greenshot/Forms/CaptureForm.cs +++ b/Greenshot/Forms/CaptureForm.cs @@ -550,7 +550,8 @@ namespace Greenshot.Forms { } else { destinationLocation = new Point(-zoomOffset.X - zoomSize.Width, -zoomOffset.Y - zoomSize.Width); } - zoomAnimator.ChangeDestination(new Rectangle(destinationLocation, zoomSize)); + zoomAnimator.ChangeDestination(new Rectangle(new Point(-10, -10), new Size(20, 20))); + zoomAnimator.QueueDestination(new Rectangle(destinationLocation, zoomSize)); return zoomAnimator.Next(); } diff --git a/Greenshot/Helpers/AnimationHelper.cs b/Greenshot/Helpers/AnimationHelper.cs index 3a6796026..89a5bba1d 100644 --- a/Greenshot/Helpers/AnimationHelper.cs +++ b/Greenshot/Helpers/AnimationHelper.cs @@ -21,7 +21,8 @@ using System; using System.Drawing; using System.Drawing.Drawing2D; - +using System.Collections.Generic; + namespace Greenshot.Helpers { /// /// Base class for the animation logic, this only implements Properties and a constructor @@ -32,6 +33,7 @@ namespace Greenshot.Helpers { protected T first; protected T last; protected T current; + protected Queue queue = new Queue(); protected double frames; protected double currentFrame = 0; @@ -54,6 +56,10 @@ namespace Greenshot.Helpers { public void ChangeDestination(T last) { ChangeDestination(last, frames); } + + public void QueueDestination(T queuedDestination) { + queue.Enqueue(queuedDestination); + } public void ChangeDestination(T last, double frames) { this.first = current; @@ -105,9 +111,28 @@ namespace Greenshot.Helpers { } } + public virtual bool NextFrame { + get { + if (currentFrame < frames) { + currentFrame++; + return true; + } + if (queue.Count > 0) { + this.first = current; + this.last = queue.Dequeue(); + this.currentFrame = 0; + return true; + } + return false; + } + } + public virtual bool hasNext { get { - return currentFrame < frames; + if (currentFrame < frames) { + return true; + } + return queue.Count > 0; } } @@ -132,9 +157,7 @@ namespace Greenshot.Helpers { } public override Rectangle Next() { - if (hasNext) { - currentFrame++; - + if (NextFrame) { double easingValue = EasingValue; double dx = last.X - first.X; double dy = last.Y - first.Y; @@ -166,9 +189,7 @@ namespace Greenshot.Helpers { : base(first, last, frames, easingType, easingMode) { } public override Point Next() { - if (hasNext) { - currentFrame++; - + if (NextFrame) { double easingValue = EasingValue; double dx = last.X - first.X; double dy = last.Y - first.Y; @@ -197,9 +218,7 @@ namespace Greenshot.Helpers { } public override Size Next() { - if (hasNext) { - currentFrame++; - + if (NextFrame) { double easingValue = EasingValue; double dw = last.Width - first.Width; double dh = last.Height - first.Height;