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

GeoJson layer props #245

Merged
merged 3 commits into from
May 11, 2022
Merged

Conversation

wangxingkai
Copy link
Contributor

@wangxingkai wangxingkai commented Apr 19, 2022

  • Adapt props from sub-layers to GeoJson layer
  • Layer clone accepts partial props
  • Deck layers prop accepts falsy item
  • TileLayer getTileData returns Promise with falsy value
  • Add missing props to ScatterplotLayerProps. related to ScatterplotLayer types need updating #227
  • Add missing props to TextLayerProps

@@ -2198,7 +2198,7 @@ declare module '@deck.gl/core/lib/deck' {
// https://github.com/visgl/deck.gl/blob/e948740f801cf91b541a9d7f3bba143ceac34ab2/modules/react/src/deckgl.js#L71-L72
width: string | number;
height: string | number;
layers: Layer<any>[];
layers: (Layer<any> | undefined | null | false)[];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://deck.gl/docs/api-reference/core/deck#layers

Nested arrays are accepted, as well as falsy values (null, false, undefined).

@@ -925,7 +925,7 @@ declare module '@deck.gl/core/lifecycle/component' {
import { LayerContext } from '@deck.gl/core/lib/layer';
export default class Component<P> {
constructor(props: P, ...additionalProps: P[]);
clone(newProps: P): any;
clone(newProps?: Partial<P>): any;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://deck.gl/docs/api-reference/core/layer#clone

Create a copy of this layer, optionally change some prop values.

@@ -200,7 +200,7 @@ declare module '@deck.gl/geo-layers/tile-layer/tile-layer' {
url: string;
bbox: any;
signal: AbortSignal;
}) => D[] | Promise<D[]> | null;
}) => D[] | null | Promise<D[] | null>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://deck.gl/docs/api-reference/geo-layers/tile-layer#gettiledata

It should return either the tile data or a Promise that resolves to the tile data.

If signal is aborted, then throw or return falsy from getTileData so the data is not cached; do not return incomplete data.

as the getTileData could be sync or async function, so when it's an async function and in the falsy scenario, the return type should be Promise<null>.

Comment on lines +715 to +773
// Point Options
pointType?: string;

// pointType:circle Options (ScatterplotLayer Props)
/**
* @deprecated
* getRadius is deprecated since deck.gl v8.5, use {@link getPointRadius} instead
* */
getRadius?: ScatterplotLayerProps<D>['getRadius'];
getPointRadius?: ScatterplotLayerProps<D>['getRadius'];
pointRadiusUnits?: ScatterplotLayerProps<D>['radiusUnits'];
pointRadiusScale?: ScatterplotLayerProps<D>['radiusScale'];
pointRadiusMinPixels?: ScatterplotLayerProps<D>['radiusMinPixels'];
pointRadiusMaxPixels?: ScatterplotLayerProps<D>['radiusMaxPixels'];
pointAntialiasing?: ScatterplotLayerProps<D>['antialiasing'];
pointBillboard?: ScatterplotLayerProps<D>['billboard'];

// pointType:icon Options (IconLayer Props)
iconAtlas?: IconLayerProps<D>['iconAtlas'];
iconMapping?: IconLayerProps<D>['iconMapping'];
getIcon?: IconLayerProps<D>['getIcon'];
getIconSize?: IconLayerProps<D>['getSize'];
getIconColor?: IconLayerProps<D>['getColor'];
getIconAngle?: IconLayerProps<D>['getAngle'];
getIconPixelOffset?: IconLayerProps<D>['getPixelOffset'];
iconSizeUnits?: IconLayerProps<D>['sizeUnits'];
iconSizeScale?: IconLayerProps<D>['sizeScale'];
iconSizeMinPixels?: IconLayerProps<D>['sizeMinPixels'];
iconSizeMaxPixels?: IconLayerProps<D>['sizeMaxPixels'];
iconBillboard?: IconLayerProps<D>['billboard'];
iconAlphaCutoff?: IconLayerProps<D>['alphaCutoff'];

// pointType:text Options (TextLayer Props)
getText?: TextLayerProps<D>['getText'];
getTextColor?: TextLayerProps<D>['getColor'];
getTextAngle?: TextLayerProps<D>['getAngle'];
getTextSize?: TextLayerProps<D>['getSize'];
getTextAnchor?: TextLayerProps<D>['getTextAnchor'];
getTextAlignmentBaseline?: TextLayerProps<D>['getAlignmentBaseline'];
getTextPixelOffset?: TextLayerProps<D>['getPixelOffset'];
getTextBackgroundColor?: TextLayerProps<D>['getBackgroundColor'];
getTextBorderColor?: TextLayerProps<D>['getBorderColor'];
getTextBorderWidth?: TextLayerProps<D>['getBorderWidth'];
textSizeUnits?: TextLayerProps<D>['sizeUnits'];
textSizeScale?: TextLayerProps<D>['sizeScale'];
textSizeMinPixels?: TextLayerProps<D>['sizeMinPixels'];
textSizeMaxPixels?: TextLayerProps<D>['sizeMaxPixels'];
textCharacterSet?: TextLayerProps<D>['characterSet'];
textFontFamily?: TextLayerProps<D>['fontFamily'];
textFontWeight?: TextLayerProps<D>['fontWeight'];
textLineHeight?: TextLayerProps<D>['lineHeight'];
textMaxWidth?: TextLayerProps<D>['maxWidth'];
textWordBreak?: TextLayerProps<D>['wordBreak'];
textBackground?: TextLayerProps<D>['background'];
textBackgroundPadding?: TextLayerProps<D>['backgroundPadding'];
textOutlineColor?: TextLayerProps<D>['outlineColor'];
textOutlineWidth?: TextLayerProps<D>['outlineWidth'];
textBillboard?: TextLayerProps<D>['billboard'];
textFontSettings?: TextLayerProps<D>['fontSettings'];
Copy link
Contributor Author

@wangxingkai wangxingkai Apr 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +991 to +993
getBackgroundColor?: ((d: D) => RGBAColor) | RGBAColor;
getBorderColor?: ((d: D) => RGBAColor) | RGBAColor;
getBorderWidth?: ((d: D) => number) | number;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add missing props to TextLayerProps

Comment on lines +311 to +312
billboard?: boolean;
antialiasing?: boolean;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add missing props to ScatterplotLayerProps

@danmarshall
Copy link
Owner

Thanks! Is this ready to merge?

@wangxingkai
Copy link
Contributor Author

Yes, it's ready. Cheers

@danmarshall danmarshall merged commit b5f10a0 into danmarshall:master May 11, 2022
@danmarshall
Copy link
Owner

Thanks! Published 4.9.23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants