commit 86e99198250d3994ace03b4f16b708c743dba9af
parent 7f58809741bb715624d263f8ad88580ea022e5e4
Author: Daniel Barlow <dan@telent.net>
Date: Thu, 14 Nov 2024 15:07:33 +0000
rename type MapZoom -> ZoomLevel
Diffstat:
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/frontend/src/Main.elm b/frontend/src/Main.elm
@@ -53,7 +53,7 @@ main =
type alias Coord = { x: Float, y: Float }
-- zoom level
-type alias MapZoom = Int
+type alias ZoomLevel = Int
type alias TileNumber = { x: Int, y: Int }
@@ -86,20 +86,20 @@ reflect c = Coord -c.x -c.y
translate base offset =
{ base | x = (base.x + offset.x), y = (base.y + offset.y) }
-translatePixels : Coord -> MapZoom -> (Int, Int) -> Coord
+translatePixels : Coord -> ZoomLevel -> (Int, Int) -> Coord
translatePixels old z (x, y) = translate old (pixelsToCoord z (x, y))
-tileCovering : Coord -> MapZoom -> TileNumber
+tileCovering : Coord -> ZoomLevel -> TileNumber
tileCovering c z =
TileNumber (truncate (toFloat (2 ^ z) * c.x)) (truncate (toFloat (2 ^ z) * c.y))
-pixelFromCoord : Coord -> MapZoom -> (Int, Int)
+pixelFromCoord : Coord -> ZoomLevel -> (Int, Int)
pixelFromCoord c z =
let {x,y} = tileCovering c (z + 8)
in (x,y)
-boundingTiles : Coord -> MapZoom -> Int -> Int -> (TileNumber, TileNumber)
+boundingTiles : Coord -> ZoomLevel -> Int -> Int -> (TileNumber, TileNumber)
boundingTiles centre z width height =
-- find the tiles needed to cover the area (`width` x `height`)
-- about the point at `centre`
@@ -129,7 +129,7 @@ dragDelta d =
type TrackState = Empty | Loading | Failure String | Present (List Point)
type alias Model =
{ centre: Coord
- , zoom: MapZoom
+ , zoom: ZoomLevel
, drag: Drag
, startTime : Int
, duration : Int
@@ -223,7 +223,7 @@ newModel msg model =
-- VIEW
-tileUrl : TileNumber -> MapZoom -> String
+tileUrl : TileNumber -> ZoomLevel -> String
tileUrl {x,y} z =
String.concat ["https://a.tile.openstreetmap.org",
"/", String.fromInt z,
@@ -290,7 +290,7 @@ powerView = measureView "power" "#994444" (.power >> Maybe.map toFloat)
eleView = measureView "elevation" "#4444ee" (.pos >> .ele)
-trackView : Int -> Int -> MapZoom -> List Point -> Svg Msg
+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