From 9573fca9335e30dc984c313ac5d6d205186a8bab Mon Sep 17 00:00:00 2001 From: John Doknjas Date: Tue, 10 Dec 2024 06:16:01 +0000 Subject: [PATCH] Check if a ply is not NaN before jumping to it. --- ui/round/src/view/replay.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/round/src/view/replay.ts b/ui/round/src/view/replay.ts index 4d875b8d22538..9ecdf6a20f459 100644 --- a/ui/round/src/view/replay.ts +++ b/ui/round/src/view/replay.ts @@ -52,7 +52,7 @@ const renderMove = (step: Step, curPly: number, orEmpty: boolean, drawOffers: Se : orEmpty && h(moveTag, '…'); const goToPly = (ctrl: RoundController, ply: number) => { - ctrl.userJump(ply); + if (!isNaN(ply)) ctrl.userJump(ply); ctrl.redraw(); }; @@ -204,6 +204,7 @@ function initMessage(ctrl: RoundController) { } const col1Button = (ctrl: RoundController, dir: number, icon: string, disabled: boolean) => + // todo: update the stuff for mobile (in vertical mode) here: h('button.fbt', { attrs: { disabled: disabled, 'data-icon': icon, 'data-ply': ctrl.ply + dir }, hook: bind('mousedown', e => {