|
@@ -8436,6 +8436,13 @@ static void ImGui::UpdateMouseInputs()
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
ImGuiIO& io = g.IO;
|
|
|
|
|
|
+ // Mouse Wheel swapping flag
|
|
|
+ // 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.
|
|
|
+ // - FIXME: However this means when running on OSX over Emscripten, Shift+WheelY will incur two swapping (1 in OS, 1 here), canceling the feature.
|
|
|
+ // - FIXME: When we can distinguish e.g. touchpad scroll events from mouse ones, we'll set this accordingly based on input source.
|
|
|
+ io.MouseWheelRequestAxisSwap = io.KeyShift && !io.ConfigMacOSXBehaviors;
|
|
|
+
|
|
|
// Round mouse position to avoid spreading non-rounded position (e.g. UpdateManualResize doesn't support them well)
|
|
|
if (IsMousePosValid(&io.MousePos))
|
|
|
io.MousePos = g.MouseLastValidPos = ImFloorSigned(io.MousePos);
|
|
@@ -8596,15 +8603,9 @@ void ImGui::UpdateMouseWheel()
|
|
|
return;
|
|
|
|
|
|
// 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.
|
|
|
- // - 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)
|
|
|
- {
|
|
|
- wheel.x = wheel.y;
|
|
|
- wheel.y = 0.0f;
|
|
|
- }
|
|
|
+ // Read about io.MouseWheelRequestAxisSwap and its issue on Mac+Emscripten in UpdateMouseInputs()
|
|
|
+ if (g.IO.MouseWheelRequestAxisSwap)
|
|
|
+ wheel = ImVec2(wheel.y, 0.0f);
|
|
|
|
|
|
// Maintain a rough average of moving magnitude on both axises
|
|
|
// FIXME: should by based on wall clock time rather than frame-counter
|