Minor bugfix for freezing editor due to out of bounds frame index
This commit is contained in:
parent
5ec06159a6
commit
db0fc82eb0
1 changed files with 1 additions and 0 deletions
|
@ -502,6 +502,7 @@ module.exports = Surface = class Surface extends CocoClass
|
||||||
# Skip some frame updates unless we're playing and not at end (or we haven't drawn much yet)
|
# Skip some frame updates unless we're playing and not at end (or we haven't drawn much yet)
|
||||||
frameAdvanced = (@playing and @currentFrame < @world.totalFrames) or @totalFramesDrawn < 2
|
frameAdvanced = (@playing and @currentFrame < @world.totalFrames) or @totalFramesDrawn < 2
|
||||||
@currentFrame += @world.frameRate / @options.frameRate if frameAdvanced and @playing
|
@currentFrame += @world.frameRate / @options.frameRate if frameAdvanced and @playing
|
||||||
|
@currentFrame = Math.min(@currentFrame, @world.totalFrames - 1)
|
||||||
newWorldFrame = Math.floor @currentFrame
|
newWorldFrame = Math.floor @currentFrame
|
||||||
worldFrameAdvanced = newWorldFrame isnt oldWorldFrame
|
worldFrameAdvanced = newWorldFrame isnt oldWorldFrame
|
||||||
if worldFrameAdvanced
|
if worldFrameAdvanced
|
||||||
|
|
Reference in a new issue