Refactor implementation to support hitobjects nested multiple levels deep

This commit is contained in:
Dean Herbert 2022-10-20 22:30:30 +09:00
parent a754dc6d3b
commit 26860a903e
1 changed files with 5 additions and 3 deletions

View File

@ -236,8 +236,10 @@ private void setComputedLifetimeStart(HitObjectLifetimeEntry entry)
entry.LifetimeStart = Math.Min(entry.HitObject.StartTime - judgementOffset, computedStartTime);
}
private void updateLayoutRecursive(DrawableHitObject hitObject)
private void updateLayoutRecursive(DrawableHitObject hitObject, double? parentHitObjectStartTime = null)
{
parentHitObjectStartTime ??= hitObject.HitObject.StartTime;
if (hitObject.HitObject is IHasDuration e)
{
float length = LengthAtTime(hitObject.HitObject.StartTime, e.EndTime);
@ -249,10 +251,10 @@ private void updateLayoutRecursive(DrawableHitObject hitObject)
foreach (var obj in hitObject.NestedHitObjects)
{
updateLayoutRecursive(obj);
updateLayoutRecursive(obj, parentHitObjectStartTime);
// Nested hitobjects don't need to scroll, but they do need accurate positions and start lifetime
updatePosition(obj, hitObject.HitObject.StartTime, hitObject.HitObject.StartTime);
updatePosition(obj, hitObject.HitObject.StartTime, parentHitObjectStartTime);
setComputedLifetimeStart(obj.Entry);
}
}