From 944eb078a320a28ee27c7574adb1acfe990ed0c1 Mon Sep 17 00:00:00 2001 From: Karl Bartel Date: Sun, 27 Apr 2014 21:50:32 +0200 Subject: [PATCH] take border into account when calculating squareSize --- js/chessboard.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/chessboard.js b/js/chessboard.js index 5b2efd0d..633b6006 100644 --- a/js/chessboard.js +++ b/js/chessboard.js @@ -495,9 +495,9 @@ function expandConfig() { // calculates square size based on the width of the container // got a little CSS black magic here, so let me explain: -// get the width of the container element (could be anything), reduce by 1 for -// fudge factor, and then keep reducing until we find an exact mod 8 for -// our square size +// get the width of the container element (could be anything), reduce by border +// size, and then keep reducing until we find an exact mod 8 for our square +// size function calculateSquareSize() { var containerWidth = parseInt(containerEl.css('width'), 10); @@ -507,7 +507,7 @@ function calculateSquareSize() { } // pad one pixel - var boardWidth = containerWidth - 1; + var boardWidth = containerWidth - BOARD_BORDER_SIZE * 2; while (boardWidth % 8 !== 0 && boardWidth > 0) { boardWidth--;