From 5b9c7dc8a775f9f4ba28c9e8c39b90351443d3ca Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Fri, 26 Sep 2014 13:02:01 -0700 Subject: [PATCH] Removed layer's cache function (wasn't used before webgl factoring anyway?). Removed TRANSFORM_CHILD layer transform setting. --- app/lib/surface/LayerAdapter.coffee | 16 +++------------- app/lib/surface/SpriteBoss.coffee | 2 +- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/app/lib/surface/LayerAdapter.coffee b/app/lib/surface/LayerAdapter.coffee index b453dbc3d..20651007d 100644 --- a/app/lib/surface/LayerAdapter.coffee +++ b/app/lib/surface/LayerAdapter.coffee @@ -30,10 +30,9 @@ module.exports = LayerAdapter = class LayerAdapter extends CocoClass # Intermediary between a Surface Stage and a top-level static normal Container or hot-swapped WebGL SpriteContainer. # It handles zooming in different ways and, if webGL, creating and assigning spriteSheets. - @TRANSFORM_CHILD: 'child' # Layer transform is managed by its parents @TRANSFORM_SURFACE: 'surface' # Layer moves/scales/zooms with the Surface of the World @TRANSFORM_SURFACE_TEXT: 'surface_text' # Layer moves with the Surface but is size-independent - @TRANSFORM_SCREEN: 'screen' # Layer stays fixed to the screen (different from child?) + @TRANSFORM_SCREEN: 'screen' # Layer stays fixed to the screen # WebGL properties actionRenderState: null @@ -60,7 +59,7 @@ module.exports = LayerAdapter = class LayerAdapter extends CocoClass @defaultSpriteType = if @name is 'Default' then 'segmented' else 'singular' @customGraphics = {} @layerPriority = options.layerPriority ? 0 - @transformStyle = options.transform ? LayerAdapter.TRANSFORM_CHILD + @transformStyle = options.transform ? LayerAdapter.TRANSFORM_SURFACE @camera = options.camera @updateLayerOrder = _.throttle @updateLayerOrder, 1000 / 30 # Don't call multiple times in one frame; 30 FPS is probably good enough @@ -111,7 +110,7 @@ module.exports = LayerAdapter = class LayerAdapter extends CocoClass onZoomUpdated: (e) -> return unless e.camera is @camera - if @transformStyle in [LayerAdapter.TRANSFORM_SURFACE, LayerAdapter.TRANSFORM_SURFACE_TEXT, LayerAdapter.TRANSFORM_CHILD] + if @transformStyle in [LayerAdapter.TRANSFORM_SURFACE, LayerAdapter.TRANSFORM_SURFACE_TEXT] change = @container.scaleX / e.zoom @container.scaleX = @container.scaleY = e.zoom if @webGL @@ -124,15 +123,6 @@ module.exports = LayerAdapter = class LayerAdapter extends CocoClass child.scaleX *= change child.scaleY *= change - #- Caching - - cache: -> - return if @webGL - return unless @children.length - bounds = @container.getBounds() - return unless bounds - @container.cache bounds.x, bounds.y, bounds.width, bounds.height, 2 - #- Container-like child functions addChild: (children...) -> diff --git a/app/lib/surface/SpriteBoss.coffee b/app/lib/surface/SpriteBoss.coffee index 7703f0649..a0e1b770b 100644 --- a/app/lib/surface/SpriteBoss.coffee +++ b/app/lib/surface/SpriteBoss.coffee @@ -64,7 +64,7 @@ module.exports = class SpriteBoss extends CocoClass ['Default', 0] ['Floating', 10] ] - @spriteLayers[name] = new LayerAdapter name: name, webGL: true, layerPriority: priority, transform: LayerAdapter.TRANSFORM_CHILD, camera: @camera + @spriteLayers[name] = new LayerAdapter name: name, webGL: true, layerPriority: priority, transform: LayerAdapter.TRANSFORM_SURFACE, camera: @camera @webGLStage.addChild (spriteLayer.container for spriteLayer in _.values(@spriteLayers))... layerForChild: (child, sprite) ->