konva 8.3.0 → 8.3.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.
- package/README.md +15 -0
- package/cmj/Node.js +10 -7
- package/cmj/Stage.js +1 -3
- package/cmj/Util.js +6 -1
- package/cmj/index-types.d.ts +1 -0
- package/cmj/shapes/Arc.d.ts +6 -0
- package/cmj/shapes/Arc.js +20 -0
- package/cmj/shapes/Image.d.ts +1 -1
- package/cmj/shapes/Image.js +2 -1
- package/cmj/shapes/Text.d.ts +1 -0
- package/cmj/shapes/Text.js +10 -3
- package/cmj/shapes/Transformer.d.ts +1 -1
- package/konva.js +53 -18
- package/konva.min.js +3 -3
- package/lib/Global.js +1 -1
- package/lib/Node.js +10 -7
- package/lib/Stage.js +1 -3
- package/lib/Util.js +6 -1
- package/lib/index-types.d.ts +1 -0
- package/lib/shapes/Arc.d.ts +6 -0
- package/lib/shapes/Arc.js +20 -0
- package/lib/shapes/Image.d.ts +1 -1
- package/lib/shapes/Image.js +2 -1
- package/lib/shapes/Text.d.ts +1 -0
- package/lib/shapes/Text.js +10 -3
- package/lib/shapes/Transformer.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -128,6 +128,18 @@ In order to run `konva` in nodejs environment you also need to install `canvas`
|
|
|
128
128
|
npm install konva canvas
|
|
129
129
|
```
|
|
130
130
|
|
|
131
|
+
Then you can use the same Konva API and all Konva demos will work just fine. You just don't need to use `container` attribute in your stage.
|
|
132
|
+
|
|
133
|
+
```js
|
|
134
|
+
import Konva from 'konva';
|
|
135
|
+
|
|
136
|
+
const stage = new Konva.Stage({
|
|
137
|
+
width: 500,
|
|
138
|
+
height: 500,
|
|
139
|
+
});
|
|
140
|
+
// then all regular Konva code will work
|
|
141
|
+
```
|
|
142
|
+
|
|
131
143
|
### CommonJS modules
|
|
132
144
|
|
|
133
145
|
By default `Konva` is delivered as ES modules. Some environments may automatically take CommonJS version of `Konva`. If it doesn't work for you, try to use `cmj` version explicitly:
|
|
@@ -138,6 +150,9 @@ const Konva = require('konva/cmj').default;
|
|
|
138
150
|
|
|
139
151
|
# Backers
|
|
140
152
|
|
|
153
|
+

|
|
154
|
+

|
|
155
|
+
|
|
141
156
|
- [myposter GmbH](https://www.myposter.de/)
|
|
142
157
|
- [queue.gg](https://queue.gg/)
|
|
143
158
|
|
package/cmj/Node.js
CHANGED
|
@@ -626,11 +626,14 @@ class Node {
|
|
|
626
626
|
Util_1.Util.warn('Node has no parent. moveToTop function is ignored.');
|
|
627
627
|
return false;
|
|
628
628
|
}
|
|
629
|
-
var index = this.index;
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
629
|
+
var index = this.index, len = this.parent.getChildren().length;
|
|
630
|
+
if (index < len - 1) {
|
|
631
|
+
this.parent.children.splice(index, 1);
|
|
632
|
+
this.parent.children.push(this);
|
|
633
|
+
this.parent._setChildrenIndices();
|
|
634
|
+
return true;
|
|
635
|
+
}
|
|
636
|
+
return false;
|
|
634
637
|
}
|
|
635
638
|
moveUp() {
|
|
636
639
|
if (!this.parent) {
|
|
@@ -1290,8 +1293,8 @@ class Node {
|
|
|
1290
1293
|
const screenRect = {
|
|
1291
1294
|
x: -margin.x,
|
|
1292
1295
|
y: -margin.y,
|
|
1293
|
-
width: stage.width() + margin.x,
|
|
1294
|
-
height: stage.height() + margin.y,
|
|
1296
|
+
width: stage.width() + 2 * margin.x,
|
|
1297
|
+
height: stage.height() + 2 * margin.y,
|
|
1295
1298
|
};
|
|
1296
1299
|
return Util_1.Util.haveIntersection(screenRect, this.getClientRect());
|
|
1297
1300
|
}
|
package/cmj/Stage.js
CHANGED
|
@@ -493,14 +493,12 @@ class Stage extends Container_1.Container {
|
|
|
493
493
|
const pointerId = pos.id;
|
|
494
494
|
const event = { evt: evt, pointerId };
|
|
495
495
|
let fireDblClick = false;
|
|
496
|
-
if (Global_1.Konva['_' + eventType + 'InDblClickWindow']
|
|
497
|
-
Global_1.Konva['_' + eventType + 'InDblClickWindowId'] === pointerId) {
|
|
496
|
+
if (Global_1.Konva['_' + eventType + 'InDblClickWindow']) {
|
|
498
497
|
fireDblClick = true;
|
|
499
498
|
clearTimeout(this[eventType + 'DblTimeout']);
|
|
500
499
|
}
|
|
501
500
|
else if (!DragAndDrop_1.DD.justDragged) {
|
|
502
501
|
Global_1.Konva['_' + eventType + 'InDblClickWindow'] = true;
|
|
503
|
-
Global_1.Konva['_' + eventType + 'InDblClickWindowId'] = pointerId;
|
|
504
502
|
clearTimeout(this[eventType + 'DblTimeout']);
|
|
505
503
|
}
|
|
506
504
|
this[eventType + 'DblTimeout'] = setTimeout(function () {
|
package/cmj/Util.js
CHANGED
|
@@ -478,7 +478,12 @@ exports.Util = {
|
|
|
478
478
|
_rgbaColorToRGBA(str) {
|
|
479
479
|
if (str.indexOf('rgba(') === 0) {
|
|
480
480
|
str = str.match(/rgba\(([^)]+)\)/)[1];
|
|
481
|
-
var parts = str.split(/ *, */).map(
|
|
481
|
+
var parts = str.split(/ *, */).map((n, index) => {
|
|
482
|
+
if (n.slice(-1) === '%') {
|
|
483
|
+
return index === 3 ? parseInt(n) / 100 : (parseInt(n) / 100) * 255;
|
|
484
|
+
}
|
|
485
|
+
return Number(n);
|
|
486
|
+
});
|
|
482
487
|
return {
|
|
483
488
|
r: parts[0],
|
|
484
489
|
g: parts[1],
|
package/cmj/index-types.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ declare namespace Konva {
|
|
|
71
71
|
|
|
72
72
|
export const Stage: typeof import('./Stage').Stage;
|
|
73
73
|
export type Stage = import('./Stage').Stage;
|
|
74
|
+
export type StageConfig = import('./Stage').StageConfig;
|
|
74
75
|
export const stages: typeof import('./Stage').stages;
|
|
75
76
|
|
|
76
77
|
export const Layer: typeof import('./Layer').Layer;
|
package/cmj/shapes/Arc.d.ts
CHANGED
|
@@ -12,6 +12,12 @@ export declare class Arc extends Shape<ArcConfig> {
|
|
|
12
12
|
getHeight(): number;
|
|
13
13
|
setWidth(width: any): void;
|
|
14
14
|
setHeight(height: any): void;
|
|
15
|
+
getSelfRect(): {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
};
|
|
15
21
|
innerRadius: GetSet<number, this>;
|
|
16
22
|
outerRadius: GetSet<number, this>;
|
|
17
23
|
angle: GetSet<number, this>;
|
package/cmj/shapes/Arc.js
CHANGED
|
@@ -27,6 +27,26 @@ class Arc extends Shape_1.Shape {
|
|
|
27
27
|
setHeight(height) {
|
|
28
28
|
this.outerRadius(height / 2);
|
|
29
29
|
}
|
|
30
|
+
getSelfRect() {
|
|
31
|
+
const innerRadius = this.innerRadius();
|
|
32
|
+
const outerRadius = this.outerRadius();
|
|
33
|
+
const clockwise = this.clockwise();
|
|
34
|
+
const angle = Global_1.Konva.getAngle(clockwise ? 360 - this.angle() : this.angle());
|
|
35
|
+
const boundLeftRatio = Math.cos(Math.min(angle, Math.PI));
|
|
36
|
+
const boundRightRatio = 1;
|
|
37
|
+
const boundTopRatio = Math.sin(Math.min(Math.max(Math.PI, angle), 3 * Math.PI / 2));
|
|
38
|
+
const boundBottomRatio = Math.sin(Math.min(angle, Math.PI / 2));
|
|
39
|
+
const boundLeft = boundLeftRatio * (boundLeftRatio > 0 ? innerRadius : outerRadius);
|
|
40
|
+
const boundRight = boundRightRatio * (boundRightRatio > 0 ? outerRadius : innerRadius);
|
|
41
|
+
const boundTop = boundTopRatio * (boundTopRatio > 0 ? innerRadius : outerRadius);
|
|
42
|
+
const boundBottom = boundBottomRatio * (boundBottomRatio > 0 ? outerRadius : innerRadius);
|
|
43
|
+
return {
|
|
44
|
+
x: Math.round(boundLeft),
|
|
45
|
+
y: Math.round(clockwise ? -1 * boundBottom : boundTop),
|
|
46
|
+
width: Math.round(boundRight - boundLeft),
|
|
47
|
+
height: Math.round(boundBottom - boundTop)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
30
50
|
}
|
|
31
51
|
exports.Arc = Arc;
|
|
32
52
|
Arc.prototype._centroid = true;
|
package/cmj/shapes/Image.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare class Image extends Shape<ImageConfig> {
|
|
|
13
13
|
_hitFunc(context: any): void;
|
|
14
14
|
getWidth(): any;
|
|
15
15
|
getHeight(): any;
|
|
16
|
-
static fromURL(url: any, callback: any): void;
|
|
16
|
+
static fromURL(url: any, callback: any, onError?: any): void;
|
|
17
17
|
image: GetSet<CanvasImageSource | undefined, this>;
|
|
18
18
|
crop: GetSet<IRect, this>;
|
|
19
19
|
cropX: GetSet<number, this>;
|
package/cmj/shapes/Image.js
CHANGED
|
@@ -81,7 +81,7 @@ class Image extends Shape_1.Shape {
|
|
|
81
81
|
var _a, _b;
|
|
82
82
|
return (_a = this.attrs.height) !== null && _a !== void 0 ? _a : (_b = this.image()) === null || _b === void 0 ? void 0 : _b.height;
|
|
83
83
|
}
|
|
84
|
-
static fromURL(url, callback) {
|
|
84
|
+
static fromURL(url, callback, onError = null) {
|
|
85
85
|
var img = Util_1.Util.createImageElement();
|
|
86
86
|
img.onload = function () {
|
|
87
87
|
var image = new Image({
|
|
@@ -89,6 +89,7 @@ class Image extends Shape_1.Shape {
|
|
|
89
89
|
});
|
|
90
90
|
callback(image);
|
|
91
91
|
};
|
|
92
|
+
img.onerror = onError;
|
|
92
93
|
img.crossOrigin = 'Anonymous';
|
|
93
94
|
img.src = url;
|
|
94
95
|
}
|
package/cmj/shapes/Text.d.ts
CHANGED
package/cmj/shapes/Text.js
CHANGED
|
@@ -96,7 +96,7 @@ class Text extends Shape_1.Shape {
|
|
|
96
96
|
for (n = 0; n < textArrLen; n++) {
|
|
97
97
|
var lineTranslateX = 0;
|
|
98
98
|
var lineTranslateY = 0;
|
|
99
|
-
var obj = textArr[n], text = obj.text, width = obj.width, lastLine =
|
|
99
|
+
var obj = textArr[n], text = obj.text, width = obj.width, lastLine = obj.lastInParagraph, spacesNumber, oneWord, lineWidth;
|
|
100
100
|
context.save();
|
|
101
101
|
if (align === RIGHT) {
|
|
102
102
|
lineTranslateX += totalWidth - width - padding * 2;
|
|
@@ -141,7 +141,7 @@ class Text extends Shape_1.Shape {
|
|
|
141
141
|
var array = stringToArray(text);
|
|
142
142
|
for (var li = 0; li < array.length; li++) {
|
|
143
143
|
var letter = array[li];
|
|
144
|
-
if (letter === ' ' &&
|
|
144
|
+
if (letter === ' ' && !lastLine && align === JUSTIFY) {
|
|
145
145
|
lineTranslateX += (totalWidth - padding * 2 - width) / spacesNumber;
|
|
146
146
|
}
|
|
147
147
|
this._partialTextX = lineTranslateX;
|
|
@@ -221,7 +221,11 @@ class Text extends Shape_1.Shape {
|
|
|
221
221
|
line = line.trim();
|
|
222
222
|
}
|
|
223
223
|
var width = this._getTextWidth(line);
|
|
224
|
-
return this.textArr.push({
|
|
224
|
+
return this.textArr.push({
|
|
225
|
+
text: line,
|
|
226
|
+
width: width,
|
|
227
|
+
lastInParagraph: false,
|
|
228
|
+
});
|
|
225
229
|
}
|
|
226
230
|
_getTextWidth(text) {
|
|
227
231
|
var letterSpacing = this.letterSpacing();
|
|
@@ -314,6 +318,9 @@ class Text extends Shape_1.Shape {
|
|
|
314
318
|
if (fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx) {
|
|
315
319
|
break;
|
|
316
320
|
}
|
|
321
|
+
if (this.textArr[this.textArr.length - 1]) {
|
|
322
|
+
this.textArr[this.textArr.length - 1].lastInParagraph = true;
|
|
323
|
+
}
|
|
317
324
|
}
|
|
318
325
|
this.textHeight = fontSize;
|
|
319
326
|
this.textWidth = textWidth;
|
|
@@ -108,7 +108,7 @@ export declare class Transformer extends Group {
|
|
|
108
108
|
flipEnabled: GetSet<boolean, this>;
|
|
109
109
|
ignoreStroke: GetSet<boolean, this>;
|
|
110
110
|
boundBoxFunc: GetSet<(oldBox: Box, newBox: Box) => Box, this>;
|
|
111
|
-
anchorDragBoundFunc: GetSet<(oldPos: Vector2d, newPos: Vector2d, e: MouseEvent) =>
|
|
111
|
+
anchorDragBoundFunc: GetSet<(oldPos: Vector2d, newPos: Vector2d, e: MouseEvent) => Vector2d, this>;
|
|
112
112
|
shouldOverdrawWholeArea: GetSet<boolean, this>;
|
|
113
113
|
useSingleNodeRotation: GetSet<boolean, this>;
|
|
114
114
|
}
|
package/konva.js
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
})(this, (function () { 'use strict';
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
|
-
* Konva JavaScript Framework v8.3.
|
|
8
|
+
* Konva JavaScript Framework v8.3.3
|
|
9
9
|
* http://konvajs.org/
|
|
10
10
|
* Licensed under the MIT
|
|
11
|
-
* Date:
|
|
11
|
+
* Date: Wed Feb 23 2022
|
|
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,7 +35,7 @@
|
|
|
35
35
|
: {};
|
|
36
36
|
const Konva$2 = {
|
|
37
37
|
_global: glob,
|
|
38
|
-
version: '8.3.
|
|
38
|
+
version: '8.3.3',
|
|
39
39
|
isBrowser: detectBrowser(),
|
|
40
40
|
isUnminified: /param/.test(function (param) { }.toString()),
|
|
41
41
|
dblClickWindow: 400,
|
|
@@ -794,7 +794,12 @@
|
|
|
794
794
|
_rgbaColorToRGBA(str) {
|
|
795
795
|
if (str.indexOf('rgba(') === 0) {
|
|
796
796
|
str = str.match(/rgba\(([^)]+)\)/)[1];
|
|
797
|
-
var parts = str.split(/ *, */).map(
|
|
797
|
+
var parts = str.split(/ *, */).map((n, index) => {
|
|
798
|
+
if (n.slice(-1) === '%') {
|
|
799
|
+
return index === 3 ? parseInt(n) / 100 : (parseInt(n) / 100) * 255;
|
|
800
|
+
}
|
|
801
|
+
return Number(n);
|
|
802
|
+
});
|
|
798
803
|
return {
|
|
799
804
|
r: parts[0],
|
|
800
805
|
g: parts[1],
|
|
@@ -3449,11 +3454,14 @@
|
|
|
3449
3454
|
Util.warn('Node has no parent. moveToTop function is ignored.');
|
|
3450
3455
|
return false;
|
|
3451
3456
|
}
|
|
3452
|
-
var index = this.index;
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
+
var index = this.index, len = this.parent.getChildren().length;
|
|
3458
|
+
if (index < len - 1) {
|
|
3459
|
+
this.parent.children.splice(index, 1);
|
|
3460
|
+
this.parent.children.push(this);
|
|
3461
|
+
this.parent._setChildrenIndices();
|
|
3462
|
+
return true;
|
|
3463
|
+
}
|
|
3464
|
+
return false;
|
|
3457
3465
|
}
|
|
3458
3466
|
/**
|
|
3459
3467
|
* move node up
|
|
@@ -4496,8 +4504,8 @@
|
|
|
4496
4504
|
const screenRect = {
|
|
4497
4505
|
x: -margin.x,
|
|
4498
4506
|
y: -margin.y,
|
|
4499
|
-
width: stage.width() + margin.x,
|
|
4500
|
-
height: stage.height() + margin.y,
|
|
4507
|
+
width: stage.width() + 2 * margin.x,
|
|
4508
|
+
height: stage.height() + 2 * margin.y,
|
|
4501
4509
|
};
|
|
4502
4510
|
return Util.haveIntersection(screenRect, this.getClientRect());
|
|
4503
4511
|
}
|
|
@@ -6251,15 +6259,13 @@
|
|
|
6251
6259
|
const pointerId = pos.id;
|
|
6252
6260
|
const event = { evt: evt, pointerId };
|
|
6253
6261
|
let fireDblClick = false;
|
|
6254
|
-
if (Konva$2['_' + eventType + 'InDblClickWindow']
|
|
6255
|
-
Konva$2['_' + eventType + 'InDblClickWindowId'] === pointerId) {
|
|
6262
|
+
if (Konva$2['_' + eventType + 'InDblClickWindow']) {
|
|
6256
6263
|
fireDblClick = true;
|
|
6257
6264
|
clearTimeout(this[eventType + 'DblTimeout']);
|
|
6258
6265
|
}
|
|
6259
6266
|
else if (!DD.justDragged) {
|
|
6260
6267
|
// don't set inDblClickWindow after dragging
|
|
6261
6268
|
Konva$2['_' + eventType + 'InDblClickWindow'] = true;
|
|
6262
|
-
Konva$2['_' + eventType + 'InDblClickWindowId'] = pointerId;
|
|
6263
6269
|
clearTimeout(this[eventType + 'DblTimeout']);
|
|
6264
6270
|
}
|
|
6265
6271
|
this[eventType + 'DblTimeout'] = setTimeout(function () {
|
|
@@ -9719,6 +9725,26 @@
|
|
|
9719
9725
|
setHeight(height) {
|
|
9720
9726
|
this.outerRadius(height / 2);
|
|
9721
9727
|
}
|
|
9728
|
+
getSelfRect() {
|
|
9729
|
+
const innerRadius = this.innerRadius();
|
|
9730
|
+
const outerRadius = this.outerRadius();
|
|
9731
|
+
const clockwise = this.clockwise();
|
|
9732
|
+
const angle = Konva$2.getAngle(clockwise ? 360 - this.angle() : this.angle());
|
|
9733
|
+
const boundLeftRatio = Math.cos(Math.min(angle, Math.PI));
|
|
9734
|
+
const boundRightRatio = 1;
|
|
9735
|
+
const boundTopRatio = Math.sin(Math.min(Math.max(Math.PI, angle), 3 * Math.PI / 2));
|
|
9736
|
+
const boundBottomRatio = Math.sin(Math.min(angle, Math.PI / 2));
|
|
9737
|
+
const boundLeft = boundLeftRatio * (boundLeftRatio > 0 ? innerRadius : outerRadius);
|
|
9738
|
+
const boundRight = boundRightRatio * (outerRadius );
|
|
9739
|
+
const boundTop = boundTopRatio * (boundTopRatio > 0 ? innerRadius : outerRadius);
|
|
9740
|
+
const boundBottom = boundBottomRatio * (boundBottomRatio > 0 ? outerRadius : innerRadius);
|
|
9741
|
+
return {
|
|
9742
|
+
x: Math.round(boundLeft),
|
|
9743
|
+
y: Math.round(clockwise ? -1 * boundBottom : boundTop),
|
|
9744
|
+
width: Math.round(boundRight - boundLeft),
|
|
9745
|
+
height: Math.round(boundBottom - boundTop)
|
|
9746
|
+
};
|
|
9747
|
+
}
|
|
9722
9748
|
}
|
|
9723
9749
|
Arc.prototype._centroid = true;
|
|
9724
9750
|
Arc.prototype.className = 'Arc';
|
|
@@ -11651,6 +11677,7 @@
|
|
|
11651
11677
|
* @memberof Konva.Image
|
|
11652
11678
|
* @param {String} url image source
|
|
11653
11679
|
* @param {Function} callback with Konva.Image instance as first argument
|
|
11680
|
+
* @param {Function} onError optional error handler
|
|
11654
11681
|
* @example
|
|
11655
11682
|
* Konva.Image.fromURL(imageURL, function(image){
|
|
11656
11683
|
* // image is Konva.Image instance
|
|
@@ -11658,7 +11685,7 @@
|
|
|
11658
11685
|
* layer.draw();
|
|
11659
11686
|
* });
|
|
11660
11687
|
*/
|
|
11661
|
-
static fromURL(url, callback) {
|
|
11688
|
+
static fromURL(url, callback, onError = null) {
|
|
11662
11689
|
var img = Util.createImageElement();
|
|
11663
11690
|
img.onload = function () {
|
|
11664
11691
|
var image = new Image({
|
|
@@ -11666,6 +11693,7 @@
|
|
|
11666
11693
|
});
|
|
11667
11694
|
callback(image);
|
|
11668
11695
|
};
|
|
11696
|
+
img.onerror = onError;
|
|
11669
11697
|
img.crossOrigin = 'Anonymous';
|
|
11670
11698
|
img.src = url;
|
|
11671
11699
|
}
|
|
@@ -13272,7 +13300,7 @@
|
|
|
13272
13300
|
for (n = 0; n < textArrLen; n++) {
|
|
13273
13301
|
var lineTranslateX = 0;
|
|
13274
13302
|
var lineTranslateY = 0;
|
|
13275
|
-
var obj = textArr[n], text = obj.text, width = obj.width, lastLine =
|
|
13303
|
+
var obj = textArr[n], text = obj.text, width = obj.width, lastLine = obj.lastInParagraph, spacesNumber, oneWord, lineWidth;
|
|
13276
13304
|
// horizontal alignment
|
|
13277
13305
|
context.save();
|
|
13278
13306
|
if (align === RIGHT) {
|
|
@@ -13322,7 +13350,7 @@
|
|
|
13322
13350
|
for (var li = 0; li < array.length; li++) {
|
|
13323
13351
|
var letter = array[li];
|
|
13324
13352
|
// skip justify for the last line
|
|
13325
|
-
if (letter === ' ' &&
|
|
13353
|
+
if (letter === ' ' && !lastLine && align === JUSTIFY) {
|
|
13326
13354
|
lineTranslateX += (totalWidth - padding * 2 - width) / spacesNumber;
|
|
13327
13355
|
// context.translate(
|
|
13328
13356
|
// Math.floor((totalWidth - padding * 2 - width) / spacesNumber),
|
|
@@ -13421,7 +13449,11 @@
|
|
|
13421
13449
|
line = line.trim();
|
|
13422
13450
|
}
|
|
13423
13451
|
var width = this._getTextWidth(line);
|
|
13424
|
-
return this.textArr.push({
|
|
13452
|
+
return this.textArr.push({
|
|
13453
|
+
text: line,
|
|
13454
|
+
width: width,
|
|
13455
|
+
lastInParagraph: false,
|
|
13456
|
+
});
|
|
13425
13457
|
}
|
|
13426
13458
|
_getTextWidth(text) {
|
|
13427
13459
|
var letterSpacing = this.letterSpacing();
|
|
@@ -13543,6 +13575,9 @@
|
|
|
13543
13575
|
if (fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx) {
|
|
13544
13576
|
break;
|
|
13545
13577
|
}
|
|
13578
|
+
if (this.textArr[this.textArr.length - 1]) {
|
|
13579
|
+
this.textArr[this.textArr.length - 1].lastInParagraph = true;
|
|
13580
|
+
}
|
|
13546
13581
|
}
|
|
13547
13582
|
this.textHeight = fontSize;
|
|
13548
13583
|
// var maxTextWidth = 0;
|