mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
Solve the error when parsing tmx file on Web.
This commit is contained in:
@@ -152,7 +152,7 @@ cc.TMXTilesetInfo = cc._Class.extend(/** @lends cc.TMXTilesetInfo# */{
|
||||
rect.height = this._tileSize.height;
|
||||
gid &= cc.TiledMap.TileFlag.FLIPPED_MASK;
|
||||
gid = gid - parseInt(this.firstGid, 10);
|
||||
var max_x = parseInt((this.imageSize.width - this.margin * 2 + this.spacing) / (this._tileSize.width + this.spacing), 10);
|
||||
var max_x = parseInt((this.imageSize.width - this.margin + this.spacing) / (this._tileSize.width + this.spacing), 10);
|
||||
rect.x = parseInt((gid % max_x) * (this._tileSize.width + this.spacing) + this.margin, 10);
|
||||
rect.y = parseInt(parseInt(gid / max_x, 10) * (this._tileSize.height + this.spacing) + this.margin, 10);
|
||||
return rect;
|
||||
|
||||
Reference in New Issue
Block a user