<template lang="pug">
-div#baseGame(tabindex=-1 @click="() => focusBg()" @keydown="handleKeys")
+div#baseGame(tabindex=-1 @click="() => focusBg()"
+ @keydown="handleKeys" @wheel="handleScroll")
input#modalEog.modal(type="checkbox")
- div(role="dialog" aria-labelledby="eogMessage")
+ div(role="dialog" data-checkbox="modalEog" aria-labelledby="eogMessage")
.card.smallpad.small-modal.text-center
label.modal-close(for="modalEog")
h3#eogMessage.section {{ endgameMessage }}
this.re_setVariables();
},
mounted: function() {
- const boardSize = localStorage.getItem("boardSize");
- if (!!boardSize)
- document.getElementById("boardContainer").style.width = boardSize + "px";
+ // Take full width on small screens:
+ let boardSize = parseInt(localStorage.getItem("boardSize"));
+ if (!boardSize)
+ {
+ boardSize = (window.innerWidth >= 768
+ ? Math.min(600, 0.5*window.innerWidth) //heuristic...
+ : window.innerWidth);
+ }
+ const movesWidth = (window.innerWidth >= 768 ? 280 : 0);
+ document.getElementById("boardContainer").style.width = boardSize + "px";
+ let gameContainer = document.getElementById("gameContainer");
+ gameContainer.style.width = (boardSize + movesWidth) + "px";
},
methods: {
focusBg: function() {
break;
}
},
+ handleScroll: function(e) {
+ if (e.deltaY < 0)
+ this.undo();
+ else if (e.deltaY > 0)
+ this.play();
+ },
re_setVariables: function() {
this.endgameMessage = "";
this.orientation = this.game.mycolor || "w"; //default orientation for observed games
#movesList
width: 280px
float: left
-
-.clearer
- clear: both
+@media screen and (max-width: 767px)
+ #movesList
+ width: 100%
+ float: none
+ clear: both
+ table
+ tr
+ display: flex
+ margin: 0
+ padding: 0
+ td
+ text-align: left
</style>