mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-12 02:00:58 +01:00
Backends: Added support for SDL 2.0.18+ preciseX/preciseY mouse wheel data for smooth scrolling + scaling for Emscripten. (#4019, #6096)
+ Missing changelog entries.
This commit is contained in:
parent
624c057ae1
commit
1f1861dae6
@ -16,6 +16,7 @@
|
||||
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2023-02-02: Inputs: Scaling X value on Emscripten (bug?). (#4019, #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,10 @@ void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yo
|
||||
if (bd->PrevUserCallbackScroll != nullptr && window == bd->Window)
|
||||
bd->PrevUserCallbackScroll(window, xoffset, yoffset);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
xoffset /= 100.0;
|
||||
#endif
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.AddMouseWheelEvent((float)xoffset, (float)yoffset);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2023-02-02: Added support for SDL 2.0.18+ preciseX/preciseY mouse wheel data for smooth scrolling + Scaling X value on Emscripten (bug?). (#4019, #6096)
|
||||
// 2023-02-02: Removed SDL_MOUSEWHEEL value clamping, as values seem correct in latest Emscripten. (#4019)
|
||||
// 2023-02-01: Flipping SDL_MOUSEWHEEL 'wheel.x' value to match other backends and offer consistent horizontal scrolling direction. (#4019, #6096, #1463)
|
||||
// 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.
|
||||
@ -262,8 +263,17 @@ bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event)
|
||||
}
|
||||
case SDL_MOUSEWHEEL:
|
||||
{
|
||||
//IMGUI_DEBUG_LOG("wheel %.2f %.2f, precise %.2f %.2f\n", (float)event->wheel.x, (float)event->wheel.y, event->wheel.preciseX, event->wheel.preciseY);
|
||||
#if SDL_VERSION_ATLEAST(2,0,18) // If this fails to compile on Emscripten: update to latest Emscripten!
|
||||
float wheel_x = -event->wheel.preciseX;
|
||||
float wheel_y = event->wheel.preciseY;
|
||||
#else
|
||||
float wheel_x = -(float)event->wheel.x;
|
||||
float wheel_y = (float)event->wheel.y;
|
||||
#endif
|
||||
#ifdef __EMSCRIPTEN__
|
||||
wheel_x /= 100.0f;
|
||||
#endif
|
||||
io.AddMouseWheelEvent(wheel_x, wheel_y);
|
||||
return true;
|
||||
}
|
||||
|
@ -90,13 +90,16 @@ All changes:
|
||||
- Backends: OSX: Fixed scroll/wheel scaling for devices emitting events with
|
||||
hasPreciseScrollingDeltas==false (e.g. non-Apple mices).
|
||||
- Backends: SDL: Removed SDL_MOUSEWHEEL value clamping. (#4019, #6096, #6081)
|
||||
Latest Emscripten seems to emit correct values.
|
||||
- Backends: SDL: Added support for SDL 2.0.18+ preciseX/preciseY mouse wheel data
|
||||
for smooth scrolling as reported by SDL. (#4019, #6096)
|
||||
- Backend: WebGPU: Fix building for latest WebGPU specs (remove implicit layout generation).
|
||||
(#6117, #4116, #3632) [@tonygrue, @bfierz]
|
||||
- Examples: refactord all examples to use a "MainLoopStep()" function. This is in order
|
||||
to be able to trivially make some compile with Emscripten. (#2492, #3699)
|
||||
While not all examples are expected to compile on Emscripten, we try to keep all of them
|
||||
as close as possible to each others.
|
||||
- Examples: Emscripten: The main SDL+GL and GLFW+GL examples now supports Emscripten.
|
||||
(the dedicated example_emscripten_opengl3/ has been removed) (#2492, #2494, #3699, #3705)
|
||||
- Examples: Win32: Fixed examples using RegisterClassW() since 1.89 to also call
|
||||
DefWindowProcW() instead of DefWindowProc() so that title text are correctly converted
|
||||
when application is compiled without /DUNICODE. (#5725, #5961, #5975) [@markreidvfx]
|
||||
|
Loading…
Reference in New Issue
Block a user