Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/graphic/helper/roundSector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,13 @@ export function buildPath(ctx: CanvasRenderingContext2D | PathProxy, shape: {
innerRadius = tmp;
}

const { startAngle, endAngle } = shape;
if (isNaN(startAngle) || isNaN(endAngle)) {
return;
}

const { cx, cy } = shape;
const clockwise = !!shape.clockwise;
const { startAngle, endAngle, cx, cy, cornerRadius } = shape;

let arc = mathAbs(endAngle - startAngle);
const mod = arc > PI2 && arc % PI2;
Expand Down Expand Up @@ -201,6 +206,7 @@ export function buildPath(ctx: CanvasRenderingContext2D | PathProxy, shape: {

const hasArc = arc > e;
if (hasArc) {
const cornerRadius = shape.cornerRadius;
if (cornerRadius) {
[icrStart, icrEnd, ocrStart, ocrEnd] = normalizeCornerRadius(cornerRadius);
}
Expand Down
15 changes: 15 additions & 0 deletions test/sector.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,21 @@
// clockwise: false
}
}));

// should show nothing
zr.add(new zrender.Sector({
position: [400, 650],
scale: [1, 1],
style: {
stroke: 'black',
lineWidth: 10
},
shape: {
startAngle: NaN,
endAngle: NaN,
r: 100
}
}));
</script>
<div id="main" style="width:1000px;height:800px;"></div>
</body>
Expand Down