mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:17:23 +08:00
Add ability to change slider velocity with shift-drag
This commit is contained in:
parent
b19dc5e41f
commit
87cfcf706e
@ -382,15 +382,29 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
switch (hitObject)
|
||||
{
|
||||
case IHasRepeats repeatHitObject:
|
||||
// find the number of repeats which can fit in the requested time.
|
||||
var lengthOfOneRepeat = repeatHitObject.Duration / (repeatHitObject.RepeatCount + 1);
|
||||
var proposedCount = Math.Max(0, (int)Math.Round((time - hitObject.StartTime) / lengthOfOneRepeat) - 1);
|
||||
double proposedDuration = time - hitObject.StartTime;
|
||||
|
||||
if (proposedCount == repeatHitObject.RepeatCount)
|
||||
return;
|
||||
if (e.CurrentState.Keyboard.ShiftPressed)
|
||||
{
|
||||
if (hitObject.DifficultyControlPoint == DifficultyControlPoint.DEFAULT)
|
||||
hitObject.DifficultyControlPoint = new DifficultyControlPoint();
|
||||
|
||||
hitObject.DifficultyControlPoint.SliderVelocity *= (repeatHitObject.Duration / proposedDuration);
|
||||
beatmap.Update(hitObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
// find the number of repeats which can fit in the requested time.
|
||||
var lengthOfOneRepeat = repeatHitObject.Duration / (repeatHitObject.RepeatCount + 1);
|
||||
var proposedCount = Math.Max(0, (int)Math.Round(proposedDuration / lengthOfOneRepeat) - 1);
|
||||
|
||||
if (proposedCount == repeatHitObject.RepeatCount)
|
||||
return;
|
||||
|
||||
repeatHitObject.RepeatCount = proposedCount;
|
||||
beatmap.Update(hitObject);
|
||||
}
|
||||
|
||||
repeatHitObject.RepeatCount = proposedCount;
|
||||
beatmap.Update(hitObject);
|
||||
break;
|
||||
|
||||
case IHasDuration endTimeHitObject:
|
||||
|
Loading…
Reference in New Issue
Block a user