changed default behavior of arrows in game

+ small css improvments in game
This commit is contained in:
simplonco
2023-01-14 21:34:53 +01:00
parent 888255c810
commit a060ddf4e9
3 changed files with 17 additions and 4 deletions

View File

@@ -13,6 +13,8 @@ body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
/* tmp? */
background: bisque;
display: flex;
flex-direction: column;
}
a {

View File

@@ -348,11 +348,16 @@
}
#game_page {
margin: 0;
padding: 20px;
background-color: #222425;
position: relative;
width: 100%;
height: 100%;
height: auto;
display: flex;
flex-direction: column;
flex-grow: 1;
}
#game_option {
margin-top: 20px;
}
#canvas_container {
margin-top: 20px;

View File

@@ -59,14 +59,20 @@ function start_after_countdown()
abortControllerKeydown = new AbortController();
window.addEventListener(
'keydown',
(e) => { pong.addKey(e.key); },
(e) => {
e.preventDefault();
pong.addKey(e.key);
},
{signal: abortControllerKeydown.signal}
);
abortControllerKeyup = new AbortController();
window.addEventListener(
'keyup',
(e) => { pong.deleteKey(e.key); },
(e) => {
e.preventDefault();
pong.deleteKey(e.key);
},
{signal: abortControllerKeyup.signal}
);