[Perf] Avoid iterating over keys to generate assert message (#486)
* Avoid iterating over keys to generate assert message * Move assertion call behind guard * Shorten line by using string template
This commit is contained in:
parent
2be3eae2aa
commit
6d01c482d8
|
@ -158,7 +158,9 @@ export class AtlasSprite extends BaseSprite {
|
|||
const scale = parameters.desiredAtlasScale;
|
||||
const link = this.linksByResolution[scale];
|
||||
|
||||
assert(link, "Link not known: " + scale + " (having " + Object.keys(this.linksByResolution) + ")");
|
||||
if (!link) {
|
||||
assert(false, `Link not known: ${scale} (having ${Object.keys(this.linksByResolution)})`);
|
||||
}
|
||||
|
||||
const scaleW = w / link.w;
|
||||
const scaleH = h / link.h;
|
||||
|
|
Reference in New Issue