mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 09:27:18 +09:00
Fix nested objects in overlapping scrolling hit object container ruleset not using correct reference time
This commit is contained in:
parent
ec3761ced9
commit
d237c818f6
@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.UI.Scrolling.Algorithms
|
|||||||
return -PositionAt(startTime, endTime, timeRange, scrollLength);
|
return -PositionAt(startTime, endTime, timeRange, scrollLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float PositionAt(double time, double currentTime, double timeRange, float scrollLength)
|
public float PositionAt(double time, double currentTime, double timeRange, float scrollLength, double? originTime = null)
|
||||||
=> (float)((time - currentTime) / timeRange * scrollLength);
|
=> (float)((time - currentTime) / timeRange * scrollLength);
|
||||||
|
|
||||||
public double TimeAt(float position, double currentTime, double timeRange, float scrollLength)
|
public double TimeAt(float position, double currentTime, double timeRange, float scrollLength)
|
||||||
|
@ -53,8 +53,9 @@ namespace osu.Game.Rulesets.UI.Scrolling.Algorithms
|
|||||||
/// <param name="currentTime">The current time.</param>
|
/// <param name="currentTime">The current time.</param>
|
||||||
/// <param name="timeRange">The amount of visible time.</param>
|
/// <param name="timeRange">The amount of visible time.</param>
|
||||||
/// <param name="scrollLength">The absolute spatial length through <paramref name="timeRange"/>.</param>
|
/// <param name="scrollLength">The absolute spatial length through <paramref name="timeRange"/>.</param>
|
||||||
|
/// <param name="originTime">The time to be used for control point lookups (ie. the parent's start time for nested hit objects).</param>
|
||||||
/// <returns>The absolute spatial position.</returns>
|
/// <returns>The absolute spatial position.</returns>
|
||||||
float PositionAt(double time, double currentTime, double timeRange, float scrollLength);
|
float PositionAt(double time, double currentTime, double timeRange, float scrollLength, double? originTime = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Computes the time which brings a point to a provided spatial position given the current time.
|
/// Computes the time which brings a point to a provided spatial position given the current time.
|
||||||
@ -63,7 +64,7 @@ namespace osu.Game.Rulesets.UI.Scrolling.Algorithms
|
|||||||
/// <param name="currentTime">The current time.</param>
|
/// <param name="currentTime">The current time.</param>
|
||||||
/// <param name="timeRange">The amount of visible time.</param>
|
/// <param name="timeRange">The amount of visible time.</param>
|
||||||
/// <param name="scrollLength">The absolute spatial length through <paramref name="timeRange"/>.</param>
|
/// <param name="scrollLength">The absolute spatial length through <paramref name="timeRange"/>.</param>
|
||||||
/// <returns>The time at which <see cref="PositionAt(double,double,double,float)"/> == <paramref name="position"/>.</returns>
|
/// <returns>The time at which <see cref="PositionAt(double,double,double,float, double?)"/> == <paramref name="position"/>.</returns>
|
||||||
double TimeAt(float position, double currentTime, double timeRange, float scrollLength);
|
double TimeAt(float position, double currentTime, double timeRange, float scrollLength);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -34,8 +34,8 @@ namespace osu.Game.Rulesets.UI.Scrolling.Algorithms
|
|||||||
return -PositionAt(startTime, endTime, timeRange, scrollLength);
|
return -PositionAt(startTime, endTime, timeRange, scrollLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float PositionAt(double time, double currentTime, double timeRange, float scrollLength)
|
public float PositionAt(double time, double currentTime, double timeRange, float scrollLength, double? originTime = null)
|
||||||
=> (float)((time - currentTime) / timeRange * controlPointAt(time).Multiplier * scrollLength);
|
=> (float)((time - currentTime) / timeRange * controlPointAt(originTime ?? time).Multiplier * scrollLength);
|
||||||
|
|
||||||
public double TimeAt(float position, double currentTime, double timeRange, float scrollLength)
|
public double TimeAt(float position, double currentTime, double timeRange, float scrollLength)
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.UI.Scrolling.Algorithms
|
|||||||
return (float)(objectLength * scrollLength);
|
return (float)(objectLength * scrollLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float PositionAt(double time, double currentTime, double timeRange, float scrollLength)
|
public float PositionAt(double time, double currentTime, double timeRange, float scrollLength, double? originTime = null)
|
||||||
{
|
{
|
||||||
double timelineLength = relativePositionAt(time, timeRange) - relativePositionAt(currentTime, timeRange);
|
double timelineLength = relativePositionAt(time, timeRange) - relativePositionAt(currentTime, timeRange);
|
||||||
return (float)(timelineLength * scrollLength);
|
return (float)(timelineLength * scrollLength);
|
||||||
|
@ -93,9 +93,9 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Given a time, return the position along the scrolling axis within this <see cref="HitObjectContainer"/> at time <paramref name="currentTime"/>.
|
/// Given a time, return the position along the scrolling axis within this <see cref="HitObjectContainer"/> at time <paramref name="currentTime"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float PositionAtTime(double time, double currentTime)
|
public float PositionAtTime(double time, double currentTime, double? originTime = null)
|
||||||
{
|
{
|
||||||
float scrollPosition = scrollingInfo.Algorithm.PositionAt(time, currentTime, timeRange.Value, scrollLength);
|
float scrollPosition = scrollingInfo.Algorithm.PositionAt(time, currentTime, timeRange.Value, scrollLength, originTime);
|
||||||
return axisInverted ? -scrollPosition : scrollPosition;
|
return axisInverted ? -scrollPosition : scrollPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,14 +252,14 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
updateLayoutRecursive(obj);
|
updateLayoutRecursive(obj);
|
||||||
|
|
||||||
// Nested hitobjects don't need to scroll, but they do need accurate positions and start lifetime
|
// Nested hitobjects don't need to scroll, but they do need accurate positions and start lifetime
|
||||||
updatePosition(obj, hitObject.HitObject.StartTime);
|
updatePosition(obj, hitObject.HitObject.StartTime, hitObject.HitObject.StartTime);
|
||||||
setComputedLifetimeStart(obj.Entry);
|
setComputedLifetimeStart(obj.Entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePosition(DrawableHitObject hitObject, double currentTime)
|
private void updatePosition(DrawableHitObject hitObject, double currentTime, double? parentHitObjectStartTime = null)
|
||||||
{
|
{
|
||||||
float position = PositionAtTime(hitObject.HitObject.StartTime, currentTime);
|
float position = PositionAtTime(hitObject.HitObject.StartTime, currentTime, parentHitObjectStartTime);
|
||||||
|
|
||||||
if (scrollingAxis == Direction.Horizontal)
|
if (scrollingAxis == Direction.Horizontal)
|
||||||
hitObject.X = position;
|
hitObject.X = position;
|
||||||
|
@ -99,7 +99,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
public float GetLength(double startTime, double endTime, double timeRange, float scrollLength)
|
public float GetLength(double startTime, double endTime, double timeRange, float scrollLength)
|
||||||
=> implementation.GetLength(startTime, endTime, timeRange, scrollLength);
|
=> implementation.GetLength(startTime, endTime, timeRange, scrollLength);
|
||||||
|
|
||||||
public float PositionAt(double time, double currentTime, double timeRange, float scrollLength)
|
public float PositionAt(double time, double currentTime, double timeRange, float scrollLength, double? originTime = null)
|
||||||
=> implementation.PositionAt(time, currentTime, timeRange, scrollLength);
|
=> implementation.PositionAt(time, currentTime, timeRange, scrollLength);
|
||||||
|
|
||||||
public double TimeAt(float position, double currentTime, double timeRange, float scrollLength)
|
public double TimeAt(float position, double currentTime, double timeRange, float scrollLength)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user