diff --git a/ui/chess/src/moveRootCtrl.ts b/ui/chess/src/moveRootCtrl.ts index 18f7d89b7209..9aa7f6fc2fdf 100644 --- a/ui/chess/src/moveRootCtrl.ts +++ b/ui/chess/src/moveRootCtrl.ts @@ -12,7 +12,7 @@ export interface MoveRootCtrl { blindfold?: (v?: boolean) => boolean; speakClock?: () => void; goBerserk?: () => void; - shouldConfirmMove?: () => boolean; + confirmMoveToggle?: () => boolean; } export interface MoveUpdate { diff --git a/ui/round/src/ctrl.ts b/ui/round/src/ctrl.ts index 3b1dd0d2f486..a19346eb2cf4 100644 --- a/ui/round/src/ctrl.ts +++ b/ui/round/src/ctrl.ts @@ -334,16 +334,13 @@ export default class RoundController implements MoveRootCtrl { this.keyboardMove?.update({ fen, canMove: this.canMove() }); }; - shouldConfirmMove = (): boolean => - (this.data.pref.submitMove && this.confirmMoveToggle()) || this.confirmMoveToggle(); - sendMove = (orig: Key, dest: Key, prom: Role | undefined, meta: MoveMetadata): void => { const move: SocketMove = { u: orig + dest }; if (prom) move.u += prom === 'knight' ? 'n' : prom[0]; if (blur.get()) move.b = 1; this.resign(false); - if (!meta.preConfirmed && this.shouldConfirmMove() && !meta.premove) { + if (!meta.preConfirmed && this.confirmMoveToggle() && !meta.premove) { if (site.sound.speech()) { const spoken = `${speakable(sanOf(readFen(this.stepAt(this.ply).fen), move.u))}. confirm?`; site.sound.say(spoken, false, true); @@ -359,7 +356,7 @@ export default class RoundController implements MoveRootCtrl { const drop: SocketDrop = { role, pos: key }; if (blur.get()) drop.b = 1; this.resign(false); - if (this.shouldConfirmMove() && !isPredrop) { + if (this.confirmMoveToggle() && !isPredrop) { this.toSubmit = drop; this.redraw(); } else { diff --git a/ui/voice/src/move/voice.move.ts b/ui/voice/src/move/voice.move.ts index a2c11c4f6bdb..35966aaccf87 100644 --- a/ui/voice/src/move/voice.move.ts +++ b/ui/voice/src/move/voice.move.ts @@ -297,7 +297,7 @@ export function initModule({ // trim choices to clarity window options = options.filter(([, m]) => m.cost - lowestCost <= clarityThreshold); - if (!timer() && options.length === 1 && (options[0][1].cost < 0.3 || root.shouldConfirmMove?.())) { + if (!timer() && options.length === 1 && (options[0][1].cost < 0.3 || root.confirmMoveToggle?.())) { console.info('chooseMoves', `chose '${options[0][0]}' cost=${options[0][1].cost}`); submit(options[0][0], false); return true;