Class: Icon
- Last UpdatedMay 21, 2025
- 3 minute read
A visual representation of the H.map.Marker
.
Name | Type | Description |
---|---|---|
bitmap |
string | HTMLImageElement | HTMLCanvasElement |
An image URL, an SVG (string), an bitmap image or a canvas. |
opt_options |
H.map.Icon.Options |
optional
an object containing icon initialization attributes such as width and height, etc. |
Throws:
-
if size, anchor or hitArea is specified with invalid type or values
Extends
Members
-
The state types of an Icon
Properties:
Methods
-
addEventListener (type, handler, opt_capture, opt_scope) inherited
-
This method adds a listener for a specific event.
Note that to prevent potential memory leaks, you must either call
removeEventListener
ordispose
on the given object when you no longer need it. -
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
-
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
-
This method removes listeners from the given object. Classes that extend
EventTarget
may need to override this method in order to remove references to DOM Elements and additional listeners. -
getAnchor ()H.math.Point
-
Retrieves the anchor point of the given icon or
null
if an anchor was not specified in the constructor options and the state of this icon is notH.map.Icon.State.READY
.Returns:
Type Description H.math.Point -
Retrieves the bitmap of the give icon or
null
if the bitmap is not yet ready (seeH.map.Icon#getState
)Returns:
Type Description HTMLImageElement | HTMLCanvasElement -
getHitArea ()H.map.HitArea
-
Retrieves the hit area of the icon.
Returns:
Type Description H.map.HitArea The the hit area of the icon or null if no hit area is specified. -
getSize ()H.math.Size
-
Retrieves the size of the given icon or
null
if a size was not specified in the constructor options and the state of the icon is notH.map.Icon.State.READY
Returns:
Type Description H.math.Size -
getState ()H.map.Icon.State
-
Retrieves the bitmap loading state of the given icon object.
Returns:
Type Description H.map.Icon.State A value indicating the icon loading state. -
removeEventListener (type, handler, opt_capture, opt_scope) inherited
-
This method removes a previously added listener from the
EventTarget
instance.
Type Definitions
-
Options used to initialize an Icon object.
Properties:
Events
-
Event fired when the icon bitmap loading state changes, see
H.map.Icon#getState
Type: