Scaling correctly
Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
parent
38c6f4069d
commit
0151b76e38
@ -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');
|
||||
|
Loading…
x
Reference in New Issue
Block a user