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.
Optional
dia: DiagramGets or sets the go.Diagram associated with this Robot.
Simulate a key down event.
A simulated KeyboardEvent.keyCode (number) or KeyboardEvent.key (string)
Optional
time: numberthe timestamp of the simulated event, in milliseconds; default zero
Optional
eventprops: ObjectDataan optional argument providing properties for the InputEvent.
Simulate a key up event.
A simulated KeyboardEvent.keyCode (number) or KeyboardEvent.key (string)
Optional
time: numberthe timestamp of the simulated event, in milliseconds; default zero
Optional
eventprops: ObjectDataan 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.
Optional
time: numberthe timestamp of the simulated event, in milliseconds; default zero
Optional
eventprops: ObjectDataan 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.
Optional
time: numberthe timestamp of the simulated event, in milliseconds; default zero
Optional
eventprops: ObjectDataan 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.
Optional
time: numberthe timestamp of the simulated event, in milliseconds; default zero
Optional
eventprops: ObjectDataan optional argument providing properties for the InputEvent.
Simulate a mouse wheel event.
non-zero turn
Optional
time: numberthe timestamp of the simulated event, in milliseconds; default zero
Optional
eventprops: ObjectDataan optional argument providing properties for the InputEvent.
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
sourceDiagram
andtargetDiagram
properties on theeventprops
argument of the mouseDown/mouseMove/mouseUp methods. Although go.InputEvent.targetDiagram is a real property, thesourceDiagram
property is only used by these Robot methods.Typical setup:
Then later:
If you want to experiment with this extension, try the Simulating Input sample.