1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Remove return values from HandleScale submethods

This commit is contained in:
Leon Gebler 2021-03-26 16:39:13 +01:00
parent 5d272bef97
commit 25ea60cb92

View File

@ -143,19 +143,18 @@ namespace osu.Game.Rulesets.Osu.Edit
adjustScaleFromAnchor(ref scale, reference); adjustScaleFromAnchor(ref scale, reference);
var hitObjects = selectedMovableObjects; var hitObjects = selectedMovableObjects;
bool result;
// for the time being, allow resizing of slider paths only if the slider is // for the time being, allow resizing of slider paths only if the slider is
// the only hit object selected. with a group selection, it's likely the user // the only hit object selected. with a group selection, it's likely the user
// is not looking to change the duration of the slider but expand the whole pattern. // is not looking to change the duration of the slider but expand the whole pattern.
if (hitObjects.Length == 1 && hitObjects.First() is Slider slider) if (hitObjects.Length == 1 && hitObjects.First() is Slider slider)
result = scaleSlider(slider, scale); scaleSlider(slider, scale);
else else
result = scaleHitObjects(hitObjects, reference, scale); scaleHitObjects(hitObjects, reference, scale);
moveSelectionInBounds(); moveSelectionInBounds();
return result; return true;
} }
private static void adjustScaleFromAnchor(ref Vector2 scale, Anchor reference) private static void adjustScaleFromAnchor(ref Vector2 scale, Anchor reference)
@ -192,7 +191,7 @@ namespace osu.Game.Rulesets.Osu.Edit
return true; return true;
} }
private bool scaleSlider(Slider slider, Vector2 scale) private void scaleSlider(Slider slider, Vector2 scale)
{ {
Quad sliderQuad = getSurroundingQuad(slider.Path.ControlPoints.Select(p => p.Position.Value)); Quad sliderQuad = getSurroundingQuad(slider.Path.ControlPoints.Select(p => p.Position.Value));
Vector2 pathRelativeDeltaScale = new Vector2(1 + scale.X / sliderQuad.Width, 1 + scale.Y / sliderQuad.Height); Vector2 pathRelativeDeltaScale = new Vector2(1 + scale.X / sliderQuad.Width, 1 + scale.Y / sliderQuad.Height);
@ -210,15 +209,13 @@ namespace osu.Game.Rulesets.Osu.Edit
(bool xInBounds, bool yInBounds) = isQuadInBounds(scaledQuad); (bool xInBounds, bool yInBounds) = isQuadInBounds(scaledQuad);
if (xInBounds && yInBounds) if (xInBounds && yInBounds)
return true; return;
foreach(var point in slider.Path.ControlPoints) foreach(var point in slider.Path.ControlPoints)
point.Position.Value = oldControlPoints.Dequeue(); point.Position.Value = oldControlPoints.Dequeue();
return true;
} }
private bool scaleHitObjects(OsuHitObject[] hitObjects, Anchor reference, Vector2 scale) private void scaleHitObjects(OsuHitObject[] hitObjects, Anchor reference, Vector2 scale)
{ {
scale = getClampedScale(hitObjects, reference, scale); scale = getClampedScale(hitObjects, reference, scale);
@ -241,8 +238,6 @@ namespace osu.Game.Rulesets.Osu.Edit
h.Position = newPosition; h.Position = newPosition;
} }
return true;
} }
private (bool X, bool Y) isQuadInBounds(Quad quad) private (bool X, bool Y) isQuadInBounds(Quad quad)