OutputCanvas

widgets. OutputCanvas

Wrapper class for the canvas elements that display the output elements (textbox and histogram).

Constructor

new OutputCanvas(canvas_id, y_offset)

Source:
Properties:
Name Type Description
ctx CanvasRenderingContext2D

The 2D rendering context for the drawing surface of the <canvas> element. It is used for drawing shapes, text, images, and other objects.

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: resolution_factor=2 would double the number of horizontal and vertical pixels.

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 canvas element defined in the main HTML page.

y_offset number

The number of pixels to shift the canvas down from the top of the window. Equal to the location of the bottom of the bounding-box for the keyboard canvases.

Methods

calculate_size(y_offset)

Description:
  • Calculates the size of the output box 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 Description
y_offset number

The number of pixels to shift the canvas down from the top of the window. Equal to the location of the bottom of the bounding-box for the keyboard canvases.