# DualGestureSource

Class · extends [`InputSource`](https://api.playcanvas.com/engine/classes/InputSource.md) · category: Input

Source: https://github.com/playcanvas/engine/blob/970d89f6d3bc6667f4e1f88153abd6e7e82ed52c/src/extras/input/sources/dual-gesture-source.js#L36

Dual gesture input source. Two virtual controls for a touch screen, one on the left of the
element and one on the right, producing `leftInput` and `rightInput` deltas as `[x, y]` and a
`doubleTap` delta. The [layout](https://api.playcanvas.com/engine/classes/DualGestureSource.md#layout) chooses a joystick or a plain touch area for each side,
for example `joystick-touch`, and the joysticks are exposed as [leftJoystick](https://api.playcanvas.com/engine/classes/DualGestureSource.md#leftjoystick) and
[rightJoystick](https://api.playcanvas.com/engine/classes/DualGestureSource.md#rightjoystick).

## Constructors

### constructor

```ts
new DualGestureSource(layout?: "joystick-joystick" | "joystick-touch" | "touch-joystick" | "touch-touch")
```

**Parameters**

- `layout` (`"joystick-joystick" | "joystick-touch" | "touch-joystick" | "touch-touch"`, optional): The layout of the dual
  gesture source.

## Accessors

### layout

```ts
get layout(): "joystick-joystick" | "joystick-touch" | "touch-joystick" | "touch-touch"
set layout(value: "joystick-joystick" | "joystick-touch" | "touch-joystick" | "touch-touch")
```

### leftJoystick

```ts
get leftJoystick(): VirtualJoystick
```

### rightJoystick

```ts
get rightJoystick(): VirtualJoystick
```

## Methods

### attach

```ts
attach(element: HTMLElement): void
```

**Parameters**

- `element` (`HTMLElement`): The element.

### destroy

```ts
destroy(): void
```

### detach

```ts
detach(): void
```

### read

```ts
read(): { doubleTap: number[]; leftInput: number[]; rightInput: number[] }
```

**Returns** `{ doubleTap: number[]; leftInput: number[]; rightInput: number[] }`

## Inherited from [InputSource](https://api.playcanvas.com/engine/classes/InputSource.md)

- `protected _element: HTMLElement | null = null`
- `deltas: { doubleTap: InputDelta; leftInput: InputDelta; rightInput: InputDelta }`
- `fire(event: string, ...args: any[]): void`
- `off(event: string, callback: HandleEventCallback): void`
- `on(event: string, callback: HandleEventCallback): void`
