diff --git a/src/circle/index.js b/src/circle/index.js index a61aa7e56..8c470a112 100644 --- a/src/circle/index.js +++ b/src/circle/index.js @@ -12,9 +12,9 @@ function format(rate) { return Math.min(Math.max(rate, 0), 100); } -function getPath(clockwise) { +function getPath(clockwise, viewBoxSize) { const sweepFlag = clockwise ? 1 : 0; - return `M 530 530 m 0, -500 a 500, 500 0 1, ${sweepFlag} 0, 1000 a 500, 500 0 1, ${sweepFlag} 0, -1000`; + return `M ${viewBoxSize / 2} ${viewBoxSize / 2} m 0, -500 a 500, 500 0 1, ${sweepFlag} 0, 1000 a 500, 500 0 1, ${sweepFlag} 0, -1000`; } export default createComponent({ @@ -72,7 +72,11 @@ export default createComponent({ }, path() { - return getPath(this.clockwise); + return getPath(this.clockwise, this.viewBoxSize); + }, + + viewBoxSize() { + return 1000 + this.strokeWidth; }, layerStyle() { @@ -154,7 +158,7 @@ export default createComponent({ render() { return (
- + {this.LinearGradient}
-
- - +
+ +
70%
@@ -17,33 +17,33 @@ exports[`renders demo correctly 1`] = `
宽度定制
-
- - +
+ +
颜色定制
-
+
- - + +
渐变色
-
- - +
+ +
逆时针
-
- - +
+ +
大小定制
diff --git a/src/circle/test/__snapshots__/index.spec.js.snap b/src/circle/test/__snapshots__/index.spec.js.snap index 81802911a..97dbfb718 100644 --- a/src/circle/test/__snapshots__/index.spec.js.snap +++ b/src/circle/test/__snapshots__/index.spec.js.snap @@ -1,15 +1,15 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`size prop 1`] = ` -
- - +
+ +
`; exports[`speed is 0 1`] = ` -
- - +
+ +
`;