mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:07:44 +08:00
Add 1ms lenience to avoid potential precision issues
This commit is contained in:
parent
6c7475f085
commit
127330b8f9
@ -25,7 +25,7 @@ using osu.Game.Screens.Edit.Components.RadioButtons;
|
||||
using osu.Game.Screens.Edit.Compose;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
using osuTK;
|
||||
using Key = osuTK.Input.Key;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit
|
||||
{
|
||||
@ -297,9 +297,12 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
double snappedEndTime = BeatSnapProvider.SnapTime(actualDuration, referenceTime);
|
||||
|
||||
double beatLength = BeatSnapProvider.GetBeatLengthAtTime(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);
|
||||
// as we are snapping to beat length via SnapTime (which will round-to-nearest), check for snapping in the forward direction and reverse it.
|
||||
if (snappedEndTime > actualDuration + 1)
|
||||
snappedEndTime -= beatLength;
|
||||
|
||||
return DurationToDistance(referenceTime, snappedEndTime - referenceTime);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user