Word

Word

new Word(text, idx)

Creates a new Word instance

Parameters:
Name Type Description
text String

The raw text for this Word

idx Number

The index of this Word within the currently-parsed document

Source:

Members

boxWidth

Returns the width of the bounding box for this Word and its WordTags.

Source:

minWidth

Returns the minimum width needed to hold this Word and its WordTags. Differs from boxWidth in that it will also reserve space for the Word's WordClusters if necessary (even though the WordClusters are not technically part of the Word's box)

Source:

boxHeight

Returns the extent of the bounding box for this Word above the Row's line

Source:

descendHeight

Returns the extent of the bounding box for this Word below the Row's line

Source:

absoluteY

Returns the absolute y-position of the top of this Word's bounding box

Source:

absoluteDescent

Returns the absolute y-position of the bottom of this Word's bounding box

Source:

cx

Returns the absolute x-position of the centre of this Word's box

Source:

textWidth

Returns the width of the bounding box of the Word's SVG text element

Source:

textHeight

Returns the height of the bounding box of the Word's SVG text element

Source:

textRcx

Returns the relative x-position of the centre of the bounding box of the Word's SVG text element

Source:

isPunct

Returns true if this Word contains a single punctuation character

FIXME: doesn't handle fancier unicode punctuation | should exclude left-punctuation e.g. left-paren or left-quote

Source:

Methods

addEventId(id)

Any event IDs (essentially arbitrary labels) that this Word is associated with

Parameters:
Name Type Description
id
Source:

registerTag(category, tag)

Register a tag for this word under the given category. At run-time, one category of tags can be shown above this Word and another can be shown below it.

Parameters:
Name Type Default Description
category String default
tag String
Source:

getTagCategories()

Returns all the unique tag categories currently registered for this Word

Source:

setTopTagCategory(category)

Sets the top tag category for this Word, redrawing it if it is initialised

Parameters:
Name Type Description
category String
Source:

setBottomTagCategory(category)

Sets the bottom tag category for this Word, redrawing it if it is initialised

Parameters:
Name Type Description
category String
Source:

init(main)

Initialises the SVG elements related to this Word, and performs an initial draw of it and its WordTags. The Word will be drawn in the top left corner of the canvas, but will be properly positioned when added to a Row.

Parameters:
Name Type Description
main

The main API instance

Source:

Redraw Links

Source:

redrawClusters()

Redraw all clusters (they should always be visible)

Source:

move(x)

Sets the base x-position of this Word and its attendant SVG elements (including its WordTags)

Parameters:
Name Type Description
x
Source:

dx(x)

Moves the base x-position of this Word and its attendant SVG elements by the given amount

Parameters:
Name Type Description
x
Source:

alignBox()

Aligns the elements of this Word and any attendant WordTags such that the entire Word's bounding box has an x-value of 0, and an x2-value equal to its width

Source:

drawBbox()

Draws the outline of this component's bounding box

Source:

drawTextBbox()

Draws the outline of the text element's bounding box

Source: