UNPKG

svelte-maplibre-gl

Version:

Build interactive web maps effortlessly with MapLibre GL JS and Svelte

57 lines (56 loc) 2.47 kB
import type * as maplibregl from 'maplibre-gl'; export declare function generateLayerID(): string; export declare function generateSourceID(): string; /** * Set an event listener on an Evented object, and return a function that will remove the listener. * * Intended to be used within the $effect rune. */ export declare function resetEventListener(evented: maplibregl.Evented | null | undefined, type: string, listener: maplibregl.Listener | undefined): () => void; /** * Set a Layer event listener on the Map object, and return a function that will remove the listener. * * Intended to be used within the $effect rune. */ export declare function resetLayerEventListener(map: maplibregl.Map | null, type: keyof maplibregl.MapLayerEventType, layer: string, listener: maplibregl.Listener | undefined): () => void; /** * Minimal view of MapLibre's internal camera transform that our reactive * bindings read from. */ interface CameraTransform { center: maplibregl.LngLat; zoom: number; bearing: number; pitch: number; roll: number; elevation: number; isPaddingEqual(padding: maplibregl.PaddingOptions): boolean; } /** * The object that holds MapLibre's internal camera state. * * - MapLibre 5.x: `Map extends Camera`, so these members live directly on `map`. * - MapLibre 6.x: `Map` owns a separate `Camera` at `map._camera` and delegates camera methods to it. */ interface MapCamera { transform: CameraTransform; transformCameraUpdate: maplibregl.CameraUpdateTransformFunction | null; getTransformForUpdate?: () => CameraTransform; _getTransformForUpdate?: () => CameraTransform; stop: () => unknown; _stop: (allowGestures?: boolean) => unknown; _bearingSnap: number; } /** * Returns whichever object actually carries MapLibre's internal camera state, * so the same call sites work on both MapLibre 5.x and 6.x. See {@link MapCamera}. */ export declare function getCamera(map: maplibregl.Map): MapCamera; /** * Reads the pending "desired state" camera transform, bridging the 5.x * `_getTransformForUpdate()` / 6.x `getTransformForUpdate()` rename. */ export declare function getUpdateTransform(camera: MapCamera): CameraTransform; export declare function setTransformCameraUpdate(map: maplibregl.Map, value: maplibregl.CameraUpdateTransformFunction | null): void; export declare function formatLngLat(target: maplibregl.LngLatLike, lnglat: maplibregl.LngLat): maplibregl.LngLatLike; export {};