From: Benjamin Auder Date: Mon, 19 Apr 2021 13:26:27 +0000 (+0200) Subject: Fix squares colors on diagrams X-Git-Url: https://git.auder.net/img/css/pieces/mini-custom.min.css?a=commitdiff_plain;h=7b6306a8f359821b352995f5b9a27ba278dc5d48;p=vchess.git Fix squares colors on diagrams --- diff --git a/client/src/utils/printDiagram.js b/client/src/utils/printDiagram.js index ef0d2b55..4a3a50ee 100644 --- a/client/src/utils/printDiagram.js +++ b/client/src/utils/printDiagram.js @@ -73,13 +73,14 @@ export function getDiagram(args) { // Obtain the array of pieces images names: const board = V.GetBoard(args.position); const orientation = args.orientation || "w"; - const darkBottomRight = !!args.darkBottomRight; const markArray = getMarkArray(args.marks); const shadowArray = getShadowArray(args.shadow); - const vr = new V(); //just for pieces images paths + const vr = new V(); //TODO: just for pieces images paths let boardDiv = ""; const [startX, startY, inc] = orientation == "w" ? [0, 0, 1] : [V.size.x - 1, V.size.y - 1, -1]; + let lightOddity = (V.size.x + V.size.y) % 2; + if (V.DarkBottomRight) lightOddity = 1 - lightOddity; for (let i = startX; i >= 0 && i < V.size.x; i += inc) { boardDiv += "