Skip to content

Commit df8c0d8

Browse files
committed
Calling Tilemap.renderDebug ignored the layer world position when drawing to the Graphics object. It will now translate to the layer position before drawing. Fix phaserjs#4061
1 parent 41920b0 commit df8c0d8

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* GameObjects added to and removed from Containers no longer listen for the `shutdown` event at all (thanks Vitali)
1212
* Sprites now have `preDestroy` method, which is called automatically by `destroy`. The method destroys the Animation component, unregistering the `remove` event in the process and freeing-up resources. Fix #4051 (thanks @Aveyder)
1313
* `Tilemap.setBaseTileSize` now sets the size into the LayerData `baseTileWidth` and `baseTileHeight` properties accordingly. Fix #4057 (thanks @imilo)
14+
* Calling `Tilemap.renderDebug` ignored the layer world position when drawing to the Graphics object. It will now translate to the layer position before drawing. Fix #4061 (thanks @Zax37)
1415

1516
### Examples, Documentation and TypeScript
1617

src/tilemaps/components/RenderDebug.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ var RenderDebug = function (graphics, styleConfig, layer)
4444

4545
var tiles = GetTilesWithin(0, 0, layer.width, layer.height, null, layer);
4646

47+
graphics.translate(layer.tilemapLayer.x, layer.tilemapLayer.y);
48+
4749
for (var i = 0; i < tiles.length; i++)
4850
{
4951
var tile = tiles[i];
@@ -54,6 +56,7 @@ var RenderDebug = function (graphics, styleConfig, layer)
5456
var y = tile.pixelY;
5557

5658
var color = tile.collides ? collidingTileColor : tileColor;
59+
5760
if (color !== null)
5861
{
5962
graphics.fillStyle(color.color, color.alpha / 255);
@@ -69,6 +72,7 @@ var RenderDebug = function (graphics, styleConfig, layer)
6972
if (faceColor !== null)
7073
{
7174
graphics.lineStyle(1, faceColor.color, faceColor.alpha / 255);
75+
7276
if (tile.faceTop) { graphics.lineBetween(x, y, x + tw, y); }
7377
if (tile.faceRight) { graphics.lineBetween(x + tw, y, x + tw, y + th); }
7478
if (tile.faceBottom) { graphics.lineBetween(x, y + th, x + tw, y + th); }

0 commit comments

Comments
 (0)