Class PointerDragBehavior
Hierarchy
- PointerDragBehavior
Implements
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Creates a pointer drag behavior that can be attached to a mesh
Parameters
-
Optional options: { dragAxis?: Vector3; dragPlaneNormal?: Vector3 }
The drag axis or normal of the plane that will be dragged across. If no options are specified the drag plane will always face the ray's origin (eg. camera)
Returns PointerDragBehavior
-
Properties
attached NodeSearch playground for attachedNode
Abstract mesh the behavior is set on
current Dragging PointerIDSearch playground for currentDraggingPointerID
The id of the pointer that is currently interacting with the behavior (-1 when no pointer is active)
detach Camera ControlsSearch playground for detachCameraControls
If camera controls should be detached during the drag
drag Delta RatioSearch playground for dragDeltaRatio
The distance towards the target drag position to move each frame. This can be useful to avoid jitter. Set this to 1 for no delay. (Default: 0.2)
draggingSearch playground for dragging
If the behavior is currently in a dragging state
enabledSearch playground for enabled
If the drag behavior will react to drag events (Default: true)
last Drag PositionSearch playground for lastDragPosition
The last position where the pointer hit the drag plane in world space
max Drag AngleSearch playground for maxDragAngle
The maximum tolerated angle between the drag plane and dragging pointer rays to trigger pointer events. Set to 0 to allow any angle (default: 0)
move AttachedSearch playground for moveAttached
If the attached mesh should be moved when dragged
on Drag End ObservableSearch playground for onDragEndObservable
Fires each time a drag ends (eg. mouse release after drag)
on Drag ObservableSearch playground for onDragObservable
Fires each time the attached mesh is dragged with the pointer
- delta between last drag position and current drag position in world space
- dragDistance along the drag axis
- dragPlaneNormal normal of the current drag plane used during the drag
- dragPlanePoint in world space where the drag intersects the drag plane
on Drag Start ObservableSearch playground for onDragStartObservable
Fires each time a drag begins (eg. mouse down on mesh)
start And Release Drag OnPointer EventsSearch playground for startAndReleaseDragOnPointerEvents
If pointer events should start and release the drag (Default: true)
update Drag PlaneSearch playground for updateDragPlane
If the drag plane orientation should be updated during the dragging (Default: true)
use Object Orientation For DraggingSearch playground for useObjectOrientationForDragging
If set, the drag plane/axis will be rotated based on the attached mesh's world rotation (Default: true)
validate DragSearch playground for validateDrag
Predicate to determine if it is valid to move the object to a new position when it is moved
Type declaration
-
-
Parameters
-
targetPosition: Vector3
Returns boolean
-
-
Accessors
name
-
The name of the behavior
Returns string
options
Methods
attachSearch playground for attach
-
Attaches the drag behavior the passed in mesh
Parameters
-
ownerNode: AbstractMesh
The mesh that will be dragged around once attached
-
Optional predicate: (m: AbstractMesh) => boolean
Predicate to use for pick filtering
-
-
Parameters
-
m: AbstractMesh
Returns boolean
-
-
-
Returns void
-
detachSearch playground for detach
-
Detaches the behavior from the mesh
Returns void
initSearch playground for init
-
Initializes the behavior
Returns void
release DragSearch playground for releaseDrag
-
Force relase the drag action by code.
Returns void
start DragSearch playground for startDrag
-
Simulates the start of a pointer drag event on the behavior
Parameters
-
Optional pointerId: number
pointerID of the pointer that should be simulated (Default: Any mouse pointer ID)
-
Optional fromRay: Ray
initial ray of the pointer to be simulated (Default: Ray from camera to attached mesh)
-
Optional startPickedPoint: Vector3
picked point of the pointer to be simulated (Default: attached mesh position)
Returns void
-
A behavior that when attached to a mesh will allow the mesh to be dragged around the screen based on pointer events