From 0b1aa29f4154cec7a01fe24ff713dfd08a69e480 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Wed, 27 Nov 2024 18:43:56 +0000 Subject: [PATCH] highlight selection on map --- frontend/src/Main.elm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/frontend/src/Main.elm b/frontend/src/Main.elm index 3f0f12a..837b976 100644 --- a/frontend/src/Main.elm +++ b/frontend/src/Main.elm @@ -461,6 +461,17 @@ trackView leftedge topedge zoom selection points = in (String.fromInt x_) ++ ", " ++ (String.fromInt y_) ++ ", " line = String.concat (List.map plot points) + selectedPoints = + Maybe.map + (\(s, e) -> + List.filter (\p -> p.time >= s && p.time <= e) points) + selection + selectionLine = + case selectedPoints of + Just spoints -> + polyline [ S.points (String.concat (List.map plot spoints)) ] [] + Nothing -> g [] [] + in svg [ H.style "width" "100%" @@ -470,13 +481,15 @@ trackView leftedge topedge zoom selection points = [ g [ fill "none" , stroke "blue" - , strokeWidth "7" + , strokeWidth "5" , strokeOpacity "0.5"] [ polyline [ fill "none" - , S.points line + , S.points line ] [] + , g [ stroke "red", strokeWidth "7", strokeOpacity "0.9" ] + [ selectionLine ] ] ]