Fixed the camera to not move around when the world is reset and being cast.

This commit is contained in:
Scott Erickson 2014-02-20 14:25:39 -08:00
parent 63ef2860d6
commit 5bda4d5e5f

View file

@ -164,16 +164,16 @@ module.exports = class Camera extends CocoClass
@zoomTo target, newZoom, 0
onLevelRestarted: ->
@setBounds(@firstBounds)
@setBounds(@firstBounds, false)
# COMMANDS
setBounds: (worldBounds) ->
setBounds: (worldBounds, updateZoom=true) ->
# receives an array of two world points. Normalize and apply them
@firstBounds = worldBounds unless @firstBounds
@bounds = @normalizeBounds(worldBounds)
@calculateMinZoom()
@updateZoom true
@updateZoom true if updateZoom
@target = @currentTarget unless @target.name
normalizeBounds: (worldBounds) ->