From 742729ccfe98bb6c38453a45213d873f0579d1dd Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Mon, 30 Nov 2020 11:28:25 +0100 Subject: [HTML5] Remove file flags from writeFile in setup. Flags where deprecated and partly in removed in emscripten 2.0.9. --- platform/javascript/js/libs/library_godot_os.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'platform/javascript') diff --git a/platform/javascript/js/libs/library_godot_os.js b/platform/javascript/js/libs/library_godot_os.js index 488753d704..44b104922e 100644 --- a/platform/javascript/js/libs/library_godot_os.js +++ b/platform/javascript/js/libs/library_godot_os.js @@ -200,7 +200,7 @@ const GodotFS = { } FS.mkdirTree(dir); } - FS.writeFile(path, new Uint8Array(buffer), { 'flags': 'wx+' }); + FS.writeFile(path, new Uint8Array(buffer)); }, }, }; -- cgit v1.2.3 From 178546ac3e460864b897cf90d7835e982d237712 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Mon, 30 Nov 2020 11:32:35 +0100 Subject: [HTML5] Fix broken layout on load in HiDPI screens This was caused by the devicePixelRatio being applied twice, once by the HTML code, once by the OS code. More specifically, OS.get_window_size() would return the canvas element size, while OS.set_window_size() would set the element size to the specified value times the devicePixelRatio. Calling OS.set_window_size(OS.get_window_size()) would reapply the devicePixelRatio every time. This commit changes the behaviour so that OS.set_window_size() do not apply the devicePixelRatio to the canvas element size, by it divides the CSS size instead. --- platform/javascript/display_server_javascript.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'platform/javascript') diff --git a/platform/javascript/display_server_javascript.cpp b/platform/javascript/display_server_javascript.cpp index af8800d565..92e13553fc 100644 --- a/platform/javascript/display_server_javascript.cpp +++ b/platform/javascript/display_server_javascript.cpp @@ -948,8 +948,8 @@ void DisplayServerJavaScript::window_set_size(const Size2i p_size, WindowID p_wi last_width = p_size.x; last_height = p_size.y; double scale = godot_js_display_pixel_ratio_get(); - emscripten_set_canvas_element_size(canvas_id, p_size.x * scale, p_size.y * scale); - emscripten_set_element_css_size(canvas_id, p_size.x, p_size.y); + emscripten_set_canvas_element_size(canvas_id, p_size.x, p_size.y); + emscripten_set_element_css_size(canvas_id, p_size.x / scale, p_size.y / scale); } Size2i DisplayServerJavaScript::window_get_size(WindowID p_window) const { -- cgit v1.2.3