mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Fix snapped distances potentially exceeding the source distance
This results in slider placement including "excess" length, where the curve is not applied to the placed path. This is generally not what we want. I considered adding a bool parameter (or enum) to change the floor/rounding mode, but on further examination I think this is what we always expect from this function.
This commit is contained in:
@ -293,7 +293,13 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
public override float GetSnappedDistanceFromDistance(double referenceTime, float distance)
|
||||
{
|
||||
var snappedEndTime = BeatSnapProvider.SnapTime(referenceTime + DistanceToDuration(referenceTime, distance), referenceTime);
|
||||
double actualDuration = referenceTime + DistanceToDuration(referenceTime, distance);
|
||||
|
||||
double snappedEndTime = BeatSnapProvider.SnapTime(actualDuration, referenceTime);
|
||||
|
||||
// we don't want to exceed the actual duration and snap to a point in the future.
|
||||
if (snappedEndTime > actualDuration)
|
||||
snappedEndTime -= BeatSnapProvider.GetBeatLengthAtTime(referenceTime);
|
||||
|
||||
return DurationToDistance(referenceTime, snappedEndTime - referenceTime);
|
||||
}
|
||||
|
Reference in New Issue
Block a user