From b1784a120795b2b3b725d0cb3ee0a8243f100d45 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Thu, 18 Sep 2014 11:12:18 -0700 Subject: [PATCH] Had apparently switched the SpriteBoss tests to use a regular Stage instead of a SpriteStage. Switched it back, and fixed a subsequent bug with the Layer responding to Camera events (apparently SpriteStage does not take regX/Y or scaleX/Y into account). --- app/lib/surface/Layer.coffee | 9 +-------- test/app/lib/surface/SpriteBoss.spec.coffee | 7 +++---- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/app/lib/surface/Layer.coffee b/app/lib/surface/Layer.coffee index c68127d65..2afb0bf48 100644 --- a/app/lib/surface/Layer.coffee +++ b/app/lib/surface/Layer.coffee @@ -74,14 +74,7 @@ layerProperties = { onZoomUpdated: (e) -> return unless e.camera is @camera - # TODO: move this to the new SpriteStage, because it's what needs to be transformed. - # This is a bit of a hack to get it to work for the time being. - if @parent and @transformStyle is layerClassProperties.TRANSFORM_CHILD - @parent.scaleX = @parent.scaleY = e.zoom - @parent.regX = e.surfaceViewport.x - @parent.regY = e.surfaceViewport.y - - if @transformStyle in [layerClassProperties.TRANSFORM_SURFACE, layerClassProperties.TRANSFORM_SURFACE_TEXT] + if @transformStyle in [layerClassProperties.TRANSFORM_SURFACE, layerClassProperties.TRANSFORM_SURFACE_TEXT, layerClassProperties.TRANSFORM_CHILD] change = @scaleX / e.zoom @scaleX = @scaleY = e.zoom @regX = e.surfaceViewport.x diff --git a/test/app/lib/surface/SpriteBoss.spec.coffee b/test/app/lib/surface/SpriteBoss.spec.coffee index e6abea2c3..505e0f44d 100644 --- a/test/app/lib/surface/SpriteBoss.spec.coffee +++ b/test/app/lib/surface/SpriteBoss.spec.coffee @@ -45,7 +45,7 @@ describe 'SpriteBoss', -> thangTypes = [treeThangType, ogreMunchkinThangType, ogreFangriderThangType, fullRenderOgreMunchkinThangType, fullRenderTreeThangType] # Build the Stage and SpriteBoss. - window.stage = stage = new createjs.Stage(canvas[0]) + window.stage = stage = new createjs.SpriteStage(canvas[0]) options = { camera: camera surfaceLayer: stage @@ -76,7 +76,7 @@ describe 'SpriteBoss', -> {id: 'Ogre S', spriteName: 'Ogre Munchkin M', exists: true, pos: {x:0, y:-8}, action: 'move', health: 5, maxHealth: 10, rotation: Math.PI/2, acts: true } # Set ogres side by side with different render strategies - {id: 'FROgre', spriteName: 'Full Render Ogre', exists: true, pos: {x:-10, y:-8}, action: 'idle', health: 10, maxHealth: 10, rotation: 0, acts: true } + {id: 'FROgre', spriteName: 'Full Render Ogre', exists: true, pos: {x:-10, y:-8}, action: 'idle', health: 10, maxHealth: 10, rotation: 0, acts: true, alpha: 0.5 } {id: 'NotFROgre', spriteName: 'Ogre Munchkin M', exists: true, pos: {x:-8, y:-8}, action: 'idle', health: 10, maxHealth: 10, rotation: 0, acts: true } # A line of ogres overlapping to test child ordering @@ -94,8 +94,7 @@ describe 'SpriteBoss', -> spriteBoss.update(true) defaultLayer.once 'new-spritesheet', -> done() - - showMe() # Uncomment to display this world when you run any of these tests. +# showMe() # Uncomment to display this world when you run any of these tests. beforeEach (done) -> init(done)