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

Adjust slider bar implementations to show focused state #30413

Merged
merged 5 commits into from
Oct 25, 2024

Conversation

peppy
Copy link
Member

@peppy peppy commented Oct 24, 2024

@bdach
Copy link
Collaborator

bdach commented Oct 24, 2024

Most usages look fine but there are a few that don't:

For range slider, if focus is grabbed from the left nub, the glow appears on top of the right nub:

1729768599

For sheared slider, there's a bit of a gap on the sides (pretty much only visible on the left due to colours used):

1729768587

Second issue looks fixed by

diff --git a/osu.Game/Graphics/UserInterface/ShearedSliderBar.cs b/osu.Game/Graphics/UserInterface/ShearedSliderBar.cs
index f4c6f07262..a36b9c7a4c 100644
--- a/osu.Game/Graphics/UserInterface/ShearedSliderBar.cs
+++ b/osu.Game/Graphics/UserInterface/ShearedSliderBar.cs
@@ -70,7 +70,6 @@ public ShearedSliderBar()
                     CornerRadius = 5,
                     Anchor = Anchor.CentreLeft,
                     Origin = Anchor.CentreLeft,
-                    Padding = new MarginPadding { Horizontal = 2 },
                     Child = new Container
                     {
                         RelativeSizeAxes = Axes.Both,
@@ -192,8 +191,8 @@ private void updateGlow()
         protected override void UpdateAfterChildren()
         {
             base.UpdateAfterChildren();
-            LeftBox.Scale = new Vector2(Math.Clamp(RangePadding + Nub.DrawPosition.X - Nub.DrawWidth / 2.15f, 0, Math.Max(0, DrawWidth)), 1);
-            RightBox.Scale = new Vector2(Math.Clamp(DrawWidth - Nub.DrawPosition.X - RangePadding - Nub.DrawWidth / 2.15f, 0, Math.Max(0, DrawWidth)), 1);
+            LeftBox.Scale = new Vector2(Math.Clamp(RangePadding + Nub.DrawPosition.X - Nub.DrawWidth / 2.3f, 0, Math.Max(0, DrawWidth)), 1);
+            RightBox.Scale = new Vector2(Math.Clamp(DrawWidth - Nub.DrawPosition.X - RangePadding - Nub.DrawWidth / 2.3f, 0, Math.Max(0, DrawWidth)), 1);
         }
 
         protected override void UpdateValue(float value)

but the first one I'm not sure how to deal with as the implementation is pretty shoddy.

@peppy
Copy link
Member Author

peppy commented Oct 24, 2024

For sheared slider, there's a bit of a gap on the sides (pretty much only visible on the left due to colours used):

Noticed this and attempted to fix but had no idea what was doing that. Your fix looks good.

For range slider, if focus is grabbed from the left nub, the glow appears on top of the right nub:

Hmm, will see what can be done.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Oct 25, 2024
@peppy
Copy link
Member Author

peppy commented Oct 25, 2024

For range slider, if focus is grabbed from the left nub, the glow appears on top of the right nub

Pushed a lazyish fix for this one. I think that slider design is probably getting replaced so I'm not willing to put too much thought into it.

@bdach bdach merged commit 09582aa into ppy:master Oct 25, 2024
13 checks passed
@peppy peppy deleted the slider-bar-focus branch October 31, 2024 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants