1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 02:12:57 +08:00

Rename parameter

This commit is contained in:
Marvin Schürz 2024-09-24 12:40:28 +02:00
parent 3180468db1
commit b54b4063be

View File

@ -50,14 +50,14 @@ namespace osu.Game.Screens.Edit.Compose.Components
rawScale = convertDragEventToScaleMultiplier(e); rawScale = convertDragEventToScaleMultiplier(e);
applyScale(shouldLockAspectRatio: isCornerAnchor(originalAnchor) && e.ShiftPressed, ignoreAnchor: e.AltPressed); applyScale(shouldLockAspectRatio: isCornerAnchor(originalAnchor) && e.ShiftPressed, useDefaultOrigin: e.AltPressed);
} }
protected override bool OnKeyDown(KeyDownEvent e) protected override bool OnKeyDown(KeyDownEvent e)
{ {
if (IsDragged) if (IsDragged)
{ {
applyScale(shouldLockAspectRatio: isCornerAnchor(originalAnchor) && e.ShiftPressed, ignoreAnchor: e.AltPressed); applyScale(shouldLockAspectRatio: isCornerAnchor(originalAnchor) && e.ShiftPressed, useDefaultOrigin: e.AltPressed);
return true; return true;
} }
@ -69,7 +69,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
base.OnKeyUp(e); base.OnKeyUp(e);
if (IsDragged) if (IsDragged)
applyScale(shouldLockAspectRatio: isCornerAnchor(originalAnchor) && e.ShiftPressed, ignoreAnchor: e.AltPressed); applyScale(shouldLockAspectRatio: isCornerAnchor(originalAnchor) && e.ShiftPressed, useDefaultOrigin: e.AltPressed);
} }
protected override void OnDragEnd(DragEndEvent e) protected override void OnDragEnd(DragEndEvent e)
@ -100,13 +100,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
if ((originalAnchor & Anchor.y0) > 0) scale.Y = -scale.Y; if ((originalAnchor & Anchor.y0) > 0) scale.Y = -scale.Y;
} }
private void applyScale(bool shouldLockAspectRatio, bool ignoreAnchor = false) private void applyScale(bool shouldLockAspectRatio, bool useDefaultOrigin = false)
{ {
var newScale = shouldLockAspectRatio var newScale = shouldLockAspectRatio
? new Vector2((rawScale.X + rawScale.Y) * 0.5f) ? new Vector2((rawScale.X + rawScale.Y) * 0.5f)
: rawScale; : rawScale;
Vector2? scaleOrigin = ignoreAnchor ? null : originalAnchor.Opposite().PositionOnQuad(scaleHandler!.OriginalSurroundingQuad!.Value); Vector2? scaleOrigin = useDefaultOrigin ? null : originalAnchor.Opposite().PositionOnQuad(scaleHandler!.OriginalSurroundingQuad!.Value);
scaleHandler!.Update(newScale, scaleOrigin, getAdjustAxis()); scaleHandler!.Update(newScale, scaleOrigin, getAdjustAxis());
} }