summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-11-13 16:31:43 +0100
committerGitHub <noreply@github.com>2017-11-13 16:31:43 +0100
commit3732b2318e8a4942e8202f1797527220a5ae01a0 (patch)
treefd5fa39bf0c84d9041b91e28a10cb2c56bf332f6
parentafec30837c7026251b90fab6f47131db19df278d (diff)
parent159c2ec69cd6bb34e264b6f2df3351b86c6d0917 (diff)
Merge pull request #12904 from eska014/html5-fix-mousebuttons
Fix HTML5 mouse button release events
-rw-r--r--platform/javascript/os_javascript.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index e5bdcec30d..389d5d206e 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -166,14 +166,15 @@ static EM_BOOL _mousebutton_callback(int event_type, const EmscriptenMouseEvent
}
int mask = _input->get_mouse_button_mask();
+ int button_flag = 1 << (ev->get_button_index() - 1);
if (ev->is_pressed()) {
// since the event is consumed, focus manually
if (!is_canvas_focused()) {
focus_canvas();
}
- mask |= ev->get_button_index();
- } else if (mask & ev->get_button_index()) {
- mask &= ~ev->get_button_index();
+ mask |= button_flag;
+ } else if (mask & button_flag) {
+ mask &= ~button_flag;
} else {
// release event, but press was outside the canvas, so ignore
return false;