Fixed issue where visibility was not being respected in sprite batch

This commit is contained in:
Mat Groves 2014-02-23 18:44:14 +00:00
parent 8419c199df
commit d52f360f15
4 changed files with 15 additions and 6 deletions

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012-2014, Mat Groves
* http://goodboydigital.com/
*
* Compiled: 2014-02-17
* Compiled: 2014-02-23
*
* pixi.js is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php
@ -2171,6 +2171,9 @@ PIXI.SpriteBatch.prototype._renderCanvas = function(renderSession)
for (var i = 0; i < this.children.length; i++) {
var child = this.children[i];
if(!child.visible)continue;
var texture = child.texture;
var frame = texture.frame;
@ -7082,6 +7085,7 @@ PIXI.WebGLFastSpriteBatch.prototype.render = function(spriteBatch)
PIXI.WebGLFastSpriteBatch.prototype.renderSprite = function(sprite)
{
//sprite = children[i];
if(!sprite.visible)return;
// TODO trim??
if(sprite.texture.baseTexture !== this.currentBaseTexture)
@ -12080,7 +12084,8 @@ PIXI.Texture.addTextureToCache = function(texture, id)
PIXI.Texture.removeTextureFromCache = function(id)
{
var texture = PIXI.TextureCache[id];
PIXI.TextureCache[id] = null;
delete PIXI.TextureCache[id];
delete PIXI.BaseTextureCache[id];
return texture;
};

File diff suppressed because one or more lines are too long

View file

@ -109,6 +109,9 @@ PIXI.SpriteBatch.prototype._renderCanvas = function(renderSession)
for (var i = 0; i < this.children.length; i++) {
var child = this.children[i];
if(!child.visible)continue;
var texture = child.texture;
var frame = texture.frame;

View file

@ -122,6 +122,7 @@ PIXI.WebGLFastSpriteBatch.prototype.render = function(spriteBatch)
PIXI.WebGLFastSpriteBatch.prototype.renderSprite = function(sprite)
{
//sprite = children[i];
if(!sprite.visible)return;
// TODO trim??
if(sprite.texture.baseTexture !== this.currentBaseTexture)