This is an extension and not part of the main GoJS library. Note that the API for this class may change at any time. If you intend to use an extension in production, you should copy the code to your own source directory. See the Extensions intro page for more information.
Construct a robot for a given go.Diagram. If none is provided, a new Diagram will be created.
Optionaldia: DiagramGets or sets the go.Diagram associated with this Robot.
Simulate a key down event.
A simulated KeyboardEvent.keyCode (number) or KeyboardEvent.key (string)
Optionaltime: numberthe timestamp of the simulated event, in milliseconds; default zero
Optionaleventprops: Partial<InputEvent>an optional argument providing properties for the InputEvent.
Simulate a key up event.
A simulated KeyboardEvent.keyCode (number) or KeyboardEvent.key (string)
Optionaltime: numberthe timestamp of the simulated event, in milliseconds; default zero
Optionaleventprops: Partial<InputEvent>an optional argument providing properties for the InputEvent.
Simulate a mouse down event.
the X-coordinate of the mouse point in document coordinates.
the Y-coordinate of the mouse point in document coordinates.
Optionaltime: numberthe timestamp of the simulated event, in milliseconds; default zero
Optionaleventprops: Partial<InputEvent & { sourceDiagram: Diagram }>an optional argument providing properties for the InputEvent.
Simulate a mouse move event.
the X-coordinate of the mouse point in document coordinates.
the Y-coordinate of the mouse point in document coordinates.
Optionaltime: numberthe timestamp of the simulated event, in milliseconds; default zero
Optionaleventprops: Partial<InputEvent & { sourceDiagram: Diagram }>an optional argument providing properties for the InputEvent.
Simulate a mouse up event.
the X-coordinate of the mouse point in document coordinates.
the Y-coordinate of the mouse point in document coordinates.
Optionaltime: numberthe timestamp of the simulated event, in milliseconds; default zero
Optionaleventprops: Partial<InputEvent & { sourceDiagram: Diagram }>an optional argument providing properties for the InputEvent.
Simulate a mouse wheel event.
non-zero turn
Optionaltime: numberthe timestamp of the simulated event, in milliseconds; default zero
Optionaleventprops: Partial<InputEvent>an optional argument providing properties for the InputEvent.
Deprecated in 4.0. Consider using Diagram.emitMouseDown and related emit... methods instead.
A class for simulating mouse and keyboard input.
As a special feature, this supports limited simulation of drag-and-drop between Diagrams, by setting both the
sourceDiagramandtargetDiagramproperties on theeventpropsargument of the mouseDown/mouseMove/mouseUp methods. Although go.InputEvent.targetDiagram is a real property, thesourceDiagramproperty is only used by these Robot methods.Typical setup:
Then later:
As of version 3.2, the functionality is built into the Diagram class using methods whose names start with "emit...". However, the functionality is duplicated here for compatibility with versions earlier than 3.2.
deprecatedSee Diagram.emitMouseDown and related emit... methods