Fix live update

This commit is contained in:
iota97 2022-02-11 19:13:44 +01:00 committed by Henrik Rydgård
parent 981f5dd634
commit b1cf29bb38
2 changed files with 19 additions and 0 deletions

View file

@ -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;
}
@ -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;
}
@ -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;
}

View file

@ -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;
}