diff --git a/frontend/src/Main.elm b/frontend/src/Main.elm index 8c487cc..dc5c392 100644 --- a/frontend/src/Main.elm +++ b/frontend/src/Main.elm @@ -191,7 +191,7 @@ type Msg | Loaded (Result Http.Error (List Point)) | NewUrlRequest | UrlChanged - + | Dribble String update : Msg -> Model -> (Model, Cmd Msg) @@ -247,6 +247,9 @@ updateModel msg model = Err e -> { model | track = Debug.log "unknown error" (Failure "e") } NewUrlRequest -> model UrlChanged -> model + Dribble message -> + let _ = Debug.log "dribble" message + in model -- VIEW @@ -400,6 +403,9 @@ measureView title colour fn allPoints = , xtick 5 ] +timeClickDecoder = + D.map Dribble (D.at ["target", "id"] D.string) + timeAxis allPoints = let filteredPoints = Point.downsample 300 allPoints graphHeight = 30 @@ -439,13 +445,35 @@ timeAxis allPoints = , fill "#eef" , stroke "none" ] [] + markStart x = + let x1 = String.fromInt x + in Svg.path + [ S.d ("M " ++ x1 ++ " 40 " ++ + "v -50 h 10 v 10 h -10 v -10") + , fill "#7c7" + , stroke "#4e4" + , H.id "left-marker" + , strokeWidth "3" + ] [] + markEnd x = + let x1 = String.fromInt x + in Svg.path + [ S.d ("M " ++ x1 ++ " 40 " ++ + "v -50 h -10 v 10 h 10 v -10") + , fill "#c77" + , stroke "#e44" + , H.id "right-marker" + , strokeWidth "3" + ] [] in svg [ width portalWidth - , height graphHeight - , preserveAspectRatio "none" + , height (graphHeight + 20) + , on "pointerdown" timeClickDecoder + , viewBox ("0 -10 " ++ (String.fromInt portalWidth) ++ + " " ++ (String.fromInt (graphHeight + 10))) ] - (bg::xticks) + (bg::(markStart 22)::(markEnd 422)::xticks) cadenceView : List Point -> Svg Msg