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

Enhancement/polyline-arrow-symbol #36

Merged
merged 7 commits into from
Aug 23, 2024

Conversation

Ahmedhossamdev
Copy link
Member

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.

@Ahmedhossamdev
Copy link
Member Author

without-arrow

To

with-arrow

Copy link
Member

@aaronbrethorst aaronbrethorst left a 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!

src/components/map/RouteMap.svelte Outdated Show resolved Hide resolved
@@ -0,0 +1,4 @@
export const COLORS = {
Copy link
Collaborator

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.

Copy link
Member Author

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 = {
Copy link
Collaborator

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;
}

Copy link
Member Author

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.

Copy link
Collaborator

@tarunsinghofficial tarunsinghofficial left a 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.

Copy link
Member

@aaronbrethorst aaronbrethorst left a comment

Choose a reason for hiding this comment

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

Nice work! 👍

@aaronbrethorst aaronbrethorst merged commit 706f226 into main Aug 23, 2024
3 checks passed
@aaronbrethorst aaronbrethorst deleted the enhancement/polyline-arrow-symbol branch August 23, 2024 14:32
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