Guest User

Firefox Wayland PointerLock Crash

a guest
Jan 9th, 2023
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title></title>
  4. </head>
  5. <body>
  6. <canvas id="canvas" style="width: 300px; height: 300px;" onclick=toggle()></canvas>
  7. <script>
  8. const canvas = document.getElementById("canvas");
  9. const ctx = canvas.getContext("2d");
  10. ctx.fillStyle = "black";
  11. ctx.fillRect(0, 0, 300, 300);
  12.  
  13. var locked = false;
  14. function toggle() {
  15. console.log("hullo");
  16. if(locked) {
  17. document.exitPointerLock();
  18. } else {
  19. canvas.requestPointerLock();
  20. //canvas.requestPointerLock(); //uncomment for crash
  21. }
  22. locked = !locked;
  23. }
  24. </script>
  25. </body>
  26. </html>
Advertisement
Add Comment
Please, Sign In to add comment