Skip to content

Commit 6cc3845

Browse files
authored
Merge pull request #1987 from s7tya/fix-gray-border
Avoid showing gray rectangle when width is negative
2 parents de7ce9e + d3bebd0 commit 6cc3845

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

site/frontend/src/pages/compare/compile/table/benchmark-detail-graph.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,15 @@ function drawCurrentDate(opts: GraphRenderOpts, date: Date) {
161161
let ctx = u.ctx;
162162
const x = u.valToPos(date.getTime() / 1000, "x", true);
163163
164+
// Ignore if the width is negative
165+
const width = u.bbox.width - x + u.bbox.left;
166+
if (width <= 0) return;
167+
164168
// Draw a translucent rectangle representing the region that is more
165169
// recent than `date`.
166170
ctx.save();
167171
ctx.fillStyle = "rgba(0, 0, 0, 0.07)";
168-
ctx.rect(x, u.bbox.top, u.bbox.width - x + u.bbox.left, u.bbox.height);
172+
ctx.rect(x, u.bbox.top, width, u.bbox.height);
169173
ctx.fill();
170174
ctx.restore();
171175
},

site/frontend/src/pages/compare/runtime/benchmark-detail-graph.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,15 @@ function drawCurrentDate(opts: GraphRenderOpts, date: Date) {
151151
let ctx = u.ctx;
152152
const x = u.valToPos(date.getTime() / 1000, "x", true);
153153
154+
// Ignore if the width is negative
155+
const width = u.bbox.width - x + u.bbox.left;
156+
if (width <= 0) return;
157+
154158
// Draw a translucent rectangle representing the region that is more
155159
// recent than `date`.
156160
ctx.save();
157161
ctx.fillStyle = "rgba(0, 0, 0, 0.07)";
158-
ctx.rect(x, u.bbox.top, u.bbox.width - x + u.bbox.left, u.bbox.height);
162+
ctx.rect(x, u.bbox.top, width, u.bbox.height);
159163
ctx.fill();
160164
ctx.restore();
161165
},

0 commit comments

Comments
 (0)