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 range and marker to Directions tool #215

Merged
merged 3 commits into from
Mar 15, 2023
Merged

Conversation

michaelpnelson
Copy link
Contributor

This adds a UI control to direction options to allow input of a range as a positive integer. When a range value exists, the route planner now captures the point along the route where the range limit is met. The directions tool shows a new marker at the range limit point.

This adds a UI control to direction options to allow input of a range as a positive integer. When a range value exists, the route planner now captures the point along the route where the range limit is met. The directions tool now shows a new marker at the range limit point.
@michaelpnelson michaelpnelson requested a review from dgboss March 7, 2023 16:26
@michaelpnelson michaelpnelson self-assigned this Mar 7, 2023
@michaelpnelson michaelpnelson requested a review from rustyjux March 8, 2023 19:26
@rustyjux
Copy link
Contributor

Looks good overall.

I like how modifying range updates the range marker without needing to run the route again.

Marker dropshadow looks nice on the side it is on, but the marker white border doesn't have great contrast against the (current) light coloured basemap elsewhere.

Comment on lines +163 to +172
if (option.rangeKm > 0 && data.distance && option.rangeKm < data.distance) {
var distanceKm = 0;
for (var i = 0; i < data.route.length + 1; i += 1) {
distanceKm += turf.distance(data.route[i], data.route[i+1], {units: "kilometers"});
if (distanceKm >= option.rangeKm) {
data.rangeLimit = data.route[i];
break;
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I like. Seems like performance is fair (~2 s), even for long routes with longer ranges (750 km)

@@ -8,6 +8,8 @@
<template slot="commands">
</template>

<enter-input v-bind:value="rangeKm" v-on:change="!busy && $$emit('change', {rangeKm: $event});">Range (km)</enter-input>
Copy link
Contributor

Choose a reason for hiding this comment

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

We had talked about a slider before, but entering a numerical value is quick and easy to be precise. Though slider would maybe be preferable on mobile.

@michaelpnelson michaelpnelson merged commit d12434c into master Mar 15, 2023
@michaelpnelson michaelpnelson deleted the route_range_marker2 branch March 15, 2023 22:33
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