diff options
Diffstat (limited to 'templates/_map.html.ep')
-rw-r--r-- | templates/_map.html.ep | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/templates/_map.html.ep b/templates/_map.html.ep index cceec01..daa16f0 100644 --- a/templates/_map.html.ep +++ b/templates/_map.html.ep @@ -1,6 +1,6 @@ <div class="row"> <div class="col s12"> - <div id="map" style="height: 500px;"> + <div id="map" style="height: 70vh;"> </div> </div> </div> @@ -8,7 +8,7 @@ <div class="row"> <div class="col s12"> <span style="color: #f03;">●</span> Ein-/Ausstiegsstation<br/> - <span style="color: #f09;">—</span> Luftlinie zwischen Unterwegshalten + <span style="color: #673ab7;">—</span> Streckenverlauf oder Luftlinie </div> </div> @@ -25,24 +25,30 @@ var stations = [ % } ]; -var routes = [ -% for my $pair ( @{stash('station_pairs') // [] } ) { -[[<%= $pair->[0][0] %>,<%= $pair->[0][1] %>],[<%= $pair->[1][0] %>,<%= $pair->[1][1] %>]], +var routes = []; +var pl; +% for my $line_group ( @{ stash('polyline_groups') // [] } ) { + routes = [ <%= $line_group->{polylines} %> ]; + pl = L.polyline(routes, {color: '<%= $line_group->{color} %>', opacity: <%= $line_group->{opacity} %>}).addTo(map); + % if ($line_group->{fit_bounds}) { + if (routes.length) { + map.fitBounds(pl.getBounds()); + } + % } +% } + +% if (my $b = stash('bounds')) { + map.fitBounds([[<%= $b->[0][0] %>,<%= $b->[0][1] %>],[<%= $b->[1][0] %>,<%= $b->[1][1] %>]]); % } -]; for (var station_id in stations) { L.circle(stations[station_id][0], { color: '#f03', + opacity: 0.7, fillColor: '#f03', fillOpacity: 0.5, radius: 250 }).bindPopup(stations[station_id][1]).addTo(map); } -var pl = L.polyline(routes, {color: '#f09', opacity: 0.5}).addTo(map); -if (routes.length) { - map.fitBounds(pl.getBounds()); -} - </script> |