---
title: ViewFitOptions
summary: Type alias in @bimworks/viewercommon.
order: 10
languages: [javascript]
sdk-package: JavaScript · @bimworks/viewercommon
---

# ViewFitOptions

[[page:reference/javascript/api|API catalogue]] · `@bimworks/viewercommon` · Type alias

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
type ViewFitOptions = {
  animate?: boolean;
  animationTimeMs?: number;
  margin?: number;
  rotation?: ViewFitRotation;
  rotationObject?: Qid;
  target?: vec3;
  updatePivot?: boolean;
  viewDirection?: vec3;
};
````



## Members

| Member | Kind | Description |
|---|---|---|
| [[page:reference/javascript/bimworks-viewercommon/viewfitoptions-2382fbce#member-animate-259546c20ae9|animate]] | Property | Whether to animate, when omitted this will default to what has been defined on the Viewer |
| [[page:reference/javascript/bimworks-viewercommon/viewfitoptions-2382fbce#member-animationtimems-675198272ca2|animationTimeMs]] | Property | The total animation time in milliseconds, only effective when animate is set to true |
| [[page:reference/javascript/bimworks-viewercommon/viewfitoptions-2382fbce#member-margin-fa61af704f22|margin]] | Property | An optional margin (in percentage of total viewer size) to use as a buffer round the selected models. A perspective camera fits the bounding sphere of the ob… |
| [[page:reference/javascript/bimworks-viewercommon/viewfitoptions-2382fbce#member-rotation-6c49fdd51650|rotation]] | Property | How the fit rotates a plan, default "KEEP": the Viewer2d's, and the Viewer3d's in a plan from the top or bottom |
| [[page:reference/javascript/bimworks-viewercommon/viewfitoptions-2382fbce#member-rotationobject-77ac92a5f601|rotationObject]] | Property | The object whose oriented bounding box orients the plan for rotation "OBJECT_AXIS" (plans only) |
| [[page:reference/javascript/bimworks-viewercommon/viewfitoptions-2382fbce#member-target-4e73689d1681|target]] | Property | Optional target in 3D |
| [[page:reference/javascript/bimworks-viewercommon/viewfitoptions-2382fbce#member-updatepivot-de53b58e406d|updatePivot]] | Property | Whether the pivot should be updated to the center of the aabb of the given objects. Without it, the next orbit that starts on nothing pivots under the cursor… |
| [[page:reference/javascript/bimworks-viewercommon/viewfitoptions-2382fbce#member-viewdirection-1bcfcaad6b44|viewDirection]] | Property | Optional view direction in 3D |

## `animate` {#member-animate-259546c20ae9}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
animate?: boolean
````

Whether to animate, when omitted this will default to what has been defined on the Viewer

## `animationTimeMs` {#member-animationtimems-675198272ca2}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
animationTimeMs?: number
````

The total animation time in milliseconds, only effective when animate is set to true

## `margin` {#member-margin-fa61af704f22}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
margin?: number
````

An optional margin (in percentage of total viewer size) to use as a buffer round the selected models. A perspective
camera fits the bounding sphere of the objects, an orthographic one (fov 0) their bounding box as the screen sees it.

## `rotation` {#member-rotation-6c49fdd51650}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
rotation?: ViewFitRotation
````

How the fit rotates a plan, default "KEEP": the Viewer2d's, and the Viewer3d's in a plan from the top or bottom

## `rotationObject` {#member-rotationobject-77ac92a5f601}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
rotationObject?: Qid
````

The object whose oriented bounding box orients the plan for rotation "OBJECT_AXIS" (plans only)

## `target` {#member-target-4e73689d1681}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
target?: vec3
````

Optional target in 3D

## `updatePivot` {#member-updatepivot-de53b58e406d}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
updatePivot?: boolean
````

Whether the pivot should be updated to the center of the aabb of the given objects. Without it, the next orbit
that starts on nothing pivots under the cursor, at the depth of the point the fit looks at (one that starts on an
object pivots on that object's point under the cursor either way)

## `viewDirection` {#member-viewdirection-1bcfcaad6b44}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
viewDirection?: vec3
````

Optional view direction in 3D
