-
-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SliderWithCallback
component
#938
Add SliderWithCallback
component
#938
Conversation
I wanted to do some actions in real time when the slider value changes, not only update the reference value, so I made a little `SliderWithCallback` component Signed-off-by: Mikołaj Lubiak <lubiak@proton.me>
Example usage: https://github.com/mikolajlubiak/memory/ |
Thanks! This looks like a good thing to have. Could you please extend the current |
Hi, done. I wasn't sure whether to initialize callback to empty lambda or nullptr, but nullptr seemed like a better option to me. What do you think? |
@ArthurSonzogni friendly ping |
Thanks! LGTM.
If anything looks wrong to you, please let me know, and we will maek the appropriate change. |
@@ -127,8 +123,11 @@ class SliderBase : public ComponentBase { | |||
OnUp(); | |||
} | |||
|
|||
SetValue(util::clamp(value_(), min_(), max_())); | |||
if (old_value != value_()) { | |||
this->value() = std::max(this->min(), std::min(this->max(), this->value())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, why use this instead of std::clamp?
To get to the contributors list I would have to make more contributions, right? |
Also would it be cool to add my memory game or media (video/gif/image) into colored, animated or static, ASCII art converter to the projects using FTXUI list or is it for more advanced projects? |
You are in the contributor list: It might take a few hours for the displayed image to be invalidated and the new version to appear.
It would be cool. Do you want to submit another PR adding it? |
Thanks, I made the PR: #946
|
Add SliderOption::on_change. Useful to observe a change to the value. Signed-off-by: Mikołaj Lubiak <lubiak@proton.me> Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
Add SliderOption::on_change. Useful to observe a change to the value. Signed-off-by: Mikołaj Lubiak <lubiak@proton.me> Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
I wanted to do some actions in real time when the slider value changes, not only update the reference value, so I made a little
SliderWithCallback
component