API Docs for: 2.0.0

Class RadialMenu

Class defined in: src/node-radialmenu.js:24

Class RadialMenu

ButtonWidget addRadialMenuButton( name, icon, iconScale, dim, alignment, radialAnglePos, radialLevel )
public/src/radialMenu.js:117

Helper function for creating radial menu buttons

Parameters:
  • name <String>

    name of the button

  • icon <Image>

    icon image for the button

  • iconScale <Float>

    scale factor for icon

  • dim <ButtonSize: float, hitboxSize: float>

    } object specifying the button display and hitbox size

  • alignment <String>

    where the center of the button is defined 'left' (default) or 'centered'

  • radialAnglePos <Float>

    position of the button along the radius. based on angleSeparation and initAngle

  • radialLevel <Float>

    radial level of button (0 = center, 1 = standard icons, 2 = secondary icons)


Returns: <ButtonWidget>

the ButtonWidget object created

bytesToReadableString( )
public/src/radialMenu.js:683

Converts bytes to human readable string

closeMenu( )
public/src/radialMenu.js:703

Closes the menu, sends close signal to server

ButtonWidget createRadialButton( icon, useBackgroundColor, buttonSize, hitboxSize, alignment, hitboxShape, radialPos, buttonRadius )
public/src/radialMenu.js:278

Helper function for creating a radial button (more generic than addRadialMenuButton)

Parameters:
  • icon <Image>

    icon image for the button

  • useBackgroundColor <Boolean>
  • buttonSize <Float>

    size of the button in pixels

  • hitboxSize <Float>

    size of the button hitbox in pixels

  • alignment <String>

    where the center of the button is defined "left" (default) or "centered"

  • hitboxShape <String>

    shape of the hitbox "box" or "circle"

  • radialPos <Float>

    position of the button along the radius. based on angleSeparation and initAngle

  • buttonRadius <Float>

    distance from the center of the menu


Returns: <ButtonWidget>

the ButtonWidget object created

createRadialButton( buttonID, state )
public/src/radialMenu.js:263

Sets the state of a radial menu button

Parameters:
draw( )
public/src/radialMenu.js:351

Draws the menu

drawImage( ctx, image, position, size, color, rotation, centered )
public/src/radialMenu.js:314

Helper function for drawing an image

Parameters:
  • ctx <Context>

    context to draw on

  • image <Image>

    image to draw

  • position <X: Float, y: Float>

    position to draw

  • size <X: Float, y: Float>

    width, height of image

  • color <Color>

    fill color to use

  • rotation <Float>

    rotation of the image (not currently used)

  • centered <Boolean>

    is the center of the image the origin for positioning

generateGeometry( interactMgr )
src/node-radialmenu.js:171

Adds geometry to the Interaction module

Parameters:
  • interactMgr <Object>

    Interaction manager

getInfo( )
src/node-radialmenu.js:218

Returns information on the radial menu's layout and position

getShortButtonName( longButtonName )
src/node-radialmenu.js:348

Gets the short name of a button given the long name

Parameters:
getThumbnailWindowPosition( )
src/node-radialmenu.js:461
init( data, thumbElem, thumbElem2 )
public/src/radialMenu.js:156

Initialization

Parameters:
  • data <id: this.pointerid, x: this.left, y: this.top, radialMenuSize: this.radialMenuSize,!~YUIDOC_LINE~! thumbnailWindowSize: this.thumbnailWindowSize, radialMenuScale: this.radialMenuScale,!~YUIDOC_LINE~! visble: this.visible>

    Radial menu info from node-radialMenu

  • thumbElem <Element>

    DOM element for the thumbnail content window

  • thumbElem2 <Element>

    DOM element for the metadata window (not currently implemented)

X: Float, y: Float isDragging( id, localPos )
src/node-radialmenu.js:604

Checks if an input ID is dragging the menu

Parameters:
  • id <Integer>

    input ID

  • localPos <X: Float, y: Float>

    input position


Returns: <X: Float, y: Float>

dragPos

isEventOnMenu( )
src/node-radialmenu.js:482
isThumbnailWindowOpen( )
src/node-radialmenu.js:359

Returns if the thumbnail window is currently open


Returns:

openState

loadApplication( data, user )
public/src/radialMenu.js:1004

Tells the server to start an application

Parameters:
  • data <Object>

    Application information like filename

  • user <Integer>

    userID

loadFileFromServer( data, user )
public/src/radialMenu.js:991

Tells the server to load a file

Parameters:
  • data <Object>

    Content information like type and filename

  • user <Integer>

    userID

moveMenu( data, offset )
public/src/radialMenu.js:784

Moves the radial menu based on master and server events

Parameters:
  • data <x: data.x, y: data.y, windowX: rect.left, windowY: rect.top>
                Contains the event position and the bounding rectangle
  • offset <x: this.offsetX, y: this.offsetY>

    Contains the display client offset

onButtonEvent( buttonID, pointerID )
src/node-radialmenu.js:238
Parameters:
Returns:

stateChange -1 = no change, 0 = now idle, 1 = now mouse over, 2 = now clicked

onEvent( type, position, user, data )
public/src/radialMenu.js:812

Processes events

Parameters:
  • type <String>

    i.e. "pointerPress", "pointerMove", "pointerRelease"

  • position <X: Float, y: Float>

    event position

  • user <Integer>

    userID

  • data <Button: "left/right", color: "#000000">
onMenuEvent( pointerID )
src/node-radialmenu.js:319
Parameters:
Returns:

stateChange

onStartDrag( id, localPos )
src/node-radialmenu.js:589

Initializes the radial menu's drag state

Parameters:
  • id <Integer>

    input ID initiating the drag

  • localPos <X: Float, y: Float>

    initial drag position

redraw( )
public/src/radialMenu.js:339

Forces a redraw of the menu

setMenu( )
public/src/radialMenu.js:746

Sets the content window

setState( stateData )
public/src/radialMenu.js:1324

Sets the state of the radial menu: buttons, content windows

Parameters:
  • stateData <Object>

    node-radialMenu.js getInfo()

setThumbnailPosition( thumbnailSourceList, imageThumbnailSize, thumbSpacer, maxRows, neededColumns )
public/src/radialMenu.js:1219

Helper function for arranging thumbnails

Parameters:
  • thumbnailSourceList <Object>

    List of thumbnails

  • imageThumbnailSize <Float>

    width of thumbnail in pixels

  • thumbSpacer <Float>

    space between thumbnails in pixels

  • maxRows <Integer>

    maximum thumbnails per row

  • neededColumns <Integer>

    calculated number of columns needed

setToggleMenu( )
public/src/radialMenu.js:718

Toggles the content window open/close

toggleSubRadialMenu( )
public/src/radialMenu.js:774

Toggles a subradial menu

updateFileList( serverFileList )
public/src/radialMenu.js:1017

Receives the current asset list from server

Parameters:
  • serverFileList <Object>

    Server file list

updateThumbnailPositions( )
public/src/radialMenu.js:1250

Recalculates the thumbnail positions