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

@ -16,6 +16,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2023-02-01: Inputs: flipping both wheel axises when running on Emscripten's GLFW emulation. (#6096)
// 2023-01-04: Inputs: Fixed mods state on Linux when using Alt-GR text input (e.g. German keyboard layout), could lead to broken text input. Revert a 2022/01/17 change were we resumed using mods provided by GLFW, turns out they were faulty.
// 2022-11-22: Perform a dummy glfwGetError() read to cancel missing names with glfwGetKeyName(). (#5908)
// 2022-10-18: Perform a dummy glfwGetError() read to cancel missing mouse cursors errors. Using GLFW_VERSION_COMBINED directly. (#5785)
@ -283,6 +284,13 @@ void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yo
if (bd->PrevUserCallbackScroll != nullptr && window == bd->Window)
bd->PrevUserCallbackScroll(window, xoffset, yoffset);
#if defined(__EMSCRIPTEN__)
// Emscripten's GLFW emulation reports grossly mis-scaled and flipped scroll events.
// The scale is still currently incorrect, see #4019 #6096 for details.
xoffset /= -120.0f;
yoffset /= -120.0f;
#endif
ImGuiIO& io = ImGui::GetIO();
io.AddMouseWheelEvent((float)xoffset, (float)yoffset);
}