1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-06 19:47:19 +08:00

130 lines
5.6 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-05-18 13:05:58 +09:00
2019-12-05 20:12:25 +09:00
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
2018-05-18 13:05:58 +09:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
2018-05-18 13:05:58 +09:00
using osu.Game.Graphics.UserInterface;
2018-11-20 16:51:59 +09:00
using osuTK;
2018-05-18 13:05:58 +09:00
2018-11-06 18:28:22 +09:00
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
2018-05-18 13:05:58 +09:00
{
2019-12-05 20:12:25 +09:00
public class TimelineArea : Container
2018-05-18 13:05:58 +09:00
{
2019-12-06 11:26:50 +09:00
private readonly Timeline timeline = new Timeline { RelativeSizeAxes = Axes.Both };
2018-05-18 13:05:58 +09:00
2019-12-05 20:12:25 +09:00
protected override Container<Drawable> Content => timeline;
[BackgroundDependencyLoader]
private void load()
2018-05-18 13:05:58 +09:00
{
Masking = true;
CornerRadius = 5;
OsuCheckbox waveformCheckbox;
2018-05-18 13:05:58 +09:00
InternalChildren = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4Extensions.FromHex("111")
2018-05-18 13:05:58 +09:00
},
new GridContainer
{
RelativeSizeAxes = Axes.Both,
Content = new[]
{
new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4Extensions.FromHex("222")
2018-05-18 13:05:58 +09:00
},
new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Y,
Width = 160,
Padding = new MarginPadding { Horizontal = 15 },
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 4),
Children = new[]
{
waveformCheckbox = new OsuCheckbox { LabelText = "Waveform" }
}
}
}
},
new Container
{
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4Extensions.FromHex("333")
2018-05-18 13:05:58 +09:00
},
new Container<TimelineButton>
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Masking = true,
Children = new[]
{
new TimelineButton
{
RelativeSizeAxes = Axes.Y,
Height = 0.5f,
2019-04-02 19:55:24 +09:00
Icon = FontAwesome.Solid.SearchPlus,
Action = () => changeZoom(1)
2018-05-18 13:05:58 +09:00
},
new TimelineButton
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.Y,
Height = 0.5f,
2019-04-02 19:55:24 +09:00
Icon = FontAwesome.Solid.SearchMinus,
Action = () => changeZoom(-1)
2018-05-18 13:05:58 +09:00
},
}
}
}
},
2019-12-06 11:26:50 +09:00
timeline
2018-05-18 13:05:58 +09:00
},
},
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.Distributed),
}
}
};
waveformCheckbox.Current.Value = true;
timeline.WaveformVisible.BindTo(waveformCheckbox.Current);
}
private void changeZoom(float change) => timeline.Zoom += change;
2018-05-18 13:05:58 +09:00
}
}