From 6ae0efa40d350521d28720fccd050ce7502fb8e3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 6 Feb 2020 14:47:43 +0900 Subject: [PATCH] Fix adjustment not working when dragged before object --- .../Components/Timeline/TimelineHitObjectBlueprint.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs index 5225a4299e..8f12c2f0ed 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineHitObjectBlueprint.cs @@ -275,18 +275,18 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline case IHasRepeats repeatHitObject: // find the number of repeats which can fit in the requested time. var lengthOfOneRepeat = repeatHitObject.Duration / (repeatHitObject.RepeatCount + 1); - var proposedCount = (int)((time - hitObject.StartTime) / lengthOfOneRepeat) - 1; + var proposedCount = Math.Max(0, (int)((time - hitObject.StartTime) / lengthOfOneRepeat) - 1); - if (proposedCount == repeatHitObject.RepeatCount || proposedCount < 0) + if (proposedCount == repeatHitObject.RepeatCount) return; repeatHitObject.RepeatCount = proposedCount; break; case IHasEndTime endTimeHitObject: - var snappedTime = beatSnapProvider.SnapTime(time); + var snappedTime = Math.Max(hitObject.StartTime, beatSnapProvider.SnapTime(time)); - if (endTimeHitObject.EndTime == snappedTime || snappedTime <= hitObject.StartTime) + if (endTimeHitObject.EndTime == snappedTime) return; endTimeHitObject.EndTime = snappedTime;