@yandex/ymaps3-types
Version:
Types for ymaps3 maps library
32 lines (31 loc) • 1.07 kB
TypeScript
import type { YMap, YMapEntity } from "../../..";
import type { LngLat, WorldCoordinates, GenericPointFeature } from "../../../common/types";
/** Represents object on a map (either cluster or feature) */
type ClustererObject = {
world: WorldCoordinates;
lnglat: LngLat;
clusterId: string;
features: Feature[];
};
/** Feature to clusterize on a map */
type Feature = GenericPointFeature<LngLat>;
/** Cluster that contains cluster or feature and its sum of coordinates */
type Cluster = {
sumX: number;
sumY: number;
objects: ClustererObject[];
features: Feature[];
};
type ClustersCollection = Map<string, Cluster>;
/** Props for rendering */
type RenderProps = {
map: YMap;
features: Feature[];
};
/** Represents map of entities with its id */
type EntitiesMap = Record<string, YMapEntity<unknown> | undefined>;
/** Interface of method class*/
interface IClusterMethod {
render(props: RenderProps): ClustererObject[];
}
export type { EntitiesMap, ClustersCollection, ClustererObject, Feature, IClusterMethod, RenderProps };