@leafer/core 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core.cjs +64 -27
- package/lib/core.esm.js +64 -27
- package/lib/core.esm.min.js +1 -1
- package/lib/core.min.cjs +1 -1
- package/package.json +18 -18
- package/src/index.ts +1 -1
package/lib/core.cjs
CHANGED
|
@@ -113,6 +113,19 @@ const MathHelper = {
|
|
|
113
113
|
const a = maxLength ? pow$1(10, maxLength) : 1000000000000;
|
|
114
114
|
num = round(num * a) / a;
|
|
115
115
|
return num === -0 ? 0 : num;
|
|
116
|
+
},
|
|
117
|
+
getScaleData(scale, size, originSize, scaleData) {
|
|
118
|
+
if (!scaleData)
|
|
119
|
+
scaleData = {};
|
|
120
|
+
if (size) {
|
|
121
|
+
scaleData.scaleX = (typeof size === 'number' ? size : size.width) / originSize.width;
|
|
122
|
+
scaleData.scaleY = (typeof size === 'number' ? size : size.height) / originSize.height;
|
|
123
|
+
}
|
|
124
|
+
else if (scale) {
|
|
125
|
+
scaleData.scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
126
|
+
scaleData.scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
127
|
+
}
|
|
128
|
+
return scaleData;
|
|
116
129
|
}
|
|
117
130
|
};
|
|
118
131
|
const OneRadian = PI$2 / 180;
|
|
@@ -411,7 +424,7 @@ const MatrixHelper = {
|
|
|
411
424
|
};
|
|
412
425
|
const M$6 = MatrixHelper;
|
|
413
426
|
|
|
414
|
-
const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$
|
|
427
|
+
const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3 } = MatrixHelper;
|
|
415
428
|
const { sin: sin$2, cos: cos$2, abs: abs$2, sqrt: sqrt$2, atan2: atan2$2, min: min$1, PI: PI$1 } = Math;
|
|
416
429
|
const PointHelper = {
|
|
417
430
|
defaultPoint: getPointData(),
|
|
@@ -467,7 +480,7 @@ const PointHelper = {
|
|
|
467
480
|
tempToOuterOf(t, matrix) {
|
|
468
481
|
const { tempPoint: temp } = P$5;
|
|
469
482
|
copy$7(temp, t);
|
|
470
|
-
toOuterPoint$
|
|
483
|
+
toOuterPoint$3(matrix, temp, temp);
|
|
471
484
|
return temp;
|
|
472
485
|
},
|
|
473
486
|
tempToInnerRadiusPointOf(t, matrix) {
|
|
@@ -486,7 +499,7 @@ const PointHelper = {
|
|
|
486
499
|
toInnerPoint$2(matrix, t, to);
|
|
487
500
|
},
|
|
488
501
|
toOuterOf(t, matrix, to) {
|
|
489
|
-
toOuterPoint$
|
|
502
|
+
toOuterPoint$3(matrix, t, to);
|
|
490
503
|
},
|
|
491
504
|
getCenter(t, to) {
|
|
492
505
|
return { x: t.x + (to.x - t.x) / 2, y: t.y + (to.y - t.y) / 2 };
|
|
@@ -766,7 +779,7 @@ const TwoPointBoundsHelper = {
|
|
|
766
779
|
const { addPoint: addPoint$3 } = TwoPointBoundsHelper;
|
|
767
780
|
|
|
768
781
|
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2 } = TwoPointBoundsHelper;
|
|
769
|
-
const { toOuterPoint: toOuterPoint$
|
|
782
|
+
const { toOuterPoint: toOuterPoint$2 } = MatrixHelper;
|
|
770
783
|
const { float, fourNumber } = MathHelper;
|
|
771
784
|
const { floor, ceil: ceil$1 } = Math;
|
|
772
785
|
let right, bottom, boundsRight, boundsBottom;
|
|
@@ -786,17 +799,24 @@ const BoundsHelper = {
|
|
|
786
799
|
t.width = bounds.width;
|
|
787
800
|
t.height = bounds.height;
|
|
788
801
|
},
|
|
789
|
-
copyAndSpread(t, bounds, spread, isShrink) {
|
|
802
|
+
copyAndSpread(t, bounds, spread, isShrink, side) {
|
|
803
|
+
const { x, y, width, height } = bounds;
|
|
790
804
|
if (spread instanceof Array) {
|
|
791
805
|
const four = fourNumber(spread);
|
|
792
806
|
isShrink
|
|
793
|
-
? B.set(t,
|
|
794
|
-
: B.set(t,
|
|
807
|
+
? B.set(t, x + four[3], y + four[0], width - four[1] - four[3], height - four[2] - four[0])
|
|
808
|
+
: B.set(t, x - four[3], y - four[0], width + four[1] + four[3], height + four[2] + four[0]);
|
|
795
809
|
}
|
|
796
810
|
else {
|
|
797
811
|
if (isShrink)
|
|
798
812
|
spread = -spread;
|
|
799
|
-
B.set(t,
|
|
813
|
+
B.set(t, x - spread, y - spread, width + spread * 2, height + spread * 2);
|
|
814
|
+
}
|
|
815
|
+
if (side) {
|
|
816
|
+
if (side === 'width')
|
|
817
|
+
t.y = y, t.height = height;
|
|
818
|
+
else
|
|
819
|
+
t.x = x, t.width = width;
|
|
800
820
|
}
|
|
801
821
|
},
|
|
802
822
|
minX(t) { return t.width > 0 ? t.x : t.x + t.width; },
|
|
@@ -873,16 +893,16 @@ const BoundsHelper = {
|
|
|
873
893
|
else {
|
|
874
894
|
point.x = t.x;
|
|
875
895
|
point.y = t.y;
|
|
876
|
-
toOuterPoint$
|
|
896
|
+
toOuterPoint$2(matrix, point, toPoint$2);
|
|
877
897
|
setPoint$2(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
878
898
|
point.x = t.x + t.width;
|
|
879
|
-
toOuterPoint$
|
|
899
|
+
toOuterPoint$2(matrix, point, toPoint$2);
|
|
880
900
|
addPoint$2(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
881
901
|
point.y = t.y + t.height;
|
|
882
|
-
toOuterPoint$
|
|
902
|
+
toOuterPoint$2(matrix, point, toPoint$2);
|
|
883
903
|
addPoint$2(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
884
904
|
point.x = t.x;
|
|
885
|
-
toOuterPoint$
|
|
905
|
+
toOuterPoint$2(matrix, point, toPoint$2);
|
|
886
906
|
addPoint$2(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
887
907
|
toBounds$2(tempPointBounds$1, to);
|
|
888
908
|
}
|
|
@@ -896,16 +916,16 @@ const BoundsHelper = {
|
|
|
896
916
|
const scale = Math.min(baseScale, Math.min(t.width / put.width, t.height / put.height));
|
|
897
917
|
return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
|
|
898
918
|
},
|
|
899
|
-
getSpread(t, spread) {
|
|
919
|
+
getSpread(t, spread, side) {
|
|
900
920
|
const n = {};
|
|
901
|
-
B.copyAndSpread(n, t, spread);
|
|
921
|
+
B.copyAndSpread(n, t, spread, false, side);
|
|
902
922
|
return n;
|
|
903
923
|
},
|
|
904
|
-
spread(t, spread) {
|
|
905
|
-
B.copyAndSpread(t, t, spread);
|
|
924
|
+
spread(t, spread, side) {
|
|
925
|
+
B.copyAndSpread(t, t, spread, false, side);
|
|
906
926
|
},
|
|
907
|
-
shrink(t, shrink) {
|
|
908
|
-
B.copyAndSpread(t, t, shrink, true);
|
|
927
|
+
shrink(t, shrink, side) {
|
|
928
|
+
B.copyAndSpread(t, t, shrink, true, side);
|
|
909
929
|
},
|
|
910
930
|
ceil(t) {
|
|
911
931
|
const { x, y } = t;
|
|
@@ -1088,12 +1108,12 @@ class Bounds {
|
|
|
1088
1108
|
getFitMatrix(put, baseScale) {
|
|
1089
1109
|
return BoundsHelper.getFitMatrix(this, put, baseScale);
|
|
1090
1110
|
}
|
|
1091
|
-
spread(fourNumber) {
|
|
1092
|
-
BoundsHelper.spread(this, fourNumber);
|
|
1111
|
+
spread(fourNumber, side) {
|
|
1112
|
+
BoundsHelper.spread(this, fourNumber, side);
|
|
1093
1113
|
return this;
|
|
1094
1114
|
}
|
|
1095
|
-
shrink(fourNumber) {
|
|
1096
|
-
BoundsHelper.shrink(this, fourNumber);
|
|
1115
|
+
shrink(fourNumber, side) {
|
|
1116
|
+
BoundsHelper.shrink(this, fourNumber, side);
|
|
1097
1117
|
return this;
|
|
1098
1118
|
}
|
|
1099
1119
|
ceil() {
|
|
@@ -2910,60 +2930,75 @@ class PathCreator {
|
|
|
2910
2930
|
}
|
|
2911
2931
|
beginPath() {
|
|
2912
2932
|
beginPath(this.__path);
|
|
2933
|
+
this.paint();
|
|
2913
2934
|
return this;
|
|
2914
2935
|
}
|
|
2915
2936
|
moveTo(x, y) {
|
|
2916
2937
|
moveTo(this.__path, x, y);
|
|
2938
|
+
this.paint();
|
|
2917
2939
|
return this;
|
|
2918
2940
|
}
|
|
2919
2941
|
lineTo(x, y) {
|
|
2920
2942
|
lineTo(this.__path, x, y);
|
|
2943
|
+
this.paint();
|
|
2921
2944
|
return this;
|
|
2922
2945
|
}
|
|
2923
2946
|
bezierCurveTo(x1, y1, x2, y2, x, y) {
|
|
2924
2947
|
bezierCurveTo(this.__path, x1, y1, x2, y2, x, y);
|
|
2948
|
+
this.paint();
|
|
2925
2949
|
return this;
|
|
2926
2950
|
}
|
|
2927
2951
|
quadraticCurveTo(x1, y1, x, y) {
|
|
2928
2952
|
quadraticCurveTo(this.__path, x1, y1, x, y);
|
|
2953
|
+
this.paint();
|
|
2929
2954
|
return this;
|
|
2930
2955
|
}
|
|
2931
2956
|
closePath() {
|
|
2932
2957
|
closePath(this.__path);
|
|
2958
|
+
this.paint();
|
|
2933
2959
|
return this;
|
|
2934
2960
|
}
|
|
2935
2961
|
rect(x, y, width, height) {
|
|
2936
2962
|
rect(this.__path, x, y, width, height);
|
|
2963
|
+
this.paint();
|
|
2937
2964
|
return this;
|
|
2938
2965
|
}
|
|
2939
2966
|
roundRect(x, y, width, height, cornerRadius) {
|
|
2940
2967
|
roundRect$1(this.__path, x, y, width, height, cornerRadius);
|
|
2968
|
+
this.paint();
|
|
2941
2969
|
return this;
|
|
2942
2970
|
}
|
|
2943
2971
|
ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
2944
2972
|
ellipse$1(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
|
|
2973
|
+
this.paint();
|
|
2945
2974
|
return this;
|
|
2946
2975
|
}
|
|
2947
2976
|
arc(x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
2948
2977
|
arc$1(this.__path, x, y, radius, startAngle, endAngle, anticlockwise);
|
|
2978
|
+
this.paint();
|
|
2949
2979
|
return this;
|
|
2950
2980
|
}
|
|
2951
2981
|
arcTo(x1, y1, x2, y2, radius) {
|
|
2952
2982
|
arcTo$2(this.__path, x1, y1, x2, y2, radius);
|
|
2983
|
+
this.paint();
|
|
2953
2984
|
return this;
|
|
2954
2985
|
}
|
|
2955
2986
|
drawEllipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
2956
2987
|
drawEllipse(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
|
|
2988
|
+
this.paint();
|
|
2957
2989
|
return this;
|
|
2958
2990
|
}
|
|
2959
2991
|
drawArc(x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
2960
2992
|
drawArc(this.__path, x, y, radius, startAngle, endAngle, anticlockwise);
|
|
2993
|
+
this.paint();
|
|
2961
2994
|
return this;
|
|
2962
2995
|
}
|
|
2963
2996
|
drawPoints(points, curve, close) {
|
|
2964
2997
|
drawPoints(this.__path, points, curve, close);
|
|
2998
|
+
this.paint();
|
|
2965
2999
|
return this;
|
|
2966
3000
|
}
|
|
3001
|
+
paint() { }
|
|
2967
3002
|
}
|
|
2968
3003
|
|
|
2969
3004
|
const { M: M$2, L: L$3, C: C$2, Q: Q$1, Z: Z$2, N: N$1, D: D$1, X: X$1, G: G$1, F: F$2, O: O$1, P: P$1, U: U$1 } = PathCommandMap;
|
|
@@ -3985,7 +4020,7 @@ function registerUIEvent() {
|
|
|
3985
4020
|
};
|
|
3986
4021
|
}
|
|
3987
4022
|
|
|
3988
|
-
const { copy: copy$3, toInnerPoint: toInnerPoint$1, scaleOfOuter, rotateOfOuter, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
|
|
4023
|
+
const { copy: copy$3, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter, rotateOfOuter, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
|
|
3989
4024
|
const matrix = {};
|
|
3990
4025
|
const LeafHelper = {
|
|
3991
4026
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
@@ -4050,10 +4085,9 @@ const LeafHelper = {
|
|
|
4050
4085
|
}
|
|
4051
4086
|
return true;
|
|
4052
4087
|
},
|
|
4053
|
-
moveWorld(t, x, y = 0) {
|
|
4088
|
+
moveWorld(t, x, y = 0, isInnerPoint) {
|
|
4054
4089
|
const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
|
|
4055
|
-
|
|
4056
|
-
toInnerPoint$1(t.parent.worldTransform, local, local, true);
|
|
4090
|
+
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : (t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true));
|
|
4057
4091
|
L.moveLocal(t, local.x, local.y);
|
|
4058
4092
|
},
|
|
4059
4093
|
moveLocal(t, x, y = 0) {
|
|
@@ -5021,7 +5055,7 @@ const LeafBounds = {
|
|
|
5021
5055
|
updateAllMatrix(this);
|
|
5022
5056
|
updateBounds(this, this);
|
|
5023
5057
|
if (this.__.__autoSide)
|
|
5024
|
-
this.__updateBoxBounds();
|
|
5058
|
+
this.__updateBoxBounds(true);
|
|
5025
5059
|
}
|
|
5026
5060
|
else {
|
|
5027
5061
|
updateAllMatrix(this);
|
|
@@ -5403,6 +5437,9 @@ exports.Leaf = class Leaf {
|
|
|
5403
5437
|
move(x, y) {
|
|
5404
5438
|
moveLocal(this, x, y);
|
|
5405
5439
|
}
|
|
5440
|
+
moveInner(x, y) {
|
|
5441
|
+
moveWorld(this, x, y, true);
|
|
5442
|
+
}
|
|
5406
5443
|
scaleOf(origin, scaleX, scaleY, resize) {
|
|
5407
5444
|
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
|
|
5408
5445
|
}
|
package/lib/core.esm.js
CHANGED
|
@@ -111,6 +111,19 @@ const MathHelper = {
|
|
|
111
111
|
const a = maxLength ? pow$1(10, maxLength) : 1000000000000;
|
|
112
112
|
num = round(num * a) / a;
|
|
113
113
|
return num === -0 ? 0 : num;
|
|
114
|
+
},
|
|
115
|
+
getScaleData(scale, size, originSize, scaleData) {
|
|
116
|
+
if (!scaleData)
|
|
117
|
+
scaleData = {};
|
|
118
|
+
if (size) {
|
|
119
|
+
scaleData.scaleX = (typeof size === 'number' ? size : size.width) / originSize.width;
|
|
120
|
+
scaleData.scaleY = (typeof size === 'number' ? size : size.height) / originSize.height;
|
|
121
|
+
}
|
|
122
|
+
else if (scale) {
|
|
123
|
+
scaleData.scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
124
|
+
scaleData.scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
125
|
+
}
|
|
126
|
+
return scaleData;
|
|
114
127
|
}
|
|
115
128
|
};
|
|
116
129
|
const OneRadian = PI$2 / 180;
|
|
@@ -409,7 +422,7 @@ const MatrixHelper = {
|
|
|
409
422
|
};
|
|
410
423
|
const M$6 = MatrixHelper;
|
|
411
424
|
|
|
412
|
-
const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$
|
|
425
|
+
const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3 } = MatrixHelper;
|
|
413
426
|
const { sin: sin$2, cos: cos$2, abs: abs$2, sqrt: sqrt$2, atan2: atan2$2, min: min$1, PI: PI$1 } = Math;
|
|
414
427
|
const PointHelper = {
|
|
415
428
|
defaultPoint: getPointData(),
|
|
@@ -465,7 +478,7 @@ const PointHelper = {
|
|
|
465
478
|
tempToOuterOf(t, matrix) {
|
|
466
479
|
const { tempPoint: temp } = P$5;
|
|
467
480
|
copy$7(temp, t);
|
|
468
|
-
toOuterPoint$
|
|
481
|
+
toOuterPoint$3(matrix, temp, temp);
|
|
469
482
|
return temp;
|
|
470
483
|
},
|
|
471
484
|
tempToInnerRadiusPointOf(t, matrix) {
|
|
@@ -484,7 +497,7 @@ const PointHelper = {
|
|
|
484
497
|
toInnerPoint$2(matrix, t, to);
|
|
485
498
|
},
|
|
486
499
|
toOuterOf(t, matrix, to) {
|
|
487
|
-
toOuterPoint$
|
|
500
|
+
toOuterPoint$3(matrix, t, to);
|
|
488
501
|
},
|
|
489
502
|
getCenter(t, to) {
|
|
490
503
|
return { x: t.x + (to.x - t.x) / 2, y: t.y + (to.y - t.y) / 2 };
|
|
@@ -764,7 +777,7 @@ const TwoPointBoundsHelper = {
|
|
|
764
777
|
const { addPoint: addPoint$3 } = TwoPointBoundsHelper;
|
|
765
778
|
|
|
766
779
|
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2 } = TwoPointBoundsHelper;
|
|
767
|
-
const { toOuterPoint: toOuterPoint$
|
|
780
|
+
const { toOuterPoint: toOuterPoint$2 } = MatrixHelper;
|
|
768
781
|
const { float, fourNumber } = MathHelper;
|
|
769
782
|
const { floor, ceil: ceil$1 } = Math;
|
|
770
783
|
let right, bottom, boundsRight, boundsBottom;
|
|
@@ -784,17 +797,24 @@ const BoundsHelper = {
|
|
|
784
797
|
t.width = bounds.width;
|
|
785
798
|
t.height = bounds.height;
|
|
786
799
|
},
|
|
787
|
-
copyAndSpread(t, bounds, spread, isShrink) {
|
|
800
|
+
copyAndSpread(t, bounds, spread, isShrink, side) {
|
|
801
|
+
const { x, y, width, height } = bounds;
|
|
788
802
|
if (spread instanceof Array) {
|
|
789
803
|
const four = fourNumber(spread);
|
|
790
804
|
isShrink
|
|
791
|
-
? B.set(t,
|
|
792
|
-
: B.set(t,
|
|
805
|
+
? B.set(t, x + four[3], y + four[0], width - four[1] - four[3], height - four[2] - four[0])
|
|
806
|
+
: B.set(t, x - four[3], y - four[0], width + four[1] + four[3], height + four[2] + four[0]);
|
|
793
807
|
}
|
|
794
808
|
else {
|
|
795
809
|
if (isShrink)
|
|
796
810
|
spread = -spread;
|
|
797
|
-
B.set(t,
|
|
811
|
+
B.set(t, x - spread, y - spread, width + spread * 2, height + spread * 2);
|
|
812
|
+
}
|
|
813
|
+
if (side) {
|
|
814
|
+
if (side === 'width')
|
|
815
|
+
t.y = y, t.height = height;
|
|
816
|
+
else
|
|
817
|
+
t.x = x, t.width = width;
|
|
798
818
|
}
|
|
799
819
|
},
|
|
800
820
|
minX(t) { return t.width > 0 ? t.x : t.x + t.width; },
|
|
@@ -871,16 +891,16 @@ const BoundsHelper = {
|
|
|
871
891
|
else {
|
|
872
892
|
point.x = t.x;
|
|
873
893
|
point.y = t.y;
|
|
874
|
-
toOuterPoint$
|
|
894
|
+
toOuterPoint$2(matrix, point, toPoint$2);
|
|
875
895
|
setPoint$2(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
876
896
|
point.x = t.x + t.width;
|
|
877
|
-
toOuterPoint$
|
|
897
|
+
toOuterPoint$2(matrix, point, toPoint$2);
|
|
878
898
|
addPoint$2(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
879
899
|
point.y = t.y + t.height;
|
|
880
|
-
toOuterPoint$
|
|
900
|
+
toOuterPoint$2(matrix, point, toPoint$2);
|
|
881
901
|
addPoint$2(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
882
902
|
point.x = t.x;
|
|
883
|
-
toOuterPoint$
|
|
903
|
+
toOuterPoint$2(matrix, point, toPoint$2);
|
|
884
904
|
addPoint$2(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
885
905
|
toBounds$2(tempPointBounds$1, to);
|
|
886
906
|
}
|
|
@@ -894,16 +914,16 @@ const BoundsHelper = {
|
|
|
894
914
|
const scale = Math.min(baseScale, Math.min(t.width / put.width, t.height / put.height));
|
|
895
915
|
return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
|
|
896
916
|
},
|
|
897
|
-
getSpread(t, spread) {
|
|
917
|
+
getSpread(t, spread, side) {
|
|
898
918
|
const n = {};
|
|
899
|
-
B.copyAndSpread(n, t, spread);
|
|
919
|
+
B.copyAndSpread(n, t, spread, false, side);
|
|
900
920
|
return n;
|
|
901
921
|
},
|
|
902
|
-
spread(t, spread) {
|
|
903
|
-
B.copyAndSpread(t, t, spread);
|
|
922
|
+
spread(t, spread, side) {
|
|
923
|
+
B.copyAndSpread(t, t, spread, false, side);
|
|
904
924
|
},
|
|
905
|
-
shrink(t, shrink) {
|
|
906
|
-
B.copyAndSpread(t, t, shrink, true);
|
|
925
|
+
shrink(t, shrink, side) {
|
|
926
|
+
B.copyAndSpread(t, t, shrink, true, side);
|
|
907
927
|
},
|
|
908
928
|
ceil(t) {
|
|
909
929
|
const { x, y } = t;
|
|
@@ -1086,12 +1106,12 @@ class Bounds {
|
|
|
1086
1106
|
getFitMatrix(put, baseScale) {
|
|
1087
1107
|
return BoundsHelper.getFitMatrix(this, put, baseScale);
|
|
1088
1108
|
}
|
|
1089
|
-
spread(fourNumber) {
|
|
1090
|
-
BoundsHelper.spread(this, fourNumber);
|
|
1109
|
+
spread(fourNumber, side) {
|
|
1110
|
+
BoundsHelper.spread(this, fourNumber, side);
|
|
1091
1111
|
return this;
|
|
1092
1112
|
}
|
|
1093
|
-
shrink(fourNumber) {
|
|
1094
|
-
BoundsHelper.shrink(this, fourNumber);
|
|
1113
|
+
shrink(fourNumber, side) {
|
|
1114
|
+
BoundsHelper.shrink(this, fourNumber, side);
|
|
1095
1115
|
return this;
|
|
1096
1116
|
}
|
|
1097
1117
|
ceil() {
|
|
@@ -2908,60 +2928,75 @@ class PathCreator {
|
|
|
2908
2928
|
}
|
|
2909
2929
|
beginPath() {
|
|
2910
2930
|
beginPath(this.__path);
|
|
2931
|
+
this.paint();
|
|
2911
2932
|
return this;
|
|
2912
2933
|
}
|
|
2913
2934
|
moveTo(x, y) {
|
|
2914
2935
|
moveTo(this.__path, x, y);
|
|
2936
|
+
this.paint();
|
|
2915
2937
|
return this;
|
|
2916
2938
|
}
|
|
2917
2939
|
lineTo(x, y) {
|
|
2918
2940
|
lineTo(this.__path, x, y);
|
|
2941
|
+
this.paint();
|
|
2919
2942
|
return this;
|
|
2920
2943
|
}
|
|
2921
2944
|
bezierCurveTo(x1, y1, x2, y2, x, y) {
|
|
2922
2945
|
bezierCurveTo(this.__path, x1, y1, x2, y2, x, y);
|
|
2946
|
+
this.paint();
|
|
2923
2947
|
return this;
|
|
2924
2948
|
}
|
|
2925
2949
|
quadraticCurveTo(x1, y1, x, y) {
|
|
2926
2950
|
quadraticCurveTo(this.__path, x1, y1, x, y);
|
|
2951
|
+
this.paint();
|
|
2927
2952
|
return this;
|
|
2928
2953
|
}
|
|
2929
2954
|
closePath() {
|
|
2930
2955
|
closePath(this.__path);
|
|
2956
|
+
this.paint();
|
|
2931
2957
|
return this;
|
|
2932
2958
|
}
|
|
2933
2959
|
rect(x, y, width, height) {
|
|
2934
2960
|
rect(this.__path, x, y, width, height);
|
|
2961
|
+
this.paint();
|
|
2935
2962
|
return this;
|
|
2936
2963
|
}
|
|
2937
2964
|
roundRect(x, y, width, height, cornerRadius) {
|
|
2938
2965
|
roundRect$1(this.__path, x, y, width, height, cornerRadius);
|
|
2966
|
+
this.paint();
|
|
2939
2967
|
return this;
|
|
2940
2968
|
}
|
|
2941
2969
|
ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
2942
2970
|
ellipse$1(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
|
|
2971
|
+
this.paint();
|
|
2943
2972
|
return this;
|
|
2944
2973
|
}
|
|
2945
2974
|
arc(x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
2946
2975
|
arc$1(this.__path, x, y, radius, startAngle, endAngle, anticlockwise);
|
|
2976
|
+
this.paint();
|
|
2947
2977
|
return this;
|
|
2948
2978
|
}
|
|
2949
2979
|
arcTo(x1, y1, x2, y2, radius) {
|
|
2950
2980
|
arcTo$2(this.__path, x1, y1, x2, y2, radius);
|
|
2981
|
+
this.paint();
|
|
2951
2982
|
return this;
|
|
2952
2983
|
}
|
|
2953
2984
|
drawEllipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
2954
2985
|
drawEllipse(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
|
|
2986
|
+
this.paint();
|
|
2955
2987
|
return this;
|
|
2956
2988
|
}
|
|
2957
2989
|
drawArc(x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
2958
2990
|
drawArc(this.__path, x, y, radius, startAngle, endAngle, anticlockwise);
|
|
2991
|
+
this.paint();
|
|
2959
2992
|
return this;
|
|
2960
2993
|
}
|
|
2961
2994
|
drawPoints(points, curve, close) {
|
|
2962
2995
|
drawPoints(this.__path, points, curve, close);
|
|
2996
|
+
this.paint();
|
|
2963
2997
|
return this;
|
|
2964
2998
|
}
|
|
2999
|
+
paint() { }
|
|
2965
3000
|
}
|
|
2966
3001
|
|
|
2967
3002
|
const { M: M$2, L: L$3, C: C$2, Q: Q$1, Z: Z$2, N: N$1, D: D$1, X: X$1, G: G$1, F: F$2, O: O$1, P: P$1, U: U$1 } = PathCommandMap;
|
|
@@ -3983,7 +4018,7 @@ function registerUIEvent() {
|
|
|
3983
4018
|
};
|
|
3984
4019
|
}
|
|
3985
4020
|
|
|
3986
|
-
const { copy: copy$3, toInnerPoint: toInnerPoint$1, scaleOfOuter, rotateOfOuter, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
|
|
4021
|
+
const { copy: copy$3, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter, rotateOfOuter, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
|
|
3987
4022
|
const matrix = {};
|
|
3988
4023
|
const LeafHelper = {
|
|
3989
4024
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
@@ -4048,10 +4083,9 @@ const LeafHelper = {
|
|
|
4048
4083
|
}
|
|
4049
4084
|
return true;
|
|
4050
4085
|
},
|
|
4051
|
-
moveWorld(t, x, y = 0) {
|
|
4086
|
+
moveWorld(t, x, y = 0, isInnerPoint) {
|
|
4052
4087
|
const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
|
|
4053
|
-
|
|
4054
|
-
toInnerPoint$1(t.parent.worldTransform, local, local, true);
|
|
4088
|
+
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : (t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true));
|
|
4055
4089
|
L.moveLocal(t, local.x, local.y);
|
|
4056
4090
|
},
|
|
4057
4091
|
moveLocal(t, x, y = 0) {
|
|
@@ -5019,7 +5053,7 @@ const LeafBounds = {
|
|
|
5019
5053
|
updateAllMatrix(this);
|
|
5020
5054
|
updateBounds(this, this);
|
|
5021
5055
|
if (this.__.__autoSide)
|
|
5022
|
-
this.__updateBoxBounds();
|
|
5056
|
+
this.__updateBoxBounds(true);
|
|
5023
5057
|
}
|
|
5024
5058
|
else {
|
|
5025
5059
|
updateAllMatrix(this);
|
|
@@ -5401,6 +5435,9 @@ let Leaf = class Leaf {
|
|
|
5401
5435
|
move(x, y) {
|
|
5402
5436
|
moveLocal(this, x, y);
|
|
5403
5437
|
}
|
|
5438
|
+
moveInner(x, y) {
|
|
5439
|
+
moveWorld(this, x, y, true);
|
|
5440
|
+
}
|
|
5404
5441
|
scaleOf(origin, scaleX, scaleY, resize) {
|
|
5405
5442
|
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
|
|
5406
5443
|
}
|