Skip to content

Commit 927f4eb

Browse files
committed
fix: use arc instead of quadraticCurve for border radius of rect
apache/echarts#7023
1 parent 4361064 commit 927f4eb

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/graphic/helper/roundRect.js

+4-10
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,11 @@ export function buildPath(ctx, shape) {
7070
}
7171
ctx.moveTo(x + r1, y);
7272
ctx.lineTo(x + width - r2, y);
73-
r2 !== 0 && ctx.quadraticCurveTo(
74-
x + width, y, x + width, y + r2
75-
);
73+
r2 !== 0 && ctx.arc(x + width - r2, y + r2, r2, -Math.PI / 2, 0);
7674
ctx.lineTo(x + width, y + height - r3);
77-
r3 !== 0 && ctx.quadraticCurveTo(
78-
x + width, y + height, x + width - r3, y + height
79-
);
75+
r3 !== 0 && ctx.arc(x + width - r3, y + height - r3, r3, 0, Math.PI / 2);
8076
ctx.lineTo(x + r4, y + height);
81-
r4 !== 0 && ctx.quadraticCurveTo(
82-
x, y + height, x, y + height - r4
83-
);
77+
r4 !== 0 && ctx.arc(x + r4, y + height - r4, r4, Math.PI / 2, Math.PI);
8478
ctx.lineTo(x, y + r1);
85-
r1 !== 0 && ctx.quadraticCurveTo(x, y, x + r1, y);
79+
r1 !== 0 && ctx.arc(x + r1, y + r1, r1, Math.PI, Math.PI * 1.5);
8680
}

0 commit comments

Comments
 (0)