From b1cf29bb381d2b5eaed411307a227a8ce67561bd Mon Sep 17 00:00:00 2001 From: iota97 Date: Fri, 11 Feb 2022 19:13:44 +0100 Subject: [PATCH] Fix live update --- Common/UI/UIScreen.cpp | 9 +++++++++ Common/UI/View.cpp | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/Common/UI/UIScreen.cpp b/Common/UI/UIScreen.cpp index 03d4215caf..e296f88554 100644 --- a/Common/UI/UIScreen.cpp +++ b/Common/UI/UIScreen.cpp @@ -685,6 +685,9 @@ EventReturn SliderFloatPopupScreen::OnDecrease(EventParams ¶ms) { sprintf(temp, "%0.3f", sliderValue_); edit_->SetText(temp); changing_ = false; + if (liveUpdate_) { + *value_ = sliderValue_; + } return EVENT_DONE; } @@ -699,6 +702,9 @@ EventReturn SliderFloatPopupScreen::OnIncrease(EventParams ¶ms) { sprintf(temp, "%0.3f", sliderValue_); edit_->SetText(temp); changing_ = false; + if (liveUpdate_) { + *value_ = sliderValue_; + } return EVENT_DONE; } @@ -718,6 +724,9 @@ EventReturn SliderFloatPopupScreen::OnTextChange(EventParams ¶ms) { if (!changing_) { sliderValue_ = atof(edit_->GetText().c_str()); slider_->Clamp(); + if (liveUpdate_) { + *value_ = sliderValue_; + } } return EVENT_DONE; } diff --git a/Common/UI/View.cpp b/Common/UI/View.cpp index 9df5e38286..5dd2a5786b 100644 --- a/Common/UI/View.cpp +++ b/Common/UI/View.cpp @@ -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; } @@ -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; }