-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Support variable spacing between beatmap carousel panels #31799
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
Conversation
| var inputRectangle = DrawRectangle; | ||
|
|
||
| // Cover a gap introduced by the spacing between a BeatmapSetPanel and a BeatmapPanel either below/above it. | ||
| inputRectangle = inputRectangle.Inflate(new MarginPadding { Vertical = BeatmapCarousel.SPACING / 2f }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure this is wrong? If there's two set panels next to each other this is going to give the "closer" one extra input lenience.
osu.Game.Tests.2025-02-06.at.08.40.19.mp4
I'm not sure how much it matters, but it's worth pointing out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
99% sure you just don't need this at all? the inflation should only be on beatmap panels?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, to achieve complete evenness, beatmap panels extend input rectangle by half the spacing, so if you have a beatmap panel on top of a beatmap set panel, there'll be extra gap towards the beatmap set panel which has to be handled somehow.
Other options could be making beatmap panels somehow aware of the panel above/below it and adjust the inflation accordingly, or get rid of this completely and add handle click at gaps in BeatmapCarousel and make it determine the panel closest to its Y position (may work much better than this).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's how the alternative approach of handling this at a higher level would look like:
diff
diff --git a/osu.Game/Screens/SelectV2/BeatmapPanel.cs b/osu.Game/Screens/SelectV2/BeatmapPanel.cs
index 2fe509402b..3edfd4203b 100644
--- a/osu.Game/Screens/SelectV2/BeatmapPanel.cs
+++ b/osu.Game/Screens/SelectV2/BeatmapPanel.cs
@@ -24,16 +24,6 @@ public partial class BeatmapPanel : PoolableDrawable, ICarouselPanel
private Box activationFlash = null!;
private OsuSpriteText text = null!;
- public override bool ReceivePositionalInputAt(Vector2 screenSpacePos)
- {
- var inputRectangle = DrawRectangle;
-
- // Cover the gaps introduced by the spacing between BeatmapPanels.
- inputRectangle = inputRectangle.Inflate(new MarginPadding { Vertical = BeatmapCarousel.SPACING / 2f });
-
- return inputRectangle.Contains(ToLocalSpace(screenSpacePos));
- }
-
[BackgroundDependencyLoader]
private void load()
{
diff --git a/osu.Game/Screens/SelectV2/BeatmapSetPanel.cs b/osu.Game/Screens/SelectV2/BeatmapSetPanel.cs
index 85d5cc097d..79ffe0f68a 100644
--- a/osu.Game/Screens/SelectV2/BeatmapSetPanel.cs
+++ b/osu.Game/Screens/SelectV2/BeatmapSetPanel.cs
@@ -27,16 +27,6 @@ public partial class BeatmapSetPanel : PoolableDrawable, ICarouselPanel
private OsuSpriteText text = null!;
private Box box = null!;
- public override bool ReceivePositionalInputAt(Vector2 screenSpacePos)
- {
- var inputRectangle = DrawRectangle;
-
- // Cover a gap introduced by the spacing between a BeatmapSetPanel and a BeatmapPanel either below/above it.
- inputRectangle = inputRectangle.Inflate(new MarginPadding { Vertical = BeatmapCarousel.SPACING / 2f });
-
- return inputRectangle.Contains(ToLocalSpace(screenSpacePos));
- }
-
[BackgroundDependencyLoader]
private void load()
{
diff --git a/osu.Game/Screens/SelectV2/Carousel.cs b/osu.Game/Screens/SelectV2/Carousel.cs
index 5e0fa29684..8ce2b00482 100644
--- a/osu.Game/Screens/SelectV2/Carousel.cs
+++ b/osu.Game/Screens/SelectV2/Carousel.cs
@@ -426,6 +426,26 @@ private void traverseGroupSelection(int direction)
} while (newIndex != originalIndex);
}
+ protected override bool OnClick(ClickEvent e)
+ {
+ if (Parent == null)
+ return false;
+
+ var closestPanel = scroll.Panels.MinBy(p => Math.Min(
+ Math.Abs(p.ScreenSpaceDrawQuad.TopLeft.Y - e.ScreenSpaceMousePosition.Y),
+ Math.Abs(p.ScreenSpaceDrawQuad.BottomLeft.Y - e.ScreenSpaceMousePosition.Y)));
+
+ if (closestPanel == null)
+ return false;
+
+ var closestPanelCentre = closestPanel.ScreenSpaceDrawQuad.Centre;
+ if (!closestPanel.ReceivePositionalInputAt(new Vector2(e.ScreenSpaceMousePosition.X, closestPanelCentre.Y)))
+ return false;
+
+ closestPanel.TriggerClick();
+ return base.OnClick(e);
+ }
+
#endregion
#region Selection handling
diff --git a/osu.Game/Screens/SelectV2/GroupPanel.cs b/osu.Game/Screens/SelectV2/GroupPanel.cs
index df930a3111..7ed256ca6a 100644
--- a/osu.Game/Screens/SelectV2/GroupPanel.cs
+++ b/osu.Game/Screens/SelectV2/GroupPanel.cs
@@ -28,16 +28,6 @@ public partial class GroupPanel : PoolableDrawable, ICarouselPanel
private Box box = null!;
- public override bool ReceivePositionalInputAt(Vector2 screenSpacePos)
- {
- var inputRectangle = DrawRectangle;
-
- // Cover a gap introduced by the spacing between a GroupPanel and a BeatmapPanel either below/above it.
- inputRectangle = inputRectangle.Inflate(new MarginPadding { Vertical = BeatmapCarousel.SPACING / 2f });
-
- return inputRectangle.Contains(ToLocalSpace(screenSpacePos));
- }
-
[BackgroundDependencyLoader]
private void load()
{It sacrifices hover state between gaps but I would argue it doesn't even make sense to show anything hovered within gaps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the alternative. Definitely need hover states to match.
I'm just going to turn a blind eye for now and mention it's not perfect inline. Can be fixed if someone has the time and energy later.
peppy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As commented.
|
In order to simplify things, I've removed the inflation from group and set panels. This was objectively wrong and not something I can get behind merging, as a user could be clicking on what visually looks like one group and have the click arrive incorrectly at another due to the inflation. Instead, I've only inflated the difficulty panels. As you mentioned, this will mean that the gaps between difficulties are non-equal, but I don't see this as an issue – at least not a blocker like the aforementioned visual discrepancy. @frenzibyte Please check the changes and see if you can agree to this direction. |
frenzibyte
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sacrificing evenness to fix over-inflation in group/set panels sounds fair. Changes look good to me.
Prerequisite for implementing design. Difficulty panels should have positive spacing / gaps between them, while set/group panels should overlap, matching stable.
Before:
After:

