1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:47:52 +08:00

Follow start time and duration changes

This commit is contained in:
Dean Herbert 2020-01-22 17:11:37 +09:00
parent 63cef8b8b7
commit f0d810fe20

View File

@ -2,6 +2,8 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using JetBrains.Annotations;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
@ -115,6 +117,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private readonly Container extensionBar;
[UsedImplicitly]
private readonly Bindable<double> startTime;
public const float THICKNESS = 3;
private const float circle_size = 16;
@ -127,9 +132,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
Anchor = Anchor.CentreLeft;
Origin = Anchor.CentreLeft;
Width = (float)(hitObject.GetEndTime() - hitObject.StartTime);
X = (float)hitObject.StartTime;
startTime = hitObject.StartTimeBindable.GetBoundCopy();
startTime.BindValueChanged(time => X = (float)time.NewValue, true);
RelativePositionAxes = Axes.X;
@ -168,6 +172,14 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
});
}
protected override void Update()
{
base.Update();
// no bindable so we perform this every update
Width = (float)(HitObject.GetEndTime() - HitObject.StartTime);
}
protected override void OnSelected()
{
circle.BorderColour = Color4.Orange;