@leafer-draw/worker 1.0.0-rc.11 → 1.0.0-rc.16
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/dist/worker.esm.js +48 -26
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.js +270 -150
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +265 -150
- package/dist/worker.module.min.js +1 -1
- package/package.json +6 -6
package/dist/worker.js
CHANGED
|
@@ -32,7 +32,7 @@ var LeaferUI = (function (exports) {
|
|
|
32
32
|
};
|
|
33
33
|
const I$1 = IncrementId;
|
|
34
34
|
|
|
35
|
-
const { round
|
|
35
|
+
const { round, pow: pow$1, PI: PI$4 } = Math;
|
|
36
36
|
const MathHelper = {
|
|
37
37
|
within(value, min, max) {
|
|
38
38
|
if (value < min)
|
|
@@ -94,7 +94,7 @@ var LeaferUI = (function (exports) {
|
|
|
94
94
|
},
|
|
95
95
|
float(num, maxLength) {
|
|
96
96
|
const a = maxLength ? pow$1(10, maxLength) : 1000000000000;
|
|
97
|
-
num = round
|
|
97
|
+
num = round(num * a) / a;
|
|
98
98
|
return num === -0 ? 0 : num;
|
|
99
99
|
}
|
|
100
100
|
};
|
|
@@ -406,6 +406,10 @@ var LeaferUI = (function (exports) {
|
|
|
406
406
|
t.x = point.x;
|
|
407
407
|
t.y = point.y;
|
|
408
408
|
},
|
|
409
|
+
copyFrom(t, x, y) {
|
|
410
|
+
t.x = x;
|
|
411
|
+
t.y = y;
|
|
412
|
+
},
|
|
409
413
|
move(t, x, y) {
|
|
410
414
|
t.x += x;
|
|
411
415
|
t.y += y;
|
|
@@ -433,19 +437,19 @@ var LeaferUI = (function (exports) {
|
|
|
433
437
|
},
|
|
434
438
|
tempToInnerOf(t, matrix) {
|
|
435
439
|
const { tempPoint: temp } = P$5;
|
|
436
|
-
|
|
440
|
+
copy$9(temp, t);
|
|
437
441
|
toInnerPoint$2(matrix, temp, temp);
|
|
438
442
|
return temp;
|
|
439
443
|
},
|
|
440
444
|
tempToOuterOf(t, matrix) {
|
|
441
445
|
const { tempPoint: temp } = P$5;
|
|
442
|
-
|
|
446
|
+
copy$9(temp, t);
|
|
443
447
|
toOuterPoint$2(matrix, temp, temp);
|
|
444
448
|
return temp;
|
|
445
449
|
},
|
|
446
450
|
tempToInnerRadiusPointOf(t, matrix) {
|
|
447
451
|
const { tempRadiusPoint: temp } = P$5;
|
|
448
|
-
|
|
452
|
+
copy$9(temp, t);
|
|
449
453
|
P$5.toInnerRadiusPointOf(t, matrix, temp);
|
|
450
454
|
return temp;
|
|
451
455
|
},
|
|
@@ -471,7 +475,7 @@ var LeaferUI = (function (exports) {
|
|
|
471
475
|
return y1 + (y2 - y1) / 2;
|
|
472
476
|
},
|
|
473
477
|
getDistance(t, point) {
|
|
474
|
-
return
|
|
478
|
+
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
475
479
|
},
|
|
476
480
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
477
481
|
const x = abs$4(x2 - x1);
|
|
@@ -479,10 +483,10 @@ var LeaferUI = (function (exports) {
|
|
|
479
483
|
return sqrt$2(x * x + y * y);
|
|
480
484
|
},
|
|
481
485
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
482
|
-
return min$1(
|
|
486
|
+
return min$1(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
|
|
483
487
|
},
|
|
484
488
|
getAngle(t, to) {
|
|
485
|
-
return
|
|
489
|
+
return getAtan2(t, to) / OneRadian;
|
|
486
490
|
},
|
|
487
491
|
getRotation(t, origin, to, toOrigin) {
|
|
488
492
|
if (!toOrigin)
|
|
@@ -500,15 +504,19 @@ var LeaferUI = (function (exports) {
|
|
|
500
504
|
getAtan2(t, to) {
|
|
501
505
|
return atan2$2(to.y - t.y, to.x - t.x);
|
|
502
506
|
},
|
|
503
|
-
getDistancePoint(t, to, distance) {
|
|
504
|
-
const r =
|
|
505
|
-
|
|
507
|
+
getDistancePoint(t, to, distance, changeTo) {
|
|
508
|
+
const r = getAtan2(t, to);
|
|
509
|
+
to = changeTo ? to : {};
|
|
510
|
+
to.x = t.x + cos$4(r) * distance;
|
|
511
|
+
to.y = t.y + sin$4(r) * distance;
|
|
512
|
+
return to;
|
|
506
513
|
},
|
|
507
514
|
reset(t) {
|
|
508
515
|
P$5.reset(t);
|
|
509
516
|
}
|
|
510
517
|
};
|
|
511
518
|
const P$5 = PointHelper;
|
|
519
|
+
const { getDistanceFrom, copy: copy$9, getAtan2 } = P$5;
|
|
512
520
|
|
|
513
521
|
class Point {
|
|
514
522
|
constructor(x, y) {
|
|
@@ -562,8 +570,8 @@ var LeaferUI = (function (exports) {
|
|
|
562
570
|
getDistance(to) {
|
|
563
571
|
return PointHelper.getDistance(this, to);
|
|
564
572
|
}
|
|
565
|
-
getDistancePoint(to, distance) {
|
|
566
|
-
return new Point(PointHelper.getDistancePoint(this, to, distance));
|
|
573
|
+
getDistancePoint(to, distance, changeTo) {
|
|
574
|
+
return new Point(PointHelper.getDistancePoint(this, to, distance, changeTo));
|
|
567
575
|
}
|
|
568
576
|
getAngle(to) {
|
|
569
577
|
return PointHelper.getAngle(this, to);
|
|
@@ -717,7 +725,7 @@ var LeaferUI = (function (exports) {
|
|
|
717
725
|
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$3, addPoint: addPoint$3, toBounds: toBounds$4 } = TwoPointBoundsHelper;
|
|
718
726
|
const { toOuterPoint: toOuterPoint$1 } = MatrixHelper;
|
|
719
727
|
const { float } = MathHelper;
|
|
720
|
-
const { floor, ceil: ceil$
|
|
728
|
+
const { floor, ceil: ceil$2 } = Math;
|
|
721
729
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
722
730
|
const point = {};
|
|
723
731
|
const toPoint$1 = {};
|
|
@@ -849,8 +857,8 @@ var LeaferUI = (function (exports) {
|
|
|
849
857
|
const { x, y } = t;
|
|
850
858
|
t.x = floor(t.x);
|
|
851
859
|
t.y = floor(t.y);
|
|
852
|
-
t.width = x > t.x ? ceil$
|
|
853
|
-
t.height = y > t.y ? ceil$
|
|
860
|
+
t.width = x > t.x ? ceil$2(t.width + x - t.x) : ceil$2(t.width);
|
|
861
|
+
t.height = y > t.y ? ceil$2(t.height + y - t.y) : ceil$2(t.height);
|
|
854
862
|
},
|
|
855
863
|
unsign(t) {
|
|
856
864
|
if (t.width < 0) {
|
|
@@ -1434,6 +1442,8 @@ var LeaferUI = (function (exports) {
|
|
|
1434
1442
|
if (value !== undefined)
|
|
1435
1443
|
return value;
|
|
1436
1444
|
}
|
|
1445
|
+
if (name === 'path' && !this.__pathInputed)
|
|
1446
|
+
return;
|
|
1437
1447
|
return this['_' + name];
|
|
1438
1448
|
}
|
|
1439
1449
|
__removeInput(name) {
|
|
@@ -1447,6 +1457,8 @@ var LeaferUI = (function (exports) {
|
|
|
1447
1457
|
if (key[0] !== '_') {
|
|
1448
1458
|
value = this['_' + key];
|
|
1449
1459
|
if (value !== undefined) {
|
|
1460
|
+
if (key === 'path' && !this.__pathInputed)
|
|
1461
|
+
continue;
|
|
1450
1462
|
inputValue = __input ? __input[key] : undefined;
|
|
1451
1463
|
data[key] = (inputValue === undefined) ? value : inputValue;
|
|
1452
1464
|
}
|
|
@@ -1476,6 +1488,9 @@ var LeaferUI = (function (exports) {
|
|
|
1476
1488
|
t.__single = true;
|
|
1477
1489
|
}
|
|
1478
1490
|
}
|
|
1491
|
+
__removeNaturalSize() {
|
|
1492
|
+
this.__naturalWidth = this.__naturalHeight = undefined;
|
|
1493
|
+
}
|
|
1479
1494
|
destroy() {
|
|
1480
1495
|
this.__input = this.__middle = null;
|
|
1481
1496
|
}
|
|
@@ -1963,7 +1978,7 @@ var LeaferUI = (function (exports) {
|
|
|
1963
1978
|
this.setStrokeOptions(options);
|
|
1964
1979
|
}
|
|
1965
1980
|
setStrokeOptions(options) {
|
|
1966
|
-
this.strokeCap = options.strokeCap;
|
|
1981
|
+
this.strokeCap = options.strokeCap === 'none' ? 'butt' : options.strokeCap;
|
|
1967
1982
|
this.strokeJoin = options.strokeJoin;
|
|
1968
1983
|
this.dashPattern = options.dashPattern;
|
|
1969
1984
|
this.dashOffset = options.dashOffset;
|
|
@@ -2186,7 +2201,7 @@ var LeaferUI = (function (exports) {
|
|
|
2186
2201
|
}
|
|
2187
2202
|
};
|
|
2188
2203
|
|
|
2189
|
-
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
|
|
2204
|
+
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
|
|
2190
2205
|
const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
|
|
2191
2206
|
const { set: set$2 } = PointHelper;
|
|
2192
2207
|
const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
@@ -2300,7 +2315,7 @@ var LeaferUI = (function (exports) {
|
|
|
2300
2315
|
totalRadian -= PI2;
|
|
2301
2316
|
if (anticlockwise)
|
|
2302
2317
|
totalRadian -= PI2;
|
|
2303
|
-
const parts = ceil(abs$3(totalRadian / PI_2));
|
|
2318
|
+
const parts = ceil$1(abs$3(totalRadian / PI_2));
|
|
2304
2319
|
const partRadian = totalRadian / parts;
|
|
2305
2320
|
const partRadian4Sin = sin$3(partRadian / 4);
|
|
2306
2321
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
|
|
@@ -2786,22 +2801,12 @@ var LeaferUI = (function (exports) {
|
|
|
2786
2801
|
}
|
|
2787
2802
|
},
|
|
2788
2803
|
drawEllipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
2789
|
-
|
|
2790
|
-
rotation = 0;
|
|
2791
|
-
if (startAngle === undefined)
|
|
2792
|
-
startAngle = 0;
|
|
2793
|
-
if (endAngle === undefined)
|
|
2794
|
-
endAngle = 360;
|
|
2795
|
-
BezierHelper.ellipse(null, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise, null, null, startPoint);
|
|
2804
|
+
BezierHelper.ellipse(null, x, y, radiusX, radiusY, rotation === undefined ? 0 : rotation, startAngle === undefined ? 0 : startAngle, endAngle === undefined ? 360 : endAngle, anticlockwise, null, null, startPoint);
|
|
2796
2805
|
data.push(M$3, startPoint.x, startPoint.y);
|
|
2797
2806
|
ellipse$3(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
|
|
2798
2807
|
},
|
|
2799
2808
|
drawArc(data, x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
2800
|
-
|
|
2801
|
-
startAngle = 0;
|
|
2802
|
-
if (endAngle === undefined)
|
|
2803
|
-
endAngle = 360;
|
|
2804
|
-
BezierHelper.arc(null, x, y, radius, startAngle, endAngle, anticlockwise, null, null, startPoint);
|
|
2809
|
+
BezierHelper.arc(null, x, y, radius, startAngle === undefined ? 0 : startAngle, endAngle === undefined ? 360 : endAngle, anticlockwise, null, null, startPoint);
|
|
2805
2810
|
data.push(M$3, startPoint.x, startPoint.y);
|
|
2806
2811
|
arc$2(data, x, y, radius, startAngle, endAngle, anticlockwise);
|
|
2807
2812
|
},
|
|
@@ -2813,68 +2818,70 @@ var LeaferUI = (function (exports) {
|
|
|
2813
2818
|
|
|
2814
2819
|
const { moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo, bezierCurveTo, closePath: closePath$3, beginPath, rect: rect$1, roundRect: roundRect$1, ellipse: ellipse$2, arc: arc$1, arcTo: arcTo$2, drawEllipse, drawArc, drawPoints: drawPoints$2 } = PathCommandDataHelper;
|
|
2815
2820
|
class PathCreator {
|
|
2821
|
+
set path(value) { this.__path = value; }
|
|
2822
|
+
get path() { return this.__path; }
|
|
2816
2823
|
constructor(path) {
|
|
2817
2824
|
if (path) {
|
|
2818
|
-
this.
|
|
2825
|
+
this.__path = typeof path === 'string' ? PathHelper.parse(path) : path;
|
|
2819
2826
|
}
|
|
2820
2827
|
else {
|
|
2821
|
-
this.
|
|
2828
|
+
this.__path = [];
|
|
2822
2829
|
}
|
|
2823
2830
|
}
|
|
2824
2831
|
beginPath() {
|
|
2825
|
-
beginPath(this.
|
|
2832
|
+
beginPath(this.__path);
|
|
2826
2833
|
return this;
|
|
2827
2834
|
}
|
|
2828
2835
|
moveTo(x, y) {
|
|
2829
|
-
moveTo$4(this.
|
|
2836
|
+
moveTo$4(this.__path, x, y);
|
|
2830
2837
|
return this;
|
|
2831
2838
|
}
|
|
2832
2839
|
lineTo(x, y) {
|
|
2833
|
-
lineTo$3(this.
|
|
2840
|
+
lineTo$3(this.__path, x, y);
|
|
2834
2841
|
return this;
|
|
2835
2842
|
}
|
|
2836
2843
|
bezierCurveTo(x1, y1, x2, y2, x, y) {
|
|
2837
|
-
bezierCurveTo(this.
|
|
2844
|
+
bezierCurveTo(this.__path, x1, y1, x2, y2, x, y);
|
|
2838
2845
|
return this;
|
|
2839
2846
|
}
|
|
2840
2847
|
quadraticCurveTo(x1, y1, x, y) {
|
|
2841
|
-
quadraticCurveTo(this.
|
|
2848
|
+
quadraticCurveTo(this.__path, x1, y1, x, y);
|
|
2842
2849
|
return this;
|
|
2843
2850
|
}
|
|
2844
2851
|
closePath() {
|
|
2845
|
-
closePath$3(this.
|
|
2852
|
+
closePath$3(this.__path);
|
|
2846
2853
|
return this;
|
|
2847
2854
|
}
|
|
2848
2855
|
rect(x, y, width, height) {
|
|
2849
|
-
rect$1(this.
|
|
2856
|
+
rect$1(this.__path, x, y, width, height);
|
|
2850
2857
|
return this;
|
|
2851
2858
|
}
|
|
2852
2859
|
roundRect(x, y, width, height, cornerRadius) {
|
|
2853
|
-
roundRect$1(this.
|
|
2860
|
+
roundRect$1(this.__path, x, y, width, height, cornerRadius);
|
|
2854
2861
|
return this;
|
|
2855
2862
|
}
|
|
2856
2863
|
ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
2857
|
-
ellipse$2(this.
|
|
2864
|
+
ellipse$2(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
|
|
2858
2865
|
return this;
|
|
2859
2866
|
}
|
|
2860
2867
|
arc(x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
2861
|
-
arc$1(this.
|
|
2868
|
+
arc$1(this.__path, x, y, radius, startAngle, endAngle, anticlockwise);
|
|
2862
2869
|
return this;
|
|
2863
2870
|
}
|
|
2864
2871
|
arcTo(x1, y1, x2, y2, radius) {
|
|
2865
|
-
arcTo$2(this.
|
|
2872
|
+
arcTo$2(this.__path, x1, y1, x2, y2, radius);
|
|
2866
2873
|
return this;
|
|
2867
2874
|
}
|
|
2868
2875
|
drawEllipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
2869
|
-
drawEllipse(this.
|
|
2876
|
+
drawEllipse(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
|
|
2870
2877
|
return this;
|
|
2871
2878
|
}
|
|
2872
2879
|
drawArc(x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
2873
|
-
drawArc(this.
|
|
2880
|
+
drawArc(this.__path, x, y, radius, startAngle, endAngle, anticlockwise);
|
|
2874
2881
|
return this;
|
|
2875
2882
|
}
|
|
2876
2883
|
drawPoints(points, curve, close) {
|
|
2877
|
-
drawPoints$2(this.
|
|
2884
|
+
drawPoints$2(this.__path, points, curve, close);
|
|
2878
2885
|
return this;
|
|
2879
2886
|
}
|
|
2880
2887
|
}
|
|
@@ -3623,9 +3630,35 @@ var LeaferUI = (function (exports) {
|
|
|
3623
3630
|
defineLeafAttr(target, key, defaultValue, {
|
|
3624
3631
|
set(value) {
|
|
3625
3632
|
this.__setAttr(key, value);
|
|
3626
|
-
this
|
|
3627
|
-
|
|
3628
|
-
|
|
3633
|
+
doBoundsType(this);
|
|
3634
|
+
}
|
|
3635
|
+
});
|
|
3636
|
+
};
|
|
3637
|
+
}
|
|
3638
|
+
function naturalBoundsType(defaultValue) {
|
|
3639
|
+
return (target, key) => {
|
|
3640
|
+
defineLeafAttr(target, key, defaultValue, {
|
|
3641
|
+
set(value) {
|
|
3642
|
+
this.__setAttr(key, value);
|
|
3643
|
+
doBoundsType(this);
|
|
3644
|
+
this.__.__removeNaturalSize();
|
|
3645
|
+
}
|
|
3646
|
+
});
|
|
3647
|
+
};
|
|
3648
|
+
}
|
|
3649
|
+
function doBoundsType(leaf) {
|
|
3650
|
+
leaf.__layout.boxChanged || leaf.__layout.boxChange();
|
|
3651
|
+
if (leaf.__hasAutoLayout)
|
|
3652
|
+
leaf.__layout.matrixChanged || leaf.__layout.matrixChange();
|
|
3653
|
+
}
|
|
3654
|
+
function pathInputType(defaultValue) {
|
|
3655
|
+
return (target, key) => {
|
|
3656
|
+
defineLeafAttr(target, key, defaultValue, {
|
|
3657
|
+
set(value) {
|
|
3658
|
+
if (this.__.__pathInputed !== 2)
|
|
3659
|
+
this.__.__pathInputed = value ? 1 : 0;
|
|
3660
|
+
this.__setAttr(key, value);
|
|
3661
|
+
doBoundsType(this);
|
|
3629
3662
|
}
|
|
3630
3663
|
});
|
|
3631
3664
|
};
|
|
@@ -3636,11 +3669,14 @@ var LeaferUI = (function (exports) {
|
|
|
3636
3669
|
defineLeafAttr(target, key, defaultValue, {
|
|
3637
3670
|
set(value) {
|
|
3638
3671
|
this.__setAttr(key, value);
|
|
3639
|
-
this
|
|
3672
|
+
doStrokeType(this);
|
|
3640
3673
|
}
|
|
3641
3674
|
});
|
|
3642
3675
|
};
|
|
3643
3676
|
}
|
|
3677
|
+
function doStrokeType(leaf) {
|
|
3678
|
+
leaf.__layout.strokeChanged || leaf.__layout.strokeChange();
|
|
3679
|
+
}
|
|
3644
3680
|
const strokeType = affectStrokeBoundsType;
|
|
3645
3681
|
function affectRenderBoundsType(defaultValue) {
|
|
3646
3682
|
return (target, key) => {
|
|
@@ -4260,6 +4296,7 @@ var LeaferUI = (function (exports) {
|
|
|
4260
4296
|
}
|
|
4261
4297
|
ChildEvent.ADD = 'child.add';
|
|
4262
4298
|
ChildEvent.REMOVE = 'child.remove';
|
|
4299
|
+
ChildEvent.DESTROY = 'child.destroy';
|
|
4263
4300
|
|
|
4264
4301
|
class PropertyEvent extends Event {
|
|
4265
4302
|
constructor(type, target, attrName, oldValue, newValue) {
|
|
@@ -4707,6 +4744,7 @@ var LeaferUI = (function (exports) {
|
|
|
4707
4744
|
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2, hasParentAutoLayout } = LeafHelper;
|
|
4708
4745
|
const { updateBounds: updateBounds$1 } = BranchHelper;
|
|
4709
4746
|
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1 } = BoundsHelper;
|
|
4747
|
+
const { toBounds: toBounds$2 } = PathBounds;
|
|
4710
4748
|
const LeafBounds = {
|
|
4711
4749
|
__updateWorldBounds() {
|
|
4712
4750
|
toOuterOf$1(this.__layout.renderBounds, this.__world, this.__world);
|
|
@@ -4718,7 +4756,8 @@ var LeaferUI = (function (exports) {
|
|
|
4718
4756
|
__updateLocalBounds() {
|
|
4719
4757
|
const layout = this.__layout;
|
|
4720
4758
|
if (layout.boxChanged) {
|
|
4721
|
-
this.
|
|
4759
|
+
if (!this.__.__pathInputed)
|
|
4760
|
+
this.__updatePath();
|
|
4722
4761
|
this.__updateRenderPath();
|
|
4723
4762
|
this.__updateBoxBounds();
|
|
4724
4763
|
layout.boxChanged = false;
|
|
@@ -4785,11 +4824,16 @@ var LeaferUI = (function (exports) {
|
|
|
4785
4824
|
},
|
|
4786
4825
|
__updateBoxBounds() {
|
|
4787
4826
|
const b = this.__layout.boxBounds;
|
|
4788
|
-
const
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4827
|
+
const data = this.__;
|
|
4828
|
+
if (data.__pathInputed) {
|
|
4829
|
+
toBounds$2(data.__pathForRender, b);
|
|
4830
|
+
}
|
|
4831
|
+
else {
|
|
4832
|
+
b.x = 0;
|
|
4833
|
+
b.y = 0;
|
|
4834
|
+
b.width = data.width;
|
|
4835
|
+
b.height = data.height;
|
|
4836
|
+
}
|
|
4793
4837
|
},
|
|
4794
4838
|
__updateAutoLayout() {
|
|
4795
4839
|
this.__layout.matrixChanged = true;
|
|
@@ -4918,6 +4962,9 @@ var LeaferUI = (function (exports) {
|
|
|
4918
4962
|
get innerName() { return this.__.name || this.tag + this.innerId; }
|
|
4919
4963
|
get __DataProcessor() { return LeafData; }
|
|
4920
4964
|
get __LayoutProcessor() { return LeafLayout; }
|
|
4965
|
+
get isLeafer() { return false; }
|
|
4966
|
+
get isBranch() { return false; }
|
|
4967
|
+
get isBranchLeaf() { return false; }
|
|
4921
4968
|
get __localMatrix() { return this.__local || this.__layout; }
|
|
4922
4969
|
get __localBoxBounds() { return this.__local || this.__layout; }
|
|
4923
4970
|
get worldTransform() { return this.__layout.getTransform('world'); }
|
|
@@ -4931,6 +4978,7 @@ var LeaferUI = (function (exports) {
|
|
|
4931
4978
|
get __worldFlipped() { return this.__world.scaleX < 0 || this.__world.scaleY < 0; }
|
|
4932
4979
|
get __onlyHitMask() { return this.__hasMask && !this.__.hitChildren; }
|
|
4933
4980
|
get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
|
|
4981
|
+
get pathInputed() { return !!this.__.__pathInputed; }
|
|
4934
4982
|
constructor(data) {
|
|
4935
4983
|
this.innerId = create(LEAF);
|
|
4936
4984
|
this.reset(data);
|
|
@@ -4982,7 +5030,7 @@ var LeaferUI = (function (exports) {
|
|
|
4982
5030
|
}
|
|
4983
5031
|
}
|
|
4984
5032
|
set(_data) { }
|
|
4985
|
-
get() { return undefined; }
|
|
5033
|
+
get(_name) { return undefined; }
|
|
4986
5034
|
toJSON() {
|
|
4987
5035
|
return this.__.__getInputData();
|
|
4988
5036
|
}
|
|
@@ -5199,10 +5247,13 @@ var LeaferUI = (function (exports) {
|
|
|
5199
5247
|
}
|
|
5200
5248
|
destroy() {
|
|
5201
5249
|
if (!this.destroyed) {
|
|
5202
|
-
|
|
5250
|
+
const { parent } = this;
|
|
5251
|
+
if (parent)
|
|
5203
5252
|
this.remove();
|
|
5204
5253
|
if (this.children)
|
|
5205
5254
|
this.removeAll(true);
|
|
5255
|
+
if (this.hasEvent(ChildEvent.DESTROY))
|
|
5256
|
+
this.emitEvent(new ChildEvent(ChildEvent.DESTROY, this, parent));
|
|
5206
5257
|
this.__.destroy();
|
|
5207
5258
|
this.__layout.destroy();
|
|
5208
5259
|
this.__captureMap = this.__bubbleMap = this.__parentWait = this.__leaferWait = null;
|
|
@@ -5222,11 +5273,6 @@ var LeaferUI = (function (exports) {
|
|
|
5222
5273
|
const { sort } = BranchHelper;
|
|
5223
5274
|
const { localBoxBounds, localStrokeBounds, localRenderBounds, maskLocalBoxBounds, maskLocalStrokeBounds, maskLocalRenderBounds } = LeafBoundsHelper;
|
|
5224
5275
|
exports.Branch = class Branch extends exports.Leaf {
|
|
5225
|
-
constructor() {
|
|
5226
|
-
super();
|
|
5227
|
-
this.isBranch = true;
|
|
5228
|
-
this.children = [];
|
|
5229
|
-
}
|
|
5230
5276
|
__updateStrokeSpread() {
|
|
5231
5277
|
const { children } = this;
|
|
5232
5278
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
@@ -5266,6 +5312,8 @@ var LeaferUI = (function (exports) {
|
|
|
5266
5312
|
}
|
|
5267
5313
|
}
|
|
5268
5314
|
add(child, index) {
|
|
5315
|
+
if (child === this)
|
|
5316
|
+
return;
|
|
5269
5317
|
if (child.parent)
|
|
5270
5318
|
child.parent.remove(child);
|
|
5271
5319
|
child.parent = this;
|
|
@@ -5889,9 +5937,11 @@ var LeaferUI = (function (exports) {
|
|
|
5889
5937
|
updateAllChange(target);
|
|
5890
5938
|
}
|
|
5891
5939
|
addExtra(leaf) {
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5940
|
+
if (!this.__updatedList.has(leaf)) {
|
|
5941
|
+
const { updatedList, beforeBounds } = this.extraBlock || (this.extraBlock = new LayoutBlockData([]));
|
|
5942
|
+
updatedList.length ? beforeBounds.add(leaf.__world) : beforeBounds.set(leaf.__world);
|
|
5943
|
+
updatedList.add(leaf);
|
|
5944
|
+
}
|
|
5895
5945
|
}
|
|
5896
5946
|
createBlock(data) {
|
|
5897
5947
|
return new LayoutBlockData(data);
|
|
@@ -6164,6 +6214,18 @@ var LeaferUI = (function (exports) {
|
|
|
6164
6214
|
});
|
|
6165
6215
|
Platform.layout = Layouter.fullLayout;
|
|
6166
6216
|
|
|
6217
|
+
function arrowType(defaultValue) {
|
|
6218
|
+
return (target, key) => {
|
|
6219
|
+
defineLeafAttr(target, key, defaultValue, {
|
|
6220
|
+
set(value) {
|
|
6221
|
+
this.__setAttr(key, value);
|
|
6222
|
+
doStrokeType(this);
|
|
6223
|
+
const data = this.__;
|
|
6224
|
+
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
6225
|
+
}
|
|
6226
|
+
});
|
|
6227
|
+
};
|
|
6228
|
+
}
|
|
6167
6229
|
function effectType(defaultValue) {
|
|
6168
6230
|
return (target, key) => {
|
|
6169
6231
|
defineLeafAttr(target, key, defaultValue, {
|
|
@@ -6190,12 +6252,14 @@ var LeaferUI = (function (exports) {
|
|
|
6190
6252
|
|
|
6191
6253
|
const TextConvert = {};
|
|
6192
6254
|
const ColorConvert = {};
|
|
6255
|
+
const PathArrow = {};
|
|
6193
6256
|
const Paint = {};
|
|
6194
6257
|
const PaintImage = {};
|
|
6195
6258
|
const PaintGradient = {};
|
|
6196
6259
|
const Effect = {};
|
|
6197
6260
|
const Export = {};
|
|
6198
6261
|
|
|
6262
|
+
const { parse } = PathConvert;
|
|
6199
6263
|
const emptyPaint = {};
|
|
6200
6264
|
const debug$1 = Debug.get('UIData');
|
|
6201
6265
|
class UIData extends LeafData {
|
|
@@ -6213,7 +6277,8 @@ var LeaferUI = (function (exports) {
|
|
|
6213
6277
|
}
|
|
6214
6278
|
get __autoWidth() { return !this._width; }
|
|
6215
6279
|
get __autoHeight() { return !this._height; }
|
|
6216
|
-
get
|
|
6280
|
+
get __autoSide() { return !this._width || !this._height; }
|
|
6281
|
+
get __autoSize() { return !this._width && !this._height; }
|
|
6217
6282
|
setVisible(value) {
|
|
6218
6283
|
if (this.__leaf.leafer)
|
|
6219
6284
|
this.__leaf.leafer.watcher.hasVisible = true;
|
|
@@ -6241,7 +6306,7 @@ var LeaferUI = (function (exports) {
|
|
|
6241
6306
|
}
|
|
6242
6307
|
setFill(value) {
|
|
6243
6308
|
if (this.__naturalWidth)
|
|
6244
|
-
this.
|
|
6309
|
+
this.__removeNaturalSize();
|
|
6245
6310
|
if (typeof value === 'string' || !value) {
|
|
6246
6311
|
if (this.__isFills) {
|
|
6247
6312
|
this.__removeInput('fill');
|
|
@@ -6277,6 +6342,17 @@ var LeaferUI = (function (exports) {
|
|
|
6277
6342
|
this._stroke || (this._stroke = emptyPaint);
|
|
6278
6343
|
}
|
|
6279
6344
|
}
|
|
6345
|
+
setPath(value) {
|
|
6346
|
+
if (typeof value === 'string') {
|
|
6347
|
+
this.__setInput('path', value);
|
|
6348
|
+
this._path = parse(value);
|
|
6349
|
+
}
|
|
6350
|
+
else {
|
|
6351
|
+
if (this.__input)
|
|
6352
|
+
this.__removeInput('path');
|
|
6353
|
+
this._path = value;
|
|
6354
|
+
}
|
|
6355
|
+
}
|
|
6280
6356
|
setShadow(value) {
|
|
6281
6357
|
this.__setInput('shadow', value);
|
|
6282
6358
|
if (value instanceof Array) {
|
|
@@ -6338,9 +6414,6 @@ var LeaferUI = (function (exports) {
|
|
|
6338
6414
|
class LineData extends UIData {
|
|
6339
6415
|
}
|
|
6340
6416
|
|
|
6341
|
-
class ArrowData extends LineData {
|
|
6342
|
-
}
|
|
6343
|
-
|
|
6344
6417
|
class RectData extends UIData {
|
|
6345
6418
|
get __boxStroke() { return true; }
|
|
6346
6419
|
}
|
|
@@ -6355,19 +6428,7 @@ var LeaferUI = (function (exports) {
|
|
|
6355
6428
|
class StarData extends UIData {
|
|
6356
6429
|
}
|
|
6357
6430
|
|
|
6358
|
-
const { parse } = PathConvert;
|
|
6359
6431
|
class PathData extends UIData {
|
|
6360
|
-
setPath(value) {
|
|
6361
|
-
if (typeof value === 'string') {
|
|
6362
|
-
this.__setInput('path', value);
|
|
6363
|
-
this._path = parse(value);
|
|
6364
|
-
}
|
|
6365
|
-
else {
|
|
6366
|
-
if (this.__input)
|
|
6367
|
-
this.__removeInput('path');
|
|
6368
|
-
this._path = value;
|
|
6369
|
-
}
|
|
6370
|
-
}
|
|
6371
6432
|
}
|
|
6372
6433
|
|
|
6373
6434
|
class PenData extends GroupData {
|
|
@@ -6437,6 +6498,8 @@ var LeaferUI = (function (exports) {
|
|
|
6437
6498
|
}
|
|
6438
6499
|
}
|
|
6439
6500
|
this.__layout.strokeBoxSpread = boxWidth;
|
|
6501
|
+
if (this.__.__useArrow)
|
|
6502
|
+
width += strokeWidth * 5;
|
|
6440
6503
|
return width;
|
|
6441
6504
|
},
|
|
6442
6505
|
__updateRenderSpread() {
|
|
@@ -6570,6 +6633,7 @@ var LeaferUI = (function (exports) {
|
|
|
6570
6633
|
var UI_1;
|
|
6571
6634
|
exports.UI = UI_1 = class UI extends exports.Leaf {
|
|
6572
6635
|
get app() { return this.leafer && this.leafer.app; }
|
|
6636
|
+
get isFrame() { return false; }
|
|
6573
6637
|
set scale(value) {
|
|
6574
6638
|
if (typeof value === 'number') {
|
|
6575
6639
|
this.scaleX = this.scaleY = value;
|
|
@@ -6590,8 +6654,8 @@ var LeaferUI = (function (exports) {
|
|
|
6590
6654
|
set(data) {
|
|
6591
6655
|
Object.assign(this, data);
|
|
6592
6656
|
}
|
|
6593
|
-
get() {
|
|
6594
|
-
return this.__.__getInputData();
|
|
6657
|
+
get(name) {
|
|
6658
|
+
return name ? this.__.__getInput(name) : this.__.__getInputData();
|
|
6595
6659
|
}
|
|
6596
6660
|
createProxyData() { return undefined; }
|
|
6597
6661
|
find(_condition, _options) { return undefined; }
|
|
@@ -6623,6 +6687,8 @@ var LeaferUI = (function (exports) {
|
|
|
6623
6687
|
if (this.__.path) {
|
|
6624
6688
|
const data = this.__;
|
|
6625
6689
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
6690
|
+
if (data.__useArrow)
|
|
6691
|
+
PathArrow.addArrows(this, !data.cornerRadius);
|
|
6626
6692
|
}
|
|
6627
6693
|
}
|
|
6628
6694
|
__drawRenderPath(canvas) {
|
|
@@ -6633,7 +6699,14 @@ var LeaferUI = (function (exports) {
|
|
|
6633
6699
|
canvas.beginPath();
|
|
6634
6700
|
this.__drawPathByData(canvas, this.__.path);
|
|
6635
6701
|
}
|
|
6636
|
-
__drawPathByData(
|
|
6702
|
+
__drawPathByData(drawer, data) {
|
|
6703
|
+
if (data) {
|
|
6704
|
+
PathDrawer.drawPathByData(drawer, data);
|
|
6705
|
+
}
|
|
6706
|
+
else {
|
|
6707
|
+
this.__drawPathByBox(drawer);
|
|
6708
|
+
}
|
|
6709
|
+
}
|
|
6637
6710
|
__drawPathByBox(drawer) {
|
|
6638
6711
|
const { x, y, width, height } = this.__layout.boxBounds;
|
|
6639
6712
|
if (this.__.cornerRadius) {
|
|
@@ -6652,6 +6725,12 @@ var LeaferUI = (function (exports) {
|
|
|
6652
6725
|
static one(data, x, y, width, height) {
|
|
6653
6726
|
return UICreator.get(data.tag || this.prototype.__tag, data, x, y, width, height);
|
|
6654
6727
|
}
|
|
6728
|
+
static registerUI() {
|
|
6729
|
+
registerUI()(this);
|
|
6730
|
+
}
|
|
6731
|
+
static registerData(data) {
|
|
6732
|
+
dataProcessor(data)(this.prototype);
|
|
6733
|
+
}
|
|
6655
6734
|
destroy() {
|
|
6656
6735
|
this.fill = this.stroke = null;
|
|
6657
6736
|
super.destroy();
|
|
@@ -6790,10 +6869,19 @@ var LeaferUI = (function (exports) {
|
|
|
6790
6869
|
dataType(false)
|
|
6791
6870
|
], exports.UI.prototype, "lazy", void 0);
|
|
6792
6871
|
__decorate([
|
|
6793
|
-
|
|
6872
|
+
naturalBoundsType(1)
|
|
6873
|
+
], exports.UI.prototype, "pixelRatio", void 0);
|
|
6874
|
+
__decorate([
|
|
6875
|
+
pathInputType()
|
|
6876
|
+
], exports.UI.prototype, "path", void 0);
|
|
6877
|
+
__decorate([
|
|
6878
|
+
pathType()
|
|
6879
|
+
], exports.UI.prototype, "windingRule", void 0);
|
|
6880
|
+
__decorate([
|
|
6881
|
+
arrowType('none')
|
|
6794
6882
|
], exports.UI.prototype, "startArrow", void 0);
|
|
6795
6883
|
__decorate([
|
|
6796
|
-
|
|
6884
|
+
arrowType('none')
|
|
6797
6885
|
], exports.UI.prototype, "endArrow", void 0);
|
|
6798
6886
|
__decorate([
|
|
6799
6887
|
pathType(0)
|
|
@@ -6819,9 +6907,6 @@ var LeaferUI = (function (exports) {
|
|
|
6819
6907
|
__decorate([
|
|
6820
6908
|
rewrite(exports.Leaf.prototype.reset)
|
|
6821
6909
|
], exports.UI.prototype, "reset", null);
|
|
6822
|
-
__decorate([
|
|
6823
|
-
rewrite(PathDrawer.drawPathByData)
|
|
6824
|
-
], exports.UI.prototype, "__drawPathByData", null);
|
|
6825
6910
|
exports.UI = UI_1 = __decorate([
|
|
6826
6911
|
useModule(UIBounds),
|
|
6827
6912
|
useModule(UIRender),
|
|
@@ -6830,12 +6915,15 @@ var LeaferUI = (function (exports) {
|
|
|
6830
6915
|
|
|
6831
6916
|
exports.Group = class Group extends exports.UI {
|
|
6832
6917
|
get __tag() { return 'Group'; }
|
|
6918
|
+
get isBranch() { return true; }
|
|
6833
6919
|
constructor(data) {
|
|
6834
6920
|
super(data);
|
|
6921
|
+
}
|
|
6922
|
+
reset(data) {
|
|
6835
6923
|
this.__setBranch();
|
|
6924
|
+
super.reset(data);
|
|
6836
6925
|
}
|
|
6837
6926
|
__setBranch() {
|
|
6838
|
-
this.isBranch = true;
|
|
6839
6927
|
if (!this.children)
|
|
6840
6928
|
this.children = [];
|
|
6841
6929
|
}
|
|
@@ -6847,7 +6935,7 @@ var LeaferUI = (function (exports) {
|
|
|
6847
6935
|
this.__setBranch();
|
|
6848
6936
|
}
|
|
6849
6937
|
else {
|
|
6850
|
-
this.
|
|
6938
|
+
this.clear();
|
|
6851
6939
|
}
|
|
6852
6940
|
super.set(data);
|
|
6853
6941
|
let child;
|
|
@@ -6895,6 +6983,7 @@ var LeaferUI = (function (exports) {
|
|
|
6895
6983
|
get __tag() { return 'Leafer'; }
|
|
6896
6984
|
get isApp() { return false; }
|
|
6897
6985
|
get app() { return this.parent || this; }
|
|
6986
|
+
get isLeafer() { return true; }
|
|
6898
6987
|
get imageReady() { return this.viewReady && ImageManager.isComplete; }
|
|
6899
6988
|
get layoutLocked() { return !this.layouter.running; }
|
|
6900
6989
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
@@ -7011,7 +7100,7 @@ var LeaferUI = (function (exports) {
|
|
|
7011
7100
|
this.forceRender();
|
|
7012
7101
|
}
|
|
7013
7102
|
forceRender(bounds) {
|
|
7014
|
-
this.renderer.addBlock(new Bounds(bounds)
|
|
7103
|
+
this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
|
|
7015
7104
|
if (this.viewReady)
|
|
7016
7105
|
this.renderer.update();
|
|
7017
7106
|
}
|
|
@@ -7042,7 +7131,6 @@ var LeaferUI = (function (exports) {
|
|
|
7042
7131
|
}
|
|
7043
7132
|
__setLeafer(leafer) {
|
|
7044
7133
|
this.leafer = leafer;
|
|
7045
|
-
this.isLeafer = !!leafer;
|
|
7046
7134
|
this.__level = 1;
|
|
7047
7135
|
}
|
|
7048
7136
|
setZoomLayer(zoomLayer) {
|
|
@@ -7229,14 +7317,10 @@ var LeaferUI = (function (exports) {
|
|
|
7229
7317
|
constructor(data) {
|
|
7230
7318
|
super(data);
|
|
7231
7319
|
}
|
|
7232
|
-
__drawPathByData(_drawer, _data) { }
|
|
7233
7320
|
};
|
|
7234
7321
|
__decorate([
|
|
7235
7322
|
dataProcessor(RectData)
|
|
7236
7323
|
], exports.Rect.prototype, "__", void 0);
|
|
7237
|
-
__decorate([
|
|
7238
|
-
rewrite(exports.UI.prototype.__drawPathByBox)
|
|
7239
|
-
], exports.Rect.prototype, "__drawPathByData", null);
|
|
7240
7324
|
exports.Rect = __decorate([
|
|
7241
7325
|
useModule(RectRender),
|
|
7242
7326
|
rewriteAble(),
|
|
@@ -7249,9 +7333,9 @@ var LeaferUI = (function (exports) {
|
|
|
7249
7333
|
const { copy: copy$2, add } = BoundsHelper;
|
|
7250
7334
|
exports.Box = class Box extends exports.Group {
|
|
7251
7335
|
get __tag() { return 'Box'; }
|
|
7336
|
+
get isBranchLeaf() { return true; }
|
|
7252
7337
|
constructor(data) {
|
|
7253
7338
|
super(data);
|
|
7254
|
-
this.isBranchLeaf = true;
|
|
7255
7339
|
this.__layout.renderChanged || this.__layout.renderChange();
|
|
7256
7340
|
}
|
|
7257
7341
|
__updateStrokeSpread() { return 0; }
|
|
@@ -7265,8 +7349,18 @@ var LeaferUI = (function (exports) {
|
|
|
7265
7349
|
}
|
|
7266
7350
|
__updateRectBoxBounds() { }
|
|
7267
7351
|
__updateBoxBounds() {
|
|
7268
|
-
|
|
7352
|
+
const data = this.__;
|
|
7353
|
+
if (data.__autoSide && this.children.length) {
|
|
7354
|
+
if (this.leafer)
|
|
7355
|
+
this.leafer.layouter.addExtra(this);
|
|
7269
7356
|
super.__updateBoxBounds();
|
|
7357
|
+
if (!data.__autoSize) {
|
|
7358
|
+
const b = this.__layout.boxBounds;
|
|
7359
|
+
if (!data.__autoWidth)
|
|
7360
|
+
b.x = 0, b.width = data.width;
|
|
7361
|
+
if (!data.__autoHeight)
|
|
7362
|
+
b.y = 0, b.height = data.height;
|
|
7363
|
+
}
|
|
7270
7364
|
}
|
|
7271
7365
|
else {
|
|
7272
7366
|
this.__updateRectBoxBounds();
|
|
@@ -7288,7 +7382,6 @@ var LeaferUI = (function (exports) {
|
|
|
7288
7382
|
super.__updateChange();
|
|
7289
7383
|
this.__updateRectChange();
|
|
7290
7384
|
}
|
|
7291
|
-
__drawPathByData(_drawer, _data) { }
|
|
7292
7385
|
__renderRect(_canvas, _options) { }
|
|
7293
7386
|
__renderGroup(_canvas, _options) { }
|
|
7294
7387
|
__render(canvas, options) {
|
|
@@ -7333,9 +7426,6 @@ var LeaferUI = (function (exports) {
|
|
|
7333
7426
|
__decorate([
|
|
7334
7427
|
rewrite(rect.__updateChange)
|
|
7335
7428
|
], exports.Box.prototype, "__updateRectChange", null);
|
|
7336
|
-
__decorate([
|
|
7337
|
-
rewrite(rect.__drawPathByData)
|
|
7338
|
-
], exports.Box.prototype, "__drawPathByData", null);
|
|
7339
7429
|
__decorate([
|
|
7340
7430
|
rewrite(rect.__render)
|
|
7341
7431
|
], exports.Box.prototype, "__renderRect", null);
|
|
@@ -7349,9 +7439,9 @@ var LeaferUI = (function (exports) {
|
|
|
7349
7439
|
|
|
7350
7440
|
exports.Frame = class Frame extends exports.Box {
|
|
7351
7441
|
get __tag() { return 'Frame'; }
|
|
7442
|
+
get isFrame() { return true; }
|
|
7352
7443
|
constructor(data) {
|
|
7353
7444
|
super(data);
|
|
7354
|
-
this.isFrame = true;
|
|
7355
7445
|
}
|
|
7356
7446
|
};
|
|
7357
7447
|
__decorate([
|
|
@@ -7425,7 +7515,7 @@ var LeaferUI = (function (exports) {
|
|
|
7425
7515
|
|
|
7426
7516
|
const { moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1 } = PathCommandDataHelper;
|
|
7427
7517
|
const { rotate: rotate$1, getAngle: getAngle$2, getDistance: getDistance$2, defaultPoint } = PointHelper;
|
|
7428
|
-
const { toBounds: toBounds$
|
|
7518
|
+
const { toBounds: toBounds$1 } = PathBounds;
|
|
7429
7519
|
exports.Line = class Line extends exports.UI {
|
|
7430
7520
|
get __tag() { return 'Line'; }
|
|
7431
7521
|
get toPoint() {
|
|
@@ -7457,8 +7547,11 @@ var LeaferUI = (function (exports) {
|
|
|
7457
7547
|
}
|
|
7458
7548
|
}
|
|
7459
7549
|
__updateRenderPath() {
|
|
7460
|
-
|
|
7461
|
-
|
|
7550
|
+
const data = this.__;
|
|
7551
|
+
if (!this.pathInputed && data.points && data.curve) {
|
|
7552
|
+
drawPoints$1(data.__pathForRender = [], data.points, data.curve, this.pathClosed);
|
|
7553
|
+
if (data.__useArrow)
|
|
7554
|
+
PathArrow.addArrows(this, false);
|
|
7462
7555
|
}
|
|
7463
7556
|
else {
|
|
7464
7557
|
super.__updateRenderPath();
|
|
@@ -7466,7 +7559,7 @@ var LeaferUI = (function (exports) {
|
|
|
7466
7559
|
}
|
|
7467
7560
|
__updateBoxBounds() {
|
|
7468
7561
|
if (this.points) {
|
|
7469
|
-
toBounds$
|
|
7562
|
+
toBounds$1(this.__.__pathForRender, this.__layout.boxBounds);
|
|
7470
7563
|
}
|
|
7471
7564
|
else {
|
|
7472
7565
|
super.__updateBoxBounds();
|
|
@@ -7499,6 +7592,7 @@ var LeaferUI = (function (exports) {
|
|
|
7499
7592
|
get __tag() { return 'Polygon'; }
|
|
7500
7593
|
constructor(data) {
|
|
7501
7594
|
super(data);
|
|
7595
|
+
this.pathClosed = true;
|
|
7502
7596
|
}
|
|
7503
7597
|
__updatePath() {
|
|
7504
7598
|
const path = this.__.path = [];
|
|
@@ -7654,7 +7748,7 @@ var LeaferUI = (function (exports) {
|
|
|
7654
7748
|
}
|
|
7655
7749
|
};
|
|
7656
7750
|
__decorate([
|
|
7657
|
-
dataProcessor(
|
|
7751
|
+
dataProcessor(CanvasData)
|
|
7658
7752
|
], exports.Canvas.prototype, "__", void 0);
|
|
7659
7753
|
__decorate([
|
|
7660
7754
|
resizeType(100)
|
|
@@ -7717,7 +7811,7 @@ var LeaferUI = (function (exports) {
|
|
|
7717
7811
|
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
|
|
7718
7812
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
7719
7813
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
7720
|
-
data.__clipText = textOverflow !== 'show' && !data.
|
|
7814
|
+
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
7721
7815
|
this.__updateTextDrawData();
|
|
7722
7816
|
const { bounds } = data.__textDrawData;
|
|
7723
7817
|
const b = layout.boxBounds;
|
|
@@ -7834,25 +7928,16 @@ var LeaferUI = (function (exports) {
|
|
|
7834
7928
|
registerUI()
|
|
7835
7929
|
], exports.Text);
|
|
7836
7930
|
|
|
7837
|
-
const { toBounds: toBounds$1 } = PathBounds;
|
|
7838
7931
|
exports.Path = class Path extends exports.UI {
|
|
7839
7932
|
get __tag() { return 'Path'; }
|
|
7840
7933
|
constructor(data) {
|
|
7841
7934
|
super(data);
|
|
7842
|
-
|
|
7843
|
-
__updateBoxBounds() {
|
|
7844
|
-
toBounds$1(this.__.path, this.__layout.boxBounds);
|
|
7935
|
+
this.__.__pathInputed = 2;
|
|
7845
7936
|
}
|
|
7846
7937
|
};
|
|
7847
7938
|
__decorate([
|
|
7848
7939
|
dataProcessor(PathData)
|
|
7849
7940
|
], exports.Path.prototype, "__", void 0);
|
|
7850
|
-
__decorate([
|
|
7851
|
-
pathType()
|
|
7852
|
-
], exports.Path.prototype, "path", void 0);
|
|
7853
|
-
__decorate([
|
|
7854
|
-
pathType()
|
|
7855
|
-
], exports.Path.prototype, "windingRule", void 0);
|
|
7856
7941
|
__decorate([
|
|
7857
7942
|
affectStrokeBoundsType('center')
|
|
7858
7943
|
], exports.Path.prototype, "strokeAlign", void 0);
|
|
@@ -7868,12 +7953,12 @@ var LeaferUI = (function (exports) {
|
|
|
7868
7953
|
setStyle(data) {
|
|
7869
7954
|
const path = this.pathElement = new exports.Path(data);
|
|
7870
7955
|
this.pathStyle = data;
|
|
7871
|
-
this.
|
|
7956
|
+
this.__path = path.path || (path.path = []);
|
|
7872
7957
|
this.add(path);
|
|
7873
7958
|
return this;
|
|
7874
7959
|
}
|
|
7875
7960
|
beginPath() {
|
|
7876
|
-
this.
|
|
7961
|
+
this.__path.length = 0;
|
|
7877
7962
|
this.paint();
|
|
7878
7963
|
return this;
|
|
7879
7964
|
}
|
|
@@ -7897,10 +7982,20 @@ var LeaferUI = (function (exports) {
|
|
|
7897
7982
|
__decorate([
|
|
7898
7983
|
dataProcessor(PenData)
|
|
7899
7984
|
], exports.Pen.prototype, "__", void 0);
|
|
7985
|
+
__decorate([
|
|
7986
|
+
penPathType()
|
|
7987
|
+
], exports.Pen.prototype, "path", void 0);
|
|
7900
7988
|
exports.Pen = __decorate([
|
|
7901
|
-
useModule(PathCreator, ['beginPath']),
|
|
7989
|
+
useModule(PathCreator, ['beginPath', 'path']),
|
|
7902
7990
|
registerUI()
|
|
7903
7991
|
], exports.Pen);
|
|
7992
|
+
function penPathType() {
|
|
7993
|
+
return (target, key) => {
|
|
7994
|
+
defineKey(target, key, {
|
|
7995
|
+
get() { return this.__path; }
|
|
7996
|
+
});
|
|
7997
|
+
};
|
|
7998
|
+
}
|
|
7904
7999
|
|
|
7905
8000
|
function fillText(ui, canvas) {
|
|
7906
8001
|
let row;
|
|
@@ -8360,9 +8455,9 @@ var LeaferUI = (function (exports) {
|
|
|
8360
8455
|
function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
|
|
8361
8456
|
if (attrName === 'fill' && !ui.__.__naturalWidth) {
|
|
8362
8457
|
const data = ui.__;
|
|
8363
|
-
data.__naturalWidth = image.width;
|
|
8364
|
-
data.__naturalHeight = image.height;
|
|
8365
|
-
if (data.
|
|
8458
|
+
data.__naturalWidth = image.width / data.pixelRatio;
|
|
8459
|
+
data.__naturalHeight = image.height / data.pixelRatio;
|
|
8460
|
+
if (data.__autoSide) {
|
|
8366
8461
|
ui.forceUpdate('width');
|
|
8367
8462
|
if (ui.__proxyData) {
|
|
8368
8463
|
ui.setProxyAttr('width', data.width);
|
|
@@ -8392,7 +8487,7 @@ var LeaferUI = (function (exports) {
|
|
|
8392
8487
|
}
|
|
8393
8488
|
|
|
8394
8489
|
const { get: get$2, scale, copy: copy$1 } = MatrixHelper;
|
|
8395
|
-
const {
|
|
8490
|
+
const { ceil, abs: abs$1 } = Math;
|
|
8396
8491
|
function createPattern(ui, paint, pixelRatio) {
|
|
8397
8492
|
let { scaleX, scaleY } = ui.__world;
|
|
8398
8493
|
const id = scaleX + '-' + scaleY;
|
|
@@ -8443,7 +8538,7 @@ var LeaferUI = (function (exports) {
|
|
|
8443
8538
|
}
|
|
8444
8539
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
8445
8540
|
}
|
|
8446
|
-
const canvas = image.getCanvas(width
|
|
8541
|
+
const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity);
|
|
8447
8542
|
const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint);
|
|
8448
8543
|
paint.style = pattern;
|
|
8449
8544
|
paint.patternId = id;
|
|
@@ -9354,37 +9449,55 @@ var LeaferUI = (function (exports) {
|
|
|
9354
9449
|
const { leafer } = leaf;
|
|
9355
9450
|
if (leafer) {
|
|
9356
9451
|
leafer.waitViewCompleted(() => __awaiter(this, void 0, void 0, function* () {
|
|
9357
|
-
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
9358
9452
|
options = FileHelper.getExportOptions(options);
|
|
9359
|
-
|
|
9453
|
+
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
9454
|
+
const { worldTransform, isLeafer, isFrame } = leaf;
|
|
9455
|
+
const { slice, trim, onCanvas } = options;
|
|
9456
|
+
const scale = options.scale || 1;
|
|
9360
9457
|
const pixelRatio = options.pixelRatio || 1;
|
|
9361
9458
|
const screenshot = options.screenshot || leaf.isApp;
|
|
9362
|
-
const fill =
|
|
9459
|
+
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : undefined) : options.fill;
|
|
9363
9460
|
const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
|
|
9364
9461
|
if (screenshot) {
|
|
9365
|
-
renderBounds = screenshot === true ? (
|
|
9462
|
+
renderBounds = screenshot === true ? (isLeafer ? leafer.canvas.bounds : leaf.worldRenderBounds) : screenshot;
|
|
9366
9463
|
}
|
|
9367
9464
|
else {
|
|
9368
|
-
const
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9465
|
+
const location = options.location || ((isLeafer || isFrame) ? 'inner' : 'local');
|
|
9466
|
+
scaleX = worldTransform.scaleX;
|
|
9467
|
+
scaleY = worldTransform.scaleY;
|
|
9468
|
+
switch (location) {
|
|
9469
|
+
case 'inner':
|
|
9470
|
+
matrix.set(worldTransform).invert();
|
|
9471
|
+
break;
|
|
9472
|
+
case 'local':
|
|
9473
|
+
matrix.set(worldTransform).divide(leaf.localTransform).invert();
|
|
9474
|
+
scaleX /= leaf.scaleX;
|
|
9475
|
+
scaleY /= leaf.scaleY;
|
|
9476
|
+
break;
|
|
9477
|
+
case 'world':
|
|
9478
|
+
scaleX = 1;
|
|
9479
|
+
scaleY = 1;
|
|
9480
|
+
break;
|
|
9481
|
+
}
|
|
9482
|
+
renderBounds = leaf.getBounds('render', location);
|
|
9379
9483
|
}
|
|
9380
|
-
|
|
9381
|
-
|
|
9484
|
+
const { x, y, width, height } = new Bounds(renderBounds).scale(scale).ceil();
|
|
9485
|
+
let canvas = Creator.canvas({ width, height, pixelRatio });
|
|
9486
|
+
const renderOptions = { matrix: matrix.scale(scale).translate(-x, -y).withScale(1 / scaleX * scale, 1 / scaleY * scale) };
|
|
9382
9487
|
if (slice) {
|
|
9383
9488
|
leaf = leafer;
|
|
9384
9489
|
renderOptions.bounds = canvas.bounds;
|
|
9385
9490
|
}
|
|
9386
9491
|
canvas.save();
|
|
9387
|
-
|
|
9492
|
+
if (isFrame && fill !== undefined) {
|
|
9493
|
+
const oldFill = leaf.get('fill');
|
|
9494
|
+
leaf.fill = '';
|
|
9495
|
+
leaf.__render(canvas, renderOptions);
|
|
9496
|
+
leaf.fill = oldFill;
|
|
9497
|
+
}
|
|
9498
|
+
else {
|
|
9499
|
+
leaf.__render(canvas, renderOptions);
|
|
9500
|
+
}
|
|
9388
9501
|
canvas.restore();
|
|
9389
9502
|
if (trim) {
|
|
9390
9503
|
trimBounds = getTrimBounds(canvas);
|
|
@@ -9395,6 +9508,8 @@ var LeaferUI = (function (exports) {
|
|
|
9395
9508
|
}
|
|
9396
9509
|
if (needFill)
|
|
9397
9510
|
canvas.fillWorld(canvas.bounds, fill || '#FFFFFF', 'destination-over');
|
|
9511
|
+
if (onCanvas)
|
|
9512
|
+
onCanvas(canvas);
|
|
9398
9513
|
const data = filename === 'canvas' ? canvas : yield canvas.export(filename, options);
|
|
9399
9514
|
over({ data, width: canvas.pixelWidth, height: canvas.pixelHeight, renderBounds, trimBounds });
|
|
9400
9515
|
}));
|
|
@@ -9426,7 +9541,6 @@ var LeaferUI = (function (exports) {
|
|
|
9426
9541
|
|
|
9427
9542
|
exports.AnimateEvent = AnimateEvent;
|
|
9428
9543
|
exports.AroundHelper = AroundHelper;
|
|
9429
|
-
exports.ArrowData = ArrowData;
|
|
9430
9544
|
exports.AutoBounds = AutoBounds;
|
|
9431
9545
|
exports.BezierHelper = BezierHelper;
|
|
9432
9546
|
exports.Bounds = Bounds;
|
|
@@ -9483,6 +9597,7 @@ var LeaferUI = (function (exports) {
|
|
|
9483
9597
|
exports.Paint = Paint;
|
|
9484
9598
|
exports.PaintGradient = PaintGradient;
|
|
9485
9599
|
exports.PaintImage = PaintImage;
|
|
9600
|
+
exports.PathArrow = PathArrow;
|
|
9486
9601
|
exports.PathBounds = PathBounds;
|
|
9487
9602
|
exports.PathCommandDataHelper = PathCommandDataHelper;
|
|
9488
9603
|
exports.PathCommandMap = PathCommandMap;
|
|
@@ -9524,6 +9639,7 @@ var LeaferUI = (function (exports) {
|
|
|
9524
9639
|
exports.Watcher = Watcher;
|
|
9525
9640
|
exports.affectRenderBoundsType = affectRenderBoundsType;
|
|
9526
9641
|
exports.affectStrokeBoundsType = affectStrokeBoundsType;
|
|
9642
|
+
exports.arrowType = arrowType;
|
|
9527
9643
|
exports.autoLayoutType = autoLayoutType;
|
|
9528
9644
|
exports.boundsType = boundsType;
|
|
9529
9645
|
exports.canvasPatch = canvasPatch;
|
|
@@ -9534,6 +9650,8 @@ var LeaferUI = (function (exports) {
|
|
|
9534
9650
|
exports.defineDataProcessor = defineDataProcessor;
|
|
9535
9651
|
exports.defineKey = defineKey;
|
|
9536
9652
|
exports.defineLeafAttr = defineLeafAttr;
|
|
9653
|
+
exports.doBoundsType = doBoundsType;
|
|
9654
|
+
exports.doStrokeType = doStrokeType;
|
|
9537
9655
|
exports.effectType = effectType;
|
|
9538
9656
|
exports.eraserType = eraserType;
|
|
9539
9657
|
exports.getBoundsData = getBoundsData;
|
|
@@ -9543,7 +9661,9 @@ var LeaferUI = (function (exports) {
|
|
|
9543
9661
|
exports.hitType = hitType;
|
|
9544
9662
|
exports.layoutProcessor = layoutProcessor;
|
|
9545
9663
|
exports.maskType = maskType;
|
|
9664
|
+
exports.naturalBoundsType = naturalBoundsType;
|
|
9546
9665
|
exports.opacityType = opacityType;
|
|
9666
|
+
exports.pathInputType = pathInputType;
|
|
9547
9667
|
exports.pathType = pathType;
|
|
9548
9668
|
exports.positionType = positionType;
|
|
9549
9669
|
exports.registerUI = registerUI;
|