Reference · Markers on the globe
MarkerEventDetailtype
What the chikyu-marker-hover, chikyu-marker-click and chikyu-marker-focus events carry in event.detail. A cluster click has marker: null and cluster listing the ids in it.
Import it
import type { MarkerEventDetail } from "@johnmorrisdotca/chikyu-earth/markers";
Definition
interface MarkerEventDetail {
marker: MarkerInput | null;
cluster?: string[];
x: number;
y: number;
}
Members
| Name | Type | Description |
|---|---|---|
marker | MarkerInput | null | |
cluster (optional) | string[] | undefined | |
x | number | Where the pointer or the marker is, in CSS pixels inside the globe's box. |
y | number |
Examples
import type { MarkerEventDetail } from "@johnmorrisdotca/chikyu-earth/markers";
const on = (event: Event): void => {
const detail = (event as CustomEvent<MarkerEventDetail>).detail;
console.log(detail.marker?.label ?? `${detail.cluster?.length} places`, detail.x, detail.y);
};
console.log(typeof on);functionWhat it prints (run when this page was built)