# Class: ObjBar

## ObjBar()

The object bar class, which is used to create the options/controls for the selected scene object.

## Constructor

#### new ObjBar()

Source:
  - ObjBar.js, line 26

### Members

#### elem

##### Properties:

Name | Type | Description
--- | --- | ---
`elem` | HTMLElement | The element the inputs will be populated to

Source:
  - ObjBar.js, line 30

#### eventListeners

##### Properties:

Name | Type | Description
--- | --- | ---
`eventListeners` | object | The event listeners of the obj bar.

Source:
  - ObjBar.js, line 48

#### pendingEvent

##### Properties:

Name | Type | Description
--- | --- | ---
`pendingEvent` | function | null | The pending event to be called in case the scene object loses focus before the input is finished

Source:
  - ObjBar.js, line 45

#### shouldApplyToAll

##### Properties:

Name | Type | Description
--- | --- | ---
`shouldApplyToAll` | boolean | Whether the "Apply to all" checkbox is checked

Source:
  - ObjBar.js, line 36

#### shouldShowAdvanced

##### Properties:

Name | Type | Description
--- | --- | ---
`shouldShowAdvanced` | boolean | Whether the advanced options should be shown

Source:
  - ObjBar.js, line 39

#### targetObj

##### Properties:

Name | Type | Description
--- | --- | ---
`targetObj` | SceneObject | null | The scene object whose options are being edited

Source:
  - ObjBar.js, line 42

#### titleElem

##### Properties:

Name | Type | Description
--- | --- | ---
`titleElem` | HTMLElement | The element that contains the title of the object bar

Source:
  - ObjBar.js, line 33

### Methods

#### createBoolean(label, value, func, info, updateOnChangeopt)

Create a boolean input in the object bar.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`label` | string |  |  | The label for the input.
`value` | boolean |  |  | The initial value.
`func` | objBarValueChangeCallback |  |  | The function to call when the value changes.
`info` | string | null |  |  | The HTML content for the popover info box. If null (default), no info box is created.
`updateOnChange` | boolean | <optional> | false | Whether to update the entire obj bar (e.g. show different options) when the checkbox changes.

Source:
  - ObjBar.js, line 340

#### createButton(label, func, updateOnChangeopt, iconopt)

Create a button in the object bar.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`label` | string |  |  | The label for the button.
`func` | function |  |  | The function to call when the button is clicked.
`updateOnChange` | boolean | <optional> | false | Whether to update the entire obj bar (e.g. show different options) when the button is clicked.
`icon` | string | null | <optional> | null | The svg icon for the button. If null (default), a default button is created.

Source:
  - ObjBar.js, line 531

#### createDropdown(label, value, options, func, info, updateOnChangeopt)

Create a dropdown input in the object bar.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`label` | string |  |  | The label for the input.
`value` | string |  |  | The initial value.
`options` | Object | Array |  |  | The options for the dropdown. If an array, the keys are the same as the values.
`func` | objBarValueChangeCallback |  |  | The function to call when the value changes.
`info` | string | null |  |  | The HTML content for the popover info box. If null (default), no info box is created.
`updateOnChange` | boolean | <optional> | false | Whether to update the entire obj bar (e.g. show different options) when the dropdown changes.

Source:
  - ObjBar.js, line 476

#### createEquation(label, value, func, info)

Create an equation input (where the value is a LaTeX string) in the object bar.

##### Parameters:

Name | Type | Description
--- | --- | ---
`label` | string | The label for the input.
`value` | string | The initial value.
`func` | objBarValueChangeCallback | The function to call when the value changes.
`info` | string | null | The HTML content for the popover info box. If null (default), no info box is created.

Source:
  - ObjBar.js, line 392

#### createInfoBox(info, elemopt)

Create an popover info icon in the object bar.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`info` | string |  | The HTML content for the popover info box.
`elem` | HTMLElement | <optional> | The element to append the info icon to. If not provided, the object bar element is used.

Source:
  - ObjBar.js, line 567

#### createNote(content)

Create a note in the object bar.

##### Parameters:

Name | Type | Description
--- | --- | ---
`content` | string | The HTML content for the note.

Source:
  - ObjBar.js, line 593

#### createNumber(label, min, max, step, value, func, info, hideSlider)

Create a number input in the object bar.

##### Parameters:

Name | Type | Description
--- | --- | ---
`label` | string | The label for the input.
`min` | number | The minimum value for the slider.
`max` | number | The maximum value for the slider.
`step` | number | The step value for the slider.
`value` | number | The initial value.
`func` | objBarValueChangeCallback | The function to call when the value changes.
`info` | string | null | The HTML content for the popover info box. If null (default), no info box is created.
`hideSlider` | boolean | Whether to hide the slider (that is, only show the text input). Default is false.

Source:
  - ObjBar.js, line 134

#### createText(label, value, func)

Create a text input in the object bar.

##### Parameters:

Name | Type | Description
--- | --- | ---
`label` | string | The label for the input.
`value` | string | The initial value.
`func` | objBarValueChangeCallback | The function to call when the value changes.

Source:
  - ObjBar.js, line 284

#### createTuple(label, value, func, info)

Create a tuple input in the object bar.

##### Parameters:

Name | Type | Description
--- | --- | ---
`label` | string | The label for the input.
`value` | string | The initial value.
`func` | objBarValueChangeCallback | The function to call when the value changes.
`info` | string | null | The HTML content for the popover info box. If null (default), no info box is created.

Source:
  - ObjBar.js, line 232

#### emit(eventName, data)

Emit an event.

##### Parameters:

Name | Type | Description
--- | --- | ---
`eventName` | string | The name of the event.
`data` | any | The data to be passed to the callback functions.

Source:
  - ObjBar.js, line 68

#### on(eventName, callback)

Add an event listener to the obj bar.

##### Parameters:

Name | Type | Description
--- | --- | ---
`eventName` | string | The name of the event.
`callback` | function | The callback function.

Source:
  - ObjBar.js, line 56

#### setOption(func)

Do the callback function that set the option. Whether it is for all objects or just the selected one depends on the "Apply to all" checkbox.

##### Parameters:

Name | Type | Description
--- | --- | ---
`func` | objBarValueChangeCallback | The function to call.

Source:
  - ObjBar.js, line 607

#### setTitle(title)

Set the title of the object bar. If the title is empty, the title element is hidden.

##### Parameters:

Name | Type | Description
--- | --- | ---
`title` | string | The title of the object bar.

Source:
  - ObjBar.js, line 107

#### showAdvanced(condition) → {boolean}

Determine whether to create the advanced options ("More options...") in the object bar. If this function is called, either it means that the advanced options should be populated, or the "More options..." button will be shown.

##### Parameters:

Name | Type | Description
--- | --- | ---
`condition` | boolean | The condition (of the scene object itself or some global option) to determine whether to show the advanced options.

Source:
  - ObjBar.js, line 627

##### Returns:

Whether the advanced options should be populated.

Type
  boolean

### Events

#### edit

The event when some value is changed but the editing may not be finished yet.

Source:
  - ObjBar.js, line 74

#### editEnd

The event when the editing is finished.

Source:
  - ObjBar.js, line 79

#### requestUpdate

The event when the entire obj bar should be updated.

Source:
  - ObjBar.js, line 84

#### showAdvancedEnabled

The event when the advanced options should be enabled.

##### Parameters:

Name | Type | Description
--- | --- | ---
`enabled` | boolean | Whether the advanced options should be enabled.

Source:
  - ObjBar.js, line 89