Skip to content

Commit

Permalink
Trigger pointer leave when active controller switched (facebook#36662)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#36662

For VR, JSPointerDispatcher skips calculating the delta of hit targets (which happens in onMove) on the frame in which the active controller is switched because the motion event is a DOWN event, not a MOVE event in that specific frame.

This diff fixes the issue by just calling onMove in addition to onDown for DOWN motion events. Unfortunately we do not have separate pointer IDs for each controller.

This won't change the behavior for non-hoverable pointers. For hoverable pointers, it will dispatch an extra pointer_enter if the hit path has changed between the last move event and the down event.

Changelog:
[Internal][Fixed] - Trigger pointer leave when active controller switched

Reviewed By: lunaleaps, javache

Differential Revision: D44377324

fbshipit-source-id: 9f668e64f486b9a12ab36563ec2b7cf93f208a54
  • Loading branch information
genkikondo authored and jeongshin committed May 7, 2023
1 parent 441f167 commit b6e36c6
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ private void onDown(
motionEvent,
enterViewTargets,
eventDispatcher);
} else {
// There are cases when the pointer may have moved in the same frame as the down event.
// Dispatch the move event before the down event.
onMove(activeTargetTag, eventState, motionEvent, eventDispatcher);
}

boolean listeningForDown =
Expand Down

0 comments on commit b6e36c6

Please sign in to comment.