You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently TileMap.createFromObjects only works when specifying either a gid, a name or an idea, but it does not allow for the usecase of just converting all objects in a layer into sprites.
if (obj.gid !== undefined && typeof id === 'number' && obj.gid === id ||
obj.id !== undefined && typeof id === 'number' && obj.id === id ||
obj.name !== undefined && typeof id === 'string' && obj.name === id)
{
found = true;
}
proposed fix:
If no ID is specified, do not filter, allowing all objects in the layer to be converted.
if (id == null || obj.gid !== undefined && typeof id === 'number' && obj.gid === id ||
obj.id !== undefined && typeof id === 'number' && obj.id === id ||
obj.name !== undefined && typeof id === 'string' && obj.name === id)
{
found = true;
}
Furthermore the code block seems somewhat problematic with it's imprecision (can't turn off the name or id matching, so even if a gid does not exist, it will return true because and id exists).
Thank you for submitting this feature request. We have implemented this and the feature has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.
Currently TileMap.createFromObjects only works when specifying either a gid, a name or an idea, but it does not allow for the usecase of just converting all objects in a layer into sprites.
if (obj.gid !== undefined && typeof id === 'number' && obj.gid === id ||
obj.id !== undefined && typeof id === 'number' && obj.id === id ||
obj.name !== undefined && typeof id === 'string' && obj.name === id)
{
found = true;
}
proposed fix:
If no ID is specified, do not filter, allowing all objects in the layer to be converted.
if (id == null || obj.gid !== undefined && typeof id === 'number' && obj.gid === id ||
obj.id !== undefined && typeof id === 'number' && obj.id === id ||
obj.name !== undefined && typeof id === 'string' && obj.name === id)
{
found = true;
}
Furthermore the code block seems somewhat problematic with it's imprecision (can't turn off the name or id matching, so even if a gid does not exist, it will return true because and id exists).
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: