C

EdgePathCropper

The default implementation of the IEdgePathCropper interface.
ImplementsInheritance Hierarchy

Remarks

It has a property that determines whether the edge path is cropped at the port or at the node bounds and supports an optional extra length the edge is cropped.

See Also

API

INSTANCE

Demos

Customize where edges at the node are cropped

Members

Show:

Constructors

Parameters

Properties

Gets the value that determines if the edge path is cropped at the port or at the node bounds.
The default is false.
final
Gets or sets an extra length the edge is cropped.
The default value is 0.
final

Methods

Calculates the total length the edge path is cropped.
This method can be overridden to change the length that is cropped from an edge. The default implementation returns the sum of extraCropLength, arrow length, and arrow cropLength.
protected

Parameters

arrow: IArrow
The arrow at this edge end.
atSource: boolean
true if the crop length should be calculated at the edge source, false otherwise.

Return Value

number
The total length the edge path is cropped.

See Also

API
cropEdgePath, cropEdgePathAtArrow
Crops the provided path at one end of an edge.
If cropAtPort is true this implementation delegates to cropEdgePathAtPortGeometry. Otherwise, the edge path is cropped at the node geometry. If this results in an empty path, the cropping is delegated to handleEmptyPath instead.

Parameters

edge: IEdge
The edge whose path is to be cropped.
atSource: boolean
Whether to crop the source or target side of the path.
arrow: IArrow
The arrow that is used at the end of the edge.
path: GeneralPath
The path to crop.

Return Value

GeneralPath
The cropped path. This can be either the same instance of the given path or a newly created instance.
Crops an edge's path at the source or target side with respect to the given arrow.
The path is cropped by the length calculateTotalCropLength returns for arrow and atSource.

Parameters

atSource: boolean
if set to true the source side is cropped.
arrow: IArrow
The arrow to consider for the cropping.
path: GeneralPath
The edge's path to crop.

Return Value

GeneralPath
The cropped path. This can be either the same instance of the given path or a newly created instance.
Crops an edge's path at the source or target side at the port geometry with respect to the given arrow.
protected

Parameters

edge: IEdge
The edge whose path is to be cropped.
atSource: boolean
Whether to crop the source or target side of the path.
arrow: IArrow
The arrow that is used at the end of the edge.
path: GeneralPath
The path to crop.

Return Value

GeneralPath
The cropped path. This can be either the same instance of the given path or a newly created instance.
Finds the intersection between a node and the edge.
protected

Parameters

node: INode
The node whose geometry is tested for intersection.
nodeShapeGeometry: IShapeGeometry
The geometric representation of the node, or null if unavailable.
edge: IEdge
The edge to test for intersection.
inner: Point
A point inside the node used for intersection testing.
outer: Point
A point outside the node used for intersection testing.

Return Value

Point
The intersection point, or null if no intersection is found.
Returns the geometry that is used to crop the edge at the node outline.
The default implementation queries the node style renderer for an implementation of IShapeGeometry. This method can be overridden to return an arbitrary geometry for a node.
protected

Parameters

node: INode
The node the edge should be cropped at.

Return Value

IShapeGeometry
The geometry of the node.
Returns the geometry that is used to crop the edge at the port outline if cropAtPort is set to true.
The default implementation returns null. This method can be overridden to return an arbitrary geometry for a port.
protected

Parameters

port: IPort
The port the edge should be cropped at.

Return Value

IShapeGeometry
The geometry of the port.

See Also

API
cropAtPort
Handles the edge path cropping if cropEdgePath would result in a cleared path.

This method is called by cropEdgePath if cropAtPort is false and cropping the edge path at the node geometry would result in an empty path.

The default implementation is to clear the edge path.

protected

Parameters

edge: IEdge
The edge whose path is to be cropped.
atSource: boolean
Whether to crop the source or target side of the path.
arrow: IArrow
The arrow that is used at the end of the edge.
path: GeneralPath
The path to crop.

Return Value

GeneralPath
The cropped path. This can be either the same instance of the given path or a newly created instance.
Checks whether a given point is inside a node's shape geometry with respect to the edge that is being calculated.
protected

Parameters

location: Point
The location to test.
node: INode
The node to test the point against for inclusion.
nodeShapeGeometry: IShapeGeometry
The node's geometry.
edge: IEdge
The edge that is being calculated.

Return Value

boolean
Whether a given point is inside a node's shape.