@leafer-draw/miniapp 1.6.1 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/miniapp.cjs +208 -201
- package/dist/miniapp.esm.js +211 -204
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +1173 -490
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +9 -9
- package/dist/miniapp.cjs.map +0 -1
- package/dist/miniapp.esm.js.map +0 -1
- package/dist/miniapp.module.js.map +0 -1
package/dist/miniapp.module.js
CHANGED
|
@@ -23,8 +23,6 @@ const Platform = {
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
const Creator = {};
|
|
27
|
-
|
|
28
26
|
const IncrementId = {
|
|
29
27
|
RUNTIME: 'runtime',
|
|
30
28
|
LEAF: 'leaf',
|
|
@@ -150,7 +148,7 @@ function getMatrixData() { return { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }; }
|
|
|
150
148
|
|
|
151
149
|
const { sin: sin$5, cos: cos$5, acos, sqrt: sqrt$3 } = Math;
|
|
152
150
|
const { float: float$1 } = MathHelper;
|
|
153
|
-
const tempPoint$
|
|
151
|
+
const tempPoint$3 = {};
|
|
154
152
|
function getWorld() {
|
|
155
153
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), { scaleX: 1, scaleY: 1, rotation: 0, skewX: 0, skewY: 0 });
|
|
156
154
|
}
|
|
@@ -193,8 +191,8 @@ const MatrixHelper = {
|
|
|
193
191
|
t.d *= scaleY;
|
|
194
192
|
},
|
|
195
193
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
196
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
197
|
-
M$6.scaleOfInner(t, tempPoint$
|
|
194
|
+
M$6.toInnerPoint(t, origin, tempPoint$3);
|
|
195
|
+
M$6.scaleOfInner(t, tempPoint$3, scaleX, scaleY);
|
|
198
196
|
},
|
|
199
197
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
200
198
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -212,8 +210,8 @@ const MatrixHelper = {
|
|
|
212
210
|
t.d = c * sinR + d * cosR;
|
|
213
211
|
},
|
|
214
212
|
rotateOfOuter(t, origin, rotation) {
|
|
215
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
216
|
-
M$6.rotateOfInner(t, tempPoint$
|
|
213
|
+
M$6.toInnerPoint(t, origin, tempPoint$3);
|
|
214
|
+
M$6.rotateOfInner(t, tempPoint$3, rotation);
|
|
217
215
|
},
|
|
218
216
|
rotateOfInner(t, origin, rotation) {
|
|
219
217
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -234,8 +232,8 @@ const MatrixHelper = {
|
|
|
234
232
|
}
|
|
235
233
|
},
|
|
236
234
|
skewOfOuter(t, origin, skewX, skewY) {
|
|
237
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
238
|
-
M$6.skewOfInner(t, tempPoint$
|
|
235
|
+
M$6.toInnerPoint(t, origin, tempPoint$3);
|
|
236
|
+
M$6.skewOfInner(t, tempPoint$3, skewX, skewY);
|
|
239
237
|
},
|
|
240
238
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
241
239
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -464,8 +462,10 @@ const PointHelper = {
|
|
|
464
462
|
t.y = halfPixel ? round$2(t.y - 0.5) + 0.5 : round$2(t.y);
|
|
465
463
|
},
|
|
466
464
|
move(t, x, y) {
|
|
467
|
-
|
|
468
|
-
|
|
465
|
+
if (typeof x === 'object')
|
|
466
|
+
t.x += x.x, t.y += x.y;
|
|
467
|
+
else
|
|
468
|
+
t.x += x, t.y += y;
|
|
469
469
|
},
|
|
470
470
|
scale(t, scaleX, scaleY = scaleX) {
|
|
471
471
|
if (t.x)
|
|
@@ -490,19 +490,19 @@ const PointHelper = {
|
|
|
490
490
|
},
|
|
491
491
|
tempToInnerOf(t, matrix) {
|
|
492
492
|
const { tempPoint: temp } = P$5;
|
|
493
|
-
copy$
|
|
493
|
+
copy$b(temp, t);
|
|
494
494
|
toInnerPoint$2(matrix, temp, temp);
|
|
495
495
|
return temp;
|
|
496
496
|
},
|
|
497
497
|
tempToOuterOf(t, matrix) {
|
|
498
498
|
const { tempPoint: temp } = P$5;
|
|
499
|
-
copy$
|
|
499
|
+
copy$b(temp, t);
|
|
500
500
|
toOuterPoint$3(matrix, temp, temp);
|
|
501
501
|
return temp;
|
|
502
502
|
},
|
|
503
503
|
tempToInnerRadiusPointOf(t, matrix) {
|
|
504
504
|
const { tempRadiusPoint: temp } = P$5;
|
|
505
|
-
copy$
|
|
505
|
+
copy$b(temp, t);
|
|
506
506
|
P$5.toInnerRadiusPointOf(t, matrix, temp);
|
|
507
507
|
return temp;
|
|
508
508
|
},
|
|
@@ -575,7 +575,7 @@ const PointHelper = {
|
|
|
575
575
|
}
|
|
576
576
|
};
|
|
577
577
|
const P$5 = PointHelper;
|
|
578
|
-
const { getDistanceFrom, copy: copy$
|
|
578
|
+
const { getDistanceFrom, copy: copy$b, getAtan2 } = P$5;
|
|
579
579
|
|
|
580
580
|
class Point {
|
|
581
581
|
constructor(x, y) {
|
|
@@ -643,7 +643,7 @@ class Point {
|
|
|
643
643
|
return this;
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
|
-
const tempPoint$
|
|
646
|
+
const tempPoint$2 = new Point();
|
|
647
647
|
|
|
648
648
|
class Matrix {
|
|
649
649
|
constructor(a, b, c, d, e, f) {
|
|
@@ -801,15 +801,87 @@ const TwoPointBoundsHelper = {
|
|
|
801
801
|
};
|
|
802
802
|
const { addPoint: addPoint$3 } = TwoPointBoundsHelper;
|
|
803
803
|
|
|
804
|
+
var Direction4;
|
|
805
|
+
(function (Direction4) {
|
|
806
|
+
Direction4[Direction4["top"] = 0] = "top";
|
|
807
|
+
Direction4[Direction4["right"] = 1] = "right";
|
|
808
|
+
Direction4[Direction4["bottom"] = 2] = "bottom";
|
|
809
|
+
Direction4[Direction4["left"] = 3] = "left";
|
|
810
|
+
})(Direction4 || (Direction4 = {}));
|
|
811
|
+
var Direction9;
|
|
812
|
+
(function (Direction9) {
|
|
813
|
+
Direction9[Direction9["topLeft"] = 0] = "topLeft";
|
|
814
|
+
Direction9[Direction9["top"] = 1] = "top";
|
|
815
|
+
Direction9[Direction9["topRight"] = 2] = "topRight";
|
|
816
|
+
Direction9[Direction9["right"] = 3] = "right";
|
|
817
|
+
Direction9[Direction9["bottomRight"] = 4] = "bottomRight";
|
|
818
|
+
Direction9[Direction9["bottom"] = 5] = "bottom";
|
|
819
|
+
Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
|
|
820
|
+
Direction9[Direction9["left"] = 7] = "left";
|
|
821
|
+
Direction9[Direction9["center"] = 8] = "center";
|
|
822
|
+
Direction9[Direction9["top-left"] = 0] = "top-left";
|
|
823
|
+
Direction9[Direction9["top-right"] = 2] = "top-right";
|
|
824
|
+
Direction9[Direction9["bottom-right"] = 4] = "bottom-right";
|
|
825
|
+
Direction9[Direction9["bottom-left"] = 6] = "bottom-left";
|
|
826
|
+
})(Direction9 || (Direction9 = {}));
|
|
827
|
+
|
|
828
|
+
const directionData = [
|
|
829
|
+
{ x: 0, y: 0 },
|
|
830
|
+
{ x: 0.5, y: 0 },
|
|
831
|
+
{ x: 1, y: 0 },
|
|
832
|
+
{ x: 1, y: 0.5 },
|
|
833
|
+
{ x: 1, y: 1 },
|
|
834
|
+
{ x: 0.5, y: 1 },
|
|
835
|
+
{ x: 0, y: 1 },
|
|
836
|
+
{ x: 0, y: 0.5 },
|
|
837
|
+
{ x: 0.5, y: 0.5 }
|
|
838
|
+
];
|
|
839
|
+
directionData.forEach(item => item.type = 'percent');
|
|
840
|
+
const AroundHelper = {
|
|
841
|
+
directionData,
|
|
842
|
+
tempPoint: {},
|
|
843
|
+
get: get$4,
|
|
844
|
+
toPoint(around, box, to, onlyBoxSize, content, onlyContentSize) {
|
|
845
|
+
const point = get$4(around);
|
|
846
|
+
to.x = point.x;
|
|
847
|
+
to.y = point.y;
|
|
848
|
+
if (point.type === 'percent') {
|
|
849
|
+
to.x *= box.width;
|
|
850
|
+
to.y *= box.height;
|
|
851
|
+
if (content) {
|
|
852
|
+
if (!onlyContentSize)
|
|
853
|
+
to.x -= content.x, to.y -= content.y;
|
|
854
|
+
if (point.x)
|
|
855
|
+
to.x -= (point.x === 1) ? content.width : (point.x === 0.5 ? point.x * content.width : 0);
|
|
856
|
+
if (point.y)
|
|
857
|
+
to.y -= (point.y === 1) ? content.height : (point.y === 0.5 ? point.y * content.height : 0);
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
if (!onlyBoxSize)
|
|
861
|
+
to.x += box.x, to.y += box.y;
|
|
862
|
+
}
|
|
863
|
+
};
|
|
864
|
+
function get$4(around) {
|
|
865
|
+
return typeof around === 'string' ? directionData[Direction9[around]] : around;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
const { toPoint: toPoint$5 } = AroundHelper;
|
|
869
|
+
const AlignHelper = {
|
|
870
|
+
toPoint(align, content, box, to, onlyBoxSize, onlyContentSize) {
|
|
871
|
+
toPoint$5(align, box, to, onlyBoxSize, content, onlyContentSize);
|
|
872
|
+
}
|
|
873
|
+
};
|
|
874
|
+
|
|
804
875
|
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$3 } = TwoPointBoundsHelper;
|
|
805
876
|
const { toOuterPoint: toOuterPoint$2 } = MatrixHelper;
|
|
806
877
|
const { float, fourNumber } = MathHelper;
|
|
807
878
|
const { floor, ceil: ceil$2 } = Math;
|
|
808
879
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
809
880
|
const point = {};
|
|
810
|
-
const toPoint$
|
|
881
|
+
const toPoint$4 = {};
|
|
882
|
+
const tempBounds$2 = {};
|
|
811
883
|
const BoundsHelper = {
|
|
812
|
-
tempBounds:
|
|
884
|
+
tempBounds: tempBounds$2,
|
|
813
885
|
set(t, x = 0, y = 0, width = 0, height = 0) {
|
|
814
886
|
t.x = x;
|
|
815
887
|
t.y = y;
|
|
@@ -860,7 +932,7 @@ const BoundsHelper = {
|
|
|
860
932
|
to = t;
|
|
861
933
|
}
|
|
862
934
|
else {
|
|
863
|
-
copy$
|
|
935
|
+
copy$a(to, t);
|
|
864
936
|
}
|
|
865
937
|
if (parent) {
|
|
866
938
|
to.offsetX = -(B.maxX(parent) - t.x);
|
|
@@ -872,8 +944,8 @@ const BoundsHelper = {
|
|
|
872
944
|
}
|
|
873
945
|
B.move(to, -to.offsetX, -to.offsetY);
|
|
874
946
|
},
|
|
875
|
-
scale(t, scaleX, scaleY = scaleX) {
|
|
876
|
-
PointHelper.scale(t, scaleX, scaleY);
|
|
947
|
+
scale(t, scaleX, scaleY = scaleX, onlySize) {
|
|
948
|
+
onlySize || PointHelper.scale(t, scaleX, scaleY);
|
|
877
949
|
t.width *= scaleX;
|
|
878
950
|
t.height *= scaleY;
|
|
879
951
|
},
|
|
@@ -883,9 +955,9 @@ const BoundsHelper = {
|
|
|
883
955
|
t.height *= scaleY;
|
|
884
956
|
},
|
|
885
957
|
tempToOuterOf(t, matrix) {
|
|
886
|
-
B.copy(
|
|
887
|
-
B.toOuterOf(
|
|
888
|
-
return
|
|
958
|
+
B.copy(tempBounds$2, t);
|
|
959
|
+
B.toOuterOf(tempBounds$2, matrix);
|
|
960
|
+
return tempBounds$2;
|
|
889
961
|
},
|
|
890
962
|
getOuterOf(t, matrix) {
|
|
891
963
|
t = Object.assign({}, t);
|
|
@@ -916,17 +988,17 @@ const BoundsHelper = {
|
|
|
916
988
|
else {
|
|
917
989
|
point.x = t.x;
|
|
918
990
|
point.y = t.y;
|
|
919
|
-
toOuterPoint$2(matrix, point, toPoint$
|
|
920
|
-
setPoint$2(tempPointBounds$1, toPoint$
|
|
991
|
+
toOuterPoint$2(matrix, point, toPoint$4);
|
|
992
|
+
setPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
|
|
921
993
|
point.x = t.x + t.width;
|
|
922
|
-
toOuterPoint$2(matrix, point, toPoint$
|
|
923
|
-
addPoint$2(tempPointBounds$1, toPoint$
|
|
994
|
+
toOuterPoint$2(matrix, point, toPoint$4);
|
|
995
|
+
addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
|
|
924
996
|
point.y = t.y + t.height;
|
|
925
|
-
toOuterPoint$2(matrix, point, toPoint$
|
|
926
|
-
addPoint$2(tempPointBounds$1, toPoint$
|
|
997
|
+
toOuterPoint$2(matrix, point, toPoint$4);
|
|
998
|
+
addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
|
|
927
999
|
point.x = t.x;
|
|
928
|
-
toOuterPoint$2(matrix, point, toPoint$
|
|
929
|
-
addPoint$2(tempPointBounds$1, toPoint$
|
|
1000
|
+
toOuterPoint$2(matrix, point, toPoint$4);
|
|
1001
|
+
addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
|
|
930
1002
|
toBounds$3(tempPointBounds$1, to);
|
|
931
1003
|
}
|
|
932
1004
|
},
|
|
@@ -936,9 +1008,21 @@ const BoundsHelper = {
|
|
|
936
1008
|
B.scale(to, 1 / matrix.a, 1 / matrix.d);
|
|
937
1009
|
},
|
|
938
1010
|
getFitMatrix(t, put, baseScale = 1) {
|
|
939
|
-
const scale = Math.min(baseScale,
|
|
1011
|
+
const scale = Math.min(baseScale, B.getFitScale(t, put));
|
|
940
1012
|
return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
|
|
941
1013
|
},
|
|
1014
|
+
getFitScale(t, put, isCoverMode) {
|
|
1015
|
+
const sw = t.width / put.width, sh = t.height / put.height;
|
|
1016
|
+
return isCoverMode ? Math.max(sw, sh) : Math.min(sw, sh);
|
|
1017
|
+
},
|
|
1018
|
+
put(t, put, align = 'center', putScale = 1, changeSize = true, to) {
|
|
1019
|
+
to || (to = put);
|
|
1020
|
+
if (typeof putScale === 'string')
|
|
1021
|
+
putScale = B.getFitScale(t, put, putScale === 'cover');
|
|
1022
|
+
tempBounds$2.width = changeSize ? put.width *= putScale : put.width * putScale;
|
|
1023
|
+
tempBounds$2.height = changeSize ? put.height *= putScale : put.height * putScale;
|
|
1024
|
+
AlignHelper.toPoint(align, tempBounds$2, t, to, true, true);
|
|
1025
|
+
},
|
|
942
1026
|
getSpread(t, spread, side) {
|
|
943
1027
|
const n = {};
|
|
944
1028
|
B.copyAndSpread(n, t, spread, false, side);
|
|
@@ -1006,7 +1090,7 @@ const BoundsHelper = {
|
|
|
1006
1090
|
if (first) {
|
|
1007
1091
|
first = false;
|
|
1008
1092
|
if (!addMode)
|
|
1009
|
-
copy$
|
|
1093
|
+
copy$a(t, bounds);
|
|
1010
1094
|
}
|
|
1011
1095
|
else {
|
|
1012
1096
|
add$1(t, bounds);
|
|
@@ -1087,7 +1171,7 @@ const BoundsHelper = {
|
|
|
1087
1171
|
}
|
|
1088
1172
|
};
|
|
1089
1173
|
const B = BoundsHelper;
|
|
1090
|
-
const { add: add$1, copy: copy$
|
|
1174
|
+
const { add: add$1, copy: copy$a } = B;
|
|
1091
1175
|
|
|
1092
1176
|
class Bounds {
|
|
1093
1177
|
get minX() { return BoundsHelper.minX(this); }
|
|
@@ -1112,8 +1196,8 @@ class Bounds {
|
|
|
1112
1196
|
BoundsHelper.move(this, x, y);
|
|
1113
1197
|
return this;
|
|
1114
1198
|
}
|
|
1115
|
-
scale(scaleX, scaleY) {
|
|
1116
|
-
BoundsHelper.scale(this, scaleX, scaleY);
|
|
1199
|
+
scale(scaleX, scaleY, onlySize) {
|
|
1200
|
+
BoundsHelper.scale(this, scaleX, scaleY, onlySize);
|
|
1117
1201
|
return this;
|
|
1118
1202
|
}
|
|
1119
1203
|
scaleOf(origin, scaleX, scaleY) {
|
|
@@ -1131,6 +1215,9 @@ class Bounds {
|
|
|
1131
1215
|
getFitMatrix(put, baseScale) {
|
|
1132
1216
|
return BoundsHelper.getFitMatrix(this, put, baseScale);
|
|
1133
1217
|
}
|
|
1218
|
+
put(put, align, putScale) {
|
|
1219
|
+
BoundsHelper.put(this, put, align, putScale);
|
|
1220
|
+
}
|
|
1134
1221
|
spread(fourNumber, side) {
|
|
1135
1222
|
BoundsHelper.spread(this, fourNumber, side);
|
|
1136
1223
|
return this;
|
|
@@ -1239,79 +1326,6 @@ class AutoBounds {
|
|
|
1239
1326
|
}
|
|
1240
1327
|
}
|
|
1241
1328
|
|
|
1242
|
-
var Direction4;
|
|
1243
|
-
(function (Direction4) {
|
|
1244
|
-
Direction4[Direction4["top"] = 0] = "top";
|
|
1245
|
-
Direction4[Direction4["right"] = 1] = "right";
|
|
1246
|
-
Direction4[Direction4["bottom"] = 2] = "bottom";
|
|
1247
|
-
Direction4[Direction4["left"] = 3] = "left";
|
|
1248
|
-
})(Direction4 || (Direction4 = {}));
|
|
1249
|
-
var Direction9;
|
|
1250
|
-
(function (Direction9) {
|
|
1251
|
-
Direction9[Direction9["topLeft"] = 0] = "topLeft";
|
|
1252
|
-
Direction9[Direction9["top"] = 1] = "top";
|
|
1253
|
-
Direction9[Direction9["topRight"] = 2] = "topRight";
|
|
1254
|
-
Direction9[Direction9["right"] = 3] = "right";
|
|
1255
|
-
Direction9[Direction9["bottomRight"] = 4] = "bottomRight";
|
|
1256
|
-
Direction9[Direction9["bottom"] = 5] = "bottom";
|
|
1257
|
-
Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
|
|
1258
|
-
Direction9[Direction9["left"] = 7] = "left";
|
|
1259
|
-
Direction9[Direction9["center"] = 8] = "center";
|
|
1260
|
-
Direction9[Direction9["top-left"] = 0] = "top-left";
|
|
1261
|
-
Direction9[Direction9["top-right"] = 2] = "top-right";
|
|
1262
|
-
Direction9[Direction9["bottom-right"] = 4] = "bottom-right";
|
|
1263
|
-
Direction9[Direction9["bottom-left"] = 6] = "bottom-left";
|
|
1264
|
-
})(Direction9 || (Direction9 = {}));
|
|
1265
|
-
|
|
1266
|
-
const directionData = [
|
|
1267
|
-
{ x: 0, y: 0 },
|
|
1268
|
-
{ x: 0.5, y: 0 },
|
|
1269
|
-
{ x: 1, y: 0 },
|
|
1270
|
-
{ x: 1, y: 0.5 },
|
|
1271
|
-
{ x: 1, y: 1 },
|
|
1272
|
-
{ x: 0.5, y: 1 },
|
|
1273
|
-
{ x: 0, y: 1 },
|
|
1274
|
-
{ x: 0, y: 0.5 },
|
|
1275
|
-
{ x: 0.5, y: 0.5 }
|
|
1276
|
-
];
|
|
1277
|
-
directionData.forEach(item => item.type = 'percent');
|
|
1278
|
-
const AroundHelper = {
|
|
1279
|
-
directionData,
|
|
1280
|
-
tempPoint: {},
|
|
1281
|
-
get: get$4,
|
|
1282
|
-
toPoint(around, bounds, to, onlySize, pointBounds) {
|
|
1283
|
-
const point = get$4(around);
|
|
1284
|
-
to.x = point.x;
|
|
1285
|
-
to.y = point.y;
|
|
1286
|
-
if (point.type === 'percent') {
|
|
1287
|
-
to.x *= bounds.width;
|
|
1288
|
-
to.y *= bounds.height;
|
|
1289
|
-
if (pointBounds) {
|
|
1290
|
-
to.x -= pointBounds.x;
|
|
1291
|
-
to.y -= pointBounds.y;
|
|
1292
|
-
if (point.x)
|
|
1293
|
-
to.x -= (point.x === 1) ? pointBounds.width : (point.x === 0.5 ? point.x * pointBounds.width : 0);
|
|
1294
|
-
if (point.y)
|
|
1295
|
-
to.y -= (point.y === 1) ? pointBounds.height : (point.y === 0.5 ? point.y * pointBounds.height : 0);
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
if (!onlySize) {
|
|
1299
|
-
to.x += bounds.x;
|
|
1300
|
-
to.y += bounds.y;
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
};
|
|
1304
|
-
function get$4(around) {
|
|
1305
|
-
return typeof around === 'string' ? directionData[Direction9[around]] : around;
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
const { toPoint: toPoint$4 } = AroundHelper;
|
|
1309
|
-
const AlignHelper = {
|
|
1310
|
-
toPoint(align, contentBounds, bounds, to, onlySize) {
|
|
1311
|
-
toPoint$4(align, bounds, to, onlySize, contentBounds);
|
|
1312
|
-
}
|
|
1313
|
-
};
|
|
1314
|
-
|
|
1315
1329
|
const StringNumberMap = {
|
|
1316
1330
|
'0': 1,
|
|
1317
1331
|
'1': 1,
|
|
@@ -1442,11 +1456,17 @@ const Plugin = {
|
|
|
1442
1456
|
return rs;
|
|
1443
1457
|
},
|
|
1444
1458
|
need(name) {
|
|
1445
|
-
console.error('please install plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name);
|
|
1459
|
+
console.error('please install and import plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name);
|
|
1446
1460
|
}
|
|
1447
1461
|
};
|
|
1448
1462
|
setTimeout(() => check.forEach(name => Plugin.has(name, true)));
|
|
1449
1463
|
|
|
1464
|
+
const Creator = {
|
|
1465
|
+
editor(_options) {
|
|
1466
|
+
return Plugin.need('editor');
|
|
1467
|
+
}
|
|
1468
|
+
};
|
|
1469
|
+
|
|
1450
1470
|
const debug$d = Debug.get('UICreator');
|
|
1451
1471
|
const UICreator = {
|
|
1452
1472
|
list: {},
|
|
@@ -1584,6 +1604,10 @@ const DataHelper = {
|
|
|
1584
1604
|
for (let i = 0, len = list.length; i < len; i++)
|
|
1585
1605
|
map[list[i]] = true;
|
|
1586
1606
|
return map;
|
|
1607
|
+
},
|
|
1608
|
+
stintSet(data, attrName, value) {
|
|
1609
|
+
value || (value = undefined);
|
|
1610
|
+
data[attrName] !== value && (data[attrName] = value);
|
|
1587
1611
|
}
|
|
1588
1612
|
};
|
|
1589
1613
|
const { assign } = DataHelper;
|
|
@@ -2042,7 +2066,7 @@ __decorate([
|
|
|
2042
2066
|
contextMethod()
|
|
2043
2067
|
], Canvas$1.prototype, "strokeText", null);
|
|
2044
2068
|
|
|
2045
|
-
const { copy: copy$
|
|
2069
|
+
const { copy: copy$9, multiplyParent: multiplyParent$3 } = MatrixHelper, { round: round$1 } = Math;
|
|
2046
2070
|
const minSize = { width: 1, height: 1, pixelRatio: 1 };
|
|
2047
2071
|
const canvasSizeAttrs = ['width', 'height', 'pixelRatio'];
|
|
2048
2072
|
class LeaferCanvasBase extends Canvas$1 {
|
|
@@ -2274,7 +2298,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2274
2298
|
const { size, pixelSnap } = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
|
|
2275
2299
|
canvas.save();
|
|
2276
2300
|
if (useSameWorldTransform)
|
|
2277
|
-
copy$
|
|
2301
|
+
copy$9(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
|
|
2278
2302
|
if (useSameSmooth)
|
|
2279
2303
|
canvas.smooth = this.smooth;
|
|
2280
2304
|
canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
|
|
@@ -2385,7 +2409,7 @@ const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI
|
|
|
2385
2409
|
const { setPoint: setPoint$1, addPoint: addPoint$1 } = TwoPointBoundsHelper;
|
|
2386
2410
|
const { set, toNumberPoints } = PointHelper;
|
|
2387
2411
|
const { M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
2388
|
-
const tempPoint$
|
|
2412
|
+
const tempPoint$1 = {};
|
|
2389
2413
|
const BezierHelper = {
|
|
2390
2414
|
points(data, originPoints, curve, close) {
|
|
2391
2415
|
let points = toNumberPoints(originPoints);
|
|
@@ -2407,6 +2431,8 @@ const BezierHelper = {
|
|
|
2407
2431
|
cY = points[i + 3];
|
|
2408
2432
|
ba = sqrt$1(pow(bX - aX, 2) + pow(bY - aY, 2));
|
|
2409
2433
|
cb = sqrt$1(pow(cX - bX, 2) + pow(cY - bY, 2));
|
|
2434
|
+
if (!ba && !cb)
|
|
2435
|
+
continue;
|
|
2410
2436
|
d = ba + cb;
|
|
2411
2437
|
ba = (t * ba) / d;
|
|
2412
2438
|
cb = (t * cb) / d;
|
|
@@ -2576,8 +2602,8 @@ const BezierHelper = {
|
|
|
2576
2602
|
addMode ? addPoint$1(pointBounds, fromX, fromY) : setPoint$1(pointBounds, fromX, fromY);
|
|
2577
2603
|
addPoint$1(pointBounds, toX, toY);
|
|
2578
2604
|
for (let i = 0, len = tList.length; i < len; i++) {
|
|
2579
|
-
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$
|
|
2580
|
-
addPoint$1(pointBounds, tempPoint$
|
|
2605
|
+
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$1);
|
|
2606
|
+
addPoint$1(pointBounds, tempPoint$1.x, tempPoint$1.y);
|
|
2581
2607
|
}
|
|
2582
2608
|
},
|
|
2583
2609
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -2589,7 +2615,11 @@ const BezierHelper = {
|
|
|
2589
2615
|
const point = {};
|
|
2590
2616
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, point);
|
|
2591
2617
|
return point;
|
|
2592
|
-
}
|
|
2618
|
+
},
|
|
2619
|
+
getDerivative(t, fromV, v1, v2, toV) {
|
|
2620
|
+
const o = 1 - t;
|
|
2621
|
+
return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
|
|
2622
|
+
},
|
|
2593
2623
|
};
|
|
2594
2624
|
const { getPointAndSet, toTwoPointBounds: toTwoPointBounds$1, ellipse: ellipse$6 } = BezierHelper;
|
|
2595
2625
|
|
|
@@ -2647,7 +2677,7 @@ const EllipseHelper = {
|
|
|
2647
2677
|
};
|
|
2648
2678
|
|
|
2649
2679
|
const { M: M$4, m, L: L$5, l, H, h, V, v, C: C$3, c, S, s, Q: Q$3, q, T, t, A, a, Z: Z$4, z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3 } = PathCommandMap;
|
|
2650
|
-
const { rect: rect$
|
|
2680
|
+
const { rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
|
|
2651
2681
|
const { ellipticalArc } = EllipseHelper;
|
|
2652
2682
|
const debug$b = Debug.get('PathConvert');
|
|
2653
2683
|
const setEndPoint$1 = {};
|
|
@@ -2844,7 +2874,7 @@ const PathConvert = {
|
|
|
2844
2874
|
case N$3:
|
|
2845
2875
|
x = old[i + 1];
|
|
2846
2876
|
y = old[i + 2];
|
|
2847
|
-
curveMode ? rect$
|
|
2877
|
+
curveMode ? rect$3(data, x, y, old[i + 3], old[i + 4]) : copyData(data, old, i, 5);
|
|
2848
2878
|
i += 5;
|
|
2849
2879
|
break;
|
|
2850
2880
|
case D$3:
|
|
@@ -3020,7 +3050,7 @@ const PathCommandDataHelper = {
|
|
|
3020
3050
|
};
|
|
3021
3051
|
const { ellipse: ellipse$3, arc: arc$2 } = PathCommandDataHelper;
|
|
3022
3052
|
|
|
3023
|
-
const { moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo, bezierCurveTo, closePath: closePath$3, beginPath, rect: rect$
|
|
3053
|
+
const { moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo, bezierCurveTo, closePath: closePath$3, beginPath, rect: rect$2, roundRect: roundRect$1, ellipse: ellipse$2, arc: arc$1, arcTo: arcTo$2, drawEllipse, drawArc, drawPoints: drawPoints$2 } = PathCommandDataHelper;
|
|
3024
3054
|
class PathCreator {
|
|
3025
3055
|
set path(value) { this.__path = value; }
|
|
3026
3056
|
get path() { return this.__path; }
|
|
@@ -3067,7 +3097,7 @@ class PathCreator {
|
|
|
3067
3097
|
return this;
|
|
3068
3098
|
}
|
|
3069
3099
|
rect(x, y, width, height) {
|
|
3070
|
-
rect$
|
|
3100
|
+
rect$2(this.__path, x, y, width, height);
|
|
3071
3101
|
this.paint();
|
|
3072
3102
|
return this;
|
|
3073
3103
|
}
|
|
@@ -3185,7 +3215,7 @@ const PathDrawer = {
|
|
|
3185
3215
|
|
|
3186
3216
|
const { M: M$1, L: L$2, C, Q, Z: Z$1, N, D, X, G, F: F$1, O, P, U } = PathCommandMap;
|
|
3187
3217
|
const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse: ellipse$1 } = BezierHelper;
|
|
3188
|
-
const { addPointBounds, copy: copy$
|
|
3218
|
+
const { addPointBounds, copy: copy$8, addPoint, setPoint, addBounds, toBounds: toBounds$2 } = TwoPointBoundsHelper;
|
|
3189
3219
|
const debug$9 = Debug.get('PathBounds');
|
|
3190
3220
|
let radius, radiusX, radiusY;
|
|
3191
3221
|
const tempPointBounds = {};
|
|
@@ -3257,7 +3287,7 @@ const PathBounds = {
|
|
|
3257
3287
|
break;
|
|
3258
3288
|
case G:
|
|
3259
3289
|
ellipse$1(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], data[i + 7], data[i + 8], tempPointBounds, setEndPoint);
|
|
3260
|
-
i === 0 ? copy$
|
|
3290
|
+
i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3261
3291
|
x = setEndPoint.x;
|
|
3262
3292
|
y = setEndPoint.y;
|
|
3263
3293
|
i += 9;
|
|
@@ -3273,7 +3303,7 @@ const PathBounds = {
|
|
|
3273
3303
|
break;
|
|
3274
3304
|
case O:
|
|
3275
3305
|
arc(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], tempPointBounds, setEndPoint);
|
|
3276
|
-
i === 0 ? copy$
|
|
3306
|
+
i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3277
3307
|
x = setEndPoint.x;
|
|
3278
3308
|
y = setEndPoint.y;
|
|
3279
3309
|
i += 7;
|
|
@@ -3288,7 +3318,7 @@ const PathBounds = {
|
|
|
3288
3318
|
break;
|
|
3289
3319
|
case U:
|
|
3290
3320
|
arcTo$1(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
|
|
3291
|
-
i === 0 ? copy$
|
|
3321
|
+
i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3292
3322
|
x = setEndPoint.x;
|
|
3293
3323
|
y = setEndPoint.y;
|
|
3294
3324
|
i += 6;
|
|
@@ -3382,7 +3412,7 @@ function canvasPatch(drawer) {
|
|
|
3382
3412
|
}
|
|
3383
3413
|
|
|
3384
3414
|
const FileHelper = {
|
|
3385
|
-
|
|
3415
|
+
alphaPixelTypes: ['png', 'webp', 'svg'],
|
|
3386
3416
|
upperCaseTypeMap: {},
|
|
3387
3417
|
mineType(type) {
|
|
3388
3418
|
if (!type || type.startsWith('image'))
|
|
@@ -3409,7 +3439,7 @@ const FileHelper = {
|
|
|
3409
3439
|
}
|
|
3410
3440
|
};
|
|
3411
3441
|
const F = FileHelper;
|
|
3412
|
-
F.
|
|
3442
|
+
F.alphaPixelTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3413
3443
|
|
|
3414
3444
|
const debug$8 = Debug.get('TaskProcessor');
|
|
3415
3445
|
class TaskItem {
|
|
@@ -3726,8 +3756,8 @@ const ImageManager = {
|
|
|
3726
3756
|
list.length = 0;
|
|
3727
3757
|
}
|
|
3728
3758
|
},
|
|
3729
|
-
|
|
3730
|
-
return FileHelper.
|
|
3759
|
+
hasAlphaPixel(config) {
|
|
3760
|
+
return FileHelper.alphaPixelTypes.some(item => I.isFormat(item, config));
|
|
3731
3761
|
},
|
|
3732
3762
|
isFormat(format, config) {
|
|
3733
3763
|
if (config.format === format)
|
|
@@ -3765,13 +3795,16 @@ class LeaferImage {
|
|
|
3765
3795
|
this.setView(view.config ? view.view : view);
|
|
3766
3796
|
}
|
|
3767
3797
|
ImageManager.isFormat('svg', config) && (this.isSVG = true);
|
|
3768
|
-
ImageManager.
|
|
3798
|
+
ImageManager.hasAlphaPixel(config) && (this.hasAlphaPixel = true);
|
|
3769
3799
|
}
|
|
3770
3800
|
load(onSuccess, onError) {
|
|
3771
3801
|
if (!this.loading) {
|
|
3772
3802
|
this.loading = true;
|
|
3803
|
+
let { loadImage, loadImageWithProgress } = Platform.origin, onProgress = this.config.showProgress && loadImageWithProgress && this.onProgress.bind(this);
|
|
3804
|
+
if (onProgress)
|
|
3805
|
+
loadImage = loadImageWithProgress;
|
|
3773
3806
|
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
3774
|
-
return yield
|
|
3807
|
+
return yield loadImage(this.url, onProgress).then(img => this.setView(img)).catch((e) => {
|
|
3775
3808
|
this.error = e;
|
|
3776
3809
|
this.onComplete(false);
|
|
3777
3810
|
});
|
|
@@ -3796,6 +3829,9 @@ class LeaferImage {
|
|
|
3796
3829
|
this.view = img;
|
|
3797
3830
|
this.onComplete(true);
|
|
3798
3831
|
}
|
|
3832
|
+
onProgress(progress) {
|
|
3833
|
+
this.progress = progress;
|
|
3834
|
+
}
|
|
3799
3835
|
onComplete(isSuccess) {
|
|
3800
3836
|
let odd;
|
|
3801
3837
|
this.waitComplete.forEach((item, index) => {
|
|
@@ -4218,8 +4254,8 @@ function registerUIEvent() {
|
|
|
4218
4254
|
};
|
|
4219
4255
|
}
|
|
4220
4256
|
|
|
4221
|
-
const { copy: copy$
|
|
4222
|
-
const matrix = {}, { round } = Math;
|
|
4257
|
+
const { copy: copy$7, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
|
|
4258
|
+
const matrix$1 = {}, { round } = Math;
|
|
4223
4259
|
const LeafHelper = {
|
|
4224
4260
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
4225
4261
|
if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
|
|
@@ -4261,13 +4297,20 @@ const LeafHelper = {
|
|
|
4261
4297
|
if (leaf.isBranch) {
|
|
4262
4298
|
const { children } = leaf;
|
|
4263
4299
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
4264
|
-
updateAllWorldOpacity
|
|
4300
|
+
updateAllWorldOpacity(children[i]);
|
|
4265
4301
|
}
|
|
4266
4302
|
}
|
|
4267
4303
|
},
|
|
4268
|
-
|
|
4269
|
-
|
|
4304
|
+
updateChange(leaf) {
|
|
4305
|
+
const layout = leaf.__layout;
|
|
4306
|
+
if (layout.stateStyleChanged)
|
|
4307
|
+
leaf.updateState();
|
|
4308
|
+
if (layout.opacityChanged)
|
|
4309
|
+
updateAllWorldOpacity(leaf);
|
|
4270
4310
|
leaf.__updateChange();
|
|
4311
|
+
},
|
|
4312
|
+
updateAllChange(leaf) {
|
|
4313
|
+
updateChange$1(leaf);
|
|
4271
4314
|
if (leaf.isBranch) {
|
|
4272
4315
|
const { children } = leaf;
|
|
4273
4316
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
@@ -4307,13 +4350,13 @@ const LeafHelper = {
|
|
|
4307
4350
|
transition = scaleY;
|
|
4308
4351
|
scaleY = scaleX;
|
|
4309
4352
|
}
|
|
4310
|
-
copy$
|
|
4311
|
-
scaleOfOuter$2(matrix, origin, scaleX, scaleY);
|
|
4353
|
+
copy$7(matrix$1, o);
|
|
4354
|
+
scaleOfOuter$2(matrix$1, origin, scaleX, scaleY);
|
|
4312
4355
|
if (t.origin || t.around) {
|
|
4313
|
-
L.setTransform(t, matrix, resize, transition);
|
|
4356
|
+
L.setTransform(t, matrix$1, resize, transition);
|
|
4314
4357
|
}
|
|
4315
4358
|
else {
|
|
4316
|
-
const x = t.x + matrix.e - o.e, y = t.y + matrix.f - o.f;
|
|
4359
|
+
const x = t.x + matrix$1.e - o.e, y = t.y + matrix$1.f - o.f;
|
|
4317
4360
|
if (transition && !resize)
|
|
4318
4361
|
t.animate({ x, y, scaleX: t.scaleX * scaleX, scaleY: t.scaleY * scaleY }, transition);
|
|
4319
4362
|
else
|
|
@@ -4325,32 +4368,32 @@ const LeafHelper = {
|
|
|
4325
4368
|
},
|
|
4326
4369
|
rotateOfLocal(t, origin, angle, transition) {
|
|
4327
4370
|
const o = t.__localMatrix;
|
|
4328
|
-
copy$
|
|
4329
|
-
rotateOfOuter$2(matrix, origin, angle);
|
|
4371
|
+
copy$7(matrix$1, o);
|
|
4372
|
+
rotateOfOuter$2(matrix$1, origin, angle);
|
|
4330
4373
|
if (t.origin || t.around)
|
|
4331
|
-
L.setTransform(t, matrix, false, transition);
|
|
4374
|
+
L.setTransform(t, matrix$1, false, transition);
|
|
4332
4375
|
else
|
|
4333
|
-
t.set({ x: t.x + matrix.e - o.e, y: t.y + matrix.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
|
|
4376
|
+
t.set({ x: t.x + matrix$1.e - o.e, y: t.y + matrix$1.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
|
|
4334
4377
|
},
|
|
4335
4378
|
skewOfWorld(t, origin, skewX, skewY, resize, transition) {
|
|
4336
4379
|
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
|
|
4337
4380
|
},
|
|
4338
4381
|
skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
|
|
4339
|
-
copy$
|
|
4340
|
-
skewOfOuter(matrix, origin, skewX, skewY);
|
|
4341
|
-
L.setTransform(t, matrix, resize, transition);
|
|
4382
|
+
copy$7(matrix$1, t.__localMatrix);
|
|
4383
|
+
skewOfOuter(matrix$1, origin, skewX, skewY);
|
|
4384
|
+
L.setTransform(t, matrix$1, resize, transition);
|
|
4342
4385
|
},
|
|
4343
4386
|
transformWorld(t, transform, resize, transition) {
|
|
4344
|
-
copy$
|
|
4345
|
-
multiplyParent$2(matrix, transform);
|
|
4387
|
+
copy$7(matrix$1, t.worldTransform);
|
|
4388
|
+
multiplyParent$2(matrix$1, transform);
|
|
4346
4389
|
if (t.parent)
|
|
4347
|
-
divideParent(matrix, t.parent.worldTransform);
|
|
4348
|
-
L.setTransform(t, matrix, resize, transition);
|
|
4390
|
+
divideParent(matrix$1, t.parent.worldTransform);
|
|
4391
|
+
L.setTransform(t, matrix$1, resize, transition);
|
|
4349
4392
|
},
|
|
4350
4393
|
transform(t, transform, resize, transition) {
|
|
4351
|
-
copy$
|
|
4352
|
-
multiplyParent$2(matrix, transform);
|
|
4353
|
-
L.setTransform(t, matrix, resize, transition);
|
|
4394
|
+
copy$7(matrix$1, t.localTransform);
|
|
4395
|
+
multiplyParent$2(matrix$1, transform);
|
|
4396
|
+
L.setTransform(t, matrix$1, resize, transition);
|
|
4354
4397
|
},
|
|
4355
4398
|
setTransform(t, transform, resize, transition) {
|
|
4356
4399
|
const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
|
|
@@ -4384,9 +4427,9 @@ const LeafHelper = {
|
|
|
4384
4427
|
return innerOrigin;
|
|
4385
4428
|
},
|
|
4386
4429
|
getRelativeWorld(t, relative, temp) {
|
|
4387
|
-
copy$
|
|
4388
|
-
divideParent(matrix, relative.worldTransform);
|
|
4389
|
-
return temp ? matrix : Object.assign({}, matrix);
|
|
4430
|
+
copy$7(matrix$1, t.worldTransform);
|
|
4431
|
+
divideParent(matrix$1, relative.worldTransform);
|
|
4432
|
+
return temp ? matrix$1 : Object.assign({}, matrix$1);
|
|
4390
4433
|
},
|
|
4391
4434
|
drop(t, parent, index, resize) {
|
|
4392
4435
|
t.setTransform(L.getRelativeWorld(t, parent, true), resize);
|
|
@@ -4403,7 +4446,7 @@ const LeafHelper = {
|
|
|
4403
4446
|
}
|
|
4404
4447
|
};
|
|
4405
4448
|
const L = LeafHelper;
|
|
4406
|
-
const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity:
|
|
4449
|
+
const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1 } = L;
|
|
4407
4450
|
function getTempLocal(t, world) {
|
|
4408
4451
|
t.__layout.update();
|
|
4409
4452
|
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
@@ -4440,7 +4483,7 @@ const LeafBoundsHelper = {
|
|
|
4440
4483
|
}
|
|
4441
4484
|
};
|
|
4442
4485
|
|
|
4443
|
-
const { updateBounds: updateBounds$
|
|
4486
|
+
const { updateBounds: updateBounds$3 } = LeafHelper;
|
|
4444
4487
|
const BranchHelper = {
|
|
4445
4488
|
sort(a, b) {
|
|
4446
4489
|
return (a.__.zIndex === b.__.zIndex) ? (a.__tempNumber - b.__tempNumber) : (a.__.zIndex - b.__.zIndex);
|
|
@@ -4502,11 +4545,11 @@ const BranchHelper = {
|
|
|
4502
4545
|
branch = branchStack[i];
|
|
4503
4546
|
children = branch.children;
|
|
4504
4547
|
for (let j = 0, len = children.length; j < len; j++) {
|
|
4505
|
-
updateBounds$
|
|
4548
|
+
updateBounds$3(children[j]);
|
|
4506
4549
|
}
|
|
4507
4550
|
if (exclude && exclude === branch)
|
|
4508
4551
|
continue;
|
|
4509
|
-
updateBounds$
|
|
4552
|
+
updateBounds$3(branch);
|
|
4510
4553
|
}
|
|
4511
4554
|
}
|
|
4512
4555
|
};
|
|
@@ -4524,8 +4567,8 @@ const WaitHelper = {
|
|
|
4524
4567
|
}
|
|
4525
4568
|
};
|
|
4526
4569
|
|
|
4527
|
-
const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
|
|
4528
|
-
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$
|
|
4570
|
+
const { getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2 } = LeafHelper;
|
|
4571
|
+
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$6 } = BoundsHelper;
|
|
4529
4572
|
const localContent = '_localContentBounds';
|
|
4530
4573
|
const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
|
|
4531
4574
|
class LeafLayout {
|
|
@@ -4568,7 +4611,9 @@ class LeafLayout {
|
|
|
4568
4611
|
this._localRenderBounds = local;
|
|
4569
4612
|
}
|
|
4570
4613
|
update() {
|
|
4571
|
-
const { leafer } =
|
|
4614
|
+
const { leaf } = this, { leafer } = leaf;
|
|
4615
|
+
if (leaf.isApp)
|
|
4616
|
+
return updateBounds$2(leaf);
|
|
4572
4617
|
if (leafer) {
|
|
4573
4618
|
if (leafer.ready)
|
|
4574
4619
|
leafer.watcher.changed && leafer.layouter.layout();
|
|
@@ -4576,7 +4621,7 @@ class LeafLayout {
|
|
|
4576
4621
|
leafer.start();
|
|
4577
4622
|
}
|
|
4578
4623
|
else {
|
|
4579
|
-
let root =
|
|
4624
|
+
let root = leaf;
|
|
4580
4625
|
while (root.parent && !root.parent.leafer) {
|
|
4581
4626
|
root = root.parent;
|
|
4582
4627
|
}
|
|
@@ -4683,7 +4728,7 @@ class LeafLayout {
|
|
|
4683
4728
|
}
|
|
4684
4729
|
if (!layoutBounds)
|
|
4685
4730
|
layoutBounds = MatrixHelper.getLayout(matrix);
|
|
4686
|
-
copy$
|
|
4731
|
+
copy$6(layoutBounds, bounds);
|
|
4687
4732
|
PointHelper.copy(layoutBounds, point);
|
|
4688
4733
|
if (unscale) {
|
|
4689
4734
|
const { scaleX, scaleY } = layoutBounds;
|
|
@@ -4798,7 +4843,7 @@ class LeafLayout {
|
|
|
4798
4843
|
}
|
|
4799
4844
|
childrenSortChange() {
|
|
4800
4845
|
if (!this.childrenSortChanged) {
|
|
4801
|
-
this.childrenSortChanged = true;
|
|
4846
|
+
this.childrenSortChanged = this.affectChildrenSort = true;
|
|
4802
4847
|
this.leaf.forceUpdate('surface');
|
|
4803
4848
|
}
|
|
4804
4849
|
}
|
|
@@ -4865,6 +4910,40 @@ ImageEvent.LOAD = 'image.load';
|
|
|
4865
4910
|
ImageEvent.LOADED = 'image.loaded';
|
|
4866
4911
|
ImageEvent.ERROR = 'image.error';
|
|
4867
4912
|
|
|
4913
|
+
class BoundsEvent extends Event {
|
|
4914
|
+
static checkHas(leaf, type, mode) {
|
|
4915
|
+
if (mode === 'on') {
|
|
4916
|
+
type === WORLD ? leaf.__hasWorldEvent = true : leaf.__hasLocalEvent = true;
|
|
4917
|
+
}
|
|
4918
|
+
else {
|
|
4919
|
+
leaf.__hasLocalEvent = leaf.hasEvent(RESIZE) || leaf.hasEvent(INNER) || leaf.hasEvent(LOCAL);
|
|
4920
|
+
leaf.__hasWorldEvent = leaf.hasEvent(WORLD);
|
|
4921
|
+
}
|
|
4922
|
+
}
|
|
4923
|
+
static emitLocal(leaf) {
|
|
4924
|
+
if (leaf.leaferIsReady) {
|
|
4925
|
+
const { resized } = leaf.__layout;
|
|
4926
|
+
if (resized !== 'local') {
|
|
4927
|
+
leaf.emit(RESIZE, leaf);
|
|
4928
|
+
if (resized === 'inner')
|
|
4929
|
+
leaf.emit(INNER, leaf);
|
|
4930
|
+
}
|
|
4931
|
+
leaf.emit(LOCAL, leaf);
|
|
4932
|
+
}
|
|
4933
|
+
}
|
|
4934
|
+
static emitWorld(leaf) {
|
|
4935
|
+
if (leaf.leaferIsReady)
|
|
4936
|
+
leaf.emit(WORLD, this);
|
|
4937
|
+
}
|
|
4938
|
+
}
|
|
4939
|
+
BoundsEvent.RESIZE = 'bounds.resize';
|
|
4940
|
+
BoundsEvent.INNER = 'bounds.inner';
|
|
4941
|
+
BoundsEvent.LOCAL = 'bounds.local';
|
|
4942
|
+
BoundsEvent.WORLD = 'bounds.world';
|
|
4943
|
+
const { RESIZE, INNER, LOCAL, WORLD } = BoundsEvent;
|
|
4944
|
+
const boundsEventMap = {};
|
|
4945
|
+
[RESIZE, INNER, LOCAL, WORLD].forEach(key => boundsEventMap[key] = 1);
|
|
4946
|
+
|
|
4868
4947
|
class ResizeEvent extends Event {
|
|
4869
4948
|
get bigger() {
|
|
4870
4949
|
if (!this.old)
|
|
@@ -4961,9 +5040,12 @@ class Eventer {
|
|
|
4961
5040
|
set event(map) { this.on(map); }
|
|
4962
5041
|
on(type, listener, options) {
|
|
4963
5042
|
if (!listener) {
|
|
4964
|
-
let event
|
|
4965
|
-
|
|
4966
|
-
|
|
5043
|
+
let event;
|
|
5044
|
+
if (type instanceof Array)
|
|
5045
|
+
type.forEach(item => this.on(item[0], item[1], item[2]));
|
|
5046
|
+
else
|
|
5047
|
+
for (let key in type)
|
|
5048
|
+
(event = type[key]) instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event);
|
|
4967
5049
|
return;
|
|
4968
5050
|
}
|
|
4969
5051
|
let capture, once;
|
|
@@ -4993,6 +5075,8 @@ class Eventer {
|
|
|
4993
5075
|
else {
|
|
4994
5076
|
map[type] = [item];
|
|
4995
5077
|
}
|
|
5078
|
+
if (boundsEventMap[type])
|
|
5079
|
+
BoundsEvent.checkHas(this, type, 'on');
|
|
4996
5080
|
}
|
|
4997
5081
|
});
|
|
4998
5082
|
}
|
|
@@ -5014,6 +5098,8 @@ class Eventer {
|
|
|
5014
5098
|
events.splice(index, 1);
|
|
5015
5099
|
if (!events.length)
|
|
5016
5100
|
delete map[type];
|
|
5101
|
+
if (boundsEventMap[type])
|
|
5102
|
+
BoundsEvent.checkHas(this, type, 'off');
|
|
5017
5103
|
}
|
|
5018
5104
|
}
|
|
5019
5105
|
});
|
|
@@ -5033,19 +5119,31 @@ class Eventer {
|
|
|
5033
5119
|
}
|
|
5034
5120
|
}
|
|
5035
5121
|
on_(type, listener, bind, options) {
|
|
5036
|
-
if (
|
|
5037
|
-
|
|
5038
|
-
|
|
5122
|
+
if (!listener)
|
|
5123
|
+
(type instanceof Array) && type.forEach(item => this.on(item[0], item[2] ? item[1] = item[1].bind(item[2]) : item[1], item[3]));
|
|
5124
|
+
else
|
|
5125
|
+
this.on(type, bind ? listener = listener.bind(bind) : listener, options);
|
|
5039
5126
|
return { type, current: this, listener, options };
|
|
5040
5127
|
}
|
|
5041
5128
|
off_(id) {
|
|
5042
5129
|
if (!id)
|
|
5043
5130
|
return;
|
|
5044
5131
|
const list = id instanceof Array ? id : [id];
|
|
5045
|
-
list.forEach(item =>
|
|
5132
|
+
list.forEach(item => {
|
|
5133
|
+
if (!item.listener)
|
|
5134
|
+
(item.type instanceof Array) && item.type.forEach(v => item.current.off(v[0], v[1], v[3]));
|
|
5135
|
+
else
|
|
5136
|
+
item.current.off(item.type, item.listener, item.options);
|
|
5137
|
+
});
|
|
5046
5138
|
list.length = 0;
|
|
5047
5139
|
}
|
|
5048
|
-
once(type, listener, capture) {
|
|
5140
|
+
once(type, listener, captureOrBind, capture) {
|
|
5141
|
+
if (!listener)
|
|
5142
|
+
return (type instanceof Array) && type.forEach(item => this.once(item[0], item[1], item[2], item[3]));
|
|
5143
|
+
if (typeof captureOrBind === 'object')
|
|
5144
|
+
listener = listener.bind(captureOrBind);
|
|
5145
|
+
else
|
|
5146
|
+
capture = captureOrBind;
|
|
5049
5147
|
this.on(type, listener, { once: true, capture });
|
|
5050
5148
|
}
|
|
5051
5149
|
emit(type, event, capture) {
|
|
@@ -5157,7 +5255,7 @@ const LeafDataProxy = {
|
|
|
5157
5255
|
};
|
|
5158
5256
|
|
|
5159
5257
|
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
5160
|
-
const { toPoint: toPoint$3, tempPoint
|
|
5258
|
+
const { toPoint: toPoint$3, tempPoint } = AroundHelper;
|
|
5161
5259
|
const LeafMatrix = {
|
|
5162
5260
|
__updateWorldMatrix() {
|
|
5163
5261
|
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
|
|
@@ -5166,33 +5264,39 @@ const LeafMatrix = {
|
|
|
5166
5264
|
if (this.__local) {
|
|
5167
5265
|
const layout = this.__layout, local = this.__local, data = this.__;
|
|
5168
5266
|
if (layout.affectScaleOrRotation) {
|
|
5169
|
-
if (layout.scaleChanged || layout.rotationChanged) {
|
|
5267
|
+
if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
|
|
5170
5268
|
setLayout(local, data, null, null, layout.affectRotation);
|
|
5171
|
-
layout.scaleChanged = layout.rotationChanged =
|
|
5269
|
+
layout.scaleChanged = layout.rotationChanged = undefined;
|
|
5172
5270
|
}
|
|
5173
5271
|
}
|
|
5174
5272
|
local.e = data.x + data.offsetX;
|
|
5175
5273
|
local.f = data.y + data.offsetY;
|
|
5176
5274
|
if (data.around || data.origin) {
|
|
5177
|
-
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint
|
|
5178
|
-
translateInner(local, -tempPoint
|
|
5275
|
+
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint);
|
|
5276
|
+
translateInner(local, -tempPoint.x, -tempPoint.y, !data.around);
|
|
5179
5277
|
}
|
|
5180
5278
|
}
|
|
5181
|
-
this.__layout.matrixChanged =
|
|
5279
|
+
this.__layout.matrixChanged = undefined;
|
|
5182
5280
|
}
|
|
5183
5281
|
};
|
|
5184
5282
|
|
|
5185
5283
|
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
|
|
5186
5284
|
const { updateBounds: updateBounds$1 } = BranchHelper;
|
|
5187
|
-
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$
|
|
5285
|
+
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5 } = BoundsHelper;
|
|
5188
5286
|
const { toBounds: toBounds$1 } = PathBounds;
|
|
5189
5287
|
const LeafBounds = {
|
|
5190
5288
|
__updateWorldBounds() {
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5289
|
+
const layout = this.__layout;
|
|
5290
|
+
toOuterOf$1(layout.renderBounds, this.__world, this.__world);
|
|
5291
|
+
if (layout.resized) {
|
|
5292
|
+
if (layout.resized === 'inner')
|
|
5293
|
+
this.__onUpdateSize();
|
|
5294
|
+
if (this.__hasLocalEvent)
|
|
5295
|
+
BoundsEvent.emitLocal(this);
|
|
5296
|
+
layout.resized = undefined;
|
|
5195
5297
|
}
|
|
5298
|
+
if (this.__hasWorldEvent)
|
|
5299
|
+
BoundsEvent.emitWorld(this);
|
|
5196
5300
|
},
|
|
5197
5301
|
__updateLocalBounds() {
|
|
5198
5302
|
const layout = this.__layout;
|
|
@@ -5201,12 +5305,12 @@ const LeafBounds = {
|
|
|
5201
5305
|
this.__updatePath();
|
|
5202
5306
|
this.__updateRenderPath();
|
|
5203
5307
|
this.__updateBoxBounds();
|
|
5204
|
-
layout.resized =
|
|
5308
|
+
layout.resized = 'inner';
|
|
5205
5309
|
}
|
|
5206
5310
|
if (layout.localBoxChanged) {
|
|
5207
5311
|
if (this.__local)
|
|
5208
5312
|
this.__updateLocalBoxBounds();
|
|
5209
|
-
layout.localBoxChanged =
|
|
5313
|
+
layout.localBoxChanged = undefined;
|
|
5210
5314
|
if (layout.strokeSpread)
|
|
5211
5315
|
layout.strokeChanged = true;
|
|
5212
5316
|
if (layout.renderSpread)
|
|
@@ -5214,7 +5318,7 @@ const LeafBounds = {
|
|
|
5214
5318
|
if (this.parent)
|
|
5215
5319
|
this.parent.__layout.boxChange();
|
|
5216
5320
|
}
|
|
5217
|
-
layout.boxChanged =
|
|
5321
|
+
layout.boxChanged = undefined;
|
|
5218
5322
|
if (layout.strokeChanged) {
|
|
5219
5323
|
layout.strokeSpread = this.__updateStrokeSpread();
|
|
5220
5324
|
if (layout.strokeSpread) {
|
|
@@ -5226,12 +5330,12 @@ const LeafBounds = {
|
|
|
5226
5330
|
else {
|
|
5227
5331
|
layout.spreadStrokeCancel();
|
|
5228
5332
|
}
|
|
5229
|
-
layout.strokeChanged =
|
|
5333
|
+
layout.strokeChanged = undefined;
|
|
5230
5334
|
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
|
|
5231
5335
|
layout.renderChanged = true;
|
|
5232
5336
|
if (this.parent)
|
|
5233
5337
|
this.parent.__layout.strokeChange();
|
|
5234
|
-
layout.resized =
|
|
5338
|
+
layout.resized = 'inner';
|
|
5235
5339
|
}
|
|
5236
5340
|
if (layout.renderChanged) {
|
|
5237
5341
|
layout.renderSpread = this.__updateRenderSpread();
|
|
@@ -5244,11 +5348,12 @@ const LeafBounds = {
|
|
|
5244
5348
|
else {
|
|
5245
5349
|
layout.spreadRenderCancel();
|
|
5246
5350
|
}
|
|
5247
|
-
layout.renderChanged =
|
|
5351
|
+
layout.renderChanged = undefined;
|
|
5248
5352
|
if (this.parent)
|
|
5249
5353
|
this.parent.__layout.renderChange();
|
|
5250
5354
|
}
|
|
5251
|
-
layout.
|
|
5355
|
+
layout.resized || (layout.resized = 'local');
|
|
5356
|
+
layout.boundsChanged = undefined;
|
|
5252
5357
|
},
|
|
5253
5358
|
__updateLocalBoxBounds() {
|
|
5254
5359
|
if (this.__hasMotionPath)
|
|
@@ -5308,7 +5413,7 @@ const LeafBounds = {
|
|
|
5308
5413
|
},
|
|
5309
5414
|
__updateRenderBounds() {
|
|
5310
5415
|
const layout = this.__layout;
|
|
5311
|
-
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$
|
|
5416
|
+
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
|
|
5312
5417
|
}
|
|
5313
5418
|
};
|
|
5314
5419
|
|
|
@@ -5413,7 +5518,7 @@ const BranchRender = {
|
|
|
5413
5518
|
const { LEAF, create } = IncrementId;
|
|
5414
5519
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5415
5520
|
const { toOuterOf } = BoundsHelper;
|
|
5416
|
-
const { copy: copy$
|
|
5521
|
+
const { copy: copy$4, move } = PointHelper;
|
|
5417
5522
|
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5418
5523
|
let Leaf = class Leaf {
|
|
5419
5524
|
get tag() { return this.__tag; }
|
|
@@ -5626,7 +5731,7 @@ let Leaf = class Leaf {
|
|
|
5626
5731
|
}
|
|
5627
5732
|
else {
|
|
5628
5733
|
if (to)
|
|
5629
|
-
copy$
|
|
5734
|
+
copy$4(to, world);
|
|
5630
5735
|
}
|
|
5631
5736
|
}
|
|
5632
5737
|
localToWorld(local, to, distance, relative) {
|
|
@@ -5635,7 +5740,7 @@ let Leaf = class Leaf {
|
|
|
5635
5740
|
}
|
|
5636
5741
|
else {
|
|
5637
5742
|
if (to)
|
|
5638
|
-
copy$
|
|
5743
|
+
copy$4(to, local);
|
|
5639
5744
|
}
|
|
5640
5745
|
}
|
|
5641
5746
|
worldToInner(world, to, distance, relative) {
|
|
@@ -5788,7 +5893,7 @@ let Leaf = class Leaf {
|
|
|
5788
5893
|
off(_type, _listener, _options) { }
|
|
5789
5894
|
on_(_type, _listener, _bind, _options) { return undefined; }
|
|
5790
5895
|
off_(_id) { }
|
|
5791
|
-
once(_type, _listener, _capture) { }
|
|
5896
|
+
once(_type, _listener, _captureOrBind, _capture) { }
|
|
5792
5897
|
emit(_type, _event, _capture) { }
|
|
5793
5898
|
emitEvent(_event, _capture) { }
|
|
5794
5899
|
hasEvent(_type, _capture) { return false; }
|
|
@@ -6125,7 +6230,7 @@ class LeafLevelList {
|
|
|
6125
6230
|
}
|
|
6126
6231
|
}
|
|
6127
6232
|
|
|
6128
|
-
const version = "1.6.
|
|
6233
|
+
const version = "1.6.3";
|
|
6129
6234
|
|
|
6130
6235
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6131
6236
|
get allowBackgroundColor() { return false; }
|
|
@@ -6423,17 +6528,15 @@ class Watcher {
|
|
|
6423
6528
|
this.target.emitEvent(new WatchEvent(WatchEvent.DATA, { updatedList: this.updatedList }));
|
|
6424
6529
|
this.__updatedList = new LeafList();
|
|
6425
6530
|
this.totalTimes++;
|
|
6426
|
-
this.changed = false;
|
|
6427
|
-
this.hasVisible = false;
|
|
6428
|
-
this.hasRemove = false;
|
|
6429
|
-
this.hasAdd = false;
|
|
6531
|
+
this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
6430
6532
|
}
|
|
6431
6533
|
__listenEvents() {
|
|
6432
|
-
const { target } = this;
|
|
6433
6534
|
this.__eventIds = [
|
|
6434
|
-
target.on_(
|
|
6435
|
-
|
|
6436
|
-
|
|
6535
|
+
this.target.on_([
|
|
6536
|
+
[PropertyEvent.CHANGE, this.__onAttrChange, this],
|
|
6537
|
+
[[ChildEvent.ADD, ChildEvent.REMOVE], this.__onChildEvent, this],
|
|
6538
|
+
[WatchEvent.REQUEST, this.__onRquestData, this]
|
|
6539
|
+
])
|
|
6437
6540
|
];
|
|
6438
6541
|
}
|
|
6439
6542
|
__removeListenEvents() {
|
|
@@ -6443,13 +6546,12 @@ class Watcher {
|
|
|
6443
6546
|
if (this.target) {
|
|
6444
6547
|
this.stop();
|
|
6445
6548
|
this.__removeListenEvents();
|
|
6446
|
-
this.target = null;
|
|
6447
|
-
this.__updatedList = null;
|
|
6549
|
+
this.target = this.__updatedList = null;
|
|
6448
6550
|
}
|
|
6449
6551
|
}
|
|
6450
6552
|
}
|
|
6451
6553
|
|
|
6452
|
-
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds,
|
|
6554
|
+
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds, updateChange: updateOneChange } = LeafHelper;
|
|
6453
6555
|
const { pushAllChildBranch, pushAllParent } = BranchHelper;
|
|
6454
6556
|
function updateMatrix(updateList, levelList) {
|
|
6455
6557
|
let layout;
|
|
@@ -6492,15 +6594,7 @@ function updateBounds(boundsList) {
|
|
|
6492
6594
|
});
|
|
6493
6595
|
}
|
|
6494
6596
|
function updateChange(updateList) {
|
|
6495
|
-
|
|
6496
|
-
updateList.list.forEach(leaf => {
|
|
6497
|
-
layout = leaf.__layout;
|
|
6498
|
-
if (layout.opacityChanged)
|
|
6499
|
-
updateAllWorldOpacity(leaf);
|
|
6500
|
-
if (layout.stateStyleChanged)
|
|
6501
|
-
setTimeout(() => layout.stateStyleChanged && leaf.updateState());
|
|
6502
|
-
leaf.__updateChange();
|
|
6503
|
-
});
|
|
6597
|
+
updateList.list.forEach(updateOneChange);
|
|
6504
6598
|
}
|
|
6505
6599
|
|
|
6506
6600
|
const { worldBounds } = LeafBoundsHelper;
|
|
@@ -6557,7 +6651,7 @@ class Layouter {
|
|
|
6557
6651
|
this.disabled = true;
|
|
6558
6652
|
}
|
|
6559
6653
|
layout() {
|
|
6560
|
-
if (!this.running)
|
|
6654
|
+
if (this.layouting || !this.running)
|
|
6561
6655
|
return;
|
|
6562
6656
|
const { target } = this;
|
|
6563
6657
|
this.times = 0;
|
|
@@ -6640,12 +6734,10 @@ class Layouter {
|
|
|
6640
6734
|
}
|
|
6641
6735
|
static fullLayout(target) {
|
|
6642
6736
|
updateAllMatrix(target, true);
|
|
6643
|
-
if (target.isBranch)
|
|
6737
|
+
if (target.isBranch)
|
|
6644
6738
|
BranchHelper.updateBounds(target);
|
|
6645
|
-
|
|
6646
|
-
else {
|
|
6739
|
+
else
|
|
6647
6740
|
LeafHelper.updateBounds(target);
|
|
6648
|
-
}
|
|
6649
6741
|
updateAllChange(target);
|
|
6650
6742
|
}
|
|
6651
6743
|
addExtra(leaf) {
|
|
@@ -6668,11 +6760,12 @@ class Layouter {
|
|
|
6668
6760
|
this.__updatedList = event.data.updatedList;
|
|
6669
6761
|
}
|
|
6670
6762
|
__listenEvents() {
|
|
6671
|
-
const { target } = this;
|
|
6672
6763
|
this.__eventIds = [
|
|
6673
|
-
target.on_(
|
|
6674
|
-
|
|
6675
|
-
|
|
6764
|
+
this.target.on_([
|
|
6765
|
+
[LayoutEvent.REQUEST, this.layout, this],
|
|
6766
|
+
[LayoutEvent.AGAIN, this.layoutAgain, this],
|
|
6767
|
+
[WatchEvent.DATA, this.__onReceiveWatchData, this]
|
|
6768
|
+
])
|
|
6676
6769
|
];
|
|
6677
6770
|
}
|
|
6678
6771
|
__removeListenEvents() {
|
|
@@ -6903,12 +6996,13 @@ class Renderer {
|
|
|
6903
6996
|
this.target.emitEvent(new RenderEvent(type, this.times, bounds, options));
|
|
6904
6997
|
}
|
|
6905
6998
|
__listenEvents() {
|
|
6906
|
-
const { target } = this;
|
|
6907
6999
|
this.__eventIds = [
|
|
6908
|
-
target.on_(
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
7000
|
+
this.target.on_([
|
|
7001
|
+
[RenderEvent.REQUEST, this.update, this],
|
|
7002
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
7003
|
+
[RenderEvent.AGAIN, this.renderAgain, this],
|
|
7004
|
+
[ResizeEvent.RESIZE, this.__onResize, this]
|
|
7005
|
+
])
|
|
6912
7006
|
];
|
|
6913
7007
|
}
|
|
6914
7008
|
__removeListenEvents() {
|
|
@@ -6967,8 +7061,32 @@ function zoomLayerType() {
|
|
|
6967
7061
|
};
|
|
6968
7062
|
}
|
|
6969
7063
|
|
|
7064
|
+
function hasTransparent$3(color) {
|
|
7065
|
+
if (!color || color.length === 7 || color.length === 4)
|
|
7066
|
+
return false;
|
|
7067
|
+
if (color === 'transparent')
|
|
7068
|
+
return true;
|
|
7069
|
+
const first = color[0];
|
|
7070
|
+
if (first === '#') {
|
|
7071
|
+
switch (color.length) {
|
|
7072
|
+
case 5: return color[4] !== 'f' && color[4] !== 'F';
|
|
7073
|
+
case 9: return (color[7] !== 'f' && color[7] !== 'F') || (color[8] !== 'f' && color[8] !== 'F');
|
|
7074
|
+
}
|
|
7075
|
+
}
|
|
7076
|
+
else if (first === 'r' || first === 'h') {
|
|
7077
|
+
if (color[3] === 'a') {
|
|
7078
|
+
const i = color.lastIndexOf(',');
|
|
7079
|
+
if (i > -1)
|
|
7080
|
+
return parseFloat(color.slice(i + 1)) < 1;
|
|
7081
|
+
}
|
|
7082
|
+
}
|
|
7083
|
+
return false;
|
|
7084
|
+
}
|
|
7085
|
+
|
|
6970
7086
|
const TextConvert = {};
|
|
6971
|
-
const ColorConvert = {
|
|
7087
|
+
const ColorConvert = {
|
|
7088
|
+
hasTransparent: hasTransparent$3
|
|
7089
|
+
};
|
|
6972
7090
|
const UnitConvert = {
|
|
6973
7091
|
number(value, percentRefer) {
|
|
6974
7092
|
return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
|
|
@@ -6994,6 +7112,7 @@ const Transition = {
|
|
|
6994
7112
|
};
|
|
6995
7113
|
|
|
6996
7114
|
const { parse, objectToCanvasData } = PathConvert;
|
|
7115
|
+
const { stintSet: stintSet$2 } = DataHelper, { hasTransparent: hasTransparent$2 } = ColorConvert;
|
|
6997
7116
|
const emptyPaint = {};
|
|
6998
7117
|
const debug$1 = Debug.get('UIData');
|
|
6999
7118
|
class UIData extends LeafData {
|
|
@@ -7052,38 +7171,22 @@ class UIData extends LeafData {
|
|
|
7052
7171
|
if (this.__naturalWidth)
|
|
7053
7172
|
this.__removeNaturalSize();
|
|
7054
7173
|
if (typeof value === 'string' || !value) {
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
PaintImage.recycleImage('fill', this);
|
|
7058
|
-
this.__isFills = false;
|
|
7059
|
-
this.__pixelFill && (this.__pixelFill = false);
|
|
7060
|
-
}
|
|
7174
|
+
stintSet$2(this, '__isTransparentFill', hasTransparent$2(value));
|
|
7175
|
+
this.__isFills && this.__removePaint('fill', true);
|
|
7061
7176
|
this._fill = value;
|
|
7062
7177
|
}
|
|
7063
7178
|
else if (typeof value === 'object') {
|
|
7064
|
-
this.
|
|
7065
|
-
const layout = this.__leaf.__layout;
|
|
7066
|
-
layout.boxChanged || layout.boxChange();
|
|
7067
|
-
this.__isFills = true;
|
|
7068
|
-
this._fill || (this._fill = emptyPaint);
|
|
7179
|
+
this.__setPaint('fill', value);
|
|
7069
7180
|
}
|
|
7070
7181
|
}
|
|
7071
7182
|
setStroke(value) {
|
|
7072
7183
|
if (typeof value === 'string' || !value) {
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
PaintImage.recycleImage('stroke', this);
|
|
7076
|
-
this.__isStrokes = false;
|
|
7077
|
-
this.__pixelStroke && (this.__pixelStroke = false);
|
|
7078
|
-
}
|
|
7184
|
+
stintSet$2(this, '__isTransparentStroke', hasTransparent$2(value));
|
|
7185
|
+
this.__isStrokes && this.__removePaint('stroke', true);
|
|
7079
7186
|
this._stroke = value;
|
|
7080
7187
|
}
|
|
7081
7188
|
else if (typeof value === 'object') {
|
|
7082
|
-
this.
|
|
7083
|
-
const layout = this.__leaf.__layout;
|
|
7084
|
-
layout.boxChanged || layout.boxChange();
|
|
7085
|
-
this.__isStrokes = true;
|
|
7086
|
-
this._stroke || (this._stroke = emptyPaint);
|
|
7189
|
+
this.__setPaint('stroke', value);
|
|
7087
7190
|
}
|
|
7088
7191
|
}
|
|
7089
7192
|
setPath(value) {
|
|
@@ -7113,7 +7216,34 @@ class UIData extends LeafData {
|
|
|
7113
7216
|
Paint.compute('fill', this.__leaf);
|
|
7114
7217
|
if (stroke)
|
|
7115
7218
|
Paint.compute('stroke', this.__leaf);
|
|
7116
|
-
this.__needComputePaint =
|
|
7219
|
+
this.__needComputePaint = undefined;
|
|
7220
|
+
}
|
|
7221
|
+
__setPaint(attrName, value) {
|
|
7222
|
+
this.__setInput(attrName, value);
|
|
7223
|
+
const layout = this.__leaf.__layout;
|
|
7224
|
+
layout.boxChanged || layout.boxChange();
|
|
7225
|
+
if (value instanceof Array && !value.length) {
|
|
7226
|
+
this.__removePaint(attrName);
|
|
7227
|
+
}
|
|
7228
|
+
else {
|
|
7229
|
+
if (attrName === 'fill')
|
|
7230
|
+
this.__isFills = true, this._fill || (this._fill = emptyPaint);
|
|
7231
|
+
else
|
|
7232
|
+
this.__isStrokes = true, this._stroke || (this._stroke = emptyPaint);
|
|
7233
|
+
}
|
|
7234
|
+
}
|
|
7235
|
+
__removePaint(attrName, removeInput) {
|
|
7236
|
+
if (removeInput)
|
|
7237
|
+
this.__removeInput(attrName);
|
|
7238
|
+
PaintImage.recycleImage(attrName, this);
|
|
7239
|
+
if (attrName === 'fill') {
|
|
7240
|
+
stintSet$2(this, '__isAlphaPixelFill', undefined);
|
|
7241
|
+
this._fill = this.__isFills = undefined;
|
|
7242
|
+
}
|
|
7243
|
+
else {
|
|
7244
|
+
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7245
|
+
this._stroke = this.__isStrokes = undefined;
|
|
7246
|
+
}
|
|
7117
7247
|
}
|
|
7118
7248
|
}
|
|
7119
7249
|
function setArray(data, key, value) {
|
|
@@ -7121,10 +7251,10 @@ function setArray(data, key, value) {
|
|
|
7121
7251
|
if (value instanceof Array) {
|
|
7122
7252
|
if (value.some((item) => item.visible === false))
|
|
7123
7253
|
value = value.filter((item) => item.visible !== false);
|
|
7124
|
-
value.length || (value =
|
|
7254
|
+
value.length || (value = undefined);
|
|
7125
7255
|
}
|
|
7126
7256
|
else
|
|
7127
|
-
value = value && value.visible !== false ? [value] :
|
|
7257
|
+
value = value && value.visible !== false ? [value] : undefined;
|
|
7128
7258
|
data['_' + key] = value;
|
|
7129
7259
|
}
|
|
7130
7260
|
|
|
@@ -7188,13 +7318,11 @@ class TextData extends UIData {
|
|
|
7188
7318
|
setFontWeight(value) {
|
|
7189
7319
|
if (typeof value === 'string') {
|
|
7190
7320
|
this.__setInput('fontWeight', value);
|
|
7191
|
-
|
|
7192
|
-
}
|
|
7193
|
-
else {
|
|
7194
|
-
if (this.__input)
|
|
7195
|
-
this.__removeInput('fontWeight');
|
|
7196
|
-
this._fontWeight = value;
|
|
7321
|
+
value = fontWeightMap[value] || 400;
|
|
7197
7322
|
}
|
|
7323
|
+
else if (this.__input)
|
|
7324
|
+
this.__removeInput('fontWeight');
|
|
7325
|
+
this._fontWeight = value;
|
|
7198
7326
|
}
|
|
7199
7327
|
setBoxStyle(value) {
|
|
7200
7328
|
let t = this.__leaf, box = t.__box;
|
|
@@ -7229,8 +7357,6 @@ class ImageData extends RectData {
|
|
|
7229
7357
|
this._url = value;
|
|
7230
7358
|
}
|
|
7231
7359
|
__setImageFill(value) {
|
|
7232
|
-
if (this.__leaf.image)
|
|
7233
|
-
this.__leaf.image = null;
|
|
7234
7360
|
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
7235
7361
|
}
|
|
7236
7362
|
__getData() {
|
|
@@ -7296,21 +7422,19 @@ const UIBounds = {
|
|
|
7296
7422
|
}
|
|
7297
7423
|
};
|
|
7298
7424
|
|
|
7425
|
+
const { stintSet: stintSet$1 } = DataHelper;
|
|
7299
7426
|
const UIRender = {
|
|
7300
7427
|
__updateChange() {
|
|
7301
|
-
const data = this.__
|
|
7428
|
+
const data = this.__;
|
|
7302
7429
|
if (data.__useEffect) {
|
|
7303
|
-
const { shadow,
|
|
7304
|
-
data.
|
|
7430
|
+
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7431
|
+
stintSet$1(data, '__isFastShadow', shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !(shadow[0].box && data.__isTransparentFill) && fill && !(fill instanceof Array && fill.length > 1) && (this.useFastShadow || !stroke || (stroke && data.strokeAlign === 'inside')));
|
|
7432
|
+
data.__useEffect = !!(shadow || otherEffect);
|
|
7305
7433
|
}
|
|
7306
|
-
|
|
7307
|
-
|
|
7434
|
+
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7435
|
+
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7308
7436
|
data.__checkSingle();
|
|
7309
|
-
|
|
7310
|
-
if (complex)
|
|
7311
|
-
data.__complex = true;
|
|
7312
|
-
else
|
|
7313
|
-
data.__complex && (data.__complex = false);
|
|
7437
|
+
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7314
7438
|
},
|
|
7315
7439
|
__drawFast(canvas, options) {
|
|
7316
7440
|
drawFast(this, canvas, options);
|
|
@@ -7320,21 +7444,23 @@ const UIRender = {
|
|
|
7320
7444
|
if (data.__complex) {
|
|
7321
7445
|
if (data.__needComputePaint)
|
|
7322
7446
|
data.__computePaint();
|
|
7323
|
-
const { fill, stroke, __drawAfterFill } = data;
|
|
7447
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke, __isFastShadow } = data;
|
|
7324
7448
|
this.__drawRenderPath(canvas);
|
|
7325
|
-
if (data.__useEffect) {
|
|
7449
|
+
if (data.__useEffect && !__isFastShadow) {
|
|
7326
7450
|
const shape = Paint.shape(this, canvas, options);
|
|
7327
7451
|
this.__nowWorld = this.__getNowWorld(options);
|
|
7328
7452
|
const { shadow, innerShadow, filter } = data;
|
|
7329
7453
|
if (shadow)
|
|
7330
7454
|
Effect.shadow(this, canvas, shape);
|
|
7455
|
+
if (__fillAfterStroke)
|
|
7456
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7331
7457
|
if (fill)
|
|
7332
7458
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7333
7459
|
if (__drawAfterFill)
|
|
7334
7460
|
this.__drawAfterFill(canvas, options);
|
|
7335
7461
|
if (innerShadow)
|
|
7336
7462
|
Effect.innerShadow(this, canvas, shape);
|
|
7337
|
-
if (stroke)
|
|
7463
|
+
if (stroke && !__fillAfterStroke)
|
|
7338
7464
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7339
7465
|
if (filter)
|
|
7340
7466
|
Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
@@ -7343,21 +7469,27 @@ const UIRender = {
|
|
|
7343
7469
|
shape.canvas.recycle();
|
|
7344
7470
|
}
|
|
7345
7471
|
else {
|
|
7472
|
+
if (__fillAfterStroke)
|
|
7473
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7474
|
+
if (__isFastShadow) {
|
|
7475
|
+
const shadow = data.shadow[0], { scaleX, scaleY } = this.__nowWorld;
|
|
7476
|
+
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
7477
|
+
}
|
|
7346
7478
|
if (fill)
|
|
7347
7479
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7480
|
+
if (__isFastShadow)
|
|
7481
|
+
canvas.restore();
|
|
7348
7482
|
if (__drawAfterFill)
|
|
7349
7483
|
this.__drawAfterFill(canvas, options);
|
|
7350
|
-
if (stroke)
|
|
7484
|
+
if (stroke && !__fillAfterStroke)
|
|
7351
7485
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7352
7486
|
}
|
|
7353
7487
|
}
|
|
7354
7488
|
else {
|
|
7355
|
-
if (data.__pathInputed)
|
|
7489
|
+
if (data.__pathInputed)
|
|
7356
7490
|
drawFast(this, canvas, options);
|
|
7357
|
-
|
|
7358
|
-
else {
|
|
7491
|
+
else
|
|
7359
7492
|
this.__drawFast(canvas, options);
|
|
7360
|
-
}
|
|
7361
7493
|
}
|
|
7362
7494
|
},
|
|
7363
7495
|
__renderShape(canvas, options, ignoreFill, ignoreStroke) {
|
|
@@ -7366,11 +7498,11 @@ const UIRender = {
|
|
|
7366
7498
|
const { fill, stroke } = this.__;
|
|
7367
7499
|
this.__drawRenderPath(canvas);
|
|
7368
7500
|
if (fill && !ignoreFill)
|
|
7369
|
-
this.__.
|
|
7501
|
+
this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7370
7502
|
if (this.__.__isCanvas)
|
|
7371
7503
|
this.__drawAfterFill(canvas, options);
|
|
7372
7504
|
if (stroke && !ignoreStroke)
|
|
7373
|
-
this.__.
|
|
7505
|
+
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7374
7506
|
}
|
|
7375
7507
|
},
|
|
7376
7508
|
__drawAfterFill(canvas, options) {
|
|
@@ -7385,13 +7517,15 @@ const UIRender = {
|
|
|
7385
7517
|
}
|
|
7386
7518
|
};
|
|
7387
7519
|
function drawFast(ui, canvas, options) {
|
|
7388
|
-
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
7520
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke } = ui.__;
|
|
7389
7521
|
ui.__drawRenderPath(canvas);
|
|
7522
|
+
if (__fillAfterStroke)
|
|
7523
|
+
Paint.stroke(stroke, ui, canvas);
|
|
7390
7524
|
if (fill)
|
|
7391
7525
|
Paint.fill(fill, ui, canvas);
|
|
7392
7526
|
if (__drawAfterFill)
|
|
7393
7527
|
ui.__drawAfterFill(canvas, options);
|
|
7394
|
-
if (stroke)
|
|
7528
|
+
if (stroke && !__fillAfterStroke)
|
|
7395
7529
|
Paint.stroke(stroke, ui, canvas);
|
|
7396
7530
|
}
|
|
7397
7531
|
|
|
@@ -7521,6 +7655,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7521
7655
|
else
|
|
7522
7656
|
drawer.rect(x, y, width, height);
|
|
7523
7657
|
}
|
|
7658
|
+
drawImagePlaceholder(canvas, _image) {
|
|
7659
|
+
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7660
|
+
}
|
|
7524
7661
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7525
7662
|
return Plugin.need('animate');
|
|
7526
7663
|
}
|
|
@@ -7757,6 +7894,12 @@ __decorate([
|
|
|
7757
7894
|
__decorate([
|
|
7758
7895
|
effectType()
|
|
7759
7896
|
], UI.prototype, "filter", void 0);
|
|
7897
|
+
__decorate([
|
|
7898
|
+
surfaceType()
|
|
7899
|
+
], UI.prototype, "placeholderColor", void 0);
|
|
7900
|
+
__decorate([
|
|
7901
|
+
dataType(100)
|
|
7902
|
+
], UI.prototype, "placeholderDelay", void 0);
|
|
7760
7903
|
__decorate([
|
|
7761
7904
|
dataType({})
|
|
7762
7905
|
], UI.prototype, "data", void 0);
|
|
@@ -8158,15 +8301,20 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8158
8301
|
}
|
|
8159
8302
|
__listenEvents() {
|
|
8160
8303
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8161
|
-
this.once(
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8304
|
+
this.once([
|
|
8305
|
+
[LeaferEvent.START, () => Run.end(runId)],
|
|
8306
|
+
[LayoutEvent.START, this.updateLazyBounds, this],
|
|
8307
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
8308
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
8309
|
+
]);
|
|
8310
|
+
this.__eventIds.push(this.on_([
|
|
8311
|
+
[WatchEvent.DATA, this.__onWatchData, this],
|
|
8312
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
8313
|
+
[RenderEvent.NEXT, this.__onNextRender, this]
|
|
8314
|
+
]));
|
|
8166
8315
|
}
|
|
8167
8316
|
__removeListenEvents() {
|
|
8168
8317
|
this.off_(this.__eventIds);
|
|
8169
|
-
this.__eventIds.length = 0;
|
|
8170
8318
|
}
|
|
8171
8319
|
destroy(sync) {
|
|
8172
8320
|
const doDestory = () => {
|
|
@@ -8226,8 +8374,8 @@ Rect = __decorate([
|
|
|
8226
8374
|
registerUI()
|
|
8227
8375
|
], Rect);
|
|
8228
8376
|
|
|
8229
|
-
const { copy: copy$
|
|
8230
|
-
const rect = Rect.prototype, group = Group.prototype;
|
|
8377
|
+
const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
|
|
8378
|
+
const rect$1 = Rect.prototype, group = Group.prototype;
|
|
8231
8379
|
const childrenRenderBounds = {};
|
|
8232
8380
|
let Box = class Box extends Group {
|
|
8233
8381
|
get __tag() { return 'Box'; }
|
|
@@ -8272,15 +8420,15 @@ let Box = class Box extends Group {
|
|
|
8272
8420
|
const { renderBounds } = this.__layout;
|
|
8273
8421
|
if (this.children.length) {
|
|
8274
8422
|
super.__updateRenderBounds();
|
|
8275
|
-
copy$
|
|
8423
|
+
copy$3(childrenRenderBounds, renderBounds);
|
|
8276
8424
|
this.__updateRectRenderBounds();
|
|
8277
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8425
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8278
8426
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8279
8427
|
add(renderBounds, childrenRenderBounds);
|
|
8280
8428
|
}
|
|
8281
8429
|
else
|
|
8282
8430
|
this.__updateRectRenderBounds();
|
|
8283
|
-
|
|
8431
|
+
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8284
8432
|
}
|
|
8285
8433
|
__updateRectRenderBounds() { }
|
|
8286
8434
|
__updateRectChange() { }
|
|
@@ -8324,25 +8472,25 @@ __decorate([
|
|
|
8324
8472
|
affectRenderBoundsType('show')
|
|
8325
8473
|
], Box.prototype, "overflow", void 0);
|
|
8326
8474
|
__decorate([
|
|
8327
|
-
rewrite(rect.__updateStrokeSpread)
|
|
8475
|
+
rewrite(rect$1.__updateStrokeSpread)
|
|
8328
8476
|
], Box.prototype, "__updateStrokeSpread", null);
|
|
8329
8477
|
__decorate([
|
|
8330
|
-
rewrite(rect.__updateRenderSpread)
|
|
8478
|
+
rewrite(rect$1.__updateRenderSpread)
|
|
8331
8479
|
], Box.prototype, "__updateRectRenderSpread", null);
|
|
8332
8480
|
__decorate([
|
|
8333
|
-
rewrite(rect.__updateBoxBounds)
|
|
8481
|
+
rewrite(rect$1.__updateBoxBounds)
|
|
8334
8482
|
], Box.prototype, "__updateRectBoxBounds", null);
|
|
8335
8483
|
__decorate([
|
|
8336
|
-
rewrite(rect.__updateStrokeBounds)
|
|
8484
|
+
rewrite(rect$1.__updateStrokeBounds)
|
|
8337
8485
|
], Box.prototype, "__updateStrokeBounds", null);
|
|
8338
8486
|
__decorate([
|
|
8339
|
-
rewrite(rect.__updateRenderBounds)
|
|
8487
|
+
rewrite(rect$1.__updateRenderBounds)
|
|
8340
8488
|
], Box.prototype, "__updateRectRenderBounds", null);
|
|
8341
8489
|
__decorate([
|
|
8342
|
-
rewrite(rect.__updateChange)
|
|
8490
|
+
rewrite(rect$1.__updateChange)
|
|
8343
8491
|
], Box.prototype, "__updateRectChange", null);
|
|
8344
8492
|
__decorate([
|
|
8345
|
-
rewrite(rect.__render)
|
|
8493
|
+
rewrite(rect$1.__render)
|
|
8346
8494
|
], Box.prototype, "__renderRect", null);
|
|
8347
8495
|
__decorate([
|
|
8348
8496
|
rewrite(group.__render)
|
|
@@ -8584,17 +8732,10 @@ Star = __decorate([
|
|
|
8584
8732
|
|
|
8585
8733
|
let Image = class Image extends Rect {
|
|
8586
8734
|
get __tag() { return 'Image'; }
|
|
8587
|
-
get ready() {
|
|
8735
|
+
get ready() { const { image } = this; return image && image.ready; }
|
|
8736
|
+
get image() { const { fill } = this.__; return fill instanceof Array && fill[0].image; }
|
|
8588
8737
|
constructor(data) {
|
|
8589
8738
|
super(data);
|
|
8590
|
-
this.on(ImageEvent.LOADED, (e) => {
|
|
8591
|
-
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8592
|
-
this.image = e.image;
|
|
8593
|
-
});
|
|
8594
|
-
}
|
|
8595
|
-
destroy() {
|
|
8596
|
-
this.image = null;
|
|
8597
|
-
super.destroy();
|
|
8598
8739
|
}
|
|
8599
8740
|
};
|
|
8600
8741
|
__decorate([
|
|
@@ -8610,11 +8751,11 @@ const MyImage = Image;
|
|
|
8610
8751
|
|
|
8611
8752
|
let Canvas = class Canvas extends Rect {
|
|
8612
8753
|
get __tag() { return 'Canvas'; }
|
|
8754
|
+
get context() { return this.canvas.context; }
|
|
8613
8755
|
get ready() { return !this.url; }
|
|
8614
8756
|
constructor(data) {
|
|
8615
8757
|
super(data);
|
|
8616
8758
|
this.canvas = Creator.canvas(this.__);
|
|
8617
|
-
this.context = this.canvas.context;
|
|
8618
8759
|
if (data && data.url)
|
|
8619
8760
|
this.drawImage(data.url);
|
|
8620
8761
|
}
|
|
@@ -8658,7 +8799,7 @@ let Canvas = class Canvas extends Rect {
|
|
|
8658
8799
|
destroy() {
|
|
8659
8800
|
if (this.canvas) {
|
|
8660
8801
|
this.canvas.destroy();
|
|
8661
|
-
this.canvas =
|
|
8802
|
+
this.canvas = null;
|
|
8662
8803
|
}
|
|
8663
8804
|
super.destroy();
|
|
8664
8805
|
}
|
|
@@ -8704,7 +8845,7 @@ let Text = class Text extends UI {
|
|
|
8704
8845
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8705
8846
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8706
8847
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8707
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8848
|
+
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__);
|
|
8708
8849
|
}
|
|
8709
8850
|
__updateBoxBounds() {
|
|
8710
8851
|
const data = this.__;
|
|
@@ -8734,12 +8875,11 @@ let Text = class Text extends UI {
|
|
|
8734
8875
|
super.__updateBoxBounds();
|
|
8735
8876
|
if (italic)
|
|
8736
8877
|
b.width += fontSize * 0.16;
|
|
8737
|
-
|
|
8738
|
-
if (isOverflow)
|
|
8878
|
+
DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds));
|
|
8879
|
+
if (this.isOverflow)
|
|
8739
8880
|
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8740
8881
|
else
|
|
8741
8882
|
data.__textBoxBounds = b;
|
|
8742
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8743
8883
|
}
|
|
8744
8884
|
__onUpdateSize() {
|
|
8745
8885
|
if (this.__box)
|
|
@@ -8802,6 +8942,9 @@ __decorate([
|
|
|
8802
8942
|
__decorate([
|
|
8803
8943
|
boundsType('')
|
|
8804
8944
|
], Text.prototype, "text", void 0);
|
|
8945
|
+
__decorate([
|
|
8946
|
+
boundsType('')
|
|
8947
|
+
], Text.prototype, "placeholder", void 0);
|
|
8805
8948
|
__decorate([
|
|
8806
8949
|
boundsType('caption')
|
|
8807
8950
|
], Text.prototype, "fontFamily", void 0);
|
|
@@ -8921,8 +9064,10 @@ function penPathType() {
|
|
|
8921
9064
|
}
|
|
8922
9065
|
|
|
8923
9066
|
function fillText(ui, canvas) {
|
|
8924
|
-
|
|
8925
|
-
|
|
9067
|
+
const data = ui.__, { rows, decorationY } = data.__textDrawData;
|
|
9068
|
+
if (data.__isPlacehold && data.placeholderColor)
|
|
9069
|
+
canvas.fillStyle = data.placeholderColor;
|
|
9070
|
+
let row;
|
|
8926
9071
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
8927
9072
|
row = rows[i];
|
|
8928
9073
|
if (row.text)
|
|
@@ -8931,7 +9076,7 @@ function fillText(ui, canvas) {
|
|
|
8931
9076
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
8932
9077
|
}
|
|
8933
9078
|
if (decorationY) {
|
|
8934
|
-
const { decorationColor, decorationHeight } = data;
|
|
9079
|
+
const { decorationColor, decorationHeight } = data.__textDrawData;
|
|
8935
9080
|
if (decorationColor)
|
|
8936
9081
|
canvas.fillStyle = decorationColor;
|
|
8937
9082
|
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
@@ -8940,65 +9085,596 @@ function fillText(ui, canvas) {
|
|
|
8940
9085
|
|
|
8941
9086
|
function fill(fill, ui, canvas) {
|
|
8942
9087
|
canvas.fillStyle = fill;
|
|
8943
|
-
|
|
9088
|
+
fillPathOrText(ui, canvas);
|
|
8944
9089
|
}
|
|
8945
9090
|
function fills(fills, ui, canvas) {
|
|
8946
9091
|
let item;
|
|
8947
|
-
const { windingRule, __font } = ui.__;
|
|
8948
9092
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
8949
9093
|
item = fills[i];
|
|
8950
|
-
if (item.image
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
if (item.blendMode)
|
|
8958
|
-
canvas.blendMode = item.blendMode;
|
|
8959
|
-
__font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
|
|
8960
|
-
canvas.restore();
|
|
9094
|
+
if (item.image) {
|
|
9095
|
+
if (PaintImage.checkImage(ui, canvas, item, !ui.__.__font))
|
|
9096
|
+
continue;
|
|
9097
|
+
if (!item.style) {
|
|
9098
|
+
if (!i && item.image.isPlacehold)
|
|
9099
|
+
ui.drawImagePlaceholder(canvas, item.image);
|
|
9100
|
+
continue;
|
|
8961
9101
|
}
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
9102
|
+
}
|
|
9103
|
+
canvas.fillStyle = item.style;
|
|
9104
|
+
if (item.transform) {
|
|
9105
|
+
canvas.save();
|
|
9106
|
+
canvas.transform(item.transform);
|
|
9107
|
+
if (item.blendMode)
|
|
9108
|
+
canvas.blendMode = item.blendMode;
|
|
9109
|
+
fillPathOrText(ui, canvas);
|
|
9110
|
+
canvas.restore();
|
|
9111
|
+
}
|
|
9112
|
+
else {
|
|
9113
|
+
if (item.blendMode) {
|
|
9114
|
+
canvas.saveBlendMode(item.blendMode);
|
|
9115
|
+
fillPathOrText(ui, canvas);
|
|
9116
|
+
canvas.restoreBlendMode();
|
|
8971
9117
|
}
|
|
9118
|
+
else
|
|
9119
|
+
fillPathOrText(ui, canvas);
|
|
8972
9120
|
}
|
|
8973
9121
|
}
|
|
8974
9122
|
}
|
|
9123
|
+
function fillPathOrText(ui, canvas) {
|
|
9124
|
+
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
9125
|
+
}
|
|
9126
|
+
|
|
9127
|
+
let App = class App extends Leafer {
|
|
9128
|
+
get __tag() { return 'App'; }
|
|
9129
|
+
get isApp() { return true; }
|
|
9130
|
+
constructor(userConfig, data) {
|
|
9131
|
+
super(userConfig, data);
|
|
9132
|
+
}
|
|
9133
|
+
init(userConfig, parentApp) {
|
|
9134
|
+
super.init(userConfig, parentApp);
|
|
9135
|
+
if (userConfig) {
|
|
9136
|
+
const { ground, tree, sky, editor } = userConfig;
|
|
9137
|
+
if (ground)
|
|
9138
|
+
this.ground = this.addLeafer(ground);
|
|
9139
|
+
if (tree || editor)
|
|
9140
|
+
this.tree = this.addLeafer(tree || { type: userConfig.type || 'design' });
|
|
9141
|
+
if (sky || editor)
|
|
9142
|
+
this.sky = this.addLeafer(sky);
|
|
9143
|
+
if (editor)
|
|
9144
|
+
Creator.editor(editor, this);
|
|
9145
|
+
}
|
|
9146
|
+
}
|
|
9147
|
+
__setApp() {
|
|
9148
|
+
const { canvas } = this;
|
|
9149
|
+
const { realCanvas, view } = this.config;
|
|
9150
|
+
if (realCanvas || view === this.canvas.view || !canvas.parentView)
|
|
9151
|
+
this.realCanvas = true;
|
|
9152
|
+
else
|
|
9153
|
+
canvas.unrealCanvas();
|
|
9154
|
+
this.leafer = this;
|
|
9155
|
+
this.watcher.disable();
|
|
9156
|
+
this.layouter.disable();
|
|
9157
|
+
}
|
|
9158
|
+
__updateLocalBounds() {
|
|
9159
|
+
this.forEach(leafer => leafer.updateLayout());
|
|
9160
|
+
super.__updateLocalBounds();
|
|
9161
|
+
}
|
|
9162
|
+
start() {
|
|
9163
|
+
super.start();
|
|
9164
|
+
this.forEach(leafer => leafer.start());
|
|
9165
|
+
}
|
|
9166
|
+
stop() {
|
|
9167
|
+
this.forEach(leafer => leafer.stop());
|
|
9168
|
+
super.stop();
|
|
9169
|
+
}
|
|
9170
|
+
unlockLayout() {
|
|
9171
|
+
super.unlockLayout();
|
|
9172
|
+
this.forEach(leafer => leafer.unlockLayout());
|
|
9173
|
+
}
|
|
9174
|
+
lockLayout() {
|
|
9175
|
+
super.lockLayout();
|
|
9176
|
+
this.forEach(leafer => leafer.lockLayout());
|
|
9177
|
+
}
|
|
9178
|
+
forceRender(bounds, sync) {
|
|
9179
|
+
this.forEach(leafer => leafer.forceRender(bounds, sync));
|
|
9180
|
+
}
|
|
9181
|
+
addLeafer(merge) {
|
|
9182
|
+
const leafer = new Leafer(merge);
|
|
9183
|
+
this.add(leafer);
|
|
9184
|
+
return leafer;
|
|
9185
|
+
}
|
|
9186
|
+
add(leafer, index) {
|
|
9187
|
+
if (!leafer.view) {
|
|
9188
|
+
if (this.realCanvas && !this.canvas.bounds) {
|
|
9189
|
+
setTimeout(() => this.add(leafer, index), 10);
|
|
9190
|
+
return;
|
|
9191
|
+
}
|
|
9192
|
+
leafer.init(this.__getChildConfig(leafer.userConfig), this);
|
|
9193
|
+
}
|
|
9194
|
+
super.add(leafer, index);
|
|
9195
|
+
if (index !== undefined)
|
|
9196
|
+
leafer.canvas.childIndex = index;
|
|
9197
|
+
this.__listenChildEvents(leafer);
|
|
9198
|
+
}
|
|
9199
|
+
forEach(fn) {
|
|
9200
|
+
this.children.forEach(fn);
|
|
9201
|
+
}
|
|
9202
|
+
__onCreated() {
|
|
9203
|
+
this.created = this.children.every(child => child.created);
|
|
9204
|
+
}
|
|
9205
|
+
__onReady() {
|
|
9206
|
+
if (this.children.every(child => child.ready))
|
|
9207
|
+
super.__onReady();
|
|
9208
|
+
}
|
|
9209
|
+
__onViewReady() {
|
|
9210
|
+
if (this.children.every(child => child.viewReady))
|
|
9211
|
+
super.__onViewReady();
|
|
9212
|
+
}
|
|
9213
|
+
__onChildRenderEnd(e) {
|
|
9214
|
+
this.renderer.addBlock(e.renderBounds);
|
|
9215
|
+
if (this.viewReady)
|
|
9216
|
+
this.renderer.update();
|
|
9217
|
+
}
|
|
9218
|
+
__render(canvas, options) {
|
|
9219
|
+
if (canvas.context)
|
|
9220
|
+
this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
|
|
9221
|
+
}
|
|
9222
|
+
__onResize(event) {
|
|
9223
|
+
this.forEach(leafer => leafer.resize(event));
|
|
9224
|
+
super.__onResize(event);
|
|
9225
|
+
}
|
|
9226
|
+
updateLayout() {
|
|
9227
|
+
this.forEach(leafer => leafer.updateLayout());
|
|
9228
|
+
}
|
|
9229
|
+
__getChildConfig(userConfig) {
|
|
9230
|
+
const config = Object.assign({}, this.config);
|
|
9231
|
+
config.hittable = config.realCanvas = undefined;
|
|
9232
|
+
if (userConfig)
|
|
9233
|
+
DataHelper.assign(config, userConfig);
|
|
9234
|
+
if (this.autoLayout)
|
|
9235
|
+
DataHelper.copyAttrs(config, this, canvasSizeAttrs);
|
|
9236
|
+
config.view = this.realCanvas ? undefined : this.view;
|
|
9237
|
+
config.fill = undefined;
|
|
9238
|
+
return config;
|
|
9239
|
+
}
|
|
9240
|
+
__listenChildEvents(leafer) {
|
|
9241
|
+
leafer.once([
|
|
9242
|
+
[LayoutEvent.END, this.__onReady, this],
|
|
9243
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
9244
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
9245
|
+
]);
|
|
9246
|
+
if (this.realCanvas)
|
|
9247
|
+
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9248
|
+
}
|
|
9249
|
+
};
|
|
9250
|
+
App = __decorate([
|
|
9251
|
+
registerUI()
|
|
9252
|
+
], App);
|
|
9253
|
+
|
|
9254
|
+
const downKeyMap = {};
|
|
9255
|
+
const Keyboard = {
|
|
9256
|
+
isHoldSpaceKey() {
|
|
9257
|
+
return Keyboard.isHold('Space');
|
|
9258
|
+
},
|
|
9259
|
+
isHold(code) {
|
|
9260
|
+
return downKeyMap[code];
|
|
9261
|
+
},
|
|
9262
|
+
setDownCode(code) {
|
|
9263
|
+
if (!downKeyMap[code])
|
|
9264
|
+
downKeyMap[code] = true;
|
|
9265
|
+
},
|
|
9266
|
+
setUpCode(code) {
|
|
9267
|
+
downKeyMap[code] = false;
|
|
9268
|
+
}
|
|
9269
|
+
};
|
|
9270
|
+
|
|
9271
|
+
const PointerButton = {
|
|
9272
|
+
LEFT: 1,
|
|
9273
|
+
RIGHT: 2,
|
|
9274
|
+
MIDDLE: 4,
|
|
9275
|
+
defaultLeft(event) { if (!event.buttons)
|
|
9276
|
+
event.buttons = 1; },
|
|
9277
|
+
left(event) { return event.buttons === 1; },
|
|
9278
|
+
right(event) { return event.buttons === 2; },
|
|
9279
|
+
middle(event) { return event.buttons === 4; }
|
|
9280
|
+
};
|
|
9281
|
+
|
|
9282
|
+
class UIEvent extends Event {
|
|
9283
|
+
get spaceKey() { return Keyboard.isHoldSpaceKey(); }
|
|
9284
|
+
get left() { return PointerButton.left(this); }
|
|
9285
|
+
get right() { return PointerButton.right(this); }
|
|
9286
|
+
get middle() { return PointerButton.middle(this); }
|
|
9287
|
+
constructor(params) {
|
|
9288
|
+
super(params.type);
|
|
9289
|
+
this.bubbles = true;
|
|
9290
|
+
Object.assign(this, params);
|
|
9291
|
+
}
|
|
9292
|
+
getBoxPoint(relative) {
|
|
9293
|
+
return (relative || this.current).getBoxPoint(this);
|
|
9294
|
+
}
|
|
9295
|
+
getInnerPoint(relative) {
|
|
9296
|
+
return (relative || this.current).getInnerPoint(this);
|
|
9297
|
+
}
|
|
9298
|
+
getLocalPoint(relative) {
|
|
9299
|
+
return (relative || this.current).getLocalPoint(this);
|
|
9300
|
+
}
|
|
9301
|
+
getPagePoint() {
|
|
9302
|
+
return this.current.getPagePoint(this);
|
|
9303
|
+
}
|
|
9304
|
+
getInner(relative) { return this.getInnerPoint(relative); }
|
|
9305
|
+
getLocal(relative) { return this.getLocalPoint(relative); }
|
|
9306
|
+
getPage() { return this.getPagePoint(); }
|
|
9307
|
+
static changeName(oldName, newName) {
|
|
9308
|
+
EventCreator.changeName(oldName, newName);
|
|
9309
|
+
}
|
|
9310
|
+
}
|
|
9311
|
+
|
|
9312
|
+
let PointerEvent = class PointerEvent extends UIEvent {
|
|
9313
|
+
};
|
|
9314
|
+
PointerEvent.POINTER = 'pointer';
|
|
9315
|
+
PointerEvent.BEFORE_DOWN = 'pointer.before_down';
|
|
9316
|
+
PointerEvent.BEFORE_MOVE = 'pointer.before_move';
|
|
9317
|
+
PointerEvent.BEFORE_UP = 'pointer.before_up';
|
|
9318
|
+
PointerEvent.DOWN = 'pointer.down';
|
|
9319
|
+
PointerEvent.MOVE = 'pointer.move';
|
|
9320
|
+
PointerEvent.UP = 'pointer.up';
|
|
9321
|
+
PointerEvent.OVER = 'pointer.over';
|
|
9322
|
+
PointerEvent.OUT = 'pointer.out';
|
|
9323
|
+
PointerEvent.ENTER = 'pointer.enter';
|
|
9324
|
+
PointerEvent.LEAVE = 'pointer.leave';
|
|
9325
|
+
PointerEvent.TAP = 'tap';
|
|
9326
|
+
PointerEvent.DOUBLE_TAP = 'double_tap';
|
|
9327
|
+
PointerEvent.CLICK = 'click';
|
|
9328
|
+
PointerEvent.DOUBLE_CLICK = 'double_click';
|
|
9329
|
+
PointerEvent.LONG_PRESS = 'long_press';
|
|
9330
|
+
PointerEvent.LONG_TAP = 'long_tap';
|
|
9331
|
+
PointerEvent.MENU = 'pointer.menu';
|
|
9332
|
+
PointerEvent.MENU_TAP = 'pointer.menu_tap';
|
|
9333
|
+
PointerEvent = __decorate([
|
|
9334
|
+
registerUIEvent()
|
|
9335
|
+
], PointerEvent);
|
|
9336
|
+
|
|
9337
|
+
const tempMove = {};
|
|
9338
|
+
let DragEvent = class DragEvent extends PointerEvent {
|
|
9339
|
+
static setList(data) {
|
|
9340
|
+
this.list = data instanceof LeafList ? data : new LeafList(data);
|
|
9341
|
+
}
|
|
9342
|
+
static setData(data) {
|
|
9343
|
+
this.data = data;
|
|
9344
|
+
}
|
|
9345
|
+
static getValidMove(leaf, start, total) {
|
|
9346
|
+
const { draggable, dragBounds } = leaf, move = leaf.getLocalPoint(total, null, true);
|
|
9347
|
+
PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
|
|
9348
|
+
if (dragBounds)
|
|
9349
|
+
this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
|
|
9350
|
+
if (draggable === 'x')
|
|
9351
|
+
move.y = 0;
|
|
9352
|
+
if (draggable === 'y')
|
|
9353
|
+
move.x = 0;
|
|
9354
|
+
return move;
|
|
9355
|
+
}
|
|
9356
|
+
static getMoveInDragBounds(childBox, dragBounds, move, change) {
|
|
9357
|
+
const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
|
|
9358
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9359
|
+
if (!change)
|
|
9360
|
+
move = Object.assign({}, move);
|
|
9361
|
+
if (BoundsHelper.includes(childBox, dragBounds)) {
|
|
9362
|
+
if (x > dragBounds.x)
|
|
9363
|
+
move.x += dragBounds.x - x;
|
|
9364
|
+
else if (right < boundsRight)
|
|
9365
|
+
move.x += boundsRight - right;
|
|
9366
|
+
if (y > dragBounds.y)
|
|
9367
|
+
move.y += dragBounds.y - y;
|
|
9368
|
+
else if (bottom < boundsBottom)
|
|
9369
|
+
move.y += boundsBottom - bottom;
|
|
9370
|
+
}
|
|
9371
|
+
else {
|
|
9372
|
+
if (x < dragBounds.x)
|
|
9373
|
+
move.x += dragBounds.x - x;
|
|
9374
|
+
else if (right > boundsRight)
|
|
9375
|
+
move.x += boundsRight - right;
|
|
9376
|
+
if (y < dragBounds.y)
|
|
9377
|
+
move.y += dragBounds.y - y;
|
|
9378
|
+
else if (bottom > boundsBottom)
|
|
9379
|
+
move.y += boundsBottom - bottom;
|
|
9380
|
+
}
|
|
9381
|
+
return move;
|
|
9382
|
+
}
|
|
9383
|
+
getPageMove(total) {
|
|
9384
|
+
this.assignMove(total);
|
|
9385
|
+
return this.current.getPagePoint(tempMove, null, true);
|
|
9386
|
+
}
|
|
9387
|
+
getInnerMove(relative, total) {
|
|
9388
|
+
if (!relative)
|
|
9389
|
+
relative = this.current;
|
|
9390
|
+
this.assignMove(total);
|
|
9391
|
+
return relative.getInnerPoint(tempMove, null, true);
|
|
9392
|
+
}
|
|
9393
|
+
getLocalMove(relative, total) {
|
|
9394
|
+
if (!relative)
|
|
9395
|
+
relative = this.current;
|
|
9396
|
+
this.assignMove(total);
|
|
9397
|
+
return relative.getLocalPoint(tempMove, null, true);
|
|
9398
|
+
}
|
|
9399
|
+
getPageTotal() {
|
|
9400
|
+
return this.getPageMove(true);
|
|
9401
|
+
}
|
|
9402
|
+
getInnerTotal(relative) {
|
|
9403
|
+
return this.getInnerMove(relative, true);
|
|
9404
|
+
}
|
|
9405
|
+
getLocalTotal(relative) {
|
|
9406
|
+
return this.getLocalMove(relative, true);
|
|
9407
|
+
}
|
|
9408
|
+
getPageBounds() {
|
|
9409
|
+
const total = this.getPageTotal(), start = this.getPagePoint(), bounds = {};
|
|
9410
|
+
BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
|
|
9411
|
+
BoundsHelper.unsign(bounds);
|
|
9412
|
+
return bounds;
|
|
9413
|
+
}
|
|
9414
|
+
assignMove(total) {
|
|
9415
|
+
tempMove.x = total ? this.totalX : this.moveX;
|
|
9416
|
+
tempMove.y = total ? this.totalY : this.moveY;
|
|
9417
|
+
}
|
|
9418
|
+
};
|
|
9419
|
+
DragEvent.BEFORE_DRAG = 'drag.before_drag';
|
|
9420
|
+
DragEvent.START = 'drag.start';
|
|
9421
|
+
DragEvent.DRAG = 'drag';
|
|
9422
|
+
DragEvent.END = 'drag.end';
|
|
9423
|
+
DragEvent.OVER = 'drag.over';
|
|
9424
|
+
DragEvent.OUT = 'drag.out';
|
|
9425
|
+
DragEvent.ENTER = 'drag.enter';
|
|
9426
|
+
DragEvent.LEAVE = 'drag.leave';
|
|
9427
|
+
DragEvent = __decorate([
|
|
9428
|
+
registerUIEvent()
|
|
9429
|
+
], DragEvent);
|
|
9430
|
+
|
|
9431
|
+
let DropEvent = class DropEvent extends PointerEvent {
|
|
9432
|
+
static setList(data) {
|
|
9433
|
+
DragEvent.setList(data);
|
|
9434
|
+
}
|
|
9435
|
+
static setData(data) {
|
|
9436
|
+
DragEvent.setData(data);
|
|
9437
|
+
}
|
|
9438
|
+
};
|
|
9439
|
+
DropEvent.DROP = 'drop';
|
|
9440
|
+
DropEvent = __decorate([
|
|
9441
|
+
registerUIEvent()
|
|
9442
|
+
], DropEvent);
|
|
9443
|
+
|
|
9444
|
+
let MoveEvent = class MoveEvent extends DragEvent {
|
|
9445
|
+
};
|
|
9446
|
+
MoveEvent.BEFORE_MOVE = 'move.before_move';
|
|
9447
|
+
MoveEvent.START = 'move.start';
|
|
9448
|
+
MoveEvent.MOVE = 'move';
|
|
9449
|
+
MoveEvent.END = 'move.end';
|
|
9450
|
+
MoveEvent = __decorate([
|
|
9451
|
+
registerUIEvent()
|
|
9452
|
+
], MoveEvent);
|
|
9453
|
+
|
|
9454
|
+
let RotateEvent = class RotateEvent extends PointerEvent {
|
|
9455
|
+
};
|
|
9456
|
+
RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
|
|
9457
|
+
RotateEvent.START = 'rotate.start';
|
|
9458
|
+
RotateEvent.ROTATE = 'rotate';
|
|
9459
|
+
RotateEvent.END = 'rotate.end';
|
|
9460
|
+
RotateEvent = __decorate([
|
|
9461
|
+
registerUIEvent()
|
|
9462
|
+
], RotateEvent);
|
|
9463
|
+
|
|
9464
|
+
let SwipeEvent = class SwipeEvent extends DragEvent {
|
|
9465
|
+
};
|
|
9466
|
+
SwipeEvent.SWIPE = 'swipe';
|
|
9467
|
+
SwipeEvent.LEFT = 'swipe.left';
|
|
9468
|
+
SwipeEvent.RIGHT = 'swipe.right';
|
|
9469
|
+
SwipeEvent.UP = 'swipe.up';
|
|
9470
|
+
SwipeEvent.DOWN = 'swipe.down';
|
|
9471
|
+
SwipeEvent = __decorate([
|
|
9472
|
+
registerUIEvent()
|
|
9473
|
+
], SwipeEvent);
|
|
9474
|
+
|
|
9475
|
+
let ZoomEvent = class ZoomEvent extends PointerEvent {
|
|
9476
|
+
};
|
|
9477
|
+
ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
|
|
9478
|
+
ZoomEvent.START = 'zoom.start';
|
|
9479
|
+
ZoomEvent.ZOOM = 'zoom';
|
|
9480
|
+
ZoomEvent.END = 'zoom.end';
|
|
9481
|
+
ZoomEvent = __decorate([
|
|
9482
|
+
registerUIEvent()
|
|
9483
|
+
], ZoomEvent);
|
|
9484
|
+
|
|
9485
|
+
let KeyEvent = class KeyEvent extends UIEvent {
|
|
9486
|
+
};
|
|
9487
|
+
KeyEvent.DOWN = 'key.down';
|
|
9488
|
+
KeyEvent.HOLD = 'key.hold';
|
|
9489
|
+
KeyEvent.UP = 'key.up';
|
|
9490
|
+
KeyEvent = __decorate([
|
|
9491
|
+
registerUIEvent()
|
|
9492
|
+
], KeyEvent);
|
|
9493
|
+
|
|
9494
|
+
new LeafList();
|
|
9495
|
+
|
|
9496
|
+
Debug.get('emit');
|
|
9497
|
+
|
|
9498
|
+
const { toInnerRadiusPointOf, copy: copy$2, setRadius } = PointHelper;
|
|
9499
|
+
const inner = {};
|
|
9500
|
+
const leaf = Leaf.prototype;
|
|
9501
|
+
leaf.__hitWorld = function (point) {
|
|
9502
|
+
const data = this.__;
|
|
9503
|
+
if (!data.hitSelf)
|
|
9504
|
+
return false;
|
|
9505
|
+
const world = this.__world, layout = this.__layout;
|
|
9506
|
+
const isSmall = world.width < 10 && world.height < 10;
|
|
9507
|
+
if (data.hitRadius) {
|
|
9508
|
+
copy$2(inner, point), point = inner;
|
|
9509
|
+
setRadius(point, data.hitRadius);
|
|
9510
|
+
}
|
|
9511
|
+
toInnerRadiusPointOf(point, world, inner);
|
|
9512
|
+
if (data.hitBox || isSmall) {
|
|
9513
|
+
if (BoundsHelper.hitRadiusPoint(layout.boxBounds, inner))
|
|
9514
|
+
return true;
|
|
9515
|
+
if (isSmall)
|
|
9516
|
+
return false;
|
|
9517
|
+
}
|
|
9518
|
+
if (layout.hitCanvasChanged || !this.__hitCanvas) {
|
|
9519
|
+
this.__updateHitCanvas();
|
|
9520
|
+
if (!layout.boundsChanged)
|
|
9521
|
+
layout.hitCanvasChanged = false;
|
|
9522
|
+
}
|
|
9523
|
+
return this.__hit(inner);
|
|
9524
|
+
};
|
|
9525
|
+
leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
|
|
9526
|
+
leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
|
|
9527
|
+
leaf.__hitPixel = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitPixel(inner, this.__layout.renderBounds, this.__hitCanvas.hitScale); };
|
|
9528
|
+
leaf.__drawHitPath = function (canvas) { if (canvas)
|
|
9529
|
+
this.__drawRenderPath(canvas); };
|
|
9530
|
+
|
|
9531
|
+
const matrix = new Matrix();
|
|
9532
|
+
const ui$1 = UI.prototype;
|
|
9533
|
+
ui$1.__updateHitCanvas = function () {
|
|
9534
|
+
if (this.__box)
|
|
9535
|
+
this.__box.__updateHitCanvas();
|
|
9536
|
+
const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
|
|
9537
|
+
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
9538
|
+
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
9539
|
+
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
9540
|
+
if (!this.__hitCanvas)
|
|
9541
|
+
this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
|
|
9542
|
+
const h = this.__hitCanvas;
|
|
9543
|
+
if (isHitPixel) {
|
|
9544
|
+
const { renderBounds } = this.__layout;
|
|
9545
|
+
const size = Platform.image.hitCanvasSize;
|
|
9546
|
+
const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds).a;
|
|
9547
|
+
const { x, y, width, height } = tempBounds$1.set(renderBounds).scale(scale);
|
|
9548
|
+
h.resize({ width, height, pixelRatio: 1 });
|
|
9549
|
+
h.clear();
|
|
9550
|
+
ImageManager.patternLocked = true;
|
|
9551
|
+
this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y) }, !isHitPixelFill, !isHitPixelStroke);
|
|
9552
|
+
ImageManager.patternLocked = false;
|
|
9553
|
+
h.resetTransform();
|
|
9554
|
+
data.__isHitPixel = true;
|
|
9555
|
+
}
|
|
9556
|
+
else {
|
|
9557
|
+
data.__isHitPixel && (data.__isHitPixel = false);
|
|
9558
|
+
}
|
|
9559
|
+
this.__drawHitPath(h);
|
|
9560
|
+
h.setStrokeOptions(data);
|
|
9561
|
+
};
|
|
9562
|
+
ui$1.__hit = function (inner) {
|
|
9563
|
+
if (this.__box && this.__box.__hit(inner))
|
|
9564
|
+
return true;
|
|
9565
|
+
const data = this.__;
|
|
9566
|
+
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
9567
|
+
return true;
|
|
9568
|
+
const { hitFill } = data;
|
|
9569
|
+
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
9570
|
+
if (needHitFillPath && this.__hitFill(inner))
|
|
9571
|
+
return true;
|
|
9572
|
+
const { hitStroke, __strokeWidth } = data;
|
|
9573
|
+
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
9574
|
+
if (!needHitFillPath && !needHitStrokePath)
|
|
9575
|
+
return false;
|
|
9576
|
+
const radiusWidth = inner.radiusX * 2;
|
|
9577
|
+
let hitWidth = radiusWidth;
|
|
9578
|
+
if (needHitStrokePath) {
|
|
9579
|
+
switch (data.strokeAlign) {
|
|
9580
|
+
case 'inside':
|
|
9581
|
+
hitWidth += __strokeWidth * 2;
|
|
9582
|
+
if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
9583
|
+
return true;
|
|
9584
|
+
hitWidth = radiusWidth;
|
|
9585
|
+
break;
|
|
9586
|
+
case 'center':
|
|
9587
|
+
hitWidth += __strokeWidth;
|
|
9588
|
+
break;
|
|
9589
|
+
case 'outside':
|
|
9590
|
+
hitWidth += __strokeWidth * 2;
|
|
9591
|
+
if (!needHitFillPath) {
|
|
9592
|
+
if (!this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
9593
|
+
return true;
|
|
9594
|
+
hitWidth = radiusWidth;
|
|
9595
|
+
}
|
|
9596
|
+
break;
|
|
9597
|
+
}
|
|
9598
|
+
}
|
|
9599
|
+
return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
|
|
9600
|
+
};
|
|
9601
|
+
|
|
9602
|
+
const ui = UI.prototype, rect = Rect.prototype, box$1 = Box.prototype;
|
|
9603
|
+
rect.__updateHitCanvas = box$1.__updateHitCanvas = function () {
|
|
9604
|
+
if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
|
|
9605
|
+
ui.__updateHitCanvas.call(this);
|
|
9606
|
+
else if (this.__hitCanvas)
|
|
9607
|
+
this.__hitCanvas = null;
|
|
9608
|
+
};
|
|
9609
|
+
rect.__hitFill = box$1.__hitFill = function (inner) {
|
|
9610
|
+
return this.__hitCanvas ? ui.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
|
|
9611
|
+
};
|
|
9612
|
+
|
|
9613
|
+
Text.prototype.__drawHitPath = function (canvas) {
|
|
9614
|
+
const { __lineHeight, fontSize, __baseLine, __letterSpacing, __textDrawData: data } = this.__;
|
|
9615
|
+
canvas.beginPath();
|
|
9616
|
+
if (__letterSpacing < 0)
|
|
9617
|
+
this.__drawPathByBox(canvas);
|
|
9618
|
+
else
|
|
9619
|
+
data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
|
|
9620
|
+
};
|
|
9621
|
+
|
|
9622
|
+
function getSelector(ui) {
|
|
9623
|
+
return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
|
|
9624
|
+
}
|
|
9625
|
+
Group.prototype.pick = function (hitPoint, options) {
|
|
9626
|
+
options || (options = emptyData);
|
|
9627
|
+
this.updateLayout();
|
|
9628
|
+
return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
|
|
9629
|
+
};
|
|
9630
|
+
|
|
9631
|
+
const canvas = LeaferCanvasBase.prototype;
|
|
9632
|
+
canvas.hitFill = function (point, fillRule) {
|
|
9633
|
+
return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
|
|
9634
|
+
};
|
|
9635
|
+
canvas.hitStroke = function (point, strokeWidth) {
|
|
9636
|
+
this.strokeWidth = strokeWidth;
|
|
9637
|
+
return this.context.isPointInStroke(point.x, point.y);
|
|
9638
|
+
};
|
|
9639
|
+
canvas.hitPixel = function (radiusPoint, offset, scale = 1) {
|
|
9640
|
+
let { x, y, radiusX, radiusY } = radiusPoint;
|
|
9641
|
+
if (offset)
|
|
9642
|
+
x -= offset.x, y -= offset.y;
|
|
9643
|
+
tempBounds$1.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
|
|
9644
|
+
const { data } = this.context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width || 1, tempBounds$1.height || 1);
|
|
9645
|
+
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
9646
|
+
if (data[i + 3] > 0)
|
|
9647
|
+
return true;
|
|
9648
|
+
}
|
|
9649
|
+
return data[3] > 0;
|
|
9650
|
+
};
|
|
8975
9651
|
|
|
8976
9652
|
function strokeText(stroke, ui, canvas) {
|
|
8977
|
-
|
|
8978
|
-
const isStrokes = typeof stroke !== 'string';
|
|
8979
|
-
switch (strokeAlign) {
|
|
9653
|
+
switch (ui.__.strokeAlign) {
|
|
8980
9654
|
case 'center':
|
|
8981
|
-
|
|
8982
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
9655
|
+
drawCenter$1(stroke, 1, ui, canvas);
|
|
8983
9656
|
break;
|
|
8984
9657
|
case 'inside':
|
|
8985
|
-
|
|
9658
|
+
drawAlign(stroke, 'inside', ui, canvas);
|
|
8986
9659
|
break;
|
|
8987
9660
|
case 'outside':
|
|
8988
|
-
|
|
9661
|
+
ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, 'outside', ui, canvas);
|
|
8989
9662
|
break;
|
|
8990
9663
|
}
|
|
8991
9664
|
}
|
|
8992
|
-
function
|
|
8993
|
-
const
|
|
9665
|
+
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
9666
|
+
const data = ui.__;
|
|
9667
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
|
|
9668
|
+
data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
9669
|
+
}
|
|
9670
|
+
function drawAlign(stroke, align, ui, canvas) {
|
|
8994
9671
|
const out = canvas.getSameCanvas(true, true);
|
|
8995
|
-
out.
|
|
8996
|
-
|
|
8997
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
|
|
9672
|
+
out.font = ui.__.__font;
|
|
9673
|
+
drawCenter$1(stroke, 2, ui, out);
|
|
8998
9674
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
8999
9675
|
fillText(ui, out);
|
|
9000
9676
|
out.blendMode = 'normal';
|
|
9001
|
-
if (ui.__worldFlipped)
|
|
9677
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
9002
9678
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9003
9679
|
else
|
|
9004
9680
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
@@ -9040,90 +9716,60 @@ function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
|
9040
9716
|
}
|
|
9041
9717
|
|
|
9042
9718
|
function stroke(stroke, ui, canvas) {
|
|
9043
|
-
const
|
|
9044
|
-
|
|
9045
|
-
if (!__strokeWidth)
|
|
9719
|
+
const data = ui.__;
|
|
9720
|
+
if (!data.__strokeWidth)
|
|
9046
9721
|
return;
|
|
9047
|
-
if (__font) {
|
|
9722
|
+
if (data.__font) {
|
|
9048
9723
|
strokeText(stroke, ui, canvas);
|
|
9049
9724
|
}
|
|
9050
9725
|
else {
|
|
9051
|
-
switch (strokeAlign) {
|
|
9726
|
+
switch (data.strokeAlign) {
|
|
9052
9727
|
case 'center':
|
|
9053
|
-
|
|
9054
|
-
canvas.stroke();
|
|
9055
|
-
if (options.__useArrow)
|
|
9056
|
-
strokeArrow(ui, canvas);
|
|
9728
|
+
drawCenter(stroke, 1, ui, canvas);
|
|
9057
9729
|
break;
|
|
9058
9730
|
case 'inside':
|
|
9059
|
-
canvas
|
|
9060
|
-
canvas.setStroke(stroke, __strokeWidth * 2, options);
|
|
9061
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
9062
|
-
canvas.stroke();
|
|
9063
|
-
canvas.restore();
|
|
9731
|
+
drawInside(stroke, ui, canvas);
|
|
9064
9732
|
break;
|
|
9065
9733
|
case 'outside':
|
|
9066
|
-
|
|
9067
|
-
out.setStroke(stroke, __strokeWidth * 2, options);
|
|
9068
|
-
ui.__drawRenderPath(out);
|
|
9069
|
-
out.stroke();
|
|
9070
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
9071
|
-
out.clearWorld(ui.__layout.renderBounds);
|
|
9072
|
-
if (ui.__worldFlipped)
|
|
9073
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9074
|
-
else
|
|
9075
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
9076
|
-
out.recycle(ui.__nowWorld);
|
|
9734
|
+
drawOutside(stroke, ui, canvas);
|
|
9077
9735
|
break;
|
|
9078
9736
|
}
|
|
9079
9737
|
}
|
|
9080
9738
|
}
|
|
9081
9739
|
function strokes(strokes, ui, canvas) {
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9740
|
+
stroke(strokes, ui, canvas);
|
|
9741
|
+
}
|
|
9742
|
+
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
9743
|
+
const data = ui.__;
|
|
9744
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
9745
|
+
data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
|
|
9746
|
+
if (data.__useArrow)
|
|
9747
|
+
Paint.strokeArrow(stroke, ui, canvas);
|
|
9748
|
+
}
|
|
9749
|
+
function drawInside(stroke, ui, canvas) {
|
|
9750
|
+
const data = ui.__;
|
|
9751
|
+
canvas.save();
|
|
9752
|
+
data.windingRule ? canvas.clip(data.windingRule) : canvas.clip();
|
|
9753
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
9754
|
+
canvas.restore();
|
|
9755
|
+
}
|
|
9756
|
+
function drawOutside(stroke, ui, canvas) {
|
|
9757
|
+
const data = ui.__;
|
|
9758
|
+
if (data.__fillAfterStroke) {
|
|
9759
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
9088
9760
|
}
|
|
9089
9761
|
else {
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
|
|
9095
|
-
|
|
9096
|
-
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
9100
|
-
|
|
9101
|
-
drawStrokesStyle(strokes, false, ui, canvas);
|
|
9102
|
-
canvas.restore();
|
|
9103
|
-
break;
|
|
9104
|
-
case 'outside':
|
|
9105
|
-
const { renderBounds } = ui.__layout;
|
|
9106
|
-
const out = canvas.getSameCanvas(true, true);
|
|
9107
|
-
ui.__drawRenderPath(out);
|
|
9108
|
-
out.setStroke(undefined, __strokeWidth * 2, options);
|
|
9109
|
-
drawStrokesStyle(strokes, false, ui, out);
|
|
9110
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
9111
|
-
out.clearWorld(renderBounds);
|
|
9112
|
-
if (ui.__worldFlipped)
|
|
9113
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9114
|
-
else
|
|
9115
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
9116
|
-
out.recycle(ui.__nowWorld);
|
|
9117
|
-
break;
|
|
9118
|
-
}
|
|
9119
|
-
}
|
|
9120
|
-
}
|
|
9121
|
-
function strokeArrow(ui, canvas) {
|
|
9122
|
-
if (ui.__.dashPattern) {
|
|
9123
|
-
canvas.beginPath();
|
|
9124
|
-
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
9125
|
-
canvas.dashPattern = null;
|
|
9126
|
-
canvas.stroke();
|
|
9762
|
+
const { renderBounds } = ui.__layout;
|
|
9763
|
+
const out = canvas.getSameCanvas(true, true);
|
|
9764
|
+
ui.__drawRenderPath(out);
|
|
9765
|
+
drawCenter(stroke, 2, ui, out);
|
|
9766
|
+
data.windingRule ? out.clip(data.windingRule) : out.clip();
|
|
9767
|
+
out.clearWorld(renderBounds);
|
|
9768
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
9769
|
+
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9770
|
+
else
|
|
9771
|
+
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
9772
|
+
out.recycle(ui.__nowWorld);
|
|
9127
9773
|
}
|
|
9128
9774
|
}
|
|
9129
9775
|
|
|
@@ -9170,9 +9816,10 @@ function shape(ui, current, options) {
|
|
|
9170
9816
|
}
|
|
9171
9817
|
|
|
9172
9818
|
let recycleMap;
|
|
9819
|
+
const { stintSet } = DataHelper, { hasTransparent: hasTransparent$1 } = ColorConvert;
|
|
9173
9820
|
function compute(attrName, ui) {
|
|
9174
9821
|
const data = ui.__, leafPaints = [];
|
|
9175
|
-
let paints = data.__input[attrName],
|
|
9822
|
+
let paints = data.__input[attrName], isAlphaPixel, isTransparent;
|
|
9176
9823
|
if (!(paints instanceof Array))
|
|
9177
9824
|
paints = [paints];
|
|
9178
9825
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
@@ -9182,35 +9829,62 @@ function compute(attrName, ui) {
|
|
|
9182
9829
|
leafPaints.push(item);
|
|
9183
9830
|
}
|
|
9184
9831
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
9185
|
-
if (leafPaints.length
|
|
9186
|
-
|
|
9187
|
-
|
|
9832
|
+
if (leafPaints.length) {
|
|
9833
|
+
if (leafPaints.every(item => item.isTransparent)) {
|
|
9834
|
+
if (leafPaints.some(item => item.image))
|
|
9835
|
+
isAlphaPixel = true;
|
|
9836
|
+
isTransparent = true;
|
|
9837
|
+
}
|
|
9838
|
+
}
|
|
9839
|
+
if (attrName === 'fill') {
|
|
9840
|
+
stintSet(data, '__isAlphaPixelFill', isAlphaPixel);
|
|
9841
|
+
stintSet(data, '__isTransparentFill', isTransparent);
|
|
9842
|
+
}
|
|
9843
|
+
else {
|
|
9844
|
+
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
9845
|
+
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
9846
|
+
}
|
|
9188
9847
|
}
|
|
9189
9848
|
function getLeafPaint(attrName, paint, ui) {
|
|
9190
9849
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
|
9191
9850
|
return undefined;
|
|
9851
|
+
let data;
|
|
9192
9852
|
const { boxBounds } = ui.__layout;
|
|
9193
9853
|
switch (paint.type) {
|
|
9194
|
-
case 'solid':
|
|
9195
|
-
let { type, blendMode, color, opacity } = paint;
|
|
9196
|
-
return { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
9197
9854
|
case 'image':
|
|
9198
|
-
|
|
9855
|
+
data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
9856
|
+
break;
|
|
9199
9857
|
case 'linear':
|
|
9200
|
-
|
|
9858
|
+
data = PaintGradient.linearGradient(paint, boxBounds);
|
|
9859
|
+
break;
|
|
9201
9860
|
case 'radial':
|
|
9202
|
-
|
|
9861
|
+
data = PaintGradient.radialGradient(paint, boxBounds);
|
|
9862
|
+
break;
|
|
9203
9863
|
case 'angular':
|
|
9204
|
-
|
|
9864
|
+
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
9865
|
+
break;
|
|
9866
|
+
case 'solid':
|
|
9867
|
+
const { type, blendMode, color, opacity } = paint;
|
|
9868
|
+
data = { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
9869
|
+
break;
|
|
9205
9870
|
default:
|
|
9206
|
-
|
|
9871
|
+
if (paint.r !== undefined)
|
|
9872
|
+
data = { type: 'solid', style: ColorConvert.string(paint) };
|
|
9873
|
+
}
|
|
9874
|
+
if (data) {
|
|
9875
|
+
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
9876
|
+
data.isTransparent = true;
|
|
9877
|
+
if (paint.blendMode)
|
|
9878
|
+
data.blendMode = paint.blendMode;
|
|
9207
9879
|
}
|
|
9880
|
+
return data;
|
|
9208
9881
|
}
|
|
9209
9882
|
|
|
9210
9883
|
const PaintModule = {
|
|
9211
9884
|
compute,
|
|
9212
9885
|
fill,
|
|
9213
9886
|
fills,
|
|
9887
|
+
fillPathOrText,
|
|
9214
9888
|
fillText,
|
|
9215
9889
|
stroke,
|
|
9216
9890
|
strokes,
|
|
@@ -9269,12 +9943,10 @@ function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, al
|
|
|
9269
9943
|
|
|
9270
9944
|
const { get: get$2, translate } = MatrixHelper;
|
|
9271
9945
|
const tempBox = new Bounds();
|
|
9272
|
-
const tempPoint = {};
|
|
9273
9946
|
const tempScaleData = {};
|
|
9947
|
+
const tempImage = {};
|
|
9274
9948
|
function createData(leafPaint, image, paint, box) {
|
|
9275
|
-
const {
|
|
9276
|
-
if (blendMode)
|
|
9277
|
-
leafPaint.blendMode = blendMode;
|
|
9949
|
+
const { changeful, sync } = paint;
|
|
9278
9950
|
if (changeful)
|
|
9279
9951
|
leafPaint.changeful = changeful;
|
|
9280
9952
|
if (sync)
|
|
@@ -9282,38 +9954,38 @@ function createData(leafPaint, image, paint, box) {
|
|
|
9282
9954
|
leafPaint.data = getPatternData(paint, box, image);
|
|
9283
9955
|
}
|
|
9284
9956
|
function getPatternData(paint, box, image) {
|
|
9285
|
-
let { width, height } = image;
|
|
9286
9957
|
if (paint.padding)
|
|
9287
9958
|
box = tempBox.set(box).shrink(paint.padding);
|
|
9288
9959
|
if (paint.mode === 'strench')
|
|
9289
9960
|
paint.mode = 'stretch';
|
|
9961
|
+
let { width, height } = image;
|
|
9290
9962
|
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
9291
9963
|
const sameBox = box.width === width && box.height === height;
|
|
9292
9964
|
const data = { mode };
|
|
9293
9965
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
9294
|
-
|
|
9295
|
-
let
|
|
9966
|
+
BoundsHelper.set(tempImage, 0, 0, swapSize ? height : width, swapSize ? width : height);
|
|
9967
|
+
let scaleX, scaleY;
|
|
9296
9968
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
9297
9969
|
if (!sameBox || rotation) {
|
|
9298
|
-
|
|
9299
|
-
|
|
9300
|
-
|
|
9970
|
+
scaleX = scaleY = BoundsHelper.getFitScale(box, tempImage, mode !== 'fit');
|
|
9971
|
+
BoundsHelper.put(box, image, align, scaleX, false, tempImage);
|
|
9972
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
9301
9973
|
}
|
|
9302
9974
|
}
|
|
9303
|
-
else
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9975
|
+
else {
|
|
9976
|
+
if (scale || size) {
|
|
9977
|
+
MathHelper.getScaleData(scale, size, image, tempScaleData);
|
|
9978
|
+
scaleX = tempScaleData.scaleX;
|
|
9979
|
+
scaleY = tempScaleData.scaleY;
|
|
9980
|
+
}
|
|
9981
|
+
if (align) {
|
|
9982
|
+
if (scaleX)
|
|
9983
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
9984
|
+
AlignHelper.toPoint(align, tempImage, box, tempImage, true, true);
|
|
9985
|
+
}
|
|
9314
9986
|
}
|
|
9315
9987
|
if (offset)
|
|
9316
|
-
|
|
9988
|
+
PointHelper.move(tempImage, offset);
|
|
9317
9989
|
switch (mode) {
|
|
9318
9990
|
case 'stretch':
|
|
9319
9991
|
if (!sameBox)
|
|
@@ -9321,12 +9993,12 @@ function getPatternData(paint, box, image) {
|
|
|
9321
9993
|
break;
|
|
9322
9994
|
case 'normal':
|
|
9323
9995
|
case 'clip':
|
|
9324
|
-
if (x || y || scaleX || rotation)
|
|
9325
|
-
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
9996
|
+
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
9997
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9326
9998
|
break;
|
|
9327
9999
|
case 'repeat':
|
|
9328
10000
|
if (!sameBox || scaleX || rotation)
|
|
9329
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
10001
|
+
repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, align);
|
|
9330
10002
|
if (!repeat)
|
|
9331
10003
|
data.repeat = 'repeat';
|
|
9332
10004
|
break;
|
|
@@ -9334,7 +10006,7 @@ function getPatternData(paint, box, image) {
|
|
|
9334
10006
|
case 'cover':
|
|
9335
10007
|
default:
|
|
9336
10008
|
if (scaleX)
|
|
9337
|
-
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
10009
|
+
fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9338
10010
|
}
|
|
9339
10011
|
if (!data.transform) {
|
|
9340
10012
|
if (box.x || box.y) {
|
|
@@ -9367,6 +10039,8 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
9367
10039
|
}
|
|
9368
10040
|
else {
|
|
9369
10041
|
leafPaint = { type: paint.type, image };
|
|
10042
|
+
if (image.hasAlphaPixel)
|
|
10043
|
+
leafPaint.isTransparent = true;
|
|
9370
10044
|
cache = image.use > 1 ? { leafPaint, paint, boxBounds: box.set(boxBounds) } : null;
|
|
9371
10045
|
}
|
|
9372
10046
|
if (firstUse || image.loading)
|
|
@@ -9391,7 +10065,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
9391
10065
|
ignoreRender(ui, false);
|
|
9392
10066
|
if (!ui.destroyed) {
|
|
9393
10067
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
9394
|
-
if (image.
|
|
10068
|
+
if (image.hasAlphaPixel)
|
|
9395
10069
|
ui.__layout.hitCanvasChanged = true;
|
|
9396
10070
|
ui.forceUpdate('surface');
|
|
9397
10071
|
}
|
|
@@ -9403,6 +10077,17 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
9403
10077
|
onLoadError(ui, event, error);
|
|
9404
10078
|
leafPaint.loadId = null;
|
|
9405
10079
|
});
|
|
10080
|
+
if (ui.placeholderColor) {
|
|
10081
|
+
if (!ui.placeholderDelay)
|
|
10082
|
+
image.isPlacehold = true;
|
|
10083
|
+
else
|
|
10084
|
+
setTimeout(() => {
|
|
10085
|
+
if (!image.ready) {
|
|
10086
|
+
image.isPlacehold = true;
|
|
10087
|
+
ui.forceUpdate('surface');
|
|
10088
|
+
}
|
|
10089
|
+
}, ui.placeholderDelay);
|
|
10090
|
+
}
|
|
9406
10091
|
}
|
|
9407
10092
|
return leafPaint;
|
|
9408
10093
|
}
|
|
@@ -9608,32 +10293,33 @@ const PaintImageModule = {
|
|
|
9608
10293
|
repeatMode
|
|
9609
10294
|
};
|
|
9610
10295
|
|
|
9611
|
-
const { toPoint: toPoint$2 } = AroundHelper;
|
|
10296
|
+
const { toPoint: toPoint$2 } = AroundHelper, { hasTransparent } = ColorConvert;
|
|
9612
10297
|
const realFrom$2 = {};
|
|
9613
10298
|
const realTo$2 = {};
|
|
9614
10299
|
function linearGradient(paint, box) {
|
|
9615
|
-
let { from, to, type,
|
|
10300
|
+
let { from, to, type, opacity } = paint;
|
|
9616
10301
|
toPoint$2(from || 'top', box, realFrom$2);
|
|
9617
10302
|
toPoint$2(to || 'bottom', box, realTo$2);
|
|
9618
10303
|
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
9619
|
-
applyStops(style, paint.stops, opacity);
|
|
9620
10304
|
const data = { type, style };
|
|
9621
|
-
|
|
9622
|
-
data.blendMode = blendMode;
|
|
10305
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9623
10306
|
return data;
|
|
9624
10307
|
}
|
|
9625
|
-
function applyStops(gradient, stops, opacity) {
|
|
10308
|
+
function applyStops(data, gradient, stops, opacity) {
|
|
9626
10309
|
if (stops) {
|
|
9627
|
-
let stop;
|
|
10310
|
+
let stop, color, offset, isTransparent;
|
|
9628
10311
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
9629
10312
|
stop = stops[i];
|
|
9630
|
-
if (typeof stop === 'string')
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
10313
|
+
if (typeof stop === 'string')
|
|
10314
|
+
offset = i / (len - 1), color = ColorConvert.string(stop, opacity);
|
|
10315
|
+
else
|
|
10316
|
+
offset = stop.offset, color = ColorConvert.string(stop.color, opacity);
|
|
10317
|
+
gradient.addColorStop(offset, color);
|
|
10318
|
+
if (!isTransparent && hasTransparent(color))
|
|
10319
|
+
isTransparent = true;
|
|
9636
10320
|
}
|
|
10321
|
+
if (isTransparent)
|
|
10322
|
+
data.isTransparent = true;
|
|
9637
10323
|
}
|
|
9638
10324
|
}
|
|
9639
10325
|
|
|
@@ -9643,17 +10329,15 @@ const { toPoint: toPoint$1 } = AroundHelper;
|
|
|
9643
10329
|
const realFrom$1 = {};
|
|
9644
10330
|
const realTo$1 = {};
|
|
9645
10331
|
function radialGradient(paint, box) {
|
|
9646
|
-
let { from, to, type, opacity,
|
|
10332
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
9647
10333
|
toPoint$1(from || 'center', box, realFrom$1);
|
|
9648
10334
|
toPoint$1(to || 'bottom', box, realTo$1);
|
|
9649
10335
|
const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$1(realFrom$1, realTo$1));
|
|
9650
|
-
applyStops(style, paint.stops, opacity);
|
|
9651
10336
|
const data = { type, style };
|
|
10337
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9652
10338
|
const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
|
|
9653
10339
|
if (transform)
|
|
9654
10340
|
data.transform = transform;
|
|
9655
|
-
if (blendMode)
|
|
9656
|
-
data.blendMode = blendMode;
|
|
9657
10341
|
return data;
|
|
9658
10342
|
}
|
|
9659
10343
|
function getTransform(box, from, to, stretch, rotate90) {
|
|
@@ -9679,17 +10363,15 @@ const { toPoint } = AroundHelper;
|
|
|
9679
10363
|
const realFrom = {};
|
|
9680
10364
|
const realTo = {};
|
|
9681
10365
|
function conicGradient(paint, box) {
|
|
9682
|
-
let { from, to, type, opacity,
|
|
10366
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
9683
10367
|
toPoint(from || 'center', box, realFrom);
|
|
9684
10368
|
toPoint(to || 'bottom', box, realTo);
|
|
9685
10369
|
const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance(realFrom, realTo));
|
|
9686
|
-
applyStops(style, paint.stops, opacity);
|
|
9687
10370
|
const data = { type, style };
|
|
10371
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9688
10372
|
const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
|
|
9689
10373
|
if (transform)
|
|
9690
10374
|
data.transform = transform;
|
|
9691
|
-
if (blendMode)
|
|
9692
|
-
data.blendMode = blendMode;
|
|
9693
10375
|
return data;
|
|
9694
10376
|
}
|
|
9695
10377
|
|
|
@@ -10022,6 +10704,8 @@ function createRows(drawData, content, style) {
|
|
|
10022
10704
|
lastCharType = null;
|
|
10023
10705
|
startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
|
|
10024
10706
|
word = { data: [] }, row = { words: [] };
|
|
10707
|
+
if (__letterSpacing)
|
|
10708
|
+
content = [...content];
|
|
10025
10709
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
10026
10710
|
char = content[i];
|
|
10027
10711
|
if (char === '\n') {
|
|
@@ -10439,5 +11123,4 @@ try {
|
|
|
10439
11123
|
}
|
|
10440
11124
|
catch (_a) { }
|
|
10441
11125
|
|
|
10442
|
-
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isEmptyData, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$
|
|
10443
|
-
//# sourceMappingURL=miniapp.module.js.map
|
|
11126
|
+
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isEmptyData, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$2 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|