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

Function parsePadding

src/render.ts:32–56  ·  view source on GitHub ↗
(config: RoughAnnotationConfig)

Source from the content-addressed store, hash-verified

30}
31
32function parsePadding(config: RoughAnnotationConfig): FullPadding {
33 const p = config.padding;
34 if (p || (p === 0)) {
35 if (typeof p === 'number') {
36 return [p, p, p, p];
37 } else if (Array.isArray(p)) {
38 const pa = p as number[];
39 if (pa.length) {
40 switch (pa.length) {
41 case 4:
42 return [...pa] as FullPadding;
43 case 1:
44 return [pa[0], pa[0], pa[0], pa[0]];
45 case 2:
46 return [...pa, ...pa] as FullPadding;
47 case 3:
48 return [...pa, pa[1]] as FullPadding;
49 default:
50 return [pa[0], pa[1], pa[2], pa[3]];
51 }
52 }
53 }
54 }
55 return [5, 5, 5, 5];
56}
57
58export function renderAnnotation(svg: SVGSVGElement, rect: Rect, config: RoughAnnotationConfig, animationGroupDelay: number, animationDuration: number, seed: number) {
59 const opList: OpSet[] = [];

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…