From a48c26d9993696fda11d624d5508dd8f06955530 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 22 Nov 2018 19:40:44 +0900 Subject: [PATCH] Fix precision scroll events being handled incorrectly by editor --- osu.Game/Screens/Edit/Editor.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 0be15de7f4..b355d1f349 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.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 System; using osuTK.Graphics; using osu.Framework.Screens; using osu.Game.Screens.Backgrounds; @@ -181,12 +182,20 @@ namespace osu.Game.Screens.Edit LoadComponentAsync(currentScreen, screenContainer.Add); } + private double scrollAccumulation; + protected override bool OnScroll(ScrollEvent e) { - if (e.ScrollDelta.X + e.ScrollDelta.Y > 0) + scrollAccumulation += e.ScrollDelta.X + e.ScrollDelta.Y * (e.IsPrecise ? 0.1 : 1); + if (Math.Abs(scrollAccumulation) < 1) + return true; + + if (scrollAccumulation > 0) clock.SeekBackward(!clock.IsRunning); else clock.SeekForward(!clock.IsRunning); + + scrollAccumulation = 0; return true; }