Merge pull request #12904 from eska014/html5-fix-mousebuttons
Fix HTML5 mouse button release events
This commit is contained in:
commit
3732b2318e
1 changed files with 4 additions and 3 deletions
|
@ -166,14 +166,15 @@ static EM_BOOL _mousebutton_callback(int event_type, const EmscriptenMouseEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
int mask = _input->get_mouse_button_mask();
|
int mask = _input->get_mouse_button_mask();
|
||||||
|
int button_flag = 1 << (ev->get_button_index() - 1);
|
||||||
if (ev->is_pressed()) {
|
if (ev->is_pressed()) {
|
||||||
// since the event is consumed, focus manually
|
// since the event is consumed, focus manually
|
||||||
if (!is_canvas_focused()) {
|
if (!is_canvas_focused()) {
|
||||||
focus_canvas();
|
focus_canvas();
|
||||||
}
|
}
|
||||||
mask |= ev->get_button_index();
|
mask |= button_flag;
|
||||||
} else if (mask & ev->get_button_index()) {
|
} else if (mask & button_flag) {
|
||||||
mask &= ~ev->get_button_index();
|
mask &= ~button_flag;
|
||||||
} else {
|
} else {
|
||||||
// release event, but press was outside the canvas, so ignore
|
// release event, but press was outside the canvas, so ignore
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue