fix(canvas): ensure beginPath is called on circle polygon paths to prevent stray connecting lines
This commit is contained in:
1 parent
56a088c83d
commit
69932db0b5
1 file changed
+2
-1
+2
-1
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user