-
Notifications
You must be signed in to change notification settings - Fork 4
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
Enhancement/polyline-arrow-symbol #36
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice addition. please move the code into the googleMaps.js file as indicated!
@@ -0,0 +1,4 @@ | |||
export const COLORS = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. Great you created the colors file separately. For better visibility, we can use the polyline arrow color as #8250DF
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome! I will try it
* @param {google.maps.Polyline} polyline - The polyline to which the arrow will be added. | ||
*/ | ||
export function addArrowToPolyline(polyline) { | ||
const arrowSymbol = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a check at the beginning of the function to validate the polyline
parameter will be great, right @Ahmedhossamdev @aaronbrethorst? Something like this:
if (!(polyline instanceof google.maps.Polyline)) {
console.error('Invalid polyline');
return;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that’s a great idea for checking the polyline parameter. Moving to TypeScript could also improve type safety and help as the project grows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done @Ahmedhossamdev. I have added my suggestions on some code lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! 👍
This PR introduces the addArrowToPolyline function, which adds a red arrow to a polyline on Google Maps like android app. This can help users easily see the direction of the bus, improving the overall ux. The arrow repeats every 50 pixels along the polyline, and it can be adjusted.