Skip to content

Commit

Permalink
Adds Bookmark and Comment Options to GameTree Node Menu.
Browse files Browse the repository at this point in the history
Issue 940 - SabakiHQ#940

When navigating the gametree, it is not obvious how to
bookmark or change colors of nodes.

To bookmark, you can use hotspots (ctrl+b), and to change color,
you can leave comments on the nodes.  But neither of these
options are available by right clicking a node, so unless you
happen to come across this functionality by leaving a comment
and happen to notice the impact, there is nothing that tells the
user that this functionality exists.

This commit rectifies this by adding these options when right
clicking a node in the gametree.
  • Loading branch information
RobertChrist committed Mar 22, 2024
1 parent 53a7a2b commit 427d764
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/modules/sabaki.js
Original file line number Diff line number Diff line change
Expand Up @@ -2644,6 +2644,8 @@ class Sabaki extends EventEmitter {
// Menus

openNodeMenu(treePosition, {x, y} = {}) {
let commentMenu = this.getCommentMenuTemplate(treePosition)

let t = i18n.context('menu.edit')
let template = [
{
Expand Down Expand Up @@ -2683,13 +2685,34 @@ class Sabaki extends EventEmitter {
{
label: t('Remove &Other Variations'),
click: () => this.removeOtherVariations(treePosition)
},
{type: 'separator'},
{
label: t('Show Co&mments'),
click: () => {
setting.toggle('view.show_comments')
this.setState(({showCommentBox}) => ({
showCommentBox: !showCommentBox
}))
}
},
{type: 'separator'},
{
label: 'Annotate',
submenu: commentMenu
}
]

helper.popupMenu(template, x, y)
}

openCommentMenu(treePosition, {x, y} = {}) {
let template = this.getCommentMenuTemplate(treePosition)

helper.popupMenu(template, x, y)
}

getCommentMenuTemplate(treePosition) {
let t = i18n.context('menu.comment')
let node = this.inferredState.gameTree.get(treePosition)

Expand Down Expand Up @@ -2773,7 +2796,7 @@ class Sabaki extends EventEmitter {
item.click = () => this.setComment(treePosition, item.data)
}

helper.popupMenu(template, x, y)
return template
}

openVariationMenu(
Expand Down

0 comments on commit 427d764

Please sign in to comment.