-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
slider - make mouse wheel control sliders #3281
base: master
Are you sure you want to change the base?
Conversation
Hello @phweyland, ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
ImGui::SetItemUsingMouseWheel();
if (ImGui::IsItemHovered())
{
float wheel = ImGui::GetIO().MouseWheel;
if (wheel)
{
if (ImGui::IsItemActive())
{
ImGui::ClearActiveID();
}
else
{
f += wheel;
}
}
} Note that The more difficult question is to come up with a design to make this sort of features available by default in stock sliders. As you can see in the example above, it is currently already possible to do it from "outside" but I agree it would be nice if we add a way to add that support into sliders/drags (now that they have flags it may be possible). Whether it comes as a flag on a per-instance basis or a is more global type of flags would make an important difference and is not an easy question to answer. Among other things we have to design around the idea that dear imgui code can be shared among apps and reused outside of its initial context and that has an effect on design. |
0c1e5bd
to
bb6a60b
Compare
8b83e0a
to
d735066
Compare
b3b85d8
to
0755767
Compare
c817acb
to
8d39063
Compare
ea8c585
to
35802d1
Compare
Hello @ocornut ... sorry for the late answer as well. :) |
vkdt is a project which uses imgui. This a darktable similar project whose the first aim is to be faster. But you probably know.
Trying to help at this I think it would be a great addition to allow the mouse wheel to control the silders.
Adapting the ImGuiInputSource_Nav case to mouse wheel increments gave me interesting results.
However I've seen a first side effect when the window is scrollable. This property not being limited to scrollbar region the window contents moves before the hovered slider. What would be the correct way to fix that, if it could exist ?
If this is something you would agree with, the same principle could be applied for other widgets as well.
Thanks for reading. Your comments, whatever they can be, are welcome.
Philippe