Skip to content

FIX: Pen touch input triggers UI/Click action two times (ISXB-1456) #2201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2072,13 +2072,13 @@ private bool RemovePointerAtIndex(int index)
{
Debug.Assert(m_PointerStates[index].eventData.pointerEnter == null, "Pointer should have exited all objects before being removed");

// We don't want to release touch pointers on the same frame they are released (unpressed). They get cleaned up one frame later in Process()
ref var state = ref GetPointerStateForIndex(index);
if (state.pointerType == UIPointerType.Touch && (state.leftButton.isPressed || state.leftButton.wasReleasedThisFrame))
{
// The pointer was not removed
return false;
}
// // We don't want to release touch pointers on the same frame they are released (unpressed). They get cleaned up one frame later in Process()
// ref var state = ref GetPointerStateForIndex(index);
// if (state.pointerType == UIPointerType.Touch && (state.leftButton.isPressed || state.leftButton.wasReleasedThisFrame))
// {
// // The pointer was not removed
// return false;
// }

// Retain event data so that we can reuse the event the next time we allocate a PointerModel record.
var eventData = m_PointerStates[index].eventData;
Expand Down Expand Up @@ -2350,13 +2350,19 @@ private void FilterPointerStatesByType()
// We have input on a mouse or pen. Kill all touch and tracked pointers we may have.
for (var i = 0; i < m_PointerStates.length; ++i)
{
ref var state = ref GetPointerStateForIndex(i);
// Touch pointers need to get forced to no longer be pressed otherwise they will not get released in subsequent frames.
if (m_PointerStates[i].pointerType == UIPointerType.Touch)
{
state.leftButton.isPressed = false;
}
if (m_PointerStates[i].pointerType != UIPointerType.MouseOrPen && m_PointerStates[i].pointerType != UIPointerType.Touch || (m_PointerStates[i].pointerType == UIPointerType.Touch && !state.leftButton.isPressed && !state.leftButton.wasReleasedThisFrame))
// ref var state = ref GetPointerStateForIndex(i);
// // Touch pointers need to get forced to no longer be pressed otherwise they will not get released in subsequent frames.
// if (m_PointerStates[i].pointerType == UIPointerType.Touch)
// {
// state.leftButton.isPressed = false;
// }
// if (m_PointerStates[i].pointerType != UIPointerType.MouseOrPen && m_PointerStates[i].pointerType != UIPointerType.Touch || (m_PointerStates[i].pointerType == UIPointerType.Touch && !state.leftButton.isPressed && !state.leftButton.wasReleasedThisFrame))
// {
// if (SendPointerExitEventsAndRemovePointer(i))
// --i;
// }

if (m_PointerStates[i].pointerType != UIPointerType.MouseOrPen)
{
if (SendPointerExitEventsAndRemovePointer(i))
--i;
Expand Down