prevent from constantly pressing the escape key when user quits or reloads the web browser so that the menu wont toggle each time ingame
This commit is contained in:
+6
-3
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-18299227566"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
gtag('config', 'AW-18299227566');
|
||||
</script>
|
||||
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>CSS Stream</title>
|
||||
@@ -598,7 +597,11 @@
|
||||
if (e.key === '"') { e.preventDefault(); return; }
|
||||
if (e.key === 'F11') { e.preventDefault(); return; }
|
||||
if (e.key === 'Escape') {
|
||||
if (isControlling) {
|
||||
// If pointer is locked, Escape releases pointer lock — don't also
|
||||
// forward it to the game or it opens the in-game escape menu.
|
||||
// Only forward Escape when pointer is already unlocked (user is
|
||||
// navigating the in-game menu with mouse released).
|
||||
if (isControlling && !pointerLocked) {
|
||||
sendInput({ type: 'key_down', key: 'Escape' });
|
||||
sendInput({ type: 'key_up', key: 'Escape' });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user