-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Preventing horizontal scroll #2915
Comments
Hello, |
Excellent solution. Why didn't I find this work around myself?! |
I don't know which version you are using (Edit: 1.70 as stated above, sorry ^^), but unfortunately this won't work correctly from 1.72 (just tried and this is causing a glitch). This is directly in opposition to what we tried to achieve with dcd03f6 "Scrolling: Made it possible for mouse wheel and navigation-triggered scrolling to override a call to SetScrollX()/SetScrollY(), making it possible to use a simpler stateless pattern for auto-scrolling." |
One option would be to add explicit window flags e.g. Pro: explicit Or we could expose Pro: which would allow solve things like #1526 |
Wow, thanks for your effort. I personally don't know enough to have a valid opinion, and could live with both solutions. At least in 1.70 horizontal an vertical scrolling are handled somewhat inconsistently within the API. If possible, I would prefer verbose, explicit and consistent flags and methods for both directions. |
@ocornut I finally wanted to bump our version to v1.72 but the glitch you mentioned also appears for the vertical scrolling. I already added a work around like this some months ago...
...but forgot about it and didn't considered relevant for the horizontal scroll problem. In v1.72 it appears that the scroll position override is applied with a one frame delay. This results in considerable flickering when zooming in with mouse wheel. It's barely noticable in the gif because of the low framerate, but with 60fps it appears every time and I want to find a solution or work around. I already disabled the scrollbars. Is there a way to disable the mouse wheel and for certain windows? |
@ocornut I just had one more insight: I now believe that scrolling should be completely decoupled from mouse-wheel interaction. There are many use-cases in which the mouse-wheel is used for zooming (timelines, image viewers, maps etc.). But frequently you still want to display and use the scrollbars if the outer dimension of the zoomed canvas are known. I that's why my preferred solution would be a flag like This would fix my current issues, and I believe it should be easy to integrate. |
For the later I think you should be able to use |
Excellent. How could I have missed this option?! Again. |
I think that solving for scrolling cases As far as flag pollution, it's a bit like style vars... Always better to have too many than not enough. |
I've tried the |
Unfortunately no because we have a limited amount of window flags (32-bits) and docking branch use more. Working on removing 1-2 from docking branch. |
Okay. I understand your comment now:
Looks like we're left with the only option of exposing
Tabs, docking titles, and multi-line text entry all have scrolling too so we should probably be pedantic in naming unless the other widgets could also take Would you be open to a PR exposing This itch is annoying enough that I'm ready to scratch it!! |
Hi, Any progress on this issue? I need to allow the user to scroll vertically but not horizontally. Using |
Version/Branch of Dear ImGui:
Version: 1.70
Branch: master
Back-end/Renderer/Compiler/OS
Back-ends: imgui.net
Compiler: c#/.net
Operating System: win10
My Issue/Question:
I have some windows that don't need horizontal scrolling. Although I can disable the display of the scrollbar, I haven't found an option to prevent the horizontal scrolling to take effect when accidentally pressing the horizontal mouse wheel or scrolling on a touch pad.
Is there something I can do to prevent scrolling besides not passing along the horizontal scroll wheel data?
Screenshots/Video
The text was updated successfully, but these errors were encountered: