Skip to content

Commit

Permalink
v3.4.22
Browse files Browse the repository at this point in the history
  • Loading branch information
gruppler committed Nov 17, 2024
2 parents 0200b48 + 8ab1571 commit 326f92d
Show file tree
Hide file tree
Showing 9 changed files with 218 additions and 87 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ptn-ninja",
"version": "3.4.21",
"version": "3.4.22",
"description": "An editor and viewer for Portable Tak Notation",
"productName": "PTN Ninja",
"author": "Craig Laparo <gruppler+github@gmail.com>",
Expand Down
20 changes: 17 additions & 3 deletions src/Game/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,19 @@ export default class GameComments {

addComments(type, messages) {
const isEvaluation = /^[?!'"]+$/;
const isReplacement = /^!r(\d+):/;
for (const plyID in messages) {
messages[plyID].forEach((message) => {
if (isEvaluation.test(message)) {
this._setEvaluation(plyID, message);
} else {
this._addComment(type, message, plyID);
if (isReplacement.test(message)) {
let index = message.match(isReplacement)[1];
message = message.substring(index.length + 3);
this._replaceComment(type, plyID, index, message);
} else {
this._addComment(type, message, plyID);
}
}
});
}
Expand All @@ -64,11 +71,18 @@ export default class GameComments {
this.board.updatePositionOutput();
}

editComment(type, plyID, index, message) {
_replaceComment(type, plyID, index, message) {
if (this[type][plyID] && this[type][plyID][index]) {
this[type][plyID][index].message = message;
this._updatePTN(true);
this.board.dirtyComment(type, plyID);
return true;
}
return false;
}

editComment(type, plyID, index, message) {
if (this._replaceComment(type, plyID, index, message)) {
this._updatePTN(true);
this.board.updateCommentsOutput();
return this[type][plyID][index];
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/board/Board.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export default {
return this.$store.state.game.ptn;
},
evaluation() {
if (this.$store.state.game.evaluation) {
if (this.$store.state.game.evaluation !== null) {
return this.$store.state.game.evaluation;
} else if (this.position.boardPly) {
return this.$store.state.game.comments.evaluations[
Expand Down
8 changes: 3 additions & 5 deletions src/components/board/CurrentMove.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<template>
<div
v-show="position.ply && !$store.state.ui.showPTN"
class="board-move-container no-pointer-events"
>
<div v-show="position.ply" class="board-move-container no-pointer-events">
<div class="board-move" :class="{ collapsed }">
<q-btn
@click="toggle"
:icon="icon"
class="collapse dimmed-btn all-pointer-events"
:class="{ hidden: this.$store.state.ui.showPTN }"
:ripple="false"
:color="btnColor"
dense
Expand All @@ -34,7 +32,7 @@ export default {
computed: {
collapsed: {
get() {
return !this.$store.state.ui.showMove;
return !this.$store.state.ui.showMove || this.$store.state.ui.showPTN;
},
set(value) {
this.$store.dispatch("ui/SET_UI", ["showMove", !value]);
Expand Down
Loading

0 comments on commit 326f92d

Please sign in to comment.