commit f4a9314033d587225dc701515bce8c50ed4bf9b0
parent c10e5ea70ddc1358006723977f5f1928c1f81a99
Author: Daniel Barlow <dan@telent.net>
Date: Thu, 21 Nov 2024 11:56:51 +0000
render start/end marks on time axis
they don't do anything yet
Diffstat:
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git 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