@leafer/core 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/lib/core.cjs +114 -62
- package/lib/core.esm.js +111 -63
- package/lib/core.esm.min.js +1 -1
- package/lib/core.min.cjs +1 -1
- package/package.json +18 -18
package/lib/core.esm.js
CHANGED
|
@@ -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$6(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$6(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$6(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$2(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$2(r) * distance;
|
|
508
|
+
to.y = t.y + sin$2(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$6, 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);
|
|
@@ -711,7 +719,7 @@ const TwoPointBoundsHelper = {
|
|
|
711
719
|
};
|
|
712
720
|
const { addPoint: addPoint$3 } = TwoPointBoundsHelper;
|
|
713
721
|
|
|
714
|
-
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$
|
|
722
|
+
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2 } = TwoPointBoundsHelper;
|
|
715
723
|
const { toOuterPoint: toOuterPoint$1 } = MatrixHelper;
|
|
716
724
|
const { float } = MathHelper;
|
|
717
725
|
const { floor, ceil: ceil$1 } = Math;
|
|
@@ -822,7 +830,7 @@ const BoundsHelper = {
|
|
|
822
830
|
point.x = t.x;
|
|
823
831
|
toOuterPoint$1(matrix, point, toPoint$1);
|
|
824
832
|
addPoint$2(tempPointBounds$1, toPoint$1.x, toPoint$1.y);
|
|
825
|
-
toBounds$
|
|
833
|
+
toBounds$2(tempPointBounds$1, to);
|
|
826
834
|
}
|
|
827
835
|
},
|
|
828
836
|
toInnerOf(t, matrix, to) {
|
|
@@ -906,7 +914,7 @@ const BoundsHelper = {
|
|
|
906
914
|
},
|
|
907
915
|
setPoints(t, points) {
|
|
908
916
|
points.forEach((point, index) => index === 0 ? setPoint$2(tempPointBounds$1, point.x, point.y) : addPoint$2(tempPointBounds$1, point.x, point.y));
|
|
909
|
-
toBounds$
|
|
917
|
+
toBounds$2(tempPointBounds$1, t);
|
|
910
918
|
},
|
|
911
919
|
getPoints(t) {
|
|
912
920
|
const { x, y, width, height } = t;
|
|
@@ -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 {
|
|
|
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;
|
|
@@ -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$2(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$2, arc: arc$2 } = PathCommandDataHelper;
|
|
|
2810
2815
|
|
|
2811
2816
|
const { moveTo, lineTo, quadraticCurveTo, bezierCurveTo, closePath, beginPath, rect, roundRect: roundRect$1, ellipse: ellipse$1, arc: arc$1, arcTo: arcTo$2, drawEllipse, drawArc, drawPoints } = 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(this.
|
|
2833
|
+
moveTo(this.__path, x, y);
|
|
2827
2834
|
return this;
|
|
2828
2835
|
}
|
|
2829
2836
|
lineTo(x, y) {
|
|
2830
|
-
lineTo(this.
|
|
2837
|
+
lineTo(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(this.
|
|
2849
|
+
closePath(this.__path);
|
|
2843
2850
|
return this;
|
|
2844
2851
|
}
|
|
2845
2852
|
rect(x, y, width, height) {
|
|
2846
|
-
rect(this.
|
|
2853
|
+
rect(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$1(this.
|
|
2861
|
+
ellipse$1(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(this.
|
|
2881
|
+
drawPoints(this.__path, points, curve, close);
|
|
2875
2882
|
return this;
|
|
2876
2883
|
}
|
|
2877
2884
|
}
|
|
@@ -2949,7 +2956,7 @@ const PathDrawer = {
|
|
|
2949
2956
|
|
|
2950
2957
|
const { M: M$1, L: L$2, C: C$1, Q, Z: Z$1, N, D, X, G, F, O, P, U } = PathCommandMap;
|
|
2951
2958
|
const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse } = BezierHelper;
|
|
2952
|
-
const { addPointBounds, copy: copy$3, addPoint, setPoint, addBounds, toBounds } = TwoPointBoundsHelper;
|
|
2959
|
+
const { addPointBounds, copy: copy$3, addPoint, setPoint, addBounds, toBounds: toBounds$1 } = TwoPointBoundsHelper;
|
|
2953
2960
|
const debug$2 = Debug.get('PathBounds');
|
|
2954
2961
|
let radius, radiusX, radiusY;
|
|
2955
2962
|
const tempPointBounds = {};
|
|
@@ -2958,7 +2965,7 @@ const setEndPoint = {};
|
|
|
2958
2965
|
const PathBounds = {
|
|
2959
2966
|
toBounds(data, setBounds) {
|
|
2960
2967
|
PathBounds.toTwoPointBounds(data, setPointBounds);
|
|
2961
|
-
toBounds(setPointBounds, setBounds);
|
|
2968
|
+
toBounds$1(setPointBounds, setBounds);
|
|
2962
2969
|
},
|
|
2963
2970
|
toTwoPointBounds(data, setPointBounds) {
|
|
2964
2971
|
if (!data || !data.length)
|
|
@@ -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, updateAllMatrix, hasParentAutoLayout } = LeafHelper;
|
|
4705
4742
|
const { updateBounds } = BranchHelper;
|
|
4706
4743
|
const { toOuterOf: toOuterOf$1, copyAndSpread } = BoundsHelper;
|
|
4744
|
+
const { toBounds } = 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(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;
|
|
@@ -5500,4 +5548,4 @@ class LeafLevelList {
|
|
|
5500
5548
|
}
|
|
5501
5549
|
}
|
|
5502
5550
|
|
|
5503
|
-
export { AnimateEvent, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Branch, BranchHelper, BranchRender, CanvasManager, ChildEvent, Creator, DataHelper, Debug, Direction4, Direction9, EllipseHelper, Event, EventCreator, FileHelper, ImageEvent, ImageManager, IncrementId, LayoutEvent, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, LeaferCanvasBase, LeaferEvent, LeaferImage, MathHelper, Matrix, MatrixHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Platform, Point, PointHelper, PropertyEvent, RectHelper, RenderEvent, ResizeEvent, Run, StringNumberMap, TaskItem, TaskProcessor, TwoPointBoundsHelper, UICreator, WaitHelper, WatchEvent, affectRenderBoundsType, affectStrokeBoundsType, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, defineDataProcessor, defineKey, defineLeafAttr, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, layoutProcessor, maskType, opacityType, pathType, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, useModule };
|
|
5551
|
+
export { AnimateEvent, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Branch, BranchHelper, BranchRender, CanvasManager, ChildEvent, Creator, DataHelper, Debug, Direction4, Direction9, EllipseHelper, Event, EventCreator, FileHelper, ImageEvent, ImageManager, IncrementId, LayoutEvent, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, LeaferCanvasBase, LeaferEvent, LeaferImage, MathHelper, Matrix, MatrixHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Platform, Point, PointHelper, PropertyEvent, RectHelper, RenderEvent, ResizeEvent, Run, StringNumberMap, TaskItem, TaskProcessor, TwoPointBoundsHelper, UICreator, WaitHelper, WatchEvent, affectRenderBoundsType, affectStrokeBoundsType, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, useModule };
|