Link

Link

Creates a new Link between other entities. Links can have Words or other Links as argument anchors.

Parameters:
Name Type Default Description
eventId String

Unique ID

trigger Word

Text-bound entity that indicates the presence of this event

args Array.<Object>

The arguments to this Link. An Array of Objects specifying anchor and type

relType String

For (binary) relational Links, a String identifying the relationship type

top Boolean true

Whether or not this Link should be drawn above the text row (if false, it will be drawn below)

category String default

Links can be shown/hidden by category

Source:

Members

endpoints

Gets the left-most and right-most Word anchors that come under this Link. (Nested Links are treated as extensions of this Link, so the relevant endpoint of the nested Link is recursively found and used)

Source:

width

Returns the total horizontal width of the Link, from the leftmost handle to the rightmost handle

Source:

leftHandle

Returns the leftmost handle (smallest Row index, smallest x-position) in this Link

Source:

rightHandle

Returns the rightmost handle (largest Row index, largest x-position) in this Link

Source:

triggerHandle

Returns the handle corresponding to the trigger for this Link, if one is defined

Source:

Methods

init(main)

Initialises this Link against the main API instance

Parameters:
Name Type Description
main
Source:

toggle()

Toggles the visibility of this Link

Source:

show()

Enables this Link and draws it onto the visualisation

Source:

hide()

Disables this Link and removes it from the visualisation

Source:

showMainLabel()

Shows the main label for this Link

Source:

hideMainLabel()

Hides the main label for this Link

Source:

showArgLabels()

Shows the argument labels for this Link

Source:

hideArgLabels()

Hides the argument labels for this Link

Source:

draw(modAnchoropt)

(Re-)draw some Link onto the main visualisation

Parameters:
Name Type Attributes Description
modAnchor Word | WordCluster | Link <optional>

Passed when we know that (only) a specific anchor has changed position since the last redraw. If not, the positions of all handles will be recalculated.

Source:

remove()

Removes this Link's SVG elements from the visualisation, and removes all references to it from the data stores

Source:

getLineY(row)

Returns the y-position that this Link's main line will have if it were drawn in the given row (based on the Row's position, and this Link's slot)

Parameters:
Name Type Description
row Row
Source:

calculateSlot(words)

Given the full array of Words in the document, calculates this Link's slot based on other crossing/intervening/nested Links, recursively if necessary.

Principles:

  1. Links with no other Links intervening have priority for lowest slot
  2. Links with fully slotted intervening Links (i.e., no crossings) have second priority
  3. Crossed Links have lowest priority, and are handled in order from left to right and descending order of length (in terms of number of Words covered)

Sorting of the full Links array is handled by Util.sortForSlotting.

Parameters:
Name Type Description
words Array.<Word>
Source:

drawBbox()

Draws the outline of this component's bounding box

Source:

drawTextBbox()

Draws the outline of the text element's bounding box

Source: