Fix selection blueprint not re-snapping the path

This commit is contained in:
smoogipoo 2019-12-06 16:36:08 +09:00
parent b4e1b5fa98
commit d29ccdc25e
1 changed files with 12 additions and 2 deletions

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
@ -44,6 +45,16 @@ public SliderSelectionBlueprint(DrawableSlider slider)
}; };
} }
private IBindable<int> pathVersion;
protected override void LoadComplete()
{
base.LoadComplete();
pathVersion = HitObject.Path.Version.GetBoundCopy();
pathVersion.BindValueChanged(_ => updatePath());
}
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
@ -112,10 +123,9 @@ private int addControlPoint(Vector2 position)
return insertionIndex; return insertionIndex;
} }
private void onNewControlPoints(Vector2[] controlPoints) private void updatePath()
{ {
HitObject.Path.ExpectedDistance.Value = composer?.GetSnappedDistanceFromDistance(HitObject.StartTime, (float)HitObject.Path.CalculatedDistance) ?? (float)HitObject.Path.CalculatedDistance; HitObject.Path.ExpectedDistance.Value = composer?.GetSnappedDistanceFromDistance(HitObject.StartTime, (float)HitObject.Path.CalculatedDistance) ?? (float)HitObject.Path.CalculatedDistance;
UpdateHitObject(); UpdateHitObject();
} }