1
0

Scaling correctly

Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
James Ketrenos 2022-02-04 15:56:54 -08:00
parent 38c6f4069d
commit 0151b76e38

View File

@ -323,16 +323,18 @@ const Board = ({ game }) => {
} }
/* Adjust the 'transform: scale' for the BoardBox /* 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'); const board = document.querySelector('.Board');
if (board) { if (board) {
const width = board.offsetWidth, const width = board.offsetWidth,
height = board.offsetHeight; height = board.offsetHeight;
let _transform; let _transform;
if (width * hexRatio > height) { if (height * hexRatio > width) {
_transform = height / (450. * hexRatio);
} else {
_transform = width / (450. * hexRatio); _transform = width / (450. * hexRatio);
} else {
_transform = height / (450.);
} }
if (_transform !== transform) { if (_transform !== transform) {
const boardBox = board.querySelector('.BoardBox'); const boardBox = board.querySelector('.BoardBox');