From 0aa405ceaa149fccd4193f676da1ea8b36266eb5 Mon Sep 17 00:00:00 2001 From: winjeysong Date: Sun, 30 Jun 2024 00:28:29 +0800 Subject: [PATCH] fix(slider): inverted slider thumb in the wrong position (#439) --- 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;