From: Benjamin Auder Date: Mon, 24 Feb 2020 16:17:28 +0000 (+0100) Subject: Fixes about display X-Git-Url: https://git.auder.net/variants/img/current/assets/css/doc/%24%7BgetWhatsApp%28link%29%7D?a=commitdiff_plain;h=933fd1f90a080c1a3e477cc36adebb5e8db8a9d3;p=vchess.git Fixes about display --- diff --git a/client/src/base_rules.js b/client/src/base_rules.js index 85f63a2a..a47b853f 100644 --- a/client/src/base_rules.js +++ b/client/src/base_rules.js @@ -46,12 +46,19 @@ export const ChessRules = class ChessRules { static get CanAnalyze() { return true; } + // Patch: issues with javascript OOP, objects can't access static fields. + get canAnalyze() { + return V.CanAnalyze; + } // Some variants show incomplete information, // and thus show only a partial moves list or no list at all. static get ShowMoves() { return "all"; } + get showMoves() { + return V.ShowMoves; + } // Turn "wb" into "B" (for FEN) static board2fen(b) { diff --git a/client/src/components/BaseGame.vue b/client/src/components/BaseGame.vue index dc1ec676..47776de2 100644 --- a/client/src/components/BaseGame.vue +++ b/client/src/components/BaseGame.vue @@ -66,7 +66,8 @@ div#baseGame( | {{ st.tr["Rules"] }} #movesList MoveList( - v-if="showMoves" + v-if="showMoves != 'none'" + :show="showMoves" :score="game.score" :message="game.scoreMsg" :firstNum="firstMoveNumber" @@ -115,10 +116,12 @@ export default { }, computed: { showMoves: function() { - return this.game.score != "*" || (this.vr && this.vr.ShowMoves == "all"); + return this.game.score != "*" + ? "all" + : (this.vr ? this.vr.showMoves : "none"); }, showTurn: function() { - return this.game.score == '*' && this.vr && this.vr.ShowMoves != "all"; + return this.game.score == '*' && this.vr && this.vr.showMoves != "all"; }, turn: function() { return this.vr @@ -126,10 +129,10 @@ export default { : ""; }, canAnalyze: function() { - return this.game.mode != "analyze" && this.vr && this.vr.CanAnalyze; + return this.game.mode != "analyze" && this.vr && this.vr.canAnalyze; }, allowDownloadPGN: function() { - return this.game.score != "*" || (this.vr && this.vr.ShowMoves == "all"); + return this.game.score != "*" || (this.vr && this.vr.showMoves == "all"); } }, created: function() { diff --git a/client/src/components/MoveList.vue b/client/src/components/MoveList.vue index 48f082f4..6df5a70a 100644 --- a/client/src/components/MoveList.vue +++ b/client/src/components/MoveList.vue @@ -2,7 +2,8 @@ import { store } from "@/store"; export default { name: "my-move-list", - props: ["moves", "cursor", "score", "message", "firstNum"], + props: ["moves", "show", "cursor", "score", "message", "firstNum"], + // TODO: if show == "byrows", show only full rows. render(h) { let rootElements = []; if (!!this.score && this.score != "*") {