ElementInput
Handles mouse and touch events for ElementComponents. When input events occur on an ElementComponent this fires the appropriate events on the ElementComponent.
Summary
Methods
addElement | Add a ElementComponent to the internal list of ElementComponents that are being checked for input. |
attach | Attach mouse and touch events to a DOM element. |
detach | Remove mouse and touch events from the DOM element that it is attached to. |
removeElement | Remove a ElementComponent from the internal list of ElementComponents that are being checked for input. |
Details
Constructor
ElementInput(domElement, [options])
Create a new ElementInput instance.
Parameters
domElement | Element | The DOM element. |
options | object | Optional arguments. |
options.useMouse | boolean | Whether to allow mouse input. Defaults to true. |
options.useTouch | boolean | Whether to allow touch input. Defaults to true. |
options.useXr | boolean | Whether to allow XR input sources. Defaults to true. |
Methods
addElement(element)
Add a ElementComponent to the internal list of ElementComponents that are being checked for input.
Parameters
element | ElementComponent | The ElementComponent. |
attach(domElement)
Attach mouse and touch events to a DOM element.
Parameters
domElement | Element | The DOM element. |
detach()
Remove mouse and touch events from the DOM element that it is attached to.
removeElement(element)
Remove a ElementComponent from the internal list of ElementComponents that are being checked for input.
Parameters
element | ElementComponent | The ElementComponent. |