Fixed raster thang types, and level destruction.

This commit is contained in:
Scott Erickson 2014-09-25 13:12:47 -07:00
parent 10314b8bfa
commit d77b87ed22
2 changed files with 5 additions and 2 deletions

View file

@ -35,8 +35,9 @@ module.exports = class Label extends CocoClass
true
build: ->
@layer.removeChild @background if @background
@layer.removeChild @label if @label
if @layer and not @layer.destroyed
@layer.removeChild @background if @background
@layer.removeChild @label if @label
@label = null
@background = null
return unless @text # null or '' should both be skipped

View file

@ -439,6 +439,7 @@ module.exports = LayerAdapter = class LayerAdapter extends CocoClass
# just give a placeholder
sprite = new createjs.Sprite(@spriteSheet)
sprite.placeholder = true
sprite.baseScaleX = sprite.baseScaleY = 1
else if cocoSprite.thangType.get('raster')
sprite = new createjs.Sprite(@spriteSheet)
@ -446,6 +447,7 @@ module.exports = LayerAdapter = class LayerAdapter extends CocoClass
sprite.regX = -reg.x
sprite.regY = -reg.y
sprite.gotoAndStop(@renderGroupingKey(cocoSprite.thangType))
sprite.baseScaleX = sprite.baseScaleY = 1
else
SpriteClass = if (cocoSprite.thangType.get('spriteType') or @defaultSpriteType) is 'segmented' then SegmentedSprite else SingularSprite