Loading lib/Travelynx/Controller/Traveling.pm +1 −1 Original line number Diff line number Diff line Loading @@ -431,7 +431,7 @@ sub map_history { push( @stations, uniq map { $_->{from_name} } @journeys ); @stations = uniq @stations; my @station_coordinates = map { $location{$_} } grep { exists $location{$_} } @stations; = map { [ $location{$_}, $_ ] } grep { exists $location{$_} } @stations; my @uniq_by_route = uniq_by { join( '|', map { $_->[0] } @{ $_->{route} } ) Loading templates/map.html.ep +8 −5 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { var stations = [ % for my $station ( @{stash('station_coordinates') // [] } ) { [<%= $station->[0] %>,<%= $station->[1] %>], [[<%= $station->[0][0] %>,<%= $station->[0][1] %>],'<%= $station->[1] %>'], % } ]; Loading @@ -25,14 +25,17 @@ var routes = [ ]; for (var station_id in stations) { L.circle(stations[station_id], { L.circle(stations[station_id][0], { color: '#f03', fillColor: '#f03', fillOpacity: 0.5, radius: 100 }).addTo(map); radius: 250 }).bindPopup(stations[station_id][1]).addTo(map); } L.polyline(routes, {color: '#f09', opacity: 0.5}).addTo(map); var pl = L.polyline(routes, {color: '#f09', opacity: 0.5}).addTo(map); if (routes.length) { map.fitBounds(pl.getBounds()); } </script> Loading
lib/Travelynx/Controller/Traveling.pm +1 −1 Original line number Diff line number Diff line Loading @@ -431,7 +431,7 @@ sub map_history { push( @stations, uniq map { $_->{from_name} } @journeys ); @stations = uniq @stations; my @station_coordinates = map { $location{$_} } grep { exists $location{$_} } @stations; = map { [ $location{$_}, $_ ] } grep { exists $location{$_} } @stations; my @uniq_by_route = uniq_by { join( '|', map { $_->[0] } @{ $_->{route} } ) Loading
templates/map.html.ep +8 −5 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { var stations = [ % for my $station ( @{stash('station_coordinates') // [] } ) { [<%= $station->[0] %>,<%= $station->[1] %>], [[<%= $station->[0][0] %>,<%= $station->[0][1] %>],'<%= $station->[1] %>'], % } ]; Loading @@ -25,14 +25,17 @@ var routes = [ ]; for (var station_id in stations) { L.circle(stations[station_id], { L.circle(stations[station_id][0], { color: '#f03', fillColor: '#f03', fillOpacity: 0.5, radius: 100 }).addTo(map); radius: 250 }).bindPopup(stations[station_id][1]).addTo(map); } L.polyline(routes, {color: '#f09', opacity: 0.5}).addTo(map); var pl = L.polyline(routes, {color: '#f09', opacity: 0.5}).addTo(map); if (routes.length) { map.fitBounds(pl.getBounds()); } </script>