Members
-
<static, readonly> DEFAULTS :Object
Default options, see
http:\\/\\/photo-sphere-viewer.js.org/#options -
Details
-
<static, readonly> Error
exposes
PSVError -
Details
-
<static, readonly> ICONS :Object.<string, string>
SVG icons sources
-
Details
-
<static, readonly> TEMPLATES :Object.<string, string>
doT.js templates
-
Details
-
<static, readonly> Utils :object
exposes
PSVUtils -
Details
-
<readonly> config :Object
Configuration object
-
Details
-
<readonly> container :HTMLElement
Main container
-
Details
-
<readonly> hud :module:components.PSVHUD
-
Details
-
<readonly> loader :module:components.PSVLoader
-
Details
-
<readonly> navbar :module:components.PSVNavBar
-
Details
-
<readonly> notification :module:components.PSVNotification
-
Details
-
<readonly> overlay :module:components.PSVOverlay
-
Details
-
<readonly> panel :module:components.PSVPanel
-
Details
-
<readonly> parent :HTMLElement
Top most parent
-
Details
-
<readonly> prop :Object
Internal properties
-
Properties
Name Type Description needsUpdateboolean if the view needs to be renderer
isCubemapboolean if the panorama is a cubemap
positionPhotoSphereViewer.Position current direction of the camera
directionTHREE.Vector3 direction of the camera
anim_speedfloat parsed animation speed (rad/sec)
zoom_lvlint current zoom level
vFovfloat vertical FOV
hFovfloat horizontal FOV
aspectfloat viewer aspect ratio
move_speedfloat move speed (computed with pixel ratio and configuration move_speed)
movingboolean is the user moving
zoomingboolean is the user zooming
start_mouse_xint start x position of the click/touch
start_mouse_yint start y position of the click/touch
mouse_xint current x position of the cursor
mouse_yint current y position of the cursor
mouse_historyArray.<Array> list of latest positions of the cursor, [time, x, y]
gyro_alpha_offsetint current alpha offset for gyroscope controls
pinch_distint distance between fingers when zooming
main_reqidanimationRequest id of the main event loop
orientation_cbfunction update callback of the device orientation
autorotate_cbfunction update callback of the automatic rotation
animation_promisePromise promise of the current animation (either go to position or image transition)
loading_promisePromise promise of the setPanorama method
start_timeouttimeout id of the automatic rotation delay
dblclick_dataPhotoSphereViewer.ClickData temporary storage of click data between two clicks
dblclick_timeouttimeout id for double click
cacheArray.<PhotoSphereViewer.CacheItem> cached panoramas
sizePhotoSphereViewer.Size size of the container
pano_dataPhotoSphereViewer.PanoData panorama metadata
Details
-
<readonly> tooltip :module:components.PSVTooltip
-
Details
Methods
-
animate( options [, speed ] ) → {PSVAnimation}
Rotates the view to specific longitude and latitude with a smooth animation
-
Parameters
Name Type Attributes Description optionsPhotoSphereViewer.AnimateOptions speedstring | int <optional> animation speed or duration (in milliseconds)
Returns
Details
-
change( name, value [, ...arguments ] ) → {*}
Triggers an event on the viewer and returns the modified value
-
Parameters
Name Type Attributes Description namestring value* arguments* <optional>
<repeatable>Returns
Details
-
cleanSphereCorrection( sphere_correction )
Clean a SphereCorrection object
-
Parameters
Name Type Description sphere_correctionPhotoSphereViewer.SphereCorrection mutated
Details
-
clearPanoramaCache( [ panorama ] )
Removes a panorama from the cache or clears the entire cache
-
Parameters
Name Type Attributes Description panoramastring <optional> Throws
Details
-
destroy()
Destroys the viewer
-
Description
The memory used by the ThreeJS context is not totally cleared. This will be fixed as soon as possible.
Details
-
getPanoramaCache( panorama ) → {PhotoSphereViewer.CacheItem}
Retrieves the cache for a panorama
-
Parameters
Name Type Description panoramastring Returns
Throws
Details
-
getPosition() → {PhotoSphereViewer.Position}
Returns the current position of the camera
-
Returns
Details
-
getSize() → {PhotoSphereViewer.Size}
Returns the current viewer size
-
Returns
Details
-
getZoomLevel() → {int}
Returns the current zoom level
-
Returns
Details
-
isAutorotateEnabled() → {boolean}
Checks if the automatic rotation is enabled
-
Returns
Details
-
isExtendedPosition( object ) → {boolean}
Checks if an object is a {PhotoSphereViewer.ExtendedPosition}, ie has x/y or longitude/latitude
-
Parameters
Name Type Description objectobject Returns
Details
-
isFullscreenEnabled() → {boolean}
Checks if the viewer is in fullscreen
-
Returns
Details
-
isGyroscopeEnabled() → {boolean}
Checks if the gyroscope is enabled
-
Returns
Details
-
isStereoEnabled() → {boolean}
Checks if the stereo viewx is enabled
-
Returns
Details
-
load() → {Promise}
Starts to load the panorama
-
Returns
Throws
Details
-
lockOrientation()
Tries to lock the device in landscape or display a message
-
Details
-
needsUpdate()
Flags the view has changed for the next render
-
Details
-
off( name [, callback ] ) → {PhotoSphereViewer}
Removes an event listener from the viewer
-
Parameters
Name Type Attributes Description namestring | Object.<string, function()> event name or events map
callbackfunction <optional> Returns
Details
-
on( name [, callback ] ) → {PhotoSphereViewer}
Attaches an event listener on the viewer
-
Parameters
Name Type Attributes Description namestring | Object.<string, function()> event name or events map
callbackfunction <optional> Returns
Details
-
once( name [, callback ] ) → {PhotoSphereViewer}
Attaches an event listener called once on the viewer
-
Parameters
Name Type Attributes Description namestring | Object.<string, function()> event name or events map
callbackfunction <optional> Returns
Details
-
preloadPanorama( panorama ) → {Promise}
Preload a panorama file without displaying it
-
Parameters
Name Type Description panoramastring Returns
Throws
Details
-
render()
Performs a render
-
Details
-
resize( size )
Resizes the viewer
-
Parameters
Name Type Description sizePhotoSphereViewer.CssSize Details
-
rotate( position [, ignoreRange ] )
Rotates the view to specific longitude and latitude
-
Parameters
Name Type Attributes Default Description positionPhotoSphereViewer.ExtendedPosition ignoreRangeboolean <optional> false ignore longitude_range and latitude_range
Fires
Details
-
setPanorama( path [, options [, transition ] ] ) → {Promise}
Loads a new panorama file
-
Description
Loads a new panorama file, optionally changing the camera position and activating the transition animation.
If the "position" is not defined, the camera will not move and the ongoing animation will continue
"config.transition" must be configured for "transition" to be taken in accountParameters
Name Type Attributes Default Description pathstring | Array.<string> URL of the new panorama file
optionsPhotoSphereViewer.PanoramaOptions <optional> transitionboolean <optional> false Returns
Throws
Details
-
speedToDuration( value, angle ) → {number}
Converts a speed into a duration from current position to a new position
-
Parameters
Name Type Description valuestring | number anglenumber Returns
Details
-
sphericalCoordsToTextureCoords( position ) → {PhotoSphereViewer.Point}
Converts spherical radians coordinates to pixel texture coordinates
-
sphericalCoordsToVector3( position ) → {THREE.Vector3}
Converts spherical radians coordinates to a THREE.Vector3
-
startAutorotate()
Starts the automatic rotation
-
Fires
Details
-
startGyroscopeControl()
Enables the gyroscope navigation if available
-
Fires
Throws
Details
-
startKeyboardControl()
Enables the keyboard controls (done automatically when entering fullscreen)
-
Details
-
startNoSleep()
Enables NoSleep.js
-
Details
-
startStereoView()
Enables the stereo view
-
Description
- enables NoSleep.js
- enables full screen
- starts gyroscope controle
- hides hud, navbar and panel
- instanciate StereoEffect
Throws
Details
-
stopAnimation() → {Promise}
Stops the ongoing animation
-
Description
The return value is a Promise because the is no guaranty the animation can be stopped synchronously.
Returns
Details
-
stopAutorotate()
Stops the automatic rotation
-
Fires
Details
-
stopGyroscopeControl()
Disables the gyroscope navigation
-
Fires
Details
-
stopKeyboardControl()
Disables the keyboard controls (done automatically when exiting fullscreen)
-
Details
-
stopNoSleep()
Disables NoSleep.js
-
Details
-
stopStereoView()
Disables the stereo view
-
Details
-
textureCoordsToSphericalCoords( point ) → {PhotoSphereViewer.Position}
Converts pixel texture coordinates to spherical radians coordinates
-
toggleAutorotate()
Starts or stops the automatic rotation
-
Details
-
toggleFullscreen()
Enters or exits the fullscreen mode
-
Details
-
toggleGyroscopeControl()
Enables or disables the gyroscope navigation
-
Details
-
toggleStereoView()
Enables or disables the stereo view
-
Details
-
trigger( name [, ...arguments ] ) → {uEvent.Event}
Triggers an event on the viewer
-
Parameters
Name Type Attributes Description namestring arguments* <optional>
<repeatable>Returns
Details
-
unlockOrientation()
Unlock the device orientation
-
Details
-
vector3ToSphericalCoords( vector ) → {PhotoSphereViewer.Position}
Converts a THREE.Vector3 to spherical radians coordinates
-
Parameters
Name Type Description vectorTHREE.Vector3 Returns
Details
-
vector3ToViewerCoords( vector ) → {PhotoSphereViewer.Point}
Converts a THREE.Vector3 to position on the viewer
-
Parameters
Name Type Description vectorTHREE.Vector3 Returns
Details
-
viewerCoordsToVector3( viewerPoint ) → {THREE.Vector3}
Converts position on the viewer to a THREE.Vector3
-
zoom( level )
Zooms to a specific level between
max_fovandmin_fov -
Parameters
Name Type Description levelint new zoom level from 0 to 100
Fires
Details
-
zoomIn()
Increases the zoom level by 1
-
Details
-
zoomOut()
Decreases the zoom level by 1
-
Details
Type Definitions
-
AnimateOptions
Object defining animation options
-
Properties
Name Type Description zoomnumber target zoom level between 0 and 100
Details
-
CacheItem
An entry in the memory cache
-
Properties
Name Type Description panoramastring imageTHREE.Texture pano_dataPhotoSphereViewer.PanoData Details
-
ClickData
Data of the
clickevent -
Properties
Name Type Attributes Description client_xint position in the browser window
client_yint position in the browser window
viewer_xint position in the viewer
viewer_yint position in the viewer
longitudefloat position in spherical coordinates
latitudefloat position in spherical coordinates
texture_xint position on the texture
texture_yint position on the texture
markerPSVMarker <optional> clicked marker
Details
-
CssSize
Object defining a size in CSS (px, % or auto)
-
Properties
Name Type Attributes Description widthstring <optional> heightstring <optional> Details
-
ExtendedPosition
Object defining a spherical or texture position
-
Description
A position that can be expressed either in spherical coordinates (radians or degrees) or in texture coordinates (pixels)
Properties
Name Type Description xint yint Details
-
PanoData
Crop information of the panorama
-
Properties
Name Type Description full_widthint full_heightint cropped_widthint cropped_heightint cropped_xint cropped_yint Details
-
PanoramaOptions
Object defining panorama and animation options
-
Properties
Name Type Description sphere_correctionPhotoSphereViewer.SphereCorrection new sphere correction to apply to the panorama
Details
-
Point
Object defining a point
-
Properties
Name Type Description xint yint Details
-
Position
Object defining a spherical position
-
Properties
Name Type Description longitudefloat latitudefloat Details
-
Size
Object defining a size
-
Properties
Name Type Description widthint heightint Details
-
SphereCorrection
-
Properties
Name Type Description pannumber tiltnumber rollnumber Details
Events
-
autorotate
Triggered when the automatic rotation is enabled/disabled
-
Parameters
Name Type Description enabledboolean Details
-
before-render
Triggered before a render, used to modify the view
-
Parameters
Name Type Description timestampint time provided by requestAnimationFrame
Details
-
click
Triggered when the user clicks on the viewer (everywhere excluding the navbar and the side panel)
-
Parameters
Name Type Description dataPhotoSphereViewer.ClickData Details
-
dblclick
Triggered when the user double clicks on the viewer. The simple
clickevent is always fired beforedblclick -
Parameters
Name Type Description dataPhotoSphereViewer.ClickData Details
-
fullscreen-updated
Triggered when the fullscreen mode is enabled/disabled
-
Parameters
Name Type Description enabledboolean Details
-
gyroscope-updated
Triggered when the gyroscope mode is enabled/disabled
-
Parameters
Name Type Description enabledboolean Details
-
panorama-cached
Triggered when a panorama is stored in the cache
-
Parameters
Name Type Description panoramastring Details
-
panorama-load-progress
Triggered while a panorama image is loading
-
Parameters
Name Type Description panoramastring progressint Details
-
panorama-loaded
Triggered when a panorama image has been loaded
-
Details
-
position-updated
Triggered when the view longitude and/or latitude changes
-
Parameters
Name Type Description positionPhotoSphereViewer.Position Details
-
ready
Triggered when the panorama image has been loaded and the viewer is ready to perform the first render
-
Details
-
render
Triggered on each viewer render, this event is triggered very often
-
Details
-
size-updated
Triggered when the viewer size changes
-
Parameters
Name Type Description sizePhotoSphereViewer.Size Details
-
stereo-updated
Triggered when the stereo view is enabled/disabled
-
Parameters
Name Type Description enabledboolean Details
-
zoom-updated
Triggered when the zoom level changes
-
Parameters
Name Type Description zoomLevelint Details