Skip to content

Commit 54dba67

Browse files
committed
Tilemap rendering sets initial state better
- phaserjs#1666 - previous alpha state could bleed through. Now the initial alpha and composite modes are set explicitly.
1 parent 283457a commit 54dba67

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/tilemap/TilemapLayer.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ Phaser.TilemapLayer.prototype.renderRegion = function (scrollX, scrollY, left, t
798798
var th = this._mc.tileHeight;
799799

800800
var tilesets = this._mc.tilesets;
801-
var lastAlpha = NaN;
801+
var lastAlpha = 1;
802802

803803
if (!this._wrap)
804804
{
@@ -827,7 +827,10 @@ Phaser.TilemapLayer.prototype.renderRegion = function (scrollX, scrollY, left, t
827827
// xmax/ymax - remaining cells to render on column/row
828828
var tx, ty, x, y, xmax, ymax;
829829

830+
// Restore assumed states
831+
context.globalAlpha = 1;
830832
context.fillStyle = this.tileColor;
833+
context.globalCompositeOperation = 'source-over';
831834

832835
for (y = normStartY, ymax = bottom - top, ty = baseY;
833836
ymax >= 0;

0 commit comments

Comments
 (0)