# OpenLayers.Handler.Pinch

The pinch handler is used to deal with sequences of browser events related to pinch gestures. The handler is used by controls that want to know when a pinch sequence begins, when a pinch is happening, and when it has finished.

Controls that use the pinch handler typically construct it with callbacks for ‘start’, ‘move’, and ‘done’. Callbacks for these keys are called when the pinch begins, with each change, and when the pinch is done.

Create a new pinch handler with the OpenLayers.Handler.Pinch constructor.

#### Inherits from

- OpenLayers.Handler

Summary

OpenLayers.Handler.Pinch | The pinch handler is used to deal with sequences of browser events related to pinch gestures.
Properties |
started | {Boolean} When a touchstart event is received, we want to record it, but not set ‘pinching’ until the touchmove get started after starting.
stopDown | {Boolean} Stop propagation of touchstart events from getting to listeners on the same element.
pinching | {Boolean}
last | {Object} Object that store informations related to pinch last touch.
start | {Object} Object that store informations related to pinch touchstart.
Constructor |
OpenLayers.Handler.Pinch | Returns OpenLayers.Handler.Pinch
Functions |
touchstart | Handle touchstart events
touchmove | Handle touchmove events
touchend | Handle touchend events
activate | Activate the handler.
deactivate | Deactivate the handler.
getDistance | Get the distance in pixels between two touches.
getPinchData | Get informations about the pinch event.

### Properties

### started

{Boolean} When a touchstart event is received, we want to record it, but not set ‘pinching’ until the touchmove get started after starting.

### stopDown

{Boolean} Stop propagation of touchstart events from getting to listeners on the same element. Default is false.

### pinching

{Boolean}

### last

{Object} Object that store informations related to pinch last touch.

### start

{Object} Object that store informations related to pinch touchstart.

### Constructor

### OpenLayers.Handler.Pinch

Returns OpenLayers.Handler.Pinch

#### Parameters

control | {OpenLayers.Control} The control that is making use of this handler. If a handler is being used without a control, the handlers setMap method must be overridden to deal properly with the map.
callbacks | {Object} An object containing functions to be called when the pinch operation start, change, or is finished. The callbacks should expect to receive an object argument, which contains information about scale, distance, and position of touch points.
options | {Object}

### Functions

### touchstart

> touchstart: function( | evt | )

Handle touchstart events

#### Parameters

evt | {Event}

#### Returns

{Boolean} Let the event propagate.

### touchmove

> touchmove: function( | evt | )

Handle touchmove events

#### Parameters

evt | {Event}

#### Returns

{Boolean} Let the event propagate.

### touchend

> touchend: function( | evt | )

Handle touchend events

#### Parameters

evt | {Event}

#### Returns

{Boolean} Let the event propagate.

### activate

> activate: function()

Activate the handler.

#### Returns

{Boolean} The handler was successfully activated.

### deactivate

> deactivate: function()

Deactivate the handler.

#### Returns

{Boolean} The handler was successfully deactivated.

### getDistance

> getDistance: function( | touches | )

Get the distance in pixels between two touches.

#### Parameters

touches | {Array(Object)}

#### Returns

{Number} The distance in pixels.

### getPinchData

> getPinchData: function( | evt | )

Get informations about the pinch event.

#### Parameters

evt | {Event}

#### Returns

{Object} Object that contains data about the current pinch.

> touchstart: function( | evt | )

Handle touchstart events

> touchmove: function( | evt | )

Handle touchmove events

> touchend: function( | evt | )

Handle touchend events

> activate: function()

Activate the handler.

> deactivate: function()

Deactivate the handler.

> getDistance: function( | touches | )

Get the distance in pixels between two touches.

> getPinchData: function( | evt | )

Get informations about the pinch event.
Returns OpenLayers.Handler.Pinch
Base class to construct a higher-level handler for event sequences.
Controls affect the display or behavior of the map.
Close