consume mousewheel event if imgui wants to capture the mouse

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
slowriot 2026-04-02 22:39:51 +01:00 committed by GitHub
parent 8fa2322760
commit c0842c78cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -228,11 +228,12 @@ void ImGui_ImplEmscripten_Init()
break;
}
// TODO: make scrolling speeds configurable
ImGui::GetIO().AddMouseWheelEvent(
ImGuiIO& io{ImGui::GetIO()};
io.AddMouseWheelEvent(
-static_cast<float>(wheel_event->deltaX) * scale,
-static_cast<float>(wheel_event->deltaY) * scale
);
return false; // the event was not consumed
return io.WantCaptureMouse; // consume the event when imgui wants to capture mouse input
}
);
emscripten_set_keydown_callback(