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 <style type="text/css"> | 5 <style type="text/css"> |
6 #HTMLCursor { | 6 #HTMLCursor { |
7 border: solid black 1px; | 7 border: solid black 1px; |
8 background: yellow; | 8 background: yellow; |
9 display: inline; | 9 display: inline; |
10 position: absolute; | 10 position: absolute; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 console.log("lock success"); | 58 console.log("lock success"); |
59 lock_result = "success" | 59 lock_result = "success" |
60 }, | 60 }, |
61 function() { | 61 function() { |
62 console.log("lock failed"); | 62 console.log("lock failed"); |
63 lock_result = "failure" | 63 lock_result = "failure" |
64 } | 64 } |
65 ); | 65 ); |
66 } | 66 } |
67 | 67 |
68 // When mouse lock is initiated and accepted, PyAuto test | |
Nirnimesh
2012/06/18 18:31:59
early line break. Move some text from next line to
dyu1
2012/06/18 22:04:41
Done.
| |
69 // will wait for the lock_result to return "success" or "failure" to initiate | |
70 // the next action. | |
68 function lockMouse2() { | 71 function lockMouse2() { |
69 console.log("lockMouse2()"); | 72 console.log("lockMouse2()"); |
70 navigator.webkitPointer.lock(document.getElementById("lockTarget2"), | 73 navigator.webkitPointer.lock(document.getElementById("lockTarget2"), |
71 function(){console.log("lock success")}, | 74 function() { |
72 function(){console.log("lock failed")}); | 75 console.log("lock success"); |
76 lock_result = "success" | |
77 }, | |
78 function() { | |
79 console.log("lock failed") | |
80 lock_result = "failure" | |
81 } | |
82 ); | |
73 } | 83 } |
74 | 84 |
75 function delayedLockMouse1() { | 85 function delayedLockMouse1() { |
76 console.log("delayedLockMouse1()"); | 86 console.log("delayedLockMouse1()"); |
77 window.setTimeout(lockMouse1, 1010); | 87 window.setTimeout(lockMouse1, 1010); |
78 // Delay must be over 1 second or the click that initiated the delayed action | 88 // Delay must be over 1 second or the click that initiated the delayed action |
79 // may still be considered active and treat this as a user gesture. | 89 // may still be considered active and treat this as a user gesture. |
80 // We want to test a lock not associated with a user gesture. | 90 // We want to test a lock not associated with a user gesture. |
81 } | 91 } |
82 | 92 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 case "1": lockMouse1(); break; | 170 case "1": lockMouse1(); break; |
161 case "2": lockMouse2(); break; | 171 case "2": lockMouse2(); break; |
162 case "d": delayedLockMouse1(); break; | 172 case "d": delayedLockMouse1(); break; |
163 case "u": unlockMouse(); break; | 173 case "u": unlockMouse(); break; |
164 case "b": enterFullscreenAndLockMouse1(); break; | 174 case "b": enterFullscreenAndLockMouse1(); break; |
165 case "B": lockMouse1AndEnterFullscreen(); break; | 175 case "B": lockMouse1AndEnterFullscreen(); break; |
166 default: moveHTMLCursorToCenter(); break; | 176 default: moveHTMLCursorToCenter(); break; |
167 } | 177 } |
168 }); | 178 }); |
169 } | 179 } |
180 | |
170 </script> | 181 </script> |
171 </head> | 182 </head> |
172 <body onload="init()" title="This tooltip should not be shown if the mouse is lo cked."> | 183 <body onload="init()" title="This tooltip should not be shown if the mouse is lo cked."> |
173 <div id="container"> | 184 <div id="container"> |
174 <button id="enterFullscreen" onclick="enterFullscreen();">enterFullscreen() [f]</button><br> | 185 <button id="enterFullscreen" onclick="enterFullscreen();">enterFullscreen() [f]</button><br> |
175 <button id="exitFullscreen" onclick="exitFullscreen();">exitFullscreen() [x] </button><br> | 186 <button id="exitFullscreen" onclick="exitFullscreen();">exitFullscreen() [x] </button><br> |
176 <button id="lockMouse1" onclick="lockMouse1();">lockMouse1() [1]</button><br > | 187 <button id="lockMouse1" onclick="lockMouse1();">lockMouse1() [1]</button><br > |
177 <button id="lockMouse2" onclick="lockMouse2();">lockMouse2() [2]</button><br > | 188 <button id="lockMouse2" onclick="lockMouse2();">lockMouse2() [2]</button><br > |
178 <button id="delayedLockMouse1" onclick="delayedLockMouse1();">delayedLockMou se1() [d]</button><br> | 189 <button id="delayedLockMouse1" onclick="delayedLockMouse1();">delayedLockMou se1() [d]</button><br> |
179 <button id="spamLockMouse2" onclick="spamLockMouse2();">spamLockMouse2()</bu tton><br> | 190 <button id="spamLockMouse2" onclick="spamLockMouse2();">spamLockMouse2()</bu tton><br> |
180 <button id="unlockMouse" onclick="unlockMouse();">unlockMouse() [u]</button> <br> | 191 <button id="unlockMouse" onclick="unlockMouse();">unlockMouse() [u]</button> <br> |
181 <button id="enterFullscreenAndLockMouse1" onclick="enterFullscreenAndLockMou se1()">enterFullscreenAndLockMouse1() [b]</button><br> | 192 <button id="enterFullscreenAndLockMouse1" onclick="enterFullscreenAndLockMou se1()">enterFullscreenAndLockMouse1() [b]</button><br> |
182 <button id="lockMouse1AndEnterFullscreen" onclick="lockMouse1AndEnterFullscr een()">lockMouse1AndEnterFullscreen() [B]</button><br> | 193 <button id="lockMouse1AndEnterFullscreen" onclick="lockMouse1AndEnterFullscr een()">lockMouse1AndEnterFullscreen() [B]</button><br> |
183 <div id="lockTarget1">lockTarget1</div> | 194 <div id="lockTarget1">lockTarget1</div> |
184 <div id="lockTarget2">lockTarget2</div> | 195 <div id="lockTarget2">lockTarget2</div> |
185 <form name="HTMLCursor" id="HTMLCursor">HTMLCursor</form> | 196 <form name="HTMLCursor" id="HTMLCursor">HTMLCursor</form> |
186 <form name="displaytext">...</form> | 197 <form name="displaytext">...</form> |
198 <p>The <a href="#anchor" name="anchor" id="anchor">anchor link</a> navigates to | |
199 an anchor on this page. The browser should not exit tab fullscreen or mouse lock.</p> | |
187 </div> | 200 </div> |
188 This text is outside of the container that is made fullscreen. This text shoul d not be visible when fullscreen. | 201 <p>This text is outside of the container that is made fullscreen. This text sh ould not be visible when fullscreen.</p> |
189 </body> | 202 </body> |
190 </html> | 203 </html> |
OLD | NEW |