Class: Hotspot

Hotspot(domElement, view, coords, opts)

A Hotspot allows a DOM element to be placed at a fixed position in the image. The position is updated automatically when the view changes.

Positioning is performed with the transform CSS property when available, falling back to the position, left and top properties when not. In both cases, the top left corner of the element is placed in the requested position; clients are expected to use additional children elements or other CSS properties to achieve more sophisticated layouts.

There are two kinds of hotspots: regular and embedded. A regular hotspot does not change size depending on the zoom level. An embedded hotspot is displayed at a fixed size relative to the panorama, always covering the same portion of the image.

Clients should call HotspotContainer#createHotspot instead of invoking the constructor directly.

Constructor

new Hotspot(domElement, view, coords, opts)

Parameters:
Name Type Description
domElement Element

The DOM element.

view View

The view.

coords Object

The hotspot coordinates. Use RectilinearViewCoords for a RectilinearView or FlatViewCoords for a FlatView.

opts Object

Additional options.

Properties
Name Type Description
perspective Object

Perspective options for embedded hotspots.

Properties
Name Type Attributes Default Description
radius number <optional>
null

If set, embed the hotspot into the image by transforming it into the surface of a sphere with this radius.

extraTransforms string <optional>
null

If set, append this value to the CSS transform property used to position the hotspot. This may be used to rotate an embedded hotspot.

Methods

destroy()

Destructor. Clients should call HotspotContainer#destroyHotspot instead.

domElement() → {Element}

Returns:
Type
Element

hide()

Hide the hotspot

perspective() → {Object}

Returns:
Type
Object

position() → {Object}

Returns:
Type
Object

setPerspective(perspective)

Parameters:
Name Type Description
perspective Object

setPosition(coords)

Parameters:
Name Type Description
coords Object

show()

Show the hotspot