mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 13:33:03 +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;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using Key = osuTK.Input.Key;
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit
|
namespace osu.Game.Rulesets.Edit
|
||||||
{
|
{
|
||||||
@ -297,9 +297,12 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
double snappedEndTime = BeatSnapProvider.SnapTime(actualDuration, referenceTime);
|
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.
|
// we don't want to exceed the actual duration and snap to a point in the future.
|
||||||
if (snappedEndTime > actualDuration)
|
// as we are snapping to beat length via SnapTime (which will round-to-nearest), check for snapping in the forward direction and reverse it.
|
||||||
snappedEndTime -= BeatSnapProvider.GetBeatLengthAtTime(referenceTime);
|
if (snappedEndTime > actualDuration + 1)
|
||||||
|
snappedEndTime -= beatLength;
|
||||||
|
|
||||||
return DurationToDistance(referenceTime, snappedEndTime - referenceTime);
|
return DurationToDistance(referenceTime, snappedEndTime - referenceTime);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user