konva 8.4.3 → 9.0.0
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 +1 -9
- package/konva.js +17669 -16989
- package/konva.min.js +3 -3
- package/lib/Animation.js +11 -7
- package/lib/BezierFunctions.d.ts +6 -0
- package/lib/BezierFunctions.js +791 -0
- package/lib/Canvas.d.ts +1 -0
- package/lib/Canvas.js +26 -18
- package/lib/Container.js +16 -12
- package/lib/Context.d.ts +3 -1
- package/lib/Context.js +18 -10
- package/lib/Core.js +7 -3
- package/lib/DragAndDrop.js +25 -22
- package/lib/Factory.js +27 -24
- package/lib/FastLayer.js +10 -6
- package/lib/Global.js +16 -12
- package/lib/Group.js +10 -6
- package/lib/Layer.js +37 -33
- package/lib/Node.js +95 -90
- package/lib/PointerEvents.js +15 -7
- package/lib/Shape.js +90 -86
- package/lib/Stage.js +51 -47
- package/lib/Tween.js +26 -22
- package/lib/Util.js +29 -25
- package/lib/Validators.js +58 -44
- package/lib/_CoreInternals.js +36 -33
- package/lib/_FullInternals.js +78 -75
- package/lib/filters/Blur.js +9 -5
- package/lib/filters/Brighten.js +9 -5
- package/lib/filters/Contrast.js +9 -5
- package/lib/filters/Emboss.js +14 -10
- package/lib/filters/Enhance.js +9 -5
- package/lib/filters/Grayscale.js +5 -1
- package/lib/filters/HSL.js +11 -7
- package/lib/filters/HSV.js +11 -7
- package/lib/filters/Invert.js +5 -1
- package/lib/filters/Kaleidoscope.js +13 -9
- package/lib/filters/Mask.js +9 -5
- package/lib/filters/Noise.js +9 -5
- package/lib/filters/Pixelate.js +11 -7
- package/lib/filters/Posterize.js +9 -5
- package/lib/filters/RGB.js +11 -7
- package/lib/filters/RGBA.js +12 -8
- package/lib/filters/Sepia.js +5 -1
- package/lib/filters/Solarize.js +5 -1
- package/lib/filters/Threshold.js +9 -5
- package/lib/index-node.js +7 -5
- package/lib/index.js +4 -2
- package/lib/shapes/Arc.js +17 -13
- package/lib/shapes/Arrow.js +17 -13
- package/lib/shapes/Circle.js +11 -7
- package/lib/shapes/Ellipse.js +13 -9
- package/lib/shapes/Image.js +21 -17
- package/lib/shapes/Label.js +18 -13
- package/lib/shapes/Line.js +14 -10
- package/lib/shapes/Path.d.ts +5 -2
- package/lib/shapes/Path.js +44 -43
- package/lib/shapes/Rect.js +13 -9
- package/lib/shapes/RegularPolygon.js +12 -8
- package/lib/shapes/Ring.js +12 -8
- package/lib/shapes/Sprite.js +19 -15
- package/lib/shapes/Star.js +13 -9
- package/lib/shapes/Text.js +31 -26
- package/lib/shapes/TextPath.d.ts +5 -1
- package/lib/shapes/TextPath.js +82 -188
- package/lib/shapes/Transformer.js +85 -81
- package/lib/shapes/Wedge.js +16 -12
- package/lib/types.d.ts +6 -0
- package/lib/types.js +5 -2
- package/package.json +13 -42
- package/cmj/Animation.d.ts +0 -24
- package/cmj/Animation.js +0 -145
- package/cmj/Canvas.d.ts +0 -32
- package/cmj/Canvas.js +0 -114
- package/cmj/Container.d.ts +0 -47
- package/cmj/Container.js +0 -325
- package/cmj/Context.d.ts +0 -85
- package/cmj/Context.js +0 -538
- package/cmj/Core.d.ts +0 -3
- package/cmj/Core.js +0 -7
- package/cmj/DragAndDrop.d.ts +0 -17
- package/cmj/DragAndDrop.js +0 -111
- package/cmj/Factory.d.ts +0 -11
- package/cmj/Factory.js +0 -125
- package/cmj/FastLayer.d.ts +0 -4
- package/cmj/FastLayer.js +0 -16
- package/cmj/Global.d.ts +0 -34
- package/cmj/Global.js +0 -61
- package/cmj/Group.d.ts +0 -8
- package/cmj/Group.js +0 -17
- package/cmj/Layer.d.ts +0 -61
- package/cmj/Layer.js +0 -309
- package/cmj/Node.d.ts +0 -328
- package/cmj/Node.js +0 -1420
- package/cmj/PointerEvents.d.ts +0 -11
- package/cmj/PointerEvents.js +0 -45
- package/cmj/Shape.d.ts +0 -186
- package/cmj/Shape.js +0 -521
- package/cmj/Stage.d.ts +0 -85
- package/cmj/Stage.js +0 -692
- package/cmj/Tween.d.ts +0 -86
- package/cmj/Tween.js +0 -520
- package/cmj/Util.d.ts +0 -91
- package/cmj/Util.js +0 -801
- package/cmj/Validators.d.ts +0 -11
- package/cmj/Validators.js +0 -192
- package/cmj/_CoreInternals.d.ts +0 -152
- package/cmj/_CoreInternals.js +0 -37
- package/cmj/_FullInternals.d.ts +0 -196
- package/cmj/_FullInternals.js +0 -81
- package/cmj/filters/Blur.d.ts +0 -2
- package/cmj/filters/Blur.js +0 -701
- package/cmj/filters/Brighten.d.ts +0 -2
- package/cmj/filters/Brighten.js +0 -16
- package/cmj/filters/Contrast.d.ts +0 -2
- package/cmj/filters/Contrast.js +0 -38
- package/cmj/filters/Emboss.d.ts +0 -2
- package/cmj/filters/Emboss.js +0 -106
- package/cmj/filters/Enhance.d.ts +0 -2
- package/cmj/filters/Enhance.js +0 -87
- package/cmj/filters/Grayscale.d.ts +0 -2
- package/cmj/filters/Grayscale.js +0 -13
- package/cmj/filters/HSL.d.ts +0 -2
- package/cmj/filters/HSL.js +0 -28
- package/cmj/filters/HSV.d.ts +0 -2
- package/cmj/filters/HSV.js +0 -28
- package/cmj/filters/Invert.d.ts +0 -2
- package/cmj/filters/Invert.js +0 -12
- package/cmj/filters/Kaleidoscope.d.ts +0 -2
- package/cmj/filters/Kaleidoscope.js +0 -137
- package/cmj/filters/Mask.d.ts +0 -2
- package/cmj/filters/Mask.js +0 -144
- package/cmj/filters/Noise.d.ts +0 -2
- package/cmj/filters/Noise.js +0 -16
- package/cmj/filters/Pixelate.d.ts +0 -2
- package/cmj/filters/Pixelate.js +0 -64
- package/cmj/filters/Posterize.d.ts +0 -2
- package/cmj/filters/Posterize.js +0 -14
- package/cmj/filters/RGB.d.ts +0 -2
- package/cmj/filters/RGB.js +0 -43
- package/cmj/filters/RGBA.d.ts +0 -2
- package/cmj/filters/RGBA.js +0 -53
- package/cmj/filters/Sepia.d.ts +0 -2
- package/cmj/filters/Sepia.js +0 -15
- package/cmj/filters/Solarize.d.ts +0 -2
- package/cmj/filters/Solarize.js +0 -29
- package/cmj/filters/Threshold.d.ts +0 -2
- package/cmj/filters/Threshold.js +0 -14
- package/cmj/index-node.d.ts +0 -2
- package/cmj/index-node.js +0 -21
- package/cmj/index-types.d.ts +0 -181
- package/cmj/index.d.ts +0 -2
- package/cmj/index.js +0 -4
- package/cmj/package.json +0 -6
- package/cmj/shapes/Arc.d.ts +0 -26
- package/cmj/shapes/Arc.js +0 -59
- package/cmj/shapes/Arrow.d.ts +0 -26
- package/cmj/shapes/Arrow.js +0 -103
- package/cmj/shapes/Circle.d.ts +0 -14
- package/cmj/shapes/Circle.js +0 -37
- package/cmj/shapes/Ellipse.d.ts +0 -17
- package/cmj/shapes/Ellipse.js +0 -41
- package/cmj/shapes/Image.d.ts +0 -25
- package/cmj/shapes/Image.js +0 -117
- package/cmj/shapes/Label.d.ts +0 -36
- package/cmj/shapes/Label.js +0 -178
- package/cmj/shapes/Line.d.ts +0 -28
- package/cmj/shapes/Line.js +0 -159
- package/cmj/shapes/Path.d.ts +0 -37
- package/cmj/shapes/Path.js +0 -631
- package/cmj/shapes/Rect.d.ts +0 -10
- package/cmj/shapes/Rect.js +0 -26
- package/cmj/shapes/RegularPolygon.d.ts +0 -23
- package/cmj/shapes/RegularPolygon.js +0 -69
- package/cmj/shapes/Ring.d.ts +0 -16
- package/cmj/shapes/Ring.js +0 -37
- package/cmj/shapes/Sprite.d.ts +0 -31
- package/cmj/shapes/Sprite.js +0 -112
- package/cmj/shapes/Star.d.ts +0 -18
- package/cmj/shapes/Star.js +0 -42
- package/cmj/shapes/Text.d.ts +0 -63
- package/cmj/shapes/Text.js +0 -373
- package/cmj/shapes/TextPath.d.ts +0 -56
- package/cmj/shapes/TextPath.js +0 -351
- package/cmj/shapes/Transformer.d.ts +0 -116
- package/cmj/shapes/Transformer.js +0 -971
- package/cmj/shapes/Wedge.d.ts +0 -18
- package/cmj/shapes/Wedge.js +0 -42
- package/cmj/types.d.ts +0 -50
- package/cmj/types.js +0 -25
package/lib/filters/Sepia.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Sepia = void 0;
|
|
4
|
+
const Sepia = function (imageData) {
|
|
2
5
|
var data = imageData.data, nPixels = data.length, i, r, g, b;
|
|
3
6
|
for (i = 0; i < nPixels; i += 4) {
|
|
4
7
|
r = data[i + 0];
|
|
@@ -9,3 +12,4 @@ export const Sepia = function (imageData) {
|
|
|
9
12
|
data[i + 2] = Math.min(255, r * 0.272 + g * 0.534 + b * 0.131);
|
|
10
13
|
}
|
|
11
14
|
};
|
|
15
|
+
exports.Sepia = Sepia;
|
package/lib/filters/Solarize.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Solarize = void 0;
|
|
4
|
+
const Solarize = function (imageData) {
|
|
2
5
|
var data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4, y = h;
|
|
3
6
|
do {
|
|
4
7
|
var offsetY = (y - 1) * w4;
|
|
@@ -23,3 +26,4 @@ export const Solarize = function (imageData) {
|
|
|
23
26
|
} while (--x);
|
|
24
27
|
} while (--y);
|
|
25
28
|
};
|
|
29
|
+
exports.Solarize = Solarize;
|
package/lib/filters/Threshold.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Threshold = void 0;
|
|
4
|
+
const Factory_1 = require("../Factory");
|
|
5
|
+
const Node_1 = require("../Node");
|
|
6
|
+
const Validators_1 = require("../Validators");
|
|
7
|
+
const Threshold = function (imageData) {
|
|
5
8
|
var level = this.threshold() * 255, data = imageData.data, len = data.length, i;
|
|
6
9
|
for (i = 0; i < len; i += 1) {
|
|
7
10
|
data[i] = data[i] < level ? 0 : 255;
|
|
8
11
|
}
|
|
9
12
|
};
|
|
10
|
-
|
|
13
|
+
exports.Threshold = Threshold;
|
|
14
|
+
Factory_1.Factory.addGetterSetter(Node_1.Node, 'threshold', 0.5, (0, Validators_1.getNumberValidator)(), Factory_1.Factory.afterSetFilter);
|
package/lib/index-node.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const _FullInternals_1 = require("./_FullInternals");
|
|
4
|
+
const Canvas = require("canvas");
|
|
3
5
|
const canvas = Canvas['default'] || Canvas;
|
|
4
6
|
global.DOMMatrix = canvas.DOMMatrix;
|
|
5
7
|
const isNode = typeof global.document === 'undefined';
|
|
6
8
|
if (isNode) {
|
|
7
|
-
Konva.Util['createCanvasElement'] = () => {
|
|
9
|
+
_FullInternals_1.Konva.Util['createCanvasElement'] = () => {
|
|
8
10
|
const node = canvas.createCanvas(300, 300);
|
|
9
11
|
if (!node['style']) {
|
|
10
12
|
node['style'] = {};
|
|
11
13
|
}
|
|
12
14
|
return node;
|
|
13
15
|
};
|
|
14
|
-
Konva.Util.createImageElement = () => {
|
|
16
|
+
_FullInternals_1.Konva.Util.createImageElement = () => {
|
|
15
17
|
const node = new canvas.Image();
|
|
16
18
|
return node;
|
|
17
19
|
};
|
|
18
20
|
}
|
|
19
|
-
|
|
21
|
+
module.exports = _FullInternals_1.Konva;
|
package/lib/index.js
CHANGED
package/lib/shapes/Arc.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Arc = void 0;
|
|
4
|
+
const Factory_1 = require("../Factory");
|
|
5
|
+
const Shape_1 = require("../Shape");
|
|
6
|
+
const Global_1 = require("../Global");
|
|
7
|
+
const Validators_1 = require("../Validators");
|
|
8
|
+
const Global_2 = require("../Global");
|
|
9
|
+
class Arc extends Shape_1.Shape {
|
|
7
10
|
_sceneFunc(context) {
|
|
8
|
-
var angle = Konva.getAngle(this.angle()), clockwise = this.clockwise();
|
|
11
|
+
var angle = Global_1.Konva.getAngle(this.angle()), clockwise = this.clockwise();
|
|
9
12
|
context.beginPath();
|
|
10
13
|
context.arc(0, 0, this.outerRadius(), 0, angle, clockwise);
|
|
11
14
|
context.arc(0, 0, this.innerRadius(), angle, 0, !clockwise);
|
|
@@ -28,7 +31,7 @@ export class Arc extends Shape {
|
|
|
28
31
|
const innerRadius = this.innerRadius();
|
|
29
32
|
const outerRadius = this.outerRadius();
|
|
30
33
|
const clockwise = this.clockwise();
|
|
31
|
-
const angle = Konva.getAngle(clockwise ? 360 - this.angle() : this.angle());
|
|
34
|
+
const angle = Global_1.Konva.getAngle(clockwise ? 360 - this.angle() : this.angle());
|
|
32
35
|
const boundLeftRatio = Math.cos(Math.min(angle, Math.PI));
|
|
33
36
|
const boundRightRatio = 1;
|
|
34
37
|
const boundTopRatio = Math.sin(Math.min(Math.max(Math.PI, angle), (3 * Math.PI) / 2));
|
|
@@ -45,11 +48,12 @@ export class Arc extends Shape {
|
|
|
45
48
|
};
|
|
46
49
|
}
|
|
47
50
|
}
|
|
51
|
+
exports.Arc = Arc;
|
|
48
52
|
Arc.prototype._centroid = true;
|
|
49
53
|
Arc.prototype.className = 'Arc';
|
|
50
54
|
Arc.prototype._attrsAffectingSize = ['innerRadius', 'outerRadius'];
|
|
51
|
-
_registerNode(Arc);
|
|
52
|
-
Factory.addGetterSetter(Arc, 'innerRadius', 0, getNumberValidator());
|
|
53
|
-
Factory.addGetterSetter(Arc, 'outerRadius', 0, getNumberValidator());
|
|
54
|
-
Factory.addGetterSetter(Arc, 'angle', 0, getNumberValidator());
|
|
55
|
-
Factory.addGetterSetter(Arc, 'clockwise', false, getBooleanValidator());
|
|
55
|
+
(0, Global_2._registerNode)(Arc);
|
|
56
|
+
Factory_1.Factory.addGetterSetter(Arc, 'innerRadius', 0, (0, Validators_1.getNumberValidator)());
|
|
57
|
+
Factory_1.Factory.addGetterSetter(Arc, 'outerRadius', 0, (0, Validators_1.getNumberValidator)());
|
|
58
|
+
Factory_1.Factory.addGetterSetter(Arc, 'angle', 0, (0, Validators_1.getNumberValidator)());
|
|
59
|
+
Factory_1.Factory.addGetterSetter(Arc, 'clockwise', false, (0, Validators_1.getBooleanValidator)());
|
package/lib/shapes/Arrow.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Arrow = void 0;
|
|
4
|
+
const Factory_1 = require("../Factory");
|
|
5
|
+
const Line_1 = require("./Line");
|
|
6
|
+
const Validators_1 = require("../Validators");
|
|
7
|
+
const Global_1 = require("../Global");
|
|
8
|
+
const Path_1 = require("./Path");
|
|
9
|
+
class Arrow extends Line_1.Line {
|
|
7
10
|
_sceneFunc(ctx) {
|
|
8
11
|
super._sceneFunc(ctx);
|
|
9
12
|
var PI2 = Math.PI * 2;
|
|
@@ -25,8 +28,8 @@ export class Arrow extends Line {
|
|
|
25
28
|
points[n - 2],
|
|
26
29
|
points[n - 1],
|
|
27
30
|
];
|
|
28
|
-
const lastLength = Path.calcLength(tp[tp.length - 4], tp[tp.length - 3], 'C', lp);
|
|
29
|
-
const previous = Path.getPointOnQuadraticBezier(Math.min(1, 1 - length / lastLength), lp[0], lp[1], lp[2], lp[3], lp[4], lp[5]);
|
|
31
|
+
const lastLength = Path_1.Path.calcLength(tp[tp.length - 4], tp[tp.length - 3], 'C', lp);
|
|
32
|
+
const previous = Path_1.Path.getPointOnQuadraticBezier(Math.min(1, 1 - length / lastLength), lp[0], lp[1], lp[2], lp[3], lp[4], lp[5]);
|
|
30
33
|
dx = points[n - 2] - previous.x;
|
|
31
34
|
dy = points[n - 1] - previous.y;
|
|
32
35
|
}
|
|
@@ -91,9 +94,10 @@ export class Arrow extends Line {
|
|
|
91
94
|
};
|
|
92
95
|
}
|
|
93
96
|
}
|
|
97
|
+
exports.Arrow = Arrow;
|
|
94
98
|
Arrow.prototype.className = 'Arrow';
|
|
95
|
-
_registerNode(Arrow);
|
|
96
|
-
Factory.addGetterSetter(Arrow, 'pointerLength', 10, getNumberValidator());
|
|
97
|
-
Factory.addGetterSetter(Arrow, 'pointerWidth', 10, getNumberValidator());
|
|
98
|
-
Factory.addGetterSetter(Arrow, 'pointerAtBeginning', false);
|
|
99
|
-
Factory.addGetterSetter(Arrow, 'pointerAtEnding', true);
|
|
99
|
+
(0, Global_1._registerNode)(Arrow);
|
|
100
|
+
Factory_1.Factory.addGetterSetter(Arrow, 'pointerLength', 10, (0, Validators_1.getNumberValidator)());
|
|
101
|
+
Factory_1.Factory.addGetterSetter(Arrow, 'pointerWidth', 10, (0, Validators_1.getNumberValidator)());
|
|
102
|
+
Factory_1.Factory.addGetterSetter(Arrow, 'pointerAtBeginning', false);
|
|
103
|
+
Factory_1.Factory.addGetterSetter(Arrow, 'pointerAtEnding', true);
|
package/lib/shapes/Circle.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Circle = 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 Circle extends Shape_1.Shape {
|
|
6
9
|
_sceneFunc(context) {
|
|
7
10
|
context.beginPath();
|
|
8
11
|
context.arc(0, 0, this.attrs.radius || 0, 0, Math.PI * 2, false);
|
|
@@ -26,8 +29,9 @@ export class Circle extends Shape {
|
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
31
|
}
|
|
32
|
+
exports.Circle = Circle;
|
|
29
33
|
Circle.prototype._centroid = true;
|
|
30
34
|
Circle.prototype.className = 'Circle';
|
|
31
35
|
Circle.prototype._attrsAffectingSize = ['radius'];
|
|
32
|
-
_registerNode(Circle);
|
|
33
|
-
Factory.addGetterSetter(Circle, 'radius', 0, getNumberValidator());
|
|
36
|
+
(0, Global_1._registerNode)(Circle);
|
|
37
|
+
Factory_1.Factory.addGetterSetter(Circle, 'radius', 0, (0, Validators_1.getNumberValidator)());
|
package/lib/shapes/Ellipse.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Ellipse = 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 Ellipse extends Shape_1.Shape {
|
|
6
9
|
_sceneFunc(context) {
|
|
7
10
|
var rx = this.radiusX(), ry = this.radiusY();
|
|
8
11
|
context.beginPath();
|
|
@@ -28,10 +31,11 @@ export class Ellipse extends Shape {
|
|
|
28
31
|
this.radiusY(height / 2);
|
|
29
32
|
}
|
|
30
33
|
}
|
|
34
|
+
exports.Ellipse = Ellipse;
|
|
31
35
|
Ellipse.prototype.className = 'Ellipse';
|
|
32
36
|
Ellipse.prototype._centroid = true;
|
|
33
37
|
Ellipse.prototype._attrsAffectingSize = ['radiusX', 'radiusY'];
|
|
34
|
-
_registerNode(Ellipse);
|
|
35
|
-
Factory.addComponentsGetterSetter(Ellipse, 'radius', ['x', 'y']);
|
|
36
|
-
Factory.addGetterSetter(Ellipse, 'radiusX', 0, getNumberValidator());
|
|
37
|
-
Factory.addGetterSetter(Ellipse, 'radiusY', 0, getNumberValidator());
|
|
38
|
+
(0, Global_1._registerNode)(Ellipse);
|
|
39
|
+
Factory_1.Factory.addComponentsGetterSetter(Ellipse, 'radius', ['x', 'y']);
|
|
40
|
+
Factory_1.Factory.addGetterSetter(Ellipse, 'radiusX', 0, (0, Validators_1.getNumberValidator)());
|
|
41
|
+
Factory_1.Factory.addGetterSetter(Ellipse, 'radiusY', 0, (0, Validators_1.getNumberValidator)());
|
package/lib/shapes/Image.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Image = void 0;
|
|
4
|
+
const Util_1 = require("../Util");
|
|
5
|
+
const Factory_1 = require("../Factory");
|
|
6
|
+
const Shape_1 = require("../Shape");
|
|
7
|
+
const Global_1 = require("../Global");
|
|
8
|
+
const Validators_1 = require("../Validators");
|
|
9
|
+
class Image extends Shape_1.Shape {
|
|
7
10
|
constructor(attrs) {
|
|
8
11
|
super(attrs);
|
|
9
12
|
this.on('imageChange.konva', () => {
|
|
@@ -57,7 +60,7 @@ export class Image extends Shape {
|
|
|
57
60
|
if (this.hasFill() || this.hasStroke() || cornerRadius) {
|
|
58
61
|
context.beginPath();
|
|
59
62
|
cornerRadius
|
|
60
|
-
? Util.drawRoundedRectPath(context, width, height, cornerRadius)
|
|
63
|
+
? Util_1.Util.drawRoundedRectPath(context, width, height, cornerRadius)
|
|
61
64
|
: context.rect(0, 0, width, height);
|
|
62
65
|
context.closePath();
|
|
63
66
|
context.fillStrokeShape(this);
|
|
@@ -76,7 +79,7 @@ export class Image extends Shape {
|
|
|
76
79
|
context.rect(0, 0, width, height);
|
|
77
80
|
}
|
|
78
81
|
else {
|
|
79
|
-
Util.drawRoundedRectPath(context, width, height, cornerRadius);
|
|
82
|
+
Util_1.Util.drawRoundedRectPath(context, width, height, cornerRadius);
|
|
80
83
|
}
|
|
81
84
|
context.closePath();
|
|
82
85
|
context.fillStrokeShape(this);
|
|
@@ -90,7 +93,7 @@ export class Image extends Shape {
|
|
|
90
93
|
return (_a = this.attrs.height) !== null && _a !== void 0 ? _a : (_b = this.image()) === null || _b === void 0 ? void 0 : _b.height;
|
|
91
94
|
}
|
|
92
95
|
static fromURL(url, callback, onError = null) {
|
|
93
|
-
var img = Util.createImageElement();
|
|
96
|
+
var img = Util_1.Util.createImageElement();
|
|
94
97
|
img.onload = function () {
|
|
95
98
|
var image = new Image({
|
|
96
99
|
image: img,
|
|
@@ -102,12 +105,13 @@ export class Image extends Shape {
|
|
|
102
105
|
img.src = url;
|
|
103
106
|
}
|
|
104
107
|
}
|
|
108
|
+
exports.Image = Image;
|
|
105
109
|
Image.prototype.className = 'Image';
|
|
106
|
-
_registerNode(Image);
|
|
107
|
-
Factory.addGetterSetter(Image, 'cornerRadius', 0, getNumberOrArrayOfNumbersValidator(4));
|
|
108
|
-
Factory.addGetterSetter(Image, 'image');
|
|
109
|
-
Factory.addComponentsGetterSetter(Image, 'crop', ['x', 'y', 'width', 'height']);
|
|
110
|
-
Factory.addGetterSetter(Image, 'cropX', 0, getNumberValidator());
|
|
111
|
-
Factory.addGetterSetter(Image, 'cropY', 0, getNumberValidator());
|
|
112
|
-
Factory.addGetterSetter(Image, 'cropWidth', 0, getNumberValidator());
|
|
113
|
-
Factory.addGetterSetter(Image, 'cropHeight', 0, getNumberValidator());
|
|
110
|
+
(0, Global_1._registerNode)(Image);
|
|
111
|
+
Factory_1.Factory.addGetterSetter(Image, 'cornerRadius', 0, (0, Validators_1.getNumberOrArrayOfNumbersValidator)(4));
|
|
112
|
+
Factory_1.Factory.addGetterSetter(Image, 'image');
|
|
113
|
+
Factory_1.Factory.addComponentsGetterSetter(Image, 'crop', ['x', 'y', 'width', 'height']);
|
|
114
|
+
Factory_1.Factory.addGetterSetter(Image, 'cropX', 0, (0, Validators_1.getNumberValidator)());
|
|
115
|
+
Factory_1.Factory.addGetterSetter(Image, 'cropY', 0, (0, Validators_1.getNumberValidator)());
|
|
116
|
+
Factory_1.Factory.addGetterSetter(Image, 'cropWidth', 0, (0, Validators_1.getNumberValidator)());
|
|
117
|
+
Factory_1.Factory.addGetterSetter(Image, 'cropHeight', 0, (0, Validators_1.getNumberValidator)());
|
package/lib/shapes/Label.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Tag = exports.Label = void 0;
|
|
4
|
+
const Factory_1 = require("../Factory");
|
|
5
|
+
const Shape_1 = require("../Shape");
|
|
6
|
+
const Group_1 = require("../Group");
|
|
7
|
+
const Validators_1 = require("../Validators");
|
|
8
|
+
const Global_1 = require("../Global");
|
|
6
9
|
var ATTR_CHANGE_LIST = [
|
|
7
10
|
'fontFamily',
|
|
8
11
|
'fontSize',
|
|
@@ -16,7 +19,7 @@ var ATTR_CHANGE_LIST = [
|
|
|
16
19
|
'pointerWidth',
|
|
17
20
|
'pointerHeight',
|
|
18
21
|
], CHANGE_KONVA = 'Change.konva', NONE = 'none', UP = 'up', RIGHT = 'right', DOWN = 'down', LEFT = 'left', attrChangeListLen = ATTR_CHANGE_LIST.length;
|
|
19
|
-
|
|
22
|
+
class Label extends Group_1.Group {
|
|
20
23
|
constructor(config) {
|
|
21
24
|
super(config);
|
|
22
25
|
this.on('add.konva', function (evt) {
|
|
@@ -86,9 +89,10 @@ export class Label extends Group {
|
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
91
|
}
|
|
92
|
+
exports.Label = Label;
|
|
89
93
|
Label.prototype.className = 'Label';
|
|
90
|
-
_registerNode(Label);
|
|
91
|
-
|
|
94
|
+
(0, Global_1._registerNode)(Label);
|
|
95
|
+
class Tag extends Shape_1.Shape {
|
|
92
96
|
_sceneFunc(context) {
|
|
93
97
|
var width = this.width(), height = this.height(), pointerDirection = this.pointerDirection(), pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), cornerRadius = this.cornerRadius();
|
|
94
98
|
let topLeft = 0;
|
|
@@ -165,9 +169,10 @@ export class Tag extends Shape {
|
|
|
165
169
|
};
|
|
166
170
|
}
|
|
167
171
|
}
|
|
172
|
+
exports.Tag = Tag;
|
|
168
173
|
Tag.prototype.className = 'Tag';
|
|
169
|
-
_registerNode(Tag);
|
|
170
|
-
Factory.addGetterSetter(Tag, 'pointerDirection', NONE);
|
|
171
|
-
Factory.addGetterSetter(Tag, 'pointerWidth', 0, getNumberValidator());
|
|
172
|
-
Factory.addGetterSetter(Tag, 'pointerHeight', 0, getNumberValidator());
|
|
173
|
-
Factory.addGetterSetter(Tag, 'cornerRadius', 0, getNumberOrArrayOfNumbersValidator(4));
|
|
174
|
+
(0, Global_1._registerNode)(Tag);
|
|
175
|
+
Factory_1.Factory.addGetterSetter(Tag, 'pointerDirection', NONE);
|
|
176
|
+
Factory_1.Factory.addGetterSetter(Tag, 'pointerWidth', 0, (0, Validators_1.getNumberValidator)());
|
|
177
|
+
Factory_1.Factory.addGetterSetter(Tag, 'pointerHeight', 0, (0, Validators_1.getNumberValidator)());
|
|
178
|
+
Factory_1.Factory.addGetterSetter(Tag, 'cornerRadius', 0, (0, Validators_1.getNumberOrArrayOfNumbersValidator)(4));
|
package/lib/shapes/Line.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Line = 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");
|
|
5
8
|
function getControlPoints(x0, y0, x1, y1, x2, y2, t) {
|
|
6
9
|
var d01 = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2)), d12 = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)), fa = (t * d01) / (d01 + d12), fb = (t * d12) / (d01 + d12), p1x = x1 - fa * (x2 - x0), p1y = y1 - fa * (y2 - y0), p2x = x1 + fb * (x2 - x0), p2y = y1 + fb * (y2 - y0);
|
|
7
10
|
return [p1x, p1y, p2x, p2y];
|
|
@@ -22,7 +25,7 @@ function expandPoints(p, tension) {
|
|
|
22
25
|
}
|
|
23
26
|
return allPoints;
|
|
24
27
|
}
|
|
25
|
-
|
|
28
|
+
class Line extends Shape_1.Shape {
|
|
26
29
|
constructor(config) {
|
|
27
30
|
super(config);
|
|
28
31
|
this.on('pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva', function () {
|
|
@@ -146,10 +149,11 @@ export class Line extends Shape {
|
|
|
146
149
|
};
|
|
147
150
|
}
|
|
148
151
|
}
|
|
152
|
+
exports.Line = Line;
|
|
149
153
|
Line.prototype.className = 'Line';
|
|
150
154
|
Line.prototype._attrsAffectingSize = ['points', 'bezier', 'tension'];
|
|
151
|
-
_registerNode(Line);
|
|
152
|
-
Factory.addGetterSetter(Line, 'closed', false);
|
|
153
|
-
Factory.addGetterSetter(Line, 'bezier', false);
|
|
154
|
-
Factory.addGetterSetter(Line, 'tension', 0, getNumberValidator());
|
|
155
|
-
Factory.addGetterSetter(Line, 'points', [], getNumberArrayValidator());
|
|
155
|
+
(0, Global_1._registerNode)(Line);
|
|
156
|
+
Factory_1.Factory.addGetterSetter(Line, 'closed', false);
|
|
157
|
+
Factory_1.Factory.addGetterSetter(Line, 'bezier', false);
|
|
158
|
+
Factory_1.Factory.addGetterSetter(Line, 'tension', 0, (0, Validators_1.getNumberValidator)());
|
|
159
|
+
Factory_1.Factory.addGetterSetter(Line, 'points', [], (0, Validators_1.getNumberArrayValidator)());
|
package/lib/shapes/Path.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Shape, ShapeConfig } from '../Shape.js';
|
|
2
|
-
import { GetSet } from '../types.js';
|
|
2
|
+
import { GetSet, PathSegment } from '../types.js';
|
|
3
3
|
export interface PathConfig extends ShapeConfig {
|
|
4
4
|
data?: string;
|
|
5
5
|
}
|
|
@@ -7,6 +7,7 @@ export declare class Path extends Shape<PathConfig> {
|
|
|
7
7
|
dataArray: any[];
|
|
8
8
|
pathLength: number;
|
|
9
9
|
constructor(config?: PathConfig);
|
|
10
|
+
_readDataAttribute(): void;
|
|
10
11
|
_sceneFunc(context: any): void;
|
|
11
12
|
getSelfRect(): {
|
|
12
13
|
x: any;
|
|
@@ -18,6 +19,8 @@ export declare class Path extends Shape<PathConfig> {
|
|
|
18
19
|
getPointAtLength(length: any): any;
|
|
19
20
|
data: GetSet<string, this>;
|
|
20
21
|
static getLineLength(x1: any, y1: any, x2: any, y2: any): number;
|
|
22
|
+
static getPathLength(dataArray: PathSegment[]): number;
|
|
23
|
+
static getPointAtLengthOfDataArray(length: number, dataArray: any): any;
|
|
21
24
|
static getPointOnLine(dist: any, P1x: any, P1y: any, P2x: any, P2y: any, fromX?: any, fromY?: any): any;
|
|
22
25
|
static getPointOnCubicBezier(pct: any, P1x: any, P1y: any, P2x: any, P2y: any, P3x: any, P3y: any, P4x: any, P4y: any): {
|
|
23
26
|
x: number;
|
|
@@ -31,7 +34,7 @@ export declare class Path extends Shape<PathConfig> {
|
|
|
31
34
|
x: any;
|
|
32
35
|
y: any;
|
|
33
36
|
};
|
|
34
|
-
static parsePathData(data: any):
|
|
37
|
+
static parsePathData(data: any): PathSegment[];
|
|
35
38
|
static calcLength(x: any, y: any, cmd: any, points: any): any;
|
|
36
39
|
static convertEndpointToCenterParameterization(x1: any, y1: any, x2: any, y2: any, fa: any, fs: any, rx: any, ry: any, psiDeg: any): any[];
|
|
37
40
|
}
|
package/lib/shapes/Path.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Path = void 0;
|
|
4
|
+
const Factory_1 = require("../Factory");
|
|
5
|
+
const Shape_1 = require("../Shape");
|
|
6
|
+
const Global_1 = require("../Global");
|
|
7
|
+
const BezierFunctions_1 = require("../BezierFunctions");
|
|
8
|
+
class Path extends Shape_1.Shape {
|
|
5
9
|
constructor(config) {
|
|
6
10
|
super(config);
|
|
7
11
|
this.dataArray = [];
|
|
8
12
|
this.pathLength = 0;
|
|
9
|
-
this.
|
|
10
|
-
this.pathLength = 0;
|
|
11
|
-
for (var i = 0; i < this.dataArray.length; ++i) {
|
|
12
|
-
this.pathLength += this.dataArray[i].pathLength;
|
|
13
|
-
}
|
|
13
|
+
this._readDataAttribute();
|
|
14
14
|
this.on('dataChange.konva', function () {
|
|
15
|
-
this.
|
|
16
|
-
this.pathLength = 0;
|
|
17
|
-
for (var i = 0; i < this.dataArray.length; ++i) {
|
|
18
|
-
this.pathLength += this.dataArray[i].pathLength;
|
|
19
|
-
}
|
|
15
|
+
this._readDataAttribute();
|
|
20
16
|
});
|
|
21
17
|
}
|
|
18
|
+
_readDataAttribute() {
|
|
19
|
+
this.dataArray = Path.parsePathData(this.data());
|
|
20
|
+
this.pathLength = Path.getPathLength(this.dataArray);
|
|
21
|
+
}
|
|
22
22
|
_sceneFunc(context) {
|
|
23
23
|
var ca = this.dataArray;
|
|
24
24
|
context.beginPath();
|
|
@@ -127,37 +127,54 @@ export class Path extends Shape {
|
|
|
127
127
|
return this.pathLength;
|
|
128
128
|
}
|
|
129
129
|
getPointAtLength(length) {
|
|
130
|
-
|
|
130
|
+
return Path.getPointAtLengthOfDataArray(length, this.dataArray);
|
|
131
|
+
}
|
|
132
|
+
static getLineLength(x1, y1, x2, y2) {
|
|
133
|
+
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
|
|
134
|
+
}
|
|
135
|
+
static getPathLength(dataArray) {
|
|
136
|
+
let pathLength = 0;
|
|
137
|
+
for (var i = 0; i < dataArray.length; ++i) {
|
|
138
|
+
pathLength += dataArray[i].pathLength;
|
|
139
|
+
}
|
|
140
|
+
return pathLength;
|
|
141
|
+
}
|
|
142
|
+
static getPointAtLengthOfDataArray(length, dataArray) {
|
|
143
|
+
var point, i = 0, ii = dataArray.length;
|
|
131
144
|
if (!ii) {
|
|
132
145
|
return null;
|
|
133
146
|
}
|
|
134
|
-
while (i < ii && length >
|
|
135
|
-
length -=
|
|
147
|
+
while (i < ii && length > dataArray[i].pathLength) {
|
|
148
|
+
length -= dataArray[i].pathLength;
|
|
136
149
|
++i;
|
|
137
150
|
}
|
|
138
151
|
if (i === ii) {
|
|
139
|
-
point =
|
|
152
|
+
point = dataArray[i - 1].points.slice(-2);
|
|
140
153
|
return {
|
|
141
154
|
x: point[0],
|
|
142
155
|
y: point[1],
|
|
143
156
|
};
|
|
144
157
|
}
|
|
145
158
|
if (length < 0.01) {
|
|
146
|
-
point =
|
|
159
|
+
point = dataArray[i].points.slice(0, 2);
|
|
147
160
|
return {
|
|
148
161
|
x: point[0],
|
|
149
162
|
y: point[1],
|
|
150
163
|
};
|
|
151
164
|
}
|
|
152
|
-
var cp =
|
|
165
|
+
var cp = dataArray[i];
|
|
153
166
|
var p = cp.points;
|
|
154
167
|
switch (cp.command) {
|
|
155
168
|
case 'L':
|
|
156
169
|
return Path.getPointOnLine(length, cp.start.x, cp.start.y, p[0], p[1]);
|
|
157
170
|
case 'C':
|
|
158
|
-
return Path.getPointOnCubicBezier(
|
|
171
|
+
return Path.getPointOnCubicBezier((0, BezierFunctions_1.t2length)(length, Path.getPathLength(dataArray), (i) => {
|
|
172
|
+
return (0, BezierFunctions_1.getCubicArcLength)([cp.start.x, p[0], p[2], p[4]], [cp.start.y, p[1], p[3], p[5]], i);
|
|
173
|
+
}), cp.start.x, cp.start.y, p[0], p[1], p[2], p[3], p[4], p[5]);
|
|
159
174
|
case 'Q':
|
|
160
|
-
return Path.getPointOnQuadraticBezier(
|
|
175
|
+
return Path.getPointOnQuadraticBezier((0, BezierFunctions_1.t2length)(length, Path.getPathLength(dataArray), (i) => {
|
|
176
|
+
return (0, BezierFunctions_1.getQuadraticArcLength)([cp.start.x, p[0], p[2]], [cp.start.y, p[1], p[3]], i);
|
|
177
|
+
}), cp.start.x, cp.start.y, p[0], p[1], p[2], p[3]);
|
|
161
178
|
case 'A':
|
|
162
179
|
var cx = p[0], cy = p[1], rx = p[2], ry = p[3], theta = p[4], dTheta = p[5], psi = p[6];
|
|
163
180
|
theta += (dTheta * length) / cp.pathLength;
|
|
@@ -165,9 +182,6 @@ export class Path extends Shape {
|
|
|
165
182
|
}
|
|
166
183
|
return null;
|
|
167
184
|
}
|
|
168
|
-
static getLineLength(x1, y1, x2, y2) {
|
|
169
|
-
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
|
|
170
|
-
}
|
|
171
185
|
static getPointOnLine(dist, P1x, P1y, P2x, P2y, fromX, fromY) {
|
|
172
186
|
if (fromX === undefined) {
|
|
173
187
|
fromX = P1x;
|
|
@@ -524,23 +538,9 @@ export class Path extends Shape {
|
|
|
524
538
|
case 'L':
|
|
525
539
|
return path.getLineLength(x, y, points[0], points[1]);
|
|
526
540
|
case 'C':
|
|
527
|
-
|
|
528
|
-
p1 = path.getPointOnCubicBezier(0, x, y, points[0], points[1], points[2], points[3], points[4], points[5]);
|
|
529
|
-
for (t = 0.01; t <= 1; t += 0.01) {
|
|
530
|
-
p2 = path.getPointOnCubicBezier(t, x, y, points[0], points[1], points[2], points[3], points[4], points[5]);
|
|
531
|
-
len += path.getLineLength(p1.x, p1.y, p2.x, p2.y);
|
|
532
|
-
p1 = p2;
|
|
533
|
-
}
|
|
534
|
-
return len;
|
|
541
|
+
return (0, BezierFunctions_1.getCubicArcLength)([x, points[0], points[2], points[4]], [y, points[1], points[3], points[5]], 1);
|
|
535
542
|
case 'Q':
|
|
536
|
-
|
|
537
|
-
p1 = path.getPointOnQuadraticBezier(0, x, y, points[0], points[1], points[2], points[3]);
|
|
538
|
-
for (t = 0.01; t <= 1; t += 0.01) {
|
|
539
|
-
p2 = path.getPointOnQuadraticBezier(t, x, y, points[0], points[1], points[2], points[3]);
|
|
540
|
-
len += path.getLineLength(p1.x, p1.y, p2.x, p2.y);
|
|
541
|
-
p1 = p2;
|
|
542
|
-
}
|
|
543
|
-
return len;
|
|
543
|
+
return (0, BezierFunctions_1.getQuadraticArcLength)([x, points[0], points[2]], [y, points[1], points[3]], 1);
|
|
544
544
|
case 'A':
|
|
545
545
|
len = 0.0;
|
|
546
546
|
var start = points[4];
|
|
@@ -621,7 +621,8 @@ export class Path extends Shape {
|
|
|
621
621
|
return [cx, cy, rx, ry, theta, dTheta, psi, fs];
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
|
+
exports.Path = Path;
|
|
624
625
|
Path.prototype.className = 'Path';
|
|
625
626
|
Path.prototype._attrsAffectingSize = ['data'];
|
|
626
|
-
_registerNode(Path);
|
|
627
|
-
Factory.addGetterSetter(Path, 'data');
|
|
627
|
+
(0, Global_1._registerNode)(Path);
|
|
628
|
+
Factory_1.Factory.addGetterSetter(Path, 'data');
|
package/lib/shapes/Rect.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Rect = void 0;
|
|
4
|
+
const Factory_1 = require("../Factory");
|
|
5
|
+
const Shape_1 = require("../Shape");
|
|
6
|
+
const Global_1 = require("../Global");
|
|
7
|
+
const Util_1 = require("../Util");
|
|
8
|
+
const Validators_1 = require("../Validators");
|
|
9
|
+
class Rect extends Shape_1.Shape {
|
|
7
10
|
_sceneFunc(context) {
|
|
8
11
|
var cornerRadius = this.cornerRadius(), width = this.width(), height = this.height();
|
|
9
12
|
context.beginPath();
|
|
@@ -11,12 +14,13 @@ export class Rect extends Shape {
|
|
|
11
14
|
context.rect(0, 0, width, height);
|
|
12
15
|
}
|
|
13
16
|
else {
|
|
14
|
-
Util.drawRoundedRectPath(context, width, height, cornerRadius);
|
|
17
|
+
Util_1.Util.drawRoundedRectPath(context, width, height, cornerRadius);
|
|
15
18
|
}
|
|
16
19
|
context.closePath();
|
|
17
20
|
context.fillStrokeShape(this);
|
|
18
21
|
}
|
|
19
22
|
}
|
|
23
|
+
exports.Rect = Rect;
|
|
20
24
|
Rect.prototype.className = 'Rect';
|
|
21
|
-
_registerNode(Rect);
|
|
22
|
-
Factory.addGetterSetter(Rect, 'cornerRadius', 0, getNumberOrArrayOfNumbersValidator(4));
|
|
25
|
+
(0, Global_1._registerNode)(Rect);
|
|
26
|
+
Factory_1.Factory.addGetterSetter(Rect, 'cornerRadius', 0, (0, Validators_1.getNumberOrArrayOfNumbersValidator)(4));
|