Skip to content

AllDragListenerOptions

Overview

Options used by many drag listeners in scenery. At this time, that includes DragListener and KeyboardDragListener.

@author Jonathan Olson <jonathan.olson@colorado.edu> @author Michael Kauzmann (PhET Interactive Simulations) @author Jesse Greenberg (PhET Interactive Simulations)

Type AllDragListenerOptions

import type { AllDragListenerOptions } from 'scenerystack/scenery';
  • start?: SceneryListenerCallback<Listener, DOMEvent> | null
    Called when the drag is started.
  • drag?: SceneryListenerCallback<Listener, DOMEvent> | null
    Called when this listener is dragged.
  • end?: SceneryListenerNullableCallback<Listener, DOMEvent> | null
    Called when the drag is ended. NOTE: This will also be called if the drag is ended due to being interrupted or canceled.
  • positionProperty?: Pick<TProperty<Vector2>, "value"> | null
    If provided, it will be synchronized with the drag position in the model coordinate frame. The optional transform is applied.
  • transform?: Transform3 | TReadOnlyProperty<Transform3> | null
    If provided, this will be used to convert between the parent (view) and model coordinate frames. Most useful when you also provide a positionProperty.
  • dragBoundsProperty?: TReadOnlyProperty<Bounds2 | null> | null
    If provided, the model position will be constrained to these bounds.
  • mapPosition?: null | MapPosition
    If provided, this allows custom mapping from the desired position (i.e. where the pointer is, or where the KeyboardDragListener will set the position) to the actual position that will be used.
  • translateNode?: boolean
    If true, the target Node will be translated during the drag operation.

Source Code

See the source for AllDragListenerOptions.ts in the scenery repository.