mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Scrolling: Fix mouse wheel axis swap when using SHIFT on macOS (system already does it). (#4010)
This commit is contained in:
parent
5f45047fb6
commit
92b7b1f72b
@ -41,6 +41,7 @@ Other Changes:
|
||||
|
||||
- Scrolling: Fix scroll tracking with e.g. SetScrollHereX/Y() when WindowPadding < ItemSpacing.
|
||||
- Scrolling: Fix scroll snapping on edge of scroll region when both scrollbars are enabled.
|
||||
- Scrolling: Fix mouse wheel axis swap when using SHIFT on macOS (system already does it). (#4010)
|
||||
- Window: Fix IsWindowAppearing() from returning true twice in most cases. (#3982, #1497, #1061)
|
||||
- Tables: Expose TableSetColumnEnabled() in public api. (#3935)
|
||||
- TabBar: Fixed mouse reordering with very fast movements (e.g. crossing multiple tabs in a single
|
||||
|
14
imgui.cpp
14
imgui.cpp
@ -3738,10 +3738,17 @@ void ImGui::UpdateMouseWheel()
|
||||
|
||||
// Mouse wheel scrolling
|
||||
// If a child window has the ImGuiWindowFlags_NoScrollWithMouse flag, we give a chance to scroll its parent
|
||||
if (g.IO.KeyCtrl)
|
||||
return;
|
||||
|
||||
// As a standard behavior holding SHIFT while using Vertical Mouse Wheel triggers Horizontal scroll instead
|
||||
// (we avoid doing it on OSX as it the OS input layer handles this already)
|
||||
const bool swap_axis = g.IO.KeyShift && !g.IO.ConfigMacOSXBehaviors;
|
||||
const float wheel_y = swap_axis ? 0.0f : g.IO.MouseWheel;
|
||||
const float wheel_x = swap_axis ? g.IO.MouseWheel : g.IO.MouseWheelH;
|
||||
|
||||
// Vertical Mouse Wheel scrolling
|
||||
const float wheel_y = (g.IO.MouseWheel != 0.0f && !g.IO.KeyShift) ? g.IO.MouseWheel : 0.0f;
|
||||
if (wheel_y != 0.0f && !g.IO.KeyCtrl)
|
||||
if (wheel_y != 0.0f)
|
||||
{
|
||||
StartLockWheelingWindow(window);
|
||||
while ((window->Flags & ImGuiWindowFlags_ChildWindow) && ((window->ScrollMax.y == 0.0f) || ((window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs))))
|
||||
@ -3755,8 +3762,7 @@ void ImGui::UpdateMouseWheel()
|
||||
}
|
||||
|
||||
// Horizontal Mouse Wheel scrolling, or Vertical Mouse Wheel w/ Shift held
|
||||
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;
|
||||
if (wheel_x != 0.0f && !g.IO.KeyCtrl)
|
||||
if (wheel_x != 0.0f)
|
||||
{
|
||||
StartLockWheelingWindow(window);
|
||||
while ((window->Flags & ImGuiWindowFlags_ChildWindow) && ((window->ScrollMax.x == 0.0f) || ((window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs))))
|
||||
|
Loading…
Reference in New Issue
Block a user