Members
elem
Properties:
Name | Type | Description |
---|---|---|
elem |
HTMLElement | The element the inputs will be populated to |
- Source:
eventListeners
Properties:
Name | Type | Description |
---|---|---|
eventListeners |
object | The event listeners of the obj bar. |
- Source:
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:
shouldApplyToAll
Properties:
Name | Type | Description |
---|---|---|
shouldApplyToAll |
boolean | Whether the "Apply to all" checkbox is checked |
- Source:
shouldShowAdvanced
Properties:
Name | Type | Description |
---|---|---|
shouldShowAdvanced |
boolean | Whether the advanced options should be shown |
- Source:
targetObj
Properties:
Name | Type | Description |
---|---|---|
targetObj |
SceneObject | null | The scene object whose options are being edited |
- Source:
titleElem
Properties:
Name | Type | Description |
---|---|---|
titleElem |
HTMLElement | The element that contains the title of the object bar |
- Source:
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:
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:
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:
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:
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:
createNote(content)
Create a note in the object bar.
Parameters:
Name | Type | Description |
---|---|---|
content |
string | The HTML content for the note. |
- Source:
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:
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:
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:
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:
initialize(elem, titleElem)
Initialize the object bar.
Parameters:
Name | Type | Description |
---|---|---|
elem |
HTMLElement | The element the inputs will be populated to |
titleElem |
HTMLElement | The element that contains the title of the object bar |
- Source:
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:
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:
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:
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:
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:
editEnd
The event when the editing is finished.
- Source:
requestUpdate
The event when the entire obj bar should be updated.
- Source:
showAdvancedEnabled
The event when the advanced options should be enabled.
Parameters:
Name | Type | Description |
---|---|---|
enabled |
boolean | Whether the advanced options should be enabled. |
- Source: