Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust Typings for Node Platform #871

Merged
merged 8 commits into from
Mar 10, 2023
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 102 additions & 5 deletions platform/node/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ declare module '@maplibre/maplibre-gl-native' {
*/
type RenderOptions = {
/**
* Zoom level
*
* @default 0
*/
zoom?: number;
Expand Down Expand Up @@ -111,19 +113,114 @@ declare module '@maplibre/maplibre-gl-native' {
class Map {
constructor(mapOptions: MapOptions);

/**
* Load a style into a map
*/
load: (style: any) => void;

/**
* Render a specific map view to an image with previously loaded map styles
* Render a specific map view to an image with previously loaded map styles with render options.
*/
render: (
renderOptions: RenderOptions,
callback: (...args: [error: Error, buffer: undefined] | [error: undefined, buffer: Uint8Array]) => void,
) => void;
render(renderOptions: RenderOptions, callback: (...args: [error: Error, buffer: undefined] | [error: undefined, buffer: Uint8Array]) => void): void;

/**
* Render a specific map view to an image with previously loaded map styles without render options.
*/
render(callback: (...args: [error: Error, buffer: undefined] | [error: undefined, buffer: Uint8Array]) => void): void;

/**
* Call to permanently dispose the internal map resources, instance can't be used for further render calls
*/
release: () => void;

/**
* Add source to map's style
*/
addSource: (sourceId: string, source: object) => void;

/**
* Remove source from map's style
*/
removeSource: (sourceId: string) => void;

/**
* Add layer to map's style
*/
addLayer: (layer: object, beforeId?: string) => void;

/**
* Remove layer from map's style
*/
removeLayer: (layerId: string) => void;

/**
* Add image to map's style
*/
addImage: (imageId: string, image: any) => void;

/**
* Remove image from map's style
*/
removeImage: (imageId: string) => void;

/**
* Set the extent of the zoom for a specified layer
*/
setLayerZoomRange: (layerId: string, minZoom: number, maxZoom: number) => void;

/**
* Set the value for a layer's property
*/
setLayoutProperty: (layerId: string, name: string, value: string) => void;

/**
* Set filter for specified style layer
*/
setFilter: (layerId: string, filter: [] | null | undefined) => void;

/**
* Set size of the tile
*/
setSize: (size: [number, number]) => void;

/**
* Set the center of the map
*/
setCenter: (center: [number, number]) => void;

/**
* Set zoom of the map
*/
setZoom: (zoom: number) => void;

/**
* Set bearing (rotation) of map
*/
setBearing: (bearing: number) => void;

/**
* Set pitch (tilt angle) of map
*/
setPitch: (pitch: number) => void;

/**
* Set light value of map
*/
setLight: (light: any) => void;

/**
* Set axonometric view of map
*/
setAxonometric: (state: boolean) => void;

/**
* Set X skew of map
*/
setXSkew: (x: number) => void;

/**
* Set Y skew of map
*/
setYSkew: (y: number) => void;
}
}