Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4457a60

Browse files
committedDec 15, 2024·
Invalidate mouse position when releasing last touch finger
1 parent d95cc56 commit 4457a60

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎osu.Framework/Input/InputManager.cs

+8
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,7 @@ protected virtual bool HandleMouseTouchStateChange(TouchStateChangeEvent e)
794794
if (!MapMouseToLatestTouch)
795795
return false;
796796

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

806+
// Update mouse button state
805807
if (e.IsActive != null)
806808
{
807809
if (e.IsActive == true)
@@ -812,6 +814,11 @@ protected virtual bool HandleMouseTouchStateChange(TouchStateChangeEvent e)
812814
updateTouchMouseLeft(e);
813815
}
814816

817+
// Invalidate mouse position if releasing last touch. This is done after updating button state
818+
// for click events to be processed on the targeted input queue before the position is invalidated.
819+
if (e.IsActive == false && !e.State.Touch.ActiveSources.HasAnyButtonPressed)
820+
new MouseInvalidatePositionInputFromTouch(e).Apply(CurrentState, this);
821+
815822
updateTouchMouseRight(e);
816823
return true;
817824
}
@@ -827,6 +834,7 @@ private void updateTouchMouseLeft(TouchStateChangeEvent e)
827834
private void updateTouchMouseRight(TouchStateChangeEvent e)
828835
{
829836
if (!AllowRightClickFromLongTouch)
837+
// fix this thing, make it cancel touch.
830838
return;
831839

832840
// if a touch was pressed/released in this event, reset gesture validity state.

0 commit comments

Comments
 (0)
Please sign in to comment.