@leafer-draw/worker 1.0.0-rc.23 → 1.0.0-rc.24
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 +38 -36
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.js +259 -194
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +258 -195
- package/dist/worker.module.min.js +1 -1
- package/package.json +6 -6
package/dist/worker.module.js
CHANGED
|
@@ -750,7 +750,7 @@ const { float, fourNumber } = MathHelper;
|
|
|
750
750
|
const { floor, ceil: ceil$2 } = Math;
|
|
751
751
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
752
752
|
const point = {};
|
|
753
|
-
const toPoint$
|
|
753
|
+
const toPoint$5 = {};
|
|
754
754
|
const BoundsHelper = {
|
|
755
755
|
tempBounds: {},
|
|
756
756
|
set(t, x = 0, y = 0, width = 0, height = 0) {
|
|
@@ -852,17 +852,17 @@ const BoundsHelper = {
|
|
|
852
852
|
else {
|
|
853
853
|
point.x = t.x;
|
|
854
854
|
point.y = t.y;
|
|
855
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
856
|
-
setPoint$3(tempPointBounds$1, toPoint$
|
|
855
|
+
toOuterPoint$1(matrix, point, toPoint$5);
|
|
856
|
+
setPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
857
857
|
point.x = t.x + t.width;
|
|
858
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
859
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
858
|
+
toOuterPoint$1(matrix, point, toPoint$5);
|
|
859
|
+
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
860
860
|
point.y = t.y + t.height;
|
|
861
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
862
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
861
|
+
toOuterPoint$1(matrix, point, toPoint$5);
|
|
862
|
+
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
863
863
|
point.x = t.x;
|
|
864
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
865
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
864
|
+
toOuterPoint$1(matrix, point, toPoint$5);
|
|
865
|
+
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
866
866
|
toBounds$4(tempPointBounds$1, to);
|
|
867
867
|
}
|
|
868
868
|
},
|
|
@@ -1235,10 +1235,10 @@ function get$5(around) {
|
|
|
1235
1235
|
return typeof around === 'string' ? directionData[Direction9[around]] : around;
|
|
1236
1236
|
}
|
|
1237
1237
|
|
|
1238
|
-
const { toPoint: toPoint$
|
|
1238
|
+
const { toPoint: toPoint$4 } = AroundHelper;
|
|
1239
1239
|
const AlignHelper = {
|
|
1240
1240
|
toPoint(align, contentBounds, bounds, to, onlySize) {
|
|
1241
|
-
toPoint$
|
|
1241
|
+
toPoint$4(align, bounds, to, onlySize, contentBounds);
|
|
1242
1242
|
}
|
|
1243
1243
|
};
|
|
1244
1244
|
|
|
@@ -1485,6 +1485,8 @@ const DataHelper = {
|
|
|
1485
1485
|
const { assign } = DataHelper;
|
|
1486
1486
|
|
|
1487
1487
|
class LeafData {
|
|
1488
|
+
get __useNaturalRatio() { return true; }
|
|
1489
|
+
get __isLinePath() { return this.path && this.path.length === 6; }
|
|
1488
1490
|
get __blendMode() {
|
|
1489
1491
|
if (this.eraser && this.eraser !== 'path')
|
|
1490
1492
|
return 'destination-out';
|
|
@@ -1982,6 +1984,11 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
1982
1984
|
}
|
|
1983
1985
|
updateViewSize() { }
|
|
1984
1986
|
updateClientBounds() { }
|
|
1987
|
+
getClientBounds(update) {
|
|
1988
|
+
if (update)
|
|
1989
|
+
this.updateClientBounds();
|
|
1990
|
+
return this.clientBounds || this.bounds;
|
|
1991
|
+
}
|
|
1985
1992
|
startAutoLayout(_autoBounds, _listener) { }
|
|
1986
1993
|
stopAutoLayout() { }
|
|
1987
1994
|
setCursor(_cursor) { }
|
|
@@ -2233,7 +2240,7 @@ const RectHelper = {
|
|
|
2233
2240
|
|
|
2234
2241
|
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
|
|
2235
2242
|
const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
|
|
2236
|
-
const { set
|
|
2243
|
+
const { set } = PointHelper;
|
|
2237
2244
|
const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
2238
2245
|
const tempPoint$2 = {};
|
|
2239
2246
|
const BezierHelper = {
|
|
@@ -2311,9 +2318,9 @@ const BezierHelper = {
|
|
|
2311
2318
|
addPoint$2(setPointBounds, x1, y1);
|
|
2312
2319
|
}
|
|
2313
2320
|
if (setStartPoint)
|
|
2314
|
-
set
|
|
2321
|
+
set(setStartPoint, fromX, fromY);
|
|
2315
2322
|
if (setEndPoint)
|
|
2316
|
-
set
|
|
2323
|
+
set(setEndPoint, x1, y1);
|
|
2317
2324
|
return;
|
|
2318
2325
|
}
|
|
2319
2326
|
const anticlockwise = BAx * CBy - CBx * BAy < 0;
|
|
@@ -2362,7 +2369,7 @@ const BezierHelper = {
|
|
|
2362
2369
|
if (setPointBounds)
|
|
2363
2370
|
setPoint$2(setPointBounds, fromX, fromY);
|
|
2364
2371
|
if (setStartPoint)
|
|
2365
|
-
set
|
|
2372
|
+
set(setStartPoint, fromX, fromY);
|
|
2366
2373
|
for (let i = 0; i < parts; i++) {
|
|
2367
2374
|
endCos = cos$3(endRadian);
|
|
2368
2375
|
endSin = sin$3(endRadian);
|
|
@@ -2384,7 +2391,7 @@ const BezierHelper = {
|
|
|
2384
2391
|
endRadian += partRadian;
|
|
2385
2392
|
}
|
|
2386
2393
|
if (setEndPoint)
|
|
2387
|
-
set
|
|
2394
|
+
set(setEndPoint, cx + x, cy + y);
|
|
2388
2395
|
},
|
|
2389
2396
|
quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
|
|
2390
2397
|
data.push(C$5, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
|
|
@@ -2530,11 +2537,15 @@ const PathConvert = {
|
|
|
2530
2537
|
char = pathString[i];
|
|
2531
2538
|
if (StringNumberMap[char]) {
|
|
2532
2539
|
if (char === '.') {
|
|
2533
|
-
current.dot
|
|
2534
|
-
if (current.dot > 1) {
|
|
2540
|
+
if (current.dot) {
|
|
2535
2541
|
pushData(data, num);
|
|
2536
2542
|
num = '';
|
|
2537
2543
|
}
|
|
2544
|
+
current.dot++;
|
|
2545
|
+
}
|
|
2546
|
+
if (num === '0' && char !== '.') {
|
|
2547
|
+
pushData(data, num);
|
|
2548
|
+
num = '';
|
|
2538
2549
|
}
|
|
2539
2550
|
num += char;
|
|
2540
2551
|
}
|
|
@@ -3624,7 +3635,9 @@ class LeaferImage {
|
|
|
3624
3635
|
}
|
|
3625
3636
|
}
|
|
3626
3637
|
|
|
3627
|
-
function defineKey(target, key, descriptor) {
|
|
3638
|
+
function defineKey(target, key, descriptor, noConfigurable) {
|
|
3639
|
+
if (!noConfigurable)
|
|
3640
|
+
descriptor.configurable = descriptor.enumerable = true;
|
|
3628
3641
|
Object.defineProperty(target, key, descriptor);
|
|
3629
3642
|
}
|
|
3630
3643
|
function getDescriptor(object, name) {
|
|
@@ -3643,9 +3656,7 @@ function attr(partDescriptor) {
|
|
|
3643
3656
|
function defineLeafAttr(target, key, defaultValue, partDescriptor) {
|
|
3644
3657
|
const defaultDescriptor = {
|
|
3645
3658
|
get() { return this.__getAttr(key); },
|
|
3646
|
-
set(value) { this.__setAttr(key, value); }
|
|
3647
|
-
configurable: true,
|
|
3648
|
-
enumerable: true
|
|
3659
|
+
set(value) { this.__setAttr(key, value); }
|
|
3649
3660
|
};
|
|
3650
3661
|
defineKey(target, key, Object.assign(defaultDescriptor, partDescriptor || {}));
|
|
3651
3662
|
defineDataProcessor(target, key, defaultValue);
|
|
@@ -3656,35 +3667,33 @@ function dataType(defaultValue) {
|
|
|
3656
3667
|
function positionType(defaultValue, checkFiniteNumber) {
|
|
3657
3668
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3658
3669
|
set(value) {
|
|
3659
|
-
this.__setAttr(key, value, checkFiniteNumber);
|
|
3660
|
-
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3670
|
+
this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.matrixChanged || this.__layout.matrixChange());
|
|
3661
3671
|
}
|
|
3662
3672
|
}));
|
|
3663
3673
|
}
|
|
3664
3674
|
function autoLayoutType(defaultValue) {
|
|
3665
3675
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3666
3676
|
set(value) {
|
|
3667
|
-
this.__setAttr(key, value)
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3677
|
+
if (this.__setAttr(key, value)) {
|
|
3678
|
+
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3679
|
+
this.__hasAutoLayout = !!value;
|
|
3680
|
+
if (!this.__local)
|
|
3681
|
+
this.__layout.createLocal();
|
|
3682
|
+
}
|
|
3672
3683
|
}
|
|
3673
3684
|
}));
|
|
3674
3685
|
}
|
|
3675
3686
|
function scaleType(defaultValue, checkFiniteNumber) {
|
|
3676
3687
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3677
3688
|
set(value) {
|
|
3678
|
-
this.__setAttr(key, value, checkFiniteNumber);
|
|
3679
|
-
this.__layout.scaleChanged || this.__layout.scaleChange();
|
|
3689
|
+
this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.scaleChanged || this.__layout.scaleChange());
|
|
3680
3690
|
}
|
|
3681
3691
|
}));
|
|
3682
3692
|
}
|
|
3683
3693
|
function rotationType(defaultValue, checkFiniteNumber) {
|
|
3684
3694
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3685
3695
|
set(value) {
|
|
3686
|
-
this.__setAttr(key, value, checkFiniteNumber);
|
|
3687
|
-
this.__layout.rotationChanged || this.__layout.rotationChange();
|
|
3696
|
+
this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.rotationChanged || this.__layout.rotationChange());
|
|
3688
3697
|
}
|
|
3689
3698
|
}));
|
|
3690
3699
|
}
|
|
@@ -3698,9 +3707,7 @@ function boundsType(defaultValue, checkFiniteNumber) {
|
|
|
3698
3707
|
function naturalBoundsType(defaultValue) {
|
|
3699
3708
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3700
3709
|
set(value) {
|
|
3701
|
-
this.__setAttr(key, value);
|
|
3702
|
-
doBoundsType(this);
|
|
3703
|
-
this.__.__removeNaturalSize();
|
|
3710
|
+
this.__setAttr(key, value) && (doBoundsType(this), this.__.__removeNaturalSize());
|
|
3704
3711
|
}
|
|
3705
3712
|
}));
|
|
3706
3713
|
}
|
|
@@ -3712,8 +3719,11 @@ function doBoundsType(leaf) {
|
|
|
3712
3719
|
function pathInputType(defaultValue) {
|
|
3713
3720
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3714
3721
|
set(value) {
|
|
3715
|
-
|
|
3716
|
-
|
|
3722
|
+
const data = this.__;
|
|
3723
|
+
if (data.__pathInputed !== 2)
|
|
3724
|
+
data.__pathInputed = value ? 1 : 0;
|
|
3725
|
+
if (!value)
|
|
3726
|
+
data.__pathForRender = undefined;
|
|
3717
3727
|
this.__setAttr(key, value);
|
|
3718
3728
|
doBoundsType(this);
|
|
3719
3729
|
}
|
|
@@ -3744,56 +3754,66 @@ function affectRenderBoundsType(defaultValue) {
|
|
|
3744
3754
|
function surfaceType(defaultValue) {
|
|
3745
3755
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3746
3756
|
set(value) {
|
|
3747
|
-
this.__setAttr(key, value);
|
|
3748
|
-
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
3757
|
+
this.__setAttr(key, value) && (this.__layout.surfaceChanged || this.__layout.surfaceChange());
|
|
3749
3758
|
}
|
|
3750
3759
|
}));
|
|
3751
3760
|
}
|
|
3752
3761
|
function opacityType(defaultValue) {
|
|
3753
3762
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3754
3763
|
set(value) {
|
|
3755
|
-
this.__setAttr(key, value);
|
|
3756
|
-
|
|
3764
|
+
this.__setAttr(key, value) && (this.__layout.opacityChanged || this.__layout.opacityChange());
|
|
3765
|
+
}
|
|
3766
|
+
}));
|
|
3767
|
+
}
|
|
3768
|
+
function visibleType(defaultValue) {
|
|
3769
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3770
|
+
set(value) {
|
|
3771
|
+
const oldValue = this.visible;
|
|
3772
|
+
if (this.__setAttr(key, value)) {
|
|
3773
|
+
this.__layout.opacityChanged || this.__layout.opacityChange();
|
|
3774
|
+
if (oldValue === 0 || value === 0)
|
|
3775
|
+
doBoundsType(this);
|
|
3776
|
+
}
|
|
3757
3777
|
}
|
|
3758
3778
|
}));
|
|
3759
3779
|
}
|
|
3760
3780
|
function sortType(defaultValue) {
|
|
3761
3781
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3762
3782
|
set(value) {
|
|
3763
|
-
this.__setAttr(key, value)
|
|
3764
|
-
|
|
3765
|
-
|
|
3783
|
+
if (this.__setAttr(key, value)) {
|
|
3784
|
+
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
3785
|
+
this.waitParent(() => { this.parent.__layout.childrenSortChange(); });
|
|
3786
|
+
}
|
|
3766
3787
|
}
|
|
3767
3788
|
}));
|
|
3768
3789
|
}
|
|
3769
3790
|
function maskType(defaultValue) {
|
|
3770
3791
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3771
3792
|
set(value) {
|
|
3772
|
-
this.__setAttr(key, value)
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
this.maskType = value;
|
|
3793
|
+
if (this.__setAttr(key, value)) {
|
|
3794
|
+
this.__layout.boxChanged || this.__layout.boxChange();
|
|
3795
|
+
this.waitParent(() => { this.parent.__updateMask(value); });
|
|
3796
|
+
}
|
|
3777
3797
|
}
|
|
3778
3798
|
}));
|
|
3779
3799
|
}
|
|
3780
3800
|
function eraserType(defaultValue) {
|
|
3781
3801
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3782
3802
|
set(value) {
|
|
3783
|
-
this.__setAttr(key, value);
|
|
3784
|
-
this.waitParent(() => { this.parent.__updateEraser(value); });
|
|
3803
|
+
this.__setAttr(key, value) && this.waitParent(() => { this.parent.__updateEraser(value); });
|
|
3785
3804
|
}
|
|
3786
3805
|
}));
|
|
3787
3806
|
}
|
|
3788
3807
|
function hitType(defaultValue) {
|
|
3789
3808
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3790
3809
|
set(value) {
|
|
3791
|
-
this.__setAttr(key, value)
|
|
3792
|
-
|
|
3793
|
-
|
|
3810
|
+
if (this.__setAttr(key, value)) {
|
|
3811
|
+
if (Debug.showHitView) {
|
|
3812
|
+
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
3813
|
+
}
|
|
3814
|
+
if (this.leafer)
|
|
3815
|
+
this.leafer.updateCursor();
|
|
3794
3816
|
}
|
|
3795
|
-
if (this.leafer)
|
|
3796
|
-
this.leafer.updateCursor();
|
|
3797
3817
|
}
|
|
3798
3818
|
}));
|
|
3799
3819
|
}
|
|
@@ -3834,9 +3854,7 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
3834
3854
|
},
|
|
3835
3855
|
set(value) {
|
|
3836
3856
|
this[computedKey] = value;
|
|
3837
|
-
}
|
|
3838
|
-
configurable: true,
|
|
3839
|
-
enumerable: true
|
|
3857
|
+
}
|
|
3840
3858
|
};
|
|
3841
3859
|
if (defaultValue === undefined) {
|
|
3842
3860
|
property.get = function () { return this[computedKey]; };
|
|
@@ -3844,13 +3862,25 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
3844
3862
|
else if (key === 'width') {
|
|
3845
3863
|
property.get = function () {
|
|
3846
3864
|
const v = this[computedKey];
|
|
3847
|
-
|
|
3865
|
+
if (v === undefined) {
|
|
3866
|
+
const t = this;
|
|
3867
|
+
return t._height && t.__naturalWidth && t.__useNaturalRatio ? t._height * t.__naturalWidth / t.__naturalHeight : t.__naturalWidth || defaultValue;
|
|
3868
|
+
}
|
|
3869
|
+
else {
|
|
3870
|
+
return v;
|
|
3871
|
+
}
|
|
3848
3872
|
};
|
|
3849
3873
|
}
|
|
3850
3874
|
else if (key === 'height') {
|
|
3851
3875
|
property.get = function () {
|
|
3852
3876
|
const v = this[computedKey];
|
|
3853
|
-
|
|
3877
|
+
if (v === undefined) {
|
|
3878
|
+
const t = this;
|
|
3879
|
+
return t._width && t.__naturalHeight && t.__useNaturalRatio ? t._width * t.__naturalHeight / t.__naturalWidth : t.__naturalHeight || defaultValue;
|
|
3880
|
+
}
|
|
3881
|
+
else {
|
|
3882
|
+
return v;
|
|
3883
|
+
}
|
|
3854
3884
|
};
|
|
3855
3885
|
}
|
|
3856
3886
|
let descriptor, find = data;
|
|
@@ -3864,7 +3894,7 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
3864
3894
|
property.set = data[setMethodName];
|
|
3865
3895
|
delete data[setMethodName];
|
|
3866
3896
|
}
|
|
3867
|
-
|
|
3897
|
+
defineKey(data, key, property);
|
|
3868
3898
|
}
|
|
3869
3899
|
|
|
3870
3900
|
const debug$6 = new Debug('rewrite');
|
|
@@ -4065,13 +4095,6 @@ const LeafHelper = {
|
|
|
4065
4095
|
return true;
|
|
4066
4096
|
p = p.parent;
|
|
4067
4097
|
}
|
|
4068
|
-
},
|
|
4069
|
-
hasParentAutoLayout(p) {
|
|
4070
|
-
while (p.parent) {
|
|
4071
|
-
p = p.parent;
|
|
4072
|
-
if (p.__hasAutoLayout)
|
|
4073
|
-
return true;
|
|
4074
|
-
}
|
|
4075
4098
|
}
|
|
4076
4099
|
};
|
|
4077
4100
|
const L = LeafHelper;
|
|
@@ -4091,13 +4114,13 @@ const LeafBoundsHelper = {
|
|
|
4091
4114
|
return target.__world;
|
|
4092
4115
|
},
|
|
4093
4116
|
localBoxBounds(target) {
|
|
4094
|
-
return target.__.eraser ? null : (target.__local || target.__layout);
|
|
4117
|
+
return target.__.eraser || target.__.visible === 0 ? null : (target.__local || target.__layout);
|
|
4095
4118
|
},
|
|
4096
4119
|
localStrokeBounds(target) {
|
|
4097
|
-
return target.__.eraser ? null : target.__layout.localStrokeBounds;
|
|
4120
|
+
return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
|
|
4098
4121
|
},
|
|
4099
4122
|
localRenderBounds(target) {
|
|
4100
|
-
return target.__.eraser ? null : target.__layout.localRenderBounds;
|
|
4123
|
+
return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localRenderBounds;
|
|
4101
4124
|
},
|
|
4102
4125
|
maskLocalBoxBounds(target) {
|
|
4103
4126
|
return target.__.mask ? target.__localBoxBounds : null;
|
|
@@ -4803,7 +4826,7 @@ const LeafDataProxy = {
|
|
|
4803
4826
|
};
|
|
4804
4827
|
|
|
4805
4828
|
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
4806
|
-
const { toPoint, tempPoint: tempPoint$1 } = AroundHelper;
|
|
4829
|
+
const { toPoint: toPoint$3, tempPoint: tempPoint$1 } = AroundHelper;
|
|
4807
4830
|
const LeafMatrix = {
|
|
4808
4831
|
__updateWorldMatrix() {
|
|
4809
4832
|
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
|
|
@@ -4820,7 +4843,7 @@ const LeafMatrix = {
|
|
|
4820
4843
|
local.e = data.x + data.offsetX;
|
|
4821
4844
|
local.f = data.y + data.offsetY;
|
|
4822
4845
|
if (data.around || data.origin) {
|
|
4823
|
-
toPoint(data.around || data.origin, layout.boxBounds, tempPoint$1);
|
|
4846
|
+
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$1);
|
|
4824
4847
|
translateInner(local, -tempPoint$1.x, -tempPoint$1.y, data.origin);
|
|
4825
4848
|
}
|
|
4826
4849
|
}
|
|
@@ -4828,7 +4851,7 @@ const LeafMatrix = {
|
|
|
4828
4851
|
}
|
|
4829
4852
|
};
|
|
4830
4853
|
|
|
4831
|
-
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2
|
|
4854
|
+
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
|
|
4832
4855
|
const { updateBounds: updateBounds$1 } = BranchHelper;
|
|
4833
4856
|
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4 } = BoundsHelper;
|
|
4834
4857
|
const { toBounds: toBounds$2 } = PathBounds;
|
|
@@ -4847,7 +4870,6 @@ const LeafBounds = {
|
|
|
4847
4870
|
this.__updatePath();
|
|
4848
4871
|
this.__updateRenderPath();
|
|
4849
4872
|
this.__updateBoxBounds();
|
|
4850
|
-
layout.boxChanged = false;
|
|
4851
4873
|
layout.resized = true;
|
|
4852
4874
|
}
|
|
4853
4875
|
if (layout.localBoxChanged) {
|
|
@@ -4861,12 +4883,12 @@ const LeafBounds = {
|
|
|
4861
4883
|
if (this.parent)
|
|
4862
4884
|
this.parent.__layout.boxChange();
|
|
4863
4885
|
}
|
|
4886
|
+
layout.boxChanged = false;
|
|
4864
4887
|
if (layout.strokeChanged) {
|
|
4865
4888
|
layout.strokeSpread = this.__updateStrokeSpread();
|
|
4866
4889
|
if (layout.strokeSpread) {
|
|
4867
|
-
if (layout.strokeBounds === layout.boxBounds)
|
|
4890
|
+
if (layout.strokeBounds === layout.boxBounds)
|
|
4868
4891
|
layout.spreadStroke();
|
|
4869
|
-
}
|
|
4870
4892
|
this.__updateStrokeBounds();
|
|
4871
4893
|
this.__updateLocalStrokeBounds();
|
|
4872
4894
|
}
|
|
@@ -4874,7 +4896,7 @@ const LeafBounds = {
|
|
|
4874
4896
|
layout.spreadStrokeCancel();
|
|
4875
4897
|
}
|
|
4876
4898
|
layout.strokeChanged = false;
|
|
4877
|
-
if (layout.renderSpread)
|
|
4899
|
+
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
|
|
4878
4900
|
layout.renderChanged = true;
|
|
4879
4901
|
if (this.parent)
|
|
4880
4902
|
this.parent.__layout.strokeChange();
|
|
@@ -4883,9 +4905,8 @@ const LeafBounds = {
|
|
|
4883
4905
|
if (layout.renderChanged) {
|
|
4884
4906
|
layout.renderSpread = this.__updateRenderSpread();
|
|
4885
4907
|
if (layout.renderSpread) {
|
|
4886
|
-
if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds)
|
|
4908
|
+
if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds)
|
|
4887
4909
|
layout.spreadRender();
|
|
4888
|
-
}
|
|
4889
4910
|
this.__updateRenderBounds();
|
|
4890
4911
|
this.__updateLocalRenderBounds();
|
|
4891
4912
|
}
|
|
@@ -4925,12 +4946,15 @@ const LeafBounds = {
|
|
|
4925
4946
|
__updateAutoLayout() {
|
|
4926
4947
|
this.__layout.matrixChanged = true;
|
|
4927
4948
|
if (this.isBranch) {
|
|
4928
|
-
if (this.leafer)
|
|
4949
|
+
if (this.leafer && this.leafer.ready)
|
|
4929
4950
|
this.leafer.layouter.addExtra(this);
|
|
4930
|
-
if (this.__.flow)
|
|
4931
|
-
this.
|
|
4932
|
-
|
|
4933
|
-
|
|
4951
|
+
if (this.__.flow) {
|
|
4952
|
+
if (this.__layout.boxChanged)
|
|
4953
|
+
this.__updateFlowLayout();
|
|
4954
|
+
updateAllMatrix$2(this);
|
|
4955
|
+
updateBounds$1(this, this);
|
|
4956
|
+
if (this.__.__autoSide)
|
|
4957
|
+
this.__updateBoxBounds();
|
|
4934
4958
|
}
|
|
4935
4959
|
else {
|
|
4936
4960
|
updateAllMatrix$2(this);
|
|
@@ -4947,12 +4971,13 @@ const LeafBounds = {
|
|
|
4947
4971
|
data.__naturalHeight = layout.boxBounds.height;
|
|
4948
4972
|
},
|
|
4949
4973
|
__updateStrokeBounds() {
|
|
4950
|
-
|
|
4974
|
+
const layout = this.__layout;
|
|
4975
|
+
copyAndSpread$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
4951
4976
|
},
|
|
4952
4977
|
__updateRenderBounds() {
|
|
4953
|
-
const
|
|
4954
|
-
renderSpread > 0 ? copyAndSpread$1(renderBounds,
|
|
4955
|
-
}
|
|
4978
|
+
const layout = this.__layout;
|
|
4979
|
+
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$4(layout.renderBounds, layout.strokeBounds);
|
|
4980
|
+
}
|
|
4956
4981
|
};
|
|
4957
4982
|
|
|
4958
4983
|
const LeafRender = {
|
|
@@ -5072,7 +5097,7 @@ let Leaf = class Leaf {
|
|
|
5072
5097
|
get __worldFlipped() { return this.__world.scaleX < 0 || this.__world.scaleY < 0; }
|
|
5073
5098
|
get __onlyHitMask() { return this.__hasMask && !this.__.hitChildren; }
|
|
5074
5099
|
get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
|
|
5075
|
-
get pathInputed() { return
|
|
5100
|
+
get pathInputed() { return this.__.__pathInputed; }
|
|
5076
5101
|
constructor(data) {
|
|
5077
5102
|
this.innerId = create(LEAF);
|
|
5078
5103
|
this.reset(data);
|
|
@@ -5684,6 +5709,9 @@ class LeafLevelList {
|
|
|
5684
5709
|
}
|
|
5685
5710
|
}
|
|
5686
5711
|
|
|
5712
|
+
const version = "1.0.0-rc.24";
|
|
5713
|
+
const inviteCode = {};
|
|
5714
|
+
|
|
5687
5715
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5688
5716
|
get allowBackgroundColor() { return true; }
|
|
5689
5717
|
init() {
|
|
@@ -6225,7 +6253,7 @@ class Renderer {
|
|
|
6225
6253
|
canvas.clear();
|
|
6226
6254
|
}
|
|
6227
6255
|
else {
|
|
6228
|
-
bounds.spread(
|
|
6256
|
+
bounds.spread(10 + 1 / this.canvas.pixelRatio).ceil();
|
|
6229
6257
|
canvas.clearWorld(bounds, true);
|
|
6230
6258
|
canvas.clipWorld(bounds, true);
|
|
6231
6259
|
}
|
|
@@ -6375,10 +6403,11 @@ function stateType(defaultValue) {
|
|
|
6375
6403
|
function arrowType(defaultValue) {
|
|
6376
6404
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6377
6405
|
set(value) {
|
|
6378
|
-
this.__setAttr(key, value)
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6406
|
+
if (this.__setAttr(key, value)) {
|
|
6407
|
+
const data = this.__;
|
|
6408
|
+
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
6409
|
+
doStrokeType(this);
|
|
6410
|
+
}
|
|
6382
6411
|
}
|
|
6383
6412
|
}));
|
|
6384
6413
|
}
|
|
@@ -6551,7 +6580,7 @@ class UIData extends LeafData {
|
|
|
6551
6580
|
const UnitConvert = {
|
|
6552
6581
|
number(value, percentRefer) {
|
|
6553
6582
|
if (typeof value === 'object')
|
|
6554
|
-
return value.type === 'percent' ?
|
|
6583
|
+
return value.type === 'percent' ? value.value * percentRefer : value.value;
|
|
6555
6584
|
return value;
|
|
6556
6585
|
}
|
|
6557
6586
|
};
|
|
@@ -6560,7 +6589,7 @@ class GroupData extends UIData {
|
|
|
6560
6589
|
}
|
|
6561
6590
|
|
|
6562
6591
|
class BoxData extends GroupData {
|
|
6563
|
-
get __boxStroke() { return
|
|
6592
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
6564
6593
|
}
|
|
6565
6594
|
|
|
6566
6595
|
class LeaferData extends GroupData {
|
|
@@ -6573,11 +6602,11 @@ class LineData extends UIData {
|
|
|
6573
6602
|
}
|
|
6574
6603
|
|
|
6575
6604
|
class RectData extends UIData {
|
|
6576
|
-
get __boxStroke() { return
|
|
6605
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
6577
6606
|
}
|
|
6578
6607
|
|
|
6579
6608
|
class EllipseData extends UIData {
|
|
6580
|
-
get __boxStroke() { return
|
|
6609
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
6581
6610
|
}
|
|
6582
6611
|
|
|
6583
6612
|
class PolygonData extends UIData {
|
|
@@ -6604,6 +6633,7 @@ const fontWeightMap = {
|
|
|
6604
6633
|
'black': 900
|
|
6605
6634
|
};
|
|
6606
6635
|
class TextData extends UIData {
|
|
6636
|
+
get __useNaturalRatio() { return false; }
|
|
6607
6637
|
setFontWeight(value) {
|
|
6608
6638
|
if (typeof value === 'string') {
|
|
6609
6639
|
this.__setInput('fontWeight', value);
|
|
@@ -6645,19 +6675,18 @@ class CanvasData extends RectData {
|
|
|
6645
6675
|
const UIBounds = {
|
|
6646
6676
|
__updateStrokeSpread() {
|
|
6647
6677
|
let width = 0, boxWidth = 0;
|
|
6648
|
-
const
|
|
6649
|
-
if ((stroke || hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
6678
|
+
const data = this.__, { strokeAlign, strokeWidth } = data;
|
|
6679
|
+
if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
6650
6680
|
boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
|
|
6651
|
-
if (!
|
|
6652
|
-
const
|
|
6653
|
-
const
|
|
6654
|
-
const storkeCapAddWidth = strokeCap === 'none' ? 0 : strokeWidth;
|
|
6681
|
+
if (!data.__boxStroke) {
|
|
6682
|
+
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * width;
|
|
6683
|
+
const storkeCapAddWidth = data.strokeCap === 'none' ? 0 : strokeWidth;
|
|
6655
6684
|
width += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
6656
6685
|
}
|
|
6657
6686
|
}
|
|
6658
|
-
|
|
6659
|
-
if (this.__.__useArrow)
|
|
6687
|
+
if (data.__useArrow)
|
|
6660
6688
|
width += strokeWidth * 5;
|
|
6689
|
+
this.__layout.strokeBoxSpread = boxWidth;
|
|
6661
6690
|
return width;
|
|
6662
6691
|
},
|
|
6663
6692
|
__updateRenderSpread() {
|
|
@@ -6677,7 +6706,7 @@ const UIBounds = {
|
|
|
6677
6706
|
if (backgroundBlur)
|
|
6678
6707
|
shapeWidth = Math.max(shapeWidth, backgroundBlur);
|
|
6679
6708
|
this.__layout.renderShapeSpread = shapeWidth;
|
|
6680
|
-
return width;
|
|
6709
|
+
return width + (this.__layout.strokeSpread || 0);
|
|
6681
6710
|
}
|
|
6682
6711
|
};
|
|
6683
6712
|
|
|
@@ -6768,7 +6797,7 @@ function drawFast(ui, canvas, options) {
|
|
|
6768
6797
|
|
|
6769
6798
|
const RectRender = {
|
|
6770
6799
|
__drawFast(canvas, options) {
|
|
6771
|
-
|
|
6800
|
+
let { width, height, fill, stroke, __drawAfterFill } = this.__;
|
|
6772
6801
|
if (fill) {
|
|
6773
6802
|
canvas.fillStyle = fill;
|
|
6774
6803
|
canvas.fillRect(0, 0, width, height);
|
|
@@ -6786,7 +6815,16 @@ const RectRender = {
|
|
|
6786
6815
|
canvas.strokeRect(0, 0, width, height);
|
|
6787
6816
|
break;
|
|
6788
6817
|
case 'inside':
|
|
6789
|
-
|
|
6818
|
+
width -= __strokeWidth, height -= __strokeWidth;
|
|
6819
|
+
if (width < 0 || height < 0) {
|
|
6820
|
+
canvas.save();
|
|
6821
|
+
this.__clip(canvas, options);
|
|
6822
|
+
canvas.strokeRect(half, half, width, height);
|
|
6823
|
+
canvas.restore();
|
|
6824
|
+
}
|
|
6825
|
+
else {
|
|
6826
|
+
canvas.strokeRect(half, half, width, height);
|
|
6827
|
+
}
|
|
6790
6828
|
break;
|
|
6791
6829
|
case 'outside':
|
|
6792
6830
|
canvas.strokeRect(-half, -half, width + __strokeWidth, height + __strokeWidth);
|
|
@@ -6814,11 +6852,14 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
6814
6852
|
return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
|
|
6815
6853
|
}
|
|
6816
6854
|
get pen() {
|
|
6817
|
-
|
|
6855
|
+
const { path } = this.__;
|
|
6856
|
+
pen.set(this.path = path || []);
|
|
6857
|
+
if (!path)
|
|
6858
|
+
this.__drawPathByBox(pen);
|
|
6818
6859
|
return pen;
|
|
6819
6860
|
}
|
|
6820
6861
|
get editConfig() { return undefined; }
|
|
6821
|
-
get editOuter() { return 'EditTool'; }
|
|
6862
|
+
get editOuter() { return this.__.__isLinePath ? 'LineEditTool' : 'EditTool'; }
|
|
6822
6863
|
get editInner() { return 'PathEditor'; }
|
|
6823
6864
|
constructor(data) {
|
|
6824
6865
|
super(data);
|
|
@@ -6838,18 +6879,16 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
6838
6879
|
getPath(curve, pathForRender) {
|
|
6839
6880
|
this.__layout.update();
|
|
6840
6881
|
let path = pathForRender ? this.__.__pathForRender : this.__.path;
|
|
6841
|
-
if (!path)
|
|
6842
|
-
|
|
6843
|
-
if (width || height) {
|
|
6844
|
-
pen.set(path = []);
|
|
6845
|
-
this.__drawPathByBox(pen);
|
|
6846
|
-
}
|
|
6847
|
-
}
|
|
6882
|
+
if (!path)
|
|
6883
|
+
pen.set(path = []), this.__drawPathByBox(pen);
|
|
6848
6884
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
6849
6885
|
}
|
|
6850
6886
|
getPathString(curve, pathForRender) {
|
|
6851
6887
|
return PathConvert.stringify(this.getPath(curve, pathForRender));
|
|
6852
6888
|
}
|
|
6889
|
+
load() {
|
|
6890
|
+
this.__.__computePaint();
|
|
6891
|
+
}
|
|
6853
6892
|
__onUpdateSize() {
|
|
6854
6893
|
if (this.__.__input) {
|
|
6855
6894
|
const data = this.__;
|
|
@@ -6935,7 +6974,7 @@ __decorate([
|
|
|
6935
6974
|
opacityType(1)
|
|
6936
6975
|
], UI.prototype, "opacity", void 0);
|
|
6937
6976
|
__decorate([
|
|
6938
|
-
|
|
6977
|
+
visibleType(true)
|
|
6939
6978
|
], UI.prototype, "visible", void 0);
|
|
6940
6979
|
__decorate([
|
|
6941
6980
|
stateType(false)
|
|
@@ -6952,9 +6991,6 @@ __decorate([
|
|
|
6952
6991
|
__decorate([
|
|
6953
6992
|
maskType(false)
|
|
6954
6993
|
], UI.prototype, "mask", void 0);
|
|
6955
|
-
__decorate([
|
|
6956
|
-
surfaceType('pixel')
|
|
6957
|
-
], UI.prototype, "maskType", void 0);
|
|
6958
6994
|
__decorate([
|
|
6959
6995
|
eraserType(false)
|
|
6960
6996
|
], UI.prototype, "eraser", void 0);
|
|
@@ -7247,6 +7283,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7247
7283
|
get layoutLocked() { return !this.layouter.running; }
|
|
7248
7284
|
get FPS() { return this.renderer ? this.renderer.FPS : 60; }
|
|
7249
7285
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
7286
|
+
get clientBounds() { return this.canvas && this.canvas.getClientBounds(); }
|
|
7250
7287
|
constructor(userConfig, data) {
|
|
7251
7288
|
super(data);
|
|
7252
7289
|
this.config = {
|
|
@@ -7404,7 +7441,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7404
7441
|
this.__changeFill(newValue);
|
|
7405
7442
|
}
|
|
7406
7443
|
else if (attrName === 'hittable') {
|
|
7407
|
-
this.
|
|
7444
|
+
if (!this.parent)
|
|
7445
|
+
this.canvas.hittable = newValue;
|
|
7408
7446
|
}
|
|
7409
7447
|
}
|
|
7410
7448
|
return super.__setAttr(attrName, newValue);
|
|
@@ -7522,6 +7560,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7522
7560
|
zoom(_zoomType, _padding, _fixedScale) { return undefined; }
|
|
7523
7561
|
getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
|
|
7524
7562
|
getValidScale(changeScale) { return changeScale; }
|
|
7563
|
+
getWorldPointByClient(clientPoint, updateClient) {
|
|
7564
|
+
return this.interaction && this.interaction.getLocal(clientPoint, updateClient);
|
|
7565
|
+
}
|
|
7525
7566
|
__checkUpdateLayout() {
|
|
7526
7567
|
this.__layout.update();
|
|
7527
7568
|
}
|
|
@@ -7604,8 +7645,8 @@ Rect = __decorate([
|
|
|
7604
7645
|
|
|
7605
7646
|
const rect = Rect.prototype;
|
|
7606
7647
|
const group = Group.prototype;
|
|
7607
|
-
const
|
|
7608
|
-
const { copy: copy$2, add } = BoundsHelper;
|
|
7648
|
+
const childrenRenderBounds = {};
|
|
7649
|
+
const { copy: copy$2, add, includes: includes$1 } = BoundsHelper;
|
|
7609
7650
|
let Box = class Box extends Group {
|
|
7610
7651
|
get __tag() { return 'Box'; }
|
|
7611
7652
|
get isBranchLeaf() { return true; }
|
|
@@ -7616,40 +7657,50 @@ let Box = class Box extends Group {
|
|
|
7616
7657
|
__updateStrokeSpread() { return 0; }
|
|
7617
7658
|
__updateRectRenderSpread() { return 0; }
|
|
7618
7659
|
__updateRenderSpread() {
|
|
7619
|
-
|
|
7620
|
-
const hide = this.__.__drawAfterFill = this.__.overflow === 'hide';
|
|
7621
|
-
return (width || hide) ? width : -1;
|
|
7660
|
+
return this.__updateRectRenderSpread() || -1;
|
|
7622
7661
|
}
|
|
7623
7662
|
__updateRectBoxBounds() { }
|
|
7624
7663
|
__updateBoxBounds() {
|
|
7625
7664
|
const data = this.__;
|
|
7626
|
-
if (
|
|
7627
|
-
if (
|
|
7628
|
-
this.leafer.
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7665
|
+
if (this.children.length) {
|
|
7666
|
+
if (data.__autoSide) {
|
|
7667
|
+
if (this.leafer && this.leafer.ready)
|
|
7668
|
+
this.leafer.layouter.addExtra(this);
|
|
7669
|
+
super.__updateBoxBounds();
|
|
7670
|
+
if (!data.__autoSize) {
|
|
7671
|
+
const b = this.__layout.boxBounds;
|
|
7672
|
+
if (!data.__autoWidth)
|
|
7673
|
+
b.x = 0, b.width = data.width;
|
|
7674
|
+
if (!data.__autoHeight)
|
|
7675
|
+
b.y = 0, b.height = data.height;
|
|
7676
|
+
}
|
|
7677
|
+
}
|
|
7678
|
+
else {
|
|
7679
|
+
this.__updateRectBoxBounds();
|
|
7636
7680
|
}
|
|
7681
|
+
if (data.flow)
|
|
7682
|
+
this.__updateContentBounds();
|
|
7637
7683
|
}
|
|
7638
7684
|
else {
|
|
7639
7685
|
this.__updateRectBoxBounds();
|
|
7640
7686
|
}
|
|
7641
|
-
if (data.flow)
|
|
7642
|
-
this.__updateContentBounds();
|
|
7643
7687
|
}
|
|
7644
7688
|
__updateStrokeBounds() { }
|
|
7645
7689
|
__updateRenderBounds() {
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
copy$2(bounds$1, renderBounds);
|
|
7690
|
+
let isOverflow;
|
|
7691
|
+
const { renderBounds } = this.__layout;
|
|
7692
|
+
if (this.children.length) {
|
|
7650
7693
|
super.__updateRenderBounds();
|
|
7651
|
-
|
|
7694
|
+
copy$2(childrenRenderBounds, renderBounds);
|
|
7695
|
+
this.__updateRectRenderBounds();
|
|
7696
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds) || undefined;
|
|
7652
7697
|
}
|
|
7698
|
+
else {
|
|
7699
|
+
this.__updateRectRenderBounds();
|
|
7700
|
+
}
|
|
7701
|
+
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
7702
|
+
if (isOverflow && !(this.__.__drawAfterFill = this.__.overflow === 'hide'))
|
|
7703
|
+
add(renderBounds, childrenRenderBounds);
|
|
7653
7704
|
}
|
|
7654
7705
|
__updateRectRenderBounds() { }
|
|
7655
7706
|
__updateRectChange() { }
|
|
@@ -7665,16 +7716,27 @@ let Box = class Box extends Group {
|
|
|
7665
7716
|
}
|
|
7666
7717
|
else {
|
|
7667
7718
|
this.__renderRect(canvas, options);
|
|
7668
|
-
this.
|
|
7719
|
+
if (this.children.length)
|
|
7720
|
+
this.__renderGroup(canvas, options);
|
|
7669
7721
|
}
|
|
7670
7722
|
}
|
|
7671
7723
|
__drawAfterFill(canvas, options) {
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7724
|
+
const { length } = this.children;
|
|
7725
|
+
if (this.isOverflow) {
|
|
7726
|
+
canvas.save();
|
|
7727
|
+
canvas.clip();
|
|
7728
|
+
if (length)
|
|
7729
|
+
this.__renderGroup(canvas, options);
|
|
7730
|
+
canvas.restore();
|
|
7731
|
+
}
|
|
7732
|
+
else {
|
|
7733
|
+
if (length)
|
|
7734
|
+
this.__renderGroup(canvas, options);
|
|
7735
|
+
}
|
|
7736
|
+
if (this.__.stroke && length) {
|
|
7737
|
+
canvas.setWorld(this.__nowWorld);
|
|
7677
7738
|
this.__drawRenderPath(canvas);
|
|
7739
|
+
}
|
|
7678
7740
|
}
|
|
7679
7741
|
};
|
|
7680
7742
|
__decorate([
|
|
@@ -7812,9 +7874,10 @@ let Line = class Line extends UI {
|
|
|
7812
7874
|
super(data);
|
|
7813
7875
|
}
|
|
7814
7876
|
__updatePath() {
|
|
7815
|
-
const
|
|
7816
|
-
|
|
7817
|
-
|
|
7877
|
+
const data = this.__;
|
|
7878
|
+
const path = data.path = [];
|
|
7879
|
+
if (data.points) {
|
|
7880
|
+
drawPoints$1(path, data.points, false, data.closed);
|
|
7818
7881
|
}
|
|
7819
7882
|
else {
|
|
7820
7883
|
moveTo$2(path, 0, 0);
|
|
@@ -8184,7 +8247,7 @@ __decorate([
|
|
|
8184
8247
|
boundsType(0)
|
|
8185
8248
|
], Text.prototype, "letterSpacing", void 0);
|
|
8186
8249
|
__decorate([
|
|
8187
|
-
boundsType({ type: 'percent', value:
|
|
8250
|
+
boundsType({ type: 'percent', value: 1.5 })
|
|
8188
8251
|
], Text.prototype, "lineHeight", void 0);
|
|
8189
8252
|
__decorate([
|
|
8190
8253
|
boundsType(0)
|
|
@@ -8278,8 +8341,6 @@ function penPathType() {
|
|
|
8278
8341
|
};
|
|
8279
8342
|
}
|
|
8280
8343
|
|
|
8281
|
-
const version = "1.0.0-rc.23";
|
|
8282
|
-
|
|
8283
8344
|
function fillText(ui, canvas) {
|
|
8284
8345
|
let row;
|
|
8285
8346
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
@@ -8950,13 +9011,14 @@ const PaintImageModule = {
|
|
|
8950
9011
|
recycleImage
|
|
8951
9012
|
};
|
|
8952
9013
|
|
|
8953
|
-
const
|
|
8954
|
-
const
|
|
9014
|
+
const { toPoint: toPoint$2 } = AroundHelper;
|
|
9015
|
+
const realFrom$2 = {};
|
|
9016
|
+
const realTo$2 = {};
|
|
8955
9017
|
function linearGradient(paint, box) {
|
|
8956
9018
|
let { from, to, type, blendMode, opacity } = paint;
|
|
8957
|
-
from ||
|
|
8958
|
-
to ||
|
|
8959
|
-
const style = Platform.canvas.createLinearGradient(
|
|
9019
|
+
toPoint$2(from || 'top', box, realFrom$2);
|
|
9020
|
+
toPoint$2(to || 'bottom', box, realTo$2);
|
|
9021
|
+
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
8960
9022
|
applyStops(style, paint.stops, opacity);
|
|
8961
9023
|
const data = { type, style };
|
|
8962
9024
|
if (blendMode)
|
|
@@ -8967,23 +9029,25 @@ function applyStops(gradient, stops, opacity) {
|
|
|
8967
9029
|
let stop;
|
|
8968
9030
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
8969
9031
|
stop = stops[i];
|
|
8970
|
-
|
|
9032
|
+
if (typeof stop === 'string') {
|
|
9033
|
+
gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
|
|
9034
|
+
}
|
|
9035
|
+
else {
|
|
9036
|
+
gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
|
|
9037
|
+
}
|
|
8971
9038
|
}
|
|
8972
9039
|
}
|
|
8973
9040
|
|
|
8974
|
-
const {
|
|
9041
|
+
const { getAngle: getAngle$1, getDistance: getDistance$1 } = PointHelper;
|
|
8975
9042
|
const { get: get$1, rotateOfOuter: rotateOfOuter$1, scaleOfOuter: scaleOfOuter$1 } = MatrixHelper;
|
|
8976
|
-
const
|
|
8977
|
-
const defaultTo$1 = { x: 0.5, y: 1 };
|
|
9043
|
+
const { toPoint: toPoint$1 } = AroundHelper;
|
|
8978
9044
|
const realFrom$1 = {};
|
|
8979
9045
|
const realTo$1 = {};
|
|
8980
9046
|
function radialGradient(paint, box) {
|
|
8981
9047
|
let { from, to, type, opacity, blendMode, stretch } = paint;
|
|
8982
|
-
from ||
|
|
8983
|
-
to ||
|
|
8984
|
-
const {
|
|
8985
|
-
set$1(realFrom$1, x + from.x * width, y + from.y * height);
|
|
8986
|
-
set$1(realTo$1, x + to.x * width, y + to.y * height);
|
|
9048
|
+
toPoint$1(from || 'center', box, realFrom$1);
|
|
9049
|
+
toPoint$1(to || 'bottom', box, realTo$1);
|
|
9050
|
+
const { width, height } = box;
|
|
8987
9051
|
let transform;
|
|
8988
9052
|
if (width !== height || stretch) {
|
|
8989
9053
|
transform = get$1();
|
|
@@ -8998,19 +9062,16 @@ function radialGradient(paint, box) {
|
|
|
8998
9062
|
return data;
|
|
8999
9063
|
}
|
|
9000
9064
|
|
|
9001
|
-
const {
|
|
9065
|
+
const { getAngle, getDistance } = PointHelper;
|
|
9002
9066
|
const { get, rotateOfOuter, scaleOfOuter } = MatrixHelper;
|
|
9003
|
-
const
|
|
9004
|
-
const defaultTo = { x: 0.5, y: 1 };
|
|
9067
|
+
const { toPoint } = AroundHelper;
|
|
9005
9068
|
const realFrom = {};
|
|
9006
9069
|
const realTo = {};
|
|
9007
9070
|
function conicGradient(paint, box) {
|
|
9008
9071
|
let { from, to, type, opacity, blendMode, stretch } = paint;
|
|
9009
|
-
from ||
|
|
9010
|
-
to ||
|
|
9011
|
-
const {
|
|
9012
|
-
set(realFrom, x + from.x * width, y + from.y * height);
|
|
9013
|
-
set(realTo, x + to.x * width, y + to.y * height);
|
|
9072
|
+
toPoint(from || 'center', box, realFrom);
|
|
9073
|
+
toPoint(to || 'bottom', box, realTo);
|
|
9074
|
+
const { width, height } = box;
|
|
9014
9075
|
const transform = get();
|
|
9015
9076
|
const angle = getAngle(realFrom, realTo);
|
|
9016
9077
|
if (Platform.conicGradientRotate90) {
|
|
@@ -9164,7 +9225,7 @@ Group.prototype.__renderMask = function (canvas, options) {
|
|
|
9164
9225
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
|
|
9165
9226
|
maskCanvas = contentCanvas = null;
|
|
9166
9227
|
}
|
|
9167
|
-
if (child.__.
|
|
9228
|
+
if (child.__.mask === 'path') {
|
|
9168
9229
|
if (child.opacity < 1) {
|
|
9169
9230
|
currentMask = 'opacity-path';
|
|
9170
9231
|
maskOpacity = child.opacity;
|
|
@@ -9185,7 +9246,7 @@ Group.prototype.__renderMask = function (canvas, options) {
|
|
|
9185
9246
|
contentCanvas = getCanvas(canvas);
|
|
9186
9247
|
child.__render(maskCanvas, options);
|
|
9187
9248
|
}
|
|
9188
|
-
if (child.__.
|
|
9249
|
+
if (child.__.mask !== 'clipping')
|
|
9189
9250
|
continue;
|
|
9190
9251
|
}
|
|
9191
9252
|
if (excludeRenderBounds(child, options))
|
|
@@ -9486,11 +9547,11 @@ function layoutChar(drawData, style, width, _height) {
|
|
|
9486
9547
|
if (mode === WordMode) {
|
|
9487
9548
|
wordChar = { char: '', x: charX };
|
|
9488
9549
|
charX = toWordChar(word.data, charX, wordChar);
|
|
9489
|
-
if (wordChar.char !== ' ')
|
|
9550
|
+
if (row.isOverflow || wordChar.char !== ' ')
|
|
9490
9551
|
row.data.push(wordChar);
|
|
9491
9552
|
}
|
|
9492
9553
|
else {
|
|
9493
|
-
charX = toChar(word.data, charX, row.data);
|
|
9554
|
+
charX = toChar(word.data, charX, row.data, row.isOverflow);
|
|
9494
9555
|
}
|
|
9495
9556
|
if (!row.paraEnd && addWordWidth) {
|
|
9496
9557
|
charX += addWordWidth;
|
|
@@ -9517,9 +9578,9 @@ function toWordChar(data, charX, wordChar) {
|
|
|
9517
9578
|
});
|
|
9518
9579
|
return charX;
|
|
9519
9580
|
}
|
|
9520
|
-
function toChar(data, charX, rowData) {
|
|
9581
|
+
function toChar(data, charX, rowData, isOverflow) {
|
|
9521
9582
|
data.forEach(char => {
|
|
9522
|
-
if (char.char !== ' ') {
|
|
9583
|
+
if (isOverflow || char.char !== ' ') {
|
|
9523
9584
|
char.x = charX;
|
|
9524
9585
|
rowData.push(char);
|
|
9525
9586
|
}
|
|
@@ -9551,12 +9612,14 @@ function layoutText(drawData, style) {
|
|
|
9551
9612
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
9552
9613
|
row = rows[i];
|
|
9553
9614
|
row.x = x;
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9615
|
+
if (row.width < width || (row.width > width && !__clipText)) {
|
|
9616
|
+
switch (textAlign) {
|
|
9617
|
+
case 'center':
|
|
9618
|
+
row.x += (width - row.width) / 2;
|
|
9619
|
+
break;
|
|
9620
|
+
case 'right':
|
|
9621
|
+
row.x += width - row.width;
|
|
9622
|
+
}
|
|
9560
9623
|
}
|
|
9561
9624
|
if (row.paraStart && paraSpacing && i > 0)
|
|
9562
9625
|
starY += paraSpacing;
|
|
@@ -9905,4 +9968,4 @@ Object.assign(Export, ExportModule);
|
|
|
9905
9968
|
|
|
9906
9969
|
useCanvas();
|
|
9907
9970
|
|
|
9908
|
-
export { AlignHelper, AnimateEvent, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, 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, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, zoomLayerType };
|
|
9971
|
+
export { AlignHelper, AnimateEvent, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, 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, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, inviteCode, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|