1 | import { __assign } from "tslib";
|
2 | import { jsx } from '@antv/f-engine';
|
3 | import { deepMix } from '@antv/util';
|
4 | export default (function (props) {
|
5 | var _a = props.theme,
|
6 | theme = _a === void 0 ? {} : _a;
|
7 | var _b = deepMix(__assign({}, theme.line), props),
|
8 | coord = _b.coord,
|
9 | points = _b.points,
|
10 | style = _b.style,
|
11 | animation = _b.animation;
|
12 | var checkNaN = points.some(function (d) {
|
13 | return isNaN(d.x) || isNaN(d.y);
|
14 | });
|
15 | if (checkNaN) return null;
|
16 | var start = points[0] || {};
|
17 | var end = points[1] || {};
|
18 | var coordCenter = coord.center;
|
19 | var radius = Math.sqrt((start.x - coordCenter.x) * (start.x - coordCenter.x) + (start.y - coordCenter.y) * (start.y - coordCenter.y));
|
20 | var startAngle = Math.atan2(start.y - coordCenter.y, start.x - coordCenter.x);
|
21 | var endAngle = Math.atan2(end.y - coordCenter.y, end.x - coordCenter.x);
|
22 | return jsx("group", null, jsx("arc", {
|
23 | style: __assign({
|
24 | cx: coordCenter.x,
|
25 | cy: coordCenter.y,
|
26 | r: radius,
|
27 | startAngle: "".concat(startAngle, "rad"),
|
28 | endAngle: "".concat(endAngle, "rad")
|
29 | }, style),
|
30 | animation: animation
|
31 | }));
|
32 | }); |
\ | No newline at end of file |