1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-04 13:44:26 +08:00

Fix weird implementation of layout validation

This commit is contained in:
Dean Herbert
2025-03-12 18:33:20 +09:00
Unverified
parent b3ea63598e
commit 70693c8bb8
+9 -7
View File
@@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Mania.UI
set => base.Masking = value;
}
private readonly LayoutValue columnSizeLayout = new LayoutValue(Invalidation.DrawSize);
private readonly LayoutValue layout = new LayoutValue(Invalidation.DrawSize);
public ColumnFlow(StageDefinition stageDefinition)
{
@@ -60,7 +60,7 @@ namespace osu.Game.Rulesets.Mania.UI
for (int i = 0; i < stageDefinition.Columns; i++)
columns.Add(new Container<TContent> { RelativeSizeAxes = Axes.Y });
AddLayout(columnSizeLayout);
AddLayout(layout);
}
[Resolved]
@@ -73,18 +73,18 @@ namespace osu.Game.Rulesets.Mania.UI
{
rulesetConfig?.BindWith(ManiaRulesetSetting.MobileLayout, mobileLayout);
mobileLayout.BindValueChanged(_ => updateColumnSize());
skin.SourceChanged += updateColumnSize;
mobileLayout.BindValueChanged(_ => invalidateLayout());
skin.SourceChanged += invalidateLayout;
}
protected override void Update()
{
base.Update();
if (!columnSizeLayout.IsValid)
if (!layout.IsValid)
{
updateColumnSize();
columnSizeLayout.Validate();
layout.Validate();
}
}
@@ -98,6 +98,8 @@ namespace osu.Game.Rulesets.Mania.UI
Content[column] = columns[column].Child = content;
}
private void invalidateLayout() => layout.Invalidate();
private void updateColumnSize()
{
float mobileAdjust = 1f;
@@ -149,7 +151,7 @@ namespace osu.Game.Rulesets.Mania.UI
base.Dispose(isDisposing);
if (skin.IsNotNull())
skin.SourceChanged -= updateColumnSize;
skin.SourceChanged -= invalidateLayout;
}
}
}