Class: Viewer

PSV.Viewer

new PSV.Viewer (options)

Main class

Name Type Description
options PSV.Options
Fires:
Throws:

when the configuration is incorrect

Type
PSV.PSVError

Extends

Members

adapter PSV.adapters.AbstractAdapter packagereadonly

Render adapter

children Array.<PSV.components.AbstractComponent> packagereadonly

All child components

config PSV.Options readonly

Configuration holder

container HTMLElement readonly

Main container

dataHelper PSV.services.DataHelper readonly

dynamics Record.<string, PSV.utils.Dynamic> package

eventsHandler PSV.services.EventsHandler readonly

loader PSV.components.Loader readonly

notification PSV.components.Notification readonly

overlay PSV.components.Overlay readonly

panel PSV.components.Panel readonly

parent HTMLElement readonly

Top most parent

plugins Object.<string, PSV.plugins.AbstractPlugin> packagereadonly

All plugins

prop Object protected

Internal properties

Properties:
Name Type Description
ready boolean

when all components are loaded

uiRefresh boolean

if the UI needs to be renderer

needsUpdate boolean

if the view needs to be renderer

fullscreen boolean

if the viewer is currently fullscreen

direction external:THREE.Vector3

direction of the camera

vFov number

vertical FOV

hFov number

horizontal FOV

aspect number

viewer aspect ratio

autorotateEnabled boolean

automatic rotation is enabled

animationPromise PSV.utils.Animation

promise of the current animation

loadingPromise Promise

promise of the setPanorama method

littlePlanet boolean

special tweaks for LittlePlanetAdapter

idleTime number

time of the last user action

objectsObservers object
size PSV.Size

size of the container

panoData PSV.PanoData

panorama metadata, if supported

renderer PSV.services.Renderer readonly

textureLoader PSV.services.TextureLoader readonly

tooltip PSV.services.TooltipRenderer readonly

Methods

__stopAll ()Promise package

Stops all current animations

Returns:
Type Description
Promise

animate (options)PSV.utils.Animation

Rotates and zooms the view with a smooth animation

Name Type Description
options PSV.AnimateOptions

position and/or zoom level

Returns:
Type Description
PSV.utils.Animation

autoSize ()

Resizes the canvas when the window is resized

Fires:

destroy ()

Destroys the viewer

The memory used by the ThreeJS context is not totally cleared. This will be fixed as soon as possible.

disableIdleTimer () package

Stops the idle timer

enterFullscreen ()

Enters the fullscreen mode

Fires:

exitFullscreen ()

Exits the fullscreen mode

Fires:

getPlugin (pluginId)PSV.plugins.AbstractPlugin

Returns the instance of a plugin if it exists

Name Type Description
pluginId Class.<PSV.plugins.AbstractPlugin> | string
Returns:
Type Description
PSV.plugins.AbstractPlugin

getPosition ()PSV.Position

Returns the current position of the camera

Returns:
Type Description
PSV.Position

getSize ()PSV.Size

Returns the current viewer size

Returns:
Type Description
PSV.Size

getZoomLevel ()number

Returns the current zoom level

Returns:
Type Description
number

hideError ()

Hides the error message

isAutorotateEnabled ()boolean

Checks if the automatic rotation is enabled

Returns:
Type Description
boolean

isFullscreenEnabled ()boolean

Checks if the viewer is in fullscreen

Returns:
Type Description
boolean

needsUpdate ()

Flags the view has changed for the next render

observeObjects (userDataKey, listener)function package

Subscribes to events on objects in the scene

Name Type Description
userDataKey string

only objects with the following userData will be emitted

listener EventListener

must implement handleEvent

Returns:
Type Description
function call to stop the subscription

refreshUi () package

Refresh UI

resetIdleTimer () package

Restarts the idle timer (if autorotateIdle=true)

resize (size)

Resizes the viewer

Name Type Description
size PSV.CssSize

rotate (position)

Rotates the view to specific longitude and latitude

Name Type Description
position PSV.ExtendedPosition
Fires:

setOption (option, value)

Update options

Name Type Description
option string
value any
Fires:
Throws:

when the configuration is incorrect

Type
PSV.PSVError

setOptions (options)

Update options

Name Type Description
options PSV.Options
Fires:
Throws:

when the configuration is incorrect

Type
PSV.PSVError

setOverlay (path, opacity)Promise

Loads a new overlay

Name Type Default Description
path *

URL of the new overlay file

opacity number 1 optional
Returns:
Type Description
Promise

setPanorama (path, options)Promise.<boolean>

Loads a new panorama file

Loads a new panorama file, optionally changing the camera position/zoom and activating the transition animation.
If the "options" parameter is not defined, the camera will not move and the ongoing animation will continue.
If another loading is already in progress it will be aborted.

Name Type Description
path *

URL of the new panorama file

options PSV.PanoramaOptions optional
Returns:
Type Description
Promise.<boolean> resolves false if the loading was aborted by another call

showError (message)

Displays an error message over the viewer

Name Type Description
message string

startAutorotate ()

Starts the automatic rotation

Fires:

startKeyboardControl ()

Enables the keyboard controls (done automatically when entering fullscreen)

stopAnimation ()Promise

Stops the ongoing animation

The return value is a Promise because the is no guaranty the animation can be stopped synchronously.

Returns:
Type Description
Promise Resolved when the animation has ben cancelled

stopAutorotate ()

Stops the automatic rotation

Fires:

stopKeyboardControl ()

Disables the keyboard controls (done automatically when exiting fullscreen)

toggleAutorotate ()

Starts or stops the automatic rotation

Fires:

toggleFullscreen ()

Enters or exits the fullscreen mode

Fires:

zoom (level)

Zooms to a specific level between max_fov and min_fov

Name Type Description
level number

new zoom level from 0 to 100

Fires:

zoomIn (step)

Increases the zoom level

Name Type Default Description
step number 1 optional

zoomOut (step)

Decreases the zoom level

Name Type Default Description
step number 1 optional