Repository

Button

Extends:

Component → Button

Constructor Summary

Public Constructor
public

A Button is a special kind of 3D object that is clickable and that you can use to build Graphical User Interfaces (GUI).

Member Summary

Public Members
public
public
public

camera: *

public
public
public
public

cutOff: *

public
public
public

font: *

public

height: *

public
public

mesh: *

public
public
public
public
public
public
public
public

radius: *

public

root: *

public
public

state: *

public
public
public
public

text: *

public
public
public
public
public
public
public
public

vertex: *[]

public

width: *

Method Summary

Public Methods
public

adaptCorner(mode: String, corner: String)

Adapt a corner of the shape, for grouping buttons together

public

Can be used to simulate a pressed event when necessary (i.e.

public

off()

deactivate the button, set its opacity to 30 %

public

on()

Activate the button

public
Private Methods
private

Generate the vertices and meshes for the default button.

private

regenerate the geometry of the mesh for further update

Inherited Summary

From class Component
public
public
public

events: *

public

id: *

public

name: *

private

_nexts: *[]

private
public
public

chain(component: Component)

Adds a component to this chained component array

public

Returns the array of attached children components

public

off()

Deactivate the component

public

on()

Activate the component A call to this method calls the setup method if it has not been run yet

public

Run code after the update of all components is run This empty method is usually overriden to perform post-update actions for the component It is called periodically by an internal Mobilizing mechanism

public

preLoad the component This empty method is usually overriden to perform preLoad actions for the component.

public

Run code before the update of all components is run This empty method is usually overriden to perform pre-update actions for the component It is called once per component by an internal Mobilizing mechanism

public

prepare the component This empty method is usually overriden to perform preparation actions for the component, from external process as a server.

public

Set's up the component This empty method is usually overriden to perform setup actions for the component This is where all the initialization (such as adding event listeners)should be done It is called automatically by an internal Mobilizing mechanism and should thus not be called directly

public

Update the component This empty method is usually overriden to perform update actions for the component It is called periodically by an internal Mobilizing mechanism

Public Constructors

public constructor(params: Object) source

A Button is a special kind of 3D object that is clickable and that you can use to build Graphical User Interfaces (GUI).

Override:

Component#constructor

Params:

NameTypeAttributeDescription
paramsObject

Parameters object, given by the constructor.

params.cameraCamera

the camera used for picking.

params.textString

text to render (can be empty).

params.textSizeNumber

the text size

params.fontObject

font to use.

params.widthNumber

width in pixels.

params.heightNumber

height in pixels.

params.canvasWidthNumber

canvasWidth in pixels.

params.canvasHeightNumber

canvasHeight in pixels.

params.cutOffNumber

the size of the cutOff

params.strokeColorColor
params.fillColorColor
params.pressFillColorColor
params.hoverFillColorColor
params.textColorColor
params.onPressFunction
  • optional
params.onReleaseFunction
  • optional
params.onEnterFunction
  • optional
params.onLeaveFunction
  • optional

Example:

    //TODO

Public Members

public bottomLeftIndex: number source

public bottomRightIndex: number source

public camera: * source

public canvasHeight: * source

public canvasWidth: * source

public clickable: * source

public cutOff: * source

public fakePressed: boolean source

public fillColor: * source

public font: * source

public height: * source

public hoverFillColor: * source

public mesh: * source

public onEnter: * source

public onLeave: * source

public onPress: * source

public onRelease: * source

public pointer: * source

public pressFillColor: * source

public pressTextTexture: * source

public radius: * source

public root: * source

public sideCount: * source

public state: * source

public strokeColor: * source

public strokeMesh: * source

public strokeWidth: * source

public text: * source

public textColor: * source

public textSize: * source

public textTexture: * source

public texturedMesh: * source

public topLeftIndex: number source

public topRightIndex: number source

public transform: * source

public vertex: *[] source

public width: * source

Public Methods

public adaptCorner(mode: String, corner: String) source

Adapt a corner of the shape, for grouping buttons together

Params:

NameTypeAttributeDescription
modeString

"cutOff" || "straight"

cornerString

"topLeft" || "topRight" || "bottomRight" || "bottomLeft"

public fakePress() source

Can be used to simulate a pressed event when necessary (i.e. when a keyboard event should modify the button state).

public off() source

deactivate the button, set its opacity to 30 %

Override:

Component#off

public on() source

Activate the button

Override:

Component#on

public setup() source

Set's up the component This empty method is usually overriden to perform setup actions for the component This is where all the initialization (such as adding event listeners)should be done It is called automatically by an internal Mobilizing mechanism and should thus not be called directly

Override:

Component#setup

Private Methods

private generateDefaultMesh() source

Generate the vertices and meshes for the default button. Called internally only

private regenerateStrokeGeometry(the: Mesh) source

regenerate the geometry of the mesh for further update

Params:

NameTypeAttributeDescription
theMesh

mesh to regenerate the stroke for