new Cell()
The Cell class makes small (rounded) rectangles that live inside an instance of the Grid class. They can be informational (members of the top-, bottom-, left-, or right-most rows/columns of the grid, acting as time or pitch labels), or they can be members of the inner grid, where musical events may be represented.
Methods
add_text(type, startVal, sf, mnns)
Adds text to the cell.
Parameters:
Name | Type | Description |
---|---|---|
type |
String | The type of text to be added. |
startVal |
Number | The starting value of the text. |
sf |
Number | The scaling factor of the text. |
mnns |
Array | An array of musical note numbers. |
draw(rd, highlight, mnns, topMnn)
Draw the cell based on the given render data and highlight flag.
Parameters:
Name | Type | Description |
---|---|---|
rd |
Object | Render data object that contains gridX, gridY, gridWidth, gridHeight, colNo and rowNo. |
highlight |
boolean | Whether to highlight the cell. |
mnns |
Array | Array of MIDI note numbers. |
topMnn |
number | Top MIDI note number. |
set_background(str)
Set the background of the cell
Parameters:
Name | Type | Description |
---|---|---|
str |
string | The type of background to set. Either "highlight" or anything else. |
touch_check() → {Object}
Check if mouse touch is inside the cell.
Returns:
An object containing the row number and column number of the cell if the mouse touch is inside the cell, otherwise undefined.
- Type
- Object