mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:43:05 +08:00
Add basic scaling support
This commit is contained in:
parent
492cdb6a05
commit
756141d9ed
@ -24,11 +24,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
base.LoadComplete();
|
||||
Vector2 getCenteredVector(Vector2 top, Vector2 bottom) => new Vector2(top.X, top.Y + (bottom.Y - top.Y) / 2);
|
||||
|
||||
const float padding = 10;
|
||||
|
||||
var q1 = Source.ScreenSpaceDrawQuad;
|
||||
var q2 = Destination.ScreenSpaceDrawQuad;
|
||||
|
||||
float padding = q1.Width / 20;
|
||||
|
||||
bool progressionToRight = q2.TopLeft.X > q1.TopLeft.X;
|
||||
|
||||
if (!progressionToRight)
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.States;
|
||||
using OpenTK;
|
||||
@ -13,10 +14,22 @@ namespace osu.Game.Tournament.Screens.Ladder
|
||||
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
|
||||
|
||||
private Vector2 target;
|
||||
|
||||
private float scale = 1;
|
||||
|
||||
protected override bool OnDrag(InputState state)
|
||||
{
|
||||
Position += state.Mouse.Delta;
|
||||
this.MoveTo(target += state.Mouse.Delta, 1000, Easing.OutQuint);
|
||||
|
||||
return base.OnDrag(state);
|
||||
}
|
||||
|
||||
protected override bool OnScroll(InputState state)
|
||||
{
|
||||
this.ScaleTo(scale += state.Mouse.ScrollDelta.Y / 15, 1000, Easing.OutQuint);
|
||||
|
||||
return base.OnScroll(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user