Permalink
Browse files

fixup! UI: Ensure tweens always complete.

  • Loading branch information...
unknownbrackets committed Dec 3, 2017
1 parent 9f000dd commit c29ae5ff56a2608906b31b419cf3da95e7d82f18
Showing with 11 additions and 1 deletion.
  1. +11 −1 ext/native/ui/ui_tween.h
View
@@ -54,7 +54,7 @@ class TweenBase: public Tween {
const Value newFrom = Current(Position());
// Are we already part way through another transition?
if (!Finished()) {
if (time_now() < start_ + duration_) {
if (newTo == to_) {
// Already on course. Don't change.
} else if (newTo == from_) {
@@ -92,6 +92,16 @@ class TweenBase: public Tween {
to_ = newFrom;
}
const Value &FromValue() const {
return from_;
}
const Value &ToValue() const {
return to_;
}
Value CurrentValue() {
return Current(Position());
}
protected:
virtual Value Current(float pos) = 0;

0 comments on commit c29ae5f

Please sign in to comment.