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
4 changes: 2 additions & 2 deletions src/graphic/helper/roundSector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ export function buildPath(ctx: CanvasRenderingContext2D | PathProxy, shape: {
const { startAngle, endAngle, cx, cy, cornerRadius } = shape;

let arc = mathAbs(endAngle - startAngle);
const mod = arc && arc % PI2;
mod && (arc = mod);
const mod = arc > PI2 && arc % PI2;
mod > e && (arc = mod);

// is a point
if (!(radius > e)) {
Expand Down
46 changes: 46 additions & 0 deletions test/sector.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
}
}));

// should be collapsed to a line
zr.add(new zrender.Sector({
position: [100, 300],
scale: [1, 1],
Expand Down Expand Up @@ -174,6 +175,51 @@
cornerRadius: [0, 0, 35, 20]
}
}));

// should be a circle
zr.add(new zrender.Sector({
position: [650, 100],
scale: [1, 1],
style: {
stroke: 'black'
},
shape: {
startAngle: -1.570796326794896,
endAngle: 4.712388980384691,
r: 100,
// clockwise: false
}
}));

// should be collapsed to a line
zr.add(new zrender.Sector({
position: [650, 250],
scale: [1, 1],
style: {
stroke: 'black'
},
shape: {
startAngle: 1.0001,
endAngle: 1,
r: 100,
// clockwise: false
}
}));

// should be nearly a circle
zr.add(new zrender.Sector({
position: [650, 500],
scale: [1, 1],
style: {
stroke: 'black'
},
shape: {
startAngle: 1.0002,
endAngle: 1,
r: 100,
// clockwise: false
}
}));
</script>
<div id="main" style="width:1000px;height:800px;"></div>
</body>
Expand Down