Skip to content

Commit 6a9fd4d

Browse files
committed
Debug.currentAlpha wasn't being used to set the alpha of the Debug context at all (was always set to 1) but now updates the alpha of the Debug context before anything is rendered to it (thanks @wayfu phaserjs#1888)
1 parent 06658fa commit 6a9fd4d

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
@@ -368,6 +368,7 @@ Version 2.4 - "Katar" - in dev
368368
* The Asset Pack JSON Format example has been updated to include new and missing file formats (thanks @rblopes #1808)
369369
* RenderTexture now takes the display objects alpha into consideration when rendering it, before it would always reset worldAlpha to 1 before rendering, thus ignoring any alpha that may be set.
370370
* P2.enableBody now checks if an anchor exists on target object before attempting to set its value (thanks @standardgaussian #1885)
371+
* Debug.currentAlpha wasn't being used to set the alpha of the Debug context at all (was always set to 1) but now updates the alpha of the Debug context before anything is rendered to it (thanks @wayfu #1888)
371372

372373
### Bug Fixes
373374

src/utils/Debug.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Phaser.Utils.Debug = function (game) {
7676
this.currentY = 0;
7777

7878
/**
79-
* @property {number} currentAlpha - The current alpha the debug information will be rendered at.
79+
* @property {number} currentAlpha - The alpha of the Debug context, set before all debug information is rendered to it.
8080
* @default
8181
*/
8282
this.currentAlpha = 1;
@@ -171,7 +171,6 @@ Phaser.Utils.Debug.prototype = {
171171
this.currentX = x;
172172
this.currentY = y;
173173
this.currentColor = color;
174-
this.currentAlpha = this.context.globalAlpha;
175174
this.columnWidth = columnWidth;
176175

177176
this.dirty = true;
@@ -181,7 +180,7 @@ Phaser.Utils.Debug.prototype = {
181180
this.context.strokeStyle = color;
182181
this.context.fillStyle = color;
183182
this.context.font = this.font;
184-
this.context.globalAlpha = 1;
183+
this.context.globalAlpha = this.currentAlpha;
185184

186185
},
187186

@@ -194,7 +193,6 @@ Phaser.Utils.Debug.prototype = {
194193
stop: function () {
195194

196195
this.context.restore();
197-
this.context.globalAlpha = this.currentAlpha;
198196

199197
},
200198

0 commit comments

Comments
 (0)