---
title: "TwoFingersTouchZoomRotateHandler | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Class TwoFingersTouchZoomRotateHandler

The `TwoFingersTouchZoomRotateHandler` allows the user to zoom and rotate the map by pinching on a touchscreen.

They can zoom with one finger by double tapping and dragging. On the second tap, hold the finger down and drag up or down to zoom in or out.

##### Index

### Constructors[](#constructors)

[constructor](#constructor)

### Methods[](#methods)

[disable](#disable) [disableRotation](#disablerotation) [enable](#enable) [enableRotation](#enablerotation) [isActive](#isactive) [isEnabled](#isenabled) [setZoomRate](#setzoomrate) [setZoomThreshold](#setzoomthreshold)

## Constructors[](#constructors-1)

### constructor[](#constructor)

-   new TwoFingersTouchZoomRotateHandler(  
        el: [HTMLElement](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLElement/),  
        touchZoom: [TwoFingersTouchZoomHandler](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.TwoFingersTouchZoomHandler/),  
        touchRotate: [TwoFingersTouchRotateHandler](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.TwoFingersTouchRotateHandler/),  
        tapDragZoom: [TapDragZoomHandler](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.TapDragZoomHandler/),  
    ): TwoFingersTouchZoomRotateHandler[](#constructortwofingerstouchzoomrotatehandler)
    
    #### Parameters
    
    -   el: [HTMLElement](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.HTMLElement/)
    -   touchZoom: [TwoFingersTouchZoomHandler](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.TwoFingersTouchZoomHandler/)
    -   touchRotate: [TwoFingersTouchRotateHandler](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.TwoFingersTouchRotateHandler/)
    -   tapDragZoom: [TapDragZoomHandler](https://docs.maptiler.com/sdk-js/api-reference/classes/Externals.TapDragZoomHandler/)
    
    #### Returns TwoFingersTouchZoomRotateHandler
    
    #### Internal[](#internal)
    

## Methods[](#methods-1)

### disable[](#disable)

-   disable(): void[](#disable-1)
    
    Disables the "pinch to rotate and zoom" interaction.
    
    #### Returns void
    
    #### Example[](#example)
    
    ```typescript
    map.touchZoomRotate.disable();
    ```
    

### disableRotation[](#disablerotation)

-   disableRotation(): void[](#disablerotation-1)
    
    Disables the "pinch to rotate" interaction, leaving the "pinch to zoom" interaction enabled.
    
    #### Returns void
    
    #### Example[](#example-1)
    
    ```typescript
    map.touchZoomRotate.disableRotation();
    ```
    

### enable[](#enable)

-   enable(options?: boolean | [AroundCenterOptions](https://docs.maptiler.com/sdk-js/api-reference/types/AroundCenterOptions/) | null): void[](#enable-1)
    
    Enables the "pinch to rotate and zoom" interaction.
    
    #### Parameters
    
    -   `Optional`options: boolean | [AroundCenterOptions](https://docs.maptiler.com/sdk-js/api-reference/types/AroundCenterOptions/) | null
        
        Options object.
        
    
    #### Returns void
    
    #### Example[](#example-2)
    
    ```typescript
    map.touchZoomRotate.enable();
    map.touchZoomRotate.enable({ around: 'center' });
    ```
    

### enableRotation[](#enablerotation)

-   enableRotation(): void[](#enablerotation-1)
    
    Enables the "pinch to rotate" interaction.
    
    #### Returns void
    
    #### Example[](#example-3)
    
    ```typescript
    map.touchZoomRotate.enable();
    map.touchZoomRotate.enableRotation();
    ```
    

### isActive[](#isactive)

-   isActive(): boolean[](#isactive-1)
    
    Returns true if the handler is enabled and has detected the start of a zoom/rotate gesture.
    
    #### Returns boolean
    
    `true` if the handler is active, `false` otherwise
    

### isEnabled[](#isenabled)

-   isEnabled(): boolean[](#isenabled-1)
    
    Returns a Boolean indicating whether the "pinch to rotate and zoom" interaction is enabled.
    
    #### Returns boolean
    
    `true` if the "pinch to rotate and zoom" interaction is enabled.
    

### setZoomRate[](#setzoomrate)

-   setZoomRate(zoomRate?: number): void[](#setzoomrate-1)
    
    Sets the zoom rate of touch gestures.
    
    #### Parameters
    
    -   `Optional`zoomRate: number
        
        1 The rate used to scale touch movement to a zoom value. Set to `undefined` to restore the default.
        
    
    #### Returns void
    
    #### Example[](#example-4)
    
    Slow down touch zoom
    
    ```typescript
    map.touchZoomRotate.setZoomRate(0.5);
    ```
    

### setZoomThreshold[](#setzoomthreshold)

-   setZoomThreshold(zoomThreshold?: number): void[](#setzoomthreshold-1)
    
    Sets the threshold before a pinch gesture starts zooming.
    
    #### Parameters
    
    -   `Optional`zoomThreshold: number
        
        0.1 The minimum zoom delta before the pinch gesture becomes active. Set to `undefined` to restore the default.
        
    
    #### Returns void
    
    #### Example[](#example-5)
    
    Make pinch zoom less sensitive
    
    ```typescript
    map.touchZoomRotate.setZoomThreshold(0.3);
    ```
