ViewerSpec

Source: GLViewer.ts

GLViewer input specification


Instance Fields

ambientOcclusion: AmbientOcclusionStyle

Ambient occlusion settings

antialias: boolean

Enable antialiasing, default true.

autoDestroy: boolean

Automatically destroy the viewer when its previously connected container is removed.
Defaults to true. Cleanup is deferred to the next timer task so synchronous and
microtask reparenting is safe. Initially detached containers remain usable until mounted.
Set false to keep a viewer detached across tasks; call destroy() when finished with it.

backgroundAlpha: number

Canvas background opacity from 0 (transparent) to 1 (opaque), default 1.

backgroundColor: string

Canvas background color, default "#ffffff".

callback: function

Callback function to be executed with this viewer after setup is complete

camerax: number | string

Initial camera x coordinate in model units, default 0; used for stereo views.

canvas: HTMLCanvasElement

Existing canvas to use. Grid viewers share the canvas created by createViewerGrid.

cartoonQuality: number

Default cartoon quality for new models, default 10. Higher values increase resolution.

col: number

Internal grid column; set by createViewerGrid.

cols: number

Grid column count; normally supplied through ViewerGridSpec.

control_all: boolean

Apply mouse controls to all panels in a viewer grid, default false.

defaultcolors: Record.<string, ColorSpec>

Default atom colors as element-symbol-to-color mappings for models in this viewer.

disableFog: boolean

Disable fog, default to false

hoverDuration: number

Delay in milliseconds before a hover callback, default 500.

id: string

id of the canvas

lowerZoomLimit: number

Minimum camera-to-model distance for zoom controls; unset means no lower limit.

minimumZoomToDistance: number

Minimum model extent used by zoomTo(), in model units; default 5.

nomouse: boolean | string

Whether to disable the built-in mouse and touch handlers (default false).
If you want to use your own mouse handlers, set this then bind your handlers to the canvas object.
The default 3Dmol.js handlers are available for use:
'mousedown touchstart': viewer._handleMouseDown,
'DOMMouseScroll mousewheel': viewer._handleMouseScroll
'mousemove touchmove': viewer._handleMouseMove

orthographic: boolean

Orthographic instead of perspective rendering. Default false.

outline: OutlineStyle

Outline parameters

row: number

Internal grid row, counted from the bottom; set by createViewerGrid.

rows: number

Grid row count; normally supplied through ViewerGridSpec.

style: string

outline or ambientOcclusion deprecated

upperZoomLimit: number

Maximum camera-to-model distance for zoom controls; unset means no upper limit.

upscale: boolean

Render upscaled to 2x resolution. Defaults to antialiasing setting. Ignored for Retina displays.