X-Git-Url: https://git.auder.net/?a=blobdiff_plain;ds=sidebyside;f=client%2Fsrc%2Fcomponents%2FSettings.vue;h=5d038865c380be2792ca081812f6da60cd137447;hb=96e9585a39ca3ccef59c701b3f7ac3809692ca73;hp=5541cf372f67db80f2987d083d646138f3e18744;hpb=cf94b843f223b34fd2f3680112a183f6d5cd409c;p=vchess.git diff --git a/client/src/components/Settings.vue b/client/src/components/Settings.vue index 5541cf37..5d038865 100644 --- a/client/src/components/Settings.vue +++ b/client/src/components/Settings.vue @@ -65,10 +65,11 @@ export default { if (!boardContainer) return; //no board on page const k = document.getElementById("myRange").value; - const movesWidth = 280; //TODO: constant somewhere...; + const movesWidth = (window.innerWidth >= 768 ? 280 : 0); //TODO: constant somewhere...; const minBoardWidth = 240; //TODO: same - // Value of 0 is board min size; 100 is screen.width - movesWidth - const boardSize = k * (screen.width - (movesWidth+minBoardWidth)) / 100 + minBoardWidth; + // Value of 0 is board min size; 100 is window.width [- movesWidth] + const boardSize = minBoardWidth + + k * (window.innerWidth - (movesWidth+minBoardWidth)) / 100; localStorage.setItem("boardSize", boardSize); boardContainer.style.width = boardSize + "px"; document.getElementById("gameContainer").style.width = (boardSize + movesWidth) + "px";