MCPcopy Index your code
hub / github.com/rough-stuff/rough-notation / opsToPath

Function opsToPath

src/render.ts:239–265  ·  view source on GitHub ↗
(opList: OpSet[])

Source from the content-addressed store, hash-verified

237}
238
239function opsToPath(opList: OpSet[]): string[] {
240 const paths: string[] = [];
241 for (const drawing of opList) {
242 let path = '';
243 for (const item of drawing.ops) {
244 const data = item.data;
245 switch (item.op) {
246 case 'move':
247 if (path.trim()) {
248 paths.push(path.trim());
249 }
250 path = `M${data[0]} ${data[1]} `;
251 break;
252 case 'bcurveTo':
253 path += `C${data[0]} ${data[1]}, ${data[2]} ${data[3]}, ${data[4]} ${data[5]} `;
254 break;
255 case 'lineTo':
256 path += `L${data[0]} ${data[1]} `;
257 break;
258 }
259 }
260 if (path.trim()) {
261 paths.push(path.trim());
262 }
263 }
264 return paths;
265}

Callers 1

renderAnnotationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…