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