1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 18:12:56 +08:00

Improve zoom logic

This commit is contained in:
Dean Herbert 2018-09-25 10:46:09 +09:00
parent e74fd042aa
commit c210ea7c39

View File

@ -20,18 +20,18 @@ namespace osu.Game.Tournament.Screens.Ladder
protected override bool OnDrag(InputState state) protected override bool OnDrag(InputState state)
{ {
this.TransformTo(nameof(OriginPosition), target -= state.Mouse.Delta / scale, 1000, Easing.OutQuint); this.MoveTo(target += state.Mouse.Delta, 1000, Easing.OutQuint);
return base.OnDrag(state); return true;
} }
protected override bool OnScroll(InputState state) protected override bool OnScroll(InputState state)
{ {
this.ScaleTo(scale += state.Mouse.ScrollDelta.Y / 15 * scale, 1000, Easing.OutQuint); var newScale = scale + state.Mouse.ScrollDelta.Y / 15 * scale;
target = ToLocalSpace(state.Mouse.NativeState.Position) / 2; this.MoveTo(target = target - state.Mouse.Position * (newScale - scale), 1000, Easing.OutQuint);
this.TransformTo(nameof(OriginPosition), target, 1000, Easing.OutQuint);
return base.OnScroll(state); this.ScaleTo(scale = newScale, 1000, Easing.OutQuint);
return true;
} }
protected override void Update() protected override void Update()