1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-12 10:11:00 +01:00

Implement horizontal scrolling with Shift+Scroll

This is standard scrolling behaviour in most applications.
This commit is contained in:
Luca Rood 2019-03-16 19:55:42 +01:00 committed by omar
parent 3d8ea352d1
commit 1963cc59be

View File

@ -3296,6 +3296,13 @@ void ImGui::UpdateMouseWheel()
window->Size *= scale;
window->SizeFull *= scale;
}
else if (!g.IO.KeyCtrl && g.IO.KeyShift && scroll_allowed)
{
// Mouse wheel horizontal scrolling
float scroll_amount = 5 * scroll_window->CalcFontSize();
scroll_amount = (float)(int)ImMin(scroll_amount, (scroll_window->ContentsRegionRect.GetWidth() + scroll_window->WindowPadding.x * 2.0f) * 0.67f);
SetWindowScrollX(scroll_window, scroll_window->Scroll.x - g.IO.MouseWheel * scroll_amount);
}
else if (!g.IO.KeyCtrl && scroll_allowed)
{
// Mouse wheel vertical scrolling