Last active
May 15, 2018 19:10
-
-
Save priithaamer/04d6ced8da681c8ab961437ccc77a281 to your computer and use it in GitHub Desktop.
Partial implementation of deck.gl TypeScript definitions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module 'deck.gl' { | |
import * as React from 'react'; | |
type HandlerInfo<T> = (info: { layer: BaseLayer<T>, index: number, object: T, x: number, y: number }) => boolean; | |
interface BaseLayerOptions<T> { | |
id?: string; | |
data?: T[]; | |
visible?: boolean; | |
opacity?: number; | |
pickable?: boolean; | |
onHover?: HandlerInfo<T>; | |
onClick?: HandlerInfo<T>; | |
} | |
interface IconDefinition { | |
x: number; | |
y: number; | |
width: number; | |
height: number; | |
anchorX?: number; | |
anchorY?: number; | |
mask?: boolean | |
} | |
interface IconMapping { | |
[key: string]: IconDefinition; | |
} | |
interface IconLayerOptions<T> extends BaseLayerOptions<T> { | |
iconAtlas: string; | |
iconMapping: IconMapping; | |
sizeScale?: number; | |
fp64?: boolean; | |
getPosition?: (data: T) => [number, number, number]; | |
getIcon?: (data: T) => string; | |
getSize?: (data: T) => number; | |
getColor?: (data: T) => [number, number, number]; | |
getAngle?: (data: T) => number; | |
} | |
export class AbstractLayer { } | |
export class BaseLayer<T> extends AbstractLayer { | |
constructor(props: BaseLayerOptions<T>); | |
} | |
export class IconLayer<T> extends BaseLayer<T> { | |
constructor(props: IconLayerOptions<T>); | |
} | |
interface DeckGLProperties { | |
id?: string; | |
width?: number; | |
height?: number; | |
latitude?: number; | |
longitude?: number; | |
zoom?: number; | |
bearing?: number; | |
pitch?: number; | |
layers: AbstractLayer[]; | |
style?: React.CSSProperties; | |
pickingRadius?: number; | |
pixelRatio?: number; | |
} | |
export default class DeckGL extends React.Component<DeckGLProperties> { } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment