From 47332eba50f743ccfb7e85439cc41f5321bf910f Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Wed, 23 Mar 2022 16:26:48 +0800 Subject: [PATCH] Update app.js Simplify. --- apps/authentiwatch/app.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/apps/authentiwatch/app.js b/apps/authentiwatch/app.js index 69e4a1ae1..3920ebddd 100644 --- a/apps/authentiwatch/app.js +++ b/apps/authentiwatch/app.js @@ -360,12 +360,7 @@ function onSwipe(e) { function bangleBtn(e) { state.cnt = 1; if (tokens.length > 0) { - let id = state.id; - switch (e) { - case -1: id--; break; - case 1: id++; break; - } - id = E.clip(id, 0, tokens.length - 1); + let id = E.clip(state.id + e, 0, tokens.length - 1); onDrag({b:1, dy:state.listy - E.clip(id * TOKEN_HEIGHT - half(AR.h - TOKEN_HEIGHT), 0, Math.max(0, tokens.length * TOKEN_HEIGHT - AR.h))}); changeId(id); drawProgressBar();