Installation
This plugin also requires its own stylesheet. Import
@photo-sphere-viewer/plan-plugin/index.css or add the CDN link to your <head>.Usage
The only required option iscoordinates — the GPS position of the panorama.
Configuration
GPS position of the panorama as
[longitude, latitude]. Updatable. You can also call setCoordinates().Rotation offset applied to the central pin to align it with the panorama’s orientation. Updatable.
Available base tile layers. When more than one layer is configured, a button lets the user switch between them. Each entry is an object with:Ignored when
name— display nameurlTemplate— tile URL template for standard raster tiles (e.g.'https://tile.openstreetmap.org/{z}/{x}/{y}.png')layer— any custom Leaflet layer instance (alternative tourlTemplate)attribution— attribution text
configureLeaflet is used.(map) => void. Callback for full manual Leaflet configuration. When provided, the default tile layer is not applied.Size of the widget. Accepts any CSS length unit. Updatable.
Position of the widget on screen. Accepted values: combinations of
top/bottom and left/right. Updatable.SVG or image URL for the central position pin. Defaults to a built-in SVG. Updatable.
Size of the central pin in pixels. Updatable.
Markers visible on the map. Updatable. See Hotspots below. You can also call
setHotspots().Default style for hotspots. Updatable. Individual hotspots can override with their own
style.| Field | Type | Default | Description |
|---|---|---|---|
size | number | 15 | Hotspot diameter |
image | string | — | SVG or image URL |
color | string | 'white' | Fill color when no image |
borderSize | number | 0 | Border width |
borderColor | string | null | Border color |
hoverSize | number | null | Size on hover |
hoverImage | string | null | Image on hover |
hoverColor | string | null | Color on hover |
hoverBorderSize | number | 4 | Border width on hover |
hoverBorderColor | string | 'rgba(255,255,255,0.8)' | Border color on hover |
Initial Leaflet zoom level.
Show the map when the first panorama loads.
Minimize the map when the user clicks a hotspot or marker. Updatable.
Control which buttons are visible around the map widget.
Localization strings merged with the main viewer
lang object.Hotspots
Identifier used to match
select-hotspot events. Auto-generated if not set.GPS position of the hotspot as
[longitude, latitude].Overrides the default
spotStyle for this hotspot.Tooltip shown when hovering the hotspot.
Methods
setHotspots(hotspots)
Replaces all hotspots.
clearHotspots()
Removes all hotspots.
setCoordinates(coordinates)
Updates the panorama’s GPS position on the map.
close() / open()
Toggles between closed and open states.
maximize() / minimize()
Toggles between maximized and minimized views. Has no effect when the map is closed.
getLeaflet()
Returns the underlying Leaflet map instance for direct access to the Leaflet API.
setZoom(level)
Sets the Leaflet zoom level.
Events
select-hotspot(hotspotId)
Fired when the user clicks a hotspot.
view-changed(view)
Fired when the map state changes. view is 'maximized', 'normal', or 'closed'.
SCSS variables
| Variable | Default | Description |
|---|---|---|
$radius | 8px | Corner radius of the widget |
$shadow | 0 0 5px rgba(0,0,0,.7) | Widget shadow |
$button-size | 34px | Button size |
$button-background | rgba(0,0,0,.5) | Button background |
$button-color | white | Button icon color |
$transition | ease-in-out .3s | Animation transition |
