ClockGrid

widgets. ClockGrid

Specifies the locations of the all clocks (both on and off). Draws the clock faces for all active clocks.

Constructor

new ClockGrid(parent, face_canvas, hand_canvas, keygrid, target_layout, key_chars, main_chars, n_pred)

Source:
Properties:
Name Type Description
clock_radius number

The common radius for all clocks in pixels. Determined by available screen space.

clocks Array.<Clock>

An array containing the Clock class attributes for all the clocks on the screen.

undo_label Label

The label positioned under the Undo clock that shows what text/action would be undone.

Parameters:
Name Type Description
parent Keyboard

The main Keyboard instance.

face_canvas KeyboardCanvas

The KeyboardCanvas instance used to draw the clock faces.

hand_canvas KeyboardCanvas

The KeyboardCanvas instance used to draw the clock hands.

keygrid KeyGrid

The instance of the KeyGrid class.

target_layout Array.<Array.<String>>

A 2D array specifying the relative locations of the keyboard keys.

key_chars Array.<String>

An array of all keys (including characters and corrective options).

main_chars Array.<String>

An array of characters that can have word predictions from the Language model.

n_pred number

The max number of word predictions to display per main_character.

Methods

generate_layout()

Description:
  • calculates the position and size of all clocks. Needs to be recalled on any window resizing event.

Source:

generate_main_clock_layout(x_start, y_start, x_end, y_end, text)

Description:
  • helper function to calculate the relative position of a main character clock

Source:
Parameters:
Name Type Description
x_start number

the starting x position in pixels of the corresponding KeyGrid bounding box.

y_start number

the starting y position in pixels of the corresponding KeyGrid bounding box.

x_end number

the ending x position in pixels of the corresponding KeyGrid bounding box.

y_end number

the ending y position in pixels of the corresponding KeyGrid bounding box.

text string

the textual component of the clock, i.e. "a"

generate_word_clock_layout(x_start, y_start, x_end, y_end)

Description:
  • helper function to calculate the relative positions of the word clocks for a main character. Genreates n_pred clock faces.

Source:
Parameters:
Name Type Description
x_start number

the starting x position in pixels of the corresponding KeyGrid bounding box.

y_start number

the starting y position in pixels of the corresponding KeyGrid bounding box.

x_end number

the ending x position in pixels of the corresponding KeyGrid bounding box.

y_end number

the ending y position in pixels of the corresponding KeyGrid bounding box.

update_word_clocks(words)

Description:
  • Updates the text strings for all word completion clocks.

Source:
Parameters:
Name Type Description
words Array.<String>

An array of the current word predictions for each clock.