diff --git a/frontend/src/Main.elm b/frontend/src/Main.elm index 0044b7f..5439295 100644 --- a/frontend/src/Main.elm +++ b/frontend/src/Main.elm @@ -7,6 +7,7 @@ import Html.Attributes as H exposing (src, style, width, height) import Html.Events exposing (onClick, on) import Html.Events.Extra.Pointer as Pointer import Maybe exposing (Maybe) +import Model exposing (..) import Lib exposing(..) import List.Extra exposing(find) import Json.Decode as D @@ -52,12 +53,6 @@ main = -- MODEL -type DragTarget = Map | Graph | StartMark | EndMark | NoTarget - -type Drag - = None - | Dragging DragTarget (Int, Int) (Int, Int) - dragTo : Drag -> (Int, Int) -> Drag dragTo d dest = @@ -76,16 +71,6 @@ dragDelta target d = subtractTuple (fx,fy) (tx,ty) = (fx-tx, fy-ty) -type TrackState = Empty | Loading | Failure String | Present (List Point) -type alias Model = - { centre: Coord - , zoom: FineZoomLevel - , drag: Drag - , startTime : Float - , duration : Float - , markedTime : (Float, Float) - , track: TrackState } - init : () -> Url -> Nav.Key -> (Model, Cmd Msg) init _ url navKey = let (start, duration) = diff --git a/frontend/src/Model.elm b/frontend/src/Model.elm new file mode 100644 index 0000000..3231fd7 --- /dev/null +++ b/frontend/src/Model.elm @@ -0,0 +1,26 @@ +module Model exposing + ( + Model + , TrackState(..) + , Drag(..) + , DragTarget(..) + ) +import TileMap exposing (FineZoomLevel, Coord) +import Point exposing (Point) + +type DragTarget = Map | Graph | StartMark | EndMark | NoTarget + +type Drag + = None + | Dragging DragTarget (Int, Int) (Int, Int) + +type TrackState = Empty | Loading | Failure String | Present (List Point) + +type alias Model = + { centre: Coord + , zoom: FineZoomLevel + , drag: Drag + , startTime : Float + , duration : Float + , markedTime : (Float, Float) + , track: TrackState }