From 1bc122aa05e7432a0bee8ecdee8efabd2a3a075b Mon Sep 17 00:00:00 2001 From: Mat Groves Date: Tue, 31 Dec 2013 18:06:09 +0000 Subject: [PATCH] fixed bug where sprites where always visible --- Gruntfile.js | 2 +- bin/pixi.dev.js | 3 +++ src/pixi/display/Sprite.js | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 90c64ba..af6a371 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -131,7 +131,7 @@ module.exports = function(grunt) { }, jshint: { options: { - jshintrc: '.jshintrc' + jshintrc: './.jshintrc' }, source: srcFiles.filter(function(v) { return v.match(/(Intro|Outro|Spine|Pixi)\.js$/) === null; }).concat('Gruntfile.js'), test: { diff --git a/bin/pixi.dev.js b/bin/pixi.dev.js index 70b5eda..0205fe9 100644 --- a/bin/pixi.dev.js +++ b/bin/pixi.dev.js @@ -1756,6 +1756,9 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession) PIXI.Sprite.prototype._renderCanvas = function(renderSession) { + // if the sprite is not visible or the alpha is 0 then no need to render this element + if(this.visible === false || this.alpha === 0)return; + if(this._mask) { renderSession.maskManager.pushMask(this._mask, renderSession.context); diff --git a/src/pixi/display/Sprite.js b/src/pixi/display/Sprite.js index 0c0c5ad..34fa410 100644 --- a/src/pixi/display/Sprite.js +++ b/src/pixi/display/Sprite.js @@ -299,6 +299,9 @@ PIXI.Sprite.prototype._renderWebGL = function(renderSession) PIXI.Sprite.prototype._renderCanvas = function(renderSession) { + // if the sprite is not visible or the alpha is 0 then no need to render this element + if(this.visible === false || this.alpha === 0)return; + if(this._mask) { renderSession.maskManager.pushMask(this._mask, renderSession.context);