Class: Viewer

PSV~Viewer

new Viewer (options)

Main class

Name Type Description
options PSV.Options
Fires:
  • PSV.event:ready
Throws:

when the configuration is incorrect

Type
PSV.PSVError

Extends

Members

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

Utilities to help converting data

eventsHandler PSV.services.EventsHandler readonly

Main event handler

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

needsUpdate boolean

if the view needs to be renderer

isCubemap boolean

if the panorama is a cubemap

position PSV.Position

current direction of the camera

direction external:THREE.Vector3

direction of the camera

zoomLvl number

current zoom level

vFov number

vertical FOV

hFov number

horizontal FOV

aspect number

viewer aspect ratio

moveSpeed number

move speed (computed with pixel ratio and configuration moveSpeed)

autorotateCb function

update callback of the automatic rotation

animationPromise PSV.Animation

promise of the current animation (either go to position or image transition)

loadingPromise Promise

promise of the setPanorama method

startTimeout

timeout id of the automatic rotation delay

size PSV.Size

size of the container

panoData PSV.PanoData

panorama metadata

renderer PSV.services.Renderer readonly

Main render controller

textureLoader PSV.services.TextureLoader readonly

Textures loader

tooltip PSV.services.TooltipRenderer readonly

Methods

animate (options)PSV.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.Animation

autoSize ()

Resizes the canvas when the window is resized

Fires:
  • PSV.event:size-updated

destroy ()

Destroys the viewer

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

enterFullscreen ()

Enters the fullscreen mode

Fires:
  • PSV.event:fullscreen-updated

exitFullscreen ()

Exits the fullscreen mode

Fires:
  • PSV.event:fullscreen-updated

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

refreshUi () package

Refresh UI

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:
  • PSV.event:before-rotate
  • PSV.event:position-updated

setOption (option, value)

Update options

Name Type Description
option string
value any
Fires:
  • PSV.event:config-changed

setOptions (options)

Update options

Name Type Description
options PSV.Options
Fires:
  • PSV.event:config-changed

setPanorama (path, options)Promise

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 string | Array.<string> | PSV.Cubemap

URL of the new panorama file

options PSV.PanoramaOptions optional
Returns:
Type Description
Promise

showError (message)

Displays an error message

Name Type Description
message string

startAutorotate ()

Starts the automatic rotation

Fires:
  • PSV.event:autorotate

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:
  • PSV.event:autorotate

stopKeyboardControl ()

Disables the keyboard controls (done automatically when exiting fullscreen)

toggleAutorotate ()

Starts or stops the automatic rotation

Fires:
  • PSV.event:autorotate

toggleFullscreen ()

Enters or exits the fullscreen mode

Fires:
  • PSV.event:fullscreen-updated

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:
  • PSV.event:zoom-updated

zoomIn ()

Increases the zoom level by 1

zoomOut ()

Decreases the zoom level by 1