Skip to content

Commit f485442

Browse files
committed
add bezier curves
1 parent 0443be2 commit f485442

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

core/codeRenderer/CodeRenderer.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ export class CodeRenderer {
214214
fontSize,
215215
fontFamily,
216216
lineHeight,
217+
dimensions,
217218
);
218219
const backgroundColor = this.getBackgroundColor(highlightedCodeHtml);
219220

@@ -231,7 +232,7 @@ export class CodeRenderer {
231232
${guts}
232233
</g>
233234
</svg>`;
234-
// console.log(svg);
235+
console.log(svg);
235236

236237
return Buffer.from(svg, "utf8");
237238
}
@@ -241,6 +242,7 @@ export class CodeRenderer {
241242
fontSize: number,
242243
fontFamily: string,
243244
lineHeight: number,
245+
dimensions: Dimensions,
244246
): { guts: string; lineBackgrounds: string } {
245247
const dom = new JSDOM(shikiHtml);
246248
const document = dom.window.document;
@@ -295,7 +297,25 @@ export class CodeRenderer {
295297
// By default SVGs have anti-aliasing on.
296298
// This is undesirable in our case because pixel-perfect alignment of these rectangles will introduce thin gaps.
297299
// Turning it off with 'shape-rendering="crispEdges"' solves the issue.
298-
return `<rect x="0" y="${y}" rx="${topRadius} ${topRadius} ${bottomRadius} ${bottomRadius}" width="100%" height="${lineHeight}" fill="${bgColor}" shape-rendering="crispEdges" />`;
300+
return isFirst
301+
? `<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}
306+
L ${dimensions.width} ${y + lineHeight}
307+
Z"
308+
fill="${bgColor}" />`
309+
: isLast
310+
? `<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}
314+
Q ${dimensions.width} ${y + lineHeight} ${dimensions.width} ${y + lineHeight - 10}
315+
L ${dimensions.width} ${y}
316+
Z"
317+
fill="${bgColor}" />`
318+
: `<rect x="0" y="${y}" rx="10" ry="10" width="100%" height="${lineHeight}" fill="${bgColor}" shape-rendering="crispEdges" />`;
299319
})
300320
.join("\n");
301321

extensions/vscode/src/activation/NextEditWindowManager.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ const SVG_CONFIG = {
3636
// "drop-shadow(0 2px 4px rgb(112, 114, 209)) drop-shadow(0 4px 8px rgb(136, 194, 163)) drop-shadow(0 6px 12px rgb(107, 166, 205));",
3737
// filter:
3838
// "drop-shadow(0 3px 6px rgba(112, 114, 209, 0.4)) drop-shadow(0 3px 6px rgba(136, 194, 163, 0.4)) drop-shadow(0 3px 6px rgba(107, 166, 205, 0.4));",
39+
// filter: `drop-shadow(4px 4px 0px rgba(112, 114, 209, 0.4))
40+
// drop-shadow(8px 8px 0px rgba(107, 166, 205, 0.3))
41+
// drop-shadow(12px 12px 0px rgba(136, 194, 163, 0.2));`,
3942
filter: `drop-shadow(4px 4px 0px rgba(112, 114, 209, 0.4))
40-
drop-shadow(8px 8px 0px rgba(107, 166, 205, 0.3))
41-
drop-shadow(12px 12px 0px rgba(136, 194, 163, 0.2));`,
43+
drop-shadow(-2px 4px 0px rgba(107, 166, 205, 0.3))
44+
drop-shadow(4px -2px 0px rgba(136, 194, 163, 0.2))
45+
drop-shadow(-2px -2px 0px rgba(112, 114, 209, 0.2));`,
4246
radius: 3,
4347
leftMargin: 40,
4448
defaultText: "",

0 commit comments

Comments
 (0)