Request

Response

    Core

    Autodesk.Viewing.Private.ViewerState

    new ViewerState(viewer)

    Class for creating and restoring viewer states.

    Main interactions come from methods

    Parameters

    viewer*Viewer instance used to operate on.
    * Required

    Methods

    areEqual(viewerStateA,viewerStateB,filter)

    Return true if two viewer states are equal, it’s possible to compare only a subset of the objects providing a filter as parameter.

    Parameters

    viewerStateA*
    object
    viewerStateB*
    object
    filter
    object
    Similar in structure to viewerState used to filter out values to check.
    * Required

    Returns

    TypeDescription
    boolean True if the states are equal.

    getSeedUrn()

    Returns the URN of the document model.

    Returns

    TypeDescription
    string Model URN.

    getState(filter)

    Returns a viewer state Object for the current viewer instance.

    Parameters

    filter
    object
    Object with a structure similar to the output where values are replaced with Booleans true/false indicating whether they should be stored or not.

    Returns

    TypeDescription
    object Plain object describing the state of the viewer.

    restoreState(viewerState,filter,immediate)

    Restores the associated viewer instance with the provided viewerState object.

    Parameters

    viewerState*
    object
    filter
    object
    Similar in structure to viewerState used to filter out values that should not be restored.
    immediate
    boolean
    Whether the state should be apply with (false) or without (true) a smooth transition.
    * Required

    Returns

    TypeDescription
    boolean True if the operation was successful.