Skip to content

Commit 954f7e2

Browse files
Emscripten: Modify window resize handling in HTML template
1 parent 6fbeac2 commit 954f7e2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

SampleBase/src/Emscripten/resources/emscripten_template.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,11 @@
5454
canvas: (function () {
5555
var dpr = window.devicePixelRatio;
5656
var canvas = document.getElementById('canvas');
57-
canvas.width = Math.ceil(dpr * window.innerWidth);
58-
canvas.height = Math.ceil(dpr * window.innerHeight);
59-
window.addEventListener("resize", function () {
57+
58+
window.onload = function () {
6059
canvas.width = Math.ceil(dpr * window.innerWidth);
6160
canvas.height = Math.ceil(dpr * window.innerHeight);
62-
});
61+
};
6362
canvas.addEventListener("webglcontextlost", function(e) { alert('FIXME: WebGL context lost, please reload the page'); e.preventDefault(); }, false);
6463
return canvas;
6564
})(),

0 commit comments

Comments
 (0)