The union of tool names this manager recognizes.
The union of tool names this manager recognizes.
Create an event manager and register it in GradumEventManager.allManagers. The first one created becomes GradumEventManager.instance.
Protected StaticmanagersReadonlypropertiesStaticdefaultThe MVC pieces and event-type switches a new manager starts with. Every event family is
enabled by default; pass the matching EnabledGradumEventTypes flag to create to turn one off.
ProtectedkeyProtectedwheelProtectedpointerProtecteddispatchReadonlyonReadonlycurrentReadonlycurrentReadonlyonReadonlyinitializedThe properties passed on to children created through feedforward, letting a parent seed its descendants with shared defaults.
StaticinstanceStaticallWhether keyboard input is listened to and turned into GradumKeyEvents. Setting it
to false reverts key handling to the native event names.
Whether wheel input is listened to and turned into GradumWheelEvents. Setting it to
false reverts wheel handling to the native event names.
Whether wheel input has its native default suppressed, blocking browser page zoom and scroll. Combines the manager's setting with any active lock, as GradumEventManager.enabled does.
Whether mouse input has its native default suppressed. Combines the manager's setting with any active lock, as GradumEventManager.enabled does.
Whether touch input has its native default suppressed, blocking native scrolling and pinch-zoom. Combines the manager's setting with any active lock, as GradumEventManager.enabled does.
Function
lock
The node establishing the lock.
The state to impose while the lock is held.
Temporarily override the manager's state on behalf of one node, for the duration of an interaction. Use it to impose settings mid-gesture — suppressing native touch scrolling while a drag is in flight, say — then call GradumEventManager.unlock to hand them back. Any existing lock is released first, so locks do not nest.
Function
getToolsByKey
The key the tool is mapped to.
All instances bound to that key, or an empty array if the key maps to nothing.
Function
setTool
The tool instance to make current. Pass undefined to clear the mode.
The click mode to bind the tool to.
Optionaloptions: SetToolOptions = {}
Whether to select and activate the tool, and whether it also
becomes the tool for ClickMode.none.
Make a tool the current one for a click mode, so interactions in that mode are attributed to it. The previously held tool is deselected and deactivated first, and GradumEventManager.onToolChange fires once the swap is done. Passing a tool that is not registered with this manager does nothing.
Function
setupCustomDispatcher
The event type to dispatch.
ProtectedapplyStaticcreateFunction
create
The created instance.
Instantiate this class with the given properties. Defaults declared by every class in the
inheritance chain are applied first, nearest ancestor last, so a subclass' defaultProperties win over
its parent's. The return type follows the class it is called on, so a subclass gets its own type back.
Protected StaticcustomProtected Function
Properties to set on the new instance, defaults already merged in.
The created instance.
The construction step behind create. Override it to change how instances of a class
are built — to route through a factory, or to wrap the instance — while keeping the default-merging that
create performs.
Function
feedforward
Optionalproperties: FeedforwardProperties
Properties to feed forward. Defaults to
defaultFeedforwardProperties.
Itself, allowing for method chaining.
Function
clone
Optionaloptions: CloneElementOptions
What to carry over to the copy.
The cloned element.
GradumEventManager
Description
Listens to native mouse, trackpad, touch, and keyboard input and turns it into Gradum's richer events — GradumEvent, GradumDragEvent, GradumKeyEvent, and GradumWheelEvent — so a click, a long press, and a drag arrive as distinct, named events rather than something each component has to derive itself. It also owns the current tool per ClickMode, and can map screen coordinates into document space for every event it fires.
Most applications need only one, reached through GradumEventManager.instance.