Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Stage

Stage class, central for creating molecular scenes with NGL.

example

var stage = new Stage( "elementId", { backgroundColor: "white" } );

Hierarchy

  • Stage

Index

Constructors

constructor

Properties

animationBehavior

animationBehavior: AnimationBehavior

animationControls

animationControls: AnimationControls

compList

compList: Component[] = []

defaultFileParams

defaultFileParams: object

Type declaration

keyBehavior

keyBehavior: KeyBehavior

keyControls

keyControls: KeyControls

lastFullscreenElement

lastFullscreenElement: HTMLElement

logList

logList: string[] = []

mouseBehavior

mouseBehavior: MouseBehavior

mouseControls

mouseControls: MouseControls

mouseObserver

mouseObserver: MouseObserver

parameters

parameters: StageParameters

pickingBehavior

pickingBehavior: PickingBehavior

pickingControls

pickingControls: PickingControls

rockAnimation

rockAnimation: Animation

spinAnimation

spinAnimation: Animation

tasks

tasks: Counter = new Counter()

Counter that keeps track of various potentially long-running tasks, including file loading and surface calculation.

tooltip

tooltip: HTMLElement

trackballControls

trackballControls: TrackballControls

Optional transformAtom

transformAtom: AtomProxy

Optional transformComponent

transformComponent: Component

viewer

viewer: Viewer

viewerControls

viewerControls: ViewerControls

Methods

addComponent

addComponentFromObject

autoView

  • autoView(duration?: undefined | number): void
  • Add a zoom and a move animation with automatic targets

    Parameters

    • Optional duration: undefined | number

      animation time in milliseconds

    Returns void

defaultFileRepresentation

  • defaultFileRepresentation(component: Component): void

dispose

  • dispose(): void

eachComponent

  • eachComponent(callback: function, type?: undefined | string): void
  • Iterator over each component and executing the callback

    Parameters

    • callback: function
    • Optional type: undefined | string

    Returns void

eachRepresentation

  • eachRepresentation(callback: function, type?: undefined | string): void

getBox

  • getBox(): Box3

getCenter

  • getCenter(optionalTarget?: Vector3): Vector3

getComponentsByName

getComponentsByObject

getParameters

  • getParameters(): object
  • Get stage parameters

    Returns object

    • ambientColor: string | number
    • ambientIntensity: number
    • backgroundColor: string | number
    • cameraEyeSep: number
    • cameraFov: number
    • cameraType: "perspective" | "orthographic" | "stereo"
    • clipDist: number
    • clipFar: number
    • clipNear: number
    • fogFar: number
    • fogNear: number
    • hoverTimeout: number
    • impostor: boolean
    • lightColor: string | number
    • lightIntensity: number
    • mousePreset: "default" | "pymol" | "coot" | "astexviewer"
    • panSpeed: number
    • quality: "high" | "medium" | "low" | "auto"
    • rotateSpeed: number
    • sampleLevel: number
    • tooltip: boolean
    • workerDefault: boolean
    • zoomSpeed: number

getRepresentationsByName

getZoom

  • getZoom(): number

getZoomForBox

  • getZoomForBox(boundingBox: Box3): number

handleResize

  • handleResize(): void

loadFile

  • Load a file onto the stage

    example

    // load from URL stage.loadFile( "http://files.rcsb.org/download/5IOS.cif" );

    example

    // load binary data in CCP4 format via a Blob var binaryBlob = new Blob( [ ccp4Data ], { type: 'application/octet-binary'} ); stage.loadFile( binaryBlob, { ext: "ccp4" } );

    example

    // load string data in PDB format via a Blob var stringBlob = new Blob( [ pdbData ], { type: 'text/plain'} ); stage.loadFile( stringBlob, { ext: "pdb" } );

    example

    // load a File object stage.loadFile( file );

    example

    // load from URL and add a 'ball+stick' representation with double/triple bonds stage.loadFile( "http://files.rcsb.org/download/1crn.cif" ).then( function( comp ){ comp.addRepresentation( "ball+stick", { multipleBond: true } ); } );

    Parameters

    • path: string | File | Blob

      either a URL or an object containing the file data

    • Default value params: Partial<StageLoadFileParams> = {}

      loading parameters

    Returns any

    A Promise object that resolves to a StructureComponent, a SurfaceComponent or a {@link ScriptComponent} object, depending on the type of the loaded file.

loadScript

  • loadScript(path: string | File | Blob): any

log

  • log(msg: string): void

makeImage

measureClear

  • measureClear(): void

measureUpdate

  • measureUpdate(): void

removeAllComponents

  • removeAllComponents(): void

removeComponent

  • removeComponent(component: Component): void

setFocus

  • setFocus(value: number): void

setImpostor

  • setImpostor(value: boolean): void

setParameters

setQuality

setRock

  • setRock(flag: boolean): void
  • Set rock

    Parameters

    • flag: boolean

      if true start rocking and stop spinning

    Returns void

setSize

  • setSize(width: string, height: string): void
  • Set width and height

    Parameters

    • width: string

      CSS width value

    • height: string

      CSS height value

    Returns void

setSpin

  • setSpin(flag: boolean): void
  • Set spin

    Parameters

    • flag: boolean

      if true start rocking and stop spinning

    Returns void

toggleFullscreen

  • toggleFullscreen(element: HTMLElement): void

toggleRock

  • toggleRock(): void

toggleSpin

  • toggleSpin(): void

Object literals

signals

signals: object

clicked

clicked: Signal<T> = new Signal()

componentAdded

componentAdded: Signal<T> = new Signal()

componentRemoved

componentRemoved: Signal<T> = new Signal()

fullscreenChanged

fullscreenChanged: Signal<T> = new Signal()

hovered

hovered: Signal<T> = new Signal()

parametersChanged

parametersChanged: Signal<T> = new Signal()

Generated using TypeDoc