MCPcopy Create free account
hub / github.com/microsoft/TypeChat / renderBox

Function renderBox

typescript/examples/drawing/src/render.ts:35–39  ·  view source on GitHub ↗
(item: Box)

Source from the content-addressed store, hash-verified

33}
34
35function renderBox(item: Box): string {
36 const rounded = item.style?.corners === "rounded";
37 const text = item.text ? `<text x="${item.x + item.width / 2}" y="${item.y + item.height / 2}" text-anchor="middle" dominant-baseline="middle">${escapeXml(item.text)}</text>` : "";
38 return `<rect x="${item.x}" y="${item.y}" width="${item.width}" height="${item.height}"${rounded ? " rx=\"8\" ry=\"8\"" : ""} stroke="${stroke(item.style)}" stroke-width="${strokeWidth(item.style)}" fill="${fill(item.style)}" />${text}`;
39}
40
41function renderEllipse(item: Ellipse): string {
42 const cx = item.x + item.width / 2;

Callers 1

renderDrawingToSvgFunction · 0.85

Calls 4

escapeXmlFunction · 0.85
strokeFunction · 0.85
strokeWidthFunction · 0.85
fillFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…