mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
[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 scale = parameters.desiredAtlasScale;
|
||||||
const link = this.linksByResolution[scale];
|
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 scaleW = w / link.w;
|
||||||
const scaleH = h / link.h;
|
const scaleH = h / link.h;
|
||||||
|
Loading…
Reference in New Issue
Block a user