-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Conversation
peppy
commented
Oct 24, 2024
•
edited
Loading
edited
- Supersedes Add visual effect for slider bar focus state #30410
- Depends on Allow slider bar to take focus and accept keyboard input while not hovered osu-framework#6390
- Depends on framework bump
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: For sheared slider, there's a bit of a gap on the sides (pretty much only visible on the left due to colours used): 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. |
Noticed this and attempted to fix but had no idea what was doing that. Your fix looks good.
Hmm, will see what can be done. |
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. |