Properties
State Number | Enum for button states |
Methods
setState(state)
Sets the state of this button.
Parameters
state* | The state. |
Returns
type | description |
---|---|
boolean | True if the state was set successfully. |
setIcon(iconClass)
Sets the icon for the button.
Parameters
iconClass* string | The CSS class defining the appearance of the button icon (e.g. image background). |
getState()
Returns the state of this button.
Returns
type | description |
---|---|
Autodesk.Viewing.UI.Button.State | The state of the button. |
onClick(event)
Override this method to be notified when the user clicks on the button.
Parameters
event* MouseEvent |
onMouseOver(event)
Override this method to be notified when the mouse enters the button.
Parameters
event* MouseEvent |
onMouseOut(event)
Override this method to be notified when the mouse leaves the button.
Parameters
event* MouseEvent |
getId()
Gets this control’s ID.
Returns
type | description |
---|---|
string | The control’s ID. |
setVisible(visible)
Sets the visibility of this control.
Parameters
visible* boolean | The visibility value to set. |
Returns
type | description |
---|---|
boolean | True if the control’s visibility changed. |
isVisible()
Gets the visibility of this control.
Returns
type | description |
---|---|
boolean | True if the this control is visible. |
setToolTip(toolTipText)
Sets the tooltip text for this control.
Parameters
toolTipText* string | The text for the tooltip. |
Returns
type | description |
---|---|
boolean | True if the tooltip was successfully set. |
getToolTip()
Returns the tooltip text for this control.
Returns
type | description |
---|---|
string | The tooltip text. Null if it’s not set. |
setCollapsed(collapsed)
Sets the collapsed state of this control.
Parameters
collapsed* boolean | The collapsed value to set. |
Returns
type | description |
---|---|
boolean | True if the control’s collapsed state changes. |
isCollapsed()
Gets the collapsed state of this control.
Returns
type | description |
---|---|
boolean | True if this control is collapsed. |
isCollapsible()
Returns whether or not this control is collapsible.
Returns
type | description |
---|---|
boolean | True if this control can be collapsed. |
addClass(cssClass)
Adds a CSS class to this control.
Parameters
cssClass* string | The name of the CSS class. |
removeClass(cssClass)
Removes a CSS class from this control.
Parameters
cssClass* string | The name of the CSS class. |
getPosition()
Returns the position of this control relative to the canvas.
Returns
type | description |
---|---|
object | The top and left values of the toolbar. |
getDimensions()
Returns the dimensions of this control.
Returns
type | description |
---|---|
object | The width and height of the toolbar. |
setDisplay(value)
Sets the CSS display
style value.
Parameters
value* string | CSS display value |
removeFromParent()
Removes current control from its parent container.
Returns
type | description |
---|---|
boolean | True if the control was successfully removed. |
Events
STATE_CHANGED
Event fired when state of the button changes.
Properties
buttonId string | The ID of the button that fired this event. |
state | The new state of the button. |
VISIBILITY_CHANGED
Event fired when the visibility of the control changes.
Properties
controlId string | The ID of the control that fired this event. |
isVisible boolean | True if the control is now visible. |
COLLAPSED_CHANGED
Event fired when the collapsed state of the control changes.
Properties
controlId string | The ID of the control that fired this event. |
isCollapsed boolean | True if the control is now collapsed. |