1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 11:42:55 +08:00

Split group selection to separate method

This commit is contained in:
Dan Balasescu 2022-06-21 12:53:06 +09:00
parent 93ce6fc981
commit 046b848bcd

View File

@ -44,7 +44,6 @@ namespace osu.Game.Screens.Edit.Timing
{ {
BackgroundFlow.Add(new RowBackground(group) BackgroundFlow.Add(new RowBackground(group)
{ {
Selected = ReferenceEquals(group, selectedGroup?.Value),
Action = () => Action = () =>
{ {
selectedGroup.Value = group; selectedGroup.Value = group;
@ -55,6 +54,8 @@ namespace osu.Game.Screens.Edit.Timing
Columns = createHeaders(); Columns = createHeaders();
Content = value.Select(createContent).ToArray().ToRectangular(); Content = value.Select(createContent).ToArray().ToRectangular();
updateSelectedGroup();
} }
} }
@ -65,11 +66,17 @@ namespace osu.Game.Screens.Edit.Timing
selectedGroup.BindValueChanged(group => selectedGroup.BindValueChanged(group =>
{ {
// TODO: This should scroll the selected row into view. // TODO: This should scroll the selected row into view.
foreach (var b in BackgroundFlow) updateSelectedGroup();
b.Selected = ReferenceEquals(b.Item, group.NewValue);
}, true); }, true);
} }
private void updateSelectedGroup()
{
// TODO: This should scroll the selected row into view.
foreach (var b in BackgroundFlow)
b.Selected = ReferenceEquals(b.Item, selectedGroup?.Value);
}
private TableColumn[] createHeaders() private TableColumn[] createHeaders()
{ {
var columns = new List<TableColumn> var columns = new List<TableColumn>