documentationfor yFiles for HTML 2.6

Orthogonal Edge Editing

As described in the section Orthogonal Edge Editing, the orthogonal edge editing feature is disabled by default. You need to enable it first by setting an instance of OrthogonalEdgeEditingContext to GraphEditorInputMode’s orthogonalEdgeEditingContext property as demonstrated in this example.

The default OrthogonalEdgeEditingContext supports orthogonal edge creation as well as orthogonal bend removal (i.e. removing bends in a way that the edge stays orthogonal). Both features can be enabled or disabled independently by setting CreateEdgeInputMode.orthogonalEdgeCreation or GraphEditorInputMode.orthogonalBendRemoval to OrthogonalEdgeEditingPolicy.ALWAYS or NEVER, respectively.

The OrthogonalEdgeEditingContext can be disabled temporarily by setting enabled to false.

The movePorts property determines whether the source port (target port) should move along with the first (last) bend to retain orthogonality of the first (last) edge segment.

OrthogonalEdgeEditingContext dispatches a number of events at the start and end of the edge editing gesture:

Related events
Event Occurs at…​
Initializing…​ the start of the edge editing gesture before the context has been initialized.
Initialized…​ the start of the edge editing gesture after the context has been initialized.
CleanedUp…​ the end of the edge editing gesture after the context has been cleaned up.

OrthogonalEdgeEditingContext queries the lookup of each edge for an implementation of IOrthogonalEdgeHelper. This allows fine-grained control of orthogonal edge editing by decorating the lookup of each edge.

shouldEditOrthogonally(context: IInputModeContext, edge: IEdge): boolean
Returns whether the given edge should be edited orthogonally.
getSegmentOrientation(context: IInputModeContext, edge: IEdge, segmentIndex: number): SegmentOrientation
Returns the orientation of the given edge segment as specified in SegmentOrientation. One of HORIZONTAL, VERTICAL, or NON_ORTHOGONAL. The latter can also be returned for segments which should not be edited orthogonally.
shouldMoveEndImplicitly(context: IInputModeContext, edge: IEdge, sourceEnd: boolean): boolean
Returns whether this end of the provided edge can be moved in the input mode context. If false the orthogonality might be kept by splitting the first or last segment. Note that this method is only queried if OrthogonalEdgeEditingContext.movePorts is set to true.
cleanUpEdge(context: IInputModeContext, graph: IGraph, edge: IEdge): void
Called at the end of an editing gesture. Used to remove unused bends and finalize the gesture.

The source code of the Orthogonal Edge Editing Customization demo shows how to use different IOrthogonalEdgeHelper implementations to customize various aspects of orthogonal edge editing.