Skip to content

Commit

Permalink
Clamp scaled down value
Browse files Browse the repository at this point in the history
  • Loading branch information
mj12albert committed Jan 3, 2025
1 parent a559bd0 commit c7b00da
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react/src/slider/root/useSliderRoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c7b00da

Please sign in to comment.