-
Notifications
You must be signed in to change notification settings - Fork 181
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
Mouse scrolling not working #228
Comments
What is the window management API that you use (glfw, pyglet, sdl2, etc )? Did you correctly map the scrolling event to imgui I am only able to check it on Windows 10 but have you a code example that reproduces your problem? |
I'm using Pyglet, and I did not know I had to link the mouse wheel events? The docs don't have anything on this. |
Normally, if you use the proposed integration in def on_mouse_scroll(self, x, y, mods, scroll):
self.io.mouse_wheel = scroll In pyglet documentation (latest release) I can see that they suggest to use: def on_mouse_scroll(x, y, scroll_x, scroll_y):
pass I don't know if your problem might somehow link to this. As I understand it the vertical scroll def on_mouse_scroll(self, x, y, scroll_x, scroll_y):
self.io.mouse_wheel_horizontal = scroll_x
self.io.mouse_wheel = scroll_y I'll create a push request for this but I would prefer that we found the origin of your problem before in order to not forget anything important. Can you confirm that the implementation code that you have looks like what I have shown here please? Could you test that callbacks are correctly called with reasonable values? Is it possible for you to test it on another machine to check that the same problem reproduces? (Note: the implementation code is in |
The integration file has this in it: def on_mouse_scroll(self, x, y, mods, scroll):
self.io.mouse_wheel = scroll Which seems wrong to me? I can however verify that when I print scroll by editing the integration file, I do get values when scrolling. But the actual ImGui windows are not being scrolled. I've also noticed that there's a print in I'd also like to go through the whole integration of pyglet and "clean it up" if that's ok. Because I've never really looked into that file and I can see a lot of very old code, such as the |
Mmh, I think it would be a problem with imgui if the correct data is passed through Concerning the You are more than welcome to propose a cleanup version of pyglet integration code. I don't think that it has been updated for a long time and I don't know that anybody has planned to do it. Thanks for your help! |
Sorry for the double post but it quickly crossed my mind that IO should be cleared after a call to EDIT: Dear Imgui automatically call |
You might be on to something! I'll try to dig into the code a little deeper and try and understand how it all works. The way it's set up now in the integration file is like you say, it's doing it whenever a pyglet event is triggered. So I guess the integration should cache it and send it over once Also worth noting that mouse presses and keyboard clicks seem to work fine, which would also be sent just whenever and could also lie in-between EDIT: One more thing, so I just have a imgui.begin() and imgui.end() and in between some imgui.text(). Enough to get a scrollbar. Is there anything else I need to do to make sure that scrollbar will work while scrolling? I've made sure the window is "active/focused", and it still doesn't work. |
My bad, the Yes, I think it could be cached and sent to imgui once per frame. It is not yet part of the master branch but in #192 the integration code has a
Indeed the same problem should occur with mouse presses and keyboard clicks. I think we should be careful and verify "somehow" that this is the origin of the problem and that it should be changed.
I think you got it and that should work just like that. It should also work without window focus (but may depend on your os). |
For some reason whenever I have a window in focus that has a scrollbar (vertical), using the mouses' scroll wheel does not scroll the window. I can however click and drag the scrollbar to move it. Is there something extra I have to do to enable this? This is on MacOS, haven't tested it on Windows though. Using the latest stable build of pyimgui.
The text was updated successfully, but these errors were encountered: