Constructor
new WordCluster(words, val)
Creates a new WordCluster instance
Parameters:
Name | Type | Description |
---|---|---|
words |
Array.<Word>
|
An array of the Words that this cluster will cover |
val |
String
|
The raw text for this cluster's label |
- Source:
Members
endpoints
Returns an array of the first and last Words covered by this WordCluster
- Source:
absoluteY
Returns the absolute y-position of the top of the WordCluster's label (for positioning Links that point at it)
- Source:
fullHeight
Returns the height of this WordCluster, from Row baseline to the top of its label
- Source:
cx
Returns the x-position of the centre of this WordCluster's label
- Source:
textWidth
Returns the width of the bounding box of the WordTag's SVG text element
- Source:
Methods
addEventId(id)
Any event IDs (essentially arbitrary labels) that this WordCluster is associated with
Parameters:
Name | Type | Description |
---|---|---|
id |
- Source:
text(val) → {*}
Sets the text of this WordCluster, or returns this WordCluster's SVG text element
Parameters:
Name | Type | Description |
---|---|---|
val |
- Source:
init(word, main)
Initialise this WordCluster against the main API instance. Will be called once each by every Word within this cluster's coverage, but we are really only interested in the first Word and the last Word
Parameters:
Name | Type | Description |
---|---|---|
word |
Word
|
A Word within this cluster's coverage. |
main |
- Source:
draw()
Draws in the SVG elements for this WordCluster https://codepen.io/explosion/pen/YGApwd
- Source:
getBaseY(row)
Calculates what the absolute y-value for the base of this cluster's curly brace should be if it were drawn on the given Row
Parameters:
Name | Type | Description |
---|---|---|
row |
- Source:
drawBbox()
Draws the outline of this component's bounding box
- Source:
drawTextBbox()
Draws the outline of the text element's bounding box
- Source: