MCPcopy
hub / github.com/vercel/satori / parseEllipse

Function parseEllipse

src/parser/shape.ts:58–99  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

56 }
57 }
58 function parseEllipse(str: string) {
59 const res = str.match(regexMap['ellipse'])
60
61 if (!res) return null
62
63 const [, value] = res
64 const [radius, pos = ''] = value.split('at').map((v) => v.trim())
65 const [rx, ry] = radius.split(' ')
66 const { x, y } = resolvePosition(pos, width, height)
67
68 return {
69 type: 'ellipse',
70 rx: lengthToNumber(
71 rx || '50%',
72 inheritedStyle.fontSize as number,
73 width,
74 inheritedStyle,
75 true
76 ),
77 ry: lengthToNumber(
78 ry || '50%',
79 inheritedStyle.fontSize as number,
80 height,
81 inheritedStyle,
82 true
83 ),
84 cx: lengthToNumber(
85 x,
86 inheritedStyle.fontSize as number,
87 width,
88 inheritedStyle,
89 true
90 ),
91 cy: lengthToNumber(
92 y,
93 inheritedStyle.fontSize as number,
94 height,
95 inheritedStyle,
96 true
97 ),
98 }
99 }
100 function parsePath(str: string) {
101 const res = str.match(regexMap['path'])
102

Callers

nothing calls this directly

Calls 2

resolvePositionFunction · 0.85
lengthToNumberFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…