aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-05-05 21:00:10 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-05-05 21:00:10 -0700
commit344966e5243351edd969057738807593d3e266a8 (patch)
tree6c53d388305fead9e2280f32ddf0c83b3aca20b4 /src
parent747ab04f3992b120d279b9e2cbe9f6b507afd86c (diff)
fix fullscreen for closure
Diffstat (limited to 'src')
-rw-r--r--src/library_browser.js36
-rw-r--r--src/shell.html2
2 files changed, 19 insertions, 19 deletions
diff --git a/src/library_browser.js b/src/library_browser.js
index 71b8ffdf..055cea04 100644
--- a/src/library_browser.js
+++ b/src/library_browser.js
@@ -75,12 +75,12 @@ mergeInto(LibraryManager.library, {
requestFullScreen: function() {
var canvas = Module.canvas;
function fullScreenChange() {
- if (document.webkitFullScreenElement === canvas ||
- document.mozFullScreenElement === canvas ||
- document.fullScreenElement === canvas) {
- canvas.requestPointerLock = canvas.requestPointerLock ||
- canvas.mozRequestPointerLock ||
- canvas.webkitRequestPointerLock;
+ if (document['webkitFullScreenElement'] === canvas ||
+ document['mozFullScreenElement'] === canvas ||
+ document['fullScreenElement'] === canvas) {
+ canvas.requestPointerLock = canvas['requestPointerLock'] ||
+ canvas['mozRequestPointerLock'] ||
+ canvas['webkitRequestPointerLock'];
canvas.requestPointerLock();
}
}
@@ -90,18 +90,18 @@ mergeInto(LibraryManager.library, {
document.addEventListener('webkitfullscreenchange', fullScreenChange, false);
function pointerLockChange() {
- Browser.pointerLock = document.pointerLockElement === canvas ||
- document.mozPointerLockElement === canvas ||
- document.webkitPointerLockElement === canvas;
+ Browser.pointerLock = document['pointerLockElement'] === canvas ||
+ document['mozPointerLockElement'] === canvas ||
+ document['webkitPointerLockElement'] === canvas;
}
document.addEventListener('pointerlockchange', pointerLockChange, false);
document.addEventListener('mozpointerlockchange', pointerLockChange, false);
document.addEventListener('webkitpointerlockchange', pointerLockChange, false);
- canvas.requestFullScreen = canvas.requestFullScreen ||
- canvas.mozRequestFullScreen ||
- canvas.webkitRequestFullScreen;
+ canvas.requestFullScreen = canvas['requestFullScreen'] ||
+ canvas['mozRequestFullScreen'] ||
+ canvas['webkitRequestFullScreen'];
canvas.requestFullScreen();
},
@@ -119,17 +119,17 @@ mergeInto(LibraryManager.library, {
getMovementX: function(delta, event) {
if (!Browser.pointerLock) return delta;
- return event.movementX ||
- event.mozMovementX ||
- event.webkitMovementX ||
+ return event['movementX'] ||
+ event['mozMovementX'] ||
+ event['webkitMovementX'] ||
0; // delta;
},
getMovementY: function(delta, event) {
if (!Browser.pointerLock) return delta;
- return event.movementY ||
- event.mozMovementY ||
- event.webkitMovementY ||
+ return event['movementY'] ||
+ event['mozMovementY'] ||
+ event['webkitMovementY'] ||
0; // delta;
},
diff --git a/src/shell.html b/src/shell.html
index 4a1cb59c..bf81c971 100644
--- a/src/shell.html
+++ b/src/shell.html
@@ -14,7 +14,7 @@
<body>
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
<ht/>
- <div class="emscripten"><input type="button" value="fullscreen" onclick="Browser.requestFullScreen()"></div>
+ <div class="emscripten"><input type="button" value="fullscreen" onclick="Module.requestFullScreen()"></div>
<hr/>
<textarea class="emscripten" id="output" rows="8"></textarea>
<hr>