mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 08:02:55 +08:00
Limit zoom range of bracket display
This commit is contained in:
parent
a0503fcbe3
commit
4af16262e3
@ -8,7 +8,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Tournament.Screens.Ladder
|
||||
{
|
||||
public class ScrollableContainer : Container
|
||||
public class LadderDragContainer : Container
|
||||
{
|
||||
protected override bool OnDragStart(DragStartEvent e) => true;
|
||||
|
||||
@ -24,12 +24,15 @@ namespace osu.Game.Tournament.Screens.Ladder
|
||||
return true;
|
||||
}
|
||||
|
||||
private const float min_scale = 0.6f;
|
||||
private const float max_scale = 1.4f;
|
||||
|
||||
protected override bool OnScroll(ScrollEvent e)
|
||||
{
|
||||
var newScale = scale + e.ScrollDelta.Y / 15 * scale;
|
||||
this.MoveTo(target = target - e.MousePosition * (newScale - scale), 1000, Easing.OutQuint);
|
||||
var newScale = MathHelper.Clamp(scale + e.ScrollDelta.Y / 15 * scale, min_scale, max_scale);
|
||||
|
||||
this.ScaleTo(scale = newScale, 1000, Easing.OutQuint);
|
||||
this.MoveTo(target = target - e.MousePosition * (newScale - scale), 2000, Easing.OutQuint);
|
||||
this.ScaleTo(scale = newScale, 2000, Easing.OutQuint);
|
||||
|
||||
return true;
|
||||
}
|
@ -22,7 +22,7 @@ namespace osu.Game.Tournament.Screens.Ladder
|
||||
private Container<Path> paths;
|
||||
private Container headings;
|
||||
|
||||
protected ScrollableContainer ScrollContent;
|
||||
protected LadderDragContainer ScrollContent;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, Storage storage)
|
||||
@ -42,7 +42,7 @@ namespace osu.Game.Tournament.Screens.Ladder
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Loop = true,
|
||||
},
|
||||
ScrollContent = new ScrollableContainer
|
||||
ScrollContent = new LadderDragContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
@ -133,8 +133,5 @@ namespace osu.Game.Tournament.Screens.Ladder
|
||||
|
||||
layout.Validate();
|
||||
}
|
||||
|
||||
// todo: remove after ppy/osu-framework#1980 is merged.
|
||||
public override bool HandlePositionalInput => true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user