From f8e2ad39b4586c651b5c475b029beaa202fe440c Mon Sep 17 00:00:00 2001 From: Albert Yu Date: Fri, 3 Jan 2025 15:41:58 +0800 Subject: [PATCH] Clamp scaled down value --- packages/react/src/slider/root/useSliderRoot.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react/src/slider/root/useSliderRoot.ts b/packages/react/src/slider/root/useSliderRoot.ts index 1c3d0e6ae7..2f816e0f21 100644 --- a/packages/react/src/slider/root/useSliderRoot.ts +++ b/packages/react/src/slider/root/useSliderRoot.ts @@ -299,7 +299,7 @@ export function useSliderRoot(parameters: useSliderRoot.Parameters): useSliderRo ? (bottom - fingerPosition.y) / height + offset : (fingerPosition.x - left) / width + offset * (isRtl ? -1 : 1); - valueRescaled = Math.min(valueRescaled, 1); + valueRescaled = clamp(valueRescaled, 0, 1); if (isRtl && !isVertical) { valueRescaled = 1 - valueRescaled;