@@ -291,31 +291,30 @@ export class CodeRenderer {
291
291
const y = index * lineHeight ;
292
292
const isFirst = index === 0 ;
293
293
const isLast = index === lines . length - 1 ;
294
- const topRadius = isFirst ? "10" : "0" ;
295
- const bottomRadius = isLast ? "10" : "0" ;
294
+ const radius = 10 ;
296
295
// SVG notes:
297
296
// By default SVGs have anti-aliasing on.
298
297
// This is undesirable in our case because pixel-perfect alignment of these rectangles will introduce thin gaps.
299
298
// Turning it off with 'shape-rendering="crispEdges"' solves the issue.
300
299
return isFirst
301
300
? `<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 }
306
305
L ${ dimensions . width } ${ y + lineHeight }
307
306
Z"
308
307
fill="${ bgColor } " />`
309
308
: isLast
310
309
? `<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 }
314
313
Q ${ dimensions . width } ${ y + lineHeight } ${ dimensions . width } ${ y + lineHeight - 10 }
315
314
L ${ dimensions . width } ${ y }
316
315
Z"
317
316
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" />` ;
319
318
} )
320
319
. join ( "\n" ) ;
321
320
0 commit comments