From 457011660eb47c6d0b87dc0e6b5ab700caf5b770 Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 8 Dec 2017 18:28:17 +0100 Subject: [PATCH] Mouse wheel scrolling doesn't change speed inside Combo box (uses to slow down from 5 to 3) but instead slow down on window that are smaller than the scroll speed. --- imgui.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index c01c9492b..735f9f968 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2449,9 +2449,10 @@ void ImGui::NewFrame() } else if (!g.IO.KeyCtrl && !(window->Flags & ImGuiWindowFlags_NoScrollWithMouse)) { - // Scroll - const int scroll_lines = (window->Flags & ImGuiWindowFlags_ComboBox) ? 3 : 5; - SetWindowScrollY(window, window->Scroll.y - g.IO.MouseWheel * window->CalcFontSize() * scroll_lines); + // Mouse wheel Scrolling + float scroll_amount = 5 * window->CalcFontSize(); + scroll_amount = (float)(int)ImMin(scroll_amount, (window->ContentsRegionRect.GetHeight() + window->WindowPadding.y * 2.0f) * 0.67f); + SetWindowScrollY(window, window->Scroll.y - g.IO.MouseWheel * scroll_amount); } }