diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-07-27 17:52:41 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-07-27 17:52:41 +0200 |
commit | e54ddabe7f9f649812f6366eaa234ce0f38e7441 (patch) | |
tree | bc45ee8d3140000b6c544b0cfbd405b2bc8510da /lib/Travelynx.pm | |
parent | 6cab322100f88be57872dfec8575b3ceda9f0248 (diff) |
Fix polyline view in journey detail view for ring lines
Partially resolves #268 -- in map views that are not specific to a single
journey, the polyline will still be wrong.
Diffstat (limited to 'lib/Travelynx.pm')
-rwxr-xr-x | lib/Travelynx.pm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index bf999bc..607b153 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -2829,10 +2829,14 @@ sub startup { my $from_eva = $journey->{from_eva} // $journey->{dep_eva}; my $to_eva = $journey->{to_eva} // $journey->{arr_eva}; - my $from_index - = first_index { $_->[2] and $_->[2] == $from_eva } @polyline; - my $to_index - = first_index { $_->[2] and $_->[2] == $to_eva } @polyline; + # poly_dep_index, poly_arr_index are only available for + # journeys that were processed by get_travel_distance + # beforehand. However, they are much less error-prone than this + # first_index / last_index kludge when it comes to ring lines. + my $from_index = $journey->{poly_dep_index} + // first_index { $_->[2] and $_->[2] == $from_eva } @polyline; + my $to_index = $journey->{poly_arr_index} + // first_index { $_->[2] and $_->[2] == $to_eva } @polyline; # Work around inconsistencies caused by a multiple EVA IDs mapping to the same station name if ( $from_index == -1 ) { |