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
Constructors
Initializes a new instance of the OrthogonalEdgeEditingContext class that is initially enabled.
Parameters
Properties
Gets the previously registered added bends.
Property Value
Gets the current input mode context that is in effect for the current edit.
Property Value
true.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.
Throws
- Exception ({ name: 'ArgumentError' })
- Thrown if the property is set to
null.
See Also
Developer's Guide
Property Value
Gets the enumeration of IEdge instances whose ports have been locked at source and target end.
Property Value
See Also
true.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.
See Also
Gets the enumeration of IPortOwner instances that are being transformed during the edit.
Property Value
See Also
Methods
Registers the provided bend with this instance so that it will be considered explicitly moved for this edit.
Parameters
- movementInfo: MovementInfo
- The movement info that describes the movement of the bend.
Registers the provided bend as being moved implicitly for this edit.
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.
Parameters
- movementInfo: MovementInfo
- sourceEnd: boolean
trueif themovementInforepresents the source end of the edge.
See Also
Registers the provided port with this instance so that it will be considered explicitly moved for this edit.
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.
Parameters
- owner: IPortOwner
- The item that will be transformed.
false. Also temporarily added bends are removed and cleaned-up will be triggered.Cleans up the edge's path after a successfully finished drag.
Parameters
See Also
Called after a successfully finished drag to clean up artifacts of modified edges.
Creates or obtains a previously created MovementInfo for the provided implicitly moved bend.
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.
Needs to be called by client editing code after initializeDrag has been called and all IDragHandlers have been initialized.
Gets the MovementInfos that describe the orthogonal path of the edge.
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
nullvalues if nothing is known about the bend, yet.
Gets the declared segment orientation for the provided segment at the given edge.
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.
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.
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
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
trueif this edge should be orthogonally edited for the specified input mode context;falseotherwise.
See Also
Locks the movement of the ports of the edges so that shouldMoveEndImplicitly will yield false for the provided edge during the current edit.
false for the provided edge during the current edit.Parameters
- edge: IEdge
- The edge to lock the ports of.
See Also
Raises the cleaned-up event.
Parameters
- evt: InputModeEventArgs
- The InputModeEventArgs instance containing the event data.
Raises the initialized event.
Parameters
- evt: InputModeEventArgs
- The InputModeEventArgs instance containing the event data.
See Also
Raises the initializing event.
Parameters
- evt: InputModeEventArgs
- The InputModeEventArgs instance containing the event data.
See Also
Called during dragInitialized to prepare the edge paths for orthogonal editing.
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
nullentries for the bends. The length thus is (edge.Bends.Count + 2) andnullentries 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.
Parameters
- bend: IBend
- The bend that has been added to guarantee orthogonality.
Removes previously registered added bends.
Parameters
- graph: IGraph
- The graph to use for removing the bends.
- addedBends: IEnumerable<IBend>
- The added bends.
See Also
Called by IDragHandlers and the like to determine whether the specified end of the provided edge should be moved implicitly.
edge should be moved implicitly.Parameters
- edge: IEdge
- The edge for which it should be determined whether the edge end can be moved.
- sourceSide: boolean
- if set to
truethe source side of the end is queried, else the target side.
Return Value
- boolean
trueif the specified side of the edge can be moved;falseotherwise, in which case the segment should be split to maintain orthogonality.
See Also
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