Fix adjustment not working when dragged before object

This commit is contained in:
smoogipoo 2020-02-06 14:47:43 +09:00
parent c138e3907e
commit 6ae0efa40d

View File

@ -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;