Anchors allow you to choose how an edge visually connects to the nodes it links.
There are a number of built-in anchor functions that can be composed to form more complicated anchoring strategies.
An anchor is a function that takes a node and an edge, and returns a function that is used to calculate the anchor point. That function takes the anchor point - the point that the function will manipulate and a reference point, which is used by the anchor function to determine where to locate the anchor.
thinkmap.display.edgestyle.linear(
thinkmap.display.anchor.percentage(0,0),
thinkmap.display.anchor.percentage(0,0)
)
thinkmap.display.edgestyle.linear(
thinkmap.display.anchor.eastWest(),
thinkmap.display.anchor.eastWest()
)
Returns an anchor function that calculates a point on the node's nearest SVGElement to a reference point.
This anchor is typically used to have an edge end right at a node's SVGElement as opposed to overlapping across the element. Because this anchor requires a lot of calculations of SVGElements and their bounding boxes, it should be used for more static layouts. Any layout requiring fast animations, should use an anchor such as eastWest, northSouth, or center.
If no intersection point is found, the node's center point is used.
This optional function allows more advanced calculations of what points are acceptable as intersection points. If this function returns true, then the given intersection point will be evaluated by the bounds anchor as a possible anchor point.
By default, this function returns true for all non 'g' SVGElements, meaning all 'g' elements will not be accepted as possible anchor points by the bounds anchor.
thinkmap.display.edgestyle.linear(
thinkmap.display.anchor.bounds(),
thinkmap.display.anchor.bounds(),
)
Create an anchor function that is based on the percentage of the bounding box.
thinkmap.display.edgestyle.linear()
.anchorFrom(thinkmap.display.anchor.percentage(0,0))
.anchorTo(thinkmap.display.anchor.percentage(0,0))