Skip to content

Commit

Permalink
Add validation for SimpleDragHandler.interrupt, see phetsims/axon#208
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Jan 8, 2019
1 parent 5c93577 commit c3c56b7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion js/input/SimpleDragHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,18 @@ define( function( require ) {
tandem: options.tandem.createTandem( 'dragEndedEmitter' ),

// TODO: use of both of these is redundant, and should get fixed with https://github.com/phetsims/axon/issues/194
argumentTypes: [ { valueType: Vector2 }, { isValidValue: function( value ) { return value === null || value instanceof Event; } } ],
argumentTypes: [
{ valueType: Vector2 },
{
isValidValue: function( value ) {
return value === null || value instanceof Event ||

// When interrupted, an object literal is used to signify the interruption,
// see SimpleDragHandler.interrupt
( value.pointer && value.currentTarget );
}
}
],
phetioType: EmitterIO(
[ { name: 'point', type: Vector2IO, documentation: 'the position of the drag end in view coordinates' },
{ name: 'event', type: VoidIO, documentation: 'the scenery pointer Event' } ] ),
Expand Down

0 comments on commit c3c56b7

Please sign in to comment.