Skip to content

Commit

Permalink
ImGui: fixed handling of mouse input on Emscripten
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Jan 27, 2024
1 parent c5f8453 commit 504d967
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions Imgui/src/ImGuiImplEmscripten.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,8 @@ void ImGuiImplEmscripten::Render(IDeviceContext* pCtx)

bool ImGuiImplEmscripten::OnMouseEvent(int32_t EventType, const EmscriptenMouseEvent* Event)
{
auto DevicePixelRatio = emscripten_get_device_pixel_ratio();

auto& io = ImGui::GetIO();
io.MousePos = ImVec2(Event->targetX * DevicePixelRatio, Event->targetY * DevicePixelRatio);
io.MousePos = ImVec2(Event->targetX, Event->targetY);
io.MouseDown[0] = Event->buttons & 1;
io.MouseDown[1] = Event->buttons & 2;
io.MouseDown[2] = Event->buttons & 4;
Expand Down

0 comments on commit 504d967

Please sign in to comment.