Class: HotspotContainer

HotspotContainer(parentDomElement, stage, view, renderLoop, opts)

Creates a DOM element to hold Hotspots and updates their position when necessary.

Constructor

new HotspotContainer(parentDomElement, stage, view, renderLoop, opts)

Parameters:
Name Type Description
parentDomElement Element

DOM element inside which the container is created

stage Stage

Used to calculate the size and position of the container.

Usually hotspots are associated to a Layer. That layer's stage should be passed in here.

view View

View with which Hotspots are positioned

renderLoop RenderLoop

HotspotContainer and Hotspots will be updated when this renderLoop renders.

opts Object
Properties
Name Type Description
rect Rect

Area that the container occupies. This is similar to Effects#rect and relative to stage's size.

Methods

createHotspot(domElement, position) → {Hotspot}

Add a hotspot to this container.

Parameters:
Name Type Description
domElement Element

DOM element to use for the hotspot

position Object

View parameters with the hotspot position. For RectilinearView it should have { pitch, yaw }.

Returns:
Type
Hotspot

destroy()

Destroy the instance

destroyHotspot(hotspot)

Parameters:
Name Type Description
hotspot Hotspot

domElement() → {Element}

Returns:
Type
Element

hasHotspot(hotspot) → {boolean}

Parameters:
Name Type Description
hotspot Hotspot
Returns:
Type
boolean

hide()

Hide the container's DOM element. This hides all Hotspot it contains.

listHotspots() → {Array.<Hotspot>}

Returns:
Type
Array.<Hotspot>

rect() → {Rect}

Returns:
Type
Rect

setRect(rect)

Parameters:
Name Type Description
rect Rect

show()

Show the container's DOM element.

Events

hotspotsChange

Signals that a hotspot has been created or destroyed on the container.