diff options
Diffstat (limited to 'platform/javascript/os_javascript.cpp')
-rw-r--r-- | platform/javascript/os_javascript.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 1b5463e40d..6c6e4d2d1c 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -167,10 +167,9 @@ 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(); - } + // Since the event is consumed, focus manually. The containing iframe, + // if used, may not have focus yet, so focus even if already focused. + focus_canvas(); mask |= button_flag; } else if (mask & button_flag) { mask &= ~button_flag; @@ -181,7 +180,8 @@ static EM_BOOL _mousebutton_callback(int event_type, const EmscriptenMouseEvent ev->set_button_mask(mask); _input->parse_input_event(ev); - // prevent selection dragging + // Prevent multi-click text selection and wheel-click scrolling anchor. + // Context menu is prevented through contextmenu event. return true; } @@ -204,7 +204,7 @@ static EM_BOOL _mousemove_callback(int event_type, const EmscriptenMouseEvent *m ev->set_position(pos); ev->set_global_position(ev->get_position()); - ev->set_relative(ev->get_position() - _input->get_mouse_position()); + ev->set_relative(Vector2(mouse_event->movementX, mouse_event->movementY)); _input->set_mouse_position(ev->get_position()); ev->set_speed(_input->get_last_mouse_speed()); |