API Docs for: 2.0.0

Class SAGE2_UI

Class defined in: public/src/SAGE2_UI.js:16

Web user interface

activateSpeechDebug( )
public/src/SAGE2_Speech.js:274

Makes the speech debug text visible.

clearContextMenu( )
public/src/SAGE2_UI.js:2516

Removes all entries from context menu.

Number createFileList( list, type, parent )
public/src/SAGE2_UI.js:852

Create a list of element, returns the longest one

Parameters:
  • list <Event>

    list of files

  • type <Event>

    type of list

  • parent <Event>

    add elements to parent


Returns: <Number>

return the longest elememt

String dateToYYYYMMDDHHMMSS( date )
public/src/SAGE2_UI.js:2422

Format a date into a string

Parameters:
Returns: <String>

formatted string

doesTranscriptActivateLocally( )
public/src/SAGE2_Speech.js:226

Check if transcript is a local speech command.

drawListeningVisual( )
public/src/SAGE2_Speech.js:526

Animated the listening visual

enableMouseholdToStart( )
public/src/SAGE2_Speech.js:393

Starts the mouse hold recognition. If there has not been a 1st name mention. Restart listener. Show listening. Mark this as getting an automatic name mention.

escapeDialog( event )
public/src/SAGE2_UI.js:2213

Handler for closing a dialog box with ESC key

Parameters:
  • event <Event>

    event data

fileDragEnter( event )
public/src/SAGE2_UI.js:903

Start drag'n'drop

Parameters:
  • event <Event>

    event data

fileDragLeave( event )
public/src/SAGE2_UI.js:918

Detect drag leave event

Parameters:
  • event <Event>

    event data

fileDrop( event )
public/src/SAGE2_UI.js:933

Handler for file drop

Parameters:
  • event <Event>

    event data

fileUploadComplete( )
public/src/SAGE2_UI.js:1070

Triggered on file upload complete: redraw UI

fileUploadFromUI( )
public/src/SAGE2_UI.js:1088

Upload a file from the UI (not drag-and-drop)

fileUploadProgress( percent )
public/src/SAGE2_UI.js:1054

File upload progress callback

Parameters:
fileUploadStart( files )
public/src/SAGE2_UI.js:981

File upload start callback

Parameters:
  • files <Object>

    array-like that containing the file infos

forceClick( event )
public/src/SAGE2_UI.js:1918

Handler for force click event (safari)

Parameters:
  • event <Event>

    event data

getCSSProperty( cssFile, selector )
public/src/SAGE2_UI.js:798

Get a CSS value from a style sheet

Parameters:
  • cssFile <String>

    CSSS sheet

  • selector <String>

    item to search

handleClick( element )
public/src/SAGE2_UI.js:1251

Processing click

Parameters:
  • element <Element>

    DOM element triggering the click

handleDblClick( element )
public/src/SAGE2_UI.js:1882

Processing double click

Parameters:
  • element <Element>

    DOM element triggering the double click

hideAppContextMenuDiv( data )
public/src/SAGE2_UI.js:2525

Populates context menu. Called on initial right click with empty array for entriesToAdd Called again when appContextMenuContents packet is received. The call is given data.entries, data.app

Entries created will store their information within the div.

Parameters:
  • data <Object>
    • Object with properties described below.
    • x <Integer>
      • Location of original right click.
    • y <Integer>
      • Location of original right click.
    • entries <Array>
      • Array of objects describing each entry.
    • app <Array>
      • App id the menu is for.
hideAppContextMenuDiv( )
public/src/SAGE2_UI.js:2505

Hides context menu from the document. It only makes visibility hidden. So values are still there.

hideDialog( id )
public/src/SAGE2_UI.js:2351

Show a given dialog

Parameters:
hideSAGE2PointerOverlayNoMouse( )
public/src/SAGE2_UI.js:2377

Hide the touch mouse overlay

init( )
public/src/SAGE2_Speech.js:55

Intializes the speech recognition object.

initMouseholdToStart( )
public/src/SAGE2_Speech.js:344

Initializes by creating listeners to restart and enable sending if mouse is held down.

keyDown( event )
public/src/SAGE2_UI.js:2269

Handler for key down

Parameters:
  • event <Event>

    event data

keyPress( event )
public/src/SAGE2_UI.js:2293

Handler for key press

Parameters:
  • event <Event>

    event data

keyUp( event )
public/src/SAGE2_UI.js:2281

Handler for key up

Parameters:
  • event <Event>

    event data

listeningVisualInit( )
public/src/SAGE2_Speech.js:419

Creates and intializes the listening visual.

loadSelectedApplication( )
public/src/SAGE2_UI.js:2310

Start the selected application

loadSelectedFile( )
public/src/SAGE2_UI.js:2324

Open a selected file

mouseCheck( event )
public/src/SAGE2_UI.js:1197

First handler for mouse event: fiding out if device has a mouse

Parameters:
  • event <Event>

    event data

mouseMoveListener( e )
public/src/SAGE2_Speech.js:513

Updates position of mouse location to move the listening visual.

Parameters:
  • e <Object>
    • The mouse event, should be standard.
noBackspace( event )
public/src/SAGE2_UI.js:2226

Handler for detecting backspace outside the drawing area

Parameters:
  • event <Event>

    event data

openVoiceHelpPage( )
public/src/SAGE2_Speech.js:335

Will open a page containing the voice help.

String pad( n, width, z )
public/src/SAGE2_UI.js:2407

Pad a number to string

Parameters:
  • n <Number>

    input number

  • width <Number>

    maximum width

  • z <String>

    padding character, 0 by default


Returns: <String>

formatted string

pointerClick( event )
public/src/SAGE2_UI.js:1241

Handler for click event

Parameters:
  • event <Event>

    event data

pointerDblClick( event )
public/src/SAGE2_UI.js:1872

Handler for double click event

Parameters:
  • event <Event>

    event data

pointerMove( event )
public/src/SAGE2_UI.js:1156

Handler for mouse move

Parameters:
  • event <Event>

    event data

pointerPress( event )
public/src/SAGE2_UI.js:1105

Handler for mouse press

Parameters:
  • event <Event>

    event data

pointerRelease( event )
public/src/SAGE2_UI.js:1132

Handler for mouse up

Parameters:
  • event <Event>

    event data

pointerScroll( event )
public/src/SAGE2_UI.js:1905

Handler for pointer scroll event

Parameters:
  • event <Event>

    event data

preventDefault( event )
public/src/SAGE2_UI.js:886

Prevent default event processing on a event

Parameters:
  • event <Event>

    event data

reloadIfServerRunning( callback )
public/src/SAGE2_UI.js:2434

Reload the page if server reloads

Parameters:
resizeDialogs( )
public/src/SAGE2_UI.js:824

Resize window handling

resizeMenuUI( ratio )
public/src/SAGE2_UI.js:760

Resize menus

Parameters:
restartIfMouseStillDownAndNotTalking( )
public/src/SAGE2_Speech.js:698

Restarts the voice recognition if mouse is held down, after response speech is done.

SAGE2_init( )
public/src/SAGE2_UI.js:254

Entry point of the user interface

SAGE2_resize( ratio )
public/src/SAGE2_UI.js:733

Handler resizes

Parameters:
sagePointerDisabled( )
public/src/SAGE2_UI.js:2396

Hides the SAGE2 pointer dialog

sagePointerEnabled( )
public/src/SAGE2_UI.js:2386

Enable the SAGE2 pointer dialog

sayTheDate( )
public/src/SAGE2_Speech.js:300

UI will speak the date.

sayTheTime( )
public/src/SAGE2_Speech.js:284

UI will speak the time.

sendMessageMakeNote( )
public/src/SAGE2_UI.js:3258

This function is activated in 2 ways.

  1. User click the send button.
  2. User hits enter when making a note. This check is done in the noBackspace funciton. When activated will make the packet to launch app. Collects values from tags on page.
setListeningVisual( shouldShow )
public/src/SAGE2_Speech.js:574

Set whether or not to show the listening visual.

Parameters:
  • shouldShow <Boolean>
    • true to show, otherwise false.
setNameMarker( )
public/src/SAGE2_Speech.js:675

Activates after receiving from server what the name marker is. Only after receiving will it init the voice recognition.

setNoteToMakeMode( )
public/src/SAGE2_UI.js:3244

This sets the values of the note making button to make instead of save.

setupAppContextMenuDiv( )
public/src/SAGE2_UI.js:2456

After loading page will perform additional setup for the context menu. Mainly to do with javascript loading of variables for later use.

setupFocusHandlers( )
public/src/SAGE2_UI.js:221

setupFocusHandlers

showAppContextMenuDiv( x, y )
public/src/SAGE2_UI.js:2490

Sets context menu to visible and moves to coordinates. Called after setting the entries.

Parameters:
  • x <Integer>
    • x position.
  • y <Integer>
    • y position.
showDialog( id )
public/src/SAGE2_UI.js:2339

Show a given dialog

Parameters:
showSAGE2PointerOverlayNoMouse( )
public/src/SAGE2_UI.js:2368

Show the touch mouse overlay

speechSynthesisInit( )
public/src/SAGE2_Speech.js:586

Initialize speech synthesis

textToSpeech( whatToSay )
public/src/SAGE2_Speech.js:631

Will attempt to voice the given what to say.

Parameters:
  • whatToSay <String>
    • will attempt to say this.
toggleSAGE2_speech( )
public/src/SAGE2_Speech.js:212

Toggles speech recongition on / off.

toggleVoiceRecognition( )
public/src/SAGE2_Speech.js:653

Will toggle whether or not voice recognition starts for long click and hold.

touchEnd( event )
public/src/SAGE2_UI.js:2052

Handler for touch end event

Parameters:
  • event <Event>

    event data

touchMove( event )
public/src/SAGE2_UI.js:2117

Handler for touch move event

Parameters:
  • event <Event>

    event data

touchStart( event )
public/src/SAGE2_UI.js:1950

Handler for touch start event

Parameters:
  • event <Event>

    event data

uiDrawSendLineCommand( xDest, yDest, xPrev, yPrev )
public/src/SAGE2_UI.js:3592

When a user tries to draw on the doodle canavs, the events are converted to locations of where to place the line data. Previous location to current location. The client doesn't actually cause their canvas to update. The app sends a confirmation back which causes the canvas to update.

Parameters:
  • xDest <Number>
    • location on canvas for next point.
  • yDest <Number>
    • location on canvas for next point.
  • xPrev <Number>
    • previous location on canvas.
  • yPrev <Number>
    • previous location on canvas.
uiDrawSetCurrentStateAndShow( data )
public/src/SAGE2_UI.js:3666

This will be called from a wsio packet "sendDataToClient". Must clear out canvas, set state, show dialog. Should happen when a user chooses to edit an existing doodle. Their canvas needs to be set to the current state of the doodle before edits should be made. But, doodles can be made from images which have varying sizes. They must also be contained within view correctly.

Parameters:
  • data <Object>
    • object with properties below.
    • imageWidth <Object>
      • image resolution.
    • imageHeight <Object>
      • image resolution.
    • canvasImage <Object>
      • image as toDataURL().
    • clientDest <Object>
      • should be this client.
    • appId <Object>
      • app id this is for.
uiDrawZoneRemoveSelfAsClient( data )
public/src/SAGE2_UI.js:3718

Called when the user creates a new doodle, or closes the doodle dialog. This is necessary because the doodle canvas space is a shared draw space, if they do not remove themselves the app will continue to send updates even if they are not currently editing the app.

Parameters:
  • data <Object>
    • object with properties below.
    • imageWidth <Object>
      • image resolution.
    • imageHeight <Object>
      • image resolution.
    • canvasImage <Object>
      • image as toDataURL().
    • clientDest <Object>
      • should be this client.
    • appId <Object>
      • app id this is for.