fix(canvas): ensure beginPath is called on circle polygon paths to prevent stray connecting lines

This commit is contained in:
Jannik committed 2026-08-08 15:38:11 +02:00
1 parent 56a088c83d
commit 69932db0b5
1 file changed
+2 -1
+2 -1
View File
@@ -392,16 +392,17 @@
// --- Helper: Polygon Path Generator ---
function drawPolygonPath(targetCtx, sides, radius, cornerRadius = 0) {
targetCtx.beginPath();
if (sides === 0) {
// Circle
targetCtx.arc(0, 0, radius, 0, Math.PI * 2);
targetCtx.closePath();
return;
}
const angleStep = (Math.PI * 2) / sides;
const startAngle = -Math.PI / 2; // Point top
targetCtx.beginPath();
for (let i = 0; i < sides; i++) {
const a = startAngle + i * angleStep;
const x = Math.cos(a) * radius;