@@ -3655,28 +3655,22 @@ void ImGui::UpdateMouseWheel()
3655
3655
// If a child window has the ImGuiWindowFlags_NoScrollWithMouse flag, we give a chance to scroll its parent
3656
3656
3657
3657
// Vertical Mouse Wheel scrolling
3658
- const float wheel_y = (g.IO.MouseWheel != 0.0f && !g.IO.KeyShift) ? g.IO.MouseWheel : 0.0f;
3659
- if (wheel_y != 0.0f && !g.IO.KeyCtrl)
3658
+ const float wheel_y = (!g.IO.KeyShift) ? g.IO.MouseWheel : 0.0f;
3659
+ // Horizontal Mouse Wheel scrolling, or Vertical Mouse Wheel w/ Shift held
3660
+ const float wheel_x = (!g.IO.KeyShift) ? g.IO.MouseWheelH : g.IO.MouseWheel;
3661
+ if ((wheel_y != 0.0f || wheel_x != 0.0f) && !g.IO.KeyCtrl)
3660
3662
{
3661
- StartLockWheelingWindow (window);
3662
- while ((window->Flags & ImGuiWindowFlags_ChildWindow) && ((window->ScrollMax.y == 0.0f) || ((window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !( window->Flags & ImGuiWindowFlags_NoMouseInputs)) ))
3663
+ bool noScroll = (window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs );
3664
+ while ((window->Flags & ImGuiWindowFlags_ChildWindow) && ((window->ScrollMax.y == 0.0f && window->ScrollMax.x == 0.0f) || noScroll ))
3663
3665
window = window->ParentWindow;
3664
- if (!(window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs))
3666
+ StartLockWheelingWindow(window);
3667
+ if (!noScroll && wheel_y != 0.0f)
3665
3668
{
3666
3669
float max_step = window->InnerRect.GetHeight() * 0.67f;
3667
3670
float scroll_step = ImFloor(ImMin(5 * window->CalcFontSize(), max_step));
3668
3671
SetScrollY(window, window->Scroll.y - wheel_y * scroll_step);
3669
3672
}
3670
- }
3671
-
3672
- // Horizontal Mouse Wheel scrolling, or Vertical Mouse Wheel w/ Shift held
3673
- const float wheel_x = (g.IO.MouseWheelH != 0.0f && !g.IO.KeyShift) ? g.IO.MouseWheelH : (g.IO.MouseWheel != 0.0f && g.IO.KeyShift) ? g.IO.MouseWheel : 0.0f;
3674
- if (wheel_x != 0.0f && !g.IO.KeyCtrl)
3675
- {
3676
- StartLockWheelingWindow(window);
3677
- while ((window->Flags & ImGuiWindowFlags_ChildWindow) && ((window->ScrollMax.x == 0.0f) || ((window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs))))
3678
- window = window->ParentWindow;
3679
- if (!(window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs))
3673
+ if (!noScroll && wheel_x != 0.0f)
3680
3674
{
3681
3675
float max_step = window->InnerRect.GetWidth() * 0.67f;
3682
3676
float scroll_step = ImFloor(ImMin(2 * window->CalcFontSize(), max_step));
0 commit comments