Skip to content

Commit 85161eb

Browse files
committed
Restore to earlier shell code to get default fullscreen content.
1 parent 6dda4e5 commit 85161eb

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

samples/shell.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,39 @@
1212

1313
var canvas = document.querySelector('canvas');
1414

15+
function resizeCanvas() {
16+
canvas.style.width = window.innerWidth + 'px';
17+
canvas.style.height = window.innerHeight + 'px';
18+
if (!canvas.isOffscreen) {
19+
canvas.width = Math.round(window.innerWidth * window.devicePixelRatio);
20+
canvas.height = Math.round(window.innerHeight * window.devicePixelRatio);
21+
}
22+
if (window.resizeCallback) {
23+
getWasmTableEntry(window.resizeCallback)();
24+
}
25+
}
26+
27+
if (!location.search.includes('windowed')) {
28+
resizeCanvas();
29+
onresize = resizeCanvas;
30+
}
31+
32+
if (location.search.includes('thumbnail')) {
33+
// Save the canvas to file when clicking on it.
34+
// Not working: https://bugs.chromium.org/p/chromium/issues/detail?id=1175665
35+
canvas.onclick = function() {
36+
var img = canvas.toDataURL("image/png");
37+
var a = document.createElement('a');
38+
a.href = img;
39+
a.download = 'canvas.png';
40+
a.click();
41+
}
42+
}
43+
44+
#if WASM == 2
45+
var supportsWasm = window.WebAssembly && location.search.indexOf('_rwasm=0') < 0;
46+
#endif
47+
1548
// Depending on the build flags that one uses, different files need to be downloaded
1649
// to load the compiled page. The right set of files will be expanded to be downloaded
1750
// via the directive below.

0 commit comments

Comments
 (0)