1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 18:32:56 +08:00

Allow timeline to govern the size of the rest of the editor content

This commit is contained in:
Dean Herbert 2021-04-14 16:00:49 +09:00
parent e543db9bee
commit a314f90d37
3 changed files with 82 additions and 51 deletions

View File

@ -56,8 +56,13 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private Track track;
private const float timeline_height = 90;
public Timeline()
{
RelativeSizeAxes = Axes.X;
Height = timeline_height;
ZoomDuration = 200;
ZoomEasing = Easing.OutQuint;
ScrollbarVisible = false;

View File

@ -14,7 +14,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
public class TimelineArea : Container
{
public readonly Timeline Timeline = new Timeline { RelativeSizeAxes = Axes.Both };
public readonly Timeline Timeline = new Timeline();
protected override Container<Drawable> Content => Timeline;
@ -37,7 +37,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
},
new GridContainer
{
RelativeSizeAxes = Axes.Both,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Content = new[]
{
new Drawable[]
@ -126,11 +127,15 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
Timeline
},
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
},
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.Distributed),
new Dimension(),
}
}
};

View File

@ -19,8 +19,6 @@ namespace osu.Game.Screens.Edit
private const float vertical_margins = 10;
private const float horizontal_margins = 20;
private const float timeline_height = 110;
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
private Container timelineContainer;
@ -40,64 +38,86 @@ namespace osu.Game.Screens.Edit
if (beatDivisor != null)
this.beatDivisor.BindTo(beatDivisor);
Children = new Drawable[]
Child = new GridContainer
{
mainContent = new Container
RelativeSizeAxes = Axes.Both,
RowDimensions = new[]
{
Name = "Main content",
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding
{
Horizontal = horizontal_margins,
Top = vertical_margins + timeline_height,
Bottom = vertical_margins
},
Child = spinner = new LoadingSpinner(true)
{
State = { Value = Visibility.Visible },
},
new Dimension(GridSizeMode.AutoSize),
new Dimension(),
},
new Container
Content = new[]
{
Name = "Timeline",
RelativeSizeAxes = Axes.X,
Height = timeline_height,
Children = new Drawable[]
new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black.Opacity(0.5f)
},
new Container
{
Name = "Timeline content",
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Horizontal = horizontal_margins, Vertical = vertical_margins },
Child = new GridContainer
Name = "Timeline",
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
RelativeSizeAxes = Axes.Both,
Content = new[]
new Box
{
new Drawable[]
{
timelineContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Right = 5 },
},
new BeatDivisorControl(beatDivisor) { RelativeSizeAxes = Axes.Both }
},
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black.Opacity(0.5f)
},
ColumnDimensions = new[]
new Container
{
new Dimension(),
new Dimension(GridSizeMode.Absolute, 90),
Name = "Timeline content",
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = horizontal_margins, Vertical = vertical_margins },
Child = new GridContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Content = new[]
{
new Drawable[]
{
timelineContainer = new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Right = 5 },
},
new BeatDivisorControl(beatDivisor) { RelativeSizeAxes = Axes.Both }
},
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
},
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.Absolute, 90),
}
},
}
}
},
},
new Drawable[]
{
mainContent = new Container
{
Name = "Main content",
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding
{
Horizontal = horizontal_margins,
Top = vertical_margins,
Bottom = vertical_margins
},
}
}
},
Child = spinner = new LoadingSpinner(true)
{
State = { Value = Visibility.Visible },
},
},
},
}
};
}
@ -114,7 +134,8 @@ namespace osu.Game.Screens.Edit
LoadComponentAsync(new TimelineArea
{
RelativeSizeAxes = Axes.Both,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new[]
{
CreateTimelineContent(),