mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge remote-tracking branch 'upstream/master' into visible-playfield-boundary
This commit is contained in:
@ -26,7 +26,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
|
||||
{
|
||||
@ -294,7 +294,16 @@ 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);
|
||||
|
||||
double beatLength = BeatSnapProvider.GetBeatLengthAtTime(referenceTime);
|
||||
|
||||
// we don't want to exceed the actual duration and snap to a point in the future.
|
||||
// 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);
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
/// <summary>
|
||||
/// Converts an unsnapped distance to a snapped distance.
|
||||
/// The returned distance will always be floored (as to never exceed the provided <paramref name="distance"/>.
|
||||
/// </summary>
|
||||
/// <param name="referenceTime">The time of the timing point which <paramref name="distance"/> resides in.</param>
|
||||
/// <param name="distance">The distance to convert.</param>
|
||||
|
Reference in New Issue
Block a user