Skip to content

Commit 5b3a8c5

Browse files
committed
Auto merge of #10239 - Turbo87:patch-1, r=ehuss
timings: Fix tick mark alignment ### Before <img width="1030" alt="Bildschirmfoto 2021-12-31 um 11 58 53" src="https://user-images.githubusercontent.com/141300/147819686-ce35da70-59d3-4174-b3c9-05e926260a4f.png"> ### After <img width="1032" alt="Bildschirmfoto 2021-12-31 um 11 58 23" src="https://user-images.githubusercontent.com/141300/147819683-a12d4387-dc30-40bc-aedc-c10fdac7e4e6.png">
2 parents 9af67cf + bd9b8f4 commit 5b3a8c5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/cargo/core/compiler/timings.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function render_pipeline_graph() {
5555

5656
// Draw Y tick marks.
5757
for (let n=1; n<units.length; n++) {
58-
const y = graph_height - (n * Y_TICK_DIST);
58+
const y = MARGIN + Y_TICK_DIST * n;
5959
ctx.beginPath();
6060
ctx.moveTo(X_LINE, y);
6161
ctx.lineTo(X_LINE-5, y);
@@ -64,8 +64,9 @@ function render_pipeline_graph() {
6464

6565
// Draw Y labels.
6666
ctx.textAlign = 'end';
67+
ctx.textBaseline = 'middle';
6768
for (let n=0; n<units.length; n++) {
68-
let y = MARGIN + (Y_TICK_DIST * (n + 1)) - 13;
69+
let y = MARGIN + Y_TICK_DIST * n + Y_TICK_DIST / 2;
6970
ctx.fillText(n+1, X_LINE-4, y);
7071
}
7172

@@ -108,12 +109,12 @@ function render_pipeline_graph() {
108109
}
109110
ctx.fillStyle = "#000";
110111
ctx.textAlign = 'start';
111-
ctx.textBaseline = 'hanging';
112+
ctx.textBaseline = 'middle';
112113
ctx.font = '14px sans-serif';
113114
const label = `${unit.name}${unit.target} ${unit.duration}s`;
114115
const text_info = ctx.measureText(label);
115116
const label_x = Math.min(x + 5.0, canvas_width - text_info.width - X_LINE);
116-
ctx.fillText(label, label_x, y + BOX_HEIGHT / 2 - 6);
117+
ctx.fillText(label, label_x, y + BOX_HEIGHT / 2);
117118
draw_dep_lines(ctx, unit.i, false);
118119
}
119120
ctx.restore();

0 commit comments

Comments
 (0)