diff options
| author | Leon Krause | 2018-05-09 15:57:10 +0200 |
|---|---|---|
| committer | Hein-Pieter van Braam | 2018-05-13 22:17:53 +0200 |
| commit | 868c44b23949d7d1f677e8e7d6e4832ca2f0510e (patch) | |
| tree | 836141a3112abd352d7ecf32385fe92a7d057e8b /platform/javascript/os_javascript.cpp | |
| parent | 10c12b37ec90d2f795bbd859479d9e5c8f6899f9 (diff) | |
| download | godot-868c44b23949d7d1f677e8e7d6e4832ca2f0510e.tar.gz godot-868c44b23949d7d1f677e8e7d6e4832ca2f0510e.tar.zst godot-868c44b23949d7d1f677e8e7d6e4832ca2f0510e.zip | |
Fix keyboard focus lock-out with HTML5 canvas in iframe
(cherry picked from commit 9080e96bc81328e658a03e2cd248c06ddbf9f2ec)
Diffstat (limited to 'platform/javascript/os_javascript.cpp')
| -rw-r--r-- | platform/javascript/os_javascript.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 017922ba1..e878cf372 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -159,10 +159,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; @@ -173,7 +172,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; } |
