From f0d810fe2098a94a15ad34e439a98ca36e42b59b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Jan 2020 17:11:37 +0900 Subject: [PATCH] Follow start time and duration changes --- .../Timeline/TimelineHitObjectDisplay.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectDisplay.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectDisplay.cs index 10b470e4b7..a11958c8c9 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectDisplay.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectDisplay.cs @@ -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 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;