update mark positions while they're being dragged

This commit is contained in:
Daniel Barlow 2024-11-22 17:34:40 +00:00
parent 2c49318823
commit affe6cdc56

View File

@ -453,7 +453,6 @@ onDownWithTarget tag =
Html.Events.custom "pointerdown" decoder Html.Events.custom "pointerdown" decoder
timeAxis model points = timeAxis model points =
let graphHeight = 30 let graphHeight = 30
startTime = Maybe.withDefault 0 (Point.startTime points) startTime = Maybe.withDefault 0 (Point.startTime points)
@ -510,14 +509,15 @@ timeAxis model points =
, H.id "right-marker" , H.id "right-marker"
, strokeWidth "3" , strokeWidth "3"
] [] ] []
markStartPix = case model.markedTime of markStartPix =
(s, d) -> case model.markedTime of
floor ((s - startTime) * portalWidth/maxX) (s, d) ->
markEndPix = case model.markedTime of floor ((s - startTime) * portalWidth/maxX) - (Tuple.first (dragDelta StartMark model.drag))
(s, d) -> markEndPix =
ceiling ((s - startTime + d) * portalWidth/maxX) case model.markedTime of
(s, d) ->
ceiling ((s - startTime + d) * portalWidth/maxX) - (Tuple.first (dragDelta EndMark model.drag))
epos e = Tuple.mapBoth floor floor e.pointer.clientPos epos e = Tuple.mapBoth floor floor e.pointer.clientPos
in in
svg svg
[ width portalWidth [ width portalWidth