The CheckboxWidget JavaScript class. A checkbox widget.
This widget must be linked to a BOOL attribute. The widget manipulator is a square area. The color for the on/off states can be specified at object creation. When the area is clicked, the BOOL attribute is set to true, a cross is displayed in the widget box, and the "on" color is shown.
The following properties are supported by the widget:
Property | Type | Default Value | Description |
data | String | - | The name of the automatically generated position attribute (if none is provided) |
data | Attribute | - | An attribute of BOOL type that can be shared with another widget or node. |
size | float | 1.00 | The size (half-extent) of the box. |
screen_space | bool | false | When set to true, the checkbox position becomes relative to the screen rather than the scene. |
position | Point2d | Point2d(0,0) | Position of the box center in the scene, specified in fields. |
outer_color | ColorRGBA | 0, 0, 0,255 | The outer colour of the box. |
on_color | ColorRGBA | 0,255, 0,128 | The inner colour of the box, when checked. |
off_color | ColorRGBA | 255, 0, 0,128 | The outer colour of the box, when unchecked. |
label | String | "text" | Label text |
label_color | ColorRGBA | 255,255,255,255 | Label foreground (text) color. |
label_bg_color | ColorRGBA | 0, 0, 0,128 | Label background color. Accepts transparency values. |
label_font | String | "Arial" | Label font name. |
label_size | float | 10.0 | Label font size, in points. |
label_pos | Point2d | Point2d(0,0) | Label position, in fields. |
label_justify | String | "Left" | Horizontal label text alignment ("Left"/"Center"). |
label_screenspace | bool | true | Forces the label size to remain constant relative to screen. |
label_screenspace_offset | Point2d | Point2d(0,0) | Label position offset, in screen space. |
The following components constitute the widget:
Component | Type |
attribute | BOOL |
drag_manipulator | BUTTON |
painter | CHECKBOX |
picker | MONO |
local_transformation | - |
Create this widget to add a floating Master Controller in the camera view:
{
MessageLog.
trace(
" ---------------------------------------------------------------------------");
MessageLog.
trace(
" ---------------------------------------------------------------------------");
{
screen_space : false,
size : 1,
label : "myText",
label_font : "Arial",
label_size : 18,
label_screenspace_offset :
Point2d(0,-400),
label_justify : "Center",
label_screenspace : false
} );
{
});
}
Make sure to setup the Master Controller node specifications properly. e.g.
<attributes>
<attr type="BOOL" name="checkbox_value" value="false" tooltip="Checkbox ON/OFF value."/>
</attributes>