RowManager

RowManager

new RowManager(svg, config)

Instantiate a RowManager for some TAG instance

Parameters:
Name Type Description
svg

The svg.js API object for the current TAG instance

config

The Config object for the instance

Source:

Members

lastRow

Returns the last Row managed by the RowManager

Source:

rows

Returns the RowManager's internal Row array

Source:

Methods

resizeAll()

Resizes all the Rows in the visualisation, making sure that they all fit the parent container and that none of the Rows/Words overlap

Source:

resizeRow()

Attempts to adjust the height of the Row with index i by the specified dy. If successful, also adjusts the positions of all the Rows that follow it accordingly.

If called without a dy, simply ensures that the Row's height is at least as large as its minimum height.

Source:

width(rw)

Sets the width of all the Rows in the visualisation

Parameters:
Name Type Description
rw Number

The new Row width

Source:

fitWords()

Makes sure that all Words fit nicely on their Rows without overlaps. Runs through all the Words on all the Rows in order; the moment one is found that overlaps with a neighbour, a recursive move is initiated.

Source:

appendRow()

Adds a new Row to the bottom of the svg and sets the height of the main document to match

Source:

removeLastRow()

remove last row at the bottom of the svg and resize to match

Source:

addWordToRow(word, row, i, forceX)

Adds the given Word to the given Row at the given index. Optionally attempts to force an x-position for the Word, which will also adjust the x-positions of any Words with higher indices on this Row.

Parameters:
Name Type Description
word
row
i
forceX
Source:

moveWordRight()

Recursively attempts to move the Word at the given index on the given Row rightwards. If it runs out of space, moves all other Words right or to the next Row as needed.

Parameters:
Name Type Description
params.row Row
params.wordIndex Number
params.dx Number

A positive number specifying how far to the right we should move the Word

Source:

moveWordLeft() → {Boolean}

Recursively attempts to move the Word at the given index on the given Row leftwards. If it runs out of space, tries to move preceding Words leftwards or to the previous Row as needed.

Parameters:
Name Type Description
params.row Row
params.wordIndex Number
params.dx Number

A positive number specifying how far to the left we should try to move the Word

Source:

moveFirstWordUp(index)

Move the first Word on the Row with the given index up to the end of the previous Row

Parameters:
Name Type Description
index
Source:

moveLastWordDown(index)

Move the last Word on the Row with the given index down to the start of the next Row

Parameters:
Name Type Description
index
Source: