OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Fullscreen and Mouse Lock Scripts</title> | 4 <title>Fullscreen and Mouse Lock Scripts</title> |
5 <script type="text/javascript"> | 5 <script type="text/javascript"> |
6 | 6 |
7 function enterFullscreen() { | 7 function enterFullscreen() { |
8 console.log("enterFullscreen()"); | 8 console.log("enterFullscreen()"); |
9 document.getElementById('container').webkitRequestFullScreen( | 9 document.getElementById('container').webkitRequestFullScreen( |
10 Element.ALLOW_KEYBOARD_INPUT); | 10 Element.ALLOW_KEYBOARD_INPUT); |
11 } | 11 } |
12 | 12 |
13 function exitFullscreen() { | 13 function exitFullscreen() { |
14 console.log("exitFullscreen()"); | 14 console.log("exitFullscreen()"); |
15 document.webkitCancelFullScreen(); | 15 document.webkitCancelFullScreen(); |
16 } | 16 } |
17 | 17 |
18 function lockMouse1() { | 18 //Wait for notification from JS, then notify test of success or failure |
19 //callback that the click has registered and the mouse lock state has changed. | |
dennis_jeffrey
2012/04/23 19:42:38
add a space right after the // in each of the abov
dyu1
2012/04/23 22:31:22
Done.
| |
20 function lockMouse1(callback) { | |
19 console.log("lockMouse1()"); | 21 console.log("lockMouse1()"); |
20 navigator.webkitPointer.lock(document.getElementById("lockTarget1"), | 22 navigator.webkitPointer.lock(document.getElementById("lockTarget1"), |
21 function(){console.log("lock success")}, | 23 function() { |
22 function(){console.log("lock failed")}); | 24 console.log("lock success") |
dennis_jeffrey
2012/04/23 19:42:38
semicolon
dyu1
2012/04/23 22:31:22
Done.
| |
25 if (callback) { | |
26 callback("success"); | |
27 } | |
28 }, | |
29 function() { | |
30 console.log("lock failed") | |
dennis_jeffrey
2012/04/23 19:42:38
semicolon
dyu1
2012/04/23 22:31:22
Done.
| |
31 if (callback) { | |
32 callback("failure"); | |
33 } | |
34 } | |
35 ); | |
23 } | 36 } |
24 | 37 |
25 function lockMouse2() { | 38 function lockMouse2() { |
26 console.log("lockMouse2()"); | 39 console.log("lockMouse2()"); |
27 navigator.webkitPointer.lock(document.getElementById("lockTarget2"), | 40 navigator.webkitPointer.lock(document.getElementById("lockTarget2"), |
28 function(){console.log("lock success")}, | 41 function(){console.log("lock success")}, |
29 function(){console.log("lock failed")}); | 42 function(){console.log("lock failed")}); |
30 } | 43 } |
31 | 44 |
32 function delayedLockMouse1() { | 45 function delayedLockMouse1() { |
(...skipping 18 matching lines...) Expand all Loading... | |
51 console.log("enterFullscreenAndLockMouse1()"); | 64 console.log("enterFullscreenAndLockMouse1()"); |
52 enterFullscreen(); | 65 enterFullscreen(); |
53 lockMouse1(); | 66 lockMouse1(); |
54 } | 67 } |
55 | 68 |
56 function lockMouse1AndEnterFullscreen() { | 69 function lockMouse1AndEnterFullscreen() { |
57 console.log("lockMouse1AndEnterFullscreen()"); | 70 console.log("lockMouse1AndEnterFullscreen()"); |
58 lockMouse1(); | 71 lockMouse1(); |
59 enterFullscreen(); | 72 enterFullscreen(); |
60 } | 73 } |
74 | |
61 </script> | 75 </script> |
62 </head> | 76 </head> |
63 <body title="This tooltip should not be shown if the mouse is locked."> | 77 <body title="This tooltip should not be shown if the mouse is locked."> |
64 <div id="container"> | 78 <div id="container"> |
65 <button id="enterFullscreen" onclick="enterFullscreen();">enterFullscreen()< /button><br> | 79 <button id="enterFullscreen" onclick="enterFullscreen();">enterFullscreen()< /button><br> |
66 <button id="exitFullscreen" onclick="exitFullscreen();">exitFullscreen()</bu tton><br> | 80 <button id="exitFullscreen" onclick="exitFullscreen();">exitFullscreen()</bu tton><br> |
67 <button id="lockMouse1" onclick="lockMouse1();">lockMouse1()</button><br> | 81 <button id="lockMouse1" onclick="lockMouse1();">lockMouse1()</button><br> |
68 <button id="lockMouse2" onclick="lockMouse2();">lockMouse2()</button><br> | 82 <button id="lockMouse2" onclick="lockMouse2();">lockMouse2()</button><br> |
69 <button id="delayedLockMouse1" onclick="delayedLockMouse1();">delayedLockMou se1()</button><br> | 83 <button id="delayedLockMouse1" onclick="delayedLockMouse1();">delayedLockMou se1()</button><br> |
70 <button id="spamLockMouse2" onclick="spamLockMouse2();">spamLockMouse2()</bu tton><br> | 84 <button id="spamLockMouse2" onclick="spamLockMouse2();">spamLockMouse2()</bu tton><br> |
71 <button id="unlockMouse" onclick="unlockMouse();">unlockMouse()</button><br> | 85 <button id="unlockMouse" onclick="unlockMouse();">unlockMouse()</button><br> |
72 <button id="enterFullscreenAndLockMouse1" onclick="enterFullscreenAndLockMou se1()">enterFullscreenAndLockMouse1()</button><br> | 86 <button id="enterFullscreenAndLockMouse1" onclick="enterFullscreenAndLockMou se1()">enterFullscreenAndLockMouse1()</button><br> |
73 <button id="lockMouse1AndEnterFullscreen" onclick="lockMouse1AndEnterFullscr een()">lockMouse1AndEnterFullscreen()</button><br> | 87 <button id="lockMouse1AndEnterFullscreen" onclick="lockMouse1AndEnterFullscr een()">lockMouse1AndEnterFullscreen()</button><br> |
88 <button id="cancelFullscreen" onclick="cancelFullscreen()">cancelFullscreen( )</button><br> | |
scheib
2012/04/23 20:08:20
This seems redundant with exitFullscreen().
dyu1
2012/04/23 22:31:22
Done.
| |
74 <div id="lockTarget1">lockTarget1</div> | 89 <div id="lockTarget1">lockTarget1</div> |
75 <div id="lockTarget2">lockTarget2</div> | 90 <div id="lockTarget2">lockTarget2</div> |
76 </div> | 91 </div> |
77 This text is outside of the container that is made fullscreen. This text shoul d not be visible when fullscreen. | 92 This text is outside of the container that is made fullscreen. This text shoul d not be visible when fullscreen. |
78 </body> | 93 </body> |
79 </html> | 94 </html> |
80 </html> | 95 </html> |
OLD | NEW |