Class: Cell

Cell()

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

Cell(_sketch, _checkTint, _rowNo, _colNo, _nosRow, _nosCol, _gridX, _gridY, _gridWidth, _gridHeight)

new Cell(_sketch, _checkTint, _rowNo, _colNo, _nosRow, _nosCol, _gridX, _gridY, _gridWidth, _gridHeight)

Creates a Cell.

Parameters:
Name Type Description
_sketch Object

The sketch object to be used.

_checkTint Boolean

Handles the black or white of keyboard notes.

_rowNo Number

The row number of the cell.

_colNo Number

The column number of the cell.

_nosRow Number

The number of rows in the grid.

_nosCol Number

The number of columns in the grid.

_gridX Number

The x coordinate of the grid.

_gridY Number

The y coordinate of the grid.

_gridWidth Number

The width of the grid.

_gridHeight Number

The height of the grid.

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