mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 20:13:22 +08:00
Fix zero length spinners and sliders
This commit is contained in:
parent
7da7079ef2
commit
ce3c2f07dc
@ -161,6 +161,27 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
||||
checkControlPointSelected(1, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestZeroLengthSliderNotAllowed()
|
||||
{
|
||||
moveMouseToControlPoint(1);
|
||||
AddStep("drag control point 1 to control point 0", () =>
|
||||
{
|
||||
InputManager.PressButton(MouseButton.Left);
|
||||
moveMouseToControlPoint(0);
|
||||
InputManager.ReleaseButton(MouseButton.Left);
|
||||
});
|
||||
moveMouseToControlPoint(2);
|
||||
AddStep("drag control point 2 to control point 0", () =>
|
||||
{
|
||||
InputManager.PressButton(MouseButton.Left);
|
||||
moveMouseToControlPoint(0);
|
||||
InputManager.ReleaseButton(MouseButton.Left);
|
||||
});
|
||||
checkPositions();
|
||||
|
||||
}
|
||||
|
||||
private void moveHitObject()
|
||||
{
|
||||
AddStep("move hitobject", () =>
|
||||
|
@ -226,7 +226,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
|
||||
private void updatePath()
|
||||
{
|
||||
HitObject.Path.ExpectedDistance.Value = composer?.GetSnappedDistanceFromDistance(HitObject.StartTime, (float)HitObject.Path.CalculatedDistance) ?? (float)HitObject.Path.CalculatedDistance;
|
||||
float expectedDistance = composer?.GetSnappedDistanceFromDistance(HitObject.StartTime, (float)HitObject.Path.CalculatedDistance) ?? (float)HitObject.Path.CalculatedDistance;
|
||||
if (expectedDistance < 1)
|
||||
return;
|
||||
HitObject.Path.ExpectedDistance.Value = expectedDistance;
|
||||
editorBeatmap?.Update(HitObject);
|
||||
}
|
||||
|
||||
|
@ -387,7 +387,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
case IHasDuration endTimeHitObject:
|
||||
var snappedTime = Math.Max(hitObject.StartTime, beatSnapProvider.SnapTime(time));
|
||||
|
||||
if (endTimeHitObject.EndTime == snappedTime)
|
||||
if (endTimeHitObject.EndTime == snappedTime || (snappedTime - hitObject.StartTime) < 1)
|
||||
return;
|
||||
|
||||
endTimeHitObject.Duration = snappedTime - hitObject.StartTime;
|
||||
|
Loading…
Reference in New Issue
Block a user