TextGridContent
Source: TextGridContent.js:43
This class encapsulates the content of TextGrid objects.
It implements methods to set and retrieve individual characters on the grid, and parsing of
XML objects. It also contains information about the optimal size and other graphic properties
(fonts, colors, etc.) of the grid.
Constructor
new TextGridContent(): TextGridContentTextGridContent constructor
Instance Methods
setProperties($xml: external:jQuery)
Loads the object settings from a specific JQuery XML element
Parameters
$xml(external:jQuery)
getAttributes(): object
Gets a object with the basic attributes needed to rebuild this instance excluding functions,
parent references, constants and also attributes retaining the default value.
The resulting object is commonly usued to serialize elements in JSON format.
Returns
object
setAttributes(
data: object | string,
): module:boxes/TextGridContent.TextGridContent
Reads the properties of this TextGridContent from a data object
Parameters
data(object | string) — The data object to be parsed, or just the text content
Returns
countWildChars(): number
Counts the number of wildcard characters present in this TextGrid
Returns
number
getNumChars(): number
Counts the total number of characters, including wildcard characters.
Returns
number
setCharAt(x: number, y: number, ch: string)
Sets the specified character as a content of the cell located at specific coordinates
Parameters
x(number) — The X coordinate of the celly(number) — The X coordinate of the cellch(string) — The character to be placed on the specified cell
Instance Fields
ncw: number
Grid columns
nch: number
Grid rows
w: number
Width of cells
h: number
Height of cells
border: boolean
Whether the cells must be surrounded by a border or not
style: module:boxes/BoxBase.BoxBase
The BoxBase object with visual settings of the text grid
text: Array.<string>
An array of String objects textning the chars of cells. One string per row, one character of
this string per cell.
wild: string
The letter used as wildcardtext
randomChars: string
A String with the chars to take as source when randomly filling empty cells