From 15c56fcf8f6d74147e4aca2e7009210af1f2dc55 Mon Sep 17 00:00:00 2001 From: kerabite <10791585+kerabite@users.noreply.github.com> Date: Fri, 29 Sep 2023 05:47:22 -0500 Subject: [PATCH] Prevent snapping outside of track length --- osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index 75de15fe56..992331dcfb 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -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)); } }