Fix first scroll wheel in editor incorrectly advancing twice

This commit is contained in:
Dean Herbert 2020-08-31 18:01:16 +09:00
parent d3245dda1c
commit bee01bdd38
1 changed files with 1 additions and 1 deletions

View File

@ -284,7 +284,7 @@ protected override bool OnScroll(ScrollEvent e)
// this is a special case to handle the "pivot" scenario. // this is a special case to handle the "pivot" scenario.
// if we are precise scrolling in one direction then change our mind and scroll backwards, // if we are precise scrolling in one direction then change our mind and scroll backwards,
// the existing accumulation should be applied in the inverse direction to maintain responsiveness. // the existing accumulation should be applied in the inverse direction to maintain responsiveness.
if (Math.Sign(scrollAccumulation) != scrollDirection) if (scrollAccumulation != 0 && Math.Sign(scrollAccumulation) != scrollDirection)
scrollAccumulation = scrollDirection * (precision - Math.Abs(scrollAccumulation)); scrollAccumulation = scrollDirection * (precision - Math.Abs(scrollAccumulation));
scrollAccumulation += scrollComponent * (e.IsPrecise ? 0.1 : 1); scrollAccumulation += scrollComponent * (e.IsPrecise ? 0.1 : 1);