diff --git a/workspaces/package/src/ConfigMenu/ConfigMenu.tsx b/workspaces/package/src/ConfigMenu/ConfigMenu.tsx index 4671a535..24f053fb 100644 --- a/workspaces/package/src/ConfigMenu/ConfigMenu.tsx +++ b/workspaces/package/src/ConfigMenu/ConfigMenu.tsx @@ -141,6 +141,16 @@ const toggleValueInArray = (array: string[], value: string) => { } }; +const getSteps = (min: number, max: number, step: number) => { + const steps = []; + + for (let i = min; i <= max; i += step) { + steps.push(i); + } + + return steps; +}; + const __root = '__root'; export const ConfigMenu = ({ @@ -245,19 +255,15 @@ export const ConfigMenu = ({ )} {isNumber(activeEntry) && - Array.from({ - length: Math.floor( - (activeEntry.max - activeEntry.min) / activeEntry.step - ), - }).map( - (_, i) => + getSteps(activeEntry.min, activeEntry.max, activeEntry.step).map( + (v) => isNumber(activeEntry) && ( - {activeEntry.formatter?.(i) ?? i} + {activeEntry.formatter?.(v) ?? v} ) )}