Skip to content

fix(slider): fix incorrect placement of dots and marker text #8171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion components/vc-slider/src/common/Marks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ const Marks = (_: any, { attrs, slots }: any) => {
});

const bottomStyle = {
marginBottom: '-50%',
transform: `translateY(${reverse ? `-50%` : `50%`})`,
msTransform: `translateY(${reverse ? `-50%` : `50%`})`,
[reverse ? 'top' : 'bottom']: `${((point - min) / range) * 100}%`,
};

Expand Down
14 changes: 12 additions & 2 deletions components/vc-slider/src/common/Steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,18 @@ const Steps = (_: any, { attrs }) => {
(!included && point === upperBound) ||
(included && point <= upperBound && point >= lowerBound);
let style = vertical
? { ...dotStyle, [reverse ? 'top' : 'bottom']: offset }
: { ...dotStyle, [reverse ? 'right' : 'left']: offset };
? {
...dotStyle,
[reverse ? 'top' : 'bottom']: offset,
transform: `translateY(${reverse ? '-50%' : '50%'})`,
msTransform: `translateY(${reverse ? '-50%' : '50%'})`,
}
: {
...dotStyle,
[reverse ? 'right' : 'left']: offset,
transform: `translateX(${reverse ? '50%' : '-50%'})`,
msTransform: `translateX(${reverse ? '50%' : '-50%'})`,
};
if (isActived) {
style = { ...style, ...activeDotStyle };
}
Expand Down