Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions ui/analyse/src/analyse.nvui.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import type AnalyseCtrl from './ctrl';
import type { NvuiPlugin } from './interfaces';
import * as nvui from 'lib/nvui/chess';
import type * as studyDeps from './study/studyDeps';
import { renderNvui, initNvui } from './view/nvuiView';
import { Notify } from 'lib/nvui/notify';
import { type Prop, prop } from 'lib';

export type NvuiContext = Readonly<{
ctrl: AnalyseCtrl;
deps?: typeof studyDeps;
analysisInProgress: Prop<boolean>;
notify: Notify;
moveStyle: ReturnType<typeof nvui.styleSetting>;
pieceStyle: ReturnType<typeof nvui.pieceSetting>;
prefixStyle: ReturnType<typeof nvui.prefixSetting>;
positionStyle: ReturnType<typeof nvui.positionSetting>;
boardStyle: ReturnType<typeof nvui.boardSetting>;
}>;

export function initModule(ctrl: AnalyseCtrl): NvuiPlugin {
const ctx: NvuiContext = {
ctrl,
notify: new Notify(),
analysisInProgress: prop(false),
moveStyle: nvui.styleSetting(),
pieceStyle: nvui.pieceSetting(),
prefixStyle: nvui.prefixSetting(),
positionStyle: nvui.positionSetting(),
boardStyle: nvui.boardSetting(),
};
initNvui(ctx);
return { render: deps => renderNvui({ ...ctx, deps }) };
}
4 changes: 2 additions & 2 deletions ui/analyse/src/ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ export default class AnalyseCtrl {
}

setAutoShapes = (): void => {
this.chessground?.setAutoShapes(computeAutoShapes(this));
if (!site.blindMode) this.chessground?.setAutoShapes(computeAutoShapes(this));
};

private onNewCeval = (ev: Tree.ClientEval, path: Tree.Path, isThreat?: boolean): void => {
Expand All @@ -717,7 +717,7 @@ export default class AnalyseCtrl {
this.study?.multiCloudEval?.onLocalCeval(node, ev);
this.evalCache.onLocalCeval();
}
this.redraw();
if (!(site.blindMode && this.retro)) this.redraw();
}
});
};
Expand Down
2 changes: 1 addition & 1 deletion ui/analyse/src/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const bind = (ctrl: AnalyseCtrl) => {
kbd.bind('space', () => {
const gb = ctrl.gamebookPlay();
if (gb) gb.onSpace();
else if (ctrl.practice || ctrl.studyPractice) return;
else if (ctrl.practice || ctrl.studyPractice || site.blindMode) return;
else if (ctrl.ceval.enabled()) ctrl.playBestMove();
else ctrl.toggleCeval();
});
Expand Down
Loading
Loading