MCPcopy Create free account
hub / github.com/chartjs/Chart.js / pathFullCircle

Function pathFullCircle

src/elements/element.arc.ts:101–121  ·  view source on GitHub ↗
(
  ctx: CanvasRenderingContext2D,
  element: ArcElement,
  offset: number,
  spacing: number,
)

Source from the content-addressed store, hash-verified

99}
100
101function 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/**

Callers 1

pathArcFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected