1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 08:27:49 +08:00

Prevent snapping outside of track length

This commit is contained in:
kerabite 2023-09-29 05:47:22 -05:00
parent 0ffefce2a7
commit 15c56fcf8f
No known key found for this signature in database

View File

@ -317,6 +317,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All)
{
double time = TimeAtPosition(Content.ToLocalSpace(screenSpacePosition).X);
// prevent snapping outside of track length
time = Math.Min(time, editorClock.TrackLength);
return new SnapResult(screenSpacePosition, beatSnapProvider.SnapTime(time));
}
}