Permalink
Browse files

UI: Reset transitions after too long a time.

  • Loading branch information...
unknownbrackets committed Dec 10, 2017
1 parent 80a0a89 commit bdac150aab6a3f12914e9843f4d6f847728d1824
Showing with 8 additions and 1 deletion.
  1. +7 −1 ext/native/ui/view.cpp
  2. +1 −0 ext/native/ui/view.h
@@ -270,7 +270,13 @@ Clickable::Clickable(LayoutParams *layoutParams)
void Clickable::DrawBG(UIContext &dc, const Style &style) {
if (style.background.type == DRAW_SOLID_COLOR) {
bgColor_->Divert(style.background.color, down_ ? 0.05f : 0.1f);
if (time_now() - bgColorLast_ >= 0.25f) {
bgColor_->Reset(style.background.color);
} else {
bgColor_->Divert(style.background.color, down_ ? 0.05f : 0.1f);
}
bgColorLast_ = time_now();
dc.FillRect(Drawable(bgColor_->CurrentValue()), bounds_);
} else {
dc.FillRect(style.background, bounds_);
@@ -486,6 +486,7 @@ class Clickable : public View {
void DrawBG(UIContext &dc, const Style &style);
CallbackColorTween *bgColor_ = nullptr;
float bgColorLast_ = 0.0f;
int downCountDown_ = 0;
bool dragging_ = false;
bool down_ = false;

0 comments on commit bdac150

Please sign in to comment.