Skip to content

Commit

Permalink
include tile weight (file size) in tile debug text (mapbox#7963)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewharvey authored and pirxpilot committed Jun 18, 2019
1 parent dce6e76 commit 49ba2cb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/render/draw_debug.js
Expand Up @@ -36,7 +36,10 @@ function drawDebugTile(painter, sourceCache, coord) {
debugUniformValues(posMatrix, Color.red), id,
painter.debugBuffer, painter.tileBorderIndexBuffer, painter.debugSegments);

const vertices = createTextVertices(coord.toString(), 50, 200, 5);
const tileRawData = sourceCache.getTileByID(coord.key).latestRawTileData;
const tileByteLength = (tileRawData && tileRawData.byteLength) || 0;
const tileSizeKb = Math.floor(tileByteLength / 1024);
const vertices = createTextVertices(`${coord.toString()} ${tileSizeKb}kb`, 50, 200, 5);
const debugTextArray = new PosArray();
const debugTextIndices = new LineIndexArray();
for (let v = 0; v < vertices.length; v += 2) {
Expand Down
Binary file modified test/integration/render-tests/debug/tile/expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions test/integration/render-tests/debug/tile/style.json
Expand Up @@ -7,8 +7,8 @@
}
},
"center": [
13.418056,
52.499167
13.425481,
52.496057
],
"zoom": 14,
"sources": {
Expand Down Expand Up @@ -49,4 +49,4 @@
}
}
]
}
}

0 comments on commit 49ba2cb

Please sign in to comment.