@leafer-ui/miniapp 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/miniapp.esm.js +48 -26
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.module.js +265 -150
- package/dist/miniapp.module.min.js +1 -1
- package/package.json +9 -9
package/dist/miniapp.module.js
CHANGED
|
@@ -29,7 +29,7 @@ const IncrementId = {
|
|
|
29
29
|
};
|
|
30
30
|
const I$2 = IncrementId;
|
|
31
31
|
|
|
32
|
-
const { round
|
|
32
|
+
const { round, pow: pow$1, PI: PI$4 } = Math;
|
|
33
33
|
const MathHelper = {
|
|
34
34
|
within(value, min, max) {
|
|
35
35
|
if (value < min)
|
|
@@ -91,7 +91,7 @@ const MathHelper = {
|
|
|
91
91
|
},
|
|
92
92
|
float(num, maxLength) {
|
|
93
93
|
const a = maxLength ? pow$1(10, maxLength) : 1000000000000;
|
|
94
|
-
num = round
|
|
94
|
+
num = round(num * a) / a;
|
|
95
95
|
return num === -0 ? 0 : num;
|
|
96
96
|
}
|
|
97
97
|
};
|
|
@@ -403,6 +403,10 @@ const PointHelper = {
|
|
|
403
403
|
t.x = point.x;
|
|
404
404
|
t.y = point.y;
|
|
405
405
|
},
|
|
406
|
+
copyFrom(t, x, y) {
|
|
407
|
+
t.x = x;
|
|
408
|
+
t.y = y;
|
|
409
|
+
},
|
|
406
410
|
move(t, x, y) {
|
|
407
411
|
t.x += x;
|
|
408
412
|
t.y += y;
|
|
@@ -430,19 +434,19 @@ const PointHelper = {
|
|
|
430
434
|
},
|
|
431
435
|
tempToInnerOf(t, matrix) {
|
|
432
436
|
const { tempPoint: temp } = P$5;
|
|
433
|
-
|
|
437
|
+
copy$a(temp, t);
|
|
434
438
|
toInnerPoint$2(matrix, temp, temp);
|
|
435
439
|
return temp;
|
|
436
440
|
},
|
|
437
441
|
tempToOuterOf(t, matrix) {
|
|
438
442
|
const { tempPoint: temp } = P$5;
|
|
439
|
-
|
|
443
|
+
copy$a(temp, t);
|
|
440
444
|
toOuterPoint$2(matrix, temp, temp);
|
|
441
445
|
return temp;
|
|
442
446
|
},
|
|
443
447
|
tempToInnerRadiusPointOf(t, matrix) {
|
|
444
448
|
const { tempRadiusPoint: temp } = P$5;
|
|
445
|
-
|
|
449
|
+
copy$a(temp, t);
|
|
446
450
|
P$5.toInnerRadiusPointOf(t, matrix, temp);
|
|
447
451
|
return temp;
|
|
448
452
|
},
|
|
@@ -468,7 +472,7 @@ const PointHelper = {
|
|
|
468
472
|
return y1 + (y2 - y1) / 2;
|
|
469
473
|
},
|
|
470
474
|
getDistance(t, point) {
|
|
471
|
-
return
|
|
475
|
+
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
472
476
|
},
|
|
473
477
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
474
478
|
const x = abs$4(x2 - x1);
|
|
@@ -476,10 +480,10 @@ const PointHelper = {
|
|
|
476
480
|
return sqrt$2(x * x + y * y);
|
|
477
481
|
},
|
|
478
482
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
479
|
-
return min$1(
|
|
483
|
+
return min$1(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
|
|
480
484
|
},
|
|
481
485
|
getAngle(t, to) {
|
|
482
|
-
return
|
|
486
|
+
return getAtan2(t, to) / OneRadian;
|
|
483
487
|
},
|
|
484
488
|
getRotation(t, origin, to, toOrigin) {
|
|
485
489
|
if (!toOrigin)
|
|
@@ -497,15 +501,19 @@ const PointHelper = {
|
|
|
497
501
|
getAtan2(t, to) {
|
|
498
502
|
return atan2$2(to.y - t.y, to.x - t.x);
|
|
499
503
|
},
|
|
500
|
-
getDistancePoint(t, to, distance) {
|
|
501
|
-
const r =
|
|
502
|
-
|
|
504
|
+
getDistancePoint(t, to, distance, changeTo) {
|
|
505
|
+
const r = getAtan2(t, to);
|
|
506
|
+
to = changeTo ? to : {};
|
|
507
|
+
to.x = t.x + cos$4(r) * distance;
|
|
508
|
+
to.y = t.y + sin$4(r) * distance;
|
|
509
|
+
return to;
|
|
503
510
|
},
|
|
504
511
|
reset(t) {
|
|
505
512
|
P$5.reset(t);
|
|
506
513
|
}
|
|
507
514
|
};
|
|
508
515
|
const P$5 = PointHelper;
|
|
516
|
+
const { getDistanceFrom, copy: copy$a, getAtan2 } = P$5;
|
|
509
517
|
|
|
510
518
|
class Point {
|
|
511
519
|
constructor(x, y) {
|
|
@@ -559,8 +567,8 @@ class Point {
|
|
|
559
567
|
getDistance(to) {
|
|
560
568
|
return PointHelper.getDistance(this, to);
|
|
561
569
|
}
|
|
562
|
-
getDistancePoint(to, distance) {
|
|
563
|
-
return new Point(PointHelper.getDistancePoint(this, to, distance));
|
|
570
|
+
getDistancePoint(to, distance, changeTo) {
|
|
571
|
+
return new Point(PointHelper.getDistancePoint(this, to, distance, changeTo));
|
|
564
572
|
}
|
|
565
573
|
getAngle(to) {
|
|
566
574
|
return PointHelper.getAngle(this, to);
|
|
@@ -714,7 +722,7 @@ const { addPoint: addPoint$4 } = TwoPointBoundsHelper;
|
|
|
714
722
|
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$3, addPoint: addPoint$3, toBounds: toBounds$4 } = TwoPointBoundsHelper;
|
|
715
723
|
const { toOuterPoint: toOuterPoint$1 } = MatrixHelper;
|
|
716
724
|
const { float } = MathHelper;
|
|
717
|
-
const { floor, ceil: ceil$
|
|
725
|
+
const { floor, ceil: ceil$2 } = Math;
|
|
718
726
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
719
727
|
const point = {};
|
|
720
728
|
const toPoint$1 = {};
|
|
@@ -846,8 +854,8 @@ const BoundsHelper = {
|
|
|
846
854
|
const { x, y } = t;
|
|
847
855
|
t.x = floor(t.x);
|
|
848
856
|
t.y = floor(t.y);
|
|
849
|
-
t.width = x > t.x ? ceil$
|
|
850
|
-
t.height = y > t.y ? ceil$
|
|
857
|
+
t.width = x > t.x ? ceil$2(t.width + x - t.x) : ceil$2(t.width);
|
|
858
|
+
t.height = y > t.y ? ceil$2(t.height + y - t.y) : ceil$2(t.height);
|
|
851
859
|
},
|
|
852
860
|
unsign(t) {
|
|
853
861
|
if (t.width < 0) {
|
|
@@ -1431,6 +1439,8 @@ class LeafData {
|
|
|
1431
1439
|
if (value !== undefined)
|
|
1432
1440
|
return value;
|
|
1433
1441
|
}
|
|
1442
|
+
if (name === 'path' && !this.__pathInputed)
|
|
1443
|
+
return;
|
|
1434
1444
|
return this['_' + name];
|
|
1435
1445
|
}
|
|
1436
1446
|
__removeInput(name) {
|
|
@@ -1444,6 +1454,8 @@ class LeafData {
|
|
|
1444
1454
|
if (key[0] !== '_') {
|
|
1445
1455
|
value = this['_' + key];
|
|
1446
1456
|
if (value !== undefined) {
|
|
1457
|
+
if (key === 'path' && !this.__pathInputed)
|
|
1458
|
+
continue;
|
|
1447
1459
|
inputValue = __input ? __input[key] : undefined;
|
|
1448
1460
|
data[key] = (inputValue === undefined) ? value : inputValue;
|
|
1449
1461
|
}
|
|
@@ -1473,6 +1485,9 @@ class LeafData {
|
|
|
1473
1485
|
t.__single = true;
|
|
1474
1486
|
}
|
|
1475
1487
|
}
|
|
1488
|
+
__removeNaturalSize() {
|
|
1489
|
+
this.__naturalWidth = this.__naturalHeight = undefined;
|
|
1490
|
+
}
|
|
1476
1491
|
destroy() {
|
|
1477
1492
|
this.__input = this.__middle = null;
|
|
1478
1493
|
}
|
|
@@ -1960,7 +1975,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
1960
1975
|
this.setStrokeOptions(options);
|
|
1961
1976
|
}
|
|
1962
1977
|
setStrokeOptions(options) {
|
|
1963
|
-
this.strokeCap = options.strokeCap;
|
|
1978
|
+
this.strokeCap = options.strokeCap === 'none' ? 'butt' : options.strokeCap;
|
|
1964
1979
|
this.strokeJoin = options.strokeJoin;
|
|
1965
1980
|
this.dashPattern = options.dashPattern;
|
|
1966
1981
|
this.dashOffset = options.dashOffset;
|
|
@@ -2183,7 +2198,7 @@ const RectHelper = {
|
|
|
2183
2198
|
}
|
|
2184
2199
|
};
|
|
2185
2200
|
|
|
2186
|
-
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
|
|
2201
|
+
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
|
|
2187
2202
|
const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
|
|
2188
2203
|
const { set: set$2 } = PointHelper;
|
|
2189
2204
|
const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
@@ -2297,7 +2312,7 @@ const BezierHelper = {
|
|
|
2297
2312
|
totalRadian -= PI2;
|
|
2298
2313
|
if (anticlockwise)
|
|
2299
2314
|
totalRadian -= PI2;
|
|
2300
|
-
const parts = ceil(abs$3(totalRadian / PI_2));
|
|
2315
|
+
const parts = ceil$1(abs$3(totalRadian / PI_2));
|
|
2301
2316
|
const partRadian = totalRadian / parts;
|
|
2302
2317
|
const partRadian4Sin = sin$3(partRadian / 4);
|
|
2303
2318
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
|
|
@@ -2783,22 +2798,12 @@ const PathCommandDataHelper = {
|
|
|
2783
2798
|
}
|
|
2784
2799
|
},
|
|
2785
2800
|
drawEllipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
2786
|
-
|
|
2787
|
-
rotation = 0;
|
|
2788
|
-
if (startAngle === undefined)
|
|
2789
|
-
startAngle = 0;
|
|
2790
|
-
if (endAngle === undefined)
|
|
2791
|
-
endAngle = 360;
|
|
2792
|
-
BezierHelper.ellipse(null, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise, null, null, startPoint);
|
|
2801
|
+
BezierHelper.ellipse(null, x, y, radiusX, radiusY, rotation === undefined ? 0 : rotation, startAngle === undefined ? 0 : startAngle, endAngle === undefined ? 360 : endAngle, anticlockwise, null, null, startPoint);
|
|
2793
2802
|
data.push(M$3, startPoint.x, startPoint.y);
|
|
2794
2803
|
ellipse$3(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
|
|
2795
2804
|
},
|
|
2796
2805
|
drawArc(data, x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
2797
|
-
|
|
2798
|
-
startAngle = 0;
|
|
2799
|
-
if (endAngle === undefined)
|
|
2800
|
-
endAngle = 360;
|
|
2801
|
-
BezierHelper.arc(null, x, y, radius, startAngle, endAngle, anticlockwise, null, null, startPoint);
|
|
2806
|
+
BezierHelper.arc(null, x, y, radius, startAngle === undefined ? 0 : startAngle, endAngle === undefined ? 360 : endAngle, anticlockwise, null, null, startPoint);
|
|
2802
2807
|
data.push(M$3, startPoint.x, startPoint.y);
|
|
2803
2808
|
arc$2(data, x, y, radius, startAngle, endAngle, anticlockwise);
|
|
2804
2809
|
},
|
|
@@ -2810,68 +2815,70 @@ const { ellipse: ellipse$3, arc: arc$2 } = PathCommandDataHelper;
|
|
|
2810
2815
|
|
|
2811
2816
|
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;
|
|
2812
2817
|
class PathCreator {
|
|
2818
|
+
set path(value) { this.__path = value; }
|
|
2819
|
+
get path() { return this.__path; }
|
|
2813
2820
|
constructor(path) {
|
|
2814
2821
|
if (path) {
|
|
2815
|
-
this.
|
|
2822
|
+
this.__path = typeof path === 'string' ? PathHelper.parse(path) : path;
|
|
2816
2823
|
}
|
|
2817
2824
|
else {
|
|
2818
|
-
this.
|
|
2825
|
+
this.__path = [];
|
|
2819
2826
|
}
|
|
2820
2827
|
}
|
|
2821
2828
|
beginPath() {
|
|
2822
|
-
beginPath(this.
|
|
2829
|
+
beginPath(this.__path);
|
|
2823
2830
|
return this;
|
|
2824
2831
|
}
|
|
2825
2832
|
moveTo(x, y) {
|
|
2826
|
-
moveTo$4(this.
|
|
2833
|
+
moveTo$4(this.__path, x, y);
|
|
2827
2834
|
return this;
|
|
2828
2835
|
}
|
|
2829
2836
|
lineTo(x, y) {
|
|
2830
|
-
lineTo$3(this.
|
|
2837
|
+
lineTo$3(this.__path, x, y);
|
|
2831
2838
|
return this;
|
|
2832
2839
|
}
|
|
2833
2840
|
bezierCurveTo(x1, y1, x2, y2, x, y) {
|
|
2834
|
-
bezierCurveTo(this.
|
|
2841
|
+
bezierCurveTo(this.__path, x1, y1, x2, y2, x, y);
|
|
2835
2842
|
return this;
|
|
2836
2843
|
}
|
|
2837
2844
|
quadraticCurveTo(x1, y1, x, y) {
|
|
2838
|
-
quadraticCurveTo(this.
|
|
2845
|
+
quadraticCurveTo(this.__path, x1, y1, x, y);
|
|
2839
2846
|
return this;
|
|
2840
2847
|
}
|
|
2841
2848
|
closePath() {
|
|
2842
|
-
closePath$3(this.
|
|
2849
|
+
closePath$3(this.__path);
|
|
2843
2850
|
return this;
|
|
2844
2851
|
}
|
|
2845
2852
|
rect(x, y, width, height) {
|
|
2846
|
-
rect$1(this.
|
|
2853
|
+
rect$1(this.__path, x, y, width, height);
|
|
2847
2854
|
return this;
|
|
2848
2855
|
}
|
|
2849
2856
|
roundRect(x, y, width, height, cornerRadius) {
|
|
2850
|
-
roundRect$1(this.
|
|
2857
|
+
roundRect$1(this.__path, x, y, width, height, cornerRadius);
|
|
2851
2858
|
return this;
|
|
2852
2859
|
}
|
|
2853
2860
|
ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
2854
|
-
ellipse$2(this.
|
|
2861
|
+
ellipse$2(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
|
|
2855
2862
|
return this;
|
|
2856
2863
|
}
|
|
2857
2864
|
arc(x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
2858
|
-
arc$1(this.
|
|
2865
|
+
arc$1(this.__path, x, y, radius, startAngle, endAngle, anticlockwise);
|
|
2859
2866
|
return this;
|
|
2860
2867
|
}
|
|
2861
2868
|
arcTo(x1, y1, x2, y2, radius) {
|
|
2862
|
-
arcTo$2(this.
|
|
2869
|
+
arcTo$2(this.__path, x1, y1, x2, y2, radius);
|
|
2863
2870
|
return this;
|
|
2864
2871
|
}
|
|
2865
2872
|
drawEllipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
2866
|
-
drawEllipse(this.
|
|
2873
|
+
drawEllipse(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
|
|
2867
2874
|
return this;
|
|
2868
2875
|
}
|
|
2869
2876
|
drawArc(x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
2870
|
-
drawArc(this.
|
|
2877
|
+
drawArc(this.__path, x, y, radius, startAngle, endAngle, anticlockwise);
|
|
2871
2878
|
return this;
|
|
2872
2879
|
}
|
|
2873
2880
|
drawPoints(points, curve, close) {
|
|
2874
|
-
drawPoints$2(this.
|
|
2881
|
+
drawPoints$2(this.__path, points, curve, close);
|
|
2875
2882
|
return this;
|
|
2876
2883
|
}
|
|
2877
2884
|
}
|
|
@@ -3620,9 +3627,35 @@ function boundsType(defaultValue) {
|
|
|
3620
3627
|
defineLeafAttr(target, key, defaultValue, {
|
|
3621
3628
|
set(value) {
|
|
3622
3629
|
this.__setAttr(key, value);
|
|
3623
|
-
this
|
|
3624
|
-
|
|
3625
|
-
|
|
3630
|
+
doBoundsType(this);
|
|
3631
|
+
}
|
|
3632
|
+
});
|
|
3633
|
+
};
|
|
3634
|
+
}
|
|
3635
|
+
function naturalBoundsType(defaultValue) {
|
|
3636
|
+
return (target, key) => {
|
|
3637
|
+
defineLeafAttr(target, key, defaultValue, {
|
|
3638
|
+
set(value) {
|
|
3639
|
+
this.__setAttr(key, value);
|
|
3640
|
+
doBoundsType(this);
|
|
3641
|
+
this.__.__removeNaturalSize();
|
|
3642
|
+
}
|
|
3643
|
+
});
|
|
3644
|
+
};
|
|
3645
|
+
}
|
|
3646
|
+
function doBoundsType(leaf) {
|
|
3647
|
+
leaf.__layout.boxChanged || leaf.__layout.boxChange();
|
|
3648
|
+
if (leaf.__hasAutoLayout)
|
|
3649
|
+
leaf.__layout.matrixChanged || leaf.__layout.matrixChange();
|
|
3650
|
+
}
|
|
3651
|
+
function pathInputType(defaultValue) {
|
|
3652
|
+
return (target, key) => {
|
|
3653
|
+
defineLeafAttr(target, key, defaultValue, {
|
|
3654
|
+
set(value) {
|
|
3655
|
+
if (this.__.__pathInputed !== 2)
|
|
3656
|
+
this.__.__pathInputed = value ? 1 : 0;
|
|
3657
|
+
this.__setAttr(key, value);
|
|
3658
|
+
doBoundsType(this);
|
|
3626
3659
|
}
|
|
3627
3660
|
});
|
|
3628
3661
|
};
|
|
@@ -3633,11 +3666,14 @@ function affectStrokeBoundsType(defaultValue) {
|
|
|
3633
3666
|
defineLeafAttr(target, key, defaultValue, {
|
|
3634
3667
|
set(value) {
|
|
3635
3668
|
this.__setAttr(key, value);
|
|
3636
|
-
this
|
|
3669
|
+
doStrokeType(this);
|
|
3637
3670
|
}
|
|
3638
3671
|
});
|
|
3639
3672
|
};
|
|
3640
3673
|
}
|
|
3674
|
+
function doStrokeType(leaf) {
|
|
3675
|
+
leaf.__layout.strokeChanged || leaf.__layout.strokeChange();
|
|
3676
|
+
}
|
|
3641
3677
|
const strokeType = affectStrokeBoundsType;
|
|
3642
3678
|
function affectRenderBoundsType(defaultValue) {
|
|
3643
3679
|
return (target, key) => {
|
|
@@ -4257,6 +4293,7 @@ class ChildEvent extends Event {
|
|
|
4257
4293
|
}
|
|
4258
4294
|
ChildEvent.ADD = 'child.add';
|
|
4259
4295
|
ChildEvent.REMOVE = 'child.remove';
|
|
4296
|
+
ChildEvent.DESTROY = 'child.destroy';
|
|
4260
4297
|
|
|
4261
4298
|
class PropertyEvent extends Event {
|
|
4262
4299
|
constructor(type, target, attrName, oldValue, newValue) {
|
|
@@ -4704,6 +4741,7 @@ const WaitHelper = {
|
|
|
4704
4741
|
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2, hasParentAutoLayout } = LeafHelper;
|
|
4705
4742
|
const { updateBounds: updateBounds$1 } = BranchHelper;
|
|
4706
4743
|
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1 } = BoundsHelper;
|
|
4744
|
+
const { toBounds: toBounds$2 } = PathBounds;
|
|
4707
4745
|
const LeafBounds = {
|
|
4708
4746
|
__updateWorldBounds() {
|
|
4709
4747
|
toOuterOf$1(this.__layout.renderBounds, this.__world, this.__world);
|
|
@@ -4715,7 +4753,8 @@ const LeafBounds = {
|
|
|
4715
4753
|
__updateLocalBounds() {
|
|
4716
4754
|
const layout = this.__layout;
|
|
4717
4755
|
if (layout.boxChanged) {
|
|
4718
|
-
this.
|
|
4756
|
+
if (!this.__.__pathInputed)
|
|
4757
|
+
this.__updatePath();
|
|
4719
4758
|
this.__updateRenderPath();
|
|
4720
4759
|
this.__updateBoxBounds();
|
|
4721
4760
|
layout.boxChanged = false;
|
|
@@ -4782,11 +4821,16 @@ const LeafBounds = {
|
|
|
4782
4821
|
},
|
|
4783
4822
|
__updateBoxBounds() {
|
|
4784
4823
|
const b = this.__layout.boxBounds;
|
|
4785
|
-
const
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4824
|
+
const data = this.__;
|
|
4825
|
+
if (data.__pathInputed) {
|
|
4826
|
+
toBounds$2(data.__pathForRender, b);
|
|
4827
|
+
}
|
|
4828
|
+
else {
|
|
4829
|
+
b.x = 0;
|
|
4830
|
+
b.y = 0;
|
|
4831
|
+
b.width = data.width;
|
|
4832
|
+
b.height = data.height;
|
|
4833
|
+
}
|
|
4790
4834
|
},
|
|
4791
4835
|
__updateAutoLayout() {
|
|
4792
4836
|
this.__layout.matrixChanged = true;
|
|
@@ -4915,6 +4959,9 @@ let Leaf = class Leaf {
|
|
|
4915
4959
|
get innerName() { return this.__.name || this.tag + this.innerId; }
|
|
4916
4960
|
get __DataProcessor() { return LeafData; }
|
|
4917
4961
|
get __LayoutProcessor() { return LeafLayout; }
|
|
4962
|
+
get isLeafer() { return false; }
|
|
4963
|
+
get isBranch() { return false; }
|
|
4964
|
+
get isBranchLeaf() { return false; }
|
|
4918
4965
|
get __localMatrix() { return this.__local || this.__layout; }
|
|
4919
4966
|
get __localBoxBounds() { return this.__local || this.__layout; }
|
|
4920
4967
|
get worldTransform() { return this.__layout.getTransform('world'); }
|
|
@@ -4928,6 +4975,7 @@ let Leaf = class Leaf {
|
|
|
4928
4975
|
get __worldFlipped() { return this.__world.scaleX < 0 || this.__world.scaleY < 0; }
|
|
4929
4976
|
get __onlyHitMask() { return this.__hasMask && !this.__.hitChildren; }
|
|
4930
4977
|
get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
|
|
4978
|
+
get pathInputed() { return !!this.__.__pathInputed; }
|
|
4931
4979
|
constructor(data) {
|
|
4932
4980
|
this.innerId = create(LEAF);
|
|
4933
4981
|
this.reset(data);
|
|
@@ -4979,7 +5027,7 @@ let Leaf = class Leaf {
|
|
|
4979
5027
|
}
|
|
4980
5028
|
}
|
|
4981
5029
|
set(_data) { }
|
|
4982
|
-
get() { return undefined; }
|
|
5030
|
+
get(_name) { return undefined; }
|
|
4983
5031
|
toJSON() {
|
|
4984
5032
|
return this.__.__getInputData();
|
|
4985
5033
|
}
|
|
@@ -5196,10 +5244,13 @@ let Leaf = class Leaf {
|
|
|
5196
5244
|
}
|
|
5197
5245
|
destroy() {
|
|
5198
5246
|
if (!this.destroyed) {
|
|
5199
|
-
|
|
5247
|
+
const { parent } = this;
|
|
5248
|
+
if (parent)
|
|
5200
5249
|
this.remove();
|
|
5201
5250
|
if (this.children)
|
|
5202
5251
|
this.removeAll(true);
|
|
5252
|
+
if (this.hasEvent(ChildEvent.DESTROY))
|
|
5253
|
+
this.emitEvent(new ChildEvent(ChildEvent.DESTROY, this, parent));
|
|
5203
5254
|
this.__.destroy();
|
|
5204
5255
|
this.__layout.destroy();
|
|
5205
5256
|
this.__captureMap = this.__bubbleMap = this.__parentWait = this.__leaferWait = null;
|
|
@@ -5219,11 +5270,6 @@ const { setListWithFn } = BoundsHelper;
|
|
|
5219
5270
|
const { sort } = BranchHelper;
|
|
5220
5271
|
const { localBoxBounds, localStrokeBounds, localRenderBounds, maskLocalBoxBounds, maskLocalStrokeBounds, maskLocalRenderBounds } = LeafBoundsHelper;
|
|
5221
5272
|
let Branch = class Branch extends Leaf {
|
|
5222
|
-
constructor() {
|
|
5223
|
-
super();
|
|
5224
|
-
this.isBranch = true;
|
|
5225
|
-
this.children = [];
|
|
5226
|
-
}
|
|
5227
5273
|
__updateStrokeSpread() {
|
|
5228
5274
|
const { children } = this;
|
|
5229
5275
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
@@ -5263,6 +5309,8 @@ let Branch = class Branch extends Leaf {
|
|
|
5263
5309
|
}
|
|
5264
5310
|
}
|
|
5265
5311
|
add(child, index) {
|
|
5312
|
+
if (child === this)
|
|
5313
|
+
return;
|
|
5266
5314
|
if (child.parent)
|
|
5267
5315
|
child.parent.remove(child);
|
|
5268
5316
|
child.parent = this;
|
|
@@ -6003,9 +6051,11 @@ class Layouter {
|
|
|
6003
6051
|
updateAllChange(target);
|
|
6004
6052
|
}
|
|
6005
6053
|
addExtra(leaf) {
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6054
|
+
if (!this.__updatedList.has(leaf)) {
|
|
6055
|
+
const { updatedList, beforeBounds } = this.extraBlock || (this.extraBlock = new LayoutBlockData([]));
|
|
6056
|
+
updatedList.length ? beforeBounds.add(leaf.__world) : beforeBounds.set(leaf.__world);
|
|
6057
|
+
updatedList.add(leaf);
|
|
6058
|
+
}
|
|
6009
6059
|
}
|
|
6010
6060
|
createBlock(data) {
|
|
6011
6061
|
return new LayoutBlockData(data);
|
|
@@ -6521,6 +6571,18 @@ Object.assign(Creator, {
|
|
|
6521
6571
|
});
|
|
6522
6572
|
Platform.layout = Layouter.fullLayout;
|
|
6523
6573
|
|
|
6574
|
+
function arrowType(defaultValue) {
|
|
6575
|
+
return (target, key) => {
|
|
6576
|
+
defineLeafAttr(target, key, defaultValue, {
|
|
6577
|
+
set(value) {
|
|
6578
|
+
this.__setAttr(key, value);
|
|
6579
|
+
doStrokeType(this);
|
|
6580
|
+
const data = this.__;
|
|
6581
|
+
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
6582
|
+
}
|
|
6583
|
+
});
|
|
6584
|
+
};
|
|
6585
|
+
}
|
|
6524
6586
|
function effectType(defaultValue) {
|
|
6525
6587
|
return (target, key) => {
|
|
6526
6588
|
defineLeafAttr(target, key, defaultValue, {
|
|
@@ -6547,12 +6609,14 @@ function resizeType(defaultValue) {
|
|
|
6547
6609
|
|
|
6548
6610
|
const TextConvert = {};
|
|
6549
6611
|
const ColorConvert = {};
|
|
6612
|
+
const PathArrow = {};
|
|
6550
6613
|
const Paint = {};
|
|
6551
6614
|
const PaintImage = {};
|
|
6552
6615
|
const PaintGradient = {};
|
|
6553
6616
|
const Effect = {};
|
|
6554
6617
|
const Export = {};
|
|
6555
6618
|
|
|
6619
|
+
const { parse } = PathConvert;
|
|
6556
6620
|
const emptyPaint = {};
|
|
6557
6621
|
const debug$3 = Debug.get('UIData');
|
|
6558
6622
|
class UIData extends LeafData {
|
|
@@ -6570,7 +6634,8 @@ class UIData extends LeafData {
|
|
|
6570
6634
|
}
|
|
6571
6635
|
get __autoWidth() { return !this._width; }
|
|
6572
6636
|
get __autoHeight() { return !this._height; }
|
|
6573
|
-
get
|
|
6637
|
+
get __autoSide() { return !this._width || !this._height; }
|
|
6638
|
+
get __autoSize() { return !this._width && !this._height; }
|
|
6574
6639
|
setVisible(value) {
|
|
6575
6640
|
if (this.__leaf.leafer)
|
|
6576
6641
|
this.__leaf.leafer.watcher.hasVisible = true;
|
|
@@ -6598,7 +6663,7 @@ class UIData extends LeafData {
|
|
|
6598
6663
|
}
|
|
6599
6664
|
setFill(value) {
|
|
6600
6665
|
if (this.__naturalWidth)
|
|
6601
|
-
this.
|
|
6666
|
+
this.__removeNaturalSize();
|
|
6602
6667
|
if (typeof value === 'string' || !value) {
|
|
6603
6668
|
if (this.__isFills) {
|
|
6604
6669
|
this.__removeInput('fill');
|
|
@@ -6634,6 +6699,17 @@ class UIData extends LeafData {
|
|
|
6634
6699
|
this._stroke || (this._stroke = emptyPaint);
|
|
6635
6700
|
}
|
|
6636
6701
|
}
|
|
6702
|
+
setPath(value) {
|
|
6703
|
+
if (typeof value === 'string') {
|
|
6704
|
+
this.__setInput('path', value);
|
|
6705
|
+
this._path = parse(value);
|
|
6706
|
+
}
|
|
6707
|
+
else {
|
|
6708
|
+
if (this.__input)
|
|
6709
|
+
this.__removeInput('path');
|
|
6710
|
+
this._path = value;
|
|
6711
|
+
}
|
|
6712
|
+
}
|
|
6637
6713
|
setShadow(value) {
|
|
6638
6714
|
this.__setInput('shadow', value);
|
|
6639
6715
|
if (value instanceof Array) {
|
|
@@ -6695,9 +6771,6 @@ class FrameData extends BoxData {
|
|
|
6695
6771
|
class LineData extends UIData {
|
|
6696
6772
|
}
|
|
6697
6773
|
|
|
6698
|
-
class ArrowData extends LineData {
|
|
6699
|
-
}
|
|
6700
|
-
|
|
6701
6774
|
class RectData extends UIData {
|
|
6702
6775
|
get __boxStroke() { return true; }
|
|
6703
6776
|
}
|
|
@@ -6712,19 +6785,7 @@ class PolygonData extends UIData {
|
|
|
6712
6785
|
class StarData extends UIData {
|
|
6713
6786
|
}
|
|
6714
6787
|
|
|
6715
|
-
const { parse } = PathConvert;
|
|
6716
6788
|
class PathData extends UIData {
|
|
6717
|
-
setPath(value) {
|
|
6718
|
-
if (typeof value === 'string') {
|
|
6719
|
-
this.__setInput('path', value);
|
|
6720
|
-
this._path = parse(value);
|
|
6721
|
-
}
|
|
6722
|
-
else {
|
|
6723
|
-
if (this.__input)
|
|
6724
|
-
this.__removeInput('path');
|
|
6725
|
-
this._path = value;
|
|
6726
|
-
}
|
|
6727
|
-
}
|
|
6728
6789
|
}
|
|
6729
6790
|
|
|
6730
6791
|
class PenData extends GroupData {
|
|
@@ -6794,6 +6855,8 @@ const UIBounds = {
|
|
|
6794
6855
|
}
|
|
6795
6856
|
}
|
|
6796
6857
|
this.__layout.strokeBoxSpread = boxWidth;
|
|
6858
|
+
if (this.__.__useArrow)
|
|
6859
|
+
width += strokeWidth * 5;
|
|
6797
6860
|
return width;
|
|
6798
6861
|
},
|
|
6799
6862
|
__updateRenderSpread() {
|
|
@@ -6927,6 +6990,7 @@ const RectRender = {
|
|
|
6927
6990
|
var UI_1;
|
|
6928
6991
|
let UI = UI_1 = class UI extends Leaf {
|
|
6929
6992
|
get app() { return this.leafer && this.leafer.app; }
|
|
6993
|
+
get isFrame() { return false; }
|
|
6930
6994
|
set scale(value) {
|
|
6931
6995
|
if (typeof value === 'number') {
|
|
6932
6996
|
this.scaleX = this.scaleY = value;
|
|
@@ -6947,8 +7011,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
6947
7011
|
set(data) {
|
|
6948
7012
|
Object.assign(this, data);
|
|
6949
7013
|
}
|
|
6950
|
-
get() {
|
|
6951
|
-
return this.__.__getInputData();
|
|
7014
|
+
get(name) {
|
|
7015
|
+
return name ? this.__.__getInput(name) : this.__.__getInputData();
|
|
6952
7016
|
}
|
|
6953
7017
|
createProxyData() { return undefined; }
|
|
6954
7018
|
find(_condition, _options) { return undefined; }
|
|
@@ -6980,6 +7044,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
6980
7044
|
if (this.__.path) {
|
|
6981
7045
|
const data = this.__;
|
|
6982
7046
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
7047
|
+
if (data.__useArrow)
|
|
7048
|
+
PathArrow.addArrows(this, !data.cornerRadius);
|
|
6983
7049
|
}
|
|
6984
7050
|
}
|
|
6985
7051
|
__drawRenderPath(canvas) {
|
|
@@ -6990,7 +7056,14 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
6990
7056
|
canvas.beginPath();
|
|
6991
7057
|
this.__drawPathByData(canvas, this.__.path);
|
|
6992
7058
|
}
|
|
6993
|
-
__drawPathByData(
|
|
7059
|
+
__drawPathByData(drawer, data) {
|
|
7060
|
+
if (data) {
|
|
7061
|
+
PathDrawer.drawPathByData(drawer, data);
|
|
7062
|
+
}
|
|
7063
|
+
else {
|
|
7064
|
+
this.__drawPathByBox(drawer);
|
|
7065
|
+
}
|
|
7066
|
+
}
|
|
6994
7067
|
__drawPathByBox(drawer) {
|
|
6995
7068
|
const { x, y, width, height } = this.__layout.boxBounds;
|
|
6996
7069
|
if (this.__.cornerRadius) {
|
|
@@ -7009,6 +7082,12 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7009
7082
|
static one(data, x, y, width, height) {
|
|
7010
7083
|
return UICreator.get(data.tag || this.prototype.__tag, data, x, y, width, height);
|
|
7011
7084
|
}
|
|
7085
|
+
static registerUI() {
|
|
7086
|
+
registerUI()(this);
|
|
7087
|
+
}
|
|
7088
|
+
static registerData(data) {
|
|
7089
|
+
dataProcessor(data)(this.prototype);
|
|
7090
|
+
}
|
|
7012
7091
|
destroy() {
|
|
7013
7092
|
this.fill = this.stroke = null;
|
|
7014
7093
|
super.destroy();
|
|
@@ -7147,10 +7226,19 @@ __decorate([
|
|
|
7147
7226
|
dataType(false)
|
|
7148
7227
|
], UI.prototype, "lazy", void 0);
|
|
7149
7228
|
__decorate([
|
|
7150
|
-
|
|
7229
|
+
naturalBoundsType(1)
|
|
7230
|
+
], UI.prototype, "pixelRatio", void 0);
|
|
7231
|
+
__decorate([
|
|
7232
|
+
pathInputType()
|
|
7233
|
+
], UI.prototype, "path", void 0);
|
|
7234
|
+
__decorate([
|
|
7235
|
+
pathType()
|
|
7236
|
+
], UI.prototype, "windingRule", void 0);
|
|
7237
|
+
__decorate([
|
|
7238
|
+
arrowType('none')
|
|
7151
7239
|
], UI.prototype, "startArrow", void 0);
|
|
7152
7240
|
__decorate([
|
|
7153
|
-
|
|
7241
|
+
arrowType('none')
|
|
7154
7242
|
], UI.prototype, "endArrow", void 0);
|
|
7155
7243
|
__decorate([
|
|
7156
7244
|
pathType(0)
|
|
@@ -7176,9 +7264,6 @@ __decorate([
|
|
|
7176
7264
|
__decorate([
|
|
7177
7265
|
rewrite(Leaf.prototype.reset)
|
|
7178
7266
|
], UI.prototype, "reset", null);
|
|
7179
|
-
__decorate([
|
|
7180
|
-
rewrite(PathDrawer.drawPathByData)
|
|
7181
|
-
], UI.prototype, "__drawPathByData", null);
|
|
7182
7267
|
UI = UI_1 = __decorate([
|
|
7183
7268
|
useModule(UIBounds),
|
|
7184
7269
|
useModule(UIRender),
|
|
@@ -7187,12 +7272,15 @@ UI = UI_1 = __decorate([
|
|
|
7187
7272
|
|
|
7188
7273
|
let Group = class Group extends UI {
|
|
7189
7274
|
get __tag() { return 'Group'; }
|
|
7275
|
+
get isBranch() { return true; }
|
|
7190
7276
|
constructor(data) {
|
|
7191
7277
|
super(data);
|
|
7278
|
+
}
|
|
7279
|
+
reset(data) {
|
|
7192
7280
|
this.__setBranch();
|
|
7281
|
+
super.reset(data);
|
|
7193
7282
|
}
|
|
7194
7283
|
__setBranch() {
|
|
7195
|
-
this.isBranch = true;
|
|
7196
7284
|
if (!this.children)
|
|
7197
7285
|
this.children = [];
|
|
7198
7286
|
}
|
|
@@ -7204,7 +7292,7 @@ let Group = class Group extends UI {
|
|
|
7204
7292
|
this.__setBranch();
|
|
7205
7293
|
}
|
|
7206
7294
|
else {
|
|
7207
|
-
this.
|
|
7295
|
+
this.clear();
|
|
7208
7296
|
}
|
|
7209
7297
|
super.set(data);
|
|
7210
7298
|
let child;
|
|
@@ -7252,6 +7340,7 @@ let Leafer = class Leafer extends Group {
|
|
|
7252
7340
|
get __tag() { return 'Leafer'; }
|
|
7253
7341
|
get isApp() { return false; }
|
|
7254
7342
|
get app() { return this.parent || this; }
|
|
7343
|
+
get isLeafer() { return true; }
|
|
7255
7344
|
get imageReady() { return this.viewReady && ImageManager.isComplete; }
|
|
7256
7345
|
get layoutLocked() { return !this.layouter.running; }
|
|
7257
7346
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
@@ -7368,7 +7457,7 @@ let Leafer = class Leafer extends Group {
|
|
|
7368
7457
|
this.forceRender();
|
|
7369
7458
|
}
|
|
7370
7459
|
forceRender(bounds) {
|
|
7371
|
-
this.renderer.addBlock(new Bounds(bounds)
|
|
7460
|
+
this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
|
|
7372
7461
|
if (this.viewReady)
|
|
7373
7462
|
this.renderer.update();
|
|
7374
7463
|
}
|
|
@@ -7399,7 +7488,6 @@ let Leafer = class Leafer extends Group {
|
|
|
7399
7488
|
}
|
|
7400
7489
|
__setLeafer(leafer) {
|
|
7401
7490
|
this.leafer = leafer;
|
|
7402
|
-
this.isLeafer = !!leafer;
|
|
7403
7491
|
this.__level = 1;
|
|
7404
7492
|
}
|
|
7405
7493
|
setZoomLayer(zoomLayer) {
|
|
@@ -7586,14 +7674,10 @@ let Rect = class Rect extends UI {
|
|
|
7586
7674
|
constructor(data) {
|
|
7587
7675
|
super(data);
|
|
7588
7676
|
}
|
|
7589
|
-
__drawPathByData(_drawer, _data) { }
|
|
7590
7677
|
};
|
|
7591
7678
|
__decorate([
|
|
7592
7679
|
dataProcessor(RectData)
|
|
7593
7680
|
], Rect.prototype, "__", void 0);
|
|
7594
|
-
__decorate([
|
|
7595
|
-
rewrite(UI.prototype.__drawPathByBox)
|
|
7596
|
-
], Rect.prototype, "__drawPathByData", null);
|
|
7597
7681
|
Rect = __decorate([
|
|
7598
7682
|
useModule(RectRender),
|
|
7599
7683
|
rewriteAble(),
|
|
@@ -7606,9 +7690,9 @@ const bounds$1 = {};
|
|
|
7606
7690
|
const { copy: copy$3, add } = BoundsHelper;
|
|
7607
7691
|
let Box = class Box extends Group {
|
|
7608
7692
|
get __tag() { return 'Box'; }
|
|
7693
|
+
get isBranchLeaf() { return true; }
|
|
7609
7694
|
constructor(data) {
|
|
7610
7695
|
super(data);
|
|
7611
|
-
this.isBranchLeaf = true;
|
|
7612
7696
|
this.__layout.renderChanged || this.__layout.renderChange();
|
|
7613
7697
|
}
|
|
7614
7698
|
__updateStrokeSpread() { return 0; }
|
|
@@ -7622,8 +7706,18 @@ let Box = class Box extends Group {
|
|
|
7622
7706
|
}
|
|
7623
7707
|
__updateRectBoxBounds() { }
|
|
7624
7708
|
__updateBoxBounds() {
|
|
7625
|
-
|
|
7709
|
+
const data = this.__;
|
|
7710
|
+
if (data.__autoSide && this.children.length) {
|
|
7711
|
+
if (this.leafer)
|
|
7712
|
+
this.leafer.layouter.addExtra(this);
|
|
7626
7713
|
super.__updateBoxBounds();
|
|
7714
|
+
if (!data.__autoSize) {
|
|
7715
|
+
const b = this.__layout.boxBounds;
|
|
7716
|
+
if (!data.__autoWidth)
|
|
7717
|
+
b.x = 0, b.width = data.width;
|
|
7718
|
+
if (!data.__autoHeight)
|
|
7719
|
+
b.y = 0, b.height = data.height;
|
|
7720
|
+
}
|
|
7627
7721
|
}
|
|
7628
7722
|
else {
|
|
7629
7723
|
this.__updateRectBoxBounds();
|
|
@@ -7645,7 +7739,6 @@ let Box = class Box extends Group {
|
|
|
7645
7739
|
super.__updateChange();
|
|
7646
7740
|
this.__updateRectChange();
|
|
7647
7741
|
}
|
|
7648
|
-
__drawPathByData(_drawer, _data) { }
|
|
7649
7742
|
__renderRect(_canvas, _options) { }
|
|
7650
7743
|
__renderGroup(_canvas, _options) { }
|
|
7651
7744
|
__render(canvas, options) {
|
|
@@ -7690,9 +7783,6 @@ __decorate([
|
|
|
7690
7783
|
__decorate([
|
|
7691
7784
|
rewrite(rect.__updateChange)
|
|
7692
7785
|
], Box.prototype, "__updateRectChange", null);
|
|
7693
|
-
__decorate([
|
|
7694
|
-
rewrite(rect.__drawPathByData)
|
|
7695
|
-
], Box.prototype, "__drawPathByData", null);
|
|
7696
7786
|
__decorate([
|
|
7697
7787
|
rewrite(rect.__render)
|
|
7698
7788
|
], Box.prototype, "__renderRect", null);
|
|
@@ -7706,9 +7796,9 @@ Box = __decorate([
|
|
|
7706
7796
|
|
|
7707
7797
|
let Frame = class Frame extends Box {
|
|
7708
7798
|
get __tag() { return 'Frame'; }
|
|
7799
|
+
get isFrame() { return true; }
|
|
7709
7800
|
constructor(data) {
|
|
7710
7801
|
super(data);
|
|
7711
|
-
this.isFrame = true;
|
|
7712
7802
|
}
|
|
7713
7803
|
};
|
|
7714
7804
|
__decorate([
|
|
@@ -7782,7 +7872,7 @@ Ellipse = __decorate([
|
|
|
7782
7872
|
|
|
7783
7873
|
const { moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1 } = PathCommandDataHelper;
|
|
7784
7874
|
const { rotate: rotate$1, getAngle: getAngle$2, getDistance: getDistance$2, defaultPoint } = PointHelper;
|
|
7785
|
-
const { toBounds: toBounds$
|
|
7875
|
+
const { toBounds: toBounds$1 } = PathBounds;
|
|
7786
7876
|
let Line = class Line extends UI {
|
|
7787
7877
|
get __tag() { return 'Line'; }
|
|
7788
7878
|
get toPoint() {
|
|
@@ -7814,8 +7904,11 @@ let Line = class Line extends UI {
|
|
|
7814
7904
|
}
|
|
7815
7905
|
}
|
|
7816
7906
|
__updateRenderPath() {
|
|
7817
|
-
|
|
7818
|
-
|
|
7907
|
+
const data = this.__;
|
|
7908
|
+
if (!this.pathInputed && data.points && data.curve) {
|
|
7909
|
+
drawPoints$1(data.__pathForRender = [], data.points, data.curve, this.pathClosed);
|
|
7910
|
+
if (data.__useArrow)
|
|
7911
|
+
PathArrow.addArrows(this, false);
|
|
7819
7912
|
}
|
|
7820
7913
|
else {
|
|
7821
7914
|
super.__updateRenderPath();
|
|
@@ -7823,7 +7916,7 @@ let Line = class Line extends UI {
|
|
|
7823
7916
|
}
|
|
7824
7917
|
__updateBoxBounds() {
|
|
7825
7918
|
if (this.points) {
|
|
7826
|
-
toBounds$
|
|
7919
|
+
toBounds$1(this.__.__pathForRender, this.__layout.boxBounds);
|
|
7827
7920
|
}
|
|
7828
7921
|
else {
|
|
7829
7922
|
super.__updateBoxBounds();
|
|
@@ -7856,6 +7949,7 @@ let Polygon = class Polygon extends UI {
|
|
|
7856
7949
|
get __tag() { return 'Polygon'; }
|
|
7857
7950
|
constructor(data) {
|
|
7858
7951
|
super(data);
|
|
7952
|
+
this.pathClosed = true;
|
|
7859
7953
|
}
|
|
7860
7954
|
__updatePath() {
|
|
7861
7955
|
const path = this.__.path = [];
|
|
@@ -8011,7 +8105,7 @@ let Canvas = class Canvas extends Rect {
|
|
|
8011
8105
|
}
|
|
8012
8106
|
};
|
|
8013
8107
|
__decorate([
|
|
8014
|
-
dataProcessor(
|
|
8108
|
+
dataProcessor(CanvasData)
|
|
8015
8109
|
], Canvas.prototype, "__", void 0);
|
|
8016
8110
|
__decorate([
|
|
8017
8111
|
resizeType(100)
|
|
@@ -8074,7 +8168,7 @@ let Text = class Text extends UI {
|
|
|
8074
8168
|
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
|
|
8075
8169
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8076
8170
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8077
|
-
data.__clipText = textOverflow !== 'show' && !data.
|
|
8171
|
+
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8078
8172
|
this.__updateTextDrawData();
|
|
8079
8173
|
const { bounds } = data.__textDrawData;
|
|
8080
8174
|
const b = layout.boxBounds;
|
|
@@ -8191,25 +8285,16 @@ Text = __decorate([
|
|
|
8191
8285
|
registerUI()
|
|
8192
8286
|
], Text);
|
|
8193
8287
|
|
|
8194
|
-
const { toBounds: toBounds$1 } = PathBounds;
|
|
8195
8288
|
let Path = class Path extends UI {
|
|
8196
8289
|
get __tag() { return 'Path'; }
|
|
8197
8290
|
constructor(data) {
|
|
8198
8291
|
super(data);
|
|
8199
|
-
|
|
8200
|
-
__updateBoxBounds() {
|
|
8201
|
-
toBounds$1(this.__.path, this.__layout.boxBounds);
|
|
8292
|
+
this.__.__pathInputed = 2;
|
|
8202
8293
|
}
|
|
8203
8294
|
};
|
|
8204
8295
|
__decorate([
|
|
8205
8296
|
dataProcessor(PathData)
|
|
8206
8297
|
], Path.prototype, "__", void 0);
|
|
8207
|
-
__decorate([
|
|
8208
|
-
pathType()
|
|
8209
|
-
], Path.prototype, "path", void 0);
|
|
8210
|
-
__decorate([
|
|
8211
|
-
pathType()
|
|
8212
|
-
], Path.prototype, "windingRule", void 0);
|
|
8213
8298
|
__decorate([
|
|
8214
8299
|
affectStrokeBoundsType('center')
|
|
8215
8300
|
], Path.prototype, "strokeAlign", void 0);
|
|
@@ -8225,12 +8310,12 @@ let Pen = class Pen extends Group {
|
|
|
8225
8310
|
setStyle(data) {
|
|
8226
8311
|
const path = this.pathElement = new Path(data);
|
|
8227
8312
|
this.pathStyle = data;
|
|
8228
|
-
this.
|
|
8313
|
+
this.__path = path.path || (path.path = []);
|
|
8229
8314
|
this.add(path);
|
|
8230
8315
|
return this;
|
|
8231
8316
|
}
|
|
8232
8317
|
beginPath() {
|
|
8233
|
-
this.
|
|
8318
|
+
this.__path.length = 0;
|
|
8234
8319
|
this.paint();
|
|
8235
8320
|
return this;
|
|
8236
8321
|
}
|
|
@@ -8254,10 +8339,20 @@ let Pen = class Pen extends Group {
|
|
|
8254
8339
|
__decorate([
|
|
8255
8340
|
dataProcessor(PenData)
|
|
8256
8341
|
], Pen.prototype, "__", void 0);
|
|
8342
|
+
__decorate([
|
|
8343
|
+
penPathType()
|
|
8344
|
+
], Pen.prototype, "path", void 0);
|
|
8257
8345
|
Pen = __decorate([
|
|
8258
|
-
useModule(PathCreator, ['beginPath']),
|
|
8346
|
+
useModule(PathCreator, ['beginPath', 'path']),
|
|
8259
8347
|
registerUI()
|
|
8260
8348
|
], Pen);
|
|
8349
|
+
function penPathType() {
|
|
8350
|
+
return (target, key) => {
|
|
8351
|
+
defineKey(target, key, {
|
|
8352
|
+
get() { return this.__path; }
|
|
8353
|
+
});
|
|
8354
|
+
};
|
|
8355
|
+
}
|
|
8261
8356
|
|
|
8262
8357
|
let App = class App extends Leafer {
|
|
8263
8358
|
get __tag() { return 'App'; }
|
|
@@ -10119,9 +10214,9 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
10119
10214
|
function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
|
|
10120
10215
|
if (attrName === 'fill' && !ui.__.__naturalWidth) {
|
|
10121
10216
|
const data = ui.__;
|
|
10122
|
-
data.__naturalWidth = image.width;
|
|
10123
|
-
data.__naturalHeight = image.height;
|
|
10124
|
-
if (data.
|
|
10217
|
+
data.__naturalWidth = image.width / data.pixelRatio;
|
|
10218
|
+
data.__naturalHeight = image.height / data.pixelRatio;
|
|
10219
|
+
if (data.__autoSide) {
|
|
10125
10220
|
ui.forceUpdate('width');
|
|
10126
10221
|
if (ui.__proxyData) {
|
|
10127
10222
|
ui.setProxyAttr('width', data.width);
|
|
@@ -10151,7 +10246,7 @@ function emit(ui, type, data) {
|
|
|
10151
10246
|
}
|
|
10152
10247
|
|
|
10153
10248
|
const { get: get$2, scale, copy: copy$1 } = MatrixHelper;
|
|
10154
|
-
const {
|
|
10249
|
+
const { ceil, abs: abs$1 } = Math;
|
|
10155
10250
|
function createPattern(ui, paint, pixelRatio) {
|
|
10156
10251
|
let { scaleX, scaleY } = ui.__world;
|
|
10157
10252
|
const id = scaleX + '-' + scaleY;
|
|
@@ -10202,7 +10297,7 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
10202
10297
|
}
|
|
10203
10298
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
10204
10299
|
}
|
|
10205
|
-
const canvas = image.getCanvas(width
|
|
10300
|
+
const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity);
|
|
10206
10301
|
const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint);
|
|
10207
10302
|
paint.style = pattern;
|
|
10208
10303
|
paint.patternId = id;
|
|
@@ -11113,37 +11208,55 @@ const ExportModule = {
|
|
|
11113
11208
|
const { leafer } = leaf;
|
|
11114
11209
|
if (leafer) {
|
|
11115
11210
|
leafer.waitViewCompleted(() => __awaiter(this, void 0, void 0, function* () {
|
|
11116
|
-
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
11117
11211
|
options = FileHelper.getExportOptions(options);
|
|
11118
|
-
|
|
11212
|
+
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
11213
|
+
const { worldTransform, isLeafer, isFrame } = leaf;
|
|
11214
|
+
const { slice, trim, onCanvas } = options;
|
|
11215
|
+
const scale = options.scale || 1;
|
|
11119
11216
|
const pixelRatio = options.pixelRatio || 1;
|
|
11120
11217
|
const screenshot = options.screenshot || leaf.isApp;
|
|
11121
|
-
const fill =
|
|
11218
|
+
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : undefined) : options.fill;
|
|
11122
11219
|
const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
|
|
11123
11220
|
if (screenshot) {
|
|
11124
|
-
renderBounds = screenshot === true ? (
|
|
11221
|
+
renderBounds = screenshot === true ? (isLeafer ? leafer.canvas.bounds : leaf.worldRenderBounds) : screenshot;
|
|
11125
11222
|
}
|
|
11126
11223
|
else {
|
|
11127
|
-
const
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11137
|
-
|
|
11224
|
+
const location = options.location || ((isLeafer || isFrame) ? 'inner' : 'local');
|
|
11225
|
+
scaleX = worldTransform.scaleX;
|
|
11226
|
+
scaleY = worldTransform.scaleY;
|
|
11227
|
+
switch (location) {
|
|
11228
|
+
case 'inner':
|
|
11229
|
+
matrix.set(worldTransform).invert();
|
|
11230
|
+
break;
|
|
11231
|
+
case 'local':
|
|
11232
|
+
matrix.set(worldTransform).divide(leaf.localTransform).invert();
|
|
11233
|
+
scaleX /= leaf.scaleX;
|
|
11234
|
+
scaleY /= leaf.scaleY;
|
|
11235
|
+
break;
|
|
11236
|
+
case 'world':
|
|
11237
|
+
scaleX = 1;
|
|
11238
|
+
scaleY = 1;
|
|
11239
|
+
break;
|
|
11240
|
+
}
|
|
11241
|
+
renderBounds = leaf.getBounds('render', location);
|
|
11138
11242
|
}
|
|
11139
|
-
|
|
11140
|
-
|
|
11243
|
+
const { x, y, width, height } = new Bounds(renderBounds).scale(scale).ceil();
|
|
11244
|
+
let canvas = Creator.canvas({ width, height, pixelRatio });
|
|
11245
|
+
const renderOptions = { matrix: matrix.scale(scale).translate(-x, -y).withScale(1 / scaleX * scale, 1 / scaleY * scale) };
|
|
11141
11246
|
if (slice) {
|
|
11142
11247
|
leaf = leafer;
|
|
11143
11248
|
renderOptions.bounds = canvas.bounds;
|
|
11144
11249
|
}
|
|
11145
11250
|
canvas.save();
|
|
11146
|
-
|
|
11251
|
+
if (isFrame && fill !== undefined) {
|
|
11252
|
+
const oldFill = leaf.get('fill');
|
|
11253
|
+
leaf.fill = '';
|
|
11254
|
+
leaf.__render(canvas, renderOptions);
|
|
11255
|
+
leaf.fill = oldFill;
|
|
11256
|
+
}
|
|
11257
|
+
else {
|
|
11258
|
+
leaf.__render(canvas, renderOptions);
|
|
11259
|
+
}
|
|
11147
11260
|
canvas.restore();
|
|
11148
11261
|
if (trim) {
|
|
11149
11262
|
trimBounds = getTrimBounds(canvas);
|
|
@@ -11154,6 +11267,8 @@ const ExportModule = {
|
|
|
11154
11267
|
}
|
|
11155
11268
|
if (needFill)
|
|
11156
11269
|
canvas.fillWorld(canvas.bounds, fill || '#FFFFFF', 'destination-over');
|
|
11270
|
+
if (onCanvas)
|
|
11271
|
+
onCanvas(canvas);
|
|
11157
11272
|
const data = filename === 'canvas' ? canvas : yield canvas.export(filename, options);
|
|
11158
11273
|
over({ data, width: canvas.pixelWidth, height: canvas.pixelHeight, renderBounds, trimBounds });
|
|
11159
11274
|
}));
|
|
@@ -11221,4 +11336,4 @@ LeaferCanvas.prototype.updateViewSize = function () {
|
|
|
11221
11336
|
}
|
|
11222
11337
|
};
|
|
11223
11338
|
|
|
11224
|
-
export { AnimateEvent, Answer, App, AroundHelper,
|
|
11339
|
+
export { AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, arrowType, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, useCanvas, useModule };
|