C

OrthogonalEdgeEditingContext

Used to interactively reshape orthogonal edge paths.
Inheritance Hierarchy

Remarks

This class will be queried from the IInputModeContext of implementations of IPositionHandler, IHandle, and IReshapeHandler that support orthogonal editing of edges.

In a first step, the edit (which is a movement of one or more IPorts, IBends, edge ends, or IPortOwners) is being initialized before anything has been changed. Then, client code that seeks to modify the graph, uses the methods addExplicitlyMovedBend, addMovedEdgeEnd, addMovedPort, and addTransformedPortOwner. In the next step, the drag is being initialized and all affected edges will be prepared so that the editing will not destroy the orthogonality. Interested editors now get the chance to register and negotiate implicitly moved bends. Then the actual editing is performed and the edit is either canceled, in which case the added bends are removed or the edit is finished and the affected edges are being cleaned up.

See Also

Developer's Guide

API

IOrthogonalEdgeHelper, enabled, movePorts

Members

Show:

Constructors

Initializes a new instance of the OrthogonalEdgeEditingContext class that is initially enabled.

Parameters

Properties

Gets the previously registered added bends.
protectedreadonlyfinal

Property Value

An enumerable over the bends that have been added previously using registerAddedBend.
Gets the current input mode context that is in effect for the current edit.
protectedreadonlyfinal

Property Value

The current input mode context, which is only available if this instance is initializing or initialized.
Gets or sets a value indicating whether orthogonal edge editing is enabled at all.
The default value is true.
final

Property Value

true if orthogonal edge editing is enabled at all; false otherwise.

See Also

Developer's Guide
API
isOrthogonallyEditedEdge, shouldEditOrthogonally
Gets or sets a provider that provides the IOrthogonalEdgeHelper instance associated with a given edge.

This provider is used by isOrthogonallyEditedEdge if the orthogonalEdgeHelperProvider returns null for an edge.

The default value provides a helper that doesn't edit the edge orthogonally.

final

Throws

Exception ({ name: 'ArgumentError' })
Thrown if the property is set to null.

See Also

Developer's Guide
Gets or sets whether the context is initialized.
The context is initialized between the calls to initializeDrag and dragFinished or cancelDrag.
readonlyfinal
Gets or sets a value indicating whether this instance is currently initializing.
readonlyfinal

Property Value

true if this instance is initializing but not yet initialized; false otherwise.
Gets the enumeration of IEdge instances whose ports have been locked at source and target end.
For elements in the enumerable, the end points should not be moved and thus shouldMoveEndImplicitly returns false for these edges. Note that this collection is reset for each edit.
protectedreadonlyfinal

Property Value

The transformed port owners.

See Also

API
ARBITRARY_MOVE
Gets or sets a value indicating whether ports are allowed to be moved at all.
The default value is true.
final

Property Value

true (the default) if bends adjacent to ports should try to move the port to stay perpendicular to the bend, false otherwise.

See Also

Developer's Guide
API
shouldMoveEndImplicitly, shouldMoveEndImplicitly
Gets or sets a provider that provides the IOrthogonalEdgeHelper instance associated with a given edge.

The default value obtains the helper instance from the lookup of the edge. Note that the edge passed to the provider must not necessarily be part of the current graph in the context! E.g. it could be the previewEdge.

If the provider returns no IOrthogonalEdgeHelper instance, the fallbackEdgeHelperProvider is called.

final

See Also

API
OrthogonalEdgeHelper
Gets the enumeration of IPortOwner instances that are being transformed during the edit.
For elements in the enumerable the attached ports are considered to be moved in an irregular way during the edit.
protectedreadonlyfinal

Property Value

The transformed port owners.

See Also

API
ARBITRARY_MOVE

Methods

Registers the provided bend with this instance so that it will be considered explicitly moved for this edit.
IDragHandler implementations that are being used to explicitly move a bend during the edit should use this method to register their edit while they are being initialized.
final

Parameters

movementInfo: MovementInfo
The movement info that describes the movement of the bend.
Registers the provided bend as being moved implicitly for this edit.
The instance will be returned by createImplicitlyMovedBendInfo and the moveType will be combined with the requested move type.
final

Parameters

movementInfo: MovementInfo
The movement info for the bend.

Return Value

MovementInfo
The info that has been registered with this instance.
Registers the provided end of the edge with this instance so that it will be considered explicitly moved for this edit.
IDragHandler implementations that are being used to explicitly move the end of an edge during the edit should use this method to register their edit while they are being initialized.
final

Parameters

movementInfo: MovementInfo
The movement info that describes the movement of the end of the edge. The movedItem must be an IEdge.
sourceEnd: boolean
true if the movementInfo represents the source end of the edge.

See Also

API
IEdgePortHandleProvider
Registers the provided port with this instance so that it will be considered explicitly moved for this edit.
IDragHandler implementations that are being used to explicitly move a bend during the edit should use this method to register their edit while they are being initialized.
final

Parameters

movementInfo: MovementInfo
The movement info that describes the movement of the port.
Adds an IPortOwner that is being transformed somehow during the edit so that the attached ports will be moved in an irregular ( non-linear) way.
Normally this will be nodes that are being resized or moved in a non-linear way, or edges, whose bends or ports are being changed.
final

Parameters

owner: IPortOwner
The item that will be transformed.
Called by client edit code when a drag has been canceled.
Resets all internal state lists and sets isInitialized back to false. Also temporarily added bends are removed and cleaned-up will be triggered.
Performs cleanup procedures.
This is called in response to cancelDrag and dragFinished as well as initially during initializeDrag.
protected
Cleans up the edge's path after a successfully finished drag.
This implementation delegates to the IOrthogonalEdgeHelper's cleanUpEdge method.
protected

Parameters

graph: IGraph
The graph in which the edge resides.
edge: IEdge
The modified edge.

See Also

API
orthogonalEdgeHelperProvider
Called after a successfully finished drag to clean up artifacts of modified edges.
protected

Parameters

graph: IGraph
The graph.

See Also

API
cleanUpEdgePath
Creates or obtains a previously created MovementInfo for the provided implicitly moved bend.
This method is queried by client IDragHandler implementations that have been initialized for the current edit that need to move adjacent bends implicitly. Implementations should pass as the parameters the movement information that controls the vertical or horizontal movement of the bend implicitly.
final

Parameters

bend: IBend
The implicitly moved bend.
horizontalAdjacentInfo: MovementInfo
The movement info that implicitly constrains the horizontal movement of the bend or null.
verticalAdjacentInfo: MovementInfo
The movement info that implicitly constrains the vertical movement of the bend or null.

Return Value

MovementInfo
The info to be used by clients that requested it.
Called when a drag has been successfully finished.
This method will perform the necessary clean up and cleanUpEdgePaths.

See Also

API
cleaned-up
Needs to be called by client editing code after initializeDrag has been called and all IDragHandlers have been initialized.
This method will update the isInitializing and isInitialized properties accordingly and will prepare the edge paths. Finally, the initialized event is raised so that registered handlers can perform their post-initialization process.
Gets the MovementInfos that describe the orthogonal path of the edge.
protected

Parameters

edge: IEdge
The edge to obtain the infos for.

Return Value

IListEnumerable<MovementInfo>
An array that contains for the first entry the source end of the edge, then all bends and then as the final entry the target end of the edge. For the bends, this can be null values if nothing is known about the bend, yet.
Gets the declared segment orientation for the provided segment at the given edge.
This implementation uses the provider returned by orthogonalEdgeHelperProvider and its getSegmentOrientation method to yield the orientation.

Parameters

edge: IEdge
The edge to determine the orientation of the segment.
segmentIndex: number
Index of the segment.

Return Value

SegmentOrientation
The orientation of the segment.
Determines whether for the current input mode context there could be any orthogonally edited edge.
This method checks whether any of the edges in the graph in the context is orthogonal. Code can call this method to assure that there are no orthogonal edges in the context.

Parameters

context: IInputModeContext
The context to check.

Return Value

boolean
Whether any of the edges in the context are orthogonal.
Called by client code when a drag is about to be started.
This code needs to be called before any of the IDragHandler implementations are initialized so that they can then register the items they are going to modify with this instance. After this method was called, the handlers that perform the actual edit need to be initialized and as soon as this has been done, dragInitialized should be called.

Parameters

context: IInputModeContext
The context in which the edit is going to be performed.

Throws

Exception ({ name: 'InvalidOperationError' })
If this context is already initialized or currently initializing.

See Also

API
dragInitialized
Called by IDragHandlers and the like to determine whether the given edge is an orthogonally edited edge in the specified input mode context.

This implementation will always yield false if it is disabled. Otherwise, the helper provided by orthogonalEdgeHelperProvider will be used to delegate the query to shouldEditOrthogonally.

Note that most default style implementations have a matching IOrthogonalEdgeHelper in their context and will thus provide the necessary information. If a style doesn't provide a helper, the fallbackEdgeHelperProvider is used instead.

Parameters

context: IInputModeContext
The input mode context which is editing the edge.
edge: IEdge
The edge that will be edited. Note that this instance does not necessarily have to be part of the current graph, but could be a dummy edge or from another graph instance.

Return Value

boolean
true if this edge should be orthogonally edited for the specified input mode context; false otherwise.

See Also

API
enabled, shouldEditOrthogonally, fallbackEdgeHelperProvider
Locks the movement of the ports of the edges so that shouldMoveEndImplicitly will yield false for the provided edge during the current edit.
This state will be reset after the current edit.
final

Parameters

edge: IEdge
The edge to lock the ports of.

See Also

API
lockedPortEdges
Raises the cleaned-up event.
protected

Parameters

evt: InputModeEventArgs
The InputModeEventArgs instance containing the event data.
Raises the initialized event.
protected

Parameters

evt: InputModeEventArgs
The InputModeEventArgs instance containing the event data.

See Also

API
initialized, dragInitialized
Raises the initializing event.
protected

Parameters

evt: InputModeEventArgs
The InputModeEventArgs instance containing the event data.

See Also

API
initializing, initializeDrag
Called during dragInitialized to prepare the edge paths for orthogonal editing.
protected

Parameters

graph: IGraph
The graph that contains the edges to be edited.

See Also

API
prepareOrthogonalEdge
Helper method that inspects and prepares an orthogonal edge for the upcoming edit process.
This method inspects an edge and possibly inserts new bends into an edge to ensure that during editing the orthogonality won't be lost.
protected

Parameters

graph: IGraph
The graph to use for modifying the bends.
edge: IEdge
The edge to inspect.
orientations: IListEnumerable<SegmentOrientation>
The orientations of the segments - the array is of length (edge.Bends.Count + 1).
infos: IListEnumerable<MovementInfo>
The MovementInfo instances for the source end, the bends, and the target end. This array contains MovementInfo instances representing either edge ends or ports at the first and last position and MovementInfos or null entries for the bends. The length thus is (edge.Bends.Count + 2) and null entries indicate that there is no information about the movement (in case the bend will only be moved implicitly later, if at all).
Can be used by subclasses during prepareOrthogonalEdge to register added bends that can later be removed in case the operation is canceled.
This method will only record the addition of bends if this instance is initialized or still initializing.
protectedfinal

Parameters

bend: IBend
The bend that has been added to guarantee orthogonality.
Removes previously registered added bends.
protected

Parameters

graph: IGraph
The graph to use for removing the bends.
addedBends: IEnumerable<IBend>
The added bends.

See Also

API
addedBends, registerAddedBend
Called by IDragHandlers and the like to determine whether the specified end of the provided edge should be moved implicitly.
If an item is next to the end of an edge and the last segment should be kept orthogonal, this may only be possible if the end of the edge is moved, too. This can be achieved by moving the edge to another IPort, or by moving the port instance itself. This depends on the implementation of the IEdgePortHandleProvider for the given edge. This implementation will delegate to the shouldMoveEndImplicitly method of the IOrthogonalEdgeHelper instance returned by orthogonalEdgeHelperProvider unless the side of the edge is connected to an IPortOwner instance that is marked as transformed during the edit.

Parameters

edge: IEdge
The edge for which it should be determined whether the edge end can be moved.
sourceSide: boolean
if set to true the source side of the end is queried, else the target side.

Return Value

boolean
true if the specified side of the edge can be moved; false otherwise, in which case the segment should be split to maintain orthogonality.

See Also

API
orthogonalEdgeHelperProvider, shouldMoveEndImplicitly, movePorts

Events

Occurs when the recent edit operation has been cleaned up.

Properties of

InputModeEventArgs
context: IInputModeContext
Gets the context for the current event.

See Also

Developer's Guide
API
cleanUp, onCleanedUp
Occurs when the edit has been initialized.

Properties of

InputModeEventArgs
context: IInputModeContext
Gets the context for the current event.

See Also

Developer's Guide
API
dragInitialized, onInitialized
Occurs when the edit is about to be initialized.

Properties of

InputModeEventArgs
context: IInputModeContext
Gets the context for the current event.

See Also

Developer's Guide
API
initializeDrag, onInitializing

Static Methods

All static methods are filtered. Go to Filters.