Skip to content

Commit

Permalink
Adding documentation and PressListener more comprehensive disposal, see
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanolson committed Dec 17, 2019
1 parent bbd9cb5 commit dc95452
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
9 changes: 8 additions & 1 deletion js/listeners/DragListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
* }
* } )
*
* It's completely fine to use one DragListener with multiple objects, however this isn't done as much since specifying
* locationProperty only works with ONE model position Property (so if things are backed by the same Property it would
* be fine). Doing things based on modelPoint/modelDelta/etc. should be completely fine using one listener with
* multiple nodes. The typical pattern IS creating one DragListener per draggable view Node.
*
* @author Jonathan Olson <[email protected]>
*/

Expand Down Expand Up @@ -96,7 +101,9 @@ define( require => {
options = merge( {

// {Property.<Vector2>|null} - If provided, it will be synchronized with the drag location in the model coordinate
// frame (applying any provided transforms as needed).
// frame (applying any provided transforms as needed). Typically, DURING a drag this Property should not be
// modified externally (as the next drag event will probably undo the change), but it's completely fine to modify
// this Property at any other time.
locationProperty: null,

// {Function|null} - Called as start( event: {Event}, listener: {DragListener} ) when the drag is started.
Expand Down
3 changes: 2 additions & 1 deletion js/listeners/FireListener.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright 2017-2019, University of Colorado Boulder

/**
* A listener for common button usage, providing the fire() method/callback and helpful properties.
* A listener for common button usage, providing the fire() method/callback and helpful properties. NOTE that it doesn't
* need to be an actual button (or look like a button), this is useful whenever that type of "fire" behavior is helpful.
*
* For example usage, see scenery/examples/input.html. Usually you can just pass a fire callback and things work.
*
Expand Down
7 changes: 6 additions & 1 deletion js/listeners/PressListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -810,9 +810,14 @@ define( require => {
}
!this.isHoveringProperty.isDisposed && this.isHoveringProperty.unlink( this._isHighlightedListener );

this.overPointers.dispose();
this.isPressedProperty.dispose();
this.isOverProperty.dispose();
this.isHoveringProperty.dispose();
this.isHighlightedProperty.dispose();
this.isFocusedProperty.dispose();
this.a11yClickingProperty.dispose();
this.looksPressedProperty.dispose();

this._pressAction.dispose();
this._releaseAction.dispose();

Expand Down

0 comments on commit dc95452

Please sign in to comment.