souplesse/frontend/src/Model.elm

37 lines
772 B
Elm
Raw Normal View History

2024-11-23 16:41:04 +00:00
module Model exposing
(
Model
, TrackState(..)
, DragState(..)
, empty
2024-11-23 16:41:04 +00:00
)
import TileMap exposing (ZoomLevel(..), Coord, toCoord)
2024-11-23 16:41:04 +00:00
import Point exposing (Point)
import Pos exposing (Pos)
2024-11-23 16:41:04 +00:00
type DragState =
DragMap (Int, Int) Coord
| DragGraph (Int, Int) Float
| DragLeftMark (Int, Int) Float
| DragRightMark (Int, Int) Float
2024-11-23 16:41:04 +00:00
type TrackState = Empty | Loading | Failure String | Present (List Point)
type alias Model =
{ centre: Coord
, zoom: ZoomLevel
, drag: Maybe DragState
2024-11-23 16:41:04 +00:00
, startTime : Float
, duration : Float
, leftMark : Float
, rightMark : Float
2024-11-23 16:41:04 +00:00
, track: TrackState }
empty = Model
(toCoord (Pos 0 0 Nothing))
(ZoomLevel 0)
Nothing
0 0
0 0
Loading