Join us online - 19th of November
Save your spot
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

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:

splatModel.on("annotation:click", ({ annotation }) => {
  annotation.setColor("#e69439"); // mark as visited
});
splatModel.on("annotation:active", ({ annotation }) => {
  annotation.setPopup(`<p>Open until ${closingTime()}</p>`);
});
splatModel.on("annotation:inactive", ({ annotation }) => {
  annotation.setIcon("✔️");
});
document.querySelector("#show-pool")!.addEventListener("click", () => {
  pool.openPopup();
});
Index
  • Closes the annotation's popup, if it is open.

    Returns void

  • Returns the annotation body's color, if one was set.

    Returns Color | undefined

  • 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

    splatModel.on("annotation:click", ({ annotation }) => {
      const { rowId } = annotation.getData() as { rowId: number };
    });
    
  • Returns the emoji shown in the annotation, if any.

    Returns string | undefined

  • Returns the short string displayed in the annotation body (empty if none).

    Returns string

  • Returns the HTML string of the annotation's popup, if it has one.

    Returns string | undefined

  • Returns whether the annotation is currently active, i.e. its popup is open.

    Returns boolean

  • Returns whether the annotation was removed, by remove() or along with its SplatModel.

    Returns boolean

  • 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

  • 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

  • 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

  • Sets the annotation body's color, e.g. to mark annotations the user has already seen. undefined restores the default color. An unsupported color string is ignored (with a console warning), keeping the current color.

    Parameters

    Returns void

  • Replaces the custom data attached to the annotation, which may be anything.

    Parameters

    • Optionaldata: unknown

    Returns void

  • Sets the single emoji shown by itself while the annotation is collapsed (active), and prepended to the label text while it's expanded. undefined or an empty string shows no icon.

    Parameters

    • Optionalicon: string

    Returns void

  • Sets the short string displayed in the annotation body; the annotation resizes to fit it. undefined or an empty string shows no label.

    Parameters

    • Optionallabel: string

    Returns void

  • 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. undefined or 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

  • 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

    Returns void

    Error for an invalid position, like SplatModel.addAnnotation().

  • 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

Was this helpful?