1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 03:33:20 +08:00

Merge pull request #29438 from Joehuu/fix-play-button-click-area

Fix preview play button having incorrect click area
This commit is contained in:
Dan Balasescu 2024-08-16 16:29:49 +09:00 committed by GitHub
commit 4ea7d9fb9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 9 deletions

View File

@ -23,7 +23,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
protected override Drawable IdleContent => idleBottomContent;
protected override Drawable DownloadInProgressContent => downloadProgressBar;
private const float height = 100;
public const float HEIGHT = 100;
[Cached]
private readonly BeatmapCardContent content;
@ -42,14 +42,14 @@ namespace osu.Game.Beatmaps.Drawables.Cards
public BeatmapCardNormal(APIBeatmapSet beatmapSet, bool allowExpansion = true)
: base(beatmapSet, allowExpansion)
{
content = new BeatmapCardContent(height);
content = new BeatmapCardContent(HEIGHT);
}
[BackgroundDependencyLoader]
private void load()
{
Width = WIDTH;
Height = height;
Height = HEIGHT;
FillFlowContainer leftIconArea = null!;
FillFlowContainer titleBadgeArea = null!;
@ -65,7 +65,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
thumbnail = new BeatmapCardThumbnail(BeatmapSet, BeatmapSet)
{
Name = @"Left (icon) area",
Size = new Vector2(height),
Size = new Vector2(HEIGHT),
Padding = new MarginPadding { Right = CORNER_RADIUS },
Child = leftIconArea = new FillFlowContainer
{
@ -77,8 +77,8 @@ namespace osu.Game.Beatmaps.Drawables.Cards
},
buttonContainer = new CollapsibleButtonContainer(BeatmapSet)
{
X = height - CORNER_RADIUS,
Width = WIDTH - height + CORNER_RADIUS,
X = HEIGHT - CORNER_RADIUS,
Width = WIDTH - HEIGHT + CORNER_RADIUS,
FavouriteState = { BindTarget = FavouriteState },
ButtonsCollapsedWidth = CORNER_RADIUS,
ButtonsExpandedWidth = 30,

View File

@ -90,10 +90,9 @@ namespace osu.Game.Beatmaps.Drawables.Cards
protected override void Update()
{
base.Update();
progress.Progress = playButton.Progress.Value;
playButton.Scale = new Vector2(DrawWidth / 100);
progress.Size = new Vector2(50 * DrawWidth / 100);
progress.Progress = playButton.Progress.Value;
progress.Size = new Vector2(50 * playButton.DrawWidth / (BeatmapCardNormal.HEIGHT - BeatmapCard.CORNER_RADIUS));
}
private void updateState()

View File

@ -79,6 +79,8 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
{
base.Update();
icon.Scale = new Vector2(DrawWidth / (BeatmapCardNormal.HEIGHT - BeatmapCard.CORNER_RADIUS));
if (Playing.Value && previewTrack != null && previewTrack.TrackLoaded)
progress.Value = previewTrack.CurrentTime / previewTrack.Length;
else