Merge pull request #13978 from Henry-YSLin/truncate-playlist-item-text

Truncate beatmap text in playlist item
This commit is contained in:
Dean Herbert 2021-07-22 15:00:03 +09:00 committed by GitHub
commit 04c69c95cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -108,7 +108,11 @@ namespace osu.Game.Screens.OnlinePlay
difficultyIconContainer.Child = new DifficultyIcon(beatmap.Value, ruleset.Value, requiredMods) { Size = new Vector2(32) }; difficultyIconContainer.Child = new DifficultyIcon(beatmap.Value, ruleset.Value, requiredMods) { Size = new Vector2(32) };
beatmapText.Clear(); beatmapText.Clear();
beatmapText.AddLink(Item.Beatmap.Value.ToRomanisableString(), LinkAction.OpenBeatmap, Item.Beatmap.Value.OnlineBeatmapID.ToString()); beatmapText.AddLink(Item.Beatmap.Value.ToRomanisableString(), LinkAction.OpenBeatmap, Item.Beatmap.Value.OnlineBeatmapID.ToString(), null, text =>
{
text.Truncate = true;
text.RelativeSizeAxes = Axes.X;
});
authorText.Clear(); authorText.Clear();
@ -147,29 +151,40 @@ namespace osu.Game.Screens.OnlinePlay
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Beatmap = { BindTarget = beatmap } Beatmap = { BindTarget = beatmap }
}, },
new FillFlowContainer new GridContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = 8 }, ColumnDimensions = new[]
Spacing = new Vector2(8, 0), {
Direction = FillDirection.Horizontal, new Dimension(GridSizeMode.AutoSize),
Children = new Drawable[] new Dimension(),
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
{
new Drawable[]
{ {
difficultyIconContainer = new Container difficultyIconContainer = new Container
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Margin = new MarginPadding { Left = 8, Right = 8, },
}, },
new FillFlowContainer new FillFlowContainer
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
beatmapText = new LinkFlowContainer(fontParameters) { AutoSizeAxes = Axes.Both }, beatmapText = new LinkFlowContainer(fontParameters)
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
},
new FillFlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
@ -208,17 +223,15 @@ namespace osu.Game.Screens.OnlinePlay
} }
} }
} }
}
}
}, },
new FillFlowContainer new FillFlowContainer
{ {
Anchor = Anchor.CentreRight, Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight, Origin = Anchor.CentreRight,
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Margin = new MarginPadding { Left = 8, Right = 10, },
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Spacing = new Vector2(5), Spacing = new Vector2(5),
X = -10,
ChildrenEnumerable = CreateButtons().Select(button => button.With(b => ChildrenEnumerable = CreateButtons().Select(button => button.With(b =>
{ {
b.Anchor = Anchor.Centre; b.Anchor = Anchor.Centre;
@ -226,6 +239,9 @@ namespace osu.Game.Screens.OnlinePlay
})) }))
} }
} }
}
},
}
}; };
} }