From fa0aeb4563457e529d51fae00f60643bea33c620 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 13 Sep 2016 13:03:47 +1200 Subject: [PATCH] Display render info values only when valid provided --- scripts/system/html/js/entityList.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/scripts/system/html/js/entityList.js b/scripts/system/html/js/entityList.js index 750352e6c4..e9075da3eb 100644 --- a/scripts/system/html/js/entityList.js +++ b/scripts/system/html/js/entityList.js @@ -135,11 +135,11 @@ function loaded() { const BYTES_PER_MEGABYTE = 1024 * 1024; function decimalMegabytes(number) { - if (number) { - return (number / BYTES_PER_MEGABYTE).toFixed(1); - } else { - return ""; - } + return number ? (number / BYTES_PER_MEGABYTE).toFixed(1) : ""; + } + + function displayIfNonZero(number) { + return number ? number : ""; } function addEntity(id, name, type, url, locked, visible, verticesCount, texturesCount, texturesSize, hasTransparent, @@ -150,9 +150,10 @@ function loaded() { if (entities[id] === undefined) { entityList.add([{ - id: id, name: name, type: type, url: filename, locked: locked, visible: visible, verticesCount: verticesCount, - texturesCount: texturesCount, texturesSize: decimalMegabytes(texturesSize), hasTransparent: hasTransparent, - drawCalls: drawCalls, hasScript: hasScript + id: id, name: name, type: type, url: filename, locked: locked, visible: visible, + verticesCount: displayIfNonZero(verticesCount), texturesCount: displayIfNonZero(texturesCount), + texturesSize: decimalMegabytes(texturesSize), hasTransparent: hasTransparent, + drawCalls: displayIfNonZero(drawCalls), hasScript: hasScript }], function (items) { var currentElement = items[0].elm;