You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying MultiListener outside of a PhET simulation and needed this patch to get it to work for my scene. Seems like a reasonable change but it should be cleaned and tested.
Subject: [PATCH] focusPanDirection -> limitPanDirection, see https://github.com/phetsims/center-and-variability/issues/564
---
Index: js/listeners/MultiListener.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================diff --git a/js/listeners/MultiListener.ts b/js/listeners/MultiListener.ts--- a/js/listeners/MultiListener.ts (revision 46bd74b3cf1d8d7bbfb6fe875b6579b920712470)+++ b/js/listeners/MultiListener.ts (date 1700409247479)@@ -342,24 +342,29 @@
}
assert && assert( _.includes( pressTrail.nodes, this._targetNode ), 'targetNode must be in the Trail for Press' );
- sceneryLog && sceneryLog.InputListener && sceneryLog.push();- const press = new MultiListenerPress( event.pointer, pressTrail );+ // If this targetNode is not in the event trail, and the event target does not have a trail that contains+ // the targetNode, then we should not add a press. This can happen when the targetNode is not in a subtree+ // under this targetNode (like when it is in a modal pane), and we don't want to add a press in that case.+ if ( pressTrail ) {+ sceneryLog && sceneryLog.InputListener && sceneryLog.push();+ const press = new MultiListenerPress( event.pointer, pressTrail );- if ( !this._allowMoveInterruption && !this._allowMultitouchInterruption ) {+ if ( !this._allowMoveInterruption && !this._allowMultitouchInterruption ) {- // most restrictive case, only allow presses if the pointer is not attached - Presses- // are never added as background presses in this case because interruption is never allowed- if ( !event.pointer.isAttached() ) {- sceneryLog && sceneryLog.InputListener && sceneryLog.InputListener( 'MultiListener unattached, using press' );- this.addPress( press );- }- }- else {+ // most restrictive case, only allow presses if the pointer is not attached - Presses+ // are never added as background presses in this case because interruption is never allowed+ if ( !event.pointer.isAttached() ) {+ sceneryLog && sceneryLog.InputListener && sceneryLog.InputListener( 'MultiListener unattached, using press' );+ this.addPress( press );+ }+ }+ else {- // we allow some form of interruption, add as background presses, and we will decide if they- // should be converted to presses and interrupt other listeners on move event- sceneryLog && sceneryLog.InputListener && sceneryLog.InputListener( 'MultiListener attached, adding background press' );- this.addBackgroundPress( press );+ // we allow some form of interruption, add as background presses, and we will decide if they+ // should be converted to presses and interrupt other listeners on move event+ sceneryLog && sceneryLog.InputListener && sceneryLog.InputListener( 'MultiListener attached, adding background press' );+ this.addBackgroundPress( press );+ }
}
sceneryLog && sceneryLog.InputListener && sceneryLog.pop();
The text was updated successfully, but these errors were encountered:
I was trying MultiListener outside of a PhET simulation and needed this patch to get it to work for my scene. Seems like a reasonable change but it should be cleaned and tested.
The text was updated successfully, but these errors were encountered: