Skip to content
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

Fix issue: New Input System - All mouse buttons have the same pointer Id #2071

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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 @@ -343,9 +343,12 @@ private void ProcessPointer(ref PointerModel state)

////REVIEW: for touch, we only need the left button; should we skip right and middle button processing? then we also don't need to copy to/from the event

var pointerId = eventData.pointerId;

// Left mouse button. Movement and scrolling is processed with event set left button.
eventData.button = PointerEventData.InputButton.Left;
state.leftButton.CopyPressStateTo(eventData);
eventData.pointerId = PointerInputModule.kMouseLeftId;

// Unlike StandaloneInputModule, we process moves before processing buttons. This way
// UI elements get pointer enters/exits before they get button ups/downs and clicks.
Expand All @@ -357,7 +360,11 @@ private void ProcessPointer(ref PointerModel state)
// However, after that, early out at this point when there's no changes to the pointer state (except
// for tracked pointers as the tracking origin may have moved).
if (!state.changedThisFrame && (xrTrackingOrigin == null || state.pointerType != UIPointerType.Tracked))
{
// Restore the original pointerId
eventData.pointerId = pointerId;
return;
}

ProcessPointerButton(ref state.leftButton, eventData);
ProcessPointerButtonDrag(ref state.leftButton, eventData);
Expand All @@ -366,16 +373,21 @@ private void ProcessPointer(ref PointerModel state)
// Right mouse button.
eventData.button = PointerEventData.InputButton.Right;
state.rightButton.CopyPressStateTo(eventData);
eventData.pointerId = PointerInputModule.kMouseRightId;

ProcessPointerButton(ref state.rightButton, eventData);
ProcessPointerButtonDrag(ref state.rightButton, eventData);

// Middle mouse button.
eventData.button = PointerEventData.InputButton.Middle;
state.middleButton.CopyPressStateTo(eventData);
eventData.pointerId = PointerInputModule.kMouseMiddleId;

ProcessPointerButton(ref state.middleButton, eventData);
ProcessPointerButtonDrag(ref state.middleButton, eventData);

// Restore the original pointerId
eventData.pointerId = pointerId;
}

// if we are using a MultiplayerEventSystem, ignore any transforms
Expand Down