Skip to content

Commit 37366aa

Browse files
committed
Website: smoothly select rows in bar chart
If you scrub your cursor slowly down the benchmark chart, the benchmark table appears to flicker. This is because, if the cursor is between two chart rows, no row is selected, so every row of the table is saturated. Fix this issue by removing the cursor dead zones between chart rows. This commit in theory shouldn't change the visuals, but it does move things around slightly (at least in Firefox). As best as I could, I tried to change the hit boxes while keeping everything the same size as before.
1 parent 3f012df commit 37366aa

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

website/public/benchmarks/benchmark.css

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ body.javascript .javascript-only {
3939
.chart {
4040
--x-axis-label-line-height: 1.4em;
4141
overflow: hidden;
42+
padding-top: 0.25em;
4243
position: relative;
4344

4445
/* Make space for the "0 ms" and "1000 ms" labels. */
@@ -47,18 +48,16 @@ body.javascript .javascript-only {
4748
padding-left: var(--chart-padding-left);
4849
padding-right: var(--chart-padding-right);
4950

50-
/* Force bottom and top margins of .series to show by setting a non-zero
51-
padding-bottom and padding-top. */
52-
padding-top: 0.1px;
53-
5451
/* Make room for X-axis labels. */
55-
padding-bottom: calc(var(--x-axis-label-line-height) * 3);
52+
padding-bottom: calc(var(--x-axis-label-line-height) * 3 + 0.25em);
5653
}
5754

5855
.chart .series {
59-
height: 1.75em;
60-
line-height: 1.75em;
61-
margin: 0.25em 0;
56+
--series-vertical-padding: 0.125em;
57+
58+
height: 1.625em;
59+
line-height: 1.625em;
60+
padding: var(--series-vertical-padding) 0;
6261
position: relative;
6362
width: 100%;
6463

@@ -67,9 +66,9 @@ body.javascript .javascript-only {
6766
}
6867

6968
.chart .series .label {
70-
bottom: 0;
69+
bottom: var(--series-vertical-padding);
7170
position: absolute;
72-
top: 0;
71+
top: var(--series-vertical-padding);
7372
padding-left: 0.5em;
7473
padding-right: 0.5em;
7574
}
@@ -108,10 +107,10 @@ body.javascript .javascript-only {
108107
}
109108

110109
.chart .series .bar {
111-
bottom: 0;
110+
bottom: var(--series-vertical-padding);
112111
left: 0;
113112
position: absolute;
114-
top: 0;
113+
top: var(--series-vertical-padding);
115114
width: calc(
116115
100% * (var(--average-x) / var(--chart-max-x)) - var(--border-width)
117116
);

0 commit comments

Comments
 (0)