Class: MarkersPlugin

PSV.plugins.MarkersPlugin

new PSV.plugins.MarkersPlugin (psv, options)

Displays various markers on the viewer

Name Type Description
psv PSV.Viewer
options PSV.plugins.MarkersPlugin.Options optional

Extends

Classes

Marker

Object representing a marker

Members

PSV.plugins.MarkersPlugin.EVENTS string staticconstant

Available events

container HTMLElement readonly

id string readonly inherited overrides

Unique identifier of the plugin

markers Object.<string, PSV.plugins.MarkersPlugin.Marker>

All registered markers

Reference to main controller

svgContainer SVGElement readonly

Methods

addMarker (properties, render)PSV.plugins.MarkersPlugin.Marker

Adds a new marker to viewer

Name Type Default Description
properties PSV.plugins.MarkersPlugin.Properties
render boolean true optional

renders the marker immediately

Throws:

when the marker's id is missing or already exists

Type
PSV.PSVError
Returns:
Type Description
PSV.plugins.MarkersPlugin.Marker

clearMarkers (render)

Removes all markers

Name Type Default Description
render boolean true optional

renders the markers immediately

destroy () package overrides

Returns the last marker selected by the user

Returns:
Type Description
PSV.plugins.MarkersPlugin.Marker

getMarker (markerId)PSV.plugins.MarkersPlugin.Marker

Returns the internal marker object for a marker id

Name Type Description
markerId string
Throws:

when the marker cannot be found

Type
PSV.PSVError
Returns:
Type Description
PSV.plugins.MarkersPlugin.Marker

getMarkers ()Array.<PSV.plugins.MarkersPlugin.Marker>

Returns all the markers

Returns:
Type Description
Array.<PSV.plugins.MarkersPlugin.Marker>

getNbMarkers ()number

Returns the total number of markers

Returns:
Type Description
number

gotoMarker (markerId, speed)PSV.utils.Animation

Rotate the view to face the marker

Name Type Description
markerId string
speed string | number optional

rotates smoothy, see PSV.Viewer#animate

Fires:
Returns:
Type Description
PSV.utils.Animation A promise that will be resolved when the animation finishes

hide ()

Hides all markers

Fires:

hideAllTooltips ()

Hides all tooltips

hideMarker (markerId)

Hides a marker

Name Type Description
markerId string

hideMarkersList ()

Closes side panel if it contains the list of markers

hideMarkerTooltip (markerId)

Hides the tooltip

Name Type Description
markerId string

init () package overrides

removeMarker (markerId, render)

Removes a marker from the viewer

Name Type Default Description
markerId string
render boolean true optional

renders the marker immediately

removeMarkers (markerIds, render)

Removes multiple markers

Name Type Default Description
markerIds Array.<string>
render boolean true optional

renders the markers immediately

renderMarkers ()

Updates the visibility and the position of all markers

setMarkers (markers, render)

Replaces all markers

Name Type Default Description
markers Array.<PSV.plugins.MarkersPlugin.Properties>
render boolean true optional

renders the marker immediately

show ()

Shows all markers

Fires:

showAllTooltips ()

Displays all tooltips

showMarker (markerId)

Shows a marker

Name Type Description
markerId string

showMarkerPanel (markerId)

Opens the panel with the content of the marker

Name Type Description
markerId string

showMarkersList ()

Opens side panel with the list of markers

Fires:

showMarkerTooltip (markerId)

Forces the display of the tooltip

Name Type Description
markerId string

toggleAllTooltips ()

Toggles the visibility of all tooltips

toggleMarker (markerId, visible)

Toggles a marker

Name Type Default Description
markerId string
visible boolean null optional

toggleMarkersList ()

Toggles the visibility of the list of markers

updateMarker (properties, render)PSV.plugins.MarkersPlugin.Marker

Updates the existing marker with the same id

Every property can be changed but you can't change its type (Eg: image to html).

Name Type Default Description
properties PSV.plugins.MarkersPlugin.Properties
render boolean true optional

renders the marker immediately

Returns:
Type Description
PSV.plugins.MarkersPlugin.Marker

Type Definitions

PSV.plugins.MarkersPlugin.Options Object

Properties:
Name Type Argument Default Description
clickEventOnMarker boolean <optional>
false

If a click event is triggered on the viewer additionally to the select-marker event.

gotoMarkerSpeed string | number <optional>
8rpm

Default animation speed for gotoMarker method

markers Array.<PSV.plugins.MarkersPlugin.Properties> <optional>

PSV.plugins.MarkersPlugin.Properties Object

Marker properties, see https://photo-sphere-viewer.js.org/plugins/plugin-markers.html#markers-options

PSV.plugins.MarkersPlugin.SelectMarkerData Object

Data of the select-marker event

Properties:
Name Type Description
dblclick boolean

if the selection originated from a double click, the simple click is always fired before the double click

rightclick boolean

if the selection originated from a right click

Events

PSV.plugins.MarkersPlugin.event:goto-marker-done

Triggered when the animation to a marker is done

Name Type Description
marker PSV.plugins.MarkersPlugin.Marker

PSV.plugins.MarkersPlugin.event:hide-markers

Triggered when the markers are hidden

PSV.plugins.MarkersPlugin.event:leave-marker

Triggered when the user puts the cursor away from a marker

Name Type Description
marker PSV.plugins.MarkersPlugin.Marker

PSV.plugins.MarkersPlugin.event:marker-visibility

Triggered when the visibility of a marker changes

Name Type Description
marker PSV.plugins.MarkersPlugin.Marker
visible boolean

PSV.plugins.MarkersPlugin.event:over-marker

Triggered when the user puts the cursor hover a marker

Name Type Description
marker PSV.plugins.MarkersPlugin.Marker

PSV.plugins.MarkersPlugin.event:select-marker

Triggered when the user clicks on a marker. The marker can be retrieved from outside the event handler with PSV.plugins.MarkersPlugin.getCurrentMarker

Name Type Description
marker PSV.plugins.MarkersPlugin.Marker
data PSV.plugins.MarkersPlugin.SelectMarkerData

PSV.plugins.MarkersPlugin.event:select-marker-list

Triggered when a marker is selected from the side panel

Name Type Description
marker PSV.plugins.MarkersPlugin.Marker

PSV.plugins.MarkersPlugin.event:set-marker

Triggered when the list of markers changes

Name Type Description
markers Array.<PSV.plugins.MarkersPlugin.Marker>

PSV.plugins.MarkersPlugin.event:show-markers

Triggered when the markers are shown

PSV.plugins.MarkersPlugin.event:unselect-marker

Triggered when a marker was selected and the user clicks elsewhere

Name Type Description
marker PSV.plugins.MarkersPlugin.Marker

PSV.plugins.MarkersPlugin.filter:render-markers-list

Used to alter the list of markers displayed on the side-panel

Name Type Description
markers Array.<PSV.plugins.MarkersPlugin.Marker>
Returns:
Type Description
Array.<PSV.plugins.MarkersPlugin.Marker>