konva 8.4.3 → 9.0.1

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 (192) hide show
  1. package/README.md +1 -9
  2. package/konva.js +17691 -16989
  3. package/konva.min.js +3 -3
  4. package/lib/Animation.js +11 -7
  5. package/lib/BezierFunctions.d.ts +6 -0
  6. package/lib/BezierFunctions.js +791 -0
  7. package/lib/Canvas.d.ts +1 -0
  8. package/lib/Canvas.js +26 -18
  9. package/lib/Container.js +16 -12
  10. package/lib/Context.d.ts +3 -1
  11. package/lib/Context.js +18 -10
  12. package/lib/Core.js +7 -3
  13. package/lib/DragAndDrop.js +25 -22
  14. package/lib/Factory.js +27 -24
  15. package/lib/FastLayer.js +10 -6
  16. package/lib/Global.js +16 -12
  17. package/lib/Group.js +10 -6
  18. package/lib/Layer.js +37 -33
  19. package/lib/Node.d.ts +1 -0
  20. package/lib/Node.js +105 -104
  21. package/lib/PointerEvents.js +15 -7
  22. package/lib/Shape.js +90 -86
  23. package/lib/Stage.js +51 -47
  24. package/lib/Tween.js +26 -22
  25. package/lib/Util.js +29 -25
  26. package/lib/Validators.js +58 -44
  27. package/lib/_CoreInternals.js +36 -33
  28. package/lib/_FullInternals.js +78 -75
  29. package/lib/filters/Blur.js +9 -5
  30. package/lib/filters/Brighten.js +9 -5
  31. package/lib/filters/Contrast.js +9 -5
  32. package/lib/filters/Emboss.js +14 -10
  33. package/lib/filters/Enhance.js +9 -5
  34. package/lib/filters/Grayscale.js +5 -1
  35. package/lib/filters/HSL.js +11 -7
  36. package/lib/filters/HSV.js +11 -7
  37. package/lib/filters/Invert.js +5 -1
  38. package/lib/filters/Kaleidoscope.js +13 -9
  39. package/lib/filters/Mask.js +9 -5
  40. package/lib/filters/Noise.js +9 -5
  41. package/lib/filters/Pixelate.js +11 -7
  42. package/lib/filters/Posterize.js +9 -5
  43. package/lib/filters/RGB.js +11 -7
  44. package/lib/filters/RGBA.js +12 -8
  45. package/lib/filters/Sepia.js +5 -1
  46. package/lib/filters/Solarize.js +5 -1
  47. package/lib/filters/Threshold.js +9 -5
  48. package/lib/index-node.js +7 -5
  49. package/lib/index.js +4 -2
  50. package/lib/shapes/Arc.js +17 -13
  51. package/lib/shapes/Arrow.js +17 -13
  52. package/lib/shapes/Circle.js +11 -7
  53. package/lib/shapes/Ellipse.js +13 -9
  54. package/lib/shapes/Image.js +21 -17
  55. package/lib/shapes/Label.js +18 -13
  56. package/lib/shapes/Line.js +14 -10
  57. package/lib/shapes/Path.d.ts +5 -2
  58. package/lib/shapes/Path.js +44 -43
  59. package/lib/shapes/Rect.js +13 -9
  60. package/lib/shapes/RegularPolygon.js +12 -8
  61. package/lib/shapes/Ring.js +12 -8
  62. package/lib/shapes/Sprite.js +19 -15
  63. package/lib/shapes/Star.js +13 -9
  64. package/lib/shapes/Text.js +31 -26
  65. package/lib/shapes/TextPath.d.ts +5 -1
  66. package/lib/shapes/TextPath.js +82 -188
  67. package/lib/shapes/Transformer.d.ts +2 -0
  68. package/lib/shapes/Transformer.js +97 -82
  69. package/lib/shapes/Wedge.js +16 -12
  70. package/lib/types.d.ts +6 -0
  71. package/lib/types.js +5 -2
  72. package/package.json +13 -42
  73. package/cmj/Animation.d.ts +0 -24
  74. package/cmj/Animation.js +0 -145
  75. package/cmj/Canvas.d.ts +0 -32
  76. package/cmj/Canvas.js +0 -114
  77. package/cmj/Container.d.ts +0 -47
  78. package/cmj/Container.js +0 -325
  79. package/cmj/Context.d.ts +0 -85
  80. package/cmj/Context.js +0 -538
  81. package/cmj/Core.d.ts +0 -3
  82. package/cmj/Core.js +0 -7
  83. package/cmj/DragAndDrop.d.ts +0 -17
  84. package/cmj/DragAndDrop.js +0 -111
  85. package/cmj/Factory.d.ts +0 -11
  86. package/cmj/Factory.js +0 -125
  87. package/cmj/FastLayer.d.ts +0 -4
  88. package/cmj/FastLayer.js +0 -16
  89. package/cmj/Global.d.ts +0 -34
  90. package/cmj/Global.js +0 -61
  91. package/cmj/Group.d.ts +0 -8
  92. package/cmj/Group.js +0 -17
  93. package/cmj/Layer.d.ts +0 -61
  94. package/cmj/Layer.js +0 -309
  95. package/cmj/Node.d.ts +0 -328
  96. package/cmj/Node.js +0 -1420
  97. package/cmj/PointerEvents.d.ts +0 -11
  98. package/cmj/PointerEvents.js +0 -45
  99. package/cmj/Shape.d.ts +0 -186
  100. package/cmj/Shape.js +0 -521
  101. package/cmj/Stage.d.ts +0 -85
  102. package/cmj/Stage.js +0 -692
  103. package/cmj/Tween.d.ts +0 -86
  104. package/cmj/Tween.js +0 -520
  105. package/cmj/Util.d.ts +0 -91
  106. package/cmj/Util.js +0 -801
  107. package/cmj/Validators.d.ts +0 -11
  108. package/cmj/Validators.js +0 -192
  109. package/cmj/_CoreInternals.d.ts +0 -152
  110. package/cmj/_CoreInternals.js +0 -37
  111. package/cmj/_FullInternals.d.ts +0 -196
  112. package/cmj/_FullInternals.js +0 -81
  113. package/cmj/filters/Blur.d.ts +0 -2
  114. package/cmj/filters/Blur.js +0 -701
  115. package/cmj/filters/Brighten.d.ts +0 -2
  116. package/cmj/filters/Brighten.js +0 -16
  117. package/cmj/filters/Contrast.d.ts +0 -2
  118. package/cmj/filters/Contrast.js +0 -38
  119. package/cmj/filters/Emboss.d.ts +0 -2
  120. package/cmj/filters/Emboss.js +0 -106
  121. package/cmj/filters/Enhance.d.ts +0 -2
  122. package/cmj/filters/Enhance.js +0 -87
  123. package/cmj/filters/Grayscale.d.ts +0 -2
  124. package/cmj/filters/Grayscale.js +0 -13
  125. package/cmj/filters/HSL.d.ts +0 -2
  126. package/cmj/filters/HSL.js +0 -28
  127. package/cmj/filters/HSV.d.ts +0 -2
  128. package/cmj/filters/HSV.js +0 -28
  129. package/cmj/filters/Invert.d.ts +0 -2
  130. package/cmj/filters/Invert.js +0 -12
  131. package/cmj/filters/Kaleidoscope.d.ts +0 -2
  132. package/cmj/filters/Kaleidoscope.js +0 -137
  133. package/cmj/filters/Mask.d.ts +0 -2
  134. package/cmj/filters/Mask.js +0 -144
  135. package/cmj/filters/Noise.d.ts +0 -2
  136. package/cmj/filters/Noise.js +0 -16
  137. package/cmj/filters/Pixelate.d.ts +0 -2
  138. package/cmj/filters/Pixelate.js +0 -64
  139. package/cmj/filters/Posterize.d.ts +0 -2
  140. package/cmj/filters/Posterize.js +0 -14
  141. package/cmj/filters/RGB.d.ts +0 -2
  142. package/cmj/filters/RGB.js +0 -43
  143. package/cmj/filters/RGBA.d.ts +0 -2
  144. package/cmj/filters/RGBA.js +0 -53
  145. package/cmj/filters/Sepia.d.ts +0 -2
  146. package/cmj/filters/Sepia.js +0 -15
  147. package/cmj/filters/Solarize.d.ts +0 -2
  148. package/cmj/filters/Solarize.js +0 -29
  149. package/cmj/filters/Threshold.d.ts +0 -2
  150. package/cmj/filters/Threshold.js +0 -14
  151. package/cmj/index-node.d.ts +0 -2
  152. package/cmj/index-node.js +0 -21
  153. package/cmj/index-types.d.ts +0 -181
  154. package/cmj/index.d.ts +0 -2
  155. package/cmj/index.js +0 -4
  156. package/cmj/package.json +0 -6
  157. package/cmj/shapes/Arc.d.ts +0 -26
  158. package/cmj/shapes/Arc.js +0 -59
  159. package/cmj/shapes/Arrow.d.ts +0 -26
  160. package/cmj/shapes/Arrow.js +0 -103
  161. package/cmj/shapes/Circle.d.ts +0 -14
  162. package/cmj/shapes/Circle.js +0 -37
  163. package/cmj/shapes/Ellipse.d.ts +0 -17
  164. package/cmj/shapes/Ellipse.js +0 -41
  165. package/cmj/shapes/Image.d.ts +0 -25
  166. package/cmj/shapes/Image.js +0 -117
  167. package/cmj/shapes/Label.d.ts +0 -36
  168. package/cmj/shapes/Label.js +0 -178
  169. package/cmj/shapes/Line.d.ts +0 -28
  170. package/cmj/shapes/Line.js +0 -159
  171. package/cmj/shapes/Path.d.ts +0 -37
  172. package/cmj/shapes/Path.js +0 -631
  173. package/cmj/shapes/Rect.d.ts +0 -10
  174. package/cmj/shapes/Rect.js +0 -26
  175. package/cmj/shapes/RegularPolygon.d.ts +0 -23
  176. package/cmj/shapes/RegularPolygon.js +0 -69
  177. package/cmj/shapes/Ring.d.ts +0 -16
  178. package/cmj/shapes/Ring.js +0 -37
  179. package/cmj/shapes/Sprite.d.ts +0 -31
  180. package/cmj/shapes/Sprite.js +0 -112
  181. package/cmj/shapes/Star.d.ts +0 -18
  182. package/cmj/shapes/Star.js +0 -42
  183. package/cmj/shapes/Text.d.ts +0 -63
  184. package/cmj/shapes/Text.js +0 -373
  185. package/cmj/shapes/TextPath.d.ts +0 -56
  186. package/cmj/shapes/TextPath.js +0 -351
  187. package/cmj/shapes/Transformer.d.ts +0 -116
  188. package/cmj/shapes/Transformer.js +0 -971
  189. package/cmj/shapes/Wedge.d.ts +0 -18
  190. package/cmj/shapes/Wedge.js +0 -42
  191. package/cmj/types.d.ts +0 -50
  192. package/cmj/types.js +0 -25
@@ -1,69 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RegularPolygon = void 0;
4
- const Factory_1 = require("../Factory");
5
- const Shape_1 = require("../Shape");
6
- const Validators_1 = require("../Validators");
7
- const Global_1 = require("../Global");
8
- class RegularPolygon extends Shape_1.Shape {
9
- _sceneFunc(context) {
10
- const points = this._getPoints();
11
- context.beginPath();
12
- context.moveTo(points[0].x, points[0].y);
13
- for (var n = 1; n < points.length; n++) {
14
- context.lineTo(points[n].x, points[n].y);
15
- }
16
- context.closePath();
17
- context.fillStrokeShape(this);
18
- }
19
- _getPoints() {
20
- const sides = this.attrs.sides;
21
- const radius = this.attrs.radius || 0;
22
- const points = [];
23
- for (var n = 0; n < sides; n++) {
24
- points.push({
25
- x: radius * Math.sin((n * 2 * Math.PI) / sides),
26
- y: -1 * radius * Math.cos((n * 2 * Math.PI) / sides),
27
- });
28
- }
29
- return points;
30
- }
31
- getSelfRect() {
32
- const points = this._getPoints();
33
- var minX = points[0].x;
34
- var maxX = points[0].y;
35
- var minY = points[0].x;
36
- var maxY = points[0].y;
37
- points.forEach((point) => {
38
- minX = Math.min(minX, point.x);
39
- maxX = Math.max(maxX, point.x);
40
- minY = Math.min(minY, point.y);
41
- maxY = Math.max(maxY, point.y);
42
- });
43
- return {
44
- x: minX,
45
- y: minY,
46
- width: maxX - minX,
47
- height: maxY - minY,
48
- };
49
- }
50
- getWidth() {
51
- return this.radius() * 2;
52
- }
53
- getHeight() {
54
- return this.radius() * 2;
55
- }
56
- setWidth(width) {
57
- this.radius(width / 2);
58
- }
59
- setHeight(height) {
60
- this.radius(height / 2);
61
- }
62
- }
63
- exports.RegularPolygon = RegularPolygon;
64
- RegularPolygon.prototype.className = 'RegularPolygon';
65
- RegularPolygon.prototype._centroid = true;
66
- RegularPolygon.prototype._attrsAffectingSize = ['radius'];
67
- (0, Global_1._registerNode)(RegularPolygon);
68
- Factory_1.Factory.addGetterSetter(RegularPolygon, 'radius', 0, (0, Validators_1.getNumberValidator)());
69
- Factory_1.Factory.addGetterSetter(RegularPolygon, 'sides', 0, (0, Validators_1.getNumberValidator)());
@@ -1,16 +0,0 @@
1
- import { Shape, ShapeConfig } from '../Shape';
2
- import { GetSet } from '../types';
3
- import { Context } from '../Context';
4
- export interface RingConfig extends ShapeConfig {
5
- innerRadius: number;
6
- outerRadius: number;
7
- }
8
- export declare class Ring extends Shape<RingConfig> {
9
- _sceneFunc(context: Context): void;
10
- getWidth(): number;
11
- getHeight(): number;
12
- setWidth(width: number): void;
13
- setHeight(height: number): void;
14
- outerRadius: GetSet<number, this>;
15
- innerRadius: GetSet<number, this>;
16
- }
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Ring = void 0;
4
- const Factory_1 = require("../Factory");
5
- const Shape_1 = require("../Shape");
6
- const Validators_1 = require("../Validators");
7
- const Global_1 = require("../Global");
8
- var PIx2 = Math.PI * 2;
9
- class Ring extends Shape_1.Shape {
10
- _sceneFunc(context) {
11
- context.beginPath();
12
- context.arc(0, 0, this.innerRadius(), 0, PIx2, false);
13
- context.moveTo(this.outerRadius(), 0);
14
- context.arc(0, 0, this.outerRadius(), PIx2, 0, true);
15
- context.closePath();
16
- context.fillStrokeShape(this);
17
- }
18
- getWidth() {
19
- return this.outerRadius() * 2;
20
- }
21
- getHeight() {
22
- return this.outerRadius() * 2;
23
- }
24
- setWidth(width) {
25
- this.outerRadius(width / 2);
26
- }
27
- setHeight(height) {
28
- this.outerRadius(height / 2);
29
- }
30
- }
31
- exports.Ring = Ring;
32
- Ring.prototype.className = 'Ring';
33
- Ring.prototype._centroid = true;
34
- Ring.prototype._attrsAffectingSize = ['innerRadius', 'outerRadius'];
35
- (0, Global_1._registerNode)(Ring);
36
- Factory_1.Factory.addGetterSetter(Ring, 'innerRadius', 0, (0, Validators_1.getNumberValidator)());
37
- Factory_1.Factory.addGetterSetter(Ring, 'outerRadius', 0, (0, Validators_1.getNumberValidator)());
@@ -1,31 +0,0 @@
1
- import { Context } from '../Context';
2
- import { Shape, ShapeConfig } from '../Shape';
3
- import { Animation } from '../Animation';
4
- import { GetSet } from '../types';
5
- export interface SpriteConfig extends ShapeConfig {
6
- animation: string;
7
- animations: any;
8
- frameIndex?: number;
9
- image: HTMLImageElement;
10
- frameRate?: number;
11
- }
12
- export declare class Sprite extends Shape<SpriteConfig> {
13
- _updated: boolean;
14
- anim: Animation;
15
- interval: any;
16
- constructor(config: SpriteConfig);
17
- _sceneFunc(context: Context): void;
18
- _hitFunc(context: Context): void;
19
- _useBufferCanvas(): boolean;
20
- _setInterval(): void;
21
- start(): void;
22
- stop(): void;
23
- isRunning(): boolean;
24
- _updateIndex(): void;
25
- frameIndex: GetSet<number, this>;
26
- animation: GetSet<string, this>;
27
- image: GetSet<CanvasImageSource, this>;
28
- animations: GetSet<any, this>;
29
- frameOffsets: GetSet<any, this>;
30
- frameRate: GetSet<number, this>;
31
- }
@@ -1,112 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Sprite = void 0;
4
- const Factory_1 = require("../Factory");
5
- const Shape_1 = require("../Shape");
6
- const Animation_1 = require("../Animation");
7
- const Validators_1 = require("../Validators");
8
- const Global_1 = require("../Global");
9
- class Sprite extends Shape_1.Shape {
10
- constructor(config) {
11
- super(config);
12
- this._updated = true;
13
- this.anim = new Animation_1.Animation(() => {
14
- var updated = this._updated;
15
- this._updated = false;
16
- return updated;
17
- });
18
- this.on('animationChange.konva', function () {
19
- this.frameIndex(0);
20
- });
21
- this.on('frameIndexChange.konva', function () {
22
- this._updated = true;
23
- });
24
- this.on('frameRateChange.konva', function () {
25
- if (!this.anim.isRunning()) {
26
- return;
27
- }
28
- clearInterval(this.interval);
29
- this._setInterval();
30
- });
31
- }
32
- _sceneFunc(context) {
33
- var anim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), x = set[ix4 + 0], y = set[ix4 + 1], width = set[ix4 + 2], height = set[ix4 + 3], image = this.image();
34
- if (this.hasFill() || this.hasStroke()) {
35
- context.beginPath();
36
- context.rect(0, 0, width, height);
37
- context.closePath();
38
- context.fillStrokeShape(this);
39
- }
40
- if (image) {
41
- if (offsets) {
42
- var offset = offsets[anim], ix2 = index * 2;
43
- context.drawImage(image, x, y, width, height, offset[ix2 + 0], offset[ix2 + 1], width, height);
44
- }
45
- else {
46
- context.drawImage(image, x, y, width, height, 0, 0, width, height);
47
- }
48
- }
49
- }
50
- _hitFunc(context) {
51
- var anim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), width = set[ix4 + 2], height = set[ix4 + 3];
52
- context.beginPath();
53
- if (offsets) {
54
- var offset = offsets[anim];
55
- var ix2 = index * 2;
56
- context.rect(offset[ix2 + 0], offset[ix2 + 1], width, height);
57
- }
58
- else {
59
- context.rect(0, 0, width, height);
60
- }
61
- context.closePath();
62
- context.fillShape(this);
63
- }
64
- _useBufferCanvas() {
65
- return super._useBufferCanvas(true);
66
- }
67
- _setInterval() {
68
- var that = this;
69
- this.interval = setInterval(function () {
70
- that._updateIndex();
71
- }, 1000 / this.frameRate());
72
- }
73
- start() {
74
- if (this.isRunning()) {
75
- return;
76
- }
77
- var layer = this.getLayer();
78
- this.anim.setLayers(layer);
79
- this._setInterval();
80
- this.anim.start();
81
- }
82
- stop() {
83
- this.anim.stop();
84
- clearInterval(this.interval);
85
- }
86
- isRunning() {
87
- return this.anim.isRunning();
88
- }
89
- _updateIndex() {
90
- var index = this.frameIndex(), animation = this.animation(), animations = this.animations(), anim = animations[animation], len = anim.length / 4;
91
- if (index < len - 1) {
92
- this.frameIndex(index + 1);
93
- }
94
- else {
95
- this.frameIndex(0);
96
- }
97
- }
98
- }
99
- exports.Sprite = Sprite;
100
- Sprite.prototype.className = 'Sprite';
101
- (0, Global_1._registerNode)(Sprite);
102
- Factory_1.Factory.addGetterSetter(Sprite, 'animation');
103
- Factory_1.Factory.addGetterSetter(Sprite, 'animations');
104
- Factory_1.Factory.addGetterSetter(Sprite, 'frameOffsets');
105
- Factory_1.Factory.addGetterSetter(Sprite, 'image');
106
- Factory_1.Factory.addGetterSetter(Sprite, 'frameIndex', 0, (0, Validators_1.getNumberValidator)());
107
- Factory_1.Factory.addGetterSetter(Sprite, 'frameRate', 17, (0, Validators_1.getNumberValidator)());
108
- Factory_1.Factory.backCompat(Sprite, {
109
- index: 'frameIndex',
110
- getIndex: 'getFrameIndex',
111
- setIndex: 'setFrameIndex',
112
- });
@@ -1,18 +0,0 @@
1
- import { Context } from '../Context';
2
- import { Shape, ShapeConfig } from '../Shape';
3
- import { GetSet } from '../types';
4
- export interface StarConfig extends ShapeConfig {
5
- numPoints: number;
6
- innerRadius: number;
7
- outerRadius: number;
8
- }
9
- export declare class Star extends Shape<StarConfig> {
10
- _sceneFunc(context: Context): void;
11
- getWidth(): number;
12
- getHeight(): number;
13
- setWidth(width: number): void;
14
- setHeight(height: number): void;
15
- outerRadius: GetSet<number, this>;
16
- innerRadius: GetSet<number, this>;
17
- numPoints: GetSet<number, this>;
18
- }
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Star = void 0;
4
- const Factory_1 = require("../Factory");
5
- const Shape_1 = require("../Shape");
6
- const Validators_1 = require("../Validators");
7
- const Global_1 = require("../Global");
8
- class Star extends Shape_1.Shape {
9
- _sceneFunc(context) {
10
- var innerRadius = this.innerRadius(), outerRadius = this.outerRadius(), numPoints = this.numPoints();
11
- context.beginPath();
12
- context.moveTo(0, 0 - outerRadius);
13
- for (var n = 1; n < numPoints * 2; n++) {
14
- var radius = n % 2 === 0 ? outerRadius : innerRadius;
15
- var x = radius * Math.sin((n * Math.PI) / numPoints);
16
- var y = -1 * radius * Math.cos((n * Math.PI) / numPoints);
17
- context.lineTo(x, y);
18
- }
19
- context.closePath();
20
- context.fillStrokeShape(this);
21
- }
22
- getWidth() {
23
- return this.outerRadius() * 2;
24
- }
25
- getHeight() {
26
- return this.outerRadius() * 2;
27
- }
28
- setWidth(width) {
29
- this.outerRadius(width / 2);
30
- }
31
- setHeight(height) {
32
- this.outerRadius(height / 2);
33
- }
34
- }
35
- exports.Star = Star;
36
- Star.prototype.className = 'Star';
37
- Star.prototype._centroid = true;
38
- Star.prototype._attrsAffectingSize = ['innerRadius', 'outerRadius'];
39
- (0, Global_1._registerNode)(Star);
40
- Factory_1.Factory.addGetterSetter(Star, 'numPoints', 5, (0, Validators_1.getNumberValidator)());
41
- Factory_1.Factory.addGetterSetter(Star, 'innerRadius', 0, (0, Validators_1.getNumberValidator)());
42
- Factory_1.Factory.addGetterSetter(Star, 'outerRadius', 0, (0, Validators_1.getNumberValidator)());
@@ -1,63 +0,0 @@
1
- import { Context } from '../Context';
2
- import { Shape, ShapeConfig } from '../Shape';
3
- import { GetSet } from '../types';
4
- export declare function stringToArray(string: string): string[];
5
- export interface TextConfig extends ShapeConfig {
6
- text?: string;
7
- fontFamily?: string;
8
- fontSize?: number;
9
- fontStyle?: string;
10
- fontVariant?: string;
11
- textDecoration?: string;
12
- align?: string;
13
- verticalAlign?: string;
14
- padding?: number;
15
- lineHeight?: number;
16
- letterSpacing?: number;
17
- wrap?: string;
18
- ellipsis?: boolean;
19
- }
20
- export declare class Text extends Shape<TextConfig> {
21
- textArr: Array<{
22
- text: string;
23
- width: number;
24
- lastInParagraph: boolean;
25
- }>;
26
- _partialText: string;
27
- _partialTextX: number;
28
- _partialTextY: number;
29
- textWidth: number;
30
- textHeight: number;
31
- constructor(config?: TextConfig);
32
- _sceneFunc(context: Context): void;
33
- _hitFunc(context: Context): void;
34
- setText(text: string): this;
35
- getWidth(): any;
36
- getHeight(): any;
37
- getTextWidth(): number;
38
- getTextHeight(): number;
39
- measureSize(text: any): {
40
- width: any;
41
- height: number;
42
- };
43
- _getContextFont(): string;
44
- _addTextLine(line: string): number;
45
- _getTextWidth(text: string): number;
46
- _setTextData(): void;
47
- _shouldHandleEllipsis(currentHeightPx: number): boolean;
48
- _tryToAddEllipsisToLastLine(): void;
49
- getStrokeScaleEnabled(): boolean;
50
- fontFamily: GetSet<string, this>;
51
- fontSize: GetSet<number, this>;
52
- fontStyle: GetSet<string, this>;
53
- fontVariant: GetSet<string, this>;
54
- align: GetSet<string, this>;
55
- letterSpacing: GetSet<number, this>;
56
- verticalAlign: GetSet<string, this>;
57
- padding: GetSet<number, this>;
58
- lineHeight: GetSet<number, this>;
59
- textDecoration: GetSet<string, this>;
60
- text: GetSet<string, this>;
61
- wrap: GetSet<string, this>;
62
- ellipsis: GetSet<boolean, this>;
63
- }