From: Benjamin Auder Date: Thu, 2 Jun 2022 20:48:48 +0000 (+0200) Subject: Hex rotation OK X-Git-Url: https://git.auder.net/%7B%7B%20path%28%27mixstore_store_usecase_view%27%2C%20%7B%20id:%20ucs.id%20%7D%29%20%7D%7D?a=commitdiff_plain;h=fcede3ef85cbb36a05220033cdd318af68e0084c;p=xogo.git Hex rotation OK --- diff --git a/common.css b/common.css index c1ba77c..bf4e1a8 100644 --- a/common.css +++ b/common.css @@ -117,6 +117,11 @@ h4 { margin: 10px 0; } +#gameInfos > .rules > a { + padding-bottom: 1px; + border-bottom: 1px dotted black; +} + #gameStopped > h1 { margin-bottom: 10px; } diff --git a/variants/Hex/class.js b/variants/Hex/class.js index 91a0fe6..db60da7 100644 --- a/variants/Hex/class.js +++ b/variants/Hex/class.js @@ -78,24 +78,21 @@ export default class HexRules extends ChessRules { return (emptyCount + "/").repeat(this.size.x).slice(0, -1) + " w 0"; } - // TODO: enable vertical board (rotate?) getSvgChessboard() { // NOTE: with small margin seems nicer let width = 173.2 * this.size.y + 173.2 * (this.size.y-1) / 2 + 30, height = 50 + Math.floor(150 * this.size.x) + 30, min_x = -86.6 - 15, min_y = -100 - 15; -// if (this.size.ratio < 1) { -// [width, height] = [height, width]; -// [min_x, min_y] = [min_y, min_x]; -// } + if (this.size.ratio < 1) { + // Rotate by 30 degrees to display vertically + [width, height] = [height, width]; + [min_x, min_y] = [min_y, min_x]; + } let board = ` + class="chessboard_SVG"> `; - board += ""; + board += "`; } } - board += ``; + board += `