mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-14 07:00:01 -04:00
Make it much less likely to get to frame 0, since that frame is often pretty weird.
This commit is contained in:
parent
41db27c709
commit
a1038af32b
2 changed files with 5 additions and 2 deletions
|
@ -258,7 +258,9 @@ module.exports = Surface = class Surface extends CocoClass
|
|||
createjs.Tween.removeTweens(@)
|
||||
@currentFrame = @scrubbingTo
|
||||
|
||||
@scrubbingTo = Math.min(Math.round(progress * (@world.frames.length - 1)), @world.frames.length - 1)
|
||||
@scrubbingTo = Math.round(progress * (@world.frames.length - 1))
|
||||
@scrubbingTo = Math.max @scrubbingTo, 1
|
||||
@scrubbingTo = Math.min @scrubbingTo, @world.frames.length - 1
|
||||
@scrubbingPlaybackSpeed = Math.sqrt(Math.abs(@scrubbingTo - @currentFrame) * @world.dt / (scrubDuration or 0.5))
|
||||
if scrubDuration
|
||||
t = createjs.Tween
|
||||
|
@ -402,7 +404,7 @@ module.exports = Surface = class Surface extends CocoClass
|
|||
@playing = (e ? {}).playing ? true
|
||||
@setPlayingCalled = true
|
||||
if @playing and @currentFrame >= (@world.totalFrames - 5)
|
||||
@currentFrame = 0
|
||||
@currentFrame = 1 # Go back to the beginning (but not frame 0, that frame is weird)
|
||||
if @fastForwardingToFrame and not @playing
|
||||
@fastForwardingToFrame = null
|
||||
|
||||
|
|
|
@ -210,6 +210,7 @@ module.exports = class LevelPlaybackView extends CocoView
|
|||
onProgressHover: (e, offsetX) ->
|
||||
timeRatio = @$progressScrubber.width() / @totalTime
|
||||
offsetX ?= e.clientX - $(e.target).closest('#timeProgress').offset().left
|
||||
offsetX = Math.max 0, offsetX
|
||||
@newTime = offsetX / timeRatio
|
||||
@updatePopupContent()
|
||||
@timePopup?.onHover e
|
||||
|
|
Loading…
Reference in a new issue