diff options
| author | eska | 2017-01-12 14:14:40 +0100 |
|---|---|---|
| committer | eska | 2017-01-16 18:39:04 +0100 |
| commit | e4bbc1067a033c44f65091590408ad22cf41a4d5 (patch) | |
| tree | cea065328320eb7a84aca7b47c7eaee794da4d78 | |
| parent | 5aac8eeb0f2f207b3b3e39440cfec89b568500ce (diff) | |
| download | godot-e4bbc1067a033c44f65091590408ad22cf41a4d5.tar.gz godot-e4bbc1067a033c44f65091590408ad22cf41a4d5.tar.zst godot-e4bbc1067a033c44f65091590408ad22cf41a4d5.zip | |
Improve usability in web export presentation
- Make canvas support check message visible
- Make it obvious status can be closed by clicking
- Don't use status to display non-critical errors
- Fix setting total memory
(cherry picked from commit 1f7d4c4d0ee8eba0a1d8084019269a45dfa76be4)
| -rw-r--r-- | tools/dist/html_fs/godot.html | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/tools/dist/html_fs/godot.html b/tools/dist/html_fs/godot.html index ee5b34e2e..34df0939a 100644 --- a/tools/dist/html_fs/godot.html +++ b/tools/dist/html_fs/godot.html @@ -81,6 +81,7 @@ * calculate cursor coordinates correctly */ border: 0 none; padding: 0; + color: white; } @@ -101,6 +102,7 @@ } #status { + cursor: pointer; visibility: visible; padding: 4px 6px; } @@ -206,6 +208,7 @@ var presentation = { statusElement: statusElement, outputElement: outputElement, + postRun: [], setOutputVisible: function setOutputVisible(visible) { outputElement.style.display = (visible?"block":"none"); }, @@ -213,12 +216,17 @@ statusElement.style.visibility = (visible?"visible":"hidden"); }, setStatus: function setStatus(text) { - if (!text || text.length === 0) { - Presentation.setStatusVisible(false); - onLoaded(); + if (!text) { + // emscripten sets empty string as status after "Running..." + // per timeout, but another status may have been set by then + if (Presentation.setStatus.lastText === "Running...") { + Presentation.setStatusVisible(false); + onLoaded(); + } } else { - Presentation.setStatusVisible(true); + Presentation.setStatus.lastText = text; statusElement.innerHTML = text; + Presentation.setStatusVisible(true); } }, goFullscreen: function goFullscreen() { @@ -226,6 +234,8 @@ } }; + window.onerror = function(event) { presentation.setStatus("Failure during start-up, see JavaScript console") }; + if ($GODOT_CONTROLS_ENABLED) { // controls enabled (function() { var controlsElement = document.getElementById("controls"); @@ -250,6 +260,13 @@ outputElement.scrollTop = outputElement.scrollHeight; // focus on bottom }; })(); + + presentation.postRun.push(function() { + window.onerror = function(event) { presentation.print("**EXCEPTION**:", event) }; + }); + + } else { + presentation.postRun.push(function() { window.onerror = null; }); } return presentation; @@ -274,6 +291,11 @@ } })(); + var postRun = []; + if (typeof Presentation !== "undefined" && Presentation.postRun instanceof Array) { + postRun = Presentation.postRun; + } + var canvas = (function() { var canvasElement = document.getElementById("canvas"); @@ -318,9 +340,9 @@ })(); return { - TOTAL_MEMORY: 268435456, + TOTAL_MEMORY: $GODOT_TMEM, preRun: [], - postRun: [], + postRun: postRun, print: print, printErr: function printErr(text) { if (arguments.length > 1) @@ -343,13 +365,6 @@ Presentation.setStatus("Downloading..."); - window.onerror = function(event) { - // TODO: do not warn on ok events like simulating an infinite loop or exitStatus - Module.setStatus("Exception thrown, see JavaScript console"); - Module.setStatus = function(text) { - if (text) Module.printErr("[post-exception status] " + text); - }; - }; //]]></script> <script type="text/javascript" src="$GODOT_FS"></script> <script> |
