Used to interactively reshape orthogonal edge paths.
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.
Type Details
- yFiles module
- view
See Also
Constructors
Initializes a new instance of the OrthogonalEdgeEditingContext class that is initially enabled.
Parameters
A map of options to pass to the method.
- enabled - boolean
- A value indicating whether orthogonal edge editing is enabled at all. This option sets the enabled property on the created object.
- movePorts - boolean
- A value indicating whether ports are allowed to be moved at all. This option sets the movePorts property on the created object.
- orthogonalEdgeHelperProvider - function(IEdge):IOrthogonalEdgeHelper
- A provider that provides the IOrthogonalEdgeHelper instance associated with a given edge. This option sets the orthogonalEdgeHelperProvider property on the created object.
Signature Details
function(arg: IEdge) : IOrthogonalEdgeHelper
Encapsulates a method that has one parameters and returns a value of the type specified by theTResult
parameter.Parameters
- arg - IEdge
- The parameter of the method that this delegate encapsulates.
Returns
- IOrthogonalEdgeHelper
- The return value of the method that this delegate encapsulates.
- fallbackEdgeHelperProvider - function(IEdge):IOrthogonalEdgeHelper
- A provider that provides the IOrthogonalEdgeHelper instance associated with a given edge. This option sets the fallbackEdgeHelperProvider property on the created object.
Signature Details
function(arg: IEdge) : IOrthogonalEdgeHelper
Encapsulates a method that has one parameters and returns a value of the type specified by theTResult
parameter.Parameters
- arg - IEdge
- The parameter of the method that this delegate encapsulates.
Returns
- IOrthogonalEdgeHelper
- The return value of the method that this delegate encapsulates.
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
Gets or sets a value indicating whether orthogonal edge editing is enabled at all.
Remarks
true
.Property Value
true
if orthogonal edge editing is enabled at all; false
otherwise.See Also
Gets or sets a provider that provides the IOrthogonalEdgeHelper instance associated with a given edge.
Remarks
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.
Signature Details
function(arg: IEdge) : IOrthogonalEdgeHelper
TResult
parameter.Parameters
- arg - IEdge
- The parameter of the method that this delegate encapsulates.
Returns
- IOrthogonalEdgeHelper
- The return value of the method that this delegate encapsulates.
Throws
- Exception({ name: 'ArgumentError' })
- Thrown if the property is set to
null
.
Gets or sets whether the context is initialized.
Remarks
Gets or sets a value indicating whether this instance is currently initializing.
Property Value
Gets the enumeration of IEdge instances whose ports have been locked at source and target end.
Remarks
Property Value
See Also
Gets or sets a value indicating whether ports are allowed to be moved at all.
Remarks
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
Gets or sets a provider that provides the IOrthogonalEdgeHelper instance associated with a given edge.
Remarks
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.
Signature Details
function(arg: IEdge) : IOrthogonalEdgeHelper
TResult
parameter.Parameters
- arg - IEdge
- The parameter of the method that this delegate encapsulates.
Returns
- IOrthogonalEdgeHelper
- The return value of the method that this delegate encapsulates.
See Also
Gets the enumeration of IPortOwner instances that are being transformed during the edit.
Remarks
Property Value
See Also
Methods
Registers the provided bend with this instance so that it will be considered explicitly moved for this edit.
Remarks
Parameters
A map of options to pass to the method.
- movementInfo - MovementInfo
- The movement info that describes the movement of the bend.
Registers the provided bend as being moved implicitly for this edit.
Remarks
Parameters
A map of options to pass to the method.
- movementInfo - MovementInfo
- The movement info for the bend.
Returns
- ↪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.
Remarks
Parameters
A map of options to pass to the method.
- movementInfo - MovementInfo
- sourceEnd - boolean
true
if themovementInfo
represents 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.
Remarks
Parameters
A map of options to pass to the method.
- 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.
Remarks
Parameters
A map of options to pass to the method.
- owner - IPortOwner
- The item that will be transformed.
Called by client edit code when a drag has been canceled.
Remarks
false
. Also temporarily added bends are removed and cleaned-up will be triggered.Performs cleanup procedures.
Remarks
Cleans up the edge's path after a successfully finished drag.
Remarks
Parameters
A map of options to pass to the method.
See Also
Called after a successfully finished drag to clean up artifacts of modified edges.
createImplicitlyMovedBendInfo
(bend: IBend, horizontalAdjacentInfo: MovementInfo, verticalAdjacentInfo: MovementInfo) : MovementInfoCreates or obtains a previously created MovementInfo for the provided implicitly moved bend.
Remarks
Parameters
A map of options to pass to the method.
- 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
.
Returns
- ↪MovementInfo?
- The info to be used by clients that requested it.
Called when a drag has been successfully finished.
Needs to be called by client editing code after initializeDrag has been called and all IDragHandlers have been initialized.
Remarks
Gets the MovementInfos that describe the orthogonal path of the edge.
Parameters
A map of options to pass to the method.
- edge - IEdge
- The edge to obtain the infos for.
Returns
- ↪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.
Remarks
Parameters
A map of options to pass to the method.
- edge - IEdge
- The edge to determine the orientation of the segment.
- segmentIndex - number
- Index of the segment.
Returns
- ↪SegmentOrientation
- The orientation of the segment.
Determines whether for the current input mode context there could be any orthogonally edited edge.
Remarks
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The context to check.
Returns
- ↪boolean
- Whether any of the edges in the context are orthogonal.
Called by client code when a drag is about to be started.
Remarks
Parameters
A map of options to pass to the method.
- 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.
Remarks
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
A map of options to pass to the method.
- 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.
Returns
- ↪boolean
true
if this edge should be orthogonally edited for the specified input mode context;false
otherwise.
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.
Remarks
Parameters
A map of options to pass to the method.
- edge - IEdge
- The edge to lock the ports of.
See Also
Raises the cleaned-up event.
Parameters
A map of options to pass to the method.
- evt - InputModeEventArgs
- The InputModeEventArgs instance containing the event data.
Raises the initialized event.
Parameters
A map of options to pass to the method.
- evt - InputModeEventArgs
- The InputModeEventArgs instance containing the event data.
See Also
Raises the initializing event.
Parameters
A map of options to pass to the method.
- evt - InputModeEventArgs
- The InputModeEventArgs instance containing the event data.
See Also
Called during dragInitialized to prepare the edge paths for orthogonal editing.
Parameters
A map of options to pass to the method.
- graph - IGraph
- The graph that contains the edges to be edited.
See Also
prepareOrthogonalEdge
(graph: IGraph, edge: IEdge, orientations: IListEnumerable<SegmentOrientation>, infos: IListEnumerable<MovementInfo>)Helper method that inspects and prepares an orthogonal edge for the upcoming edit process.
Remarks
Parameters
A map of options to pass to the method.
- 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) andnull
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.
Remarks
Parameters
A map of options to pass to the method.
- bend - IBend
- The bend that has been added to guarantee orthogonality.
Removes previously registered added bends.
Parameters
A map of options to pass to the method.
- 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.
Remarks
Parameters
A map of options to pass to the method.
- 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.
Returns
- ↪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
Events
Occurs when the recent edit operation has been cleaned up.
Occurs when the edit has been initialized.
Occurs when the edit is about to be initialized.
Static Methods
createOrthogonalEdgeDragHandler
(context: IInputModeContext, portOwner: IPortOwner, linearPortMovement: boolean) : OrthogonalEdgeDragHandlerCreates an OrthogonalEdgeDragHandler that keeps the orthogonal edges attached to portOwner
orthogonal while the port owner is moved or reshaped interactively.
Remarks
If no enabled OrthogonalEdgeEditingContext can be found in the lookup of the context
, null
is returned.
In each move/reshape step, handleMove has to be called. When the gesture is canceled or finished, cancelDrag or finishDrag has to be called.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The input mode context which is editing the node.
- portOwner - IPortOwner
- The port owner that is moved or reshaped.
- linearPortMovement - boolean
true
if ports on the owner move linear with the mouse movement,false
otherwise.
Returns
- ↪OrthogonalEdgeDragHandler?
- An OrthogonalEdgeDragHandler for the port owner or
null
if no enabled OrthogonalEdgeEditingContext was found.