import Button from '@mobilizing/library/js/Mobilizing/renderer/3D/three/ui/Button.js'
Button
Extends:
Constructor Summary
Public Constructor | ||
public | constructor(params: Object) 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 | canvasHeight: * | |
public | canvasWidth: * | |
public | clickable: * | |
public | cutOff: * | |
public | ||
public | fillColor: * | |
public | font: * | |
public | height: * | |
public | ||
public | mesh: * | |
public | onEnter: * | |
public | onLeave: * | |
public | onPress: * | |
public | onRelease: * | |
public | pointer: * | |
public | ||
public | ||
public | radius: * | |
public | root: * | |
public | sideCount: * | |
public | state: * | |
public | strokeColor: * | |
public | strokeMesh: * | |
public | strokeWidth: * | |
public | text: * | |
public | textColor: * | |
public | textSize: * | |
public | textTexture: * | |
public | texturedMesh: * | |
public | ||
public | ||
public | transform: * | |
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 | setup() |
Private Methods | ||
private | Generate the vertices and meshes for the default button. | |
private | regenerateStrokeGeometry(the: Mesh) regenerate the geometry of the mesh for further update |
Inherited Summary
From class Component | ||
public | ||
public | context: * | |
public | events: * | |
public | id: * | |
public | name: * | |
private | _nexts: *[] | |
private | ||
public | byPass() | |
public | 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() 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() prepare the component This empty method is usually overriden to perform preparation actions for the component, from external process as a server. | |
public | setup() 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() 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#constructorParams:
Name | Type | Attribute | Description |
params | Object | Parameters object, given by the constructor. | |
params.camera | Camera | the camera used for picking. | |
params.text | String | text to render (can be empty). | |
params.textSize | Number | the text size | |
params.font | Object | font to use. | |
params.width | Number | width in pixels. | |
params.height | Number | height in pixels. | |
params.canvasWidth | Number | canvasWidth in pixels. | |
params.canvasHeight | Number | canvasHeight in pixels. | |
params.cutOff | Number | the size of the cutOff | |
params.strokeColor | Color | ||
params.fillColor | Color | ||
params.pressFillColor | Color | ||
params.hoverFillColor | Color | ||
params.textColor | Color | ||
params.onPress | Function |
| |
params.onRelease | Function |
| |
params.onEnter | Function |
| |
params.onLeave | Function |
|
Example:
//TODO
Public Members
public camera: * source
public canvasHeight: * source
public canvasWidth: * source
public clickable: * source
public cutOff: * 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 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
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 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#setupPrivate Methods
private generateDefaultMesh() source
Generate the vertices and meshes for the default button. Called internally only