Skip to content

Commit

Permalink
Split out constant for usable statistics item space
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Jul 13, 2023
1 parent e11e87d commit 2ee1a51
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal partial class StatisticItemContainer : CompositeDrawable
public StatisticItemContainer(StatisticItem item)
{
RelativeSizeAxes = Axes.X;
Size = item.RelativeSize * new Vector2(1, 720);
Size = item.RelativeSize * new Vector2(1, StatisticsPanel.USABLE_SPACE.Y);

Padding = new MarginPadding(5);

Expand Down
10 changes: 8 additions & 2 deletions osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#nullable disable

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
Expand All @@ -26,6 +27,11 @@ namespace osu.Game.Screens.Ranking.Statistics
{
public partial class StatisticsPanel : VisibilityContainer
{
/// <summary>
/// The usable absolute screen region which can be filled with statistics items.
/// </summary>
public static readonly Vector2 USABLE_SPACE = new Vector2(720, 720);

public const float SIDE_PADDING = 30;

public readonly Bindable<ScoreInfo> Score = new Bindable<ScoreInfo>();
Expand Down Expand Up @@ -142,7 +148,7 @@ private void populateStatistics(ValueChangedEvent<ScoreInfo> score)
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.Distributed, 540, 540, 720),
new Dimension(GridSizeMode.Distributed, 540, 540, USABLE_SPACE.X),
new Dimension(),
},
RowDimensions = new[]
Expand Down Expand Up @@ -231,7 +237,7 @@ protected override void Update()
{
base.Update();
if (flow != null)
scroll.Height = flow.DrawHeight;
scroll.Height = Math.Min(flow.DrawHeight, USABLE_SPACE.Y);
}

protected override bool OnClick(ClickEvent e)
Expand Down

0 comments on commit 2ee1a51

Please sign in to comment.