@leafer/core 1.0.0 → 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 +119 -54
- package/lib/core.esm.js +119 -54
- 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/types/index.d.ts +1 -1
package/lib/core.cjs
CHANGED
|
@@ -50,6 +50,8 @@ const I$1 = IncrementId;
|
|
|
50
50
|
const { round, pow: pow$1, PI: PI$2 } = Math;
|
|
51
51
|
const MathHelper = {
|
|
52
52
|
within(value, min, max) {
|
|
53
|
+
if (typeof min === 'object')
|
|
54
|
+
max = min.max, min = min.min;
|
|
53
55
|
if (min !== undefined && value < min)
|
|
54
56
|
value = min;
|
|
55
57
|
if (max !== undefined && value > max)
|
|
@@ -111,6 +113,19 @@ const MathHelper = {
|
|
|
111
113
|
const a = maxLength ? pow$1(10, maxLength) : 1000000000000;
|
|
112
114
|
num = round(num * a) / a;
|
|
113
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;
|
|
114
129
|
}
|
|
115
130
|
};
|
|
116
131
|
const OneRadian = PI$2 / 180;
|
|
@@ -152,10 +167,10 @@ const MatrixHelper = {
|
|
|
152
167
|
t.e += x;
|
|
153
168
|
t.f += y;
|
|
154
169
|
},
|
|
155
|
-
translateInner(t, x, y,
|
|
170
|
+
translateInner(t, x, y, hasOrigin) {
|
|
156
171
|
t.e += t.a * x + t.c * y;
|
|
157
172
|
t.f += t.b * x + t.d * y;
|
|
158
|
-
if (
|
|
173
|
+
if (hasOrigin)
|
|
159
174
|
t.e -= x, t.f -= y;
|
|
160
175
|
},
|
|
161
176
|
scale(t, scaleX, scaleY = scaleX) {
|
|
@@ -314,7 +329,7 @@ const MatrixHelper = {
|
|
|
314
329
|
to.y -= (f * a - e * b) * s;
|
|
315
330
|
}
|
|
316
331
|
},
|
|
317
|
-
setLayout(t, layout, origin, bcChanged) {
|
|
332
|
+
setLayout(t, layout, origin, around, bcChanged) {
|
|
318
333
|
const { x, y, scaleX, scaleY } = layout;
|
|
319
334
|
if (bcChanged === undefined)
|
|
320
335
|
bcChanged = layout.rotation || layout.skewX || layout.skewY;
|
|
@@ -346,10 +361,10 @@ const MatrixHelper = {
|
|
|
346
361
|
}
|
|
347
362
|
t.e = x;
|
|
348
363
|
t.f = y;
|
|
349
|
-
if (origin)
|
|
350
|
-
M$6.translateInner(t, -origin.x, -origin.y,
|
|
364
|
+
if (origin = origin || around)
|
|
365
|
+
M$6.translateInner(t, -origin.x, -origin.y, !around);
|
|
351
366
|
},
|
|
352
|
-
getLayout(t, origin, firstSkewY) {
|
|
367
|
+
getLayout(t, origin, around, firstSkewY) {
|
|
353
368
|
const { a, b, c, d, e, f } = t;
|
|
354
369
|
let x = e, y = f, scaleX, scaleY, rotation, skewX, skewY;
|
|
355
370
|
if (b || c) {
|
|
@@ -378,9 +393,11 @@ const MatrixHelper = {
|
|
|
378
393
|
scaleY = d;
|
|
379
394
|
rotation = skewX = skewY = 0;
|
|
380
395
|
}
|
|
381
|
-
if (origin) {
|
|
396
|
+
if (origin = around || origin) {
|
|
382
397
|
x += origin.x * a + origin.y * c;
|
|
383
398
|
y += origin.x * b + origin.y * d;
|
|
399
|
+
if (!around)
|
|
400
|
+
x -= origin.x, y -= origin.y;
|
|
384
401
|
}
|
|
385
402
|
return { x, y, scaleX, scaleY, rotation, skewX, skewY };
|
|
386
403
|
},
|
|
@@ -407,7 +424,7 @@ const MatrixHelper = {
|
|
|
407
424
|
};
|
|
408
425
|
const M$6 = MatrixHelper;
|
|
409
426
|
|
|
410
|
-
const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$
|
|
427
|
+
const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3 } = MatrixHelper;
|
|
411
428
|
const { sin: sin$2, cos: cos$2, abs: abs$2, sqrt: sqrt$2, atan2: atan2$2, min: min$1, PI: PI$1 } = Math;
|
|
412
429
|
const PointHelper = {
|
|
413
430
|
defaultPoint: getPointData(),
|
|
@@ -463,7 +480,7 @@ const PointHelper = {
|
|
|
463
480
|
tempToOuterOf(t, matrix) {
|
|
464
481
|
const { tempPoint: temp } = P$5;
|
|
465
482
|
copy$7(temp, t);
|
|
466
|
-
toOuterPoint$
|
|
483
|
+
toOuterPoint$3(matrix, temp, temp);
|
|
467
484
|
return temp;
|
|
468
485
|
},
|
|
469
486
|
tempToInnerRadiusPointOf(t, matrix) {
|
|
@@ -482,7 +499,7 @@ const PointHelper = {
|
|
|
482
499
|
toInnerPoint$2(matrix, t, to);
|
|
483
500
|
},
|
|
484
501
|
toOuterOf(t, matrix, to) {
|
|
485
|
-
toOuterPoint$
|
|
502
|
+
toOuterPoint$3(matrix, t, to);
|
|
486
503
|
},
|
|
487
504
|
getCenter(t, to) {
|
|
488
505
|
return { x: t.x + (to.x - t.x) / 2, y: t.y + (to.y - t.y) / 2 };
|
|
@@ -708,12 +725,12 @@ class Matrix {
|
|
|
708
725
|
toInnerPoint(outer, to, distance) {
|
|
709
726
|
MatrixHelper.toInnerPoint(this, outer, to, distance);
|
|
710
727
|
}
|
|
711
|
-
setLayout(data, origin) {
|
|
712
|
-
MatrixHelper.setLayout(this, data, origin);
|
|
728
|
+
setLayout(data, origin, around) {
|
|
729
|
+
MatrixHelper.setLayout(this, data, origin, around);
|
|
713
730
|
return this;
|
|
714
731
|
}
|
|
715
|
-
getLayout(origin, firstSkewY) {
|
|
716
|
-
return MatrixHelper.getLayout(this, origin, firstSkewY);
|
|
732
|
+
getLayout(origin, around, firstSkewY) {
|
|
733
|
+
return MatrixHelper.getLayout(this, origin, around, firstSkewY);
|
|
717
734
|
}
|
|
718
735
|
withScale(scaleX, scaleY) {
|
|
719
736
|
return MatrixHelper.withScale(this, scaleX, scaleY);
|
|
@@ -762,7 +779,7 @@ const TwoPointBoundsHelper = {
|
|
|
762
779
|
const { addPoint: addPoint$3 } = TwoPointBoundsHelper;
|
|
763
780
|
|
|
764
781
|
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2 } = TwoPointBoundsHelper;
|
|
765
|
-
const { toOuterPoint: toOuterPoint$
|
|
782
|
+
const { toOuterPoint: toOuterPoint$2 } = MatrixHelper;
|
|
766
783
|
const { float, fourNumber } = MathHelper;
|
|
767
784
|
const { floor, ceil: ceil$1 } = Math;
|
|
768
785
|
let right, bottom, boundsRight, boundsBottom;
|
|
@@ -782,17 +799,24 @@ const BoundsHelper = {
|
|
|
782
799
|
t.width = bounds.width;
|
|
783
800
|
t.height = bounds.height;
|
|
784
801
|
},
|
|
785
|
-
copyAndSpread(t, bounds, spread, isShrink) {
|
|
802
|
+
copyAndSpread(t, bounds, spread, isShrink, side) {
|
|
803
|
+
const { x, y, width, height } = bounds;
|
|
786
804
|
if (spread instanceof Array) {
|
|
787
805
|
const four = fourNumber(spread);
|
|
788
806
|
isShrink
|
|
789
|
-
? B.set(t,
|
|
790
|
-
: 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]);
|
|
791
809
|
}
|
|
792
810
|
else {
|
|
793
811
|
if (isShrink)
|
|
794
812
|
spread = -spread;
|
|
795
|
-
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;
|
|
796
820
|
}
|
|
797
821
|
},
|
|
798
822
|
minX(t) { return t.width > 0 ? t.x : t.x + t.width; },
|
|
@@ -869,16 +893,16 @@ const BoundsHelper = {
|
|
|
869
893
|
else {
|
|
870
894
|
point.x = t.x;
|
|
871
895
|
point.y = t.y;
|
|
872
|
-
toOuterPoint$
|
|
896
|
+
toOuterPoint$2(matrix, point, toPoint$2);
|
|
873
897
|
setPoint$2(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
874
898
|
point.x = t.x + t.width;
|
|
875
|
-
toOuterPoint$
|
|
899
|
+
toOuterPoint$2(matrix, point, toPoint$2);
|
|
876
900
|
addPoint$2(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
877
901
|
point.y = t.y + t.height;
|
|
878
|
-
toOuterPoint$
|
|
902
|
+
toOuterPoint$2(matrix, point, toPoint$2);
|
|
879
903
|
addPoint$2(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
880
904
|
point.x = t.x;
|
|
881
|
-
toOuterPoint$
|
|
905
|
+
toOuterPoint$2(matrix, point, toPoint$2);
|
|
882
906
|
addPoint$2(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
883
907
|
toBounds$2(tempPointBounds$1, to);
|
|
884
908
|
}
|
|
@@ -892,16 +916,16 @@ const BoundsHelper = {
|
|
|
892
916
|
const scale = Math.min(baseScale, Math.min(t.width / put.width, t.height / put.height));
|
|
893
917
|
return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
|
|
894
918
|
},
|
|
895
|
-
getSpread(t, spread) {
|
|
919
|
+
getSpread(t, spread, side) {
|
|
896
920
|
const n = {};
|
|
897
|
-
B.copyAndSpread(n, t, spread);
|
|
921
|
+
B.copyAndSpread(n, t, spread, false, side);
|
|
898
922
|
return n;
|
|
899
923
|
},
|
|
900
|
-
spread(t, spread) {
|
|
901
|
-
B.copyAndSpread(t, t, spread);
|
|
924
|
+
spread(t, spread, side) {
|
|
925
|
+
B.copyAndSpread(t, t, spread, false, side);
|
|
902
926
|
},
|
|
903
|
-
shrink(t, shrink) {
|
|
904
|
-
B.copyAndSpread(t, t, shrink, true);
|
|
927
|
+
shrink(t, shrink, side) {
|
|
928
|
+
B.copyAndSpread(t, t, shrink, true, side);
|
|
905
929
|
},
|
|
906
930
|
ceil(t) {
|
|
907
931
|
const { x, y } = t;
|
|
@@ -1084,12 +1108,12 @@ class Bounds {
|
|
|
1084
1108
|
getFitMatrix(put, baseScale) {
|
|
1085
1109
|
return BoundsHelper.getFitMatrix(this, put, baseScale);
|
|
1086
1110
|
}
|
|
1087
|
-
spread(fourNumber) {
|
|
1088
|
-
BoundsHelper.spread(this, fourNumber);
|
|
1111
|
+
spread(fourNumber, side) {
|
|
1112
|
+
BoundsHelper.spread(this, fourNumber, side);
|
|
1089
1113
|
return this;
|
|
1090
1114
|
}
|
|
1091
|
-
shrink(fourNumber) {
|
|
1092
|
-
BoundsHelper.shrink(this, fourNumber);
|
|
1115
|
+
shrink(fourNumber, side) {
|
|
1116
|
+
BoundsHelper.shrink(this, fourNumber, side);
|
|
1093
1117
|
return this;
|
|
1094
1118
|
}
|
|
1095
1119
|
ceil() {
|
|
@@ -2001,7 +2025,7 @@ class LeaferCanvasBase extends Canvas {
|
|
|
2001
2025
|
DataHelper.copyAttrs(this.size, size, canvasSizeAttrs);
|
|
2002
2026
|
this.size.pixelRatio || (this.size.pixelRatio = 1);
|
|
2003
2027
|
this.bounds = new Bounds(0, 0, this.width, this.height);
|
|
2004
|
-
if (!this.unreal) {
|
|
2028
|
+
if (this.context && !this.unreal) {
|
|
2005
2029
|
this.updateViewSize();
|
|
2006
2030
|
this.smooth = this.config.smooth;
|
|
2007
2031
|
}
|
|
@@ -2174,7 +2198,7 @@ class LeaferCanvasBase extends Canvas {
|
|
|
2174
2198
|
this.manager ? this.manager.recycle(this) : this.destroy();
|
|
2175
2199
|
}
|
|
2176
2200
|
}
|
|
2177
|
-
updateRender() { }
|
|
2201
|
+
updateRender(_bounds) { }
|
|
2178
2202
|
unrealCanvas() { }
|
|
2179
2203
|
destroy() {
|
|
2180
2204
|
this.manager = this.view = this.parentView = null;
|
|
@@ -2906,60 +2930,75 @@ class PathCreator {
|
|
|
2906
2930
|
}
|
|
2907
2931
|
beginPath() {
|
|
2908
2932
|
beginPath(this.__path);
|
|
2933
|
+
this.paint();
|
|
2909
2934
|
return this;
|
|
2910
2935
|
}
|
|
2911
2936
|
moveTo(x, y) {
|
|
2912
2937
|
moveTo(this.__path, x, y);
|
|
2938
|
+
this.paint();
|
|
2913
2939
|
return this;
|
|
2914
2940
|
}
|
|
2915
2941
|
lineTo(x, y) {
|
|
2916
2942
|
lineTo(this.__path, x, y);
|
|
2943
|
+
this.paint();
|
|
2917
2944
|
return this;
|
|
2918
2945
|
}
|
|
2919
2946
|
bezierCurveTo(x1, y1, x2, y2, x, y) {
|
|
2920
2947
|
bezierCurveTo(this.__path, x1, y1, x2, y2, x, y);
|
|
2948
|
+
this.paint();
|
|
2921
2949
|
return this;
|
|
2922
2950
|
}
|
|
2923
2951
|
quadraticCurveTo(x1, y1, x, y) {
|
|
2924
2952
|
quadraticCurveTo(this.__path, x1, y1, x, y);
|
|
2953
|
+
this.paint();
|
|
2925
2954
|
return this;
|
|
2926
2955
|
}
|
|
2927
2956
|
closePath() {
|
|
2928
2957
|
closePath(this.__path);
|
|
2958
|
+
this.paint();
|
|
2929
2959
|
return this;
|
|
2930
2960
|
}
|
|
2931
2961
|
rect(x, y, width, height) {
|
|
2932
2962
|
rect(this.__path, x, y, width, height);
|
|
2963
|
+
this.paint();
|
|
2933
2964
|
return this;
|
|
2934
2965
|
}
|
|
2935
2966
|
roundRect(x, y, width, height, cornerRadius) {
|
|
2936
2967
|
roundRect$1(this.__path, x, y, width, height, cornerRadius);
|
|
2968
|
+
this.paint();
|
|
2937
2969
|
return this;
|
|
2938
2970
|
}
|
|
2939
2971
|
ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
2940
2972
|
ellipse$1(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
|
|
2973
|
+
this.paint();
|
|
2941
2974
|
return this;
|
|
2942
2975
|
}
|
|
2943
2976
|
arc(x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
2944
2977
|
arc$1(this.__path, x, y, radius, startAngle, endAngle, anticlockwise);
|
|
2978
|
+
this.paint();
|
|
2945
2979
|
return this;
|
|
2946
2980
|
}
|
|
2947
2981
|
arcTo(x1, y1, x2, y2, radius) {
|
|
2948
2982
|
arcTo$2(this.__path, x1, y1, x2, y2, radius);
|
|
2983
|
+
this.paint();
|
|
2949
2984
|
return this;
|
|
2950
2985
|
}
|
|
2951
2986
|
drawEllipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
2952
2987
|
drawEllipse(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
|
|
2988
|
+
this.paint();
|
|
2953
2989
|
return this;
|
|
2954
2990
|
}
|
|
2955
2991
|
drawArc(x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
2956
2992
|
drawArc(this.__path, x, y, radius, startAngle, endAngle, anticlockwise);
|
|
2993
|
+
this.paint();
|
|
2957
2994
|
return this;
|
|
2958
2995
|
}
|
|
2959
2996
|
drawPoints(points, curve, close) {
|
|
2960
2997
|
drawPoints(this.__path, points, curve, close);
|
|
2998
|
+
this.paint();
|
|
2961
2999
|
return this;
|
|
2962
3000
|
}
|
|
3001
|
+
paint() { }
|
|
2963
3002
|
}
|
|
2964
3003
|
|
|
2965
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;
|
|
@@ -3981,7 +4020,7 @@ function registerUIEvent() {
|
|
|
3981
4020
|
};
|
|
3982
4021
|
}
|
|
3983
4022
|
|
|
3984
|
-
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;
|
|
3985
4024
|
const matrix = {};
|
|
3986
4025
|
const LeafHelper = {
|
|
3987
4026
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
@@ -4046,10 +4085,9 @@ const LeafHelper = {
|
|
|
4046
4085
|
}
|
|
4047
4086
|
return true;
|
|
4048
4087
|
},
|
|
4049
|
-
moveWorld(t, x, y = 0) {
|
|
4088
|
+
moveWorld(t, x, y = 0, isInnerPoint) {
|
|
4050
4089
|
const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
|
|
4051
|
-
|
|
4052
|
-
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));
|
|
4053
4091
|
L.moveLocal(t, local.x, local.y);
|
|
4054
4092
|
},
|
|
4055
4093
|
moveLocal(t, x, y = 0) {
|
|
@@ -4068,8 +4106,13 @@ const LeafHelper = {
|
|
|
4068
4106
|
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
|
|
4069
4107
|
copy$3(matrix, t.__localMatrix);
|
|
4070
4108
|
scaleOfOuter(matrix, origin, scaleX, scaleY);
|
|
4071
|
-
|
|
4072
|
-
|
|
4109
|
+
if (t.origin || t.around) {
|
|
4110
|
+
L.setTransform(t, matrix, resize);
|
|
4111
|
+
}
|
|
4112
|
+
else {
|
|
4113
|
+
moveByMatrix(t, matrix);
|
|
4114
|
+
t.scaleResize(scaleX, scaleY, resize !== true);
|
|
4115
|
+
}
|
|
4073
4116
|
},
|
|
4074
4117
|
rotateOfWorld(t, origin, angle) {
|
|
4075
4118
|
L.rotateOfLocal(t, getTempLocal(t, origin), angle);
|
|
@@ -4077,8 +4120,13 @@ const LeafHelper = {
|
|
|
4077
4120
|
rotateOfLocal(t, origin, angle) {
|
|
4078
4121
|
copy$3(matrix, t.__localMatrix);
|
|
4079
4122
|
rotateOfOuter(matrix, origin, angle);
|
|
4080
|
-
|
|
4081
|
-
|
|
4123
|
+
if (t.origin || t.around) {
|
|
4124
|
+
L.setTransform(t, matrix);
|
|
4125
|
+
}
|
|
4126
|
+
else {
|
|
4127
|
+
moveByMatrix(t, matrix);
|
|
4128
|
+
t.rotation = MathHelper.formatRotation(t.rotation + angle);
|
|
4129
|
+
}
|
|
4082
4130
|
},
|
|
4083
4131
|
skewOfWorld(t, origin, skewX, skewY, resize) {
|
|
4084
4132
|
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
|
|
@@ -4101,7 +4149,7 @@ const LeafHelper = {
|
|
|
4101
4149
|
L.setTransform(t, matrix, resize);
|
|
4102
4150
|
},
|
|
4103
4151
|
setTransform(t, transform, resize) {
|
|
4104
|
-
const layout = getLayout(transform);
|
|
4152
|
+
const layout = getLayout(transform, t.origin && L.getInnerOrigin(t, t.origin), t.around && L.getInnerOrigin(t, t.around));
|
|
4105
4153
|
if (resize) {
|
|
4106
4154
|
const scaleX = layout.scaleX / t.scaleX;
|
|
4107
4155
|
const scaleY = layout.scaleY / t.scaleY;
|
|
@@ -4114,13 +4162,19 @@ const LeafHelper = {
|
|
|
4114
4162
|
t.set(layout);
|
|
4115
4163
|
}
|
|
4116
4164
|
},
|
|
4165
|
+
getFlipTransform(t, axis) {
|
|
4166
|
+
const m = getMatrixData();
|
|
4167
|
+
const sign = axis === 'x' ? 1 : -1;
|
|
4168
|
+
scaleOfOuter(m, L.getLocalOrigin(t, 'center'), -1 * sign, 1 * sign);
|
|
4169
|
+
return m;
|
|
4170
|
+
},
|
|
4117
4171
|
getLocalOrigin(t, origin) {
|
|
4118
4172
|
return PointHelper.tempToOuterOf(L.getInnerOrigin(t, origin), t.localTransform);
|
|
4119
4173
|
},
|
|
4120
4174
|
getInnerOrigin(t, origin) {
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
return
|
|
4175
|
+
const innerOrigin = {};
|
|
4176
|
+
AroundHelper.toPoint(origin, t.boxBounds, innerOrigin);
|
|
4177
|
+
return innerOrigin;
|
|
4124
4178
|
},
|
|
4125
4179
|
getRelativeWorld(t, relative, temp) {
|
|
4126
4180
|
copy$3(matrix, t.worldTransform);
|
|
@@ -4547,7 +4601,10 @@ const LeafEventer = {
|
|
|
4547
4601
|
on(type, listener, options) {
|
|
4548
4602
|
let capture, once;
|
|
4549
4603
|
if (options) {
|
|
4550
|
-
if (
|
|
4604
|
+
if (options === 'once') {
|
|
4605
|
+
once = true;
|
|
4606
|
+
}
|
|
4607
|
+
else if (typeof options === 'boolean') {
|
|
4551
4608
|
capture = options;
|
|
4552
4609
|
}
|
|
4553
4610
|
else {
|
|
@@ -4578,7 +4635,7 @@ const LeafEventer = {
|
|
|
4578
4635
|
if (listener) {
|
|
4579
4636
|
let capture;
|
|
4580
4637
|
if (options)
|
|
4581
|
-
capture = typeof options === 'boolean' ? options : options.capture;
|
|
4638
|
+
capture = typeof options === 'boolean' ? options : (options === 'once' ? false : options.capture);
|
|
4582
4639
|
let events, index;
|
|
4583
4640
|
const map = __getListenerMap(this, capture);
|
|
4584
4641
|
typeList.forEach(type => {
|
|
@@ -4880,7 +4937,7 @@ const LeafMatrix = {
|
|
|
4880
4937
|
const layout = this.__layout, local = this.__local, data = this.__;
|
|
4881
4938
|
if (layout.affectScaleOrRotation) {
|
|
4882
4939
|
if (layout.scaleChanged || layout.rotationChanged) {
|
|
4883
|
-
setLayout(local, data, null, layout.affectRotation);
|
|
4940
|
+
setLayout(local, data, null, null, layout.affectRotation);
|
|
4884
4941
|
layout.scaleChanged = layout.rotationChanged = false;
|
|
4885
4942
|
}
|
|
4886
4943
|
}
|
|
@@ -4888,7 +4945,7 @@ const LeafMatrix = {
|
|
|
4888
4945
|
local.f = data.y + data.offsetY;
|
|
4889
4946
|
if (data.around || data.origin) {
|
|
4890
4947
|
toPoint(data.around || data.origin, layout.boxBounds, tempPoint);
|
|
4891
|
-
translateInner(local, -tempPoint.x, -tempPoint.y, data.
|
|
4948
|
+
translateInner(local, -tempPoint.x, -tempPoint.y, !data.around);
|
|
4892
4949
|
}
|
|
4893
4950
|
}
|
|
4894
4951
|
this.__layout.matrixChanged = false;
|
|
@@ -4998,7 +5055,7 @@ const LeafBounds = {
|
|
|
4998
5055
|
updateAllMatrix(this);
|
|
4999
5056
|
updateBounds(this, this);
|
|
5000
5057
|
if (this.__.__autoSide)
|
|
5001
|
-
this.__updateBoxBounds();
|
|
5058
|
+
this.__updateBoxBounds(true);
|
|
5002
5059
|
}
|
|
5003
5060
|
else {
|
|
5004
5061
|
updateAllMatrix(this);
|
|
@@ -5117,7 +5174,7 @@ const { LEAF, create } = IncrementId;
|
|
|
5117
5174
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5118
5175
|
const { toOuterOf } = BoundsHelper;
|
|
5119
5176
|
const { copy } = PointHelper;
|
|
5120
|
-
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5177
|
+
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5121
5178
|
exports.Leaf = class Leaf {
|
|
5122
5179
|
get tag() { return this.__tag; }
|
|
5123
5180
|
set tag(_value) { }
|
|
@@ -5143,6 +5200,8 @@ exports.Leaf = class Leaf {
|
|
|
5143
5200
|
get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
|
|
5144
5201
|
get __inLazyBounds() { const { leafer } = this; return leafer && leafer.created && leafer.lazyBounds.hit(this.__world); }
|
|
5145
5202
|
get pathInputed() { return this.__.__pathInputed; }
|
|
5203
|
+
set event(map) { let event; for (let key in map)
|
|
5204
|
+
event = map[key], event instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event); }
|
|
5146
5205
|
constructor(data) {
|
|
5147
5206
|
this.innerId = create(LEAF);
|
|
5148
5207
|
this.reset(data);
|
|
@@ -5378,6 +5437,9 @@ exports.Leaf = class Leaf {
|
|
|
5378
5437
|
move(x, y) {
|
|
5379
5438
|
moveLocal(this, x, y);
|
|
5380
5439
|
}
|
|
5440
|
+
moveInner(x, y) {
|
|
5441
|
+
moveWorld(this, x, y, true);
|
|
5442
|
+
}
|
|
5381
5443
|
scaleOf(origin, scaleX, scaleY, resize) {
|
|
5382
5444
|
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
|
|
5383
5445
|
}
|
|
@@ -5402,6 +5464,9 @@ exports.Leaf = class Leaf {
|
|
|
5402
5464
|
skewOfWorld(worldOrigin, skewX, skewY, resize) {
|
|
5403
5465
|
skewOfWorld(this, worldOrigin, skewX, skewY, resize);
|
|
5404
5466
|
}
|
|
5467
|
+
flip(axis) {
|
|
5468
|
+
transform(this, getFlipTransform(this, axis));
|
|
5469
|
+
}
|
|
5405
5470
|
scaleResize(scaleX, scaleY = scaleX, _noResize) {
|
|
5406
5471
|
this.scaleX *= scaleX;
|
|
5407
5472
|
this.scaleY *= scaleY;
|
|
@@ -5759,7 +5824,7 @@ class LeafLevelList {
|
|
|
5759
5824
|
}
|
|
5760
5825
|
}
|
|
5761
5826
|
|
|
5762
|
-
const version = "1.0.
|
|
5827
|
+
const version = "1.0.1";
|
|
5763
5828
|
const inviteCode = {};
|
|
5764
5829
|
|
|
5765
5830
|
exports.AlignHelper = AlignHelper;
|