diff options
| author | Rémi Verschelde | 2017-01-16 20:13:19 +0100 |
|---|---|---|
| committer | GitHub | 2017-01-16 20:13:19 +0100 |
| commit | 23789f49dd2f405e68ac3e9c032146a551910e67 (patch) | |
| tree | cea065328320eb7a84aca7b47c7eaee794da4d78 /tools | |
| parent | 5aac8eeb0f2f207b3b3e39440cfec89b568500ce (diff) | |
| parent | e4bbc1067a033c44f65091590408ad22cf41a4d5 (diff) | |
| download | godot-23789f49dd2f405e68ac3e9c032146a551910e67.tar.gz godot-23789f49dd2f405e68ac3e9c032146a551910e67.tar.zst godot-23789f49dd2f405e68ac3e9c032146a551910e67.zip | |
Merge pull request #7561 from eska014/web-presentation-2.1
Cherry-pick usability fixes in web export presentation
[ci skip]
Diffstat (limited to 'tools')
| -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> |
