API Docs for: 2.0.0

Class SAGE2DisplayUI

Class defined in: public/src/SAGE2_DisplayUI.js:22

User interface drawn using Canvas2D

addAppWindow( data )
public/src/SAGE2_DisplayUI.js:377

Add an application with its icon and draw

Parameters:
  • data <Object>

    contains .icon image of the application

addPartitionBorder( data )
public/src/SAGE2_DisplayUI.js:497

Add ui element showing partition

Parameters:
  • data <Object>
    • contains partition information
deleteApp( id )
public/src/SAGE2_DisplayUI.js:625

Delete an application and draw

Parameters:
deletePartition( id )
public/src/SAGE2_DisplayUI.js:639

Delete a partition and draw

Parameters:
draw( )
public/src/SAGE2_DisplayUI.js:88

Draw the UI

drawRoundedRect( ctx, x, y, width, height, radius, fillFlag, strokeFlag )
public/src/SAGE2_DisplayUI.js:703

Draw a rounded rectangle

Parameters:
  • ctx <Object>

    canvas context

  • x <Number>

    position x

  • y <Number>

    position y

  • width <Number>

    width

  • height <Number>

    height

  • radius <Number>

    radius of corner

  • fillFlag <Bool>

    whether to fill or not

  • strokeFlag <Bool>

    whether to stroke or not

generateMediaStreamIcon( title, color )
public/src/SAGE2_DisplayUI.js:300

Generate an image icon for media stream apps

Parameters:
  • title <String>

    title of application

  • color <String>

    color for background of icon

highlightApplication( x, y )
public/src/SAGE2_DisplayUI.js:827

Highlight the top most application under the cursor

Parameters:
init( config, wsio )
public/src/SAGE2_DisplayUI.js:48

Initialize the object

Parameters:
  • config <Object>

    display configuration object

  • wsio <Object>

    WebsocktIO object

keyDown( keyCode )
public/src/SAGE2_DisplayUI.js:913

Handler for key down

Parameters:
  • keyCode <Number>

    character code

keyPress( charCode )
public/src/SAGE2_DisplayUI.js:950

Handler for key press

Parameters:
  • charCode <Number>

    character code

keyUp( keyCode )
public/src/SAGE2_DisplayUI.js:936

Handler for key up

Parameters:
  • keyCode <Number>

    character code

pointerDblClick( )
public/src/SAGE2_DisplayUI.js:904

Handler for double click

pointerMove( x, y )
public/src/SAGE2_DisplayUI.js:864

Handler for mouse move

Parameters:
pointerPress( btn )
public/src/SAGE2_DisplayUI.js:791

Handler for mouse up

Parameters:
  • btn <String>

    mouse button name (left, right, middle)

pointerRelease( btn )
public/src/SAGE2_DisplayUI.js:803

Handler for mouse up

Parameters:
  • btn <String>

    mouse button name (left, right, middle)

pointerScroll( value )
public/src/SAGE2_DisplayUI.js:882

Handler for scrolling

Parameters:
  • value <Number>

    scroll amount

resize( ratio )
public/src/SAGE2_DisplayUI.js:166

Callback when the browser is resize, adjust the position of UI elements

Parameters:
setItemPosition( position_data )
public/src/SAGE2_DisplayUI.js:557

Move an application and redraw

Parameters:
  • position_data <Object>

    oject with .elemId .elemLeft .elemTop .elemWidth .elemHeight fields

setItemPositionAndSize( position_data )
public/src/SAGE2_DisplayUI.js:573

Move and scale an application and redraw

Parameters:
  • position_data <Object>

    oject with .elemId .elemLeft .elemTop .elemWidth .elemHeight fields

setPartitionPositionAndSize( data )
public/src/SAGE2_DisplayUI.js:600

Move and scale a partition and redraw

Parameters:
  • data <Object>

    oject with .id .left .top .width .height fields

setUploadPercent( percent )
public/src/SAGE2_DisplayUI.js:367

Update the upload progress bar

Parameters:
  • percent <Number>

    progress [0.0 - 1.0]

textLineCount( ctx, text, maxWidth )
public/src/SAGE2_DisplayUI.js:736

Count the number of lines for a given maximum width

Parameters:
  • ctx <Object>

    canvas context

  • text <String>

    text to be drawn

  • maxWidth <Number>

    maximum width

updateItemOrder( order )
public/src/SAGE2_DisplayUI.js:541

Reorder the application list and draw

Parameters:
  • order <Object>

    contains the application ids and zIndex

wrapText( ctx, text, x, y, maxWidth, lineHeight )
public/src/SAGE2_DisplayUI.js:762

Draw some text, and wrap it over multiple lines if necessary

Parameters: