Skip to content

Commit

Permalink
Invalidate mouse position when releasing last touch finger
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzibyte committed Dec 15, 2024
1 parent d95cc56 commit 52944cd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions osu.Framework/Input/InputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ protected virtual bool HandleMouseTouchStateChange(TouchStateChangeEvent e)
if (!MapMouseToLatestTouch)
return false;

// Update mouse position state
if (e.IsActive == true || e.LastPosition != null)
{
new MousePositionAbsoluteInputFromTouch(e)
Expand All @@ -802,6 +803,7 @@ protected virtual bool HandleMouseTouchStateChange(TouchStateChangeEvent e)
}.Apply(CurrentState, this);
}

// Update mouse button state
if (e.IsActive != null)
{
if (e.IsActive == true)
Expand All @@ -812,6 +814,11 @@ protected virtual bool HandleMouseTouchStateChange(TouchStateChangeEvent e)
updateTouchMouseLeft(e);
}

// Invalidate mouse position if releasing last touch. This is done after updating button state
// for click events to be processed on the targeted input queue before the position is invalidated.
if (e.IsActive == false && !e.State.Touch.ActiveSources.HasAnyButtonPressed)
new MouseInvalidatePositionInputFromTouch(e).Apply(CurrentState, this);

updateTouchMouseRight(e);
return true;
}
Expand Down

0 comments on commit 52944cd

Please sign in to comment.