1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:43:05 +08:00

Fix osu! logo drag area being a square

This commit is contained in:
Joseph Madamba 2022-10-26 18:33:07 -07:00
parent 90a68880ea
commit 0efbae6e70

View File

@ -113,7 +113,7 @@ namespace osu.Game.Screens.Menu
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
logoBounceContainer = new DragContainer logoBounceContainer = new Container
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
@ -407,27 +407,24 @@ namespace osu.Game.Screens.Menu
impactContainer.ScaleTo(1.12f, 250); impactContainer.ScaleTo(1.12f, 250);
} }
private class DragContainer : Container public override bool DragBlocksClick => false;
protected override bool OnDragStart(DragStartEvent e) => true;
protected override void OnDrag(DragEvent e)
{ {
public override bool DragBlocksClick => false; Vector2 change = e.MousePosition - e.MouseDownPosition;
protected override bool OnDragStart(DragStartEvent e) => true; // Diminish the drag distance as we go further to simulate "rubber band" feeling.
change *= change.Length <= 0 ? 0 : MathF.Pow(change.Length, 0.6f) / change.Length;
protected override void OnDrag(DragEvent e) logoBounceContainer.MoveTo(change);
{ }
Vector2 change = e.MousePosition - e.MouseDownPosition;
// Diminish the drag distance as we go further to simulate "rubber band" feeling. protected override void OnDragEnd(DragEndEvent e)
change *= change.Length <= 0 ? 0 : MathF.Pow(change.Length, 0.6f) / change.Length; {
logoBounceContainer.MoveTo(Vector2.Zero, 800, Easing.OutElastic);
this.MoveTo(change); base.OnDragEnd(e);
}
protected override void OnDragEnd(DragEndEvent e)
{
this.MoveTo(Vector2.Zero, 800, Easing.OutElastic);
base.OnDragEnd(e);
}
} }
} }
} }