From 60560a030fda3c539ff9dc1563b9926414a193da Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini Date: Sat, 21 Jan 2012 19:07:09 +0100 Subject: Imported Upstream version 0.4.0 --- src/utilities/animatedValue.vala | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/utilities/animatedValue.vala') diff --git a/src/utilities/animatedValue.vala b/src/utilities/animatedValue.vala index 32ab889..7acc7a7 100644 --- a/src/utilities/animatedValue.vala +++ b/src/utilities/animatedValue.vala @@ -116,10 +116,16 @@ public class AnimatedValue : GLib.Object { ///////////////////////////////////////////////////////////////////// public void reset_target(double end, double duration) { - this.start = this.val; this.end = end; this.duration = duration; - this.state = 0.0; + this.start = this.val; + + if (duration == 0.0) { + this.val = end; + this.state = 1.0; + } else { + this.state = 0.0; + } } ///////////////////////////////////////////////////////////////////// @@ -129,7 +135,7 @@ public class AnimatedValue : GLib.Object { public void update(double time) { this.state += time/this.duration; - if (state < 1) { + if (this.state < 1) { switch (this.type) { case Type.LINEAR: @@ -152,6 +158,7 @@ public class AnimatedValue : GLib.Object { } break; } + } else if (this.val != this.end) { this.val = this.end; } -- cgit v1.2.3