@inweb/markup 25.9.2 → 25.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,7 +36,7 @@ export interface IMarkupCloud extends IMarkupObject, IMarkupColorable {
36
36
  /**
37
37
  * Sets the coordinates of the top-left point (position) of the cloud.
38
38
  */
39
- setPosition(x: number, y: number);
39
+ setPosition(x: number, y: number): void;
40
40
 
41
41
  /**
42
42
  * Returns the width of the cloud.
@@ -46,7 +46,7 @@ export interface IMarkupCloud extends IMarkupObject, IMarkupColorable {
46
46
  /**
47
47
  * Sets the width of the cloud.
48
48
  */
49
- setWidth(w: number);
49
+ setWidth(w: number): void;
50
50
 
51
51
  /**
52
52
  * Returns the height of the cloud.
@@ -56,7 +56,7 @@ export interface IMarkupCloud extends IMarkupObject, IMarkupColorable {
56
56
  /**
57
57
  * Sets the height of the cloud.
58
58
  */
59
- setHeight(h: number);
59
+ setHeight(h: number): void;
60
60
 
61
61
  /**
62
62
  * Returns the line width of the cloud.
@@ -66,5 +66,49 @@ export interface IMarkupCloud extends IMarkupObject, IMarkupColorable {
66
66
  /**
67
67
  * Sets the line width of the cloud.
68
68
  */
69
- setLineWidth(size: number);
69
+ setLineWidth(size: number): void;
70
+ }
71
+
72
+ /**
73
+ * Defines the parameters for creating a {@link IMarkupCloudParams | markup cloud}.
74
+ */
75
+ export interface IMarkupCloudParams {
76
+ /**
77
+ * Coordinates of the top-left point (position) of the cloud.
78
+ */
79
+ position?: { x: number; y: number };
80
+
81
+ /**
82
+ * Width of the cloud.
83
+ *
84
+ * @default 200
85
+ */
86
+ width?: number;
87
+
88
+ /**
89
+ * Height of the cloud.
90
+ *
91
+ * @default 200
92
+ */
93
+ height?: number;
94
+
95
+ /**
96
+ * Line width.
97
+ *
98
+ * @default 4
99
+ */
100
+ lineWidth?: number;
101
+
102
+ /**
103
+ * Line color as a string in hexadecimal color syntax `#RGB` color using its primary color
104
+ * components (red, green, blue) written as hexadecimal numbers.
105
+ *
106
+ * @default "#ff0000"
107
+ */
108
+ color?: string;
109
+
110
+ /**
111
+ * Internal markup object identifier.
112
+ */
113
+ id?: string;
70
114
  }
@@ -36,7 +36,7 @@ export interface IMarkupEllipse extends IMarkupObject, IMarkupColorable {
36
36
  /**
37
37
  * Sets the coordinates of the top-left point (position) of the ellipse.
38
38
  */
39
- setPosition(x: number, y: number);
39
+ setPosition(x: number, y: number): void;
40
40
 
41
41
  /**
42
42
  * Returns the X radius of the ellipse.
@@ -46,7 +46,7 @@ export interface IMarkupEllipse extends IMarkupObject, IMarkupColorable {
46
46
  /**
47
47
  * Sets the X radius of the ellipse.
48
48
  */
49
- setRadiusX(r: number);
49
+ setRadiusX(r: number): void;
50
50
 
51
51
  /**
52
52
  * Returns the Y radius of the ellipse.
@@ -56,7 +56,7 @@ export interface IMarkupEllipse extends IMarkupObject, IMarkupColorable {
56
56
  /**
57
57
  * Sets the X radius of the ellipse.
58
58
  */
59
- setRadiusY(r: number);
59
+ setRadiusY(r: number): void;
60
60
 
61
61
  /**
62
62
  * Returns the line width of the ellipse.
@@ -66,5 +66,42 @@ export interface IMarkupEllipse extends IMarkupObject, IMarkupColorable {
66
66
  /**
67
67
  * Sets the line width of the ellipse.
68
68
  */
69
- setLineWidth(size: number);
69
+ setLineWidth(size: number): void;
70
+ }
71
+
72
+ /**
73
+ * Defines the parameters for creating a {@link IMarkupEllipse | markup ellipse}.
74
+ */
75
+ export interface IMarkupEllipseParams {
76
+ /**
77
+ * Coordinates of the center point (position) of the ellipse.
78
+ */
79
+ position?: { x: number; y: number };
80
+
81
+ /**
82
+ * Radius of the ellipse along the X and Y axes.
83
+ *
84
+ * @default 25
85
+ */
86
+ radius?: { x: number; y: number };
87
+
88
+ /**
89
+ * Line width.
90
+ *
91
+ * @default 4
92
+ */
93
+ lineWidth?: number;
94
+
95
+ /**
96
+ * Line color as a string in hexadecimal color syntax `#RGB` color using its primary color
97
+ * components (red, green, blue) written as hexadecimal numbers.
98
+ *
99
+ * @default "#ff0000"
100
+ */
101
+ color?: string;
102
+
103
+ /**
104
+ * Internal markup object identifier.
105
+ */
106
+ id?: string;
70
107
  }
@@ -35,7 +35,7 @@ export interface IMarkupImage extends IMarkupObject {
35
35
  /**
36
36
  * Sets the coordinates of the top-left point (position) of the image.
37
37
  */
38
- setPosition(x: number, y: number);
38
+ setPosition(x: number, y: number): void;
39
39
 
40
40
  /**
41
41
  * Returns the image source as a base64-encoded
@@ -49,7 +49,7 @@ export interface IMarkupImage extends IMarkupObject {
49
49
  *
50
50
  * @param src - Image source as base64-encoded string.
51
51
  */
52
- setSrc(src: string);
52
+ setSrc(src: string): void;
53
53
 
54
54
  /**
55
55
  * Returns the width of the image. The original image is scaled to this width.
@@ -60,7 +60,7 @@ export interface IMarkupImage extends IMarkupObject {
60
60
  * Sets the width of the image. The image height will be automatically updated to match its
61
61
  * aspect ratio.
62
62
  */
63
- setWidth(w: number);
63
+ setWidth(w: number): void;
64
64
 
65
65
  /**
66
66
  * Returns the height of the image. The original image is scaled to this height.
@@ -71,5 +71,54 @@ export interface IMarkupImage extends IMarkupObject {
71
71
  * Sets the height of the image. The image width will be automatically updated to match its
72
72
  * aspect ratio.
73
73
  */
74
- setHeight(h: number);
74
+ setHeight(h: number): void;
75
+ }
76
+
77
+ /**
78
+ * Defines the parameters for creating a {@link IMarkupImage | markup image}.
79
+ */
80
+ export interface IMarkupImageParams {
81
+ /**
82
+ * Coordinates of the top-left point (position) of the image.
83
+ */
84
+ position?: { x: number; y: number };
85
+
86
+ /**
87
+ * Image source as a base64-encoded
88
+ * {@link https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URIs | Data URL}.
89
+ */
90
+ src?: string;
91
+
92
+ /**
93
+ * Width of the image. The original image is scaled to this width. Specify 0 to set width of
94
+ * the source image.
95
+ *
96
+ * @default 0
97
+ */
98
+ width?: number;
99
+
100
+ /**
101
+ * Height of the image. The original image is scaled to this height. Specify 0 to set height
102
+ * of the source image.
103
+ *
104
+ * @default 0
105
+ */
106
+ height?: number;
107
+
108
+ /**
109
+ * Maximum width of the image. Specify a max width if you want to set the width to the
110
+ * original image but not more than the max.
111
+ */
112
+ maxWidth?: number;
113
+
114
+ /**
115
+ * Maximum height of the image. Specify a max height if you want to set the height to the
116
+ * original image but not more than the max.
117
+ */
118
+ maxHeight?: number;
119
+
120
+ /**
121
+ * Internal markup object identifier.
122
+ */
123
+ id?: string;
75
124
  }
@@ -36,7 +36,7 @@ export interface IMarkupRectangle extends IMarkupObject, IMarkupColorable {
36
36
  /**
37
37
  * Sets the coordinates of the top-left point (position) of the rectangle.
38
38
  */
39
- setPosition(x: number, y: number);
39
+ setPosition(x: number, y: number): void;
40
40
 
41
41
  /**
42
42
  * Returns the width of the rectangle.
@@ -46,7 +46,7 @@ export interface IMarkupRectangle extends IMarkupObject, IMarkupColorable {
46
46
  /**
47
47
  * Sets the width of the rectangle.
48
48
  */
49
- setWidth(w: number);
49
+ setWidth(w: number): void;
50
50
 
51
51
  /**
52
52
  * Returns the height of the rectangle.
@@ -56,7 +56,7 @@ export interface IMarkupRectangle extends IMarkupObject, IMarkupColorable {
56
56
  /**
57
57
  * Sets the height of the rectangle.
58
58
  */
59
- setHeight(h: number);
59
+ setHeight(h: number): void;
60
60
 
61
61
  /**
62
62
  * Returns the line width of the rectangle.
@@ -66,5 +66,49 @@ export interface IMarkupRectangle extends IMarkupObject, IMarkupColorable {
66
66
  /**
67
67
  * Sets the line width of the rectangle.
68
68
  */
69
- setLineWidth(size: number);
69
+ setLineWidth(size: number): void;
70
+ }
71
+
72
+ /**
73
+ * Defines the parameters for creating a {@link IMarkupRectangle | markup rectangle}.
74
+ */
75
+ export interface IMarkupRectangleParams {
76
+ /**
77
+ * Coordinates of the top-left point (position) of the rectangle.
78
+ */
79
+ position?: { x: number; y: number };
80
+
81
+ /**
82
+ * Width of the rectangle.
83
+ *
84
+ * @default 200
85
+ */
86
+ width?: number;
87
+
88
+ /**
89
+ * Height of the rectangle.
90
+ *
91
+ * @default 200
92
+ */
93
+ height?: number;
94
+
95
+ /**
96
+ * Line width.
97
+ *
98
+ * @default 4
99
+ */
100
+ lineWidth?: number;
101
+
102
+ /**
103
+ * Line color as a string in hexadecimal color syntax `#RGB` color using its primary color
104
+ * components (red, green, blue) written as hexadecimal numbers.
105
+ *
106
+ * @default "#ff0000"
107
+ */
108
+ color?: string;
109
+
110
+ /**
111
+ * Internal markup object identifier.
112
+ */
113
+ id?: string;
70
114
  }
@@ -46,15 +46,57 @@ export interface IMarkupText extends IMarkupObject, IMarkupColorable {
46
46
  /**
47
47
  * Sets the coordinates of the top-left point (position) of the text.
48
48
  */
49
- setPosition(x: number, y: number);
49
+ setPosition(x: number, y: number): void;
50
50
 
51
51
  /**
52
52
  * Returns the font size of the text.
53
53
  */
54
- getFontSize();
54
+ getFontSize(): number;
55
55
 
56
56
  /**
57
57
  * Sets the font size of the text.
58
58
  */
59
- setFontSize(size: number);
59
+ setFontSize(size: number): void;
60
+ }
61
+
62
+ /**
63
+ * Defines the parameters for creating a {@link IMarkupText | markup text}.
64
+ */
65
+ export interface IMarkupTextParams {
66
+ /**
67
+ * Coordinates of the top-left point (position) of the text.
68
+ */
69
+ position?: { x: number; y: number };
70
+
71
+ /**
72
+ * Text string.
73
+ */
74
+ text?: string;
75
+
76
+ /**
77
+ * Rotation angle of the text, in degress.
78
+ *
79
+ * @default 0
80
+ */
81
+ rotation?: number;
82
+
83
+ /**
84
+ * Font size of the text.
85
+ *
86
+ * @default 34
87
+ */
88
+ fontSize?: number;
89
+
90
+ /**
91
+ * Text color as a string in hexadecimal color syntax `#RGB` color using its primary color
92
+ * components (red, green, blue) written as hexadecimal numbers.
93
+ *
94
+ * @default "#ff0000"
95
+ */
96
+ color?: string;
97
+
98
+ /**
99
+ * Internal markup object identifier.
100
+ */
101
+ id?: string;
60
102
  }
@@ -22,20 +22,12 @@
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
24
  import Konva from "konva";
25
- import { IMarkupArrow } from "../IMarkupArrow";
25
+ import { IMarkupArrow, IMarkupArrowParams } from "../IMarkupArrow";
26
26
 
27
27
  export class KonvaArrow implements IMarkupArrow {
28
28
  private _ref: Konva.Arrow;
29
29
 
30
- constructor(
31
- params: {
32
- start?: { x: number; y: number };
33
- end?: { x: number; y: number };
34
- color?: string;
35
- id?: string;
36
- },
37
- ref = null
38
- ) {
30
+ constructor(params: IMarkupArrowParams, ref = null) {
39
31
  if (ref) {
40
32
  this._ref = ref;
41
33
  return;
@@ -86,7 +78,7 @@ export class KonvaArrow implements IMarkupArrow {
86
78
  return this._ref.stroke() as string;
87
79
  }
88
80
 
89
- setColor(hex: string) {
81
+ setColor(hex: string): void {
90
82
  this._ref.stroke(hex);
91
83
  this._ref.fill(hex);
92
84
  }
@@ -120,7 +112,7 @@ export class KonvaArrow implements IMarkupArrow {
120
112
  ];
121
113
  }
122
114
 
123
- setPoints(points: { x: number; y: number }[]) {
115
+ setPoints(points: { x: number; y: number }[]): void {
124
116
  if (points.length === 2) {
125
117
  this._ref.points([points[0].x, points[0].y, points[1].x, points[1].y]);
126
118
  }
@@ -131,7 +123,7 @@ export class KonvaArrow implements IMarkupArrow {
131
123
  return { x: points[0], y: points[1] };
132
124
  }
133
125
 
134
- setStartPoint(x: number, y: number) {
126
+ setStartPoint(x: number, y: number): void {
135
127
  const points = this._ref.points();
136
128
  this._ref.points([x, y, points[2], points[3]]);
137
129
  }
@@ -141,7 +133,7 @@ export class KonvaArrow implements IMarkupArrow {
141
133
  return { x: points[2], y: points[3] };
142
134
  }
143
135
 
144
- setEndPoint(x: number, y: number) {
136
+ setEndPoint(x: number, y: number): void {
145
137
  const points = this._ref.points();
146
138
  this._ref.points([points[0], points[1], x, y]);
147
139
  }
@@ -1,20 +1,10 @@
1
1
  import Konva from "konva";
2
- import { IMarkupCloud } from "../IMarkupCloud";
2
+ import { IMarkupCloud, IMarkupCloudParams } from "../IMarkupCloud";
3
3
 
4
4
  export class KonvaCloud implements IMarkupCloud {
5
5
  private _ref: Konva.Shape;
6
6
 
7
- constructor(
8
- params: {
9
- position?: { x: number; y: number };
10
- width?: number;
11
- height?: number;
12
- lineWidth?: number;
13
- color?: string;
14
- id?: string;
15
- },
16
- ref = null
17
- ) {
7
+ constructor(params: IMarkupCloudParams, ref = null) {
18
8
  if (ref) {
19
9
  this._ref = ref;
20
10
  return;
@@ -154,7 +144,7 @@ export class KonvaCloud implements IMarkupCloud {
154
144
  return this._ref.stroke() as string;
155
145
  }
156
146
 
157
- setColor(hex: string) {
147
+ setColor(hex: string): void {
158
148
  this._ref.stroke(hex);
159
149
  }
160
150
 
@@ -183,7 +173,7 @@ export class KonvaCloud implements IMarkupCloud {
183
173
  return this._ref.position();
184
174
  }
185
175
 
186
- setPosition(x: number, y: number) {
176
+ setPosition(x: number, y: number): void {
187
177
  this._ref.position({ x, y });
188
178
  }
189
179
 
@@ -191,7 +181,7 @@ export class KonvaCloud implements IMarkupCloud {
191
181
  return this._ref.width();
192
182
  }
193
183
 
194
- setWidth(w: number) {
184
+ setWidth(w: number): void {
195
185
  this._ref.width(w);
196
186
  }
197
187
 
@@ -199,7 +189,7 @@ export class KonvaCloud implements IMarkupCloud {
199
189
  return this._ref.height();
200
190
  }
201
191
 
202
- setHeight(h: number) {
192
+ setHeight(h: number): void {
203
193
  this._ref.height(h);
204
194
  }
205
195
 
@@ -207,7 +197,7 @@ export class KonvaCloud implements IMarkupCloud {
207
197
  return this._ref.strokeWidth();
208
198
  }
209
199
 
210
- setLineWidth(size: number) {
200
+ setLineWidth(size: number): void {
211
201
  this._ref.strokeWidth(size);
212
202
  }
213
203
  }
@@ -1,19 +1,10 @@
1
1
  import Konva from "konva";
2
- import { IMarkupEllipse } from "../IMarkupEllipse";
2
+ import { IMarkupEllipse, IMarkupEllipseParams } from "../IMarkupEllipse";
3
3
 
4
4
  export class KonvaEllipse implements IMarkupEllipse {
5
5
  private _ref: Konva.Ellipse;
6
6
 
7
- constructor(
8
- params: {
9
- position?: { x: number; y: number };
10
- radius?: { x: number; y: number };
11
- lineWidth?: number;
12
- color?: string;
13
- id?: string;
14
- },
15
- ref = null
16
- ) {
7
+ constructor(params: IMarkupEllipseParams, ref = null) {
17
8
  if (ref) {
18
9
  this._ref = ref;
19
10
  return;
@@ -76,7 +67,7 @@ export class KonvaEllipse implements IMarkupEllipse {
76
67
  return this._ref.position();
77
68
  }
78
69
 
79
- setPosition(x: number, y: number) {
70
+ setPosition(x: number, y: number): void {
80
71
  this._ref.setPosition({ x, y });
81
72
  }
82
73
 
@@ -84,7 +75,7 @@ export class KonvaEllipse implements IMarkupEllipse {
84
75
  return this._ref.radiusX();
85
76
  }
86
77
 
87
- setRadiusX(r: number) {
78
+ setRadiusX(r: number): void {
88
79
  this._ref.radiusX(r);
89
80
  }
90
81
 
@@ -92,7 +83,7 @@ export class KonvaEllipse implements IMarkupEllipse {
92
83
  return this._ref.radiusY();
93
84
  }
94
85
 
95
- setRadiusY(r: number) {
86
+ setRadiusY(r: number): void {
96
87
  this._ref.radiusY(r);
97
88
  }
98
89
 
@@ -100,7 +91,7 @@ export class KonvaEllipse implements IMarkupEllipse {
100
91
  return this._ref.strokeWidth();
101
92
  }
102
93
 
103
- setLineWidth(size: number) {
94
+ setLineWidth(size: number): void {
104
95
  this._ref.strokeWidth(size);
105
96
  }
106
97
 
@@ -124,7 +115,7 @@ export class KonvaEllipse implements IMarkupEllipse {
124
115
  return this._ref.stroke() as string;
125
116
  }
126
117
 
127
- setColor(hex: string) {
118
+ setColor(hex: string): void {
128
119
  this._ref.stroke(hex);
129
120
  }
130
121
 
@@ -1,5 +1,5 @@
1
1
  import Konva from "konva";
2
- import { IMarkupImage } from "../IMarkupImage";
2
+ import { IMarkupImage, IMarkupImageParams } from "../IMarkupImage";
3
3
 
4
4
  export class KonvaImage implements IMarkupImage {
5
5
  private _ref: Konva.Image;
@@ -10,18 +10,7 @@ export class KonvaImage implements IMarkupImage {
10
10
  private readonly BASE64_NOT_FOUND =
11
11
  "data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAADsAAAA7AF5KHG9AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAmhJREFUWIXtlr9rVEEQxz+H8RQUJIdeIopYm0vkCg0GBBtbG1NF7Kxt7dR/IGIw/uhTaBNLERURg2kCEUyCYCPi70b0InjGS57FzOZN3r19d+9HJIVfWO52dma/s7Mz8xa2KAaBCWAR+AkECWOmSOIdwC1gtQOpHc+NfQ8wClQ8+1d0vcdH/lQ3bSIRGAZ2pTjAqNovANXIWlXlAXA2zvi2Ln4AjqYgtagYEutENSLvjRoOImFv5iB32Ae8UrLXwFBk3h9ndF0VJnKSO9gTu3yKu5Z1LKnS8YIcABgw5Ks692JZFXcXRJ46Aq6kikCnHNi/mQ50WwVtfaIoBzL3gRk2drSscJ2wrc4VvUoe2wn/41/iBfoVLRnBGnDSY3AAKacy8AmYR+o7K1zCl6wgrgpOAc/MuhvfgMuk+1JGHQgSBcAloKXy78AjYBppJk5/noTulseBMZ23iD/piHFkEdgTQzKk+5wHjmHC3cmBg0BD5xcSTrFXyQPgIWFtDwMvab+2N8DpbhyY1v/3E8gdDgNfVX9SCVZ0/gW4B0wB71S2BpxLcuCM/jaQSHSDEeAX4VMuAG4gTzyHbcAVXXO6GxxwIX+vvxe7JHcYQ07nHqklj96UIW/YhSWzMKcep8VVtf8B1Dw6h4DfhB+sdbgn2R+gnoEc5NR3dZ+3QJ9H74HqXLPCGlJyTfI9y3YCs0owq3OLOpKkLeBI1HhSDT/mdKIPiUCARMTlQx34TMLjtww8IczmO8AJ/N/2JNSQXAiQ671JePePge0+wzJSQq4FFzlaenIvucUAkiQLhC/mLGNZ9xgn5s63BP4CCk0QDtm4BhoAAAAASUVORK5CYII=";
12
12
 
13
- constructor(
14
- params: {
15
- position?: { x: number; y: number };
16
- src?: string;
17
- width?: number;
18
- height?: number;
19
- maxWidth?: number;
20
- maxHeight?: number;
21
- id?: string;
22
- },
23
- ref = null
24
- ) {
13
+ constructor(params: IMarkupImageParams, ref = null) {
25
14
  if (ref) {
26
15
  if (!ref.src || !ref.src.startsWith(this.BASE64_HEADER_START)) ref.src = this.BASE64_NOT_FOUND;
27
16
  if (ref.height() <= this.EPSILON) ref.height(32);
@@ -137,7 +126,7 @@ export class KonvaImage implements IMarkupImage {
137
126
  return this._ref.width();
138
127
  }
139
128
 
140
- setWidth(w: number) {
129
+ setWidth(w: number): void {
141
130
  this._ref.width(w);
142
131
  this._ref.height(w * this._ratio);
143
132
  }
@@ -146,7 +135,7 @@ export class KonvaImage implements IMarkupImage {
146
135
  return this._ref.height();
147
136
  }
148
137
 
149
- setHeight(h: number) {
138
+ setHeight(h: number): void {
150
139
  this._ref.height(h);
151
140
  this._ref.width(h / this._ratio);
152
141
  }
@@ -192,7 +181,7 @@ export class KonvaImage implements IMarkupImage {
192
181
  return this._ref.getPosition();
193
182
  }
194
183
 
195
- setPosition(x: number, y: number) {
184
+ setPosition(x: number, y: number): void {
196
185
  this._ref.setPosition({ x, y });
197
186
  }
198
187
  }
@@ -1,20 +1,10 @@
1
1
  import Konva from "konva";
2
- import { IMarkupRectangle } from "../IMarkupRectangle";
2
+ import { IMarkupRectangle, IMarkupRectangleParams } from "../IMarkupRectangle";
3
3
 
4
4
  export class KonvaRectangle implements IMarkupRectangle {
5
5
  private _ref: Konva.Rect;
6
6
 
7
- constructor(
8
- params: {
9
- position?: { x: number; y: number };
10
- width?: number;
11
- height?: number;
12
- lineWidth?: number;
13
- color?: string;
14
- id?: string;
15
- },
16
- ref = null
17
- ) {
7
+ constructor(params: IMarkupRectangleParams, ref = null) {
18
8
  if (ref) {
19
9
  this._ref = ref;
20
10
  return;
@@ -82,15 +72,15 @@ export class KonvaRectangle implements IMarkupRectangle {
82
72
  return this._ref.height();
83
73
  }
84
74
 
85
- setWidth(w: number) {
75
+ setWidth(w: number): void {
86
76
  this._ref.width(w);
87
77
  }
88
78
 
89
- setHeight(h: number) {
79
+ setHeight(h: number): void {
90
80
  this._ref.height(h);
91
81
  }
92
82
 
93
- setPosition(x: number, y: number) {
83
+ setPosition(x: number, y: number): void {
94
84
  this._ref.setPosition({ x, y });
95
85
  }
96
86
 
@@ -1,21 +1,11 @@
1
1
  import Konva from "konva";
2
- import { IMarkupText } from "../IMarkupText";
2
+ import { IMarkupText, IMarkupTextParams } from "../IMarkupText";
3
3
 
4
4
  export class KonvaText implements IMarkupText {
5
5
  private _ref: Konva.Text;
6
6
  private readonly TEXT_FONT_FAMILY = "Calibri";
7
7
 
8
- constructor(
9
- params: {
10
- position?: { x: number; y: number };
11
- text?: string;
12
- rotation?: number;
13
- fontSize?: number;
14
- color?: string;
15
- id?: string;
16
- },
17
- ref = null
18
- ) {
8
+ constructor(params: IMarkupTextParams, ref = null) {
19
9
  if (ref) {
20
10
  this._ref = ref;
21
11
  return;
@@ -91,7 +81,7 @@ export class KonvaText implements IMarkupText {
91
81
  return this._ref.fill() as string;
92
82
  }
93
83
 
94
- setColor(hex: string) {
84
+ setColor(hex: string): void {
95
85
  this._ref.fill(hex);
96
86
  }
97
87
 
@@ -128,15 +118,15 @@ export class KonvaText implements IMarkupText {
128
118
  return this._ref.getPosition();
129
119
  }
130
120
 
131
- setPosition(x: number, y: number) {
121
+ setPosition(x: number, y: number): void {
132
122
  this._ref.setPosition({ x, y });
133
123
  }
134
124
 
135
- getFontSize() {
125
+ getFontSize(): number {
136
126
  return this._ref.fontSize();
137
127
  }
138
128
 
139
- setFontSize(size: number) {
129
+ setFontSize(size: number): void {
140
130
  this._ref.fontSize(size);
141
131
  }
142
132
  }