// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Input.StateChanges.Events; using osu.Framework.Input.States; using osuTK; namespace osu.Framework.Input.StateChanges { /// /// Denotes a relative change of mouse scroll. /// Pointing devices such as mice provide relative scroll input. /// public class MouseScrollRelativeInput : IInput { /// /// The change in scroll. This is added to the current scroll. /// public Vector2 Delta; /// /// Whether the change came from a device supporting precision scrolling. /// /// /// In cases this is true, scroll events will generally map 1:1 to user's input, rather than incrementing in large "notches" (as expected of traditional scroll wheels). /// public bool IsPrecise; public void Apply(InputState state, IInputStateChangeHandler handler) { var mouse = state.Mouse; if (Delta != Vector2.Zero) { var lastScroll = mouse.Scroll; mouse.Scroll += Delta; mouse.LastSource = this; handler.HandleInputStateChange(new MouseScrollChangeEvent(state, this, lastScroll, IsPrecise)); } } } }