Skip to content

Commit 355e947

Browse files
committed
Revert #1982 but leave commented code
1 parent 9cc79d7 commit 355e947

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

Packages/com.unity.inputsystem/InputSystem/Plugins/UI/InputSystemUIInputModule.cs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,13 +2072,13 @@ private bool RemovePointerAtIndex(int index)
20722072
{
20732073
Debug.Assert(m_PointerStates[index].eventData.pointerEnter == null, "Pointer should have exited all objects before being removed");
20742074

2075-
// 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()
2076-
ref var state = ref GetPointerStateForIndex(index);
2077-
if (state.pointerType == UIPointerType.Touch && (state.leftButton.isPressed || state.leftButton.wasReleasedThisFrame))
2078-
{
2079-
// The pointer was not removed
2080-
return false;
2081-
}
2075+
// // 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()
2076+
// ref var state = ref GetPointerStateForIndex(index);
2077+
// if (state.pointerType == UIPointerType.Touch && (state.leftButton.isPressed || state.leftButton.wasReleasedThisFrame))
2078+
// {
2079+
// // The pointer was not removed
2080+
// return false;
2081+
// }
20822082

20832083
// Retain event data so that we can reuse the event the next time we allocate a PointerModel record.
20842084
var eventData = m_PointerStates[index].eventData;
@@ -2350,13 +2350,19 @@ private void FilterPointerStatesByType()
23502350
// We have input on a mouse or pen. Kill all touch and tracked pointers we may have.
23512351
for (var i = 0; i < m_PointerStates.length; ++i)
23522352
{
2353-
ref var state = ref GetPointerStateForIndex(i);
2354-
// Touch pointers need to get forced to no longer be pressed otherwise they will not get released in subsequent frames.
2355-
if (m_PointerStates[i].pointerType == UIPointerType.Touch)
2356-
{
2357-
state.leftButton.isPressed = false;
2358-
}
2359-
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))
2353+
// ref var state = ref GetPointerStateForIndex(i);
2354+
// // Touch pointers need to get forced to no longer be pressed otherwise they will not get released in subsequent frames.
2355+
// if (m_PointerStates[i].pointerType == UIPointerType.Touch)
2356+
// {
2357+
// state.leftButton.isPressed = false;
2358+
// }
2359+
// 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))
2360+
// {
2361+
// if (SendPointerExitEventsAndRemovePointer(i))
2362+
// --i;
2363+
// }
2364+
2365+
if (m_PointerStates[i].pointerType != UIPointerType.MouseOrPen)
23602366
{
23612367
if (SendPointerExitEventsAndRemovePointer(i))
23622368
--i;

0 commit comments

Comments
 (0)