mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
emscripten: Scale horizontal scroll events to be reasonable
In my browser, I noticed that zooming seemed jumpy and unreliable. Turns out that my fingers were moving horizontally on my trackpad, and the x-scroll was causing the unexpected behavior.
This commit is contained in:
parent
5492a2cf94
commit
c71a43c9c9
@ -313,6 +313,11 @@ void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int acti
|
|||||||
|
|
||||||
void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset)
|
void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset)
|
||||||
{
|
{
|
||||||
|
#if defined(__EMSCRIPTEN__)
|
||||||
|
// Running under Emscripten, GLFW reports grossly mis-scaled scroll events and even flips the X axis.
|
||||||
|
xoffset /= -20.0f;
|
||||||
|
#endif
|
||||||
|
|
||||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||||
if (bd->PrevUserCallbackScroll != nullptr && window == bd->Window)
|
if (bd->PrevUserCallbackScroll != nullptr && window == bd->Window)
|
||||||
bd->PrevUserCallbackScroll(window, xoffset, yoffset);
|
bd->PrevUserCallbackScroll(window, xoffset, yoffset);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user