link.target()
Return a shallow copy of the target
property of the link.
If the ending of the link is connected to an element, an object in the format { id: elementID }
is returned. If the ending of the link is specified as a point instead (the link is pinned
to the paper at that point), an object in the format { x: targetX, y: targetY }
is returned. Furthermore, any additional arguments of the target are returned alongside those properties.
If you need to be sure that an Element is returned (and not a Point), use the link.getTargetElement
function instead.
link.target(target [, opt])
Set the target
of the link.
If the link is to be connected to an element, send an object in the format { id: element.id }
(or a joint.dia.Element
object). If the link is to be pinned to the paper, send an object in the format { x: targetX, y: targetY }
(or a g.Point
object).
link.target(rect);
link.target({ id: rect.id });
link.target(new g.Point(100, 100));
link.target({ x: 100, y: 100 });
Additional options may by provided to further specify the behavior of link at the target:
link.target(rect, {
selector: 'body',
anchor: {
name: 'bottomLeft',
args: {
dx: 20,
dy: -10
}
}
});
More information can be found in dia.Link
documentation.