Skip to content

Commit

Permalink
Fix live update
Browse files Browse the repository at this point in the history
  • Loading branch information
iota97 authored and hrydgard committed Feb 18, 2022
1 parent 981f5dd commit b1cf29b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Common/UI/UIScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,9 @@ EventReturn SliderFloatPopupScreen::OnDecrease(EventParams &params) {
sprintf(temp, "%0.3f", sliderValue_);
edit_->SetText(temp);
changing_ = false;
if (liveUpdate_) {
*value_ = sliderValue_;
}
return EVENT_DONE;
}

Expand All @@ -699,6 +702,9 @@ EventReturn SliderFloatPopupScreen::OnIncrease(EventParams &params) {
sprintf(temp, "%0.3f", sliderValue_);
edit_->SetText(temp);
changing_ = false;
if (liveUpdate_) {
*value_ = sliderValue_;
}
return EVENT_DONE;
}

Expand All @@ -718,6 +724,9 @@ EventReturn SliderFloatPopupScreen::OnTextChange(EventParams &params) {
if (!changing_) {
sliderValue_ = atof(edit_->GetText().c_str());
slider_->Clamp();
if (liveUpdate_) {
*value_ = sliderValue_;
}
}
return EVENT_DONE;
}
Expand Down
10 changes: 10 additions & 0 deletions Common/UI/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,11 @@ bool Slider::ApplyKey(int keyCode) {
default:
return false;
}
EventParams params{};
params.v = this;
params.a = (uint32_t)(*value_);
params.f = (float)(*value_);
OnChange.Trigger(params);
return true;
}

Expand Down Expand Up @@ -1457,6 +1462,11 @@ bool SliderFloat::ApplyKey(int keyCode) {
default:
return false;
}
EventParams params{};
params.v = this;
params.a = (uint32_t)(*value_);
params.f = (float)(*value_);
OnChange.Trigger(params);
return true;
}

Expand Down

0 comments on commit b1cf29b

Please sign in to comment.