1 |
|
2 |
|
3 |
|
4 |
|
5 | export default class TextRenderer {
|
6 | static $inject: string[];
|
7 | |
8 |
|
9 |
|
10 | constructor(config?: TextRendererConfig);
|
11 | /**
|
12 | * Get the new bounds of an externally rendered,
|
13 | * layouted label.
|
14 | *
|
15 | * @param bounds
|
16 | * @param text
|
17 | *
|
18 | * @return
|
19 | */
|
20 | getExternalLabelBounds: (bounds: Rect, text: string) => Rect;
|
21 | /**
|
22 | * Get the new bounds of text annotation.
|
23 | *
|
24 | * @param bounds
|
25 | * @param text
|
26 | *
|
27 | * @return
|
28 | */
|
29 | getTextAnnotationBounds: (bounds: Rect, text: string) => Rect;
|
30 | /**
|
31 | * Create a layouted text element.
|
32 | *
|
33 | * @param text
|
34 | * @param options
|
35 | *
|
36 | * @return rendered text
|
37 | */
|
38 | createText: (text: string, options?: TextLayoutConfig) => SVGElement;
|
39 | /**
|
40 | * Get default text style.
|
41 | */
|
42 | getDefaultStyle: () => {
|
43 | fontFamily: string;
|
44 | fontSize: number;
|
45 | fontWeight: string;
|
46 | lineHeight: number;
|
47 | } & Partial<TextRendererStyle>;
|
48 | |
49 |
|
50 |
|
51 | getExternalStyle: () => {
|
52 | fontFamily: string;
|
53 | fontSize: number;
|
54 | fontWeight: string;
|
55 | lineHeight: number;
|
56 | } & Partial<TextRendererStyle> & {
|
57 | fontSize: number;
|
58 | };
|
59 | }
|
60 |
|
61 | export type TextRendererStyle = {
|
62 | fontFamily: string;
|
63 | fontSize: number;
|
64 | fontWeight: string;
|
65 | lineHeight: number;
|
66 | };
|
67 |
|
68 | export type TextRendererConfig = {
|
69 | defaultStyle?: Partial<TextRendererStyle>;
|
70 | externalStyle?: Partial<TextRendererStyle>;
|
71 | };
|
72 |
|
73 | type TextLayoutConfig = import('diagram-js/lib/util/Text').TextLayoutConfig;
|
74 | type Rect = import('diagram-js/lib/util/Types').Rect;
|