@yandex/ymaps3-types
Version:
Types for ymaps3 maps library
74 lines (73 loc) • 2.87 kB
TypeScript
import type { Matrix4 } from "./matrix";
import type { RasterLayerOptions } from "./layer-description";
import type { Vec2 } from "./vec2";
import type { Camera } from "./camera";
import type { WorldOptions } from "./world-options";
import type { GenericProjection } from "./projection";
import type { PixelCoordinates, WorldCoordinates } from "./coordinates";
interface WorldOffset {
readonly left: number;
readonly top: number;
readonly width: number;
readonly height: number;
}
interface LayerImplementationRenderProps {
size: PixelCoordinates;
}
interface RasterLayerImplementationRenderProps extends LayerImplementationRenderProps {
camera: Camera & {
fov: number;
};
worlds: WorldOffset[];
}
interface RasterLayerImplementation {
render(props: RasterLayerImplementationRenderProps): void;
findObjectInPosition?(coords: {
readonly worldCoordinates: WorldCoordinates;
readonly screenCoordinates: PixelCoordinates;
}): unknown | undefined | null;
destroy?(): void;
}
interface RasterLayerImplementationConstructorProps {
requestRender: () => void;
size: PixelCoordinates;
element: HTMLElement;
camera: Camera;
worldOptions: WorldOptions;
projection: GenericProjection<unknown>;
options?: RasterLayerOptions;
}
interface RasterLayerImplementationConstructor {
new (props: RasterLayerImplementationConstructorProps): RasterLayerImplementation;
}
interface VectorLayerImplementationRenderProps extends LayerImplementationRenderProps {
camera: Camera & {
fov: number;
};
worlds: {
lookAt: Vec2;
viewProjMatrix: Matrix4;
}[];
}
interface VectorLayerImplementation {
render(props: VectorLayerImplementationRenderProps): {
color: WebGLTexture;
depth?: WebGLTexture;
};
destroy(): void;
}
interface VectorLayerImplementationConstructor {
new (gl: WebGLRenderingContext, options: {
requestRender: () => void;
}): VectorLayerImplementation;
}
type LayerImplementationClassesProps<Mode extends 'raster' | 'vector' = 'raster' | 'vector'> = {
source: string;
type: string;
effectiveMode: Mode;
};
interface LayerImplementationClasses {
<Result extends RasterLayerImplementationConstructor = RasterLayerImplementationConstructor>(props: LayerImplementationClassesProps<'raster'>): Result;
<Result extends VectorLayerImplementationConstructor = VectorLayerImplementationConstructor>(props: LayerImplementationClassesProps<'vector'>): Result;
}
export { WorldOffset, RasterLayerImplementation, RasterLayerImplementationRenderProps, RasterLayerImplementationConstructor, RasterLayerImplementationConstructorProps, VectorLayerImplementation, VectorLayerImplementationRenderProps, VectorLayerImplementationConstructor, LayerImplementationClassesProps, LayerImplementationClasses };