Skip to content

Commit

Permalink
Do not change mania column width on mobile platforms
Browse files Browse the repository at this point in the history
- Closes ppy#25852
- Reverts ppy#25336 /
  ppy#25777

With the columns not being directly touchable anymore after
ppy#28173 I see very little point to this
continuing to exist.
  • Loading branch information
bdach committed May 16, 2024
1 parent a3960bf commit 97de73b
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions osu.Game.Rulesets.Mania/UI/ColumnFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@

#nullable disable

using System;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Skinning;
using osu.Game.Skinning;
using osuTK;

namespace osu.Game.Rulesets.Mania.UI
{
Expand Down Expand Up @@ -62,12 +59,6 @@ private void load(ISkinSource skin)
onSkinChanged();
}

protected override void LoadComplete()
{
base.LoadComplete();
updateMobileSizing();
}

private void onSkinChanged()
{
for (int i = 0; i < stageDefinition.Columns; i++)
Expand All @@ -92,8 +83,6 @@ private void onSkinChanged()

columns[i].Width = width.Value;
}

updateMobileSizing();
}

/// <summary>
Expand All @@ -106,31 +95,6 @@ public void SetContentForColumn(int column, TContent content)
Content[column] = columns[column].Child = content;
}

private void updateMobileSizing()
{
if (!IsLoaded || !RuntimeInfo.IsMobile)
return;

// GridContainer+CellContainer containing this stage (gets split up for dual stages).
Vector2? containingCell = this.FindClosestParent<Stage>()?.Parent?.DrawSize;

// Will be null in tests.
if (containingCell == null)
return;

float aspectRatio = containingCell.Value.X / containingCell.Value.Y;

// 2.83 is a mostly arbitrary scale-up (170 / 60, based on original implementation for argon)
float mobileAdjust = 2.83f * Math.Min(1, 7f / stageDefinition.Columns);
// 1.92 is a "reference" mobile screen aspect ratio for phones.
// We should scale it back for cases like tablets which aren't so extreme.
mobileAdjust *= aspectRatio / 1.92f;

// Best effort until we have better mobile support.
for (int i = 0; i < stageDefinition.Columns; i++)
columns[i].Width *= mobileAdjust;
}

protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
Expand Down

0 comments on commit 97de73b

Please sign in to comment.