components icon indicating copy to clipboard operation
components copied to clipboard

fix(material/slider): Aligns the tickmarks with the thumbs

Open GiftLanga opened this issue 1 year ago • 3 comments
trafficstars

Uses flexbox to align the tickmarks with the thumbs

Fixes #29409.

GiftLanga avatar Jul 31 '24 10:07 GiftLanga

Hey @GiftLanga! Thank you for this PR! I've been hoping to make this switch sometime since IMO it's much cleaner

I took a look at the changes and noticed a small visual issue where some tick marks appear to be stretching slightly depending on the screen size

Here's a screenshot of the problem

Screenshot 2024-07-31 at 10 24 18 AM

wagnermaciel avatar Jul 31 '24 14:07 wagnermaciel

Hey @GiftLanga! Thank you for this PR! I've been hoping to make this switch sometime since IMO it's much cleaner

I took a look at the changes and noticed a small visual issue where some tick marks appear to be stretching slightly depending on the screen size

Here's a screenshot of the problem

Screenshot 2024-07-31 at 10 24 18 AM

Okay, I'll take a look.

GiftLanga avatar Jul 31 '24 15:07 GiftLanga

Hey @GiftLanga! Thank you for this PR! I've been hoping to make this switch sometime since IMO it's much cleaner

I took a look at the changes and noticed a small visual issue where some tick marks appear to be stretching slightly depending on the screen size

Here's a screenshot of the problem

Screenshot 2024-07-31 at 10 24 18 AM

I ended up using clip-path to make the circles (not sure if it's the correct way to do things), because at 2px there are inconsistencies with the widths of the tick marks. Otherwise I would need to revert back to using the absolute positioning and translate.

/** Returns the translateX positioning for a tick mark based on it's index. */ _calcTickMarkTransform(index: number): string { // TODO(wagnermaciel): See if we can avoid doing this and just using flex to position these. const translateX = index * (this._tickMarkTrackWidth / (this._tickMarks.length - 1)); returntranslateX(${translateX}px; }

GiftLanga avatar Aug 02 '24 07:08 GiftLanga

Closing as we ended up deciding to keep the absolute positioning and fixing the translateX in https://github.com/angular/components/pull/30329

wagnermaciel avatar Apr 17 '25 18:04 wagnermaciel

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.