From c03204a8aa4f28fd90bccdf2f132714a4e10508f Mon Sep 17 00:00:00 2001 From: Shen Yiming Date: Tue, 3 Dec 2019 16:42:02 +0800 Subject: [PATCH] fix: Fix prune index not working on id=0 object.id should be object.hasOwnProperty("id") to determin it's existence --- src/atlasify.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/atlasify.ts b/src/atlasify.ts index be46fc7..a2c6679 100644 --- a/src/atlasify.ts +++ b/src/atlasify.ts @@ -561,11 +561,11 @@ export class Atlasify { private pruneTagIndex (tagCount: { [index: string]: number; }) { for (let a of this._atlas) { const tag = a.tag ? a.tag : "_"; - if (tagCount[tag] < 1 && a.id) delete a.id; + if (tagCount[tag] < 1 && a.hasOwnProperty("id")) delete a.id; } for (let s of this._spritesheets) { const tag = s.tag ? s.tag : "_"; - if (tagCount[tag] < 1 && s.id) delete s.id; + if (tagCount[tag] < 1 && s.hasOwnProperty("id")) delete s.id; } } }