ClosestDragForwardingListener¶
Overview¶
A Scenery input listener that is able to find the closest in a list of items to a "down" event and trigger an action (usually a drag) on that item. Usually this will be a drag listener start/press (e.g. SimpleDragHandler/DragListener), but could accommodate other uses. It's similar in use to DragListener.createForwardingListener.
Handles items of the form: { startDrag: function( event ), computeDistance: function( globalPoint ) : number }
@author Jonathan Olson (PhET Interactive Simulations)
Class ClosestDragForwardingListener¶
Constructor¶
new ClosestDragForwardingListener( touchThreshold : number, mouseThreshold : number )¶
Instance Methods¶
addDraggableItem( item : DraggableItem )¶
Adds an item that can be dragged.
removeDraggableItem( item : DraggableItem )¶
Removes a previously-added item.
down( event : PressListenerEvent )¶
Called on pointer down.
Source Code¶
See the source for ClosestDragForwardingListener.ts in the sun repository.