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 1f7d4c4d0e
)
This commit is contained in:
parent
5aac8eeb0f
commit
e4bbc1067a
|
@ -81,6 +81,7 @@
|
||||||
* calculate cursor coordinates correctly */
|
* calculate cursor coordinates correctly */
|
||||||
border: 0 none;
|
border: 0 none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,6 +102,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#status {
|
#status {
|
||||||
|
cursor: pointer;
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
padding: 4px 6px;
|
padding: 4px 6px;
|
||||||
}
|
}
|
||||||
|
@ -206,6 +208,7 @@
|
||||||
var presentation = {
|
var presentation = {
|
||||||
statusElement: statusElement,
|
statusElement: statusElement,
|
||||||
outputElement: outputElement,
|
outputElement: outputElement,
|
||||||
|
postRun: [],
|
||||||
setOutputVisible: function setOutputVisible(visible) {
|
setOutputVisible: function setOutputVisible(visible) {
|
||||||
outputElement.style.display = (visible?"block":"none");
|
outputElement.style.display = (visible?"block":"none");
|
||||||
},
|
},
|
||||||
|
@ -213,12 +216,17 @@
|
||||||
statusElement.style.visibility = (visible?"visible":"hidden");
|
statusElement.style.visibility = (visible?"visible":"hidden");
|
||||||
},
|
},
|
||||||
setStatus: function setStatus(text) {
|
setStatus: function setStatus(text) {
|
||||||
if (!text || text.length === 0) {
|
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);
|
Presentation.setStatusVisible(false);
|
||||||
onLoaded();
|
onLoaded();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Presentation.setStatusVisible(true);
|
Presentation.setStatus.lastText = text;
|
||||||
statusElement.innerHTML = text;
|
statusElement.innerHTML = text;
|
||||||
|
Presentation.setStatusVisible(true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
goFullscreen: function goFullscreen() {
|
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
|
if ($GODOT_CONTROLS_ENABLED) { // controls enabled
|
||||||
(function() {
|
(function() {
|
||||||
var controlsElement = document.getElementById("controls");
|
var controlsElement = document.getElementById("controls");
|
||||||
|
@ -250,6 +260,13 @@
|
||||||
outputElement.scrollTop = outputElement.scrollHeight; // focus on bottom
|
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;
|
return presentation;
|
||||||
|
@ -274,6 +291,11 @@
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
var postRun = [];
|
||||||
|
if (typeof Presentation !== "undefined" && Presentation.postRun instanceof Array) {
|
||||||
|
postRun = Presentation.postRun;
|
||||||
|
}
|
||||||
|
|
||||||
var canvas = (function() {
|
var canvas = (function() {
|
||||||
var canvasElement = document.getElementById("canvas");
|
var canvasElement = document.getElementById("canvas");
|
||||||
|
|
||||||
|
@ -318,9 +340,9 @@
|
||||||
})();
|
})();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
TOTAL_MEMORY: 268435456,
|
TOTAL_MEMORY: $GODOT_TMEM,
|
||||||
preRun: [],
|
preRun: [],
|
||||||
postRun: [],
|
postRun: postRun,
|
||||||
print: print,
|
print: print,
|
||||||
printErr: function printErr(text) {
|
printErr: function printErr(text) {
|
||||||
if (arguments.length > 1)
|
if (arguments.length > 1)
|
||||||
|
@ -343,13 +365,6 @@
|
||||||
|
|
||||||
Presentation.setStatus("Downloading...");
|
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>
|
||||||
<script type="text/javascript" src="$GODOT_FS"></script>
|
<script type="text/javascript" src="$GODOT_FS"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
Loading…
Reference in New Issue