panorama.Player
Extends IEventEmitter.
Class for creating and controlling the panorama player.
Constructor | Fields | Events | Methods
Constructor
panorama.Player(element, panorama[, options])
Creates an instance of the panorama player.
Parameters:
Parameter |
Default value |
Description |
— |
Type: HTMLElement|String A reference to the HTML element that will contain the player, or the ID of this HTML element. |
|
— |
Type: IPanorama The panorama that will be opened in the created panorama player. |
|
— |
Type: Object Options. |
|
"always" |
Type: String The option to disable automatic tracking of the size of the player container. By default, the player always follows the size of its container, and reconstructs the image if the size has changed. Available values:
|
|
— |
Type: String[] Set of player controls. Available controls:
|
|
'auto' |
Type: Number[]|String Direction of view in the format |
|
false |
Type: Boolean Enables keyboard control of the player. Please note that when you open the player, it begins to intercept some keys (e.g. arrow keys), thus canceling the default reaction of the browser, which may prevent the user from interacting with your page. This is why keyboard control is disabled by default. |
|
true |
Type: Boolean Disables zooming of the panorama by scrolling. Enabled by default, and the player intercepts the mouse wheel events. |
|
'auto' |
Type: Number[]|String The angular dimensions of the field of view in the format |
|
false |
Type: Boolean Whether to hide the offer to open the current panorama in Yandex Maps with all the available map information preserved as completely as possible. |
* Mandatory parameter/option.
Fields
Name |
Type |
Description |
Event manager. Inherited from IEventEmitter. |
Events
Name |
Description |
The player was closed by the user or destroyed using the panorama.Player.destroy method. |
|
The view direction changed. |
|
An error occurred during operation of the player. The user will be shown the appropriate screen. |
|
The panorama player switched to full-screen mode. |
|
The panorama player exited full-screen mode. |
|
The user clicked on an expanded marker. Names of fields that are available via the Event.get method:
|
|
The user clicked on a collapsed marker. Names of fields that are available via the Event.get method:
|
|
The user's cursor hovered over a marker. Names of fields that are available via the Event.get method:
|
|
The user's cursor left a marker. Names of fields that are available via the Event.get method:
|
|
The open panorama changed (for example, as the result of calling the panorama.Player.setPanorama function or a user action). |
|
The size of the viewport has been changed. |
Methods
Name |
Returns |
Description |
destroy() |
Destroys the player. |
|
Checks the size of the player container and if it has changed since the last inspection, rebuilds the image. |
||
Number[] |
Returns the current viewing direction, in the format |
|
Returns the panorama that is currently open in the player. |
||
getSpan() |
Number[] |
Returns the current angular dimensions of the field of view, in the format |
Rotates the view so that the passed point is in the center of the field of view. |
||
Searches for a panorama with the specified parameters and opens it. |
||
Sets a new viewing direction. |
||
Opens the passed panorama in the player. |
||
Sets new dimensions for the field of view. |
Events details
destroy
The player was closed by the user or destroyed using the panorama.Player.destroy method.
directionchange
The view direction changed.
error
An error occurred during operation of the player. The user will be shown the appropriate screen.
fullscreenenter
The panorama player switched to full-screen mode.
fullscreenexit
The panorama player exited full-screen mode.
markercollapse
The user clicked on an expanded marker. Names of fields that are available via the Event.get method:
- marker — The marker that was collapsed.
markerexpand
The user clicked on a collapsed marker. Names of fields that are available via the Event.get method:
- marker — The marker that was expanded.
markermouseenter
The user's cursor hovered over a marker. Names of fields that are available via the Event.get method:
- marker — The marker that the cursor hovered over.
markermouseleave
The user's cursor left a marker. Names of fields that are available via the Event.get method:
- marker — The marker that the cursor moved away from.
panoramachange
The open panorama changed (for example, as the result of calling the panorama.Player.setPanorama function or a user action).
spanchange
The size of the viewport has been changed.
Methods details
destroy
{} destroy()
Destroys the player.
fitToViewport
{} fitToViewport()
Checks the size of the player container and if it has changed since the last inspection, rebuilds the image.
getDirection
{Number[]} getDirection()
Returns the current viewing direction, in the format [bearing, pitch]
, where bearing
is the azimuth of the direction in degrees, and pitch
is the angle of elevation above the horizon in degrees.
getPanorama
{IPanorama} getPanorama()
Returns the panorama that is currently open in the player.
getSpan
{Number[]} getSpan()
Returns the current angular dimensions of the field of view, in the format [horizontalSpan, verticalSpan]
, where horizontalSpan
is the horizontal field size in degrees, and verticalSpan
is the vertical field size in degrees.
lookAt
{panorama.Player} lookAt(point)
Rotates the view so that the passed point is in the center of the field of view.
Returns self-reference.
Parameters:
Parameter |
Default value |
Description |
— |
Type: Number[] The point to rotate the view at. It can be an array of two or three coordinates. The first two coordinates are interpreted as the geographical coordinates of the point. If three coordinates are passed, the third is interpreted as the height of the point relative to the panorama in meters. |
* Mandatory parameter/option.
moveTo
{vow.Promise} moveTo(point[, options])
Searches for a panorama with the specified parameters and opens it.
Returns a promise object that will be resolved if the panorama is found and successfully opened in the player, or rejected with an error message otherwise.
Parameters:
Parameter |
Default value |
Description |
— |
Type: Number[] The point for searching for nearby panoramas. |
|
— |
Type: Object Options. |
|
'auto' |
Type: Number[]|String Direction of view in the format |
|
'yandex#panorama' |
Type: String The layer to search for panoramas. There are two layers available:
|
|
'auto' |
Type: Number[]|String The angular dimensions of the field of view in the format |
* Mandatory parameter/option.
setDirection
{panorama.Player} setDirection(direction)
Sets a new viewing direction.
Returns self-reference.
Parameters:
Parameter |
Default value |
Description |
— |
Type: Number[]|String Direction of view in the format |
* Mandatory parameter/option.
setPanorama
{panorama.Player} setPanorama(panorama)
Opens the passed panorama in the player.
Returns self-reference.
Parameters:
Parameter |
Default value |
Description |
— |
Type: IPanorama Panorama. |
* Mandatory parameter/option.
setSpan
{panorama.Player} setSpan(span)
Sets new dimensions for the field of view.
Returns self-reference.
Parameters:
Parameter |
Default value |
Description |
|
— |
Type: Number[]|String The angular dimensions of the field of view in the format |
* Mandatory parameter/option.
Mandatory parameter/option.