Skip to content

Commit

Permalink
Format with prettier.
Browse files Browse the repository at this point in the history
  • Loading branch information
johndoknjas committed Dec 11, 2024
1 parent 399d15f commit 4c91620
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions ui/round/src/view/replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,26 +136,29 @@ export function analysisButton(ctrl: RoundController): LooseVNode {
}

const goThroughMoves = (ctrl: RoundController) => {
return function(e: MouseEvent) {
return function (e: MouseEvent) {
e.preventDefault();
let timeoutId: number | undefined = undefined;
const clearMovesTimeout = () => {
clearTimeout(timeoutId);
};
const targetPly = (e: MouseEvent) => parseInt((e.target as HTMLElement).getAttribute('data-ply') || '');
const delay = showMovesDecreasingDelay();
document.addEventListener(e.type === 'touchstart' ? 'touchend' : 'mouseup', () => clearMovesTimeout(), { once: true });
document.addEventListener(e.type === 'touchstart' ? 'touchend' : 'mouseup', () => clearMovesTimeout(), {
once: true,
});
const repeat = () => {
goToPly(ctrl, targetPly(e));
timeoutId = setTimeout(repeat, delay.next().value!);
if (isNaN(targetPly(e))) clearMovesTimeout();
};
repeat();
}
}
};
};

function renderButtons(ctrl: RoundController) {
const firstPly = util.firstPly(ctrl.data), lastPly = util.lastPly(ctrl.data);
const firstPly = util.firstPly(ctrl.data),
lastPly = util.lastPly(ctrl.data);
return h(
'div.buttons',
{
Expand Down

0 comments on commit 4c91620

Please sign in to comment.