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