| 99 | } |
| 100 | |
| 101 | function pathFullCircle( |
| 102 | ctx: CanvasRenderingContext2D, |
| 103 | element: ArcElement, |
| 104 | offset: number, |
| 105 | spacing: number, |
| 106 | ) { |
| 107 | const {x, y, startAngle: start, pixelMargin, innerRadius: innerR} = element; |
| 108 | const outerRadius = Math.max(element.outerRadius + spacing + offset - pixelMargin, 0); |
| 109 | const innerRadius = innerR > 0 ? innerR + spacing + offset + pixelMargin : 0; |
| 110 | |
| 111 | ctx.beginPath(); |
| 112 | ctx.arc(x, y, outerRadius, start, start + TAU); |
| 113 | |
| 114 | if (innerRadius > 0) { |
| 115 | // Start the inner contour as a separate subpath to avoid a seam connector. |
| 116 | ctx.moveTo(x + Math.cos(start) * innerRadius, y + Math.sin(start) * innerRadius); |
| 117 | ctx.arc(x, y, innerRadius, start + TAU, start, true); |
| 118 | } |
| 119 | |
| 120 | ctx.closePath(); |
| 121 | } |
| 122 | |
| 123 | |
| 124 | /** |