oakmac / chessboardjs

JavaScript chessboard
https://chessboardjs.com
MIT License
2.01k stars 408 forks source link

board.resize only works when width changes #166

Open aditya1709 opened 5 years ago

aditya1709 commented 5 years ago

board.resize only works when width changes, but when the height of the browser window changes the chess board is not resized. Is there a way to achieve this?

arcsinw commented 5 years ago

maybe you can call board.resize() manually when windows's size changed

dax006 commented 5 years ago

it does resize on every window resize - but its calculations are based solely on width. You have to make it check for height in calculateSquareSize()

So where it says: var containerWidth = parseInt(elWidth, 10); You have to do something like

  var containerHeight = parseInt(elHeight, 10);
containerWidth = Math.min(containerWidth,containerHeight);