Request

Response

    Autodesk.Viewing.UI
    Version 8 preview
    This page documents a preview of the Viewer SDK v8. APIs and content can still change before the final release.

    Control

    new Control(id, options)

    Base class for UI controls.

    It is abstract and should not be instantiated directly.

    Parameters

    Expand all
    id
    string
    The id for this control.
    options
    object
    Dictionary with options.
    collapsible
    boolean
    Whether this control is collapsible.

    Properties

    Event
    String
    Enum for control event IDs.
    container
    HTMLElement
    The HTMLElement representing this control.

    Methods

    getId()

    Gets this control’s ID.

    Returns

    typedescription
    string The control’s ID.

    setVisible(visible)

    Sets the visibility of this control.

    Parameters

    visible*
    boolean
    The visibility value to set.
    * Required

    Returns

    typedescription
    boolean True if the control’s visibility changed.

    isVisible()

    Gets the visibility of this control.

    Returns

    typedescription
    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.
    * Required

    Returns

    typedescription
    boolean True if the tooltip was successfully set.

    getToolTip()

    Returns the tooltip text for this control.

    Returns

    typedescription
    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.
    * Required

    Returns

    typedescription
    boolean True if the control’s collapsed state changes.

    isCollapsed()

    Gets the collapsed state of this control.

    Returns

    typedescription
    boolean True if this control is collapsed.

    isCollapsible()

    Returns whether or not this control is collapsible.

    Returns

    typedescription
    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.
    * Required

    removeClass(cssClass)

    Removes a CSS class from this control.

    Parameters

    cssClass*
    string
    The name of the CSS class.
    * Required

    getPosition()

    Returns the position of this control relative to the canvas.

    Returns

    typedescription
    object The top and left values of the toolbar.

    getDimensions()

    Returns the dimensions of this control.

    Returns

    typedescription
    object The width and height of the toolbar.

    setDisplay(value)

    Sets the CSS display style value.

    Parameters

    value*
    string
    CSS display value
    * Required

    removeFromParent()

    Removes current control from its parent container.

    Returns

    typedescription
    boolean True if the control was successfully removed.

    Events

    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.