Skip to content

Commit eb506e2

Browse files
committed
PIXI.Graphics in Canvas mode wouldn't respect the objects visible or alpha zero properties, rendering it regardless (thanks @TimvdEijnden phaserjs#1720)
1 parent bb8b0d0 commit eb506e2

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ Version 2.3.1 - "Katar" - in dev
269269
* P2.getConstraints would return an array of null objects. It now returns the raw p2 constraint objects (thanks @valueerrorx #1726)
270270
* TilemapLayer docs incorrectly reported it as extending Phaser.Image, but it doesn't share the same components so has been updated.
271271
* TilemapLayer was missing the Input component (thanks @uhe1231 #1700)
272+
* PIXI.Graphics in Canvas mode wouldn't respect the objects visible or alpha zero properties, rendering it regardless (thanks @TimvdEijnden #1720)
272273

273274
For changes in previous releases please see the extensive [Version History](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md).
274275

src/pixi/primitives/Graphics.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -749,10 +749,8 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
749749
*/
750750
PIXI.Graphics.prototype._renderCanvas = function(renderSession)
751751
{
752-
if (this.isMask === true)
753-
{
754-
return;
755-
}
752+
// if the sprite is not visible or the alpha is 0 then no need to render this element
753+
if (this.visible === false || this.alpha === 0 || this.isMask === true) return;
756754

757755
// if the tint has changed, set the graphics object to dirty.
758756
if (this._prevTint !== this.tint) {

0 commit comments

Comments
 (0)