From 6cb0499f8346a96a8f680f1fd85c47deec8eb53d Mon Sep 17 00:00:00 2001 From: winjeysong Date: Mon, 22 Jul 2024 23:02:23 +0800 Subject: [PATCH] fix(slider): inverted slider thumb in the wrong position (#441) --- packages/core/src/slider/slider-thumb.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/core/src/slider/slider-thumb.tsx b/packages/core/src/slider/slider-thumb.tsx index 81aede15..35ac1308 100644 --- a/packages/core/src/slider/slider-thumb.tsx +++ b/packages/core/src/slider/slider-thumb.tsx @@ -140,9 +140,11 @@ export function SliderThumb( return isVertical ? `translate(-50%, ${value}%)` : `translate(${value}%, -50%)`; */ - return context.state.orientation() === "vertical" - ? "translateY(50%)" - : "translateX(-50%)"; + if (context.state.orientation() === 'vertical') { + return context.inverted() ? 'translateY(-50%)' :'translateY(50%)'; + } + + return context.inverted() ? 'translateX(50%)' : 'translateX(-50%)'; }; let startPosition = 0;