Scrolling: when scrolling a window with the mouse wheel, own the wheel when its lock starts

This commit is contained in:
Pascal Thomet 2026-10-15 15:29:03 +02:00
parent 6d32174508
commit a27933f6b5
No known key found for this signature in database
GPG Key ID: 421F2328314F192D

View File

@ -10698,6 +10698,7 @@ void ImGui::UpdateMouseWheel()
if (do_scroll[ImGuiAxis_X])
{
LockWheelingWindow(window, wheel.x);
SetKeyOwner(ImGuiKey_MouseWheelX, window->ID);
float max_step = window->InnerRect.GetWidth() * 0.67f;
float scroll_step = ImTrunc(ImMin(2 * window->FontRefSize, max_step));
SetScrollX(window, window->Scroll.x - wheel.x * scroll_step);
@ -10706,6 +10707,7 @@ void ImGui::UpdateMouseWheel()
if (do_scroll[ImGuiAxis_Y])
{
LockWheelingWindow(window, wheel.y);
SetKeyOwner(ImGuiKey_MouseWheelY, window->ID);
float max_step = window->InnerRect.GetHeight() * 0.67f;
float scroll_step = ImTrunc(ImMin(5 * window->FontRefSize, max_step));
SetScrollY(window, window->Scroll.y - wheel.y * scroll_step);