GrabDragModel¶
Overview¶
The model of the grab drag interaction. This has the current interaction state, and the cueing state. Scenery-phet internal, GrabDragInteraction should be the only one to create this.
@author Michael Kauzmann (PhET Interactive Simulations) @author Jesse Greenberg (PhET Interactive Simulations) @author Sam Reid (PhET Interactive Simulations)
Class GrabDragModel¶
Constructor¶
new GrabDragModel( grabDragUsageTracker : GrabDragUsageTracker, providedOptions? : GrabDragModelOptions )¶
Instance Methods¶
keyboardGrab( onBeforeEmit : VoidFunction )¶
Grab with keyboard usage tracking
grab( onBeforeEmit : VoidFunction )¶
Turn from idle into grabbed interaction state. This updates accessibility representation in the PDOM and changes input listeners. This function can be called while already grabbed, because of nuance in how we support multi-input and gestureDescription.
release()¶
Release from being grabbed. This function will set the interaction back to the "idle" state and should only be called when in "grabbed" state. It also behaves as though it was released from user input, for example sound effect and description will occur may occur.
dispose()¶
reset()¶
Instance Properties¶
interactionStateProperty : Property¶
(readonly)
resetEmitter : Emitter¶
(readonly)
called on reset()
Type GrabDragInteractionState¶
Interaction states that this component interaction can be in: "idle": In the default state where you can interact with the node to grab it. It is ready to be "picked up" ("grabbed") from this state. This state mostly behaves like a button. "grabbed": In the state where you can use keyboard to move the object with arrow keys. You are also able to "release" back into idle
"idle" | "grabbed"
Type GrabDragModelOptions¶
Source Code¶
See the source for GrabDragModel.ts in the scenery-phet repository.