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

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.

This commit is contained in:
omar 2017-12-08 18:28:17 +01:00
parent a263dce2f2
commit 457011660e

View File

@ -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);
}
}