From 0151b76e3847419ba57195d67c703a98b604808d Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Fri, 4 Feb 2022 15:56:54 -0800 Subject: [PATCH] Scaling correctly Signed-off-by: James Ketrenos --- client/src/Board.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/client/src/Board.js b/client/src/Board.js index 3ac061d..832c356 100644 --- a/client/src/Board.js +++ b/client/src/Board.js @@ -323,16 +323,18 @@ const Board = ({ game }) => { } /* Adjust the 'transform: scale' for the BoardBox - * so the board fills the Board */ + * so the board fills the Board + * + * The board is H tall, and H * hexRatio wide */ const board = document.querySelector('.Board'); if (board) { const width = board.offsetWidth, height = board.offsetHeight; let _transform; - if (width * hexRatio > height) { - _transform = height / (450. * hexRatio); - } else { + if (height * hexRatio > width) { _transform = width / (450. * hexRatio); + } else { + _transform = height / (450.); } if (_transform !== transform) { const boardBox = board.querySelector('.BoardBox');