diff --git a/backends/imgui_impl_emscripten.cpp b/backends/imgui_impl_emscripten.cpp index db25ec8a9..51a0c221d 100644 --- a/backends/imgui_impl_emscripten.cpp +++ b/backends/imgui_impl_emscripten.cpp @@ -179,7 +179,7 @@ constexpr ImGuiMouseButton translate_mousebutton(unsigned short emscripten_butto // Translate an emscripten-provided integer describing a mouse button to an imgui mouse button if (emscripten_button == 1) return ImGuiMouseButton_Middle; // 1 = middle mouse button if (emscripten_button == 2) return ImGuiMouseButton_Right; // 2 = right mouse button - if (emscripten_button > ImGuiMouseButton_COUNT) return ImGuiMouseButton_Middle; // treat any weird clicks on unexpected buttons (button 6 upwards) as middle mouse + if (emscripten_button >= ImGuiMouseButton_COUNT) return ImGuiMouseButton_Middle; // treat any weird clicks on unexpected buttons (button 6 upwards) as middle mouse return emscripten_button; // any other button translates 1:1 }