Skip to content
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

Fix issue where the slider background would shine through gaps between slider and thumb #3673

Conversation

marcelwgn
Copy link
Contributor

@marcelwgn marcelwgn commented Nov 22, 2020

Description

Using a negative margin, the the track extends underneath the thumb hiding the gaps. The fix is not great but better than nothing.

Motivation and Context

Fixes #1765

How Has This Been Tested?

Tested manually.

Screenshots (if appropriate):

Before

Horizontal slider and thumb enlarged

Vertical slider and thumb enlarged

After

Horizontal slider and thumb enlarged

Vertical slider and thumb enlarged

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Nov 22, 2020
@robloo
Copy link
Contributor

robloo commented Nov 23, 2020

Its always a good idea to add comments directly in the code explaining why things like this are done. Also a link to the GitHub issue is convention. This will allow it to be removed in the future if ever composition fixes these rendering glitches.

@marcelwgn
Copy link
Contributor Author

Good idea @robloo ! Added comments now explaining why we use a negative margin there.

Btw, this would likely not be something that will be fixed by composition but rather the controls team as the rect/thumb combination is unfortunate here. But still, if this get's fixed it's good to have linked to that so we can find it easier later on.

@ranjeshj
Copy link
Contributor

can you please add the before screenshot as well to the description ? Thanks

@ranjeshj
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ranjeshj ranjeshj added area-Slider team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Nov 23, 2020
@marcelwgn
Copy link
Contributor Author

can you please add the before screenshot as well to the description ? Thanks

Sure thing, updated the description.

@mdtauk
Copy link
Contributor

mdtauk commented Dec 1, 2020

I am guessing the updated slider design may fix this, but just bringing this to your attention using the upcoming new Design Tokens and colours... Specifically the Disabled state.

image


light_slider

New designs which may fix things

@karkarl
Copy link
Contributor

karkarl commented Dec 4, 2020

This bug is fixed with the new slider visual update in PR now. Link here.

@marcelwgn
Copy link
Contributor Author

So this PR can be closed then?

@StephenLPeters
Copy link
Contributor

@chingucoding Karen's change is going into the Feature/token-experiment branch. I think this fix will still end up being valuable in master.

Using a negative margin to hide the round corners that would otherwise leave a gap between the rect and the thumb.
See https://github.com/microsoft/microsoft-ui-xaml/issues/1765 for more context.
-->
<Rectangle x:Name="HorizontalDecreaseRect" Fill="{TemplateBinding Foreground}" Grid.Row="1" Margin="0,0,-5,0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 [](start = 137, length = 1)

Does this need to scale based on the value of SliderHorizontalThumbWidth?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes in theory it should. Problem is, if we use converters, it wouldn't pick up user made changes due to the fact that binding inside resource dictionaries are only evaluated once if I recall correctly.

@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@StephenLPeters
Copy link
Contributor

@chingucoding do you want to confirm my merge?

@StephenLPeters
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@marcelwgn
Copy link
Contributor Author

Merge looks good, thank you @StephenLPeters.

@StephenLPeters
Copy link
Contributor

@chingucoding can you take a look at the merge conflict?

@marcelwgn
Copy link
Contributor Author

Not sure why it says "empty files" now, but merge conflict is resolved @StephenLPeters.

@beervoley
Copy link
Contributor

@chingucoding unfortunately, this fix doesn't work properly - it will cause thumb not be able to reach a 100 visually because it will be "pulled back" by 5 pixels :)
I've submitted a proper fix in this PR
I will close this PR once another one is checked in :)

@marcelwgn
Copy link
Contributor Author

Alrighty, thanks @beervoley .

@marcelwgn
Copy link
Contributor Author

Closing this as #5353 was merged.

@marcelwgn marcelwgn closed this Jul 6, 2021
@marcelwgn marcelwgn deleted the user/chingucoding/slider-roundcorner-artifact branch July 6, 2021 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Slider team-Controls Issue for the Controls team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Few pixels in Slider show wrong color
7 participants