X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=variants%2FHex%2Fclass.js;h=8721227f7ef266480fdbfeddc489a2e87a328329;hb=ca8a399316d2496c069ea9c6ccf2dc241aeb70ef;hp=91a0fe67ce89e3394388d004fc6a6588fca9c33f;hpb=437dfd42748eb2359103fd87a7d0e780121a7865;p=xogo.git diff --git a/variants/Hex/class.js b/variants/Hex/class.js index 91a0fe6..8721227 100644 --- a/variants/Hex/class.js +++ b/variants/Hex/class.js @@ -32,7 +32,6 @@ export default class HexRules extends ChessRules { get hasReserve() { return false; } - get noAnimate() { return true; } @@ -78,24 +77,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 += ` this.rescale(e.deltaY < 0 ? "up" : "down")); - } - if ('ontouchstart' in window) - document.addEventListener("touchstart", mousedown, {passive: false}); - } - - // TODO: enable rotation get size() { - const baseRatio = 1.619191; // 2801.2 / 1730, "widescreen" - const rotate = false; //window.innerWidth < window.innerHeight; //"vertical screen" + const baseRatio = 1.6191907514450865; //2801.2 / 1730, "widescreen" + const rotate = window.innerWidth < window.innerHeight; //"vertical screen" return { x: this.options["bsize"], y: this.options["bsize"],