From c29ae5ff56a2608906b31b419cf3da95e7d82f18 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 3 Dec 2017 11:49:34 -0800 Subject: [PATCH] fixup! UI: Ensure tweens always complete. --- ext/native/ui/ui_tween.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ext/native/ui/ui_tween.h b/ext/native/ui/ui_tween.h index 41f061f262..04ba166890 100644 --- a/ext/native/ui/ui_tween.h +++ b/ext/native/ui/ui_tween.h @@ -54,7 +54,7 @@ public: 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 @@ public: 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;