mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-08 15:35:50 +01:00
catch out of range buttons
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
426bff6aed
commit
416d85c9e7
@ -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
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user