Skip to content

Commit ee0a9a4

Browse files
committed
use radius instead of 10
1 parent f485442 commit ee0a9a4

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

core/codeRenderer/CodeRenderer.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -291,31 +291,30 @@ export class CodeRenderer {
291291
const y = index * lineHeight;
292292
const isFirst = index === 0;
293293
const isLast = index === lines.length - 1;
294-
const topRadius = isFirst ? "10" : "0";
295-
const bottomRadius = isLast ? "10" : "0";
294+
const radius = 10;
296295
// SVG notes:
297296
// By default SVGs have anti-aliasing on.
298297
// This is undesirable in our case because pixel-perfect alignment of these rectangles will introduce thin gaps.
299298
// Turning it off with 'shape-rendering="crispEdges"' solves the issue.
300299
return isFirst
301300
? `<path d="M ${0} ${y + lineHeight}
302-
L ${0} ${y + 10}
303-
Q ${0} ${y} ${10} ${y}
304-
L ${dimensions.width - 10} ${y}
305-
Q ${dimensions.width} ${y} ${dimensions.width} ${y + 10}
301+
L ${0} ${y + radius}
302+
Q ${0} ${y} ${radius} ${y}
303+
L ${dimensions.width - radius} ${y}
304+
Q ${dimensions.width} ${y} ${dimensions.width} ${y + radius}
306305
L ${dimensions.width} ${y + lineHeight}
307306
Z"
308307
fill="${bgColor}" />`
309308
: isLast
310309
? `<path d="M ${0} ${y}
311-
L ${0} ${y + lineHeight - 10}
312-
Q ${0} ${y + lineHeight} ${10} ${y + lineHeight}
313-
L ${dimensions.width - 10} ${y + lineHeight}
310+
L ${0} ${y + lineHeight - radius}
311+
Q ${0} ${y + lineHeight} ${radius} ${y + lineHeight}
312+
L ${dimensions.width - radius} ${y + lineHeight}
314313
Q ${dimensions.width} ${y + lineHeight} ${dimensions.width} ${y + lineHeight - 10}
315314
L ${dimensions.width} ${y}
316315
Z"
317316
fill="${bgColor}" />`
318-
: `<rect x="0" y="${y}" rx="10" ry="10" width="100%" height="${lineHeight}" fill="${bgColor}" shape-rendering="crispEdges" />`;
317+
: `<rect x="0" y="${y}" rx="${radius}" ry="${radius}" width="100%" height="${lineHeight}" fill="${bgColor}" shape-rendering="crispEdges" />`;
319318
})
320319
.join("\n");
321320

0 commit comments

Comments
 (0)