A link anchor of a link is a point on the reference link that this link wants to reach as its endpoint. Link anchors are set via a linkAnchor
property provided within link end definitions (i.e. the objects provided to link.source()
and link.target()
functions). (If the reference object is an Element, JointJS looks at anchor
property instead.)
There are several built-in linkAnchor functions in JointJS:
'connectionRatio'
- default link anchor at specified ratio at reference link'connectionLength'
- link anchor at specified length along reference link'connectionPerpendicular'
- link anchor that ensures an orthogonal route to the reference link'connectionClosest'
- link anchor at the point on reference link that is closest to the last vertex on link pathExample:
link.source(link2, {
linkAnchor: {
name: 'connectionRatio',
args: {
ratio: 0.25
}
}
});
The default link anchor function is 'connectionRatio'
; this can be changed with the defaultLinkAnchor
paper option. Example:
paper.options.defaultLinkAnchor = {
name: 'connectionLength',
args: {
length: 20
}
};
JointJS also contains mechanisms to define one's own custom link anchor functions.