// 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 an absolute change of mouse position. /// Pointing devices such as tablets provide absolute input. /// /// /// This is the first input received from any pointing device. /// public class MousePositionAbsoluteInput : IInput { /// /// The position which will be assigned to the current position. /// public Vector2 Position; public void Apply(InputState state, IInputStateChangeHandler handler) { var mouse = state.Mouse; if (!mouse.IsPositionValid || mouse.Position != Position) { var lastPosition = mouse.IsPositionValid ? mouse.Position : Position; mouse.IsPositionValid = true; mouse.LastSource = this; mouse.Position = Position; handler.HandleInputStateChange(new MousePositionChangeEvent(state, this, lastPosition)); } } } }