# SingleGestureSource

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/single-gesture-source.js#L19

Single gesture input source. One virtual control for a touch screen, either an on-screen
[joystick](https://api.playcanvas.com/engine/classes/SingleGestureSource.md#joystick) or a drag anywhere on the element depending on [layout](https://api.playcanvas.com/engine/classes/SingleGestureSource.md#layout), producing an
`input` delta as `[x, y]` and a `doubleTap` delta.

## Constructors

### constructor

```ts
new SingleGestureSource()
```

## Accessors

### joystick

```ts
get joystick(): VirtualJoystick
```

### layout

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

## 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[]; input: number[] }
```

**Returns** `{ doubleTap: number[]; input: number[] }`

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

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