1 | import { BBox, IGroup, IShape } from '../dependents';
|
2 | import { LabelItem } from '../geometry/label/interface';
|
3 | import { AnimateOption, GeometryLabelLayoutCfg } from '../interface';
|
4 |
|
5 |
|
6 |
|
7 | export interface LabelsGroupCfg {
|
8 |
|
9 | container: IGroup;
|
10 |
|
11 | layout?: GeometryLabelLayoutCfg | GeometryLabelLayoutCfg[];
|
12 | }
|
13 |
|
14 |
|
15 |
|
16 | export default class Labels {
|
17 |
|
18 | layout: GeometryLabelLayoutCfg | GeometryLabelLayoutCfg[];
|
19 |
|
20 | container: IGroup;
|
21 |
|
22 | animate: AnimateOption | false;
|
23 |
|
24 | region: BBox;
|
25 |
|
26 | shapesMap: Record<string, IGroup>;
|
27 | constructor(cfg: LabelsGroupCfg);
|
28 | /**
|
29 | * 渲染文本
|
30 | */
|
31 | render(items: LabelItem[], shapes: Record<string, IShape | IGroup>, isUpdate?: boolean): Promise<void>;
|
32 | /** 清除当前 labels */
|
33 | clear(): void;
|
34 | /** 销毁 */
|
35 | destroy(): void;
|
36 | private renderLabel;
|
37 | private doLayout;
|
38 | private renderLabelLine;
|
39 | /**
|
40 | * 绘制标签背景
|
41 | * @param labelItems
|
42 | */
|
43 | private renderLabelBackground;
|
44 | private createOffscreenGroup;
|
45 | private adjustLabel;
|
46 | }
|