flatworld.eventListeners Class
This keeps all the event listeners and detectors in one class. You add detectors / event listener types with addDetector and you add event listeners with on.
Item Index
Methods
Methods
_createEventListenerWrapper
-
type
-
cb
This creates a wrapper for callback. The idea is to send map events from this wrapper for all events.
clearDetector
-
type
Clear event detector. We also remove all possible eventlisteners set on this event type.
Parameters:
-
type
StringEvent type
getActivityState
-
type
get activity state of the event
Parameters:
-
type
StringEventType
Returns:
isOn
-
type
-
cb
Activates the eventListener. Callback is optional. If is not provided will check if the eventlistener type has any listeners active.
off
-
type
-
cb
Deactivates the eventListener. Callback is optional. If is not provided will remove all this types eventListeners
on
-
type
-
cb
Activates the eventListener.
Parameters:
Throws:
General error, if detector for this event type has not been set.
setActivityState
-
type
-
newState
Sets the state of the event. State is very important e.g. for fluent dragging and selecting. When we start to drag, we avoid selecting units and vice versa, when we keep an event state tracking through this.