ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
61.15k stars 10.3k forks source link

Can default scrolling behavior via mouse wheel be set to horizontal? #8060

Open alektron opened 1 month ago

alektron commented 1 month ago

Version/Branch of Dear ImGui:

Version 1.91.4, Branch: docking

Back-ends:

Backend independent (might only be relevant for Windows, see note below)

Compiler, OS:

Visual Studio 2022 MSVC C++ 20

Full config/build information:

No response

Details:

I have a (child) window that can only scroll horizontally via the mouse wheel. The content size is smaller than the window size on the y axis, so no vertical scrolling is possible. The content size is bigger than the window size on the x axis, so horizontal scrolling is possible. The scrollbar is hidden via the ImGuiWindowFlags_NoScrollbar flag but it might just as well be visible. It should not really matter for the question.

With this configuration it is possible to scroll horizontally with the mouse wheel by holding shift. However, since this window in my scenario will never scroll vertically I would like that to be the default behavior (without shift). Is that currently possible with some combination of flags or do I have set ScrollX myself programatically?

Note: There seem to be some differences in the scrolling behavior if ConfigMacOSXBehaviors is set. Maybe that would even do what I need? I'm not a MacOS user so I could not tell but since I am on Windows I would probably prefer not to set that flag either way.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

ocornut commented 1 month ago

It doesn't seem to be easily possible right now but it would be a good idea to allow for it.

My problem is at which point to fit that in the API.

The scrolling/scrollbar related flags in ImGuiWindowFlags seems already a bit polluting, I wish we had a better design.