Connection strategies come into play when the user modifies the position of link endpoints. There are two situations in which this is relevant:
anchor
property that might have been assigned on the dragged link endpoint will be overridden by the connection strategy. If necessary, have a look at the custom connectionStrategy documentation for information on replicating the functionality of anchor functions.)Both the anchor
and connectionPoint
properties are rewritten in response to user interaction. None of the built-in connection strategies preserve the originally assigned anchor and connection point functions. To assign precisely what you need as the anchor and connection point functions, you may need to define your own custom connection strategy.
Connection strategies are not assigned on a link-by-link basis. They are set with the connectionStrategy
option on a paper.
There are three built-in connection strategies in JointJS:
useDefaults
- default strategy; ignore user pointer and use default anchor and connectionPoint functionspinAbsolute
- use user pointer coordinates to position anchor absolutely within end element; use default connectionPointpinRelative
- use user pointer coordinates to position anchor relatively within end element; use default connectionPointThe default connection strategy is specified as null
in paper settings, which is equivalent to joint.connectionStrategies.useDefaults
.
joint.connectionStrategies
namespace. Example:
paper.options.connectionStrategy = joint.connectionStrategies.pinAbsolute;