From 756141d9ed6b2ca3d2941ce73002bb3c5dbceea7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 04:51:40 +0900 Subject: [PATCH] Add basic scaling support --- .../Screens/Ladder/Components/ProgressionPath.cs | 4 ++-- .../Screens/Ladder/ScrollableContainer.cs | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs index c44f67a171..841148ce90 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/ProgressionPath.cs @@ -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) diff --git a/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs b/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs index bb4f2e58a9..f818a55296 100644 --- a/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs +++ b/osu.Game.Tournament/Screens/Ladder/ScrollableContainer.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // 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); + } } }