Permalink
Browse files

adjustFrameWaitTime in Movie#stop

  • Loading branch information...
1 parent 07eeb1e commit 0d77b843d3f9ef21ad6882576d5ddb3c0402cb0e @sickill sickill committed Apr 15, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 app/assets/javascripts/player/movie.js.coffee
@@ -75,13 +75,19 @@ class AsciiIo.Movie
@nextFrame()
stop: ->
- clearInterval @nextFrameTimeoutId
@playing = false
+ @cancelNextFrameProcessing()
now = @now()
+ @adjustFrameWaitTime(now)
+ @pausedAt = now
+
+ cancelNextFrameProcessing: ->
+ clearInterval @nextFrameTimeoutId
+
+ adjustFrameWaitTime: (now) ->
resumedAt = @resumedAt or @lastFrameAt
currentWaitTime = now - resumedAt
@totalFrameWaitTime += currentWaitTime
- @pausedAt = now
restart: ->
@reset()

0 comments on commit 0d77b84

Please sign in to comment.