diff --git a/js/input/SimpleDragHandler.js b/js/input/SimpleDragHandler.js index a253eed6e..a88a84a00 100644 --- a/js/input/SimpleDragHandler.js +++ b/js/input/SimpleDragHandler.js @@ -92,7 +92,7 @@ define( function( require ) { this.lastInterruptedTouchPointer = null; // @private - this.dragStartedEmitter = new Action( function( point, event ) { + this.dragStartedAction = new Action( function( point, event ) { if ( self.dragging ) { return; } @@ -121,7 +121,7 @@ define( function( require ) { sceneryLog && sceneryLog.InputListener && sceneryLog.pop(); }, { - tandem: options.tandem.createTandem( 'dragStartedEmitter' ), + tandem: options.tandem.createTandem( 'dragStartedAction' ), phetioType: ActionIO( [ { name: 'point', type: Vector2IO, documentation: 'the position of the drag start in view coordinates' }, @@ -134,7 +134,7 @@ define( function( require ) { } ); // @private - this.draggedEmitter = new Action( function( point, event ) { + this.draggedAction = new Action( function( point, event ) { if ( !self.dragging || self.isDisposed ) { return; } @@ -177,7 +177,7 @@ define( function( require ) { sceneryLog && sceneryLog.InputListener && sceneryLog.pop(); }, { phetioHighFrequency: true, - tandem: options.tandem.createTandem( 'draggedEmitter' ), + tandem: options.tandem.createTandem( 'draggedAction' ), phetioType: ActionIO( [ { name: 'point', type: Vector2IO, documentation: 'the position of the drag in view coordinates' }, @@ -190,7 +190,7 @@ define( function( require ) { } ); // @private - this.dragEndedEmitter = new Action( function( point, event ) { + this.dragEndedAction = new Action( function( point, event ) { if ( !self.dragging ) { return; } @@ -214,7 +214,7 @@ define( function( require ) { sceneryLog && sceneryLog.InputListener && sceneryLog.pop(); }, { - tandem: options.tandem.createTandem( 'dragEndedEmitter' ), + tandem: options.tandem.createTandem( 'dragEndedAction' ), phetioType: ActionIO( [ { name: 'point', type: Vector2IO, documentation: 'the position of the drag end in view coordinates' }, @@ -297,7 +297,7 @@ define( function( require ) { // mouse/touch move move: function( event ) { - self.draggedEmitter.emit( event.pointer.point, event ); + self.draggedAction.execute( event.pointer.point, event ); } }; PhetioObject.call( this, options ); @@ -316,14 +316,14 @@ define( function( require ) { assert && assert( 'illegal call to set dragging on SimpleDragHandler' ); }, startDrag: function( event ) { - this.dragStartedEmitter.emit( event.pointer.point, event ); + this.dragStartedAction.execute( event.pointer.point, event ); }, endDrag: function( event ) { // Signify drag ended. In the case of programmatically ended drags, signify drag ended at 0,0. // see https://github.com/phetsims/ph-scale-basics/issues/43 - this.dragEndedEmitter.emit( event ? event.pointer.point : Vector2.ZERO, event ); + this.dragEndedAction.execute( event ? event.pointer.point : Vector2.ZERO, event ); }, // Called when input is interrupted on this listener, see https://github.com/phetsims/scenery/issues/218 @@ -415,9 +415,9 @@ define( function( require ) { this.isDraggingProperty.dispose(); // It seemed without disposing these led to a memory leak in Energy Skate Park: Basics - this.dragEndedEmitter.dispose(); - this.draggedEmitter.dispose(); - this.dragStartedEmitter.dispose(); + this.dragEndedAction.dispose(); + this.draggedAction.dispose(); + this.dragStartedAction.dispose(); PhetioObject.prototype.dispose.call( this ); diff --git a/js/listeners/DragListener.js b/js/listeners/DragListener.js index 05e0b2394..6acd55dcb 100644 --- a/js/listeners/DragListener.js +++ b/js/listeners/DragListener.js @@ -184,7 +184,7 @@ define( function( require ) { this._lastInterruptedTouchPointer = null; // @private {Emitter} - emitted on drag. Used for triggering phet-io events to the data stream, see https://github.com/phetsims/scenery/issues/842 - this._draggedEmitter = new Action( function( event ) { + this._draggedAction = new Action( function( event ) { // This is done first, before the drag listener is called (from the prototype drag call) if ( !self._globalPoint.equals( self.pointer.point ) ) { @@ -194,7 +194,7 @@ define( function( require ) { PressListener.prototype.drag.call( self, event ); }, { phetioFeatured: options.phetioFeatured, - tandem: options.tandem.createTandem( 'draggedEmitter' ), + tandem: options.tandem.createTandem( 'draggedAction' ), phetioHighFrequency: true, phetioDocumentation: 'Emits whenever a drag occurs with an EventIO argument.', phetioReadOnly: options.phetioReadOnly, @@ -305,7 +305,7 @@ define( function( require ) { sceneryLog && sceneryLog.InputListener && sceneryLog.InputListener( 'DragListener drag' ); sceneryLog && sceneryLog.InputListener && sceneryLog.push(); - this._draggedEmitter.emit( event ); + this._draggedAction.execute( event ); sceneryLog && sceneryLog.InputListener && sceneryLog.pop(); }, @@ -670,7 +670,7 @@ define( function( require ) { sceneryLog && sceneryLog.InputListener && sceneryLog.InputListener( 'DragListener dispose' ); sceneryLog && sceneryLog.InputListener && sceneryLog.push(); - this._draggedEmitter.dispose(); + this._draggedAction.dispose(); this.detachTransformTracker(); diff --git a/js/listeners/PressListener.js b/js/listeners/PressListener.js index 0b0907b27..d82cad16b 100644 --- a/js/listeners/PressListener.js +++ b/js/listeners/PressListener.js @@ -36,7 +36,7 @@ define( function( require ) { var globalID = 0; // constants - factored out to reduce memory usage, see https://github.com/phetsims/unit-rates/issues/207 - var PressedEmitterIO = ActionIO( [ + var PressedActionIO = ActionIO( [ { name: 'event', type: EventIO }, { name: 'targetNode', @@ -50,7 +50,7 @@ define( function( require ) { } ] ); - var ReleasedEmitterIO = ActionIO( [ { + var ReleasedActionIO = ActionIO( [ { name: 'event', type: NullableIO( EventIO ) }, { @@ -233,30 +233,30 @@ define( function( require ) { interrupt: this.pointerInterrupt.bind( this ) }; - // @private {Emitter} - Emitted on press event - // The main implementation of "press" handling is implemented as a callback to the emitter, so things are nested + // @private {Action} - Executed on press event + // The main implementation of "press" handling is implemented as a callback to the Action, so things are nested // nicely for phet-io. - this._pressedEmitter = new Action( this.onPress.bind( this ), { - tandem: options.tandem.createTandem( 'pressedEmitter' ), - phetioDocumentation: 'Emits whenever a press occurs. The first argument when emitting can be ' + + this._pressedAction = new Action( this.onPress.bind( this ), { + tandem: options.tandem.createTandem( 'pressedAction' ), + phetioDocumentation: 'Executes whenever a press occurs. The first argument when executing can be ' + 'used to convey info about the Event.', phetioReadOnly: options.phetioReadOnly, phetioFeatured: options.phetioFeatured, phetioEventType: PhetioObject.EventType.USER, - phetioType: PressedEmitterIO + phetioType: PressedActionIO } ); - // @private {Emitter} - Emitted on release event - // The main implementation of "release" handling is implemented as a callback to the emitter, so things are nested + // @private {Action} - Executed on release event + // The main implementation of "release" handling is implemented as a callback to the Action, so things are nested // nicely for phet-io. - this._releasedEmitter = new Action( this.onRelease.bind( this ), { - tandem: options.tandem.createTandem( 'releasedEmitter' ), - phetioDocumentation: 'Emits whenever a release occurs.', + this._releasedAction = new Action( this.onRelease.bind( this ), { + tandem: options.tandem.createTandem( 'releasedAction' ), + phetioDocumentation: 'Executes whenever a release occurs.', phetioReadOnly: options.phetioReadOnly, phetioFeatured: options.phetioFeatured, phetioEventType: PhetioObject.EventType.USER, - phetioType: ReleasedEmitterIO + phetioType: ReleasedActionIO } ); // update isOverProperty (not a DerivedProperty because we need to hook to passed-in properties) @@ -363,7 +363,7 @@ define( function( require ) { sceneryLog && sceneryLog.InputListener && sceneryLog.InputListener( 'PressListener#' + this._id + ' successful press' ); sceneryLog && sceneryLog.InputListener && sceneryLog.push(); - this._pressedEmitter.emit( event, targetNode || null, callback || null ); // cannot pass undefined into emit call + this._pressedAction.execute( event, targetNode || null, callback || null ); // cannot pass undefined into execute call sceneryLog && sceneryLog.InputListener && sceneryLog.pop(); @@ -386,7 +386,7 @@ define( function( require ) { sceneryLog && sceneryLog.InputListener && sceneryLog.InputListener( 'PressListener#' + this._id + ' release' ); sceneryLog && sceneryLog.InputListener && sceneryLog.push(); - this._releasedEmitter.emit( event || null, callback || null ); // cannot pass undefined to emit call + this._releasedAction.execute( event || null, callback || null ); // cannot pass undefined to execute call sceneryLog && sceneryLog.InputListener && sceneryLog.pop(); }, @@ -767,8 +767,8 @@ define( function( require ) { this.a11yClickingProperty.dispose(); this.looksPressedProperty.dispose(); - this._pressedEmitter.dispose(); - this._releasedEmitter.dispose(); + this._pressedAction.dispose(); + this._releasedAction.dispose(); sceneryLog && sceneryLog.InputListener && sceneryLog.pop(); }