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

specify types for defaultProps in PathMarkerLayer #2655

Merged
merged 3 commits into from
Feb 11, 2019

Conversation

XiaokaiUber
Copy link
Contributor

For #2477

Background

In PathMarkerLayer, the defaultProps don't have types specified. We need to specify types for those props.

Change List

  • Add type to the defaultProps in the PathMarkerLayer

note: tested in layer browser

@@ -22,18 +22,21 @@ const defaultProps = Object.assign({}, PathOutlineLayer.defaultProps, {
MarkerLayer: DEFAULT_MARKER_LAYER,
markerLayerProps: DEFAULT_MARKER_LAYER_PROPS,

sizeScale: 100,
sizeScale: {type: 'number', value: 100, min: 1},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is min 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can be 0.

getMarkerPercentages: (object, {lineLength}) =>
lineLength > DISTANCE_FOR_MULTI_ARROWS ? [0.25, 0.5, 0.75] : [0.5]
getPath: {type: 'accessor', value: x => x.path},
getColor: {type: 'accessor', value: x => x.color},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this prop used anywhere?

Copy link
Contributor Author

@XiaokaiUber XiaokaiUber Feb 8, 2019

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Look again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is not used. I removed it

getPath: {type: 'accessor', value: x => x.path},
getColor: {type: 'accessor', value: x => x.color},
getMarkerColor: {type: 'accessor', value: [0, 0, 0, 255]},
getDirection: {type: 'accessor', value: x => x.direction},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this have to be a function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's changed to a const

@XiaokaiUber XiaokaiUber force-pushed the specify-types-for-defaultProps-path-marker-layer branch from 0510130 to 4251e35 Compare February 9, 2019 00:11
getMarkerPercentages = x => [0.5],
getDirection = DEFAULT_DIRECTION,
getColor = DEFAULT_COLOR,
getMarkerPercentages = [0.5],
Copy link
Collaborator

Choose a reason for hiding this comment

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

You're using this as a function but the default value is a constant

@XiaokaiUber XiaokaiUber merged commit 832835a into master Feb 11, 2019
@XiaokaiUber XiaokaiUber deleted the specify-types-for-defaultProps-path-marker-layer branch February 11, 2019 22:34
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.

3 participants