diff options
| author | Leon Krause | 2018-05-09 15:57:10 +0200 |
|---|---|---|
| committer | Leon Krause | 2018-05-10 02:42:47 +0200 |
| commit | 9080e96bc81328e658a03e2cd248c06ddbf9f2ec (patch) | |
| tree | 068885cd973a53889b69ce1ddb6daa7a489cd3fe /platform | |
| parent | 0f930f831410bc57d0e975b4ab73715d0d034735 (diff) | |
| download | godot-9080e96bc81328e658a03e2cd248c06ddbf9f2ec.tar.gz godot-9080e96bc81328e658a03e2cd248c06ddbf9f2ec.tar.zst godot-9080e96bc81328e658a03e2cd248c06ddbf9f2ec.zip | |
Diffstat (limited to 'platform')
| -rw-r--r-- | platform/javascript/engine.js | 4 | ||||
| -rw-r--r-- | platform/javascript/os_javascript.cpp | 10 |
2 files changed, 9 insertions, 5 deletions
diff --git a/platform/javascript/engine.js b/platform/javascript/engine.js index e4839af43..e3a28083a 100644 --- a/platform/javascript/engine.js +++ b/platform/javascript/engine.js @@ -161,6 +161,10 @@ actualCanvas.style.padding = 0; actualCanvas.style.borderWidth = 0; actualCanvas.style.borderStyle = 'none'; + // disable right-click context menu + actualCanvas.addEventListener('contextmenu', function(ev) { + ev.preventDefault(); + }, false); // until context restoration is implemented actualCanvas.addEventListener('webglcontextlost', function(ev) { alert("WebGL context lost, please reload the page"); diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 1b5463e40..cb942b6bb 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; } |
