Mirror Engine
V5
How To
Mirror Engine Logo

Mirror Engine API


Mirror Engine API / ElementInput

Class: ElementInput

Handles mouse and touch events for ElementComponents. When input events occur on an ElementComponent this fires the appropriate events on the ElementComponent.

Constructors

new ElementInput()

new ElementInput(domElement: Element, options?: {
  useMouse: boolean;
  useTouch: boolean;
  useXr: boolean;
 }): ElementInput

Create a new ElementInput instance.

Parameters

domElement

Element

The DOM element.

options?

Optional arguments.

useMouse?

boolean

Whether to allow mouse input. Defaults to true.

useTouch?

boolean

Whether to allow touch input. Defaults to true.

useXr?

boolean

Whether to allow XR input sources. Defaults to true.

Returns

ElementInput

Methods

addElement()

addElement(element: ElementComponent): void

Add a ElementComponent to the internal list of ElementComponents that are being checked for input.

Parameters

element

ElementComponent

The ElementComponent.

Returns

void


attach()

attach(domElement: Element): void

Attach mouse and touch events to a DOM element.

Parameters

domElement

Element

The DOM element.

Returns

void


detach()

detach(): void

Remove mouse and touch events from the DOM element that it is attached to.

Returns

void


removeElement()

removeElement(element: ElementComponent): void

Remove a ElementComponent from the internal list of ElementComponents that are being checked for input.

Parameters

element

ElementComponent

The ElementComponent.

Returns

void

Mirror Engine Logo