Skip to content
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

Scrollbar increment values #7753

Open
Antidote opened this issue Jun 29, 2024 · 1 comment
Open

Scrollbar increment values #7753

Antidote opened this issue Jun 29, 2024 · 1 comment

Comments

@Antidote
Copy link

Antidote commented Jun 29, 2024

Version/Branch of Dear ImGui:

docking

Back-ends:

imgui_impl_sdlrenderer2.cpp + imgui_impl_sdl2.cpp

Compiler, OS:

Linux+GCC/Clang

Full config/build information:

No response

Details:

In some cases it's useful to have discrete scrollbar increments, such as for a tile map editor where you want to increment the scrollbars by either the tile size, or a region of tiles (i.e for a rectangle brush)

If there is an existing solution to this my google-fu has failed me, I currently snap the scrollbar values manually,
but due to the nature in which they get updated there is a lot of rubber-banding.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

@ocornut
Copy link
Owner

ocornut commented Jul 1, 2024

Hello,

I don't have a great solution yet, however, you can use:

ImGui::GetActiveID() == ImGui::GetWindowScrollbarID(ImGui::GetCurrentWindow(), ImGuiAxis_Y);

from imgui_internal.h to tell that a scrollbar is activated, which may be useful to reduce glitches.

Note that keyboard navigation and other features may also lead to scroll.

Linking to #5628.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants