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 Oct 19, 2023
1 parent 598135e commit 182c7dc
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 @@ -2581,6 +2581,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 @@ -2620,13 +2622,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 @@ -2710,7 +2733,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 182c7dc

Please sign in to comment.