UNPKG

terra-draw

Version:

Frictionless map drawing across mapping provider

45 lines (44 loc) 2.17 kB
import { Project, Unproject, SetCursor, GetLngLatFromEvent, TerraDrawChanges, TerraDrawStylingFunction, TerraDrawAdapterStyling } from "../common"; import { TerraDrawBaseAdapter, CustomStyling, TerraDrawBaseDrawMode } from "../extend"; import { TerraDrawExtend, GeoJSONStoreFeatures, BehaviorConfig } from "../terra-draw"; /** * A mock implementation of a custom adapter - this is to ensure that it is possible to write * custom adapters for Terra Draw exclusively relying on the public API of the library. */ export declare class TerraDrawTestAdapter extends TerraDrawBaseAdapter { constructor(config: { lib: Record<string, unknown>; } & TerraDrawExtend.BaseAdapterConfig); getMapEventElement(): HTMLElement; clear(): void; project(lng: number, lat: number): ReturnType<Project>; unproject(x: number, y: number): ReturnType<Unproject>; setCursor(_: "move" | "unset" | "grab" | "grabbing" | "crosshair" | "pointer" | "wait"): ReturnType<SetCursor>; getLngLatFromEvent(_: PointerEvent | MouseEvent): ReturnType<GetLngLatFromEvent>; setDraggability(_: boolean): void; setDoubleClickToZoom(_: boolean): void; render(_1: TerraDrawChanges, _2: TerraDrawStylingFunction): void; register(callbacks: TerraDrawExtend.TerraDrawCallbacks): void; unregister(): void; } /** * A mock implementation for a custom draw mode - this is to ensure that it is possible to write * custom draw modes for Terra Draw exclusively relying on the public API of the library. */ interface TerraDrawTestModeOptions<T extends CustomStyling> extends TerraDrawExtend.BaseModeOptions<T> { customProperty: string; } interface TestModeStyling extends CustomStyling { fillColor: TerraDrawExtend.HexColorStyling; outlineWidth: TerraDrawExtend.NumericStyling; } export declare class TerraDrawTestMode extends TerraDrawBaseDrawMode<TestModeStyling> { private customProperty; constructor(options?: TerraDrawTestModeOptions<TestModeStyling>); styleFeature(_: GeoJSONStoreFeatures): TerraDrawAdapterStyling; registerBehaviors(_: BehaviorConfig): void; start(): void; stop(): void; cleanUp(): void; } export {};