Class: GestureHandler

GestureHandler

new GestureHandler(options)

Object to bind and handle gesture events for a single DOM element.
Parameters:
Name Type Description
options Object additional options
Properties
Name Type Argument Default Description
element Element element for which to handle gestures
emitter Emitter <optional>
<nullable>
{} Emitter instance or options
animator Object animator object
config Object config object
gestures Object <nullable>
gesture emitter options
containerElement Element <nullable>
container element for this element
bounds Object <nullable>
rectangle-like boundary for gestures/animations
Source:

Mixes In

Members

defaultOptions

Default options to use with a GestureHandler instance.
Source:

gestureEmitterTypes

Mapping of gesture names to gesture emitter component constructor functions
Source:

Methods

animateMoveForPan(e, elementRect) → {undefined}

Moves the element using the information in the given Hammer event object.
Parameters:
Name Type Description
e hammer pan event object (from a panmove|panleft|panright|etc.)
elementRect the bounding client rect of the element
Source:
Returns:
Type
undefined

animateMoveForPanX(e, elementRect) → {undefined}

Moves the element horizontally, using the information in the given hammer event object.
Parameters:
Name Type Description
e
elementRect
Source:
Returns:
Type
undefined

animateMoveForPanY(e, elementRect) → {undefined}

Moves the element vertically, using the information in the given hammer event object.
Parameters:
Name Type Description
e
elementRect
Source:
Returns:
Type
undefined

animateMoveForSwipe(e) → {undefined}

Starts a horizontal and/or vertical movement animation using the information in the given Hammer event object.
Parameters:
Name Type Description
e
Source:
Returns:
Type
undefined

animateMoveForSwipeX(e, animateOptions, beginOptions, completeOptions) → {undefined}

Starts an animation for a swipe gesture in the horizontal direction.
Parameters:
Name Type Description
e
animateOptions
beginOptions
completeOptions
Source:
Returns:
Type
undefined

animateMoveForSwipeY(e, animateOptions, beginOptions, completeOptions) → {undefined}

Starts an animation for a swipe gestures in the vertical direction.
Parameters:
Name Type Description
e
animateOptions
beginOptions
completeOptions
Source:
Returns:
Type
undefined

animateMoveToElement(element, animateOptions, beginOptions, completeOptions) → {undefined}

Animates a movement to move the element to a position near the given child element.
Parameters:
Name Type Description
element
animateOptions
beginOptions
completeOptions
Source:
Returns:
Type
undefined

animateMoveX(x, animateOptions, beginOptions, completeOptions) → {undefined}

Animates a movement in the horizontal direction.
Parameters:
Name Type Description
x
animateOptions
beginOptions
completeOptions
Source:
Returns:
Type
undefined

animateMoveXAndY(x, y, animateOptions, beginOptions, completeOptions) → {undefined}

Animates a movement in the horizontal and vertical directions.
Parameters:
Name Type Description
x
y
animateOptions
beginOptions
completeOptions
Source:
Returns:
Type
undefined

animateMoveXOrY(value, axis, animateOptions, beginOptions, completeOptions) → {undefined}

Animates a move in the horizontal or vertical direction (based on axis parameter)
Parameters:
Name Type Description
value
axis
animateOptions
beginOptions
completeOptions
Source:
Returns:
Type
undefined

animateMoveY(y, animateOptions, beginOptions, completeOptions) → {undefined}

Animates a movement in the vertical direction.
Parameters:
Name Type Description
y
animateOptions
beginOptions
completeOptions
Source:
Returns:
Type
undefined

bind() → {undefined}

Binds all GestureHandler events handlers.
Source:
Returns:
Type
undefined

clearPositionData() → {undefined}

Clears the current and start position data
Source:
Returns:
Type
undefined

destroy() → {undefined}

Destroys the GestureHandler and all GestureEmitter instances
Source:
Returns:
Type
undefined

getInertiaDistance(velocity) → {undefined}

Gets the distance to travel for an inertial movement.
Parameters:
Name Type Description
velocity
Source:
Returns:
Type
undefined

getInertiaDuration(velocity) → {undefined}

Gets the animation duration for an inertial movement.
Parameters:
Name Type Description
velocity
Source:
Returns:
Type
undefined

isAnimating() → {undefined}

Indicates if the element has any animation running currently.
Source:
Returns:
Type
undefined

onAnimationComplete(options) → {undefined}

Called when a movement animation is complete.
Parameters:
Name Type Description
options
Source:
Returns:
Type
undefined

onGesturePanAny(e) → {undefined}

Called when a pan gesture is detected in any direction.
Parameters:
Name Type Description
e
Source:
Returns:
Type
undefined

onGesturePanStart(e) → {undefined}

Called when a pan gestures is started.
Parameters:
Name Type Description
e
Source:
Returns:
Type
undefined

onGesturePanX(e) → {undefined}

Called when a pan gesture is detected in the horizontal direction.
Parameters:
Name Type Description
e
Source:
Returns:
Type
undefined

onGesturePanY(e) → {undefined}

Called when a pan gesture is detected in the vertical direction.
Parameters:
Name Type Description
e
Source:
Returns:
Type
undefined

resetPosition() → {undefined}

Animates a movement to reset the element to its origin position (0, 0).
Source:
Returns:
Type
undefined

setAnimator(animator) → {undefined}

Sets the animator instance
Parameters:
Name Type Description
animator
Source:
Returns:
Type
undefined

setBounds(bounds) → {undefined}

Sets the bounds for the gestures/animations
Parameters:
Name Type Description
bounds
Source:
Returns:
Type
undefined

setConfig(config) → {undefined}

Sets the config instance
Parameters:
Name Type Description
config
Source:
Returns:
Type
undefined

setElement(element) → {undefined}

Sets the element instance
Parameters:
Name Type Description
element
Source:
Returns:
Type
undefined

setOptions(options) → {undefined}

Sets GestureHandler options
Parameters:
Name Type Description
options
Source:
Returns:
Type
undefined

setSwiping() → {undefined}

Sets a flag that indicates that the element is swiping. Flag is automatically cleared after a configurable timeout.
Source:
Returns:
Type
undefined

snapToBounds() → {undefined}

Snaps the element's position back to within its movement boundary.
Source:
Returns:
Type
undefined

snapToNearestChildElement() → {undefined}

Snaps the element's position to a nearby child element.
Source:
Returns:
Type
undefined

stopAnimation() → {undefined}

Stops the current animation (if possible) and clears the animation queue for the element Note: only queued animations can be stopped. Animations with "queue: false" don't seem to be stoppable.
Source:
Returns:
Type
undefined

unbind() → {undefined}

Unbinds all GestureHandler event handlers.
Source:
Returns:
Type
undefined

updatePositionData(e) → {undefined}

Updates the current position data (and sets the start position if not set)
Parameters:
Name Type Description
e
Source:
Returns:
Type
undefined