Skip to content

Commit

Permalink
Only toggle the menu dialogues when flipping the board through the menu.
Browse files Browse the repository at this point in the history
  • Loading branch information
johndoknjas committed Jan 17, 2025
1 parent 10c6c3e commit 9ac6509
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
1 change: 0 additions & 1 deletion ui/analyse/src/ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ export default class AnalyseCtrl {
this.explorer.onFlip();
this.onChange();
this.persistence?.save(true);
this.actionMenu.toggle();
this.redraw();
};

Expand Down
9 changes: 8 additions & 1 deletion ui/analyse/src/view/actionMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,14 @@ export function view(ctrl: AnalyseCtrl): VNode {
h('div.action-menu__tools', [
h(
'a',
{ hook: bind('click', ctrl.flip), attrs: { 'data-icon': licon.ChasingArrows, title: 'Hotkey: f' } },
{
hook: bind('click', () => {
ctrl.flip();
ctrl.actionMenu.toggle();
ctrl.redraw();
}),
attrs: { 'data-icon': licon.ChasingArrows, title: 'Hotkey: f' },
},
i18n.site.flipBoard,
),
!ctrl.ongoing &&
Expand Down
1 change: 0 additions & 1 deletion ui/round/src/ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ export default class RoundController implements MoveRootCtrl {
orientation: boardOrientation(this.data, this.flip),
});
pubsub.emit('flip', this.flip);
this.menu.toggle();
this.redraw();
};

Expand Down
7 changes: 6 additions & 1 deletion ui/round/src/view/boardMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ export default function (ctrl: RoundController): LooseVNode {
const d = ctrl.data,
spectator = d.player.spectator;
return [
h('section', [menu.flip(i18n.site.flipBoard, ctrl.flip, ctrl.flipNow)]),
h('section', [
menu.flip(i18n.site.flipBoard, ctrl.flip, () => {
ctrl.flipNow();
ctrl.menu.toggle();
}),
]),
h('section', [
menu.zenMode(true),
menu.blindfold(
Expand Down

0 comments on commit 9ac6509

Please sign in to comment.