adjustFrameWaitTime in Movie#stop

openid
Marcin Kulik 13 years ago
parent 07eeb1e81b
commit 0d77b843d3

@ -75,13 +75,19 @@ class AsciiIo.Movie
@nextFrame() @nextFrame()
stop: -> stop: ->
clearInterval @nextFrameTimeoutId
@playing = false @playing = false
@cancelNextFrameProcessing()
now = @now() now = @now()
@adjustFrameWaitTime(now)
@pausedAt = now
cancelNextFrameProcessing: ->
clearInterval @nextFrameTimeoutId
adjustFrameWaitTime: (now) ->
resumedAt = @resumedAt or @lastFrameAt resumedAt = @resumedAt or @lastFrameAt
currentWaitTime = now - resumedAt currentWaitTime = now - resumedAt
@totalFrameWaitTime += currentWaitTime @totalFrameWaitTime += currentWaitTime
@pausedAt = now
restart: -> restart: ->
@reset() @reset()

Loading…
Cancel
Save