X-Git-Url: https://git.auder.net/?p=xogo.git;a=blobdiff_plain;f=variants%2FHex%2Fclass.js;h=0797c91e42c0498699b8080f3d4bcddf50ba364a;hp=37bd53c9792ae7b7e6e2556a40c25a1c4d1bb733;hb=f31de5e46015a93dca20765da61670035ce8f491;hpb=535c464b0543306a0ea36c66f07dcfad7a951efc diff --git a/variants/Hex/class.js b/variants/Hex/class.js index 37bd53c..0797c91 100644 --- a/variants/Hex/class.js +++ b/variants/Hex/class.js @@ -32,10 +32,12 @@ export default class HexRules extends ChessRules { get hasReserve() { return false; } - get noAnimate() { return true; } + get clickOnly() { + return true; + } doClick(coords) { if ( @@ -72,30 +74,30 @@ export default class HexRules extends ChessRules { return res; } - genRandInitFen() { + genRandInitBaseFen() { // NOTE: size.x == size.y (square boards) const emptyCount = C.FenEmptySquares(this.size.x); - return (emptyCount + "/").repeat(this.size.x).slice(0, -1) + " w 0"; + return { + fen: (emptyCount + "/").repeat(this.size.x).slice(0, -1) + " w 0", + o: {} + }; } - // TODO: re-enable rotation 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.rotate) { -// [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 += `