InputEvent class

An InputEvent represents a mouse or keyboard or touch event. The principal properties hold information about a particular input event. These properties include the #documentPoint at which a mouse event occurred in document coordinates, the corresponding point in view/element coordinates, #viewPoint, the #key for keyboard events, and the #modifiers and #button at the time. Additional descriptive properties include #clickCount, #delta, #timestamp, and the source event #event (if available).

Many of its properties are provided for convenient access to the state of the input event, such as asking whether the #control key was held down at the time, or the #targetObject (a GraphObject) that the mouse was over .

When real events fire on the Diagram, InputEvents are created automatically set update the value of Diagram#lastInput. These events set the value of #event with the backing browser-defined Event, which may be a MouseEvent, KeyboardEvent, PointerEvent, and so on.

InputEvents backed by MouseEvents set both #button, the button that caused the action, and #buttons, the set of buttons currently pressed after the action has happened. By default a user-created InputEvent sets #button and #buttons as if the event was a left-click.

You can create InputEvents and set the value of Diagram#lastInput in order to simulate user actions in tools. This can be useful for testing. See the Robot extension sample for an example of creating InputEvents to simulate user input.

Available extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

InputEvent()
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited