Installation
This plugin requires its stylesheet. Import
@photo-sphere-viewer/virtual-tour-plugin/index.css or add the CDN link to your <head>.Usage
Data mode
- Client mode
- Server mode
Provide all nodes upfront in the
nodes array. You can replace them later with setNodes().Position mode
- Manual mode
- GPS mode
Each link specifies its position on the panorama using
yaw/pitch or textureX/textureY coordinates.Node definition
Unique identifier for the node.
The panorama to display. Accepts the same value as the main viewer
panorama option.GPS coordinates of the node:
[longitude, latitude, altitude?]. Required when using positionMode: 'gps'.Short name shown in link tooltips and the Gallery plugin.
Caption displayed in the viewer header. Same as the main viewer
caption option.Description text. Same as the main viewer
description option.Thumbnail URL used in the Gallery plugin.
Whether to show this node in the Gallery plugin.
Additional markers to display on this node. Requires the Markers plugin. Markers can use standard
position (yaw/pitch) or, in GPS mode, a gps coordinate.map
Hotspot configuration for the Map plugin (client mode only). Set to
false to hide this node from the map.plan
Hotspot configuration for the Plan plugin (client + GPS mode only). Set to
false to hide this node from the plan.Panorama data passed to the viewer. Same as the main viewer
panoData option.Sphere correction applied to the panorama. Same as the main viewer
sphereCorrection option.Arbitrary data attached to the node.
Links
ID of the target node.
Position of the link on the panorama in spherical or texture coordinates. Required in manual mode.
GPS coordinates of the target node. Required in GPS + server mode so the link can be positioned without loading the target node first.
Positional offset applied to the arrow. Adjusting this moves the displayed arrow without changing where the viewer rotates when the link is clicked.
depth is used in 3D render mode to manage overlapping arrows.Overrides the global
arrowStyle for this specific link.Arbitrary data attached to the link.
Plugin configuration
How node data is provided. Not updatable.
How link positions are determined. Not updatable.
How navigation arrows are rendered. Not updatable.
Initial node list (client mode only). Not updatable — use
setNodes() instead.(nodeId: string) => Promise<Node>. Callback to fetch a node’s configuration (server mode only). Required in server mode.ID of the initially loaded node. If omitted, the first node is used. Required in server mode.
Preload linked nodes before the user navigates to them. Can be a function
(node, link) => boolean for selective preloading.Configures the transition when switching nodes. Can be a static object or a callback
When using a callback, two additional fields are available:
(toNode, fromNode?, fromLink?) => options.Static object fields:| Field | Type | Default | Description |
|---|---|---|---|
showLoader | boolean | true | Show the loader while loading the next panorama |
effect | 'none' | 'fade' | 'black' | 'white' | 'fade' | Transition effect |
speed | string | number | '20rpm' | Speed or duration of the transition |
rotation | boolean | true | Rotate toward the next node before transitioning |
rotateTo (where to rotate before switching) and zoomTo (new zoom level).Show link directions on the Compass plugin overlay.
Show a tooltip on each link arrow containing the node’s
name, thumbnail, and caption.(content: string, link, node) => string. Callback to customize the tooltip content for a link. The first argument is the default tooltip HTML.Global style for link arrows.Default is a circular button with a ripple effect, 80×80px.
Fine-tuning for arrow placement (3D mode). All values are in radians unless noted.
Configuration for Map plugin integration (client mode only). The
imageUrl for the map must be set here, not in the Map plugin configuration.Methods
setNodes(nodes, startNodeId?) (client mode only)
Replaces all nodes and navigates to the first one (or to startNodeId).
updateNode(node) (client mode only)
Updates a single node. Only id is required; all other fields are optional. If the updated node is the current one, the viewer refreshes accordingly.
setCurrentNode(nodeId, options?)
Navigates to a specific node. Pass options to override transitionOptions for this transition only.
gotoLink(nodeId, speed?): Promise
Rotates the view to face a specific link. Default speed is 8rpm.
