extract Model module
This commit is contained in:
parent
d8180febe7
commit
33d59e1696
@ -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) =
|
||||
|
26
frontend/src/Model.elm
Normal file
26
frontend/src/Model.elm
Normal file
@ -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 }
|
Loading…
Reference in New Issue
Block a user