new MouseState()
Poll system (https://en.wikipedia.org/wiki/Polling_(computer_science)) Listen to the MOUSE_STATE_EVENTS and store the mouse state to then be access synchronously
- Source
Classes
Members
dragging :boolean
true if the mouse is dragging
Type:
- boolean
- Source
listeners :Array.<{element:HTMLElement, listener:EventCallback, id:string}>
register all listeners to well dispose them on dipose
Type:
- Array.<{element:HTMLElement, listener:EventCallback, id:string}>
- Source
mouseEvent :Object.<string, Event>
register event native js to pass it later synchronously
Type:
- Object.<string, Event>
- Source
mouseMap :Object.<string, boolean>
register if a mouse event is trigger or not
Type:
- Object.<string, boolean>
- Source
Methods
addEvent(element, idEvent) → {EventCallback}
Add a listener for a particular event on element
Parameters:
Name | Type | Description |
---|---|---|
element | HTMLElement | element to listen to |
idEvent | string | mouse events |
- Source
Returns:
- Callback call for this event
- Type:
- EventCallback
dispose()
Remove listeners and reset variables
- Source
event(eventID) → {Event}
Access the last Event stored for eventID
Parameters:
Name | Type | Description |
---|---|---|
eventID | string | id of the mouse event |
- Source
Returns:
- The last event store for this event
- Type:
- Event
isDragging() → {boolean}
- Source
Returns:
- true if the mouse is dragging, false otherwise
- Type:
- boolean
isTrigger(eventID) → {boolean}
Return true if this event has been triggered on the last poll
Parameters:
Name | Type | Description |
---|---|---|
eventID | string | event id |
- Source
Returns:
- true if the eventID has been triggered
- Type:
- boolean
reset()
Reset Event triggered
- Source
startListening(element)
Start listening MOUSE_STATE_EVENTS
on the element
Parameters:
Name | Type | Description |
---|---|---|
element | HTMLElement | html catching events |
- Source