Link$Typings extension

on

Properties

adjusting EnumValue
Gets or sets how the route is computed, including whether it uses the points of its old route to determine the new route. The value must be one of Link.None|None, Link.End|End, Link.Scale|Scale, or Link.Stretch|Stretch.
getter/setter pair
corner num
Gets or sets how rounded the corners are for adjacent line segments when the #curve is Link.None|None, Link.JumpGap|JumpGap, or Link.JumpOver|JumpOver and the two line segments are orthogonal to each other.
getter/setter pair
curve EnumValue
Gets or sets the way the path is generated from the route's points. The value must be one of Link.None|None, Link.Bezier|Bezier, Link.JumpGap|JumpGap, or Link.JumpOver|JumpOver.
getter/setter pair
curviness num
Gets or sets how far the control points are offset when the #curve is Link.Bezier|Bezier or when there are multiple links between the same two ports.
getter/setter pair
defaultFromPoint Point
(undocumented)
getter/setter pair
defaultToPoint Point
(undocumented)
getter/setter pair
firstPickIndex num
(undocumented)
getter/setter pair
fromEndSegmentLength num
Gets or sets the length of the first segment, when the computed "from spot" at the #fromPort is not Spot.None. The default value is NaN, meaning that the value actually comes from the GraphObject#fromEndSegmentLength property of the #fromPort. This value also limits how short the #fromShortLength may be drawn.
getter/setter pair
fromNode Node?
Gets or sets the Node that this link comes from. The #fromPortId specifies which port the link comes from. The default value is null -- this link is not coming from any node.
getter/setter pair
fromPort GraphObject?
This read-only property returns a GraphObject that is the "from" port that this link is connected from. The #fromNode provides the node that the link is coming from. The #fromPortId provides the identifier for which port this link is coming from; you can set that property in order to change the value of this property. This method may return null.
getter/setter pair
fromPortChanged ↔ void Function(Link, [GraphObject?, GraphObject?])?
Gets or sets the function that is called after this Link changes which Node or port it connects from. The first argument will be this Link. The second argument will be the old GraphObject port. The third argument will be the new GraphObject port.
getter/setter pair
fromPortId String
Gets or sets the identifier of the port that this link comes from. The default value is the empty string.
getter/setter pair
fromShortLength num
Gets or sets how far the end segment stops short of the actual port. Positive values are limited by the #fromEndSegmentLength or GraphObject#fromEndSegmentLength. Negative values cause the link to extend into the port. The default value is NaN -- the value actually comes from the GraphObject#fromShortLength property of the #fromPort.
getter/setter pair
fromSpot Spot
Gets or sets where this link should connect at the #fromPort. The default value is Spot.Default, meaning that the value actually comes from the GraphObject#fromSpot property of the #fromPort.
getter/setter pair
geometry Geometry
This read-only property returns the Geometry that is used by the #path, the link Shape based on the route points.
getter/setter pair
isAvoiding bool
(undocumented) This read-only property is true when the routing tries to be smart about not overlapping other parts.
getter/setter pair
This read-only property is true when this Link has any label Nodes, Nodes that are owned by this Link and are arranged along its path in the same manner as elements of the Link Panel.
getter/setter pair
isOrthogonal bool
This read-only property is true if #routing is a value that implies that the points of the route should be orthogonal, such that each point shares a common X or a common Y value with the immediately previous and next points. This property is completely dependent on the #routing property. Values of Link.Orthogonal and Link.AvoidsNodes causes this property to be true.
getter/setter pair
Gets or sets whether this Link is part of the tree for tree operations such as Node#findTreeChildrenNodes or Node#collapseTree.
getter/setter pair
key ↔ dynamic
This read-only property returns the Links's Model data key if it is in a Diagram and is backed by Model data. Otherwise this returns undefined.
getter/setter pair
labelNodes Iterator<Node>
This read-only property returns an iterator over the Nodes that act as labels on this Link. Setting Node#labeledLink to refer to this Link will add that Node to this collection.
getter/setter pair
lastPickIndex num
(undocumented)
getter/setter pair
midAngle num
This read-only property returns the angle of the path at the #midPoint.
getter/setter pair
midPoint Point
This read-only property returns the point at the middle of the path, in document coordinates.
getter/setter pair
path Shape?
This read-only property returns the main Shape representing the path of this Link.
getter/setter pair
points List<Point>
Gets or sets the List of Points in the route. All of the Points must be Point#isReal -- no NaN or infinite values -- and all of the points are in document coordinates. Although this list may be replaced by setting this property, one must not modify the contents of the List directly.
getter/setter pair
pointsCount num
This read-only property returns the number of points in the route.
getter/setter pair
relinkableFrom bool
Gets or sets whether the user may reconnect an existing link at the "from" end. This affects the behavior of the RelinkingTool.
getter/setter pair
relinkableTo bool
Gets or sets whether the user may reconnect an existing link at the "to" end. This affects the behavior of the RelinkingTool.
getter/setter pair
resegmentable bool
Gets or sets whether the user may change the number of segments in this Link, if the link has straight segments. This affects the behavior of the LinkReshapingTool when #curve is not Link.Bezier.
getter/setter pair
routeBounds Rect
This read-only property returns the bounds of the link geometry in document coordinates.
getter/setter pair
routing EnumValue
Gets or sets whether the link's path tries to avoid other nodes. The value must be one of Link.Normal|Normal, Link.Orthogonal|Orthogonal, or Link.AvoidsNodes|AvoidsNodes.
getter/setter pair
smoothness num
Gets or sets how far the control points are from the points of the route when #routing is Link.Orthogonal|Orthogonal and #curve is Link.Bezier|Bezier.
getter/setter pair
toEndSegmentLength num
Gets or sets the length of the last segment. The default value is NaN, meaning that the value actually comes from the GraphObject#toEndSegmentLength property of the #toPort. This value also limits how short the #toShortLength may be drawn.
getter/setter pair
toNode Node?
Gets or sets the Node that this link goes to. The #toPortId specifies which port the link goes to. The default value is null -- this link is not going to any node.
getter/setter pair
toPort GraphObject?
This read-only property returns a GraphObject that is the "to" port that this link is connected to. The #toNode provides the node that the link is going to. The #toPortId provides the identifier for which port this link is going to; you can set that property in order to change the value of this property. This method may return null.
getter/setter pair
toPortChanged ↔ void Function(Link, GraphObject, [GraphObject?])?
Gets or sets the function that is called after this Link changes which Node or port it connects to. The first argument will be this Link. The second argument will be the old GraphObject port. The third argument will be the new GraphObject port.
getter/setter pair
toPortId String
Gets or sets the identifier of the port that this link goes to. The default value is the empty string.
getter/setter pair
toShortLength num
Gets or sets how far the end segment stops short of the actual port. Positive values are limited by the #toEndSegmentLength or GraphObject#toEndSegmentLength. Negative values cause the link to extend into the port. The default value is NaN -- the value actually comes from the GraphObject#toShortLength property of the #toPort.
getter/setter pair
toSpot Spot
Gets or sets where this link should connect at the #toPort. The default value is Spot.Default, meaning that the value actually comes from the GraphObject#toSpot property of the #toPort.
getter/setter pair

Methods

addOrthoPoints(Point startFrom, num fromDir, Point endTo, num toDir, Node fromnode, Node tonode) → void
(undocumented) This method is called by #computePoints when the link is orthogonal and at least one port has a link spot that is not Spot#isNoSpot.
addPoint(Point p) → void
Add a point at the end of the route; this may only be called within an override of #computePoints. @param {Point} p The new point in document coordinates, which should not have infinite or NaN coordinate values, and which must not be modified afterwards. @see #getPoint @see #setPoint @see #insertPoint @see #removePoint @since 1.6
addPointAt(num x, num y) → void
(undocumented) Add a point at the end of the route; this may only be called within an override of #computePoints. @param {number} x The new X, which should not be infinite or NaN, in document coordinates. @param {number} y The new Y, which should not be infinite or NaN, in document coordinates.
(undocumented) Sort the Links between two ports and invalidate their routes. Only one of the Links in the bundle will get this method called -- it is undetermined which Link is chosen.
canRelinkFrom() bool
This predicate returns true if #relinkableFrom is true, if the layer's Layer#allowRelink is true, and if the diagram's Diagram#allowRelink is true.
canRelinkTo() bool
This predicate returns true if #relinkableTo is true, if the layer's Layer#allowRelink is true, and if the diagram's Diagram#allowRelink is true.
clearPoints() → void
Remove all of the points from this link's route; this may only be called within an override of #computePoints. @see #getPoint @see #setPoint @see #insertPoint @see #addPoint @see #removePoint @since 1.6
commitRoute() → void
(undocumented) Call this method after a call to #startRoute and calls to methods that modify the route.
computeAdjusting() EnumValue
Returns the #adjusting value, unless this Link's Diagram is animating and the routing is AvoidsNodes -- then it will return Link.End|End
computeCorner() num
(undocumented) Returns the #corner, if it's a non-negative number, or else 10.
computeCurve() EnumValue
Returns the #curve, unless this link is supposed to pretend to be curved, as with reflexive links.
computeCurviness() num
Returns the #curviness, if it's a number, or else a computed value based on how many links connect this pair of nodes/ports, by calling #computeSpacing on each link.
computeEndSegmentLength(Spot spot, bool from, [Node? node, GraphObject? port]) num
Get the length of the end segment in document coordinates, typically a short distance, in document units. For spot values that are Spot#isSide, this returns a computed value. Depending on the from argument, this will return #fromEndSegmentLength or #toEndSegmentLength. If the value is NaN, this will return the #fromPort's GraphObject#fromEndSegmentLength or the #toPort's GraphObject#toEndSegmentLength.
computeMidOrthoPosition(num fromX, num fromY, num toX, num toY, bool vertical) num
(undocumented) This method is called by #addOrthoPoints to determine the distance of the middle segment between the two ports.
computeOtherPoint(Node othernode, GraphObject otherport) Point
Find the approximate point of the other end of the link in document coordinates. This is useful when computing the connection point when there is no specific spot, to have an idea of which general direction the link should be going. By default this will return the center of the other port.
computePoints() bool
The code that constructs a new route by modifying the #points. It is only called by #updateRoute, when needed. All route points are always in document coordinates.
computeShortLength(bool from) num
(undocumented)
computeSpacing() num
Returns the expected spacing between this link and others that connect this link's fromPort and toPort. This calls #computeThickness and also takes any "mid label"'s breadth into account.
computeSpot(bool from, [GraphObject? port]) Spot
Get the Spot that describes how the end of the link should connect with the port. Depending on the from argument, this will return #fromSpot or #toSpot. If the value is Spot#isDefault, this will return the #fromPort's GraphObject#fromSpot or the #toPort's GraphObject#toSpot.
computeThickness() num
Returns the thickness of this link. By default it uses the strokeWidth of the main element, assuming it's a Shape. This is called by #computeSpacing.
findClosestSegment(Point p) num
Find the index of the segment that is closest to a given point. This assumes the route only has straight line segments. It ignores any jump-overs or jump-gaps. @param {Point} p the Point, in document coordinates. @return {number} int the index of the segment, from zero to the number of points minus 2.
findMidLabel() GraphObject?
(undocumented) Returns the first label that should be at the "middle" of the link, if there is any such label. Elements that have .isPanelMain === true are ignored, including the #path. Elements that have a GraphObject#segmentIndex set are ignored, such as arrowheads. If there are no label objects within the Link Panel, consider any #labelNodes whose segmentIndex has not been set. This could be overridden to return a different label than the first one, or to always return null. @expose @return {GraphObject}
getLinkDirection(Node? node, GraphObject? port, Point linkpoint, Spot spot, bool from, bool ortho, [Node? othernode, GraphObject? otherport]) num
Compute the direction in which a link should go from a given connection point. @expose @param {Node} node @param {GraphObject} port the GraphObject representing a port on the node. @param {Point} linkpoint the connection point, in document coordinates. @param {Spot} spot a Spot value describing where the link should connect. @param {boolean} from true if the link is coming out of the port; false if going to the port. @param {boolean} ortho whether the link should have orthogonal segments. @param {Node} othernode the node at the other end of the link. @param {GraphObject} otherport the GraphObject port at the other end of the link. @return {number} the absolute angle, in degrees. @since 1.2
getLinkPoint(Node? node, GraphObject port, Spot spot, bool from, bool ortho, Node? othernode, GraphObject otherport, [Point? result]) Point
Compute the point on a node/port in document coordinates at which the route of a link should end. @expose @param {Node} node @param {GraphObject} port the GraphObject representing a port on the node. @param {Spot} spot a Spot value describing where the link should connect. @param {boolean} from true if the link is coming out of the port; false if going to the port. @param {boolean} ortho whether the link should have orthogonal segments. @param {Node} othernode the node at the other end of the link. @param {GraphObject} otherport the GraphObject port at the other end of the link. @param {Point=} result an optional Point that is modified and returned; otherwise it allocates and returns a new Point @return {Point} in document coordinates. @since 1.2
getLinkPointFromPoint(Node? node, GraphObject? port, Point focus, Point p, bool from, [Point? result]) Point
Compute the intersection point in document coordinates for the edge of a particular port GraphObject, given a point, when no particular spot or side has been specified. @expose @param {Node} node @param {GraphObject} port the GraphObject representing a port on the node. @param {Point} focus the point in document coordinates to/from which the link should point, normally the center of the port. @param {Point} p often this point is far away from the node, to give a general direction, particularly an orthogonal one. @param {boolean} from true if the link is coming out of the port; false if going to the port. @param {Point=} result an optional Point that is modified and returned; otherwise it allocates and returns a new Point @return {Point} the point in document coordinates of the intersection point on the edge of the port. @since 1.2
getOtherNode(Node node) Node?
Given a Node, return the node at the other end of this link. @param {Node} node @return {Node} This may return the same node, if the link is reflexive.
getOtherPort(GraphObject port) GraphObject?
Given a GraphObject that is a "port", return the port at the other end of this link. @param {GraphObject} port @return {GraphObject} This may return the same object, if the link is reflexive.
getPoint(num i) Point
Gets a particular point of the route. @param {number} i int The zero-based index of the desired point. @return {Point} in document coordinates
hasCurviness() bool
Returns true if an extra or a different point is needed based on #curviness.
insertPoint(num i, Point p) → void
Insert a point at a particular position in the route, without replacing an existing point; this may only be called within an override of #computePoints. @param {number} i int The zero-based index of the new point. @param {Point} p The new point in document coordinates, which should not have infinite or NaN coordinate values, and which must not be modified afterwards. @see #getPoint @see #setPoint @see #addPoint @see #removePoint @since 1.6
insertPointAt(num i, num x, num y) → void
(undocumented) Insert a point at a particular position in the route, without replacing an existing point; this may only be called within an override of #computePoints. @param {number} i int The zero-based index of the new point. @param {number} x The new X, which should not be infinite or NaN, in document coordinates. @param {number} y The new Y, which should not be infinite or NaN, in document coordinates.
invalidateRoute() → void
Declare that the route (the #points) of this Link need to be recomputed soon. This causes #updateRoute to be called, which will call #computePoints to perform the actual determination of the route. @since 1.6
makeGeometry() Geometry
Produce a Geometry given the points of this route, depending on the value of #curve and #corner and perhaps other properties. The points of the Geometry are in local coordinates, whereas the #points of the link route are in document coordinates.
move(Point newpos, [bool? useLocation]) → void
Move this link to a new position. This also shifts all of the Points in the route accordingly. This also moves any #labelNodes. @param {Point} newpos a new Point in document coordinates. @param {boolean=} useLocation true if you want to set the #location instead of the position. False by default.
removePoint(num i) → void
Remove a particular point from the route; this may only be called within an override of #computePoints. @param {number} i int The zero-based index of the point to extract. @see #getPoint @see #setPoint @see #insertPoint @see #addPoint @see #clearPoints @since 1.6
rollbackRoute() → void
(undocumented) Call this method instead of #commitRoute if you need to cancel changes to the route.
setPoint(num i, Point p) → void
Sets a particular point of the route; this may only be called within an override of #computePoints. @param {number} i int The zero-based index of the desired point. @param {Point} p The new point in document coordinates, which should not have infinite or NaN coordinate values, and which must not be modified afterwards. @see #getPoint @see #insertPoint @see #addPoint @see #removePoint @since 1.6
setPointAt(num i, num x, num y) → void
(undocumented) Sets a particular point of the route; this may only be called within an override of #computePoints. @param {number} i int The zero-based index of the desired point. @param {number} x The new X, which should not be infinite or NaN, in document coordinates. @param {number} y The new Y, which should not be infinite or NaN, in document coordinates.
startRoute() → void
(undocumented) Allow calls to #setPoint, #addPoint, #insertPoint, #removePoint, and #clearPoints. You must call #commitRoute when you are done modifying the route.
updateRoute() → void
This method recomputes the route if the route is invalid, to make sure the #points are up-to-date. This method calls #computePoints in order to calculate a new route.