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-editor
- yfiles-umd modules
- view-editor, view-table, view
- Legacy UMD name
- yfiles.input.OrthogonalEdgeEditingContext
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.
Properties
Gets the previously registered added bends.
Gets the current input mode context that is in effect for the current edit.
Gets or sets a value indicating whether orthogonal edge editing is enabled at all.
Remarks
true
.See Also
Gets or sets whether the context is initialized.
Remarks
Gets the enumeration of IEdge instances whose ports have been locked at source and target end.
Remarks
See Also
Gets or sets a value indicating ports are allowed to be moved at all.
Remarks
true
.See Also
Gets the enumeration of IPortOwner instances that are being transformed during the edit.
Remarks
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 CleanedUp will be triggered.Performs clean up 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 movement infos 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 be
null
values if nothing is known about the bend, yet.
Gets the IOrthogonalEdgeHelper instance associated with the given edge.
Remarks
Parameters
A map of options to pass to the method.
- edge - IEdge
- The edge to obtain the helper instance for.
Returns
- ↪IOrthogonalEdgeHelper
- The helper instance to use or
null
, in which case the default behavior will be used.
See Also
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.
Called by client code when a drag is started 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 determines whether the given edge is orthogonally edited edge in the specified input mode context.
Remarks
false
if it is disabled. Otherwise getOrthogonalEdgeHelper will be used to delegate the query to shouldEditOrthogonally.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.
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 CleanedUp 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 determines 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.
See Also
Event Registration
addCleanedUpListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeCleanedUpListener(function(this, InputModeEventArgs):void)
Signature Details
function(sender: this, evt: InputModeEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - InputModeEventArgs
- An object that contains the event data.
Occurs when the edit has been initialized.
See Also
Event Registration
addInitializedListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeInitializedListener(function(this, InputModeEventArgs):void)
Signature Details
function(sender: this, evt: InputModeEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - InputModeEventArgs
- An object that contains the event data.
Occurs when the edit is about to be initialized.
See Also
Event Registration
addInitializingListener(function(this, InputModeEventArgs):void)
Event Deregistration
removeInitializingListener(function(this, InputModeEventArgs):void)
Signature Details
function(sender: this, evt: InputModeEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - InputModeEventArgs
- An object that contains the event data.
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.