From 933fd1f90a080c1a3e477cc36adebb5e8db8a9d3 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Mon, 24 Feb 2020 17:17:28 +0100 Subject: [PATCH] Fixes about display --- client/src/base_rules.js | 7 +++++++ client/src/components/BaseGame.vue | 13 ++++++++----- client/src/components/MoveList.vue | 3 ++- 3 files changed, 17 insertions(+), 6 deletions(-) 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 != "*") { -- 2.44.0