Skip to content

Commit

Permalink
Merge pull request #542 from antvis/fix_sector_with_only_one
Browse files Browse the repository at this point in the history
当只有1个扇形时,角度计算-6.285040585751744e-7和0,相减小于0.0001,也不绘制
  • Loading branch information
simaQ committed Apr 1, 2019
2 parents 1e6c194 + 337a95a commit d3f21b5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/f2",
"version": "3.3.7",
"version": "3.3.8",
"description": "Charts for mobile visualization.",
"keywords": [
"f2",
Expand Down
2 changes: 1 addition & 1 deletion src/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const Theme = require('./theme');
const Util = require('./util/common');

const Global = {
version: '3.3.7',
version: '3.3.8',
scales: {},
widthRatio: {
column: 1 / 2,
Expand Down
3 changes: 2 additions & 1 deletion src/graphic/shape/sector.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class Sector extends Shape {
context.moveTo(unitX * r0 + x, unitY * r0 + y);
context.lineTo(unitX * r + x, unitY * r + y);

if (Math.abs(endAngle - startAngle) > 0.0001) { // 当扇形的角度非常小的时候,就不进行弧线的绘制
// 当扇形的角度非常小的时候,就不进行弧线的绘制;或者整个只有1个扇形时,会出现end<0的情况不绘制
if (Math.abs(endAngle - startAngle) > 0.0001 || startAngle === 0 && endAngle < 0) {
context.arc(x, y, r, startAngle, endAngle, clockwise);
context.lineTo(Math.cos(endAngle) * r0 + x, Math.sin(endAngle) * r0 + y);
if (r0 !== 0) {
Expand Down

0 comments on commit d3f21b5

Please sign in to comment.