diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-09-17 14:01:21 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-09-17 14:01:21 -0700 |
commit | 5edb805b8021b8a0cc53ab6e9f0ef92829ffcd26 (patch) | |
tree | 6da04fcb079be36108c9c2808d2a24c9ba3e79a5 | |
parent | 83c05137e967774b05156f3754f8314c40e682d4 (diff) |
fix fullscreen/pointer lock events in shell replay
-rw-r--r-- | tools/reproduceriter_shell.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/reproduceriter_shell.js b/tools/reproduceriter_shell.js index 50824650..4221a940 100644 --- a/tools/reproduceriter_shell.js +++ b/tools/reproduceriter_shell.js @@ -86,7 +86,8 @@ var document = { getElementById: function(id) { switch(id) { case 'canvas': { - return { + if (this.canvas) return this.canvas; + return this.canvas = { getContext: function(which) { switch(which) { case 'experimental-webgl': { @@ -670,18 +671,23 @@ var document = { } }, requestPointerLock: function() { - document.callEventListeners('pointerlockchange'); + document.pointerLockElement = document.getElementById('canvas'); + window.setTimeout(function() { + document.callEventListeners('pointerlockchange'); + }); }, style: {}, eventListeners: {}, addEventListener: document.addEventListener, callEventListeners: document.callEventListeners, requestFullScreen: function() { - var that = this; + document.fullscreenElement = document.getElementById('canvas'); window.setTimeout(function() { - that.callEventListeners('fullscreenchange'); + document.callEventListeners('fullscreenchange'); }); }, + offsetTop: 0, + offsetLeft: 0, }; } case 'status-text': case 'progress': { |