From 5b759dd5cc7dc95265daf8655558166ecd963ee9 Mon Sep 17 00:00:00 2001 From: Aiden Fox Ivey Date: Tue, 2 Dec 2025 13:39:20 -0500 Subject: [PATCH] Refactor indexing to display as 1-indexed Internally, the function index is 0 indexed, but displays as being 1 indexed. This patch fixes that and also limits the funcIndex to be within range of [1, numFunctions]. --- www/main.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/www/main.tsx b/www/main.tsx index cdc40b7..d570ce2 100644 --- a/www/main.tsx +++ b/www/main.tsx @@ -81,10 +81,13 @@ function MenuBar(props: MenuBarProps) { {numFunctions > 1 &&
Function { - const newFuncIndex = Math.max(0, Math.min(numFunctions - 1, parseInt(e.target.value, 10))); + const displayValue = parseInt(e.target.value, 10); + const newFuncIndex = Math.max(0, Math.min(numFunctions - 1, displayValue - 1)); setFuncIndex(isNaN(newFuncIndex) ? 0 : newFuncIndex); }} /> / {numFunctions}