new Row(svg, config, idx, ry, rh)
Creates a new Row for holding Words.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
svg |
This Row's SVG group |
||
config |
Config~Config
|
The Config object for the parent TAG instance |
|
idx |
Number
|
0 |
The Row's index |
ry |
Number
|
0 |
The y-position of the Row's top edge |
rh |
Number
|
100 |
The Row's height |
- Source:
Members
baseline
Gets the y-position of the Row's baseline (where the draggable resize line is, and the baseline for all the Row's words)
- Source:
ry2
Returns the lower bound of the Row on the y-axis
- Source:
maxSlot
Returns the maximum slot occupied by Links related to Words on this Row. Considers positive slots, so only accounts for top Links.
- Source:
minSlot
Returns the minimum slot occupied by Links related to Words on this Row. Considers negative slots, so only accounts for bottom Links.
- Source:
wordHeight
Returns the maximum height above the baseline of the Word elements on the Row (accounting for their top WordTags and attached WordClusters, if present)
- Source:
wordDescent
Returns the maximum descent below the baseline of the Word elements on the Row (accounting for their bottom WordTags, if present)
- Source:
minHeight
Returns the minimum amount of height above the baseline needed to fit all this Row's Words, top WordTags and currently-visible top Links. Includes vertical Row padding.
- Source:
minDescent
Returns the minimum amount of descent below the baseline needed to fit all this Row's bottom WordTags and currently-visible bottom Links. Includes vertical Row padding.
- Source:
availableSpace
Returns the amount of space available at the end of this Row for adding new Words
- Source:
Methods
svgInit(mainSvg)
Initialises the SVG elements related to this Row, and performs an initial draw of the baseline/resize line
Parameters:
Name | Type | Description |
---|---|---|
mainSvg |
The main SVG document |
- Source:
remove() → {*}
Removes all elements related to this Row from the main SVG document
- Source:
dy(y)
Changes the y-position of this Row's upper bound by the given amount
Parameters:
Name | Type | Description |
---|---|---|
y |
- Source:
move(y)
Moves this Row's upper bound vertically to the given y-position
Parameters:
Name | Type | Description |
---|---|---|
y |
- Source:
height(rh)
Sets the height of this Row
Parameters:
Name | Type | Description |
---|---|---|
rh |
- Source:
width(rw)
Sets the width of this Row
Parameters:
Name | Type | Description |
---|---|---|
rw |
- Source:
addWord(word, index, forceX) → {number}
Adds the given Word to this Row at the given index, adjusting the x-positions of any Words with higher indices. Optionally, attempts to force an x-position for the Word. If adding the Word to the Row causes any existing Words to overflow its bounds, will return the index of the first Word that no longer fits.
Parameters:
Name | Type | Description |
---|---|---|
word |
||
index |
||
forceX |
- Source:
positionWord(word, newX) → {number}
Assumes that the given Word is already on this Row. Tries to move the Word to the given x-position, adjusting the x-positions of all the following Words on the Row as well. If this ends up pushing some Words off the Row, returns the index of the first Word that no longer fits.
Parameters:
Name | Type | Description |
---|---|---|
word |
||
newX |
- Source:
removeWord(word) → {Word}
Removes the specified Word from this Row, returning it for potential further operations.
Parameters:
Name | Type | Description |
---|---|---|
word |
- Source:
removeLastWord() → {Word}
Removes the last Word from this Row, returning it for potential further operations.
- Source:
redrawLinksAndClusters()
Redraws all the unique Links and WordClusters associated with all the Words in the row
- Source:
drawBbox()
Draws the outline of this component's bounding box
- Source: