Viewport Constructor

Constructor of the viewport object.

Signatures

  •   Paramate.Viewport( object options )

Details

The function sets up the viewport inside a given HTML element. Parameters can be set inside the options object argument.

The viewport must be registered inside a configurator element.

Example

 [...]
 <body>
   <div id="viewPort"></div>
   <script type="text/javascript">
     configurator = new Paramate.Configurator({...});
     viewPort = new Paramate.Viewport({
       configurator: configurator,
       viewportElement: document.getElementById("viewport")
     });
     configurator.viewPort = viewPort;
     configurator.initialize();
   </script>
 [...]
 

Throw

error

Throws an error if the initalization failed.

Parameters

options

Object containing parameters for the viewport:

 {
   configurator: <object>,
   viewportElement: <element>,
   onBeforeRedraw: <function>,
   onAfterRedraw: <function>,
   onCheckCameraLimits: <function>,
   useWaitAnim: <bool>,
   cameraOrbit: <bool>,
   cameraShift: <bool>,
   cameraDolly: <bool>,
   cameraPan: <bool>,
   cameraZoom: <bool>,
   orbitMode: <string>,
   cameraAutoPos: <bool>,
   cameraRealTime: <bool>,
   cameraAutoRotate: <bool>
 }

options.configurator

The configurator object (see configurator constructor).

options.viewportElement

The HTML element to host the viewport.

options.onBeforeRedraw

(optional) Function to be called before a redraw operation is started.

options.onAfterRedraw

(optional) Function to be called after a redraw operation is finished.

options.onCheckCameraLimits

(optional) Function to be called when the user changes the camera to check limits and correct if needed.

options.useWaitAnim

(optional) Boolean flag whether a wait animation should be shown. (default: true)

options.cameraOrbit

(optional) Boolean flag to enable/disable camera orbiting. See also setCameraOrbit and getCameraOrbit . (default: true)

options.cameraShift

(optional) Boolean flag to enable/disable camera shifting. See also setCameraShift and getCameraShift . (default: true)

options.cameraDolly

(optional) Boolean flag to enable/disable camera dollying. See also setCameraDolly and getCameraDolly . (default: true)

options.cameraPan

(optional) Boolean flag to enable/disable camera panning. See also setCameraPan and getCameraPan . (default: true)

options.cameraZoom

(optional) Boolean flag to enable/disable camera zooming. See also setCameraZoom and getCameraZoom . (default: true)

options.orbitMode

(optional) Possible camera orbiting modes:

"turn_and_flip" Movement that allows a combination of free rotation and flipping.
"turntable" The Z axis stays strictly vertical. The object cannot be turned upside-down.
"turntable_overturn" The Z axis stays strictly vertical. The object can be turned upside-down.

(default: "turn_and_flip")

options.cameraAutoPos

(optional) Boolean flag to enable/disable automatic camera (re-)positioning. (default: true)

options.cameraRealTime

(optional) Boolean flag to toggle between real time image streaming or the display of a rotation placeholder object. (default: false)

options.cameraAutoRotate

(optional) Boolean flag to enable/disable automatic camera rotation. (default: false)