Skip to content

mouse.input overview


Table of contents


utils

MouseInput (class)

A class representing mouse input.

Signature

export declare class MouseInput {
  constructor(options: Partial<MouseInputOptions> = {})
}

isTouchDevice (static method)

Signature

static isTouchDevice(): boolean

startInternal (method)

Signature

protected startInternal()

stopInternal (method)

Stop listening for mouse movement events.

Signature

protected stopInternal(unlockPointer: boolean = true)

canvasClickListener (method)

Request pointer lock on the canvas element.

Signature

private canvasClickListener(): void

MouseInputOptions (type alias)

Options for a MouseInput.

canvas?: Canvas element. If not provided, mouse events will be listened on the whole window pointerLock: The flag to enable pointer lock when clicking on canvas

Signature

export type MouseInputOptions = {
  canvas?: HTMLCanvasElement
  pointerLock: boolean
}