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

Add support for polyline borders #203

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: was too lazy to test
canscaw28 committed Aug 28, 2022
commit 78843d332dbe457b41efbb6f968b1ef2076a3098
16 changes: 12 additions & 4 deletions src/MapViewDirections.js
Original file line number Diff line number Diff line change
@@ -92,9 +92,6 @@ class MapViewDirections extends Component {
precision = 'low',
timePrecision = 'none',
channel,
strokeWidth = 1,
strokeBorderWidth = 0,
strokeBorderColor = '#FFF',
} = props;

if (!apikey) {
@@ -310,9 +307,17 @@ class MapViewDirections extends Component {
...props
} = this.props;

const borderPolylineProps = {
...props,
strokeWidth: this.strokeBorderWidth + this.strokeWidth,
strokeColor: this.strokeBorderColor,
};

return (
<>
{strokeBorderWidth > 0 && <Polyline coordinates={coordinates} {...[...props, { strokeWidth: strokeBorderWidth + strokeWidth, strokeColor: strokeBorderColor}]} />}
{this.strokeBorderWidth > 0 &&
<Polyline coordinates={coordinates} {...borderPolylineProps} />
}
<Polyline coordinates={coordinates} {...props} />
</>
);
@@ -358,6 +363,9 @@ MapViewDirections.propTypes = {
precision: PropTypes.oneOf(['high', 'low']),
timePrecision: PropTypes.oneOf(['now', 'none']),
channel: PropTypes.string,
strokeWidth: PropTypes.number,
strokeBorderWidth: PropTypes.number,
strokeBorderColor: PropTypes.string,
};

export default MapViewDirections;