- core
- Context
- ElementAllocator
- ElementOutput
- Engine
- Entity
- EventEmitter
- EventHandler
- Group
- Modifier
- OptionsManager
- RenderNode
- Scene
- SpecParser
- Surface
- 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
- Collision
- Constraint
- Curve
- Distance
- Snap
- Surface
- 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
TouchSync
Handles piped in touch events. Emits 'start', 'update', and 'events' events with delta, position, velocity, acceleration, clientX, clientY, count, and touch id. Useful for dealing with inputs on touch devices. Designed to be used either as standalone, or included in a GenericSync.
Overview
Options
direction
rails
velocitySampleLength
scale
touchLimit
Methods
setOptions
getOptions
TouchSync(options)
Constructor Parameters
options
Object
default options overrides
direction
Number
read from a particular axis
rails
Boolean
read from axis with greatest differential
velocitySampleLength
Number
Number of previous frames to check velocity against.
scale
Number
constant factor to scale velocity output
touchLimit
Number
touchLimit upper bound for emitting events based on number of touches
Methods
_handleStart()Private
Triggered by trackstart.
_handleMove()Private
Triggered by trackmove.
_handleEnd()Private
Triggered by trackend.
setOptions(options)
Set internal options, overriding any default options
Parameters
options
Object
default options overrides
getOptions()
Return entire options dictionary, including defaults.
Returns
Object
configuration options
Example
var Surface = require('../core/Surface');
var TouchSync = require('../inputs/TouchSync');
var surface = new Surface({ size: [100, 100] });
var touchSync = new TouchSync();
surface.pipe(touchSync);
touchSync.on('start', function (e) { // react to start });
touchSync.on('update', function (e) { // react to update });
touchSync.on('end', function (e) { // react to end });*