8000 resize display if viewport changes · GameJs/gamejs@03ccc0b · GitHub
[go: up one dir, main page]

Skip to content

Commit 03ccc0b

Browse files
committed
resize display if viewport changes
1 parent d222776 commit 03ccc0b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/gamejs/display.js

+8
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ exports.hasPointerLock = function() {
127127
document.mozFullScreenElement);
128128
};
129129

130+
function onResize(event) {
131+
var canvas = getCanvas();
132+
SURFACE._canvas.width = canvas.clientWidth;
133+
SURFACE._canvas.height = canvas.clientHeight;
134+
}
135+
130136
/**
131137
* Create the master Canvas plane.
132138
* @ignore
@@ -144,6 +150,8 @@ exports.init = function() {
144150
if ($loader) {
145151
$loader.style.display = "none";
146152
}
153+
// hook into resize
154+
window.addEventListener("resize", onResize, false);
147155
return;
148156
};
149157

0 commit comments

Comments
 (0)
0