- core
- Context
- ElementAllocator
- ElementOutput
- Engine
- Entity
- EventEmitter
- EventHandler
- Group
- Modifier
- OptionsManager
- RenderNode
- Scene
- SpecParser
- Transform
- View
- ViewSequence
- events
- EventArbiter
- EventFilter
- EventMapper
- inputs
- Accumulator
- GenericSync
- MouseSync
- PinchSync
- RotateSync
- ScaleSync
- ScrollSync
- TouchSync
- TouchTracker
- TwoFingerSync
- math
- Matrix
- Quaternion
- Random
- Utilities
- Vector
- modifiers
- Draggable
- Fader
- ModifierChain
- StateModifier
- physics
- PhysicsEngine
- physics/bodies
- Body
- Circle
- Particle
- Rectangle
- physics/constraints
- Surface
- Collision
- Constraint
- Curve
- Distance
- Snap
- Wall
- Walls
- physics/forces
- Drag
- Force
- Repulsion
- RotationalDrag
- RotationalSpring
- Spring
- VectorField
- physics/integrators
- SymplecticEuler
- surfaces
- CanvasSurface
- ContainerSurface
- ImageSurface
- InputSurface
- TextareaSurface
- VideoSurface
- transitions
- CachedMap
- Easing
- MultipleTransition
- SnapTransition
- SpringTransition
- Transitionable
- TransitionableTransform
- TweenTransition
- WallTransition
- utilities
- KeyCodes
- Timer
- Utility
- views
- ContextualView
- Deck
- DrawerLayout
- EdgeSwapper
- FlexibleLayout
- Flipper
- GridLayout
- HeaderFooterLayout
- Lightbox
- RenderController
- ScrollContainer
- Scroller
- Scrollview
- SequentialLayout
- widgets
- NavigationBar
- TabBar
Draggable
Makes added render nodes responsive to drag beahvior. Emits events 'start', 'update', 'end'.
Overview
Options
snapX
snapY
xRange] maxmimum [negative, positive
yRange] maxmimum [negative, positive
scale
projection
Methods
setOptions
getPosition
setRelativePosition
setPosition
activate
deactivate
toggle
Draggable(options)
Constructor Parameters
options
Object
options configuration object.
snapX
Number
grid width for snapping during drag
snapY
Number
grid height for snapping during drag
xRange] maxmimum [negative, positive
Array.Number
x displacement from start of drag
yRange] maxmimum [negative, positive
Array.Number
y displacement from start of drag
scale
Number
one pixel of input motion translates to this many pixels of output drag motion
projection
Number
User should set to Draggable._direction.x or Draggable._direction.y to constrain to one axis.
Methods
setOptions(options)
Set internal options, overriding any default options
Parameters
options
Object
overrides of default options. See constructor.
getPosition()
Get current delta in position from where this draggable started.
Returns
Array<number>
[x, y] position delta from start.
setRelativePosition(position, transition, callback)
Transition the element to the desired relative position via provided transition. For example, calling this with [0,0] will not change the position. Callback will be executed on completion.
Parameters
position
Array<number>
end state to which we interpolate
transition
Transition
transition object specifying how object moves to new position
callback
Function
zero-argument function to call on observed completion
setPosition(position, transition, callback)
Transition the element to the desired absolute position via provided transition. Callback will be executed on completion.
Parameters
position
Array<number>
end state to which we interpolate
transition
Transition
transition object specifying how object moves to new position
callback
Function
zero-argument function to call on observed completion
activate()
Set this draggable to respond to user input.
deactivate()
Set this draggable to ignore user input.
toggle()
Switch the input response stage between active and inactive.
modify(target)Private
Return render spec for this Modifier, applying to the provided target component. This is similar to render() for Surfaces.
Parameters
target
Object
(already rendered) render spec to which to apply the transform.
Returns
Object
render spec for this Modifier, including the provided target