Class: InfoBubble

H.ui.InfoBubble

new H.ui.InfoBubble (position, opt_options)

This class represents an information bubble bound to a geographic position on the map.

Name Type Description
position H.geo.IPoint

The geographic location to which this info bubble corresponds

opt_options H.ui.InfoBubble.Options optional

An object containing optional initialization parameters to be passed to the info bubble

Extends

Members

H.ui.InfoBubble.State string static

This enumeration defines identifiers for the state applicable to an info bubble.

Properties:
Name Description
OPEN

This value represents the state where an info bubble is open and visible (value: 'open').

CLOSED

This value represents the state where an info bubble is closed and invisible (value: 'closed')

Methods

addClass (className)H.ui.base.Element inherited

This method adds a CSS class to the given UI element (if it is not already present).

Name Type Description
className string

The name of the CSS class to add

Returns:
Type Description
H.ui.base.Element The given UI element instance

addEventListener (type, handler, opt_capture, opt_scope) inherited

This method sets a listener for a specific event triggered by the given element.

Name Type Description
type string

The name of the event type

handler function

An event handler function to be invoked when the event is fired

opt_capture boolean optional

If true, listening is active in the capture phase (bubble otherwise)

opt_scope Object optional

The scope for the handler function

addOnDisposeCallback (callback, opt_scope) inherited

This method adds a callback which is triggered when the EventTarget object is being disposed.

Name Type Description
callback function

The callback function.

opt_scope Object optional

An optional scope for the callback function

close ()

This method closes the info bubble (setting its state to CLOSED).

dispatchEvent (evt) inherited

This method dispatches an event on the EventTarget object.

Name Type Description
evt H.util.Event | string

An object representing the event or a string with the event name

dispose () inherited overrides

This method disposes of the given InfoBubble instance.

Note: Disposing of an info bubble does not automatically remove it from the UI's info bubble collection. Please call H.ui.UI#removeBubble before disposing of an info bubble instance.

getContentElement ()HTMLElement

This method retrieves the content element of the info bubble object.

Note: The content element is null before the info bubble has been added to a UI object.

Returns:
Type Description
HTMLElement The content element of the given info bubble object

getData ()* inherited

This method retrieves previously stored arbitrary data from the given element.

Returns:
Type Description
* The previously stored data object or null if no data was stored.

getElement ()HTMLElement inherited

This method retrieves the HTML element that represents the given UI element.

Note: If the UI element has not been rendered, the method retrieves null.

Returns:
Type Description
HTMLElement An object representing the given element instance or null

This method retrieves the current state of the info bubble instance.

Returns:
Type Description
H.ui.InfoBubble.State A value indicating the current state of the info bubble

getVisibility ()boolean inherited

This method retrieves a value indicating if the given element is visibile.

Returns:
Type Description
boolean true if the given element is visible, otherwise false

isDisabled ()boolean inherited

This method retrieves a value indicating if the given UI element is disabled.

Returns:
Type Description
boolean true if the element is disabled, false otherwise

open ()

This method opens the info bubble (setting its state to OPEN).

removeClass (className)H.ui.base.Element inherited

This method removes a CSS class from the given UI element (if it is present).

Name Type Description
className string

The CSS class name to add

Returns:
Type Description
H.ui.base.Element The given UI element instance

removeEventListener (type, handler, opt_capture, opt_scope) inherited

This method removes a previously added listener from the event target.

Name Type Description
type string

The name of the event type

handler function

The previously added event handler

opt_capture boolean optional

If true, listening is active in the capture phase (bubble otherwise)

opt_scope Object optional

The scope for the handler function

renderInternal (element, doc) inherited overrides

This method is the concrete implementation of the UI element. It receives the pre-rendered HTML element which may be modified by deriving classes.

Name Type Description
element Element

The HTML representation of the given UI element

doc Document

The HTML document into which the give UI element is rendered

setContent (content)

This methods sets the content of the info bubble. This can either be a string (applied as innerHTML) to the content element of the given info bubble or an HTML node to be appended to the content element.

Name Type Description
content string | Node

An object representing the content for the given bubble

setData (data) inherited

This method stores arbitrary data with the given UI element.

Name Type Description
data *

The data to be stored

setDisabled (opt_disabled, opt_force)H.ui.base.Element inherited

This method sets a value indicating if the given UI element is disabled.

Name Type Description
opt_disabled boolean optional

true to disable the element, false to enable it. Default is false

opt_force boolean optional

An optional Boolean flag indicating that the value should be set and propagated even if it is the same as the current state

Returns:
Type Description
H.ui.base.Element An object representing the given element instance

setPosition (position)

This method sets the geographic location of the given info bubble.

Name Type Description
position H.geo.IPoint | H.geo.Point

An object defining the geographic location of the bubble

setState (state)

This method sets the state of the info bubble.

Name Type Description
state H.ui.InfoBubble.State

A value indicating the new state of the info bubble

setTabIndex (tabIndex) inherited

This method sets the tabIndex of the element. See https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex for more details.

Name Type Description
tabIndex number

setVisibility (visibility) inherited

This method sets a value indicating if the given element is visible.

Name Type Description
visibility boolean

true if the given element is visible, otherwise false

Type Definitions

H.ui.InfoBubble.Options Object

This typedef defines the configuration (initialization) properties of an InfoBubble instance.

Properties:
Name Type Argument Description
onStateChange function <optional>

A callback to be invoked when the sate of the info bubble changes

content string | Node

The content to be added to the info bubble

Events

statechange overrides

This event is dispatched when the state of the bubble has changed.

Type: