From 3ec545a5b17760a0d69a3e87af7cc3ac7d7d9976 Mon Sep 17 00:00:00 2001 From: workaholicpanda <> Date: Sat, 11 Sep 2021 11:36:29 -0400 Subject: [PATCH] fixes #797 --- src/utils.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index f1d95f122..d83074cfb 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -68,9 +68,10 @@ export function ensureValueInRange(val: number, { max, min }: { max?: number; mi } export function ensureValuePrecision(val: number, props) { - const { step } = props; + const { step, min, max } = props; const closestPoint = isFinite(getClosestPoint(val, props)) ? getClosestPoint(val, props) : 0; // eslint-disable-line - return step === null ? closestPoint : parseFloat(closestPoint.toFixed(getPrecision(step))); + const retValue = step === null ? closestPoint : parseFloat(closestPoint.toFixed(getPrecision(step))); + return Math.min(Math.max(retValue, min), max); } export function pauseEvent(e: React.SyntheticEvent) {