mirror of
https://github.com/ppy/osu.git
synced 2024-11-14 15:17:27 +08:00
working jank solution
This commit is contained in:
parent
f5d6d52d4c
commit
b4f9878b46
@ -72,10 +72,27 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
};
|
||||
|
||||
hitObjectVersion = hitObject.Path.Version.GetBoundCopy();
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
inputManager = GetContainingInputManager();
|
||||
|
||||
controlPoints.CollectionChanged += onControlPointsChanged;
|
||||
controlPoints.BindTo(hitObject.Path.ControlPoints);
|
||||
|
||||
// schedule ensure that updates are only applied after all operations from a single frame are applied.
|
||||
// this avoids inadvertently changing the hit object path type for batch operations.
|
||||
hitObjectVersion.BindValueChanged(_ => Scheduler.AddOnce(cachePointsAndEnsureValidPathTypes));
|
||||
hitObject.Path.Validating += cachePointsAndEnsureValidPathTypes;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
hitObject.Path.Validating -= cachePointsAndEnsureValidPathTypes;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -88,7 +105,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
foreach (var controlPoint in controlPoints)
|
||||
{
|
||||
if (controlPoint.Type != null)
|
||||
{
|
||||
pointsInCurrentSegment.Add(controlPoint);
|
||||
pointsInCurrentSegment = new List<PathControlPoint>();
|
||||
}
|
||||
|
||||
pointsInCurrentSegment.Add(controlPoint);
|
||||
|
||||
@ -99,13 +119,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
foreach (var piece in Pieces)
|
||||
{
|
||||
if (piece.ControlPoint.Type != PathType.PERFECT_CURVE)
|
||||
return;
|
||||
continue;
|
||||
|
||||
if (piece.PointsInSegment.Count > 3)
|
||||
piece.ControlPoint.Type = PathType.BEZIER;
|
||||
|
||||
if (piece.PointsInSegment.Count != 3)
|
||||
return;
|
||||
continue;
|
||||
|
||||
ReadOnlySpan<Vector2> points = piece.PointsInSegment.Select(p => p.Position).ToArray();
|
||||
RectangleF boundingBox = PathApproximator.CircularArcBoundingBox(points);
|
||||
@ -114,16 +134,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
}
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
inputManager = GetContainingInputManager();
|
||||
|
||||
controlPoints.CollectionChanged += onControlPointsChanged;
|
||||
controlPoints.BindTo(hitObject.Path.ControlPoints);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selects the <see cref="PathControlPointPiece{T}"/> corresponding to the given <paramref name="pathControlPoint"/>,
|
||||
/// and deselects all other <see cref="PathControlPointPiece{T}"/>s.
|
||||
|
@ -25,6 +25,8 @@ namespace osu.Game.Rulesets.Objects
|
||||
|
||||
private readonly Bindable<int> version = new Bindable<int>();
|
||||
|
||||
public event Action? Validating;
|
||||
|
||||
/// <summary>
|
||||
/// The user-set distance of the path. If non-null, <see cref="Distance"/> will match this value,
|
||||
/// and the path will be shortened/lengthened to match this length.
|
||||
@ -233,6 +235,8 @@ namespace osu.Game.Rulesets.Objects
|
||||
if (pathCache.IsValid)
|
||||
return;
|
||||
|
||||
Validating?.Invoke();
|
||||
|
||||
calculatePath();
|
||||
calculateLength();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user