Skip to content

Commit

Permalink
Merge pull request #13 from 2gis/TILES-4788-add-extend-types
Browse files Browse the repository at this point in the history
TILES-4788 types add
  • Loading branch information
Kuznecoff authored Jan 23, 2023
2 parents 839591e + bad5207 commit 330204c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@2gis/deck2gis-layer",
"version": "1.1.3",
"version": "1.1.4",
"description": "",
"main": "dist/deck2gislayer.js",
"typings": "dist/types/index.d.ts",
Expand Down
21 changes: 17 additions & 4 deletions src/deckgl2gisLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,27 @@ import Texture from '2gl/Texture';
import type Vao from '2gl/Vao';
import type ShaderProgram from '2gl/ShaderProgram';

export type DeckInternalLayerProps = {
/**
* A class that extends deck.gl's base Layer class.
*/
export type DeckBaseLayer = any;

/**
* Deck2gisLayer layer props
*/
export interface DeckInternalLayerProps {
id: string;
renderingMode?: '2d' | '3d';
deck: Deck;
type: any;
type: DeckBaseLayer;
antialiasing?: boolean;
};
}

export type LayerProps<LayerT extends Layer> = Partial<LayerT['props']> & DeckInternalLayerProps;
/**
* LayerProps is type extends from Layer:
* https://deck.gl/docs/api-reference/core/layer
*/
export type LayerProps<LayerT extends Layer> = DeckInternalLayerProps & Partial<LayerT['props']>;

/**
* A class that provides rendering any deck.gl layer inside the MapGl canvas / WebGL context.
Expand Down Expand Up @@ -133,6 +145,7 @@ export class Deck2gisLayer<LayerT extends Layer> implements DeckCustomLayer {

/**
* Sets layer properties and updates the layer.
* @param props deck.gl layer properties.
*/
public setProps(props: Partial<LayerProps<LayerT>>) {
// id cannot be changed
Expand Down
4 changes: 4 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ export type CustomRenderInternalProps = {
_2gisData?: any;
};

/**
* CustomRenderProps is type extends from DeckProps:
* https://deck.gl/docs/api-reference/core/deck#properties
*/
export type CustomRenderProps = Partial<DeckProps> & CustomRenderInternalProps;

0 comments on commit 330204c

Please sign in to comment.