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

The DOM element inside which the container should be created.

stage Stage

The underlying stage.

view View

The view according to which the hotspots are positioned.

renderLoop RenderLoop

The render loop indicating when the hotspots must be rendered.

opts Object
Properties
Name Type Description
rect RectSpec

Rectangular region covered by the container. See Effects#rect.

Methods

createHotspot(domElement, coords, opts) → {Hotspot}

Creates a new hotspot in this container.

Parameters:
Name Type Description
domElement Element

DOM element to use for the hotspot

coords Object

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

opts Object

Options in the same format as the opts argument to the Hotspot constructor.

Returns:
Type
Hotspot

destroy()

Destructor.

destroyHotspot(hotspot)

Removes a hotspot from the container.

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, causing every contained Hotspot to be hidden.

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, causing every contained Hotspot to be shown.

Events

hotspotsChange

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