Backends, Inputs: Made horizontal scroll wheel and horizontal scroll direction consistent accross backends/os. (#4019, #6096, #1463)

Documented assumptions.
This commit is contained in:
ocornut
2023-02-01 20:50:45 +01:00
parent 8d29665ae1
commit 3617a96372
10 changed files with 372 additions and 8 deletions

View File

@ -1467,7 +1467,7 @@ void ImGuiIO::AddMouseButtonEvent(int mouse_button, bool down)
g.InputEventsQueue.push_back(e);
}
// Queue a mouse wheel event (most mouse/API will only have a Y component)
// Queue a mouse wheel event (some mouse/API may only have a Y component)
void ImGuiIO::AddMouseWheelEvent(float wheel_x, float wheel_y)
{
ImGuiContext& g = *GImGui;
@ -8488,7 +8488,8 @@ void ImGui::UpdateMouseWheel()
// Mouse wheel scrolling
// 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)
// - We avoid doing it on OSX as it the OS input layer handles this already.
// - However this means when running on OSX over Emcripten, Shift+WheelY will incur two swappings (1 in OS, 1 here), cancelling the feature.
const bool swap_axis = g.IO.KeyShift && !g.IO.ConfigMacOSXBehaviors;
if (swap_axis)
{