clamp marks to visible time range

This commit is contained in:
Daniel Barlow 2024-11-27 17:52:49 +00:00
parent 621055e2df
commit 290edd1daf

View File

@ -113,8 +113,12 @@ dragUpdate model (newx, newy) =
in { model | centre = translate fromcoord (pixelsToCoord model.zoom t) }
Just (DragGraph (fromx,_) fromtime) ->
let time = secondsFromPixels model (fromx - newx)
startTime = fromtime + time
clampVisible = clamp startTime (startTime + model.duration)
in { model |
startTime = fromtime + time
startTime = startTime
, leftMark = clampVisible model.leftMark
, rightMark = clampVisible model.rightMark
}
Just (DragLeftMark (fromx,_) fromtime) ->
let time = secondsFromPixels model (fromx - newx)