konva 9.3.15 → 9.3.17

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.
Files changed (68) hide show
  1. package/konva.js +821 -801
  2. package/konva.min.js +3 -3
  3. package/lib/Animation.js +1 -1
  4. package/lib/BezierFunctions.js +1 -2
  5. package/lib/Canvas.js +9 -9
  6. package/lib/Container.d.ts +1 -1
  7. package/lib/Container.js +29 -29
  8. package/lib/Context.d.ts +2 -2
  9. package/lib/Context.js +28 -28
  10. package/lib/DragAndDrop.d.ts +2 -2
  11. package/lib/DragAndDrop.js +6 -4
  12. package/lib/Factory.d.ts +18 -8
  13. package/lib/Factory.js +17 -16
  14. package/lib/Global.js +1 -1
  15. package/lib/Group.js +1 -1
  16. package/lib/Layer.js +17 -17
  17. package/lib/Node.d.ts +2 -2
  18. package/lib/Node.js +89 -89
  19. package/lib/PointerEvents.js +5 -6
  20. package/lib/Shape.d.ts +5 -0
  21. package/lib/Shape.js +37 -37
  22. package/lib/Stage.d.ts +2 -2
  23. package/lib/Stage.js +32 -31
  24. package/lib/Tween.js +31 -27
  25. package/lib/Util.d.ts +4 -4
  26. package/lib/Util.js +66 -65
  27. package/lib/Validators.d.ts +9 -9
  28. package/lib/Validators.js +12 -13
  29. package/lib/_CoreInternals.d.ts +8 -8
  30. package/lib/_FullInternals.d.ts +8 -8
  31. package/lib/filters/Blur.js +7 -6
  32. package/lib/filters/Brighten.js +2 -2
  33. package/lib/filters/Contrast.js +4 -3
  34. package/lib/filters/Emboss.js +22 -21
  35. package/lib/filters/Enhance.js +8 -7
  36. package/lib/filters/Grayscale.js +3 -3
  37. package/lib/filters/HSL.js +7 -7
  38. package/lib/filters/HSV.js +7 -7
  39. package/lib/filters/Invert.js +2 -2
  40. package/lib/filters/Kaleidoscope.js +44 -44
  41. package/lib/filters/Mask.js +58 -57
  42. package/lib/filters/Noise.js +2 -2
  43. package/lib/filters/Pixelate.js +1 -1
  44. package/lib/filters/Posterize.js +2 -2
  45. package/lib/filters/RGB.js +3 -4
  46. package/lib/filters/RGBA.js +3 -3
  47. package/lib/filters/Sepia.js +5 -5
  48. package/lib/filters/Solarize.js +8 -7
  49. package/lib/filters/Threshold.js +2 -2
  50. package/lib/shapes/Arc.js +1 -1
  51. package/lib/shapes/Arrow.js +12 -12
  52. package/lib/shapes/Ellipse.js +1 -1
  53. package/lib/shapes/Image.js +3 -3
  54. package/lib/shapes/Label.d.ts +3 -1
  55. package/lib/shapes/Label.js +6 -6
  56. package/lib/shapes/Line.d.ts +1 -1
  57. package/lib/shapes/Line.js +14 -14
  58. package/lib/shapes/Path.js +62 -62
  59. package/lib/shapes/Rect.js +1 -1
  60. package/lib/shapes/RegularPolygon.js +6 -6
  61. package/lib/shapes/Ring.js +1 -1
  62. package/lib/shapes/Sprite.js +9 -9
  63. package/lib/shapes/Star.js +5 -5
  64. package/lib/shapes/Text.js +48 -44
  65. package/lib/shapes/TextPath.js +25 -25
  66. package/lib/shapes/Transformer.d.ts +1 -1
  67. package/lib/shapes/Transformer.js +64 -64
  68. package/package.json +15 -17
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Text = exports.stringToArray = void 0;
3
+ exports.Text = void 0;
4
+ exports.stringToArray = stringToArray;
4
5
  const Util_1 = require("../Util");
5
6
  const Factory_1 = require("../Factory");
6
7
  const Shape_1 = require("../Shape");
@@ -9,8 +10,13 @@ const Validators_1 = require("../Validators");
9
10
  const Global_2 = require("../Global");
10
11
  function stringToArray(string) {
11
12
  return [...string].reduce((acc, char, index, array) => {
12
- if (/\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?(?:\u200D\p{Emoji_Presentation})+/u.test(char)) {
13
- acc.push(char);
13
+ if (/\p{Emoji}/u.test(char)) {
14
+ if (acc.length > 0 && /\p{Emoji}/u.test(acc[acc.length - 1])) {
15
+ acc[acc.length - 1] += char;
16
+ }
17
+ else {
18
+ acc.push(char);
19
+ }
14
20
  }
15
21
  else if (/\p{Regional_Indicator}{2}/u.test(char + (array[index + 1] || ''))) {
16
22
  acc.push(char + array[index + 1]);
@@ -24,8 +30,7 @@ function stringToArray(string) {
24
30
  return acc;
25
31
  }, []);
26
32
  }
27
- exports.stringToArray = stringToArray;
28
- var AUTO = 'auto', CENTER = 'center', INHERIT = 'inherit', JUSTIFY = 'justify', CHANGE_KONVA = 'Change.konva', CONTEXT_2D = '2d', DASH = '-', LEFT = 'left', LTR = 'ltr', TEXT = 'text', TEXT_UPPER = 'Text', TOP = 'top', BOTTOM = 'bottom', MIDDLE = 'middle', NORMAL = 'normal', PX_SPACE = 'px ', SPACE = ' ', RIGHT = 'right', RTL = 'rtl', WORD = 'word', CHAR = 'char', NONE = 'none', ELLIPSIS = '…', ATTR_CHANGE_LIST = [
33
+ const AUTO = 'auto', CENTER = 'center', INHERIT = 'inherit', JUSTIFY = 'justify', CHANGE_KONVA = 'Change.konva', CONTEXT_2D = '2d', DASH = '-', LEFT = 'left', TEXT = 'text', TEXT_UPPER = 'Text', TOP = 'top', BOTTOM = 'bottom', MIDDLE = 'middle', NORMAL = 'normal', PX_SPACE = 'px ', SPACE = ' ', RIGHT = 'right', RTL = 'rtl', WORD = 'word', CHAR = 'char', NONE = 'none', ELLIPSIS = '…', ATTR_CHANGE_LIST = [
29
34
  'direction',
30
35
  'fontFamily',
31
36
  'fontSize',
@@ -56,7 +61,7 @@ function normalizeFontFamily(fontFamily) {
56
61
  })
57
62
  .join(', ');
58
63
  }
59
- var dummyContext;
64
+ let dummyContext;
60
65
  function getDummyContext() {
61
66
  if (dummyContext) {
62
67
  return dummyContext;
@@ -85,22 +90,22 @@ class Text extends Shape_1.Shape {
85
90
  super(checkDefaultFill(config));
86
91
  this._partialTextX = 0;
87
92
  this._partialTextY = 0;
88
- for (var n = 0; n < attrChangeListLen; n++) {
93
+ for (let n = 0; n < attrChangeListLen; n++) {
89
94
  this.on(ATTR_CHANGE_LIST[n] + CHANGE_KONVA, this._setTextData);
90
95
  }
91
96
  this._setTextData();
92
97
  }
93
98
  _sceneFunc(context) {
94
- var textArr = this.textArr, textArrLen = textArr.length;
99
+ const textArr = this.textArr, textArrLen = textArr.length;
95
100
  if (!this.text()) {
96
101
  return;
97
102
  }
98
- var padding = this.padding(), fontSize = this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, verticalAlign = this.verticalAlign(), direction = this.direction(), alignY = 0, align = this.align(), totalWidth = this.getWidth(), letterSpacing = this.letterSpacing(), fill = this.fill(), textDecoration = this.textDecoration(), shouldUnderline = textDecoration.indexOf('underline') !== -1, shouldLineThrough = textDecoration.indexOf('line-through') !== -1, n;
103
+ let padding = this.padding(), fontSize = this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, verticalAlign = this.verticalAlign(), direction = this.direction(), alignY = 0, align = this.align(), totalWidth = this.getWidth(), letterSpacing = this.letterSpacing(), fill = this.fill(), textDecoration = this.textDecoration(), shouldUnderline = textDecoration.indexOf('underline') !== -1, shouldLineThrough = textDecoration.indexOf('line-through') !== -1, n;
99
104
  direction = direction === INHERIT ? context.direction : direction;
100
- var translateY = lineHeightPx / 2;
101
- var baseline = MIDDLE;
105
+ let translateY = lineHeightPx / 2;
106
+ let baseline = MIDDLE;
102
107
  if (Global_1.Konva._fixTextRendering) {
103
- var metrics = this.measureSize('M');
108
+ const metrics = this.measureSize('M');
104
109
  baseline = 'alphabetic';
105
110
  translateY =
106
111
  (metrics.fontBoundingBoxAscent - metrics.fontBoundingBoxDescent) / 2 +
@@ -135,7 +140,7 @@ class Text extends Shape_1.Shape {
135
140
  if (shouldUnderline) {
136
141
  context.save();
137
142
  context.beginPath();
138
- let yOffset = Global_1.Konva._fixTextRendering
143
+ const yOffset = Global_1.Konva._fixTextRendering
139
144
  ? Math.round(fontSize / 4)
140
145
  : Math.round(fontSize / 2);
141
146
  const x = lineTranslateX;
@@ -155,14 +160,12 @@ class Text extends Shape_1.Shape {
155
160
  if (shouldLineThrough) {
156
161
  context.save();
157
162
  context.beginPath();
158
- let yOffset = Global_1.Konva._fixTextRendering ? -Math.round(fontSize / 4) : 0;
163
+ const yOffset = Global_1.Konva._fixTextRendering ? -Math.round(fontSize / 4) : 0;
159
164
  context.moveTo(lineTranslateX, translateY + lineTranslateY + yOffset);
160
165
  spacesNumber = text.split(' ').length - 1;
161
166
  oneWord = spacesNumber === 0;
162
167
  lineWidth =
163
- align === JUSTIFY && lastLine && !oneWord
164
- ? totalWidth - padding * 2
165
- : width;
168
+ align === JUSTIFY && !lastLine ? totalWidth - padding * 2 : width;
166
169
  context.lineTo(lineTranslateX + Math.round(lineWidth), translateY + lineTranslateY + yOffset);
167
170
  context.lineWidth = fontSize / 15;
168
171
  const gradient = this._getLinearGradient();
@@ -172,9 +175,9 @@ class Text extends Shape_1.Shape {
172
175
  }
173
176
  if (direction !== RTL && (letterSpacing !== 0 || align === JUSTIFY)) {
174
177
  spacesNumber = text.split(' ').length - 1;
175
- var array = stringToArray(text);
176
- for (var li = 0; li < array.length; li++) {
177
- var letter = array[li];
178
+ const array = stringToArray(text);
179
+ for (let li = 0; li < array.length; li++) {
180
+ const letter = array[li];
178
181
  if (letter === ' ' && !lastLine && align === JUSTIFY) {
179
182
  lineTranslateX += (totalWidth - padding * 2 - width) / spacesNumber;
180
183
  }
@@ -201,14 +204,14 @@ class Text extends Shape_1.Shape {
201
204
  }
202
205
  }
203
206
  _hitFunc(context) {
204
- var width = this.getWidth(), height = this.getHeight();
207
+ const width = this.getWidth(), height = this.getHeight();
205
208
  context.beginPath();
206
209
  context.rect(0, 0, width, height);
207
210
  context.closePath();
208
211
  context.fillStrokeShape(this);
209
212
  }
210
213
  setText(text) {
211
- var str = Util_1.Util._isString(text)
214
+ const str = Util_1.Util._isString(text)
212
215
  ? text
213
216
  : text === null || text === undefined
214
217
  ? ''
@@ -217,11 +220,11 @@ class Text extends Shape_1.Shape {
217
220
  return this;
218
221
  }
219
222
  getWidth() {
220
- var isAuto = this.attrs.width === AUTO || this.attrs.width === undefined;
223
+ const isAuto = this.attrs.width === AUTO || this.attrs.width === undefined;
221
224
  return isAuto ? this.getTextWidth() + this.padding() * 2 : this.attrs.width;
222
225
  }
223
226
  getHeight() {
224
- var isAuto = this.attrs.height === AUTO || this.attrs.height === undefined;
227
+ const isAuto = this.attrs.height === AUTO || this.attrs.height === undefined;
225
228
  return isAuto
226
229
  ? this.fontSize() * this.textArr.length * this.lineHeight() +
227
230
  this.padding() * 2
@@ -236,7 +239,7 @@ class Text extends Shape_1.Shape {
236
239
  }
237
240
  measureSize(text) {
238
241
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
239
- var _context = getDummyContext(), fontSize = this.fontSize(), metrics;
242
+ let _context = getDummyContext(), fontSize = this.fontSize(), metrics;
240
243
  _context.save();
241
244
  _context.font = this._getContextFont();
242
245
  metrics = _context.measureText(text);
@@ -271,7 +274,7 @@ class Text extends Shape_1.Shape {
271
274
  if (align === JUSTIFY) {
272
275
  line = line.trim();
273
276
  }
274
- var width = this._getTextWidth(line);
277
+ const width = this._getTextWidth(line);
275
278
  return this.textArr.push({
276
279
  text: line,
277
280
  width: width,
@@ -279,24 +282,25 @@ class Text extends Shape_1.Shape {
279
282
  });
280
283
  }
281
284
  _getTextWidth(text) {
282
- var letterSpacing = this.letterSpacing();
283
- var length = text.length;
284
- return (getDummyContext().measureText(text).width +
285
- (length ? letterSpacing * (length - 1) : 0));
285
+ const letterSpacing = this.letterSpacing();
286
+ const length = text.length;
287
+ return getDummyContext().measureText(text).width + letterSpacing * length;
286
288
  }
287
289
  _setTextData() {
288
- var lines = this.text().split('\n'), fontSize = +this.fontSize(), textWidth = 0, lineHeightPx = this.lineHeight() * fontSize, width = this.attrs.width, height = this.attrs.height, fixedWidth = width !== AUTO && width !== undefined, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxWidth = width - padding * 2, maxHeightPx = height - padding * 2, currentHeightPx = 0, wrap = this.wrap(), shouldWrap = wrap !== NONE, wrapAtWord = wrap !== CHAR && shouldWrap, shouldAddEllipsis = this.ellipsis();
290
+ let lines = this.text().split('\n'), fontSize = +this.fontSize(), textWidth = 0, lineHeightPx = this.lineHeight() * fontSize, width = this.attrs.width, height = this.attrs.height, fixedWidth = width !== AUTO && width !== undefined, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxWidth = width - padding * 2, maxHeightPx = height - padding * 2, currentHeightPx = 0, wrap = this.wrap(), shouldWrap = wrap !== NONE, wrapAtWord = wrap !== CHAR && shouldWrap, shouldAddEllipsis = this.ellipsis();
289
291
  this.textArr = [];
290
292
  getDummyContext().font = this._getContextFont();
291
- var additionalWidth = shouldAddEllipsis ? this._getTextWidth(ELLIPSIS) : 0;
292
- for (var i = 0, max = lines.length; i < max; ++i) {
293
- var line = lines[i];
294
- var lineWidth = this._getTextWidth(line);
293
+ const additionalWidth = shouldAddEllipsis
294
+ ? this._getTextWidth(ELLIPSIS)
295
+ : 0;
296
+ for (let i = 0, max = lines.length; i < max; ++i) {
297
+ let line = lines[i];
298
+ let lineWidth = this._getTextWidth(line);
295
299
  if (fixedWidth && lineWidth > maxWidth) {
296
300
  while (line.length > 0) {
297
- var low = 0, high = line.length, match = '', matchWidth = 0;
301
+ let low = 0, high = line.length, match = '', matchWidth = 0;
298
302
  while (low < high) {
299
- var mid = (low + high) >>> 1, substr = line.slice(0, mid + 1), substrWidth = this._getTextWidth(substr) + additionalWidth;
303
+ const mid = (low + high) >>> 1, substr = line.slice(0, mid + 1), substrWidth = this._getTextWidth(substr) + additionalWidth;
300
304
  if (substrWidth <= maxWidth) {
301
305
  low = mid + 1;
302
306
  match = substr;
@@ -309,8 +313,8 @@ class Text extends Shape_1.Shape {
309
313
  if (match) {
310
314
  if (wrapAtWord) {
311
315
  var wrapIndex;
312
- var nextChar = line[match.length];
313
- var nextIsSpaceOrDash = nextChar === SPACE || nextChar === DASH;
316
+ const nextChar = line[match.length];
317
+ const nextIsSpaceOrDash = nextChar === SPACE || nextChar === DASH;
314
318
  if (nextIsSpaceOrDash && matchWidth <= maxWidth) {
315
319
  wrapIndex = match.length;
316
320
  }
@@ -329,7 +333,7 @@ class Text extends Shape_1.Shape {
329
333
  this._addTextLine(match);
330
334
  textWidth = Math.max(textWidth, matchWidth);
331
335
  currentHeightPx += lineHeightPx;
332
- var shouldHandleEllipsis = this._shouldHandleEllipsis(currentHeightPx);
336
+ const shouldHandleEllipsis = this._shouldHandleEllipsis(currentHeightPx);
333
337
  if (shouldHandleEllipsis) {
334
338
  this._tryToAddEllipsisToLastLine();
335
339
  break;
@@ -370,18 +374,18 @@ class Text extends Shape_1.Shape {
370
374
  this.textWidth = textWidth;
371
375
  }
372
376
  _shouldHandleEllipsis(currentHeightPx) {
373
- var fontSize = +this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, height = this.attrs.height, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxHeightPx = height - padding * 2, wrap = this.wrap(), shouldWrap = wrap !== NONE;
377
+ const fontSize = +this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, height = this.attrs.height, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxHeightPx = height - padding * 2, wrap = this.wrap(), shouldWrap = wrap !== NONE;
374
378
  return (!shouldWrap ||
375
379
  (fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx));
376
380
  }
377
381
  _tryToAddEllipsisToLastLine() {
378
- var width = this.attrs.width, fixedWidth = width !== AUTO && width !== undefined, padding = this.padding(), maxWidth = width - padding * 2, shouldAddEllipsis = this.ellipsis();
379
- var lastLine = this.textArr[this.textArr.length - 1];
382
+ const width = this.attrs.width, fixedWidth = width !== AUTO && width !== undefined, padding = this.padding(), maxWidth = width - padding * 2, shouldAddEllipsis = this.ellipsis();
383
+ const lastLine = this.textArr[this.textArr.length - 1];
380
384
  if (!lastLine || !shouldAddEllipsis) {
381
385
  return;
382
386
  }
383
387
  if (fixedWidth) {
384
- var haveSpace = this._getTextWidth(lastLine.text + ELLIPSIS) < maxWidth;
388
+ const haveSpace = this._getTextWidth(lastLine.text + ELLIPSIS) < maxWidth;
385
389
  if (!haveSpace) {
386
390
  lastLine.text = lastLine.text.slice(0, lastLine.text.length - 3);
387
391
  }
@@ -8,7 +8,7 @@ const Path_1 = require("./Path");
8
8
  const Text_1 = require("./Text");
9
9
  const Validators_1 = require("../Validators");
10
10
  const Global_1 = require("../Global");
11
- var EMPTY_STRING = '', NORMAL = 'normal';
11
+ const EMPTY_STRING = '', NORMAL = 'normal';
12
12
  function _fillFunc(context) {
13
13
  context.fillText(this.partialText, 0, 0);
14
14
  }
@@ -50,16 +50,16 @@ class TextPath extends Shape_1.Shape {
50
50
  context.setAttr('textBaseline', this.textBaseline());
51
51
  context.setAttr('textAlign', 'left');
52
52
  context.save();
53
- var textDecoration = this.textDecoration();
54
- var fill = this.fill();
55
- var fontSize = this.fontSize();
56
- var glyphInfo = this.glyphInfo;
53
+ const textDecoration = this.textDecoration();
54
+ const fill = this.fill();
55
+ const fontSize = this.fontSize();
56
+ const glyphInfo = this.glyphInfo;
57
57
  if (textDecoration === 'underline') {
58
58
  context.beginPath();
59
59
  }
60
- for (var i = 0; i < glyphInfo.length; i++) {
60
+ for (let i = 0; i < glyphInfo.length; i++) {
61
61
  context.save();
62
- var p0 = glyphInfo[i].p0;
62
+ const p0 = glyphInfo[i].p0;
63
63
  context.translate(p0.x, p0.y);
64
64
  context.rotate(glyphInfo[i].rotation);
65
65
  this.partialText = glyphInfo[i].text;
@@ -81,13 +81,13 @@ class TextPath extends Shape_1.Shape {
81
81
  }
82
82
  _hitFunc(context) {
83
83
  context.beginPath();
84
- var glyphInfo = this.glyphInfo;
84
+ const glyphInfo = this.glyphInfo;
85
85
  if (glyphInfo.length >= 1) {
86
- var p0 = glyphInfo[0].p0;
86
+ const p0 = glyphInfo[0].p0;
87
87
  context.moveTo(p0.x, p0.y);
88
88
  }
89
- for (var i = 0; i < glyphInfo.length; i++) {
90
- var p1 = glyphInfo[i].p1;
89
+ for (let i = 0; i < glyphInfo.length; i++) {
90
+ const p1 = glyphInfo[i].p1;
91
91
  context.lineTo(p1.x, p1.y);
92
92
  }
93
93
  context.setAttr('lineWidth', this.fontSize());
@@ -108,11 +108,11 @@ class TextPath extends Shape_1.Shape {
108
108
  return Text_1.Text.prototype._getContextFont.call(this);
109
109
  }
110
110
  _getTextSize(text) {
111
- var dummyCanvas = this.dummyCanvas;
112
- var _context = dummyCanvas.getContext('2d');
111
+ const dummyCanvas = this.dummyCanvas;
112
+ const _context = dummyCanvas.getContext('2d');
113
113
  _context.save();
114
114
  _context.font = this._getContextFont();
115
- var metrics = _context.measureText(text);
115
+ const metrics = _context.measureText(text);
116
116
  _context.restore();
117
117
  return {
118
118
  width: metrics.width,
@@ -140,7 +140,7 @@ class TextPath extends Shape_1.Shape {
140
140
  }
141
141
  const charArr = (0, Text_1.stringToArray)(this.text());
142
142
  let offsetToGlyph = offset;
143
- for (var i = 0; i < charArr.length; i++) {
143
+ for (let i = 0; i < charArr.length; i++) {
144
144
  const charStartPoint = this._getPointAtLength(offsetToGlyph);
145
145
  if (!charStartPoint)
146
146
  return;
@@ -187,19 +187,19 @@ class TextPath extends Shape_1.Shape {
187
187
  height: 0,
188
188
  };
189
189
  }
190
- var points = [];
190
+ const points = [];
191
191
  this.glyphInfo.forEach(function (info) {
192
192
  points.push(info.p0.x);
193
193
  points.push(info.p0.y);
194
194
  points.push(info.p1.x);
195
195
  points.push(info.p1.y);
196
196
  });
197
- var minX = points[0] || 0;
198
- var maxX = points[0] || 0;
199
- var minY = points[1] || 0;
200
- var maxY = points[1] || 0;
201
- var x, y;
202
- for (var i = 0; i < points.length / 2; i++) {
197
+ let minX = points[0] || 0;
198
+ let maxX = points[0] || 0;
199
+ let minY = points[1] || 0;
200
+ let maxY = points[1] || 0;
201
+ let x, y;
202
+ for (let i = 0; i < points.length / 2; i++) {
203
203
  x = points[i * 2];
204
204
  y = points[i * 2 + 1];
205
205
  minX = Math.min(minX, x);
@@ -207,7 +207,7 @@ class TextPath extends Shape_1.Shape {
207
207
  minY = Math.min(minY, y);
208
208
  maxY = Math.max(maxY, y);
209
209
  }
210
- var fontSize = this.fontSize();
210
+ const fontSize = this.fontSize();
211
211
  return {
212
212
  x: minX - fontSize / 2,
213
213
  y: minY - fontSize / 2,
@@ -237,5 +237,5 @@ Factory_1.Factory.addGetterSetter(TextPath, 'letterSpacing', 0, (0, Validators_1
237
237
  Factory_1.Factory.addGetterSetter(TextPath, 'textBaseline', 'middle');
238
238
  Factory_1.Factory.addGetterSetter(TextPath, 'fontVariant', NORMAL);
239
239
  Factory_1.Factory.addGetterSetter(TextPath, 'text', EMPTY_STRING);
240
- Factory_1.Factory.addGetterSetter(TextPath, 'textDecoration', null);
241
- Factory_1.Factory.addGetterSetter(TextPath, 'kerningFunc', null);
240
+ Factory_1.Factory.addGetterSetter(TextPath, 'textDecoration', '');
241
+ Factory_1.Factory.addGetterSetter(TextPath, 'kerningFunc', undefined);
@@ -94,7 +94,7 @@ export declare class Transformer extends Group {
94
94
  toObject(): {
95
95
  attrs: any;
96
96
  className: string;
97
- children?: any[] | undefined;
97
+ children?: Array<any>;
98
98
  };
99
99
  clone(obj?: any): this;
100
100
  getClientRect(): IRect;