Merge pull request #14638 from huffman/fix/entity-list-text-mb

Fix texture MB column not sorting correctly in entity list
This commit is contained in:
Ryan Huffman 2019-01-02 13:32:05 -08:00 committed by GitHub
commit f3d2d7c95b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,19 @@ const DELTA_X_MOVE_COLUMNS_THRESHOLD = 2;
const DELTA_X_COLUMN_SWAP_POSITION = 5;
const CERTIFIED_PLACEHOLDER = "** Certified **";
function decimalMegabytes(number) {
return number ? (number / BYTES_PER_MEGABYTE).toFixed(1) : "";
}
function displayIfNonZero(number) {
return number ? number : "";
}
function getFilename(url) {
let urlParts = url.split('/');
return urlParts[urlParts.length - 1];
}
const COLUMNS = {
type: {
columnHeader: "Type",
@ -79,6 +92,7 @@ const COLUMNS = {
dropdownLabel: "Texture Size",
propertyID: "texturesSize",
initialWidth: 0.10,
format: decimalMegabytes
},
hasTransparent: {
columnHeader: "",
@ -605,19 +619,6 @@ function loaded() {
}));
}
function decimalMegabytes(number) {
return number ? (number / BYTES_PER_MEGABYTE).toFixed(1) : "";
}
function displayIfNonZero(number) {
return number ? number : "";
}
function getFilename(url) {
let urlParts = url.split('/');
return urlParts[urlParts.length - 1];
}
function updateEntityData(entityData) {
entities = [];
entitiesByID = {};
@ -639,7 +640,7 @@ function loaded() {
certificateID: entity.certificateID,
verticesCount: displayIfNonZero(entity.verticesCount),
texturesCount: displayIfNonZero(entity.texturesCount),
texturesSize: decimalMegabytes(entity.texturesSize),
texturesSize: entity.texturesSize,
hasTransparent: entity.hasTransparent,
isBaked: entity.isBaked,
drawCalls: displayIfNonZero(entity.drawCalls),
@ -874,7 +875,11 @@ function loaded() {
if (column.data.glyph) {
elCell.innerHTML = itemData[column.data.propertyID] ? column.data.columnHeader : null;
} else {
elCell.innerHTML = itemData[column.data.propertyID];
let value = itemData[column.data.propertyID];
if (column.data.format) {
value = column.data.format(value);
}
elCell.innerHTML = value;
}
elCell.style = "min-width:" + column.widthPx + "px;" + "max-width:" + column.widthPx + "px;";
elCell.className = createColumnClassName(column.columnID);