Skip to content

Commit

Permalink
include tile weight (file size) in tile debug text (#7963)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewharvey authored Mar 1, 2019
1 parent a7eb83e commit 434d03d
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,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
Loading
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
Original file line number Diff line number Diff line change
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 434d03d

Please sign in to comment.