1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.getAnglePoint = exports.getFactTitleConfig = void 0;
|
4 | var constant_1 = require("../constant");
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | function getFactTitleConfig(direction) {
|
10 | if ([constant_1.DIRECTION.TOP, constant_1.DIRECTION.BOTTOM].includes(direction)) {
|
11 | return {
|
12 | offsetX: 0,
|
13 | offsetY: direction === constant_1.DIRECTION.TOP ? -8 : 8,
|
14 | style: {
|
15 | textAlign: 'center',
|
16 | textBaseline: direction === constant_1.DIRECTION.TOP ? 'bottom' : 'top',
|
17 | },
|
18 | };
|
19 | }
|
20 | if ([constant_1.DIRECTION.LEFT, constant_1.DIRECTION.RIGHT].includes(direction)) {
|
21 | return {
|
22 | offsetX: direction === constant_1.DIRECTION.LEFT ? -8 : 8,
|
23 | offsetY: 0,
|
24 | style: {
|
25 | textAlign: direction === constant_1.DIRECTION.LEFT ? 'right' : 'left',
|
26 | textBaseline: 'middle',
|
27 | rotate: Math.PI / 2,
|
28 | },
|
29 | };
|
30 | }
|
31 | return {};
|
32 | }
|
33 | exports.getFactTitleConfig = getFactTitleConfig;
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 | function getAnglePoint(center, r, angle) {
|
42 | return {
|
43 | x: center.x + r * Math.cos(angle),
|
44 | y: center.y + r * Math.sin(angle),
|
45 | };
|
46 | }
|
47 | exports.getAnglePoint = getAnglePoint;
|
48 |
|
\ | No newline at end of file |