|
5 | 5 | })(this, (function () { 'use strict';
|
6 | 6 |
|
7 | 7 | /*
|
8 |
| - * Konva JavaScript Framework v8.4.0 |
| 8 | + * Konva JavaScript Framework v8.4.1 |
9 | 9 | * http://konvajs.org/
|
10 | 10 | * Licensed under the MIT
|
11 |
| - * Date: Thu Jan 05 2023 |
| 11 | + * Date: Thu Jan 19 2023 |
12 | 12 | *
|
13 | 13 | * Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
|
14 | 14 | * Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)
|
|
35 | 35 | : {};
|
36 | 36 | const Konva$2 = {
|
37 | 37 | _global: glob,
|
38 |
| - version: '8.4.0', |
| 38 | + version: '8.4.1', |
39 | 39 | isBrowser: detectBrowser(),
|
40 | 40 | isUnminified: /param/.test(function (param) { }.toString()),
|
41 | 41 | dblClickWindow: 400,
|
|
5355 | 5355 | * add a child and children into container
|
5356 | 5356 | * @name Konva.Container#add
|
5357 | 5357 | * @method
|
5358 |
| - * @param {...Konva.Node} child |
| 5358 | + * @param {...Konva.Node} children |
5359 | 5359 | * @returns {Container}
|
5360 | 5360 | * @example
|
5361 | 5361 | * layer.add(rect);
|
5362 | 5362 | * layer.add(shape1, shape2, shape3);
|
| 5363 | + * // empty arrays are accepted, though each individual child must be defined |
| 5364 | + * layer.add(...shapes); |
5363 | 5365 | * // remember to redraw layer if you changed something
|
5364 | 5366 | * layer.draw();
|
5365 | 5367 | */
|
5366 | 5368 | add(...children) {
|
5367 |
| - if (arguments.length > 1) { |
5368 |
| - for (var i = 0; i < arguments.length; i++) { |
5369 |
| - this.add(arguments[i]); |
| 5369 | + if (children.length === 0) { |
| 5370 | + return this; |
| 5371 | + } |
| 5372 | + if (children.length > 1) { |
| 5373 | + for (var i = 0; i < children.length; i++) { |
| 5374 | + this.add(children[i]); |
5370 | 5375 | }
|
5371 | 5376 | return this;
|
5372 | 5377 | }
|
5373 |
| - var child = children[0]; |
| 5378 | + const child = children[0]; |
5374 | 5379 | if (child.getParent()) {
|
5375 | 5380 | child.moveTo(this);
|
5376 | 5381 | return this;
|
@@ -13498,14 +13503,13 @@
|
13498 | 13503 | spacesNumber = text.split(' ').length - 1;
|
13499 | 13504 | oneWord = spacesNumber === 0;
|
13500 | 13505 | lineWidth =
|
13501 |
| - align === JUSTIFY && lastLine && !oneWord |
13502 |
| - ? totalWidth - padding * 2 |
13503 |
| - : width; |
| 13506 | + align === JUSTIFY && !lastLine ? totalWidth - padding * 2 : width; |
13504 | 13507 | context.lineTo(lineTranslateX + Math.round(lineWidth), translateY + lineTranslateY + Math.round(fontSize / 2));
|
13505 | 13508 | // I have no idea what is real ratio
|
13506 | 13509 | // just /15 looks good enough
|
13507 | 13510 | context.lineWidth = fontSize / 15;
|
13508 |
| - context.strokeStyle = fill; |
| 13511 | + const gradient = this._getLinearGradient(); |
| 13512 | + context.strokeStyle = gradient || fill; |
13509 | 13513 | context.stroke();
|
13510 | 13514 | context.restore();
|
13511 | 13515 | }
|
|
13521 | 13525 | : width;
|
13522 | 13526 | context.lineTo(lineTranslateX + Math.round(lineWidth), translateY + lineTranslateY);
|
13523 | 13527 | context.lineWidth = fontSize / 15;
|
13524 |
| - context.strokeStyle = fill; |
| 13528 | + const gradient = this._getLinearGradient(); |
| 13529 | + context.strokeStyle = gradient || fill; |
13525 | 13530 | context.stroke();
|
13526 | 13531 | context.restore();
|
13527 | 13532 | }
|
|
13627 | 13632 | normalizeFontFamily(this.fontFamily()));
|
13628 | 13633 | }
|
13629 | 13634 | _addTextLine(line) {
|
13630 |
| - if (this.align() === JUSTIFY) { |
| 13635 | + const align = this.align(); |
| 13636 | + if (align === JUSTIFY) { |
13631 | 13637 | line = line.trim();
|
13632 | 13638 | }
|
13633 | 13639 | var width = this._getTextWidth(line);
|
|
0 commit comments