Skip to content

Commit c819f0b

Browse files
committed
Merge pull request phaserjs#1642 from zekoff/tileset-render-fix
Fix row/col count formula.
2 parents ef5d7a9 + 510353f commit c819f0b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/tilemap/Tileset.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ Phaser.Tileset.prototype = {
214214
updateTileData: function (imageWidth, imageHeight) {
215215

216216
// May be fractional values
217-
var rowCount = (imageHeight - this.tileMargin) / (this.tileHeight + this.tileSpacing);
218-
var colCount = (imageWidth - this.tileMargin) / (this.tileWidth + this.tileSpacing);
217+
var rowCount = (imageHeight - this.tileMargin * 2 + this.tileSpacing) / (this.tileHeight + this.tileSpacing);
218+
var colCount = (imageWidth - this.tileMargin * 2 + this.tileSpacing) / (this.tileWidth + this.tileSpacing);
219219

220220
if (rowCount % 1 !== 0 || colCount % 1 !== 0)
221221
{

0 commit comments

Comments
 (0)