Constructor
new KeyboardCanvas(canvas_id, layer_index)
- Source:
Properties:
Name | Type | Description |
---|---|---|
ctx |
CanvasRenderingContext2D | The 2D rendering context for the drawing surface of the |
window_width |
number | The width of the window in pixels. |
window_height |
number | The height of the window in pixels. |
screen_fill_factor |
number | The fraction of the window to use to draw the keyboard (should be less than 1 to avoid overflow). |
resolution_factor |
number | The amount to increase the resolution (in pixels) of the canvas display.
For example: |
topbar_height |
number | The height in pixels of the top bar (containing the speed slider, buttons, check boxes). |
bottom_height_factor |
number | The fraction of available screen space to reserve for the output canvas (text box and histogram). |
screen_width |
number | The width of the canvas screen available for drawing in pixels. |
screen_height |
number | The height of the canvas screen available for drawing in pixels. |
Parameters:
Name | Type | Description |
---|---|---|
canvas_id |
string | The id for the |
layer_index |
number | The zIndex order for display of the canvas element. Higher-valued canvases are displayed on top of lower-valued ones. |
Methods
calculate_size(bottom_height_factor)
- Description:
Calculates the size of the keyboard based on the available screen space. Styles the canvas position and resolution. Needs to be recalled for each canvas upon any window resizing events.
- Source:
Parameters:
Name | Type | Default | Description |
---|---|---|---|
bottom_height_factor |
number |
0.2
|
The proportion of screen space to allocate for the output canvas on the bottom (the textbox and histogram). |
clear()
- Description:
Clears the content of the canvas, leaving it transparent.
- Source: