Skip to content

Commit

Permalink
support a null pointer to check isTouchLike, phetsims/scenery#1156
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Feb 17, 2021
1 parent ef74003 commit 5b3601a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/charges-and-fields/view/ChargedParticleNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ChargedParticleNode extends ChargedParticleRepresentationNode {
transform: modelViewTransform,
canStartPress: () => !chargedParticle.animationTween,
offsetPosition: ( point, listener ) => {
return listener.pointer.isTouchLike() ? new Vector2( 0, -2 * CIRCLE_RADIUS ) : Vector2.ZERO;
return listener.pointer && listener.pointer.isTouchLike() ? new Vector2( 0, -2 * CIRCLE_RADIUS ) : Vector2.ZERO;
},
start: ( event, listener ) => {
// Move the chargedParticle to the front of this layer when grabbed by the user.
Expand Down
2 changes: 1 addition & 1 deletion js/charges-and-fields/view/ElectricFieldSensorNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class ElectricFieldSensorNode extends ElectricFieldSensorRepresentationNode {
transform: modelViewTransform,
canStartPress: () => !electricFieldSensor.animationTween,
offsetPosition: ( point, listener ) => {
return listener.pointer.isTouchLike() ? new Vector2( 0, -2 * ChargesAndFieldsConstants.ELECTRIC_FIELD_SENSOR_CIRCLE_RADIUS ) : Vector2.ZERO;
return listener.pointer && listener.pointer.isTouchLike() ? new Vector2( 0, -2 * ChargesAndFieldsConstants.ELECTRIC_FIELD_SENSOR_CIRCLE_RADIUS ) : Vector2.ZERO;
},
start: ( event, listener ) => {
// Move the sensor to the front of this layer when grabbed by the user.
Expand Down

0 comments on commit 5b3601a

Please sign in to comment.