The DiagramEvent class constructor produces an empty DiagramEvent. You should never need to call this constructor. But if you do, you must first set diagram to the Diagram before any other use.
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.
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:
this can be useful for customizing the initial animation, see AnimationManager.initialAnimationStyle.
do not modify the Diagram or its Model in the event listener.
do not modify the Diagram or its Model in the event listener.
if you make any changes, start and commit your own transaction.
if you make any changes, start and commit your own transaction.
if you make any changes, start and commit your own transaction.
which is also the value of the DiagramEvent.subject;
do not make any changes to the selection or the diagram in the event listener; note that just setting Part.isSelected will not raise this event, but tools and commands will.
which is also the value of the DiagramEvent.subject;
do not make any changes to the selection or the diagram in the event listener; note that just setting Part.isSelected will not raise this event, but tools and commands will.
the DiagramEvent.subject is the collection of Parts;
if you make any changes, start and commit your own transaction.
the DiagramEvent.subject is the Diagram.selection,
and this is called within a transaction.
the DiagramEvent.parameter is the old Rect
the DiagramEvent.subject is the set of Parts that were dropped (which is also the Diagram.selection), the DiagramEvent.parameter is the source Diagram, and this is called within a transaction. If you choose, you can cancel the drop by executing:
e.diagram.toolManager.draggingTool.transactionResult = null;
if you make any changes, you do not need to perform a transaction.
if you make any changes, you do not need to perform a transaction.
the DiagramEvent.subject is the new Link,
and this is called within a transaction.
the DiagramEvent.subject is the modified Link,
the DiagramEvent.parameter is the GraphObject port that the link was disconnected from,
and this is called within a transaction.
the DiagramEvent.subject is the modified Link,
the DiagramEvent.parameter is the List of Points of the link's original route, and this is called within a transaction.
do not modify the Diagram or its Model in the event listener.
the DiagramEvent.subject is the GraphObject;
if you make any changes, start and commit your own transaction.
the DiagramEvent.subject is the GraphObject;
if you make any changes, start and commit your own transaction.
the DiagramEvent.subject is the GraphObject;
if you make any changes, start and commit your own transaction.
the DiagramEvent.subject is the new Part,
and this is called within a transaction.
the DiagramEvent.subject is the GraphObject,
the DiagramEvent.parameter is the original Size,
and this is called within a transaction.
the DiagramEvent.subject is the GraphObject,
the DiagramEvent.parameter is the original angle in degrees,
and this is called within a transaction.
the DiagramEvent.subject is a Set of the moved Parts,
and this is called within a transaction.
the DiagramEvent.subject is Set of the newly copied Parts,
and this is called within a transaction.
the DiagramEvent.subject is the collection of Parts that were deleted,
and this is called within a transaction.
the DiagramEvent.subject is the Diagram.selection collection of Parts to be deleted,
and this is called within a transaction.
the DiagramEvent.subject is the new Group,
and this is called within a transaction.
the DiagramEvent.subject is the collection of Groups that were ungrouped,
the DiagramEvent.parameter is the collection of former member Parts that were ungrouped,
and this is called within a transaction.
the DiagramEvent.subject is the collection of Groups that were collapsed,
and this is called within a transaction.
the DiagramEvent.subject is the collection of Groups that were expanded,
and this is called within a transaction.
the DiagramEvent.subject is the edited TextBlock,
the DiagramEvent.parameter is the original string,
and this is called within a transaction.
the DiagramEvent.subject is the collection of Nodes that were collapsed,
and this is called within a transaction.
the DiagramEvent.subject is the collection of Nodes that were expanded,
and this is called within a transaction.
the DiagramEvent.subject is an object whose "scale" property is the old Diagram.scale value, whose "position" property is the old Diagram.position value, whose "bounds" property is the old Diagram.viewportBounds value, whose "canvasSize" property is the old size of the Diagram.div, and whose "newCanvasSize" property is the new size of the Diagram.div, the DiagramEvent.parameter is also the old viewportBounds Rect.