leafer-ui 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/README.md +1 -1
- package/dist/web.esm.js +38 -42
- package/dist/web.esm.min.js +1 -1
- package/dist/web.js +269 -206
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +268 -207
- package/dist/web.module.min.js +1 -1
- package/package.json +11 -11
package/dist/web.js
CHANGED
|
@@ -753,7 +753,7 @@ var LeaferUI = (function (exports) {
|
|
|
753
753
|
const { floor, ceil: ceil$2 } = Math;
|
|
754
754
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
755
755
|
const point = {};
|
|
756
|
-
const toPoint$
|
|
756
|
+
const toPoint$5 = {};
|
|
757
757
|
const BoundsHelper = {
|
|
758
758
|
tempBounds: {},
|
|
759
759
|
set(t, x = 0, y = 0, width = 0, height = 0) {
|
|
@@ -855,17 +855,17 @@ var LeaferUI = (function (exports) {
|
|
|
855
855
|
else {
|
|
856
856
|
point.x = t.x;
|
|
857
857
|
point.y = t.y;
|
|
858
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
859
|
-
setPoint$3(tempPointBounds$1, toPoint$
|
|
858
|
+
toOuterPoint$1(matrix, point, toPoint$5);
|
|
859
|
+
setPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
860
860
|
point.x = t.x + t.width;
|
|
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.y = t.y + t.height;
|
|
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
|
point.x = t.x;
|
|
867
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
868
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
867
|
+
toOuterPoint$1(matrix, point, toPoint$5);
|
|
868
|
+
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
869
869
|
toBounds$4(tempPointBounds$1, to);
|
|
870
870
|
}
|
|
871
871
|
},
|
|
@@ -1238,10 +1238,10 @@ var LeaferUI = (function (exports) {
|
|
|
1238
1238
|
return typeof around === 'string' ? directionData[exports.Direction9[around]] : around;
|
|
1239
1239
|
}
|
|
1240
1240
|
|
|
1241
|
-
const { toPoint: toPoint$
|
|
1241
|
+
const { toPoint: toPoint$4 } = AroundHelper;
|
|
1242
1242
|
const AlignHelper = {
|
|
1243
1243
|
toPoint(align, contentBounds, bounds, to, onlySize) {
|
|
1244
|
-
toPoint$
|
|
1244
|
+
toPoint$4(align, bounds, to, onlySize, contentBounds);
|
|
1245
1245
|
}
|
|
1246
1246
|
};
|
|
1247
1247
|
|
|
@@ -1488,6 +1488,8 @@ var LeaferUI = (function (exports) {
|
|
|
1488
1488
|
const { assign } = DataHelper;
|
|
1489
1489
|
|
|
1490
1490
|
class LeafData {
|
|
1491
|
+
get __useNaturalRatio() { return true; }
|
|
1492
|
+
get __isLinePath() { return this.path && this.path.length === 6; }
|
|
1491
1493
|
get __blendMode() {
|
|
1492
1494
|
if (this.eraser && this.eraser !== 'path')
|
|
1493
1495
|
return 'destination-out';
|
|
@@ -1985,6 +1987,11 @@ var LeaferUI = (function (exports) {
|
|
|
1985
1987
|
}
|
|
1986
1988
|
updateViewSize() { }
|
|
1987
1989
|
updateClientBounds() { }
|
|
1990
|
+
getClientBounds(update) {
|
|
1991
|
+
if (update)
|
|
1992
|
+
this.updateClientBounds();
|
|
1993
|
+
return this.clientBounds || this.bounds;
|
|
1994
|
+
}
|
|
1988
1995
|
startAutoLayout(_autoBounds, _listener) { }
|
|
1989
1996
|
stopAutoLayout() { }
|
|
1990
1997
|
setCursor(_cursor) { }
|
|
@@ -2236,7 +2243,7 @@ var LeaferUI = (function (exports) {
|
|
|
2236
2243
|
|
|
2237
2244
|
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
|
|
2238
2245
|
const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
|
|
2239
|
-
const { set
|
|
2246
|
+
const { set } = PointHelper;
|
|
2240
2247
|
const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
2241
2248
|
const tempPoint$2 = {};
|
|
2242
2249
|
const BezierHelper = {
|
|
@@ -2314,9 +2321,9 @@ var LeaferUI = (function (exports) {
|
|
|
2314
2321
|
addPoint$2(setPointBounds, x1, y1);
|
|
2315
2322
|
}
|
|
2316
2323
|
if (setStartPoint)
|
|
2317
|
-
set
|
|
2324
|
+
set(setStartPoint, fromX, fromY);
|
|
2318
2325
|
if (setEndPoint)
|
|
2319
|
-
set
|
|
2326
|
+
set(setEndPoint, x1, y1);
|
|
2320
2327
|
return;
|
|
2321
2328
|
}
|
|
2322
2329
|
const anticlockwise = BAx * CBy - CBx * BAy < 0;
|
|
@@ -2365,7 +2372,7 @@ var LeaferUI = (function (exports) {
|
|
|
2365
2372
|
if (setPointBounds)
|
|
2366
2373
|
setPoint$2(setPointBounds, fromX, fromY);
|
|
2367
2374
|
if (setStartPoint)
|
|
2368
|
-
set
|
|
2375
|
+
set(setStartPoint, fromX, fromY);
|
|
2369
2376
|
for (let i = 0; i < parts; i++) {
|
|
2370
2377
|
endCos = cos$3(endRadian);
|
|
2371
2378
|
endSin = sin$3(endRadian);
|
|
@@ -2387,7 +2394,7 @@ var LeaferUI = (function (exports) {
|
|
|
2387
2394
|
endRadian += partRadian;
|
|
2388
2395
|
}
|
|
2389
2396
|
if (setEndPoint)
|
|
2390
|
-
set
|
|
2397
|
+
set(setEndPoint, cx + x, cy + y);
|
|
2391
2398
|
},
|
|
2392
2399
|
quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
|
|
2393
2400
|
data.push(C$5, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
|
|
@@ -2533,11 +2540,15 @@ var LeaferUI = (function (exports) {
|
|
|
2533
2540
|
char = pathString[i];
|
|
2534
2541
|
if (StringNumberMap[char]) {
|
|
2535
2542
|
if (char === '.') {
|
|
2536
|
-
current.dot
|
|
2537
|
-
if (current.dot > 1) {
|
|
2543
|
+
if (current.dot) {
|
|
2538
2544
|
pushData(data, num);
|
|
2539
2545
|
num = '';
|
|
2540
2546
|
}
|
|
2547
|
+
current.dot++;
|
|
2548
|
+
}
|
|
2549
|
+
if (num === '0' && char !== '.') {
|
|
2550
|
+
pushData(data, num);
|
|
2551
|
+
num = '';
|
|
2541
2552
|
}
|
|
2542
2553
|
num += char;
|
|
2543
2554
|
}
|
|
@@ -3627,7 +3638,9 @@ var LeaferUI = (function (exports) {
|
|
|
3627
3638
|
}
|
|
3628
3639
|
}
|
|
3629
3640
|
|
|
3630
|
-
function defineKey(target, key, descriptor) {
|
|
3641
|
+
function defineKey(target, key, descriptor, noConfigurable) {
|
|
3642
|
+
if (!noConfigurable)
|
|
3643
|
+
descriptor.configurable = descriptor.enumerable = true;
|
|
3631
3644
|
Object.defineProperty(target, key, descriptor);
|
|
3632
3645
|
}
|
|
3633
3646
|
function getDescriptor(object, name) {
|
|
@@ -3646,9 +3659,7 @@ var LeaferUI = (function (exports) {
|
|
|
3646
3659
|
function defineLeafAttr(target, key, defaultValue, partDescriptor) {
|
|
3647
3660
|
const defaultDescriptor = {
|
|
3648
3661
|
get() { return this.__getAttr(key); },
|
|
3649
|
-
set(value) { this.__setAttr(key, value); }
|
|
3650
|
-
configurable: true,
|
|
3651
|
-
enumerable: true
|
|
3662
|
+
set(value) { this.__setAttr(key, value); }
|
|
3652
3663
|
};
|
|
3653
3664
|
defineKey(target, key, Object.assign(defaultDescriptor, partDescriptor || {}));
|
|
3654
3665
|
defineDataProcessor(target, key, defaultValue);
|
|
@@ -3659,35 +3670,33 @@ var LeaferUI = (function (exports) {
|
|
|
3659
3670
|
function positionType(defaultValue, checkFiniteNumber) {
|
|
3660
3671
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3661
3672
|
set(value) {
|
|
3662
|
-
this.__setAttr(key, value, checkFiniteNumber);
|
|
3663
|
-
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3673
|
+
this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.matrixChanged || this.__layout.matrixChange());
|
|
3664
3674
|
}
|
|
3665
3675
|
}));
|
|
3666
3676
|
}
|
|
3667
3677
|
function autoLayoutType(defaultValue) {
|
|
3668
3678
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3669
3679
|
set(value) {
|
|
3670
|
-
this.__setAttr(key, value)
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3680
|
+
if (this.__setAttr(key, value)) {
|
|
3681
|
+
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3682
|
+
this.__hasAutoLayout = !!value;
|
|
3683
|
+
if (!this.__local)
|
|
3684
|
+
this.__layout.createLocal();
|
|
3685
|
+
}
|
|
3675
3686
|
}
|
|
3676
3687
|
}));
|
|
3677
3688
|
}
|
|
3678
3689
|
function scaleType(defaultValue, checkFiniteNumber) {
|
|
3679
3690
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3680
3691
|
set(value) {
|
|
3681
|
-
this.__setAttr(key, value, checkFiniteNumber);
|
|
3682
|
-
this.__layout.scaleChanged || this.__layout.scaleChange();
|
|
3692
|
+
this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.scaleChanged || this.__layout.scaleChange());
|
|
3683
3693
|
}
|
|
3684
3694
|
}));
|
|
3685
3695
|
}
|
|
3686
3696
|
function rotationType(defaultValue, checkFiniteNumber) {
|
|
3687
3697
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3688
3698
|
set(value) {
|
|
3689
|
-
this.__setAttr(key, value, checkFiniteNumber);
|
|
3690
|
-
this.__layout.rotationChanged || this.__layout.rotationChange();
|
|
3699
|
+
this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.rotationChanged || this.__layout.rotationChange());
|
|
3691
3700
|
}
|
|
3692
3701
|
}));
|
|
3693
3702
|
}
|
|
@@ -3701,9 +3710,7 @@ var LeaferUI = (function (exports) {
|
|
|
3701
3710
|
function naturalBoundsType(defaultValue) {
|
|
3702
3711
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3703
3712
|
set(value) {
|
|
3704
|
-
this.__setAttr(key, value);
|
|
3705
|
-
doBoundsType(this);
|
|
3706
|
-
this.__.__removeNaturalSize();
|
|
3713
|
+
this.__setAttr(key, value) && (doBoundsType(this), this.__.__removeNaturalSize());
|
|
3707
3714
|
}
|
|
3708
3715
|
}));
|
|
3709
3716
|
}
|
|
@@ -3715,8 +3722,11 @@ var LeaferUI = (function (exports) {
|
|
|
3715
3722
|
function pathInputType(defaultValue) {
|
|
3716
3723
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3717
3724
|
set(value) {
|
|
3718
|
-
|
|
3719
|
-
|
|
3725
|
+
const data = this.__;
|
|
3726
|
+
if (data.__pathInputed !== 2)
|
|
3727
|
+
data.__pathInputed = value ? 1 : 0;
|
|
3728
|
+
if (!value)
|
|
3729
|
+
data.__pathForRender = undefined;
|
|
3720
3730
|
this.__setAttr(key, value);
|
|
3721
3731
|
doBoundsType(this);
|
|
3722
3732
|
}
|
|
@@ -3747,56 +3757,66 @@ var LeaferUI = (function (exports) {
|
|
|
3747
3757
|
function surfaceType(defaultValue) {
|
|
3748
3758
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3749
3759
|
set(value) {
|
|
3750
|
-
this.__setAttr(key, value);
|
|
3751
|
-
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
3760
|
+
this.__setAttr(key, value) && (this.__layout.surfaceChanged || this.__layout.surfaceChange());
|
|
3752
3761
|
}
|
|
3753
3762
|
}));
|
|
3754
3763
|
}
|
|
3755
3764
|
function opacityType(defaultValue) {
|
|
3756
3765
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3757
3766
|
set(value) {
|
|
3758
|
-
this.__setAttr(key, value);
|
|
3759
|
-
|
|
3767
|
+
this.__setAttr(key, value) && (this.__layout.opacityChanged || this.__layout.opacityChange());
|
|
3768
|
+
}
|
|
3769
|
+
}));
|
|
3770
|
+
}
|
|
3771
|
+
function visibleType(defaultValue) {
|
|
3772
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3773
|
+
set(value) {
|
|
3774
|
+
const oldValue = this.visible;
|
|
3775
|
+
if (this.__setAttr(key, value)) {
|
|
3776
|
+
this.__layout.opacityChanged || this.__layout.opacityChange();
|
|
3777
|
+
if (oldValue === 0 || value === 0)
|
|
3778
|
+
doBoundsType(this);
|
|
3779
|
+
}
|
|
3760
3780
|
}
|
|
3761
3781
|
}));
|
|
3762
3782
|
}
|
|
3763
3783
|
function sortType(defaultValue) {
|
|
3764
3784
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3765
3785
|
set(value) {
|
|
3766
|
-
this.__setAttr(key, value)
|
|
3767
|
-
|
|
3768
|
-
|
|
3786
|
+
if (this.__setAttr(key, value)) {
|
|
3787
|
+
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
3788
|
+
this.waitParent(() => { this.parent.__layout.childrenSortChange(); });
|
|
3789
|
+
}
|
|
3769
3790
|
}
|
|
3770
3791
|
}));
|
|
3771
3792
|
}
|
|
3772
3793
|
function maskType(defaultValue) {
|
|
3773
3794
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3774
3795
|
set(value) {
|
|
3775
|
-
this.__setAttr(key, value)
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
this.maskType = value;
|
|
3796
|
+
if (this.__setAttr(key, value)) {
|
|
3797
|
+
this.__layout.boxChanged || this.__layout.boxChange();
|
|
3798
|
+
this.waitParent(() => { this.parent.__updateMask(value); });
|
|
3799
|
+
}
|
|
3780
3800
|
}
|
|
3781
3801
|
}));
|
|
3782
3802
|
}
|
|
3783
3803
|
function eraserType(defaultValue) {
|
|
3784
3804
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3785
3805
|
set(value) {
|
|
3786
|
-
this.__setAttr(key, value);
|
|
3787
|
-
this.waitParent(() => { this.parent.__updateEraser(value); });
|
|
3806
|
+
this.__setAttr(key, value) && this.waitParent(() => { this.parent.__updateEraser(value); });
|
|
3788
3807
|
}
|
|
3789
3808
|
}));
|
|
3790
3809
|
}
|
|
3791
3810
|
function hitType(defaultValue) {
|
|
3792
3811
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3793
3812
|
set(value) {
|
|
3794
|
-
this.__setAttr(key, value)
|
|
3795
|
-
|
|
3796
|
-
|
|
3813
|
+
if (this.__setAttr(key, value)) {
|
|
3814
|
+
if (Debug.showHitView) {
|
|
3815
|
+
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
3816
|
+
}
|
|
3817
|
+
if (this.leafer)
|
|
3818
|
+
this.leafer.updateCursor();
|
|
3797
3819
|
}
|
|
3798
|
-
if (this.leafer)
|
|
3799
|
-
this.leafer.updateCursor();
|
|
3800
3820
|
}
|
|
3801
3821
|
}));
|
|
3802
3822
|
}
|
|
@@ -3837,9 +3857,7 @@ var LeaferUI = (function (exports) {
|
|
|
3837
3857
|
},
|
|
3838
3858
|
set(value) {
|
|
3839
3859
|
this[computedKey] = value;
|
|
3840
|
-
}
|
|
3841
|
-
configurable: true,
|
|
3842
|
-
enumerable: true
|
|
3860
|
+
}
|
|
3843
3861
|
};
|
|
3844
3862
|
if (defaultValue === undefined) {
|
|
3845
3863
|
property.get = function () { return this[computedKey]; };
|
|
@@ -3847,13 +3865,25 @@ var LeaferUI = (function (exports) {
|
|
|
3847
3865
|
else if (key === 'width') {
|
|
3848
3866
|
property.get = function () {
|
|
3849
3867
|
const v = this[computedKey];
|
|
3850
|
-
|
|
3868
|
+
if (v === undefined) {
|
|
3869
|
+
const t = this;
|
|
3870
|
+
return t._height && t.__naturalWidth && t.__useNaturalRatio ? t._height * t.__naturalWidth / t.__naturalHeight : t.__naturalWidth || defaultValue;
|
|
3871
|
+
}
|
|
3872
|
+
else {
|
|
3873
|
+
return v;
|
|
3874
|
+
}
|
|
3851
3875
|
};
|
|
3852
3876
|
}
|
|
3853
3877
|
else if (key === 'height') {
|
|
3854
3878
|
property.get = function () {
|
|
3855
3879
|
const v = this[computedKey];
|
|
3856
|
-
|
|
3880
|
+
if (v === undefined) {
|
|
3881
|
+
const t = this;
|
|
3882
|
+
return t._width && t.__naturalHeight && t.__useNaturalRatio ? t._width * t.__naturalHeight / t.__naturalWidth : t.__naturalHeight || defaultValue;
|
|
3883
|
+
}
|
|
3884
|
+
else {
|
|
3885
|
+
return v;
|
|
3886
|
+
}
|
|
3857
3887
|
};
|
|
3858
3888
|
}
|
|
3859
3889
|
let descriptor, find = data;
|
|
@@ -3867,7 +3897,7 @@ var LeaferUI = (function (exports) {
|
|
|
3867
3897
|
property.set = data[setMethodName];
|
|
3868
3898
|
delete data[setMethodName];
|
|
3869
3899
|
}
|
|
3870
|
-
|
|
3900
|
+
defineKey(data, key, property);
|
|
3871
3901
|
}
|
|
3872
3902
|
|
|
3873
3903
|
const debug$9 = new Debug('rewrite');
|
|
@@ -4068,13 +4098,6 @@ var LeaferUI = (function (exports) {
|
|
|
4068
4098
|
return true;
|
|
4069
4099
|
p = p.parent;
|
|
4070
4100
|
}
|
|
4071
|
-
},
|
|
4072
|
-
hasParentAutoLayout(p) {
|
|
4073
|
-
while (p.parent) {
|
|
4074
|
-
p = p.parent;
|
|
4075
|
-
if (p.__hasAutoLayout)
|
|
4076
|
-
return true;
|
|
4077
|
-
}
|
|
4078
4101
|
}
|
|
4079
4102
|
};
|
|
4080
4103
|
const L = LeafHelper;
|
|
@@ -4094,13 +4117,13 @@ var LeaferUI = (function (exports) {
|
|
|
4094
4117
|
return target.__world;
|
|
4095
4118
|
},
|
|
4096
4119
|
localBoxBounds(target) {
|
|
4097
|
-
return target.__.eraser ? null : (target.__local || target.__layout);
|
|
4120
|
+
return target.__.eraser || target.__.visible === 0 ? null : (target.__local || target.__layout);
|
|
4098
4121
|
},
|
|
4099
4122
|
localStrokeBounds(target) {
|
|
4100
|
-
return target.__.eraser ? null : target.__layout.localStrokeBounds;
|
|
4123
|
+
return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
|
|
4101
4124
|
},
|
|
4102
4125
|
localRenderBounds(target) {
|
|
4103
|
-
return target.__.eraser ? null : target.__layout.localRenderBounds;
|
|
4126
|
+
return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localRenderBounds;
|
|
4104
4127
|
},
|
|
4105
4128
|
maskLocalBoxBounds(target) {
|
|
4106
4129
|
return target.__.mask ? target.__localBoxBounds : null;
|
|
@@ -4806,7 +4829,7 @@ var LeaferUI = (function (exports) {
|
|
|
4806
4829
|
};
|
|
4807
4830
|
|
|
4808
4831
|
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
4809
|
-
const { toPoint, tempPoint: tempPoint$1 } = AroundHelper;
|
|
4832
|
+
const { toPoint: toPoint$3, tempPoint: tempPoint$1 } = AroundHelper;
|
|
4810
4833
|
const LeafMatrix = {
|
|
4811
4834
|
__updateWorldMatrix() {
|
|
4812
4835
|
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
|
|
@@ -4823,7 +4846,7 @@ var LeaferUI = (function (exports) {
|
|
|
4823
4846
|
local.e = data.x + data.offsetX;
|
|
4824
4847
|
local.f = data.y + data.offsetY;
|
|
4825
4848
|
if (data.around || data.origin) {
|
|
4826
|
-
toPoint(data.around || data.origin, layout.boxBounds, tempPoint$1);
|
|
4849
|
+
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$1);
|
|
4827
4850
|
translateInner(local, -tempPoint$1.x, -tempPoint$1.y, data.origin);
|
|
4828
4851
|
}
|
|
4829
4852
|
}
|
|
@@ -4831,7 +4854,7 @@ var LeaferUI = (function (exports) {
|
|
|
4831
4854
|
}
|
|
4832
4855
|
};
|
|
4833
4856
|
|
|
4834
|
-
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2
|
|
4857
|
+
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
|
|
4835
4858
|
const { updateBounds: updateBounds$1 } = BranchHelper;
|
|
4836
4859
|
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5 } = BoundsHelper;
|
|
4837
4860
|
const { toBounds: toBounds$2 } = PathBounds;
|
|
@@ -4850,7 +4873,6 @@ var LeaferUI = (function (exports) {
|
|
|
4850
4873
|
this.__updatePath();
|
|
4851
4874
|
this.__updateRenderPath();
|
|
4852
4875
|
this.__updateBoxBounds();
|
|
4853
|
-
layout.boxChanged = false;
|
|
4854
4876
|
layout.resized = true;
|
|
4855
4877
|
}
|
|
4856
4878
|
if (layout.localBoxChanged) {
|
|
@@ -4864,12 +4886,12 @@ var LeaferUI = (function (exports) {
|
|
|
4864
4886
|
if (this.parent)
|
|
4865
4887
|
this.parent.__layout.boxChange();
|
|
4866
4888
|
}
|
|
4889
|
+
layout.boxChanged = false;
|
|
4867
4890
|
if (layout.strokeChanged) {
|
|
4868
4891
|
layout.strokeSpread = this.__updateStrokeSpread();
|
|
4869
4892
|
if (layout.strokeSpread) {
|
|
4870
|
-
if (layout.strokeBounds === layout.boxBounds)
|
|
4893
|
+
if (layout.strokeBounds === layout.boxBounds)
|
|
4871
4894
|
layout.spreadStroke();
|
|
4872
|
-
}
|
|
4873
4895
|
this.__updateStrokeBounds();
|
|
4874
4896
|
this.__updateLocalStrokeBounds();
|
|
4875
4897
|
}
|
|
@@ -4877,7 +4899,7 @@ var LeaferUI = (function (exports) {
|
|
|
4877
4899
|
layout.spreadStrokeCancel();
|
|
4878
4900
|
}
|
|
4879
4901
|
layout.strokeChanged = false;
|
|
4880
|
-
if (layout.renderSpread)
|
|
4902
|
+
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
|
|
4881
4903
|
layout.renderChanged = true;
|
|
4882
4904
|
if (this.parent)
|
|
4883
4905
|
this.parent.__layout.strokeChange();
|
|
@@ -4886,9 +4908,8 @@ var LeaferUI = (function (exports) {
|
|
|
4886
4908
|
if (layout.renderChanged) {
|
|
4887
4909
|
layout.renderSpread = this.__updateRenderSpread();
|
|
4888
4910
|
if (layout.renderSpread) {
|
|
4889
|
-
if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds)
|
|
4911
|
+
if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds)
|
|
4890
4912
|
layout.spreadRender();
|
|
4891
|
-
}
|
|
4892
4913
|
this.__updateRenderBounds();
|
|
4893
4914
|
this.__updateLocalRenderBounds();
|
|
4894
4915
|
}
|
|
@@ -4928,12 +4949,15 @@ var LeaferUI = (function (exports) {
|
|
|
4928
4949
|
__updateAutoLayout() {
|
|
4929
4950
|
this.__layout.matrixChanged = true;
|
|
4930
4951
|
if (this.isBranch) {
|
|
4931
|
-
if (this.leafer)
|
|
4952
|
+
if (this.leafer && this.leafer.ready)
|
|
4932
4953
|
this.leafer.layouter.addExtra(this);
|
|
4933
|
-
if (this.__.flow)
|
|
4934
|
-
this.
|
|
4935
|
-
|
|
4936
|
-
|
|
4954
|
+
if (this.__.flow) {
|
|
4955
|
+
if (this.__layout.boxChanged)
|
|
4956
|
+
this.__updateFlowLayout();
|
|
4957
|
+
updateAllMatrix$2(this);
|
|
4958
|
+
updateBounds$1(this, this);
|
|
4959
|
+
if (this.__.__autoSide)
|
|
4960
|
+
this.__updateBoxBounds();
|
|
4937
4961
|
}
|
|
4938
4962
|
else {
|
|
4939
4963
|
updateAllMatrix$2(this);
|
|
@@ -4950,12 +4974,13 @@ var LeaferUI = (function (exports) {
|
|
|
4950
4974
|
data.__naturalHeight = layout.boxBounds.height;
|
|
4951
4975
|
},
|
|
4952
4976
|
__updateStrokeBounds() {
|
|
4953
|
-
|
|
4977
|
+
const layout = this.__layout;
|
|
4978
|
+
copyAndSpread$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
4954
4979
|
},
|
|
4955
4980
|
__updateRenderBounds() {
|
|
4956
|
-
const
|
|
4957
|
-
renderSpread > 0 ? copyAndSpread$1(renderBounds,
|
|
4958
|
-
}
|
|
4981
|
+
const layout = this.__layout;
|
|
4982
|
+
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
|
|
4983
|
+
}
|
|
4959
4984
|
};
|
|
4960
4985
|
|
|
4961
4986
|
const LeafRender = {
|
|
@@ -5075,7 +5100,7 @@ var LeaferUI = (function (exports) {
|
|
|
5075
5100
|
get __worldFlipped() { return this.__world.scaleX < 0 || this.__world.scaleY < 0; }
|
|
5076
5101
|
get __onlyHitMask() { return this.__hasMask && !this.__.hitChildren; }
|
|
5077
5102
|
get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
|
|
5078
|
-
get pathInputed() { return
|
|
5103
|
+
get pathInputed() { return this.__.__pathInputed; }
|
|
5079
5104
|
constructor(data) {
|
|
5080
5105
|
this.innerId = create(LEAF);
|
|
5081
5106
|
this.reset(data);
|
|
@@ -5687,6 +5712,9 @@ var LeaferUI = (function (exports) {
|
|
|
5687
5712
|
}
|
|
5688
5713
|
}
|
|
5689
5714
|
|
|
5715
|
+
const version = "1.0.0-rc.24";
|
|
5716
|
+
const inviteCode = {};
|
|
5717
|
+
|
|
5690
5718
|
const debug$7 = Debug.get('LeaferCanvas');
|
|
5691
5719
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5692
5720
|
init() {
|
|
@@ -6360,7 +6388,7 @@ var LeaferUI = (function (exports) {
|
|
|
6360
6388
|
canvas.clear();
|
|
6361
6389
|
}
|
|
6362
6390
|
else {
|
|
6363
|
-
bounds.spread(
|
|
6391
|
+
bounds.spread(10 + 1 / this.canvas.pixelRatio).ceil();
|
|
6364
6392
|
canvas.clearWorld(bounds, true);
|
|
6365
6393
|
canvas.clipWorld(bounds, true);
|
|
6366
6394
|
}
|
|
@@ -6777,10 +6805,11 @@ var LeaferUI = (function (exports) {
|
|
|
6777
6805
|
function arrowType(defaultValue) {
|
|
6778
6806
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6779
6807
|
set(value) {
|
|
6780
|
-
this.__setAttr(key, value)
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6808
|
+
if (this.__setAttr(key, value)) {
|
|
6809
|
+
const data = this.__;
|
|
6810
|
+
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
6811
|
+
doStrokeType(this);
|
|
6812
|
+
}
|
|
6784
6813
|
}
|
|
6785
6814
|
}));
|
|
6786
6815
|
}
|
|
@@ -6953,7 +6982,7 @@ var LeaferUI = (function (exports) {
|
|
|
6953
6982
|
const UnitConvert = {
|
|
6954
6983
|
number(value, percentRefer) {
|
|
6955
6984
|
if (typeof value === 'object')
|
|
6956
|
-
return value.type === 'percent' ?
|
|
6985
|
+
return value.type === 'percent' ? value.value * percentRefer : value.value;
|
|
6957
6986
|
return value;
|
|
6958
6987
|
}
|
|
6959
6988
|
};
|
|
@@ -6962,7 +6991,7 @@ var LeaferUI = (function (exports) {
|
|
|
6962
6991
|
}
|
|
6963
6992
|
|
|
6964
6993
|
class BoxData extends GroupData {
|
|
6965
|
-
get __boxStroke() { return
|
|
6994
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
6966
6995
|
}
|
|
6967
6996
|
|
|
6968
6997
|
class LeaferData extends GroupData {
|
|
@@ -6975,11 +7004,11 @@ var LeaferUI = (function (exports) {
|
|
|
6975
7004
|
}
|
|
6976
7005
|
|
|
6977
7006
|
class RectData extends UIData {
|
|
6978
|
-
get __boxStroke() { return
|
|
7007
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
6979
7008
|
}
|
|
6980
7009
|
|
|
6981
7010
|
class EllipseData extends UIData {
|
|
6982
|
-
get __boxStroke() { return
|
|
7011
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
6983
7012
|
}
|
|
6984
7013
|
|
|
6985
7014
|
class PolygonData extends UIData {
|
|
@@ -7006,6 +7035,7 @@ var LeaferUI = (function (exports) {
|
|
|
7006
7035
|
'black': 900
|
|
7007
7036
|
};
|
|
7008
7037
|
class TextData extends UIData {
|
|
7038
|
+
get __useNaturalRatio() { return false; }
|
|
7009
7039
|
setFontWeight(value) {
|
|
7010
7040
|
if (typeof value === 'string') {
|
|
7011
7041
|
this.__setInput('fontWeight', value);
|
|
@@ -7047,19 +7077,18 @@ var LeaferUI = (function (exports) {
|
|
|
7047
7077
|
const UIBounds = {
|
|
7048
7078
|
__updateStrokeSpread() {
|
|
7049
7079
|
let width = 0, boxWidth = 0;
|
|
7050
|
-
const
|
|
7051
|
-
if ((stroke || hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
7080
|
+
const data = this.__, { strokeAlign, strokeWidth } = data;
|
|
7081
|
+
if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
7052
7082
|
boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
|
|
7053
|
-
if (!
|
|
7054
|
-
const
|
|
7055
|
-
const
|
|
7056
|
-
const storkeCapAddWidth = strokeCap === 'none' ? 0 : strokeWidth;
|
|
7083
|
+
if (!data.__boxStroke) {
|
|
7084
|
+
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * width;
|
|
7085
|
+
const storkeCapAddWidth = data.strokeCap === 'none' ? 0 : strokeWidth;
|
|
7057
7086
|
width += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
7058
7087
|
}
|
|
7059
7088
|
}
|
|
7060
|
-
|
|
7061
|
-
if (this.__.__useArrow)
|
|
7089
|
+
if (data.__useArrow)
|
|
7062
7090
|
width += strokeWidth * 5;
|
|
7091
|
+
this.__layout.strokeBoxSpread = boxWidth;
|
|
7063
7092
|
return width;
|
|
7064
7093
|
},
|
|
7065
7094
|
__updateRenderSpread() {
|
|
@@ -7079,7 +7108,7 @@ var LeaferUI = (function (exports) {
|
|
|
7079
7108
|
if (backgroundBlur)
|
|
7080
7109
|
shapeWidth = Math.max(shapeWidth, backgroundBlur);
|
|
7081
7110
|
this.__layout.renderShapeSpread = shapeWidth;
|
|
7082
|
-
return width;
|
|
7111
|
+
return width + (this.__layout.strokeSpread || 0);
|
|
7083
7112
|
}
|
|
7084
7113
|
};
|
|
7085
7114
|
|
|
@@ -7170,7 +7199,7 @@ var LeaferUI = (function (exports) {
|
|
|
7170
7199
|
|
|
7171
7200
|
const RectRender = {
|
|
7172
7201
|
__drawFast(canvas, options) {
|
|
7173
|
-
|
|
7202
|
+
let { width, height, fill, stroke, __drawAfterFill } = this.__;
|
|
7174
7203
|
if (fill) {
|
|
7175
7204
|
canvas.fillStyle = fill;
|
|
7176
7205
|
canvas.fillRect(0, 0, width, height);
|
|
@@ -7188,7 +7217,16 @@ var LeaferUI = (function (exports) {
|
|
|
7188
7217
|
canvas.strokeRect(0, 0, width, height);
|
|
7189
7218
|
break;
|
|
7190
7219
|
case 'inside':
|
|
7191
|
-
|
|
7220
|
+
width -= __strokeWidth, height -= __strokeWidth;
|
|
7221
|
+
if (width < 0 || height < 0) {
|
|
7222
|
+
canvas.save();
|
|
7223
|
+
this.__clip(canvas, options);
|
|
7224
|
+
canvas.strokeRect(half, half, width, height);
|
|
7225
|
+
canvas.restore();
|
|
7226
|
+
}
|
|
7227
|
+
else {
|
|
7228
|
+
canvas.strokeRect(half, half, width, height);
|
|
7229
|
+
}
|
|
7192
7230
|
break;
|
|
7193
7231
|
case 'outside':
|
|
7194
7232
|
canvas.strokeRect(-half, -half, width + __strokeWidth, height + __strokeWidth);
|
|
@@ -7216,11 +7254,14 @@ var LeaferUI = (function (exports) {
|
|
|
7216
7254
|
return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
|
|
7217
7255
|
}
|
|
7218
7256
|
get pen() {
|
|
7219
|
-
|
|
7257
|
+
const { path } = this.__;
|
|
7258
|
+
pen.set(this.path = path || []);
|
|
7259
|
+
if (!path)
|
|
7260
|
+
this.__drawPathByBox(pen);
|
|
7220
7261
|
return pen;
|
|
7221
7262
|
}
|
|
7222
7263
|
get editConfig() { return undefined; }
|
|
7223
|
-
get editOuter() { return 'EditTool'; }
|
|
7264
|
+
get editOuter() { return this.__.__isLinePath ? 'LineEditTool' : 'EditTool'; }
|
|
7224
7265
|
get editInner() { return 'PathEditor'; }
|
|
7225
7266
|
constructor(data) {
|
|
7226
7267
|
super(data);
|
|
@@ -7240,18 +7281,16 @@ var LeaferUI = (function (exports) {
|
|
|
7240
7281
|
getPath(curve, pathForRender) {
|
|
7241
7282
|
this.__layout.update();
|
|
7242
7283
|
let path = pathForRender ? this.__.__pathForRender : this.__.path;
|
|
7243
|
-
if (!path)
|
|
7244
|
-
|
|
7245
|
-
if (width || height) {
|
|
7246
|
-
pen.set(path = []);
|
|
7247
|
-
this.__drawPathByBox(pen);
|
|
7248
|
-
}
|
|
7249
|
-
}
|
|
7284
|
+
if (!path)
|
|
7285
|
+
pen.set(path = []), this.__drawPathByBox(pen);
|
|
7250
7286
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
7251
7287
|
}
|
|
7252
7288
|
getPathString(curve, pathForRender) {
|
|
7253
7289
|
return PathConvert.stringify(this.getPath(curve, pathForRender));
|
|
7254
7290
|
}
|
|
7291
|
+
load() {
|
|
7292
|
+
this.__.__computePaint();
|
|
7293
|
+
}
|
|
7255
7294
|
__onUpdateSize() {
|
|
7256
7295
|
if (this.__.__input) {
|
|
7257
7296
|
const data = this.__;
|
|
@@ -7337,7 +7376,7 @@ var LeaferUI = (function (exports) {
|
|
|
7337
7376
|
opacityType(1)
|
|
7338
7377
|
], exports.UI.prototype, "opacity", void 0);
|
|
7339
7378
|
__decorate([
|
|
7340
|
-
|
|
7379
|
+
visibleType(true)
|
|
7341
7380
|
], exports.UI.prototype, "visible", void 0);
|
|
7342
7381
|
__decorate([
|
|
7343
7382
|
stateType(false)
|
|
@@ -7354,9 +7393,6 @@ var LeaferUI = (function (exports) {
|
|
|
7354
7393
|
__decorate([
|
|
7355
7394
|
maskType(false)
|
|
7356
7395
|
], exports.UI.prototype, "mask", void 0);
|
|
7357
|
-
__decorate([
|
|
7358
|
-
surfaceType('pixel')
|
|
7359
|
-
], exports.UI.prototype, "maskType", void 0);
|
|
7360
7396
|
__decorate([
|
|
7361
7397
|
eraserType(false)
|
|
7362
7398
|
], exports.UI.prototype, "eraser", void 0);
|
|
@@ -7649,6 +7685,7 @@ var LeaferUI = (function (exports) {
|
|
|
7649
7685
|
get layoutLocked() { return !this.layouter.running; }
|
|
7650
7686
|
get FPS() { return this.renderer ? this.renderer.FPS : 60; }
|
|
7651
7687
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
7688
|
+
get clientBounds() { return this.canvas && this.canvas.getClientBounds(); }
|
|
7652
7689
|
constructor(userConfig, data) {
|
|
7653
7690
|
super(data);
|
|
7654
7691
|
this.config = {
|
|
@@ -7806,7 +7843,8 @@ var LeaferUI = (function (exports) {
|
|
|
7806
7843
|
this.__changeFill(newValue);
|
|
7807
7844
|
}
|
|
7808
7845
|
else if (attrName === 'hittable') {
|
|
7809
|
-
this.
|
|
7846
|
+
if (!this.parent)
|
|
7847
|
+
this.canvas.hittable = newValue;
|
|
7810
7848
|
}
|
|
7811
7849
|
}
|
|
7812
7850
|
return super.__setAttr(attrName, newValue);
|
|
@@ -7924,6 +7962,9 @@ var LeaferUI = (function (exports) {
|
|
|
7924
7962
|
zoom(_zoomType, _padding, _fixedScale) { return undefined; }
|
|
7925
7963
|
getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
|
|
7926
7964
|
getValidScale(changeScale) { return changeScale; }
|
|
7965
|
+
getWorldPointByClient(clientPoint, updateClient) {
|
|
7966
|
+
return this.interaction && this.interaction.getLocal(clientPoint, updateClient);
|
|
7967
|
+
}
|
|
7927
7968
|
__checkUpdateLayout() {
|
|
7928
7969
|
this.__layout.update();
|
|
7929
7970
|
}
|
|
@@ -8006,8 +8047,8 @@ var LeaferUI = (function (exports) {
|
|
|
8006
8047
|
|
|
8007
8048
|
const rect$1 = exports.Rect.prototype;
|
|
8008
8049
|
const group$1 = exports.Group.prototype;
|
|
8009
|
-
const
|
|
8010
|
-
const { copy: copy$3, add } = BoundsHelper;
|
|
8050
|
+
const childrenRenderBounds = {};
|
|
8051
|
+
const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
|
|
8011
8052
|
exports.Box = class Box extends exports.Group {
|
|
8012
8053
|
get __tag() { return 'Box'; }
|
|
8013
8054
|
get isBranchLeaf() { return true; }
|
|
@@ -8018,40 +8059,50 @@ var LeaferUI = (function (exports) {
|
|
|
8018
8059
|
__updateStrokeSpread() { return 0; }
|
|
8019
8060
|
__updateRectRenderSpread() { return 0; }
|
|
8020
8061
|
__updateRenderSpread() {
|
|
8021
|
-
|
|
8022
|
-
const hide = this.__.__drawAfterFill = this.__.overflow === 'hide';
|
|
8023
|
-
return (width || hide) ? width : -1;
|
|
8062
|
+
return this.__updateRectRenderSpread() || -1;
|
|
8024
8063
|
}
|
|
8025
8064
|
__updateRectBoxBounds() { }
|
|
8026
8065
|
__updateBoxBounds() {
|
|
8027
8066
|
const data = this.__;
|
|
8028
|
-
if (
|
|
8029
|
-
if (
|
|
8030
|
-
this.leafer.
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8067
|
+
if (this.children.length) {
|
|
8068
|
+
if (data.__autoSide) {
|
|
8069
|
+
if (this.leafer && this.leafer.ready)
|
|
8070
|
+
this.leafer.layouter.addExtra(this);
|
|
8071
|
+
super.__updateBoxBounds();
|
|
8072
|
+
if (!data.__autoSize) {
|
|
8073
|
+
const b = this.__layout.boxBounds;
|
|
8074
|
+
if (!data.__autoWidth)
|
|
8075
|
+
b.x = 0, b.width = data.width;
|
|
8076
|
+
if (!data.__autoHeight)
|
|
8077
|
+
b.y = 0, b.height = data.height;
|
|
8078
|
+
}
|
|
8079
|
+
}
|
|
8080
|
+
else {
|
|
8081
|
+
this.__updateRectBoxBounds();
|
|
8038
8082
|
}
|
|
8083
|
+
if (data.flow)
|
|
8084
|
+
this.__updateContentBounds();
|
|
8039
8085
|
}
|
|
8040
8086
|
else {
|
|
8041
8087
|
this.__updateRectBoxBounds();
|
|
8042
8088
|
}
|
|
8043
|
-
if (data.flow)
|
|
8044
|
-
this.__updateContentBounds();
|
|
8045
8089
|
}
|
|
8046
8090
|
__updateStrokeBounds() { }
|
|
8047
8091
|
__updateRenderBounds() {
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
copy$3(bounds$1, renderBounds);
|
|
8092
|
+
let isOverflow;
|
|
8093
|
+
const { renderBounds } = this.__layout;
|
|
8094
|
+
if (this.children.length) {
|
|
8052
8095
|
super.__updateRenderBounds();
|
|
8053
|
-
|
|
8096
|
+
copy$3(childrenRenderBounds, renderBounds);
|
|
8097
|
+
this.__updateRectRenderBounds();
|
|
8098
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds) || undefined;
|
|
8099
|
+
}
|
|
8100
|
+
else {
|
|
8101
|
+
this.__updateRectRenderBounds();
|
|
8054
8102
|
}
|
|
8103
|
+
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8104
|
+
if (isOverflow && !(this.__.__drawAfterFill = this.__.overflow === 'hide'))
|
|
8105
|
+
add(renderBounds, childrenRenderBounds);
|
|
8055
8106
|
}
|
|
8056
8107
|
__updateRectRenderBounds() { }
|
|
8057
8108
|
__updateRectChange() { }
|
|
@@ -8067,16 +8118,27 @@ var LeaferUI = (function (exports) {
|
|
|
8067
8118
|
}
|
|
8068
8119
|
else {
|
|
8069
8120
|
this.__renderRect(canvas, options);
|
|
8070
|
-
this.
|
|
8121
|
+
if (this.children.length)
|
|
8122
|
+
this.__renderGroup(canvas, options);
|
|
8071
8123
|
}
|
|
8072
8124
|
}
|
|
8073
8125
|
__drawAfterFill(canvas, options) {
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8126
|
+
const { length } = this.children;
|
|
8127
|
+
if (this.isOverflow) {
|
|
8128
|
+
canvas.save();
|
|
8129
|
+
canvas.clip();
|
|
8130
|
+
if (length)
|
|
8131
|
+
this.__renderGroup(canvas, options);
|
|
8132
|
+
canvas.restore();
|
|
8133
|
+
}
|
|
8134
|
+
else {
|
|
8135
|
+
if (length)
|
|
8136
|
+
this.__renderGroup(canvas, options);
|
|
8137
|
+
}
|
|
8138
|
+
if (this.__.stroke && length) {
|
|
8139
|
+
canvas.setWorld(this.__nowWorld);
|
|
8079
8140
|
this.__drawRenderPath(canvas);
|
|
8141
|
+
}
|
|
8080
8142
|
}
|
|
8081
8143
|
};
|
|
8082
8144
|
__decorate([
|
|
@@ -8214,9 +8276,10 @@ var LeaferUI = (function (exports) {
|
|
|
8214
8276
|
super(data);
|
|
8215
8277
|
}
|
|
8216
8278
|
__updatePath() {
|
|
8217
|
-
const
|
|
8218
|
-
|
|
8219
|
-
|
|
8279
|
+
const data = this.__;
|
|
8280
|
+
const path = data.path = [];
|
|
8281
|
+
if (data.points) {
|
|
8282
|
+
drawPoints$1(path, data.points, false, data.closed);
|
|
8220
8283
|
}
|
|
8221
8284
|
else {
|
|
8222
8285
|
moveTo$2(path, 0, 0);
|
|
@@ -8586,7 +8649,7 @@ var LeaferUI = (function (exports) {
|
|
|
8586
8649
|
boundsType(0)
|
|
8587
8650
|
], exports.Text.prototype, "letterSpacing", void 0);
|
|
8588
8651
|
__decorate([
|
|
8589
|
-
boundsType({ type: 'percent', value:
|
|
8652
|
+
boundsType({ type: 'percent', value: 1.5 })
|
|
8590
8653
|
], exports.Text.prototype, "lineHeight", void 0);
|
|
8591
8654
|
__decorate([
|
|
8592
8655
|
boundsType(0)
|
|
@@ -8680,8 +8743,6 @@ var LeaferUI = (function (exports) {
|
|
|
8680
8743
|
};
|
|
8681
8744
|
}
|
|
8682
8745
|
|
|
8683
|
-
const version = "1.0.0-rc.23";
|
|
8684
|
-
|
|
8685
8746
|
exports.App = class App extends exports.Leafer {
|
|
8686
8747
|
get __tag() { return 'App'; }
|
|
8687
8748
|
get isApp() { return true; }
|
|
@@ -9781,8 +9842,8 @@ var LeaferUI = (function (exports) {
|
|
|
9781
9842
|
}
|
|
9782
9843
|
tap(data) {
|
|
9783
9844
|
const { pointer } = this.config;
|
|
9784
|
-
const
|
|
9785
|
-
if (!pointer.tapMore &&
|
|
9845
|
+
const hasLong = this.longTap(data);
|
|
9846
|
+
if (!pointer.tapMore && hasLong)
|
|
9786
9847
|
return;
|
|
9787
9848
|
if (!this.waitTap)
|
|
9788
9849
|
return;
|
|
@@ -9904,6 +9965,10 @@ var LeaferUI = (function (exports) {
|
|
|
9904
9965
|
setCursor(cursor) {
|
|
9905
9966
|
this.cursor = cursor;
|
|
9906
9967
|
}
|
|
9968
|
+
getLocal(clientPoint, updateClient) {
|
|
9969
|
+
const clientBounds = this.canvas.getClientBounds(updateClient);
|
|
9970
|
+
return { x: clientPoint.clientX - clientBounds.x, y: clientPoint.clientY - clientBounds.y };
|
|
9971
|
+
}
|
|
9907
9972
|
emitTap(data) {
|
|
9908
9973
|
this.emit(exports.PointerEvent.TAP, data);
|
|
9909
9974
|
this.emit(exports.PointerEvent.CLICK, data);
|
|
@@ -9933,14 +9998,14 @@ var LeaferUI = (function (exports) {
|
|
|
9933
9998
|
}, this.config.pointer.longPressTime);
|
|
9934
9999
|
}
|
|
9935
10000
|
longTap(data) {
|
|
9936
|
-
let
|
|
10001
|
+
let hasLong;
|
|
9937
10002
|
if (this.longPressed) {
|
|
9938
10003
|
this.emit(exports.PointerEvent.LONG_TAP, data);
|
|
9939
|
-
if (pathHasEventType(data.path, exports.PointerEvent.LONG_TAP))
|
|
9940
|
-
|
|
10004
|
+
if (pathHasEventType(data.path, exports.PointerEvent.LONG_TAP) || pathHasEventType(data.path, exports.PointerEvent.LONG_PRESS))
|
|
10005
|
+
hasLong = true;
|
|
9941
10006
|
}
|
|
9942
10007
|
this.longPressWaitCancel();
|
|
9943
|
-
return
|
|
10008
|
+
return hasLong;
|
|
9944
10009
|
}
|
|
9945
10010
|
longPressWaitCancel() {
|
|
9946
10011
|
clearTimeout(this.longPressTimer);
|
|
@@ -10298,12 +10363,6 @@ var LeaferUI = (function (exports) {
|
|
|
10298
10363
|
this.windowEvents = {};
|
|
10299
10364
|
}
|
|
10300
10365
|
}
|
|
10301
|
-
getLocal(p, updateClient) {
|
|
10302
|
-
if (updateClient)
|
|
10303
|
-
this.canvas.updateClientBounds();
|
|
10304
|
-
const { clientBounds } = this.canvas;
|
|
10305
|
-
return { x: p.clientX - clientBounds.x, y: p.clientY - clientBounds.y };
|
|
10306
|
-
}
|
|
10307
10366
|
getTouches(touches) {
|
|
10308
10367
|
const list = [];
|
|
10309
10368
|
for (let i = 0, len = touches.length; i < len; i++) {
|
|
@@ -11191,13 +11250,14 @@ var LeaferUI = (function (exports) {
|
|
|
11191
11250
|
recycleImage
|
|
11192
11251
|
};
|
|
11193
11252
|
|
|
11194
|
-
const
|
|
11195
|
-
const
|
|
11253
|
+
const { toPoint: toPoint$2 } = AroundHelper;
|
|
11254
|
+
const realFrom$2 = {};
|
|
11255
|
+
const realTo$2 = {};
|
|
11196
11256
|
function linearGradient(paint, box) {
|
|
11197
11257
|
let { from, to, type, blendMode, opacity } = paint;
|
|
11198
|
-
from ||
|
|
11199
|
-
to ||
|
|
11200
|
-
const style = Platform.canvas.createLinearGradient(
|
|
11258
|
+
toPoint$2(from || 'top', box, realFrom$2);
|
|
11259
|
+
toPoint$2(to || 'bottom', box, realTo$2);
|
|
11260
|
+
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
11201
11261
|
applyStops(style, paint.stops, opacity);
|
|
11202
11262
|
const data = { type, style };
|
|
11203
11263
|
if (blendMode)
|
|
@@ -11208,23 +11268,25 @@ var LeaferUI = (function (exports) {
|
|
|
11208
11268
|
let stop;
|
|
11209
11269
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
11210
11270
|
stop = stops[i];
|
|
11211
|
-
|
|
11271
|
+
if (typeof stop === 'string') {
|
|
11272
|
+
gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
|
|
11273
|
+
}
|
|
11274
|
+
else {
|
|
11275
|
+
gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
|
|
11276
|
+
}
|
|
11212
11277
|
}
|
|
11213
11278
|
}
|
|
11214
11279
|
|
|
11215
|
-
const {
|
|
11280
|
+
const { getAngle: getAngle$1, getDistance: getDistance$1 } = PointHelper;
|
|
11216
11281
|
const { get: get$1, rotateOfOuter: rotateOfOuter$1, scaleOfOuter: scaleOfOuter$1 } = MatrixHelper;
|
|
11217
|
-
const
|
|
11218
|
-
const defaultTo$1 = { x: 0.5, y: 1 };
|
|
11282
|
+
const { toPoint: toPoint$1 } = AroundHelper;
|
|
11219
11283
|
const realFrom$1 = {};
|
|
11220
11284
|
const realTo$1 = {};
|
|
11221
11285
|
function radialGradient(paint, box) {
|
|
11222
11286
|
let { from, to, type, opacity, blendMode, stretch } = paint;
|
|
11223
|
-
from ||
|
|
11224
|
-
to ||
|
|
11225
|
-
const {
|
|
11226
|
-
set$1(realFrom$1, x + from.x * width, y + from.y * height);
|
|
11227
|
-
set$1(realTo$1, x + to.x * width, y + to.y * height);
|
|
11287
|
+
toPoint$1(from || 'center', box, realFrom$1);
|
|
11288
|
+
toPoint$1(to || 'bottom', box, realTo$1);
|
|
11289
|
+
const { width, height } = box;
|
|
11228
11290
|
let transform;
|
|
11229
11291
|
if (width !== height || stretch) {
|
|
11230
11292
|
transform = get$1();
|
|
@@ -11239,19 +11301,16 @@ var LeaferUI = (function (exports) {
|
|
|
11239
11301
|
return data;
|
|
11240
11302
|
}
|
|
11241
11303
|
|
|
11242
|
-
const {
|
|
11304
|
+
const { getAngle, getDistance } = PointHelper;
|
|
11243
11305
|
const { get, rotateOfOuter, scaleOfOuter } = MatrixHelper;
|
|
11244
|
-
const
|
|
11245
|
-
const defaultTo = { x: 0.5, y: 1 };
|
|
11306
|
+
const { toPoint } = AroundHelper;
|
|
11246
11307
|
const realFrom = {};
|
|
11247
11308
|
const realTo = {};
|
|
11248
11309
|
function conicGradient(paint, box) {
|
|
11249
11310
|
let { from, to, type, opacity, blendMode, stretch } = paint;
|
|
11250
|
-
from ||
|
|
11251
|
-
to ||
|
|
11252
|
-
const {
|
|
11253
|
-
set(realFrom, x + from.x * width, y + from.y * height);
|
|
11254
|
-
set(realTo, x + to.x * width, y + to.y * height);
|
|
11311
|
+
toPoint(from || 'center', box, realFrom);
|
|
11312
|
+
toPoint(to || 'bottom', box, realTo);
|
|
11313
|
+
const { width, height } = box;
|
|
11255
11314
|
const transform = get();
|
|
11256
11315
|
const angle = getAngle(realFrom, realTo);
|
|
11257
11316
|
if (Platform.conicGradientRotate90) {
|
|
@@ -11405,7 +11464,7 @@ var LeaferUI = (function (exports) {
|
|
|
11405
11464
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
|
|
11406
11465
|
maskCanvas = contentCanvas = null;
|
|
11407
11466
|
}
|
|
11408
|
-
if (child.__.
|
|
11467
|
+
if (child.__.mask === 'path') {
|
|
11409
11468
|
if (child.opacity < 1) {
|
|
11410
11469
|
currentMask = 'opacity-path';
|
|
11411
11470
|
maskOpacity = child.opacity;
|
|
@@ -11426,7 +11485,7 @@ var LeaferUI = (function (exports) {
|
|
|
11426
11485
|
contentCanvas = getCanvas(canvas);
|
|
11427
11486
|
child.__render(maskCanvas, options);
|
|
11428
11487
|
}
|
|
11429
|
-
if (child.__.
|
|
11488
|
+
if (child.__.mask !== 'clipping')
|
|
11430
11489
|
continue;
|
|
11431
11490
|
}
|
|
11432
11491
|
if (excludeRenderBounds(child, options))
|
|
@@ -11727,11 +11786,11 @@ var LeaferUI = (function (exports) {
|
|
|
11727
11786
|
if (mode === WordMode) {
|
|
11728
11787
|
wordChar = { char: '', x: charX };
|
|
11729
11788
|
charX = toWordChar(word.data, charX, wordChar);
|
|
11730
|
-
if (wordChar.char !== ' ')
|
|
11789
|
+
if (row.isOverflow || wordChar.char !== ' ')
|
|
11731
11790
|
row.data.push(wordChar);
|
|
11732
11791
|
}
|
|
11733
11792
|
else {
|
|
11734
|
-
charX = toChar(word.data, charX, row.data);
|
|
11793
|
+
charX = toChar(word.data, charX, row.data, row.isOverflow);
|
|
11735
11794
|
}
|
|
11736
11795
|
if (!row.paraEnd && addWordWidth) {
|
|
11737
11796
|
charX += addWordWidth;
|
|
@@ -11758,9 +11817,9 @@ var LeaferUI = (function (exports) {
|
|
|
11758
11817
|
});
|
|
11759
11818
|
return charX;
|
|
11760
11819
|
}
|
|
11761
|
-
function toChar(data, charX, rowData) {
|
|
11820
|
+
function toChar(data, charX, rowData, isOverflow) {
|
|
11762
11821
|
data.forEach(char => {
|
|
11763
|
-
if (char.char !== ' ') {
|
|
11822
|
+
if (isOverflow || char.char !== ' ') {
|
|
11764
11823
|
char.x = charX;
|
|
11765
11824
|
rowData.push(char);
|
|
11766
11825
|
}
|
|
@@ -11792,12 +11851,14 @@ var LeaferUI = (function (exports) {
|
|
|
11792
11851
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
11793
11852
|
row = rows[i];
|
|
11794
11853
|
row.x = x;
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
11800
|
-
|
|
11854
|
+
if (row.width < width || (row.width > width && !__clipText)) {
|
|
11855
|
+
switch (textAlign) {
|
|
11856
|
+
case 'center':
|
|
11857
|
+
row.x += (width - row.width) / 2;
|
|
11858
|
+
break;
|
|
11859
|
+
case 'right':
|
|
11860
|
+
row.x += width - row.width;
|
|
11861
|
+
}
|
|
11801
11862
|
}
|
|
11802
11863
|
if (row.paraStart && paraSpacing && i > 0)
|
|
11803
11864
|
starY += paraSpacing;
|
|
@@ -12293,6 +12354,7 @@ var LeaferUI = (function (exports) {
|
|
|
12293
12354
|
exports.getMatrixData = getMatrixData;
|
|
12294
12355
|
exports.getPointData = getPointData;
|
|
12295
12356
|
exports.hitType = hitType;
|
|
12357
|
+
exports.inviteCode = inviteCode;
|
|
12296
12358
|
exports.layoutProcessor = layoutProcessor;
|
|
12297
12359
|
exports.maskType = maskType;
|
|
12298
12360
|
exports.naturalBoundsType = naturalBoundsType;
|
|
@@ -12318,6 +12380,7 @@ var LeaferUI = (function (exports) {
|
|
|
12318
12380
|
exports.useCanvas = useCanvas;
|
|
12319
12381
|
exports.useModule = useModule;
|
|
12320
12382
|
exports.version = version;
|
|
12383
|
+
exports.visibleType = visibleType;
|
|
12321
12384
|
exports.zoomLayerType = zoomLayerType;
|
|
12322
12385
|
|
|
12323
12386
|
return exports;
|