For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.
Class SplatAnnotation
Methods
closePopup
-
Closes the annotation's popup, if it is open.
Returns void
getColor
-
Returns the annotation body's color, if one was set.
Returns Color | undefined
getData
-
Returns the custom data attached to the annotation (see
AnnotationOptions.data), if any. It is returned as is - not copied - so modifying it in place modifies the annotation's data.Returns unknown
getIcon
-
Returns the emoji shown in the annotation, if any.
Returns string | undefined
getLabel
-
Returns the short string displayed in the annotation body (empty if none).
Returns string
getPopup
-
Returns the HTML string of the annotation's popup, if it has one.
Returns string | undefined
getPosition
-
Returns the annotation's position, in the form it was given in: relative to the SplatModel, or geographic (with its longitude as
lng, even if it was given aslon). See AnnotationPosition.Returns AnnotationPosition
isActive
-
Returns whether the annotation is currently active, i.e. its popup is open.
Returns boolean
isRemoved
-
Returns whether the annotation was removed, by
remove()or along with its SplatModel.Returns boolean
isVisible
-
Returns whether the annotation is visible, i.e. not hidden with
setVisible(false). This is unaffected by whether it is currently on screen.Returns boolean
openPopup
-
Opens the annotation's popup, as if the annotation was clicked, but without firing "annotation:click". Like a click, it closes any other open popup on the map first. Does nothing if the annotation has no popup, is already active, hidden or removed. The popup is only shown while the annotation is on screen.
Returns void
remove
-
Removes the annotation for good, closing its popup first if it is open. Afterwards, it is no longer shown, nor fires events, and this handle has no further effect. Does nothing if the annotation was already removed, including along with its SplatModel.
Returns void
setColor
-
Sets the annotation body's color, e.g. to mark annotations the user has already seen.
undefinedrestores the default color. An unsupported color string is ignored (with a console warning), keeping the current color.Parameters
Optionalcolor: Color
Returns void
setData
-
Replaces the custom data attached to the annotation, which may be anything.
Parameters
Optionaldata: unknown
Returns void
setIcon
-
Sets the single emoji shown by itself while the annotation is collapsed (active), and prepended to the label text while it's expanded.
undefinedor an empty string shows no icon.Parameters
Optionalicon: string
Returns void
setLabel
-
Sets the short string displayed in the annotation body; the annotation resizes to fit it.
undefinedor an empty string shows no label.Parameters
Optionallabel: string
Returns void
setPopup
-
Sets the HTML string of the popup that pops up when one clicks the annotation. If the popup is currently open, its content is replaced in place.
undefinedor an empty string removes the popup, closing it if it's open, so clicking the annotation no longer opens one.Parameters
Optionalhtml: string
Returns void
setPosition
-
Moves the annotation, to a position relative to the SplatModel or a geographic one (see AnnotationPosition) - either way, regardless of which kind it had before. An open popup moves along with it.
Parameters
- pos: AnnotationPosition
Returns void
setVisible
-
Shows or hides the annotation. Hiding it closes its popup if it is open, and a hidden annotation can't be clicked, nor its popup opened. Unlike
remove(), it can be shown again at any time.Parameters
- visible: boolean
Returns void
An annotation on a SplatModel, as returned by
SplatModel.addAnnotation(), and included in the SplatModel's "annotation:click", "annotation:active" and "annotation:inactive" events. Its position, label, icon, color, popup and custom data can be changed at any time, including while the popup is open - e.g. from within those event listeners. It can also be hidden, removed, and have its popup opened and closed from code:Example