souplesse

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit ab3a5aaf9f4f0dcbfb748f018809f0a8f3ddf63b
parent f379d2d9b9cc1e5613ce18f8024b51239a70abf2
Author: Daniel Barlow <dan@telent.net>
Date:   Thu, 21 Nov 2024 16:05:47 +0000

use Pos instead of curried lat/long

Diffstat:
Mfrontend/src/Main.elm | 20+++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/frontend/src/Main.elm b/frontend/src/Main.elm @@ -80,11 +80,11 @@ type alias Lng = Float sec x = 1 / (cos x) -toCoord : Lat -> Lng -> Coord -toCoord lat lng = +toCoord : Pos -> Coord +toCoord pos = let - lat_rad = lat * pi / 180 - x = (lng + 180) / 360 + lat_rad = pos.lat * pi / 180 + x = (pos.lon + 180) / 360 y = (1 - (logBase e ((tan lat_rad) + (sec lat_rad))) / pi) / 2 in Coord x y @@ -166,7 +166,9 @@ init _ url navKey = Just (Timeline (Just s) (Just d)) -> (s, d) _ -> (10,10) in - ((Model (toCoord 0 0) (FineZoomLevel (1*8)) None 0 0 Empty), + ((Model + (toCoord (Pos 0 0 Nothing)) + (FineZoomLevel (1*8)) None 0 0 Empty), (fetchTrack start duration)) -- SUBSCRIPTIONS @@ -199,10 +201,6 @@ type Msg | Dribble String -coordFromPos p = - let {lat, lon } = p - in toCoord lat lon - update : Msg -> Model -> (Model, Cmd Msg) update msg model = (updateModel msg model, Cmd.none) @@ -248,7 +246,7 @@ updateModel msg model = in { model | track = Present trk - , centre = coordFromPos (Point.centre trk) + , centre = toCoord (Point.centre trk) , zoom = FineZoomLevel ( 13 * 8) , startTime = floor start , duration = ceiling duration @@ -492,7 +490,7 @@ eleView = measureView "elevation" "#4444ee" (.pos >> .ele) trackView : Int -> Int -> ZoomLevel -> List Point -> Svg Msg trackView leftedge topedge zoom points = let plot p = - let (x, y) = pixelFromCoord (toCoord p.pos.lat p.pos.lon) zoom + let (x, y) = pixelFromCoord (toCoord p.pos) zoom x_ = x - leftedge y_ = y - topedge in (String.fromInt x_) ++ ", " ++