Default implementation of the IOrthogonalEdgeHelper.
Implements
- I
Remarks
This class inspects the edge it was queried for and infers the SegmentOrientations of the segments from the current geometry of the edge path.
Examples
graph.decorator.edges.orthogonalEdgeHelper.addFactory(
(edge) =>
new OrthogonalEdgeHelper({
edge,
implicitlyMoveEnds: true,
}),
)See Also
Developer's Guide
Members
Show:
Constructors
Creates a new instance with optional static default return values for shouldEditOrthogonally and shouldMoveEndImplicitly.
Creates a new instance with optional static default return values for shouldEditOrthogonally and shouldMoveEndImplicitly.
Parameters
- edge: IEdge
- The edge to inspect.
- orthogonalEditing?: boolean
- The static default return value of shouldEditOrthogonally.
true - implicitlyMoveEnds?: boolean
Properties
Gets the edge this helper was created for.
Gets the edge this helper was created for.
protectedreadonlyfinal
Methods
Returns whether the given bend can be removed.
Returns whether the given bend can be removed.
This implementation always returns
true.protected
Parameters
- context: IInputModeContext
- The input mode context.
- bend: IBend
- The bend that is designated for removal.
Return Value
- boolean
trueif the specified bend can be removed; otherwise,false.
Invoked after the edge has been edited orthogonally.
Invoked after the edge has been edited orthogonally.
The default implementation in this class removes duplicate and collinear bends, as well as segments of zero length.
Parameters
- context: IInputModeContext
- The input mode context which edited the edge.
- graph: IGraph
- The graph to use for modifying the edge instance.
Implements
IOrthogonalEdgeHelper.cleanUpEdgeGets the orientation of the given segment by looking at the geometry of the segment.
Gets the orientation of the given segment by looking at the geometry of the segment.
If the segment has a zero length, the adjacent segments will be inspected to infer the orientation such that the orientation toggles between VERTICAL and HORIZONTAL.
Parameters
- context: IInputModeContext
- The input mode context in which the orientation is needed.
- segmentIndex: number
- The index of the segment.
Return Value
- SegmentOrientation
- The declared orientation of the segment.
Determines whether the provided edge should be edited orthogonally in the specified input mode context.
Determines whether the provided edge should be edited orthogonally in the specified input mode context.
If this method returns false, the other methods will not be queried at all.
The default implementation in this class always returns true.
Parameters
- context: IInputModeContext
- The input mode context in which the edge is about to be edited.
Return Value
- boolean
trueif the edge should be orthogonally edited in the specified input mode context;falseotherwise.
Determines whether this end of the provided edge can be moved in the input mode context.
Determines whether this end of the provided edge can be moved in the input mode context.
This information is required to determine whether an edge's first or last segment needs to be split or the adjacent edge end can be moved along with the other end of the segment.
The default implementation in this class always returns false.
Parameters
- context: IInputModeContext
- The input mode context in which the segment is edited.
- sourceEnd: boolean
- if set to
truethe source end of the edge is queried, otherwise the target end.
Return Value
- boolean
trueif the end of the edge can be moved for the specified input mode context;falseotherwise, in which case the corresponding segment needs to be split to keep the segment orientation orthogonal.