A DiagramEvent represents a more abstract event than an InputEvent. They are raised on the Diagram class. One can receive such events by registering a DiagramEvent listener on a Diagram by calling Diagram.addDiagramListener. The listener function, when called, will be passed an instance of a DiagramEvent. Use the name property to decide what kind of diagram event it is. The diagram property refers to the Diagram, and you can get additional information from that, such as the Diagram.lastInput, which in turn provides information such as InputEvent.documentPoint that may be relevant for that kind of DiagramEvent.
The subject and parameter properties optionally provide additional information about the diagram event. The subject could be a collection of Parts or it could be an individual object such as a Link or a GraphObject within a Node. Everything depends on the kind of diagram event that it is.
Some DiagramEvents such as "ObjectSingleClicked" or "BackgroundDoubleClicked" are normally associated with InputEvents. Some DiagramEvents such as "SelectionMoved" or "PartRotated" are associated with the results of Tool-handled gestures or CommandHandler actions. Some DiagramEvents are not necessarily associated with any input events at all, such as "ViewportBoundsChanged", which can happen due to programmatic changes to the Diagram.position and Diagram.scale properties.
DiagramEvents that occur during a transaction may be called before the state of the whole diagram has settled down. This often means that such events occur before a layout, so nodes may not have their final positions, links may not have their final routes, and the Diagram.documentBounds and Diagram.viewportBounds may not yet have been updated. Such events may make additional changes to the diagram, which may in turn result in additional side-effects.
DiagramEvents that occur outside of a transaction require you to start and commit a transaction around any side-effects that you want to do. However, some DiagramEvents do not allow you to make any changes to the Diagram or Model.
Currently defined diagram event names include:
e.diagram.toolManager.draggingTool.transactionResult = null;
Gets the diagram associated with the event.
Gets or sets the name of the kind of diagram event that this represents. This property should always be set to one of the recognized list of names, as listed in the documentation for DiagramEvent.
Gets or sets an optional object that describes the change to the subject of the diagram event. This property defaults to null.
Gets or sets an optional object that is the subject of the diagram event. This property defaults to null.