internal void OnMouseWheel(Control sender, Messages.MouseWheel args) { if (!CanScroll) { return; } var direction = args.Direction == Messages.MouseWheel.Directions.Down ? 1 : -1; var step = args.ScrollSteps * ScrollStep; // Don't tween if the new position is the same as the previous position var tweenTo = -Math.Min(MaxViewIndex, Math.Max(0, -CurrentViewIndex + direction * step)); if (tweenTo == CurrentViewIndex) { return; } if (CurrentTween != null) { CurrentTween.Cancel(); } CurrentTween = Tweener.Tween(this, new { CurrentViewIndex = -Math.Min(MaxViewIndex, Math.Max(0, -CurrentViewIndex + direction * step)) }, 0.5f); CurrentTween.Ease(Ease.CircOut); CurrentTween.OnBegin(delegate { Tweening = true; }); CurrentTween.OnComplete(delegate { Tweening = false; }); }