UNPKG

2.26 kBTypeScriptView Raw
1import * as React from 'react';
2import * as MapboxGL from 'mapbox-gl';
3export declare type Paint = MapboxGL.BackgroundPaint | MapboxGL.FillPaint | MapboxGL.FillExtrusionPaint | MapboxGL.SymbolPaint | MapboxGL.LinePaint | MapboxGL.RasterPaint | MapboxGL.CirclePaint;
4export declare type Layout = MapboxGL.BackgroundLayout | MapboxGL.FillLayout | MapboxGL.FillExtrusionLayout | MapboxGL.LineLayout | MapboxGL.SymbolLayout | MapboxGL.RasterLayout | MapboxGL.CircleLayout;
5export interface ImageOptions {
6 width?: number;
7 height?: number;
8 pixelRatio?: number;
9}
10export declare type ImageDefinition = [string, HTMLImageElement];
11export declare type ImageDefinitionWithOptions = [string, HTMLImageElement, ImageOptions];
12export declare type MouseEvent = (evt: any) => any;
13export interface LayerEvents {
14 onMouseMove?: MouseEvent;
15 onMouseEnter?: MouseEvent;
16 onMouseLeave?: MouseEvent;
17 onMouseDown?: MouseEvent;
18 onMouseUp?: MouseEvent;
19 onClick?: MouseEvent;
20 onTouchStart?: MouseEvent;
21 onTouchEnd?: MouseEvent;
22 onTouchCancel?: MouseEvent;
23}
24export interface LayerCommonProps {
25 type?: 'symbol' | 'line' | 'fill' | 'circle' | 'raster' | 'fill-extrusion' | 'background' | 'heatmap';
26 sourceId?: string;
27 images?: ImageDefinition | ImageDefinition[] | ImageDefinitionWithOptions | ImageDefinitionWithOptions[];
28 before?: string;
29 paint?: Paint;
30 layout?: Layout;
31 metadata?: any;
32 sourceLayer?: string;
33 minZoom?: number;
34 maxZoom?: number;
35 geoJSONSourceOptions?: MapboxGL.GeoJSONSourceOptions;
36 filter?: any[];
37 children?: JSX.Element | JSX.Element[];
38}
39export interface OwnProps {
40 id: string;
41 draggedChildren?: JSX.Element[];
42 map: MapboxGL.Map;
43}
44export declare type Props = LayerCommonProps & LayerEvents & OwnProps;
45export default class Layer extends React.Component<Props> {
46 static defaultProps: {
47 type: "symbol";
48 layout: {};
49 paint: {};
50 };
51 private source;
52 private geometry;
53 private makeFeature;
54 private initialize;
55 private onStyleDataChange;
56 componentDidMount(): void;
57 componentWillUnmount(): void;
58 componentDidUpdate(prevProps: Props): void;
59 getChildren: () => JSX.Element[];
60 render(): null;
61}