replace circles with polyline

This commit is contained in:
Daniel Barlow 2024-11-10 20:58:05 +00:00
parent 4bdd103bd5
commit dc46300f05

View File

@ -8,13 +8,14 @@ import Html.Events.Extra.Pointer as Pointer
import Maybe exposing (Maybe)
import Json.Decode as D
import Http
import Svg exposing (Svg, svg, rect, circle, g)
import Svg exposing (Svg, svg, rect, circle, g, polyline)
import Svg.Attributes as S exposing
( viewBox
, x, y
, r, rx, ry
, cx, cy
, fill
, points
, stroke, strokeWidth, strokeOpacity)
@ -221,8 +222,9 @@ trackView points leftedge topedge =
let (x, y) = pixelFromCoord (toCoord p.pos.lat p.pos.lon) 13
x_ = x - leftedge
y_ = y - topedge
in circle [ cx (px x_), cy (px y_), r "2" ] []
line = List.map plot points
in (String.fromInt x_) ++ ", " ++
(String.fromInt y_) ++ ", "
line = String.concat (List.map plot points)
in
svg
[ H.style "width" "100%"
@ -234,8 +236,13 @@ trackView points leftedge topedge =
, stroke "blue"
, strokeWidth "7"
, strokeOpacity "0.5"]
line
]
[
polyline
[ fill "none"
, S.points line
] []
]
]
px x = String.fromInt x ++ "px"