leafer-draw 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/web.cjs +208 -201
- package/dist/web.esm.js +211 -204
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +1178 -490
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +1173 -490
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +2 -2
- package/dist/web.cjs.map +0 -1
- package/dist/web.esm.js.map +0 -1
- package/dist/web.js.map +0 -1
- package/dist/web.module.js.map +0 -1
package/dist/web.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$e = 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$c = 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$a = 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$9 = 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
|
const debug$4 = Debug.get('LeaferCanvas');
|
|
6131
6236
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6465,17 +6570,15 @@ class Watcher {
|
|
|
6465
6570
|
this.target.emitEvent(new WatchEvent(WatchEvent.DATA, { updatedList: this.updatedList }));
|
|
6466
6571
|
this.__updatedList = new LeafList();
|
|
6467
6572
|
this.totalTimes++;
|
|
6468
|
-
this.changed = false;
|
|
6469
|
-
this.hasVisible = false;
|
|
6470
|
-
this.hasRemove = false;
|
|
6471
|
-
this.hasAdd = false;
|
|
6573
|
+
this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
6472
6574
|
}
|
|
6473
6575
|
__listenEvents() {
|
|
6474
|
-
const { target } = this;
|
|
6475
6576
|
this.__eventIds = [
|
|
6476
|
-
target.on_(
|
|
6477
|
-
|
|
6478
|
-
|
|
6577
|
+
this.target.on_([
|
|
6578
|
+
[PropertyEvent.CHANGE, this.__onAttrChange, this],
|
|
6579
|
+
[[ChildEvent.ADD, ChildEvent.REMOVE], this.__onChildEvent, this],
|
|
6580
|
+
[WatchEvent.REQUEST, this.__onRquestData, this]
|
|
6581
|
+
])
|
|
6479
6582
|
];
|
|
6480
6583
|
}
|
|
6481
6584
|
__removeListenEvents() {
|
|
@@ -6485,13 +6588,12 @@ class Watcher {
|
|
|
6485
6588
|
if (this.target) {
|
|
6486
6589
|
this.stop();
|
|
6487
6590
|
this.__removeListenEvents();
|
|
6488
|
-
this.target = null;
|
|
6489
|
-
this.__updatedList = null;
|
|
6591
|
+
this.target = this.__updatedList = null;
|
|
6490
6592
|
}
|
|
6491
6593
|
}
|
|
6492
6594
|
}
|
|
6493
6595
|
|
|
6494
|
-
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds,
|
|
6596
|
+
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds, updateChange: updateOneChange } = LeafHelper;
|
|
6495
6597
|
const { pushAllChildBranch, pushAllParent } = BranchHelper;
|
|
6496
6598
|
function updateMatrix(updateList, levelList) {
|
|
6497
6599
|
let layout;
|
|
@@ -6534,15 +6636,7 @@ function updateBounds(boundsList) {
|
|
|
6534
6636
|
});
|
|
6535
6637
|
}
|
|
6536
6638
|
function updateChange(updateList) {
|
|
6537
|
-
|
|
6538
|
-
updateList.list.forEach(leaf => {
|
|
6539
|
-
layout = leaf.__layout;
|
|
6540
|
-
if (layout.opacityChanged)
|
|
6541
|
-
updateAllWorldOpacity(leaf);
|
|
6542
|
-
if (layout.stateStyleChanged)
|
|
6543
|
-
setTimeout(() => layout.stateStyleChanged && leaf.updateState());
|
|
6544
|
-
leaf.__updateChange();
|
|
6545
|
-
});
|
|
6639
|
+
updateList.list.forEach(updateOneChange);
|
|
6546
6640
|
}
|
|
6547
6641
|
|
|
6548
6642
|
const { worldBounds } = LeafBoundsHelper;
|
|
@@ -6599,7 +6693,7 @@ class Layouter {
|
|
|
6599
6693
|
this.disabled = true;
|
|
6600
6694
|
}
|
|
6601
6695
|
layout() {
|
|
6602
|
-
if (!this.running)
|
|
6696
|
+
if (this.layouting || !this.running)
|
|
6603
6697
|
return;
|
|
6604
6698
|
const { target } = this;
|
|
6605
6699
|
this.times = 0;
|
|
@@ -6682,12 +6776,10 @@ class Layouter {
|
|
|
6682
6776
|
}
|
|
6683
6777
|
static fullLayout(target) {
|
|
6684
6778
|
updateAllMatrix(target, true);
|
|
6685
|
-
if (target.isBranch)
|
|
6779
|
+
if (target.isBranch)
|
|
6686
6780
|
BranchHelper.updateBounds(target);
|
|
6687
|
-
|
|
6688
|
-
else {
|
|
6781
|
+
else
|
|
6689
6782
|
LeafHelper.updateBounds(target);
|
|
6690
|
-
}
|
|
6691
6783
|
updateAllChange(target);
|
|
6692
6784
|
}
|
|
6693
6785
|
addExtra(leaf) {
|
|
@@ -6710,11 +6802,12 @@ class Layouter {
|
|
|
6710
6802
|
this.__updatedList = event.data.updatedList;
|
|
6711
6803
|
}
|
|
6712
6804
|
__listenEvents() {
|
|
6713
|
-
const { target } = this;
|
|
6714
6805
|
this.__eventIds = [
|
|
6715
|
-
target.on_(
|
|
6716
|
-
|
|
6717
|
-
|
|
6806
|
+
this.target.on_([
|
|
6807
|
+
[LayoutEvent.REQUEST, this.layout, this],
|
|
6808
|
+
[LayoutEvent.AGAIN, this.layoutAgain, this],
|
|
6809
|
+
[WatchEvent.DATA, this.__onReceiveWatchData, this]
|
|
6810
|
+
])
|
|
6718
6811
|
];
|
|
6719
6812
|
}
|
|
6720
6813
|
__removeListenEvents() {
|
|
@@ -6945,12 +7038,13 @@ class Renderer {
|
|
|
6945
7038
|
this.target.emitEvent(new RenderEvent(type, this.times, bounds, options));
|
|
6946
7039
|
}
|
|
6947
7040
|
__listenEvents() {
|
|
6948
|
-
const { target } = this;
|
|
6949
7041
|
this.__eventIds = [
|
|
6950
|
-
target.on_(
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
7042
|
+
this.target.on_([
|
|
7043
|
+
[RenderEvent.REQUEST, this.update, this],
|
|
7044
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
7045
|
+
[RenderEvent.AGAIN, this.renderAgain, this],
|
|
7046
|
+
[ResizeEvent.RESIZE, this.__onResize, this]
|
|
7047
|
+
])
|
|
6954
7048
|
];
|
|
6955
7049
|
}
|
|
6956
7050
|
__removeListenEvents() {
|
|
@@ -7009,8 +7103,32 @@ function zoomLayerType() {
|
|
|
7009
7103
|
};
|
|
7010
7104
|
}
|
|
7011
7105
|
|
|
7106
|
+
function hasTransparent$3(color) {
|
|
7107
|
+
if (!color || color.length === 7 || color.length === 4)
|
|
7108
|
+
return false;
|
|
7109
|
+
if (color === 'transparent')
|
|
7110
|
+
return true;
|
|
7111
|
+
const first = color[0];
|
|
7112
|
+
if (first === '#') {
|
|
7113
|
+
switch (color.length) {
|
|
7114
|
+
case 5: return color[4] !== 'f' && color[4] !== 'F';
|
|
7115
|
+
case 9: return (color[7] !== 'f' && color[7] !== 'F') || (color[8] !== 'f' && color[8] !== 'F');
|
|
7116
|
+
}
|
|
7117
|
+
}
|
|
7118
|
+
else if (first === 'r' || first === 'h') {
|
|
7119
|
+
if (color[3] === 'a') {
|
|
7120
|
+
const i = color.lastIndexOf(',');
|
|
7121
|
+
if (i > -1)
|
|
7122
|
+
return parseFloat(color.slice(i + 1)) < 1;
|
|
7123
|
+
}
|
|
7124
|
+
}
|
|
7125
|
+
return false;
|
|
7126
|
+
}
|
|
7127
|
+
|
|
7012
7128
|
const TextConvert = {};
|
|
7013
|
-
const ColorConvert = {
|
|
7129
|
+
const ColorConvert = {
|
|
7130
|
+
hasTransparent: hasTransparent$3
|
|
7131
|
+
};
|
|
7014
7132
|
const UnitConvert = {
|
|
7015
7133
|
number(value, percentRefer) {
|
|
7016
7134
|
return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
|
|
@@ -7036,6 +7154,7 @@ const Transition = {
|
|
|
7036
7154
|
};
|
|
7037
7155
|
|
|
7038
7156
|
const { parse, objectToCanvasData } = PathConvert;
|
|
7157
|
+
const { stintSet: stintSet$2 } = DataHelper, { hasTransparent: hasTransparent$2 } = ColorConvert;
|
|
7039
7158
|
const emptyPaint = {};
|
|
7040
7159
|
const debug$1 = Debug.get('UIData');
|
|
7041
7160
|
class UIData extends LeafData {
|
|
@@ -7094,38 +7213,22 @@ class UIData extends LeafData {
|
|
|
7094
7213
|
if (this.__naturalWidth)
|
|
7095
7214
|
this.__removeNaturalSize();
|
|
7096
7215
|
if (typeof value === 'string' || !value) {
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
PaintImage.recycleImage('fill', this);
|
|
7100
|
-
this.__isFills = false;
|
|
7101
|
-
this.__pixelFill && (this.__pixelFill = false);
|
|
7102
|
-
}
|
|
7216
|
+
stintSet$2(this, '__isTransparentFill', hasTransparent$2(value));
|
|
7217
|
+
this.__isFills && this.__removePaint('fill', true);
|
|
7103
7218
|
this._fill = value;
|
|
7104
7219
|
}
|
|
7105
7220
|
else if (typeof value === 'object') {
|
|
7106
|
-
this.
|
|
7107
|
-
const layout = this.__leaf.__layout;
|
|
7108
|
-
layout.boxChanged || layout.boxChange();
|
|
7109
|
-
this.__isFills = true;
|
|
7110
|
-
this._fill || (this._fill = emptyPaint);
|
|
7221
|
+
this.__setPaint('fill', value);
|
|
7111
7222
|
}
|
|
7112
7223
|
}
|
|
7113
7224
|
setStroke(value) {
|
|
7114
7225
|
if (typeof value === 'string' || !value) {
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
PaintImage.recycleImage('stroke', this);
|
|
7118
|
-
this.__isStrokes = false;
|
|
7119
|
-
this.__pixelStroke && (this.__pixelStroke = false);
|
|
7120
|
-
}
|
|
7226
|
+
stintSet$2(this, '__isTransparentStroke', hasTransparent$2(value));
|
|
7227
|
+
this.__isStrokes && this.__removePaint('stroke', true);
|
|
7121
7228
|
this._stroke = value;
|
|
7122
7229
|
}
|
|
7123
7230
|
else if (typeof value === 'object') {
|
|
7124
|
-
this.
|
|
7125
|
-
const layout = this.__leaf.__layout;
|
|
7126
|
-
layout.boxChanged || layout.boxChange();
|
|
7127
|
-
this.__isStrokes = true;
|
|
7128
|
-
this._stroke || (this._stroke = emptyPaint);
|
|
7231
|
+
this.__setPaint('stroke', value);
|
|
7129
7232
|
}
|
|
7130
7233
|
}
|
|
7131
7234
|
setPath(value) {
|
|
@@ -7155,7 +7258,34 @@ class UIData extends LeafData {
|
|
|
7155
7258
|
Paint.compute('fill', this.__leaf);
|
|
7156
7259
|
if (stroke)
|
|
7157
7260
|
Paint.compute('stroke', this.__leaf);
|
|
7158
|
-
this.__needComputePaint =
|
|
7261
|
+
this.__needComputePaint = undefined;
|
|
7262
|
+
}
|
|
7263
|
+
__setPaint(attrName, value) {
|
|
7264
|
+
this.__setInput(attrName, value);
|
|
7265
|
+
const layout = this.__leaf.__layout;
|
|
7266
|
+
layout.boxChanged || layout.boxChange();
|
|
7267
|
+
if (value instanceof Array && !value.length) {
|
|
7268
|
+
this.__removePaint(attrName);
|
|
7269
|
+
}
|
|
7270
|
+
else {
|
|
7271
|
+
if (attrName === 'fill')
|
|
7272
|
+
this.__isFills = true, this._fill || (this._fill = emptyPaint);
|
|
7273
|
+
else
|
|
7274
|
+
this.__isStrokes = true, this._stroke || (this._stroke = emptyPaint);
|
|
7275
|
+
}
|
|
7276
|
+
}
|
|
7277
|
+
__removePaint(attrName, removeInput) {
|
|
7278
|
+
if (removeInput)
|
|
7279
|
+
this.__removeInput(attrName);
|
|
7280
|
+
PaintImage.recycleImage(attrName, this);
|
|
7281
|
+
if (attrName === 'fill') {
|
|
7282
|
+
stintSet$2(this, '__isAlphaPixelFill', undefined);
|
|
7283
|
+
this._fill = this.__isFills = undefined;
|
|
7284
|
+
}
|
|
7285
|
+
else {
|
|
7286
|
+
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7287
|
+
this._stroke = this.__isStrokes = undefined;
|
|
7288
|
+
}
|
|
7159
7289
|
}
|
|
7160
7290
|
}
|
|
7161
7291
|
function setArray(data, key, value) {
|
|
@@ -7163,10 +7293,10 @@ function setArray(data, key, value) {
|
|
|
7163
7293
|
if (value instanceof Array) {
|
|
7164
7294
|
if (value.some((item) => item.visible === false))
|
|
7165
7295
|
value = value.filter((item) => item.visible !== false);
|
|
7166
|
-
value.length || (value =
|
|
7296
|
+
value.length || (value = undefined);
|
|
7167
7297
|
}
|
|
7168
7298
|
else
|
|
7169
|
-
value = value && value.visible !== false ? [value] :
|
|
7299
|
+
value = value && value.visible !== false ? [value] : undefined;
|
|
7170
7300
|
data['_' + key] = value;
|
|
7171
7301
|
}
|
|
7172
7302
|
|
|
@@ -7230,13 +7360,11 @@ class TextData extends UIData {
|
|
|
7230
7360
|
setFontWeight(value) {
|
|
7231
7361
|
if (typeof value === 'string') {
|
|
7232
7362
|
this.__setInput('fontWeight', value);
|
|
7233
|
-
|
|
7234
|
-
}
|
|
7235
|
-
else {
|
|
7236
|
-
if (this.__input)
|
|
7237
|
-
this.__removeInput('fontWeight');
|
|
7238
|
-
this._fontWeight = value;
|
|
7363
|
+
value = fontWeightMap[value] || 400;
|
|
7239
7364
|
}
|
|
7365
|
+
else if (this.__input)
|
|
7366
|
+
this.__removeInput('fontWeight');
|
|
7367
|
+
this._fontWeight = value;
|
|
7240
7368
|
}
|
|
7241
7369
|
setBoxStyle(value) {
|
|
7242
7370
|
let t = this.__leaf, box = t.__box;
|
|
@@ -7271,8 +7399,6 @@ class ImageData extends RectData {
|
|
|
7271
7399
|
this._url = value;
|
|
7272
7400
|
}
|
|
7273
7401
|
__setImageFill(value) {
|
|
7274
|
-
if (this.__leaf.image)
|
|
7275
|
-
this.__leaf.image = null;
|
|
7276
7402
|
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
7277
7403
|
}
|
|
7278
7404
|
__getData() {
|
|
@@ -7338,21 +7464,19 @@ const UIBounds = {
|
|
|
7338
7464
|
}
|
|
7339
7465
|
};
|
|
7340
7466
|
|
|
7467
|
+
const { stintSet: stintSet$1 } = DataHelper;
|
|
7341
7468
|
const UIRender = {
|
|
7342
7469
|
__updateChange() {
|
|
7343
|
-
const data = this.__
|
|
7470
|
+
const data = this.__;
|
|
7344
7471
|
if (data.__useEffect) {
|
|
7345
|
-
const { shadow,
|
|
7346
|
-
data.
|
|
7472
|
+
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7473
|
+
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')));
|
|
7474
|
+
data.__useEffect = !!(shadow || otherEffect);
|
|
7347
7475
|
}
|
|
7348
|
-
|
|
7349
|
-
|
|
7476
|
+
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7477
|
+
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7350
7478
|
data.__checkSingle();
|
|
7351
|
-
|
|
7352
|
-
if (complex)
|
|
7353
|
-
data.__complex = true;
|
|
7354
|
-
else
|
|
7355
|
-
data.__complex && (data.__complex = false);
|
|
7479
|
+
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7356
7480
|
},
|
|
7357
7481
|
__drawFast(canvas, options) {
|
|
7358
7482
|
drawFast(this, canvas, options);
|
|
@@ -7362,21 +7486,23 @@ const UIRender = {
|
|
|
7362
7486
|
if (data.__complex) {
|
|
7363
7487
|
if (data.__needComputePaint)
|
|
7364
7488
|
data.__computePaint();
|
|
7365
|
-
const { fill, stroke, __drawAfterFill } = data;
|
|
7489
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke, __isFastShadow } = data;
|
|
7366
7490
|
this.__drawRenderPath(canvas);
|
|
7367
|
-
if (data.__useEffect) {
|
|
7491
|
+
if (data.__useEffect && !__isFastShadow) {
|
|
7368
7492
|
const shape = Paint.shape(this, canvas, options);
|
|
7369
7493
|
this.__nowWorld = this.__getNowWorld(options);
|
|
7370
7494
|
const { shadow, innerShadow, filter } = data;
|
|
7371
7495
|
if (shadow)
|
|
7372
7496
|
Effect.shadow(this, canvas, shape);
|
|
7497
|
+
if (__fillAfterStroke)
|
|
7498
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7373
7499
|
if (fill)
|
|
7374
7500
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7375
7501
|
if (__drawAfterFill)
|
|
7376
7502
|
this.__drawAfterFill(canvas, options);
|
|
7377
7503
|
if (innerShadow)
|
|
7378
7504
|
Effect.innerShadow(this, canvas, shape);
|
|
7379
|
-
if (stroke)
|
|
7505
|
+
if (stroke && !__fillAfterStroke)
|
|
7380
7506
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7381
7507
|
if (filter)
|
|
7382
7508
|
Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
@@ -7385,21 +7511,27 @@ const UIRender = {
|
|
|
7385
7511
|
shape.canvas.recycle();
|
|
7386
7512
|
}
|
|
7387
7513
|
else {
|
|
7514
|
+
if (__fillAfterStroke)
|
|
7515
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7516
|
+
if (__isFastShadow) {
|
|
7517
|
+
const shadow = data.shadow[0], { scaleX, scaleY } = this.__nowWorld;
|
|
7518
|
+
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
7519
|
+
}
|
|
7388
7520
|
if (fill)
|
|
7389
7521
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7522
|
+
if (__isFastShadow)
|
|
7523
|
+
canvas.restore();
|
|
7390
7524
|
if (__drawAfterFill)
|
|
7391
7525
|
this.__drawAfterFill(canvas, options);
|
|
7392
|
-
if (stroke)
|
|
7526
|
+
if (stroke && !__fillAfterStroke)
|
|
7393
7527
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7394
7528
|
}
|
|
7395
7529
|
}
|
|
7396
7530
|
else {
|
|
7397
|
-
if (data.__pathInputed)
|
|
7531
|
+
if (data.__pathInputed)
|
|
7398
7532
|
drawFast(this, canvas, options);
|
|
7399
|
-
|
|
7400
|
-
else {
|
|
7533
|
+
else
|
|
7401
7534
|
this.__drawFast(canvas, options);
|
|
7402
|
-
}
|
|
7403
7535
|
}
|
|
7404
7536
|
},
|
|
7405
7537
|
__renderShape(canvas, options, ignoreFill, ignoreStroke) {
|
|
@@ -7408,11 +7540,11 @@ const UIRender = {
|
|
|
7408
7540
|
const { fill, stroke } = this.__;
|
|
7409
7541
|
this.__drawRenderPath(canvas);
|
|
7410
7542
|
if (fill && !ignoreFill)
|
|
7411
|
-
this.__.
|
|
7543
|
+
this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7412
7544
|
if (this.__.__isCanvas)
|
|
7413
7545
|
this.__drawAfterFill(canvas, options);
|
|
7414
7546
|
if (stroke && !ignoreStroke)
|
|
7415
|
-
this.__.
|
|
7547
|
+
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7416
7548
|
}
|
|
7417
7549
|
},
|
|
7418
7550
|
__drawAfterFill(canvas, options) {
|
|
@@ -7427,13 +7559,15 @@ const UIRender = {
|
|
|
7427
7559
|
}
|
|
7428
7560
|
};
|
|
7429
7561
|
function drawFast(ui, canvas, options) {
|
|
7430
|
-
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
7562
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke } = ui.__;
|
|
7431
7563
|
ui.__drawRenderPath(canvas);
|
|
7564
|
+
if (__fillAfterStroke)
|
|
7565
|
+
Paint.stroke(stroke, ui, canvas);
|
|
7432
7566
|
if (fill)
|
|
7433
7567
|
Paint.fill(fill, ui, canvas);
|
|
7434
7568
|
if (__drawAfterFill)
|
|
7435
7569
|
ui.__drawAfterFill(canvas, options);
|
|
7436
|
-
if (stroke)
|
|
7570
|
+
if (stroke && !__fillAfterStroke)
|
|
7437
7571
|
Paint.stroke(stroke, ui, canvas);
|
|
7438
7572
|
}
|
|
7439
7573
|
|
|
@@ -7563,6 +7697,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7563
7697
|
else
|
|
7564
7698
|
drawer.rect(x, y, width, height);
|
|
7565
7699
|
}
|
|
7700
|
+
drawImagePlaceholder(canvas, _image) {
|
|
7701
|
+
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7702
|
+
}
|
|
7566
7703
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7567
7704
|
return Plugin.need('animate');
|
|
7568
7705
|
}
|
|
@@ -7799,6 +7936,12 @@ __decorate([
|
|
|
7799
7936
|
__decorate([
|
|
7800
7937
|
effectType()
|
|
7801
7938
|
], UI.prototype, "filter", void 0);
|
|
7939
|
+
__decorate([
|
|
7940
|
+
surfaceType()
|
|
7941
|
+
], UI.prototype, "placeholderColor", void 0);
|
|
7942
|
+
__decorate([
|
|
7943
|
+
dataType(100)
|
|
7944
|
+
], UI.prototype, "placeholderDelay", void 0);
|
|
7802
7945
|
__decorate([
|
|
7803
7946
|
dataType({})
|
|
7804
7947
|
], UI.prototype, "data", void 0);
|
|
@@ -8200,15 +8343,20 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8200
8343
|
}
|
|
8201
8344
|
__listenEvents() {
|
|
8202
8345
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8203
|
-
this.once(
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8346
|
+
this.once([
|
|
8347
|
+
[LeaferEvent.START, () => Run.end(runId)],
|
|
8348
|
+
[LayoutEvent.START, this.updateLazyBounds, this],
|
|
8349
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
8350
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
8351
|
+
]);
|
|
8352
|
+
this.__eventIds.push(this.on_([
|
|
8353
|
+
[WatchEvent.DATA, this.__onWatchData, this],
|
|
8354
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
8355
|
+
[RenderEvent.NEXT, this.__onNextRender, this]
|
|
8356
|
+
]));
|
|
8208
8357
|
}
|
|
8209
8358
|
__removeListenEvents() {
|
|
8210
8359
|
this.off_(this.__eventIds);
|
|
8211
|
-
this.__eventIds.length = 0;
|
|
8212
8360
|
}
|
|
8213
8361
|
destroy(sync) {
|
|
8214
8362
|
const doDestory = () => {
|
|
@@ -8268,8 +8416,8 @@ Rect = __decorate([
|
|
|
8268
8416
|
registerUI()
|
|
8269
8417
|
], Rect);
|
|
8270
8418
|
|
|
8271
|
-
const { copy: copy$
|
|
8272
|
-
const rect = Rect.prototype, group = Group.prototype;
|
|
8419
|
+
const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
|
|
8420
|
+
const rect$1 = Rect.prototype, group = Group.prototype;
|
|
8273
8421
|
const childrenRenderBounds = {};
|
|
8274
8422
|
let Box = class Box extends Group {
|
|
8275
8423
|
get __tag() { return 'Box'; }
|
|
@@ -8314,15 +8462,15 @@ let Box = class Box extends Group {
|
|
|
8314
8462
|
const { renderBounds } = this.__layout;
|
|
8315
8463
|
if (this.children.length) {
|
|
8316
8464
|
super.__updateRenderBounds();
|
|
8317
|
-
copy$
|
|
8465
|
+
copy$3(childrenRenderBounds, renderBounds);
|
|
8318
8466
|
this.__updateRectRenderBounds();
|
|
8319
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8467
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8320
8468
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8321
8469
|
add(renderBounds, childrenRenderBounds);
|
|
8322
8470
|
}
|
|
8323
8471
|
else
|
|
8324
8472
|
this.__updateRectRenderBounds();
|
|
8325
|
-
|
|
8473
|
+
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8326
8474
|
}
|
|
8327
8475
|
__updateRectRenderBounds() { }
|
|
8328
8476
|
__updateRectChange() { }
|
|
@@ -8366,25 +8514,25 @@ __decorate([
|
|
|
8366
8514
|
affectRenderBoundsType('show')
|
|
8367
8515
|
], Box.prototype, "overflow", void 0);
|
|
8368
8516
|
__decorate([
|
|
8369
|
-
rewrite(rect.__updateStrokeSpread)
|
|
8517
|
+
rewrite(rect$1.__updateStrokeSpread)
|
|
8370
8518
|
], Box.prototype, "__updateStrokeSpread", null);
|
|
8371
8519
|
__decorate([
|
|
8372
|
-
rewrite(rect.__updateRenderSpread)
|
|
8520
|
+
rewrite(rect$1.__updateRenderSpread)
|
|
8373
8521
|
], Box.prototype, "__updateRectRenderSpread", null);
|
|
8374
8522
|
__decorate([
|
|
8375
|
-
rewrite(rect.__updateBoxBounds)
|
|
8523
|
+
rewrite(rect$1.__updateBoxBounds)
|
|
8376
8524
|
], Box.prototype, "__updateRectBoxBounds", null);
|
|
8377
8525
|
__decorate([
|
|
8378
|
-
rewrite(rect.__updateStrokeBounds)
|
|
8526
|
+
rewrite(rect$1.__updateStrokeBounds)
|
|
8379
8527
|
], Box.prototype, "__updateStrokeBounds", null);
|
|
8380
8528
|
__decorate([
|
|
8381
|
-
rewrite(rect.__updateRenderBounds)
|
|
8529
|
+
rewrite(rect$1.__updateRenderBounds)
|
|
8382
8530
|
], Box.prototype, "__updateRectRenderBounds", null);
|
|
8383
8531
|
__decorate([
|
|
8384
|
-
rewrite(rect.__updateChange)
|
|
8532
|
+
rewrite(rect$1.__updateChange)
|
|
8385
8533
|
], Box.prototype, "__updateRectChange", null);
|
|
8386
8534
|
__decorate([
|
|
8387
|
-
rewrite(rect.__render)
|
|
8535
|
+
rewrite(rect$1.__render)
|
|
8388
8536
|
], Box.prototype, "__renderRect", null);
|
|
8389
8537
|
__decorate([
|
|
8390
8538
|
rewrite(group.__render)
|
|
@@ -8626,17 +8774,10 @@ Star = __decorate([
|
|
|
8626
8774
|
|
|
8627
8775
|
let Image$1 = class Image extends Rect {
|
|
8628
8776
|
get __tag() { return 'Image'; }
|
|
8629
|
-
get ready() {
|
|
8777
|
+
get ready() { const { image } = this; return image && image.ready; }
|
|
8778
|
+
get image() { const { fill } = this.__; return fill instanceof Array && fill[0].image; }
|
|
8630
8779
|
constructor(data) {
|
|
8631
8780
|
super(data);
|
|
8632
|
-
this.on(ImageEvent.LOADED, (e) => {
|
|
8633
|
-
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8634
|
-
this.image = e.image;
|
|
8635
|
-
});
|
|
8636
|
-
}
|
|
8637
|
-
destroy() {
|
|
8638
|
-
this.image = null;
|
|
8639
|
-
super.destroy();
|
|
8640
8781
|
}
|
|
8641
8782
|
};
|
|
8642
8783
|
__decorate([
|
|
@@ -8652,11 +8793,11 @@ const MyImage = Image$1;
|
|
|
8652
8793
|
|
|
8653
8794
|
let Canvas = class Canvas extends Rect {
|
|
8654
8795
|
get __tag() { return 'Canvas'; }
|
|
8796
|
+
get context() { return this.canvas.context; }
|
|
8655
8797
|
get ready() { return !this.url; }
|
|
8656
8798
|
constructor(data) {
|
|
8657
8799
|
super(data);
|
|
8658
8800
|
this.canvas = Creator.canvas(this.__);
|
|
8659
|
-
this.context = this.canvas.context;
|
|
8660
8801
|
if (data && data.url)
|
|
8661
8802
|
this.drawImage(data.url);
|
|
8662
8803
|
}
|
|
@@ -8700,7 +8841,7 @@ let Canvas = class Canvas extends Rect {
|
|
|
8700
8841
|
destroy() {
|
|
8701
8842
|
if (this.canvas) {
|
|
8702
8843
|
this.canvas.destroy();
|
|
8703
|
-
this.canvas =
|
|
8844
|
+
this.canvas = null;
|
|
8704
8845
|
}
|
|
8705
8846
|
super.destroy();
|
|
8706
8847
|
}
|
|
@@ -8746,7 +8887,7 @@ let Text = class Text extends UI {
|
|
|
8746
8887
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8747
8888
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8748
8889
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8749
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8890
|
+
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__);
|
|
8750
8891
|
}
|
|
8751
8892
|
__updateBoxBounds() {
|
|
8752
8893
|
const data = this.__;
|
|
@@ -8776,12 +8917,11 @@ let Text = class Text extends UI {
|
|
|
8776
8917
|
super.__updateBoxBounds();
|
|
8777
8918
|
if (italic)
|
|
8778
8919
|
b.width += fontSize * 0.16;
|
|
8779
|
-
|
|
8780
|
-
if (isOverflow)
|
|
8920
|
+
DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds));
|
|
8921
|
+
if (this.isOverflow)
|
|
8781
8922
|
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8782
8923
|
else
|
|
8783
8924
|
data.__textBoxBounds = b;
|
|
8784
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8785
8925
|
}
|
|
8786
8926
|
__onUpdateSize() {
|
|
8787
8927
|
if (this.__box)
|
|
@@ -8844,6 +8984,9 @@ __decorate([
|
|
|
8844
8984
|
__decorate([
|
|
8845
8985
|
boundsType('')
|
|
8846
8986
|
], Text.prototype, "text", void 0);
|
|
8987
|
+
__decorate([
|
|
8988
|
+
boundsType('')
|
|
8989
|
+
], Text.prototype, "placeholder", void 0);
|
|
8847
8990
|
__decorate([
|
|
8848
8991
|
boundsType('caption')
|
|
8849
8992
|
], Text.prototype, "fontFamily", void 0);
|
|
@@ -8963,8 +9106,10 @@ function penPathType() {
|
|
|
8963
9106
|
}
|
|
8964
9107
|
|
|
8965
9108
|
function fillText(ui, canvas) {
|
|
8966
|
-
|
|
8967
|
-
|
|
9109
|
+
const data = ui.__, { rows, decorationY } = data.__textDrawData;
|
|
9110
|
+
if (data.__isPlacehold && data.placeholderColor)
|
|
9111
|
+
canvas.fillStyle = data.placeholderColor;
|
|
9112
|
+
let row;
|
|
8968
9113
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
8969
9114
|
row = rows[i];
|
|
8970
9115
|
if (row.text)
|
|
@@ -8973,7 +9118,7 @@ function fillText(ui, canvas) {
|
|
|
8973
9118
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
8974
9119
|
}
|
|
8975
9120
|
if (decorationY) {
|
|
8976
|
-
const { decorationColor, decorationHeight } = data;
|
|
9121
|
+
const { decorationColor, decorationHeight } = data.__textDrawData;
|
|
8977
9122
|
if (decorationColor)
|
|
8978
9123
|
canvas.fillStyle = decorationColor;
|
|
8979
9124
|
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
@@ -8982,65 +9127,596 @@ function fillText(ui, canvas) {
|
|
|
8982
9127
|
|
|
8983
9128
|
function fill(fill, ui, canvas) {
|
|
8984
9129
|
canvas.fillStyle = fill;
|
|
8985
|
-
|
|
9130
|
+
fillPathOrText(ui, canvas);
|
|
8986
9131
|
}
|
|
8987
9132
|
function fills(fills, ui, canvas) {
|
|
8988
9133
|
let item;
|
|
8989
|
-
const { windingRule, __font } = ui.__;
|
|
8990
9134
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
8991
9135
|
item = fills[i];
|
|
8992
|
-
if (item.image
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
if (item.blendMode)
|
|
9000
|
-
canvas.blendMode = item.blendMode;
|
|
9001
|
-
__font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
|
|
9002
|
-
canvas.restore();
|
|
9136
|
+
if (item.image) {
|
|
9137
|
+
if (PaintImage.checkImage(ui, canvas, item, !ui.__.__font))
|
|
9138
|
+
continue;
|
|
9139
|
+
if (!item.style) {
|
|
9140
|
+
if (!i && item.image.isPlacehold)
|
|
9141
|
+
ui.drawImagePlaceholder(canvas, item.image);
|
|
9142
|
+
continue;
|
|
9003
9143
|
}
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
|
|
9012
|
-
|
|
9144
|
+
}
|
|
9145
|
+
canvas.fillStyle = item.style;
|
|
9146
|
+
if (item.transform) {
|
|
9147
|
+
canvas.save();
|
|
9148
|
+
canvas.transform(item.transform);
|
|
9149
|
+
if (item.blendMode)
|
|
9150
|
+
canvas.blendMode = item.blendMode;
|
|
9151
|
+
fillPathOrText(ui, canvas);
|
|
9152
|
+
canvas.restore();
|
|
9153
|
+
}
|
|
9154
|
+
else {
|
|
9155
|
+
if (item.blendMode) {
|
|
9156
|
+
canvas.saveBlendMode(item.blendMode);
|
|
9157
|
+
fillPathOrText(ui, canvas);
|
|
9158
|
+
canvas.restoreBlendMode();
|
|
9013
9159
|
}
|
|
9160
|
+
else
|
|
9161
|
+
fillPathOrText(ui, canvas);
|
|
9014
9162
|
}
|
|
9015
9163
|
}
|
|
9016
9164
|
}
|
|
9165
|
+
function fillPathOrText(ui, canvas) {
|
|
9166
|
+
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
9167
|
+
}
|
|
9168
|
+
|
|
9169
|
+
let App = class App extends Leafer {
|
|
9170
|
+
get __tag() { return 'App'; }
|
|
9171
|
+
get isApp() { return true; }
|
|
9172
|
+
constructor(userConfig, data) {
|
|
9173
|
+
super(userConfig, data);
|
|
9174
|
+
}
|
|
9175
|
+
init(userConfig, parentApp) {
|
|
9176
|
+
super.init(userConfig, parentApp);
|
|
9177
|
+
if (userConfig) {
|
|
9178
|
+
const { ground, tree, sky, editor } = userConfig;
|
|
9179
|
+
if (ground)
|
|
9180
|
+
this.ground = this.addLeafer(ground);
|
|
9181
|
+
if (tree || editor)
|
|
9182
|
+
this.tree = this.addLeafer(tree || { type: userConfig.type || 'design' });
|
|
9183
|
+
if (sky || editor)
|
|
9184
|
+
this.sky = this.addLeafer(sky);
|
|
9185
|
+
if (editor)
|
|
9186
|
+
Creator.editor(editor, this);
|
|
9187
|
+
}
|
|
9188
|
+
}
|
|
9189
|
+
__setApp() {
|
|
9190
|
+
const { canvas } = this;
|
|
9191
|
+
const { realCanvas, view } = this.config;
|
|
9192
|
+
if (realCanvas || view === this.canvas.view || !canvas.parentView)
|
|
9193
|
+
this.realCanvas = true;
|
|
9194
|
+
else
|
|
9195
|
+
canvas.unrealCanvas();
|
|
9196
|
+
this.leafer = this;
|
|
9197
|
+
this.watcher.disable();
|
|
9198
|
+
this.layouter.disable();
|
|
9199
|
+
}
|
|
9200
|
+
__updateLocalBounds() {
|
|
9201
|
+
this.forEach(leafer => leafer.updateLayout());
|
|
9202
|
+
super.__updateLocalBounds();
|
|
9203
|
+
}
|
|
9204
|
+
start() {
|
|
9205
|
+
super.start();
|
|
9206
|
+
this.forEach(leafer => leafer.start());
|
|
9207
|
+
}
|
|
9208
|
+
stop() {
|
|
9209
|
+
this.forEach(leafer => leafer.stop());
|
|
9210
|
+
super.stop();
|
|
9211
|
+
}
|
|
9212
|
+
unlockLayout() {
|
|
9213
|
+
super.unlockLayout();
|
|
9214
|
+
this.forEach(leafer => leafer.unlockLayout());
|
|
9215
|
+
}
|
|
9216
|
+
lockLayout() {
|
|
9217
|
+
super.lockLayout();
|
|
9218
|
+
this.forEach(leafer => leafer.lockLayout());
|
|
9219
|
+
}
|
|
9220
|
+
forceRender(bounds, sync) {
|
|
9221
|
+
this.forEach(leafer => leafer.forceRender(bounds, sync));
|
|
9222
|
+
}
|
|
9223
|
+
addLeafer(merge) {
|
|
9224
|
+
const leafer = new Leafer(merge);
|
|
9225
|
+
this.add(leafer);
|
|
9226
|
+
return leafer;
|
|
9227
|
+
}
|
|
9228
|
+
add(leafer, index) {
|
|
9229
|
+
if (!leafer.view) {
|
|
9230
|
+
if (this.realCanvas && !this.canvas.bounds) {
|
|
9231
|
+
setTimeout(() => this.add(leafer, index), 10);
|
|
9232
|
+
return;
|
|
9233
|
+
}
|
|
9234
|
+
leafer.init(this.__getChildConfig(leafer.userConfig), this);
|
|
9235
|
+
}
|
|
9236
|
+
super.add(leafer, index);
|
|
9237
|
+
if (index !== undefined)
|
|
9238
|
+
leafer.canvas.childIndex = index;
|
|
9239
|
+
this.__listenChildEvents(leafer);
|
|
9240
|
+
}
|
|
9241
|
+
forEach(fn) {
|
|
9242
|
+
this.children.forEach(fn);
|
|
9243
|
+
}
|
|
9244
|
+
__onCreated() {
|
|
9245
|
+
this.created = this.children.every(child => child.created);
|
|
9246
|
+
}
|
|
9247
|
+
__onReady() {
|
|
9248
|
+
if (this.children.every(child => child.ready))
|
|
9249
|
+
super.__onReady();
|
|
9250
|
+
}
|
|
9251
|
+
__onViewReady() {
|
|
9252
|
+
if (this.children.every(child => child.viewReady))
|
|
9253
|
+
super.__onViewReady();
|
|
9254
|
+
}
|
|
9255
|
+
__onChildRenderEnd(e) {
|
|
9256
|
+
this.renderer.addBlock(e.renderBounds);
|
|
9257
|
+
if (this.viewReady)
|
|
9258
|
+
this.renderer.update();
|
|
9259
|
+
}
|
|
9260
|
+
__render(canvas, options) {
|
|
9261
|
+
if (canvas.context)
|
|
9262
|
+
this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
|
|
9263
|
+
}
|
|
9264
|
+
__onResize(event) {
|
|
9265
|
+
this.forEach(leafer => leafer.resize(event));
|
|
9266
|
+
super.__onResize(event);
|
|
9267
|
+
}
|
|
9268
|
+
updateLayout() {
|
|
9269
|
+
this.forEach(leafer => leafer.updateLayout());
|
|
9270
|
+
}
|
|
9271
|
+
__getChildConfig(userConfig) {
|
|
9272
|
+
const config = Object.assign({}, this.config);
|
|
9273
|
+
config.hittable = config.realCanvas = undefined;
|
|
9274
|
+
if (userConfig)
|
|
9275
|
+
DataHelper.assign(config, userConfig);
|
|
9276
|
+
if (this.autoLayout)
|
|
9277
|
+
DataHelper.copyAttrs(config, this, canvasSizeAttrs);
|
|
9278
|
+
config.view = this.realCanvas ? undefined : this.view;
|
|
9279
|
+
config.fill = undefined;
|
|
9280
|
+
return config;
|
|
9281
|
+
}
|
|
9282
|
+
__listenChildEvents(leafer) {
|
|
9283
|
+
leafer.once([
|
|
9284
|
+
[LayoutEvent.END, this.__onReady, this],
|
|
9285
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
9286
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
9287
|
+
]);
|
|
9288
|
+
if (this.realCanvas)
|
|
9289
|
+
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9290
|
+
}
|
|
9291
|
+
};
|
|
9292
|
+
App = __decorate([
|
|
9293
|
+
registerUI()
|
|
9294
|
+
], App);
|
|
9295
|
+
|
|
9296
|
+
const downKeyMap = {};
|
|
9297
|
+
const Keyboard = {
|
|
9298
|
+
isHoldSpaceKey() {
|
|
9299
|
+
return Keyboard.isHold('Space');
|
|
9300
|
+
},
|
|
9301
|
+
isHold(code) {
|
|
9302
|
+
return downKeyMap[code];
|
|
9303
|
+
},
|
|
9304
|
+
setDownCode(code) {
|
|
9305
|
+
if (!downKeyMap[code])
|
|
9306
|
+
downKeyMap[code] = true;
|
|
9307
|
+
},
|
|
9308
|
+
setUpCode(code) {
|
|
9309
|
+
downKeyMap[code] = false;
|
|
9310
|
+
}
|
|
9311
|
+
};
|
|
9312
|
+
|
|
9313
|
+
const PointerButton = {
|
|
9314
|
+
LEFT: 1,
|
|
9315
|
+
RIGHT: 2,
|
|
9316
|
+
MIDDLE: 4,
|
|
9317
|
+
defaultLeft(event) { if (!event.buttons)
|
|
9318
|
+
event.buttons = 1; },
|
|
9319
|
+
left(event) { return event.buttons === 1; },
|
|
9320
|
+
right(event) { return event.buttons === 2; },
|
|
9321
|
+
middle(event) { return event.buttons === 4; }
|
|
9322
|
+
};
|
|
9323
|
+
|
|
9324
|
+
class UIEvent extends Event {
|
|
9325
|
+
get spaceKey() { return Keyboard.isHoldSpaceKey(); }
|
|
9326
|
+
get left() { return PointerButton.left(this); }
|
|
9327
|
+
get right() { return PointerButton.right(this); }
|
|
9328
|
+
get middle() { return PointerButton.middle(this); }
|
|
9329
|
+
constructor(params) {
|
|
9330
|
+
super(params.type);
|
|
9331
|
+
this.bubbles = true;
|
|
9332
|
+
Object.assign(this, params);
|
|
9333
|
+
}
|
|
9334
|
+
getBoxPoint(relative) {
|
|
9335
|
+
return (relative || this.current).getBoxPoint(this);
|
|
9336
|
+
}
|
|
9337
|
+
getInnerPoint(relative) {
|
|
9338
|
+
return (relative || this.current).getInnerPoint(this);
|
|
9339
|
+
}
|
|
9340
|
+
getLocalPoint(relative) {
|
|
9341
|
+
return (relative || this.current).getLocalPoint(this);
|
|
9342
|
+
}
|
|
9343
|
+
getPagePoint() {
|
|
9344
|
+
return this.current.getPagePoint(this);
|
|
9345
|
+
}
|
|
9346
|
+
getInner(relative) { return this.getInnerPoint(relative); }
|
|
9347
|
+
getLocal(relative) { return this.getLocalPoint(relative); }
|
|
9348
|
+
getPage() { return this.getPagePoint(); }
|
|
9349
|
+
static changeName(oldName, newName) {
|
|
9350
|
+
EventCreator.changeName(oldName, newName);
|
|
9351
|
+
}
|
|
9352
|
+
}
|
|
9353
|
+
|
|
9354
|
+
let PointerEvent$1 = class PointerEvent extends UIEvent {
|
|
9355
|
+
};
|
|
9356
|
+
PointerEvent$1.POINTER = 'pointer';
|
|
9357
|
+
PointerEvent$1.BEFORE_DOWN = 'pointer.before_down';
|
|
9358
|
+
PointerEvent$1.BEFORE_MOVE = 'pointer.before_move';
|
|
9359
|
+
PointerEvent$1.BEFORE_UP = 'pointer.before_up';
|
|
9360
|
+
PointerEvent$1.DOWN = 'pointer.down';
|
|
9361
|
+
PointerEvent$1.MOVE = 'pointer.move';
|
|
9362
|
+
PointerEvent$1.UP = 'pointer.up';
|
|
9363
|
+
PointerEvent$1.OVER = 'pointer.over';
|
|
9364
|
+
PointerEvent$1.OUT = 'pointer.out';
|
|
9365
|
+
PointerEvent$1.ENTER = 'pointer.enter';
|
|
9366
|
+
PointerEvent$1.LEAVE = 'pointer.leave';
|
|
9367
|
+
PointerEvent$1.TAP = 'tap';
|
|
9368
|
+
PointerEvent$1.DOUBLE_TAP = 'double_tap';
|
|
9369
|
+
PointerEvent$1.CLICK = 'click';
|
|
9370
|
+
PointerEvent$1.DOUBLE_CLICK = 'double_click';
|
|
9371
|
+
PointerEvent$1.LONG_PRESS = 'long_press';
|
|
9372
|
+
PointerEvent$1.LONG_TAP = 'long_tap';
|
|
9373
|
+
PointerEvent$1.MENU = 'pointer.menu';
|
|
9374
|
+
PointerEvent$1.MENU_TAP = 'pointer.menu_tap';
|
|
9375
|
+
PointerEvent$1 = __decorate([
|
|
9376
|
+
registerUIEvent()
|
|
9377
|
+
], PointerEvent$1);
|
|
9378
|
+
|
|
9379
|
+
const tempMove = {};
|
|
9380
|
+
let DragEvent$1 = class DragEvent extends PointerEvent$1 {
|
|
9381
|
+
static setList(data) {
|
|
9382
|
+
this.list = data instanceof LeafList ? data : new LeafList(data);
|
|
9383
|
+
}
|
|
9384
|
+
static setData(data) {
|
|
9385
|
+
this.data = data;
|
|
9386
|
+
}
|
|
9387
|
+
static getValidMove(leaf, start, total) {
|
|
9388
|
+
const { draggable, dragBounds } = leaf, move = leaf.getLocalPoint(total, null, true);
|
|
9389
|
+
PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
|
|
9390
|
+
if (dragBounds)
|
|
9391
|
+
this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
|
|
9392
|
+
if (draggable === 'x')
|
|
9393
|
+
move.y = 0;
|
|
9394
|
+
if (draggable === 'y')
|
|
9395
|
+
move.x = 0;
|
|
9396
|
+
return move;
|
|
9397
|
+
}
|
|
9398
|
+
static getMoveInDragBounds(childBox, dragBounds, move, change) {
|
|
9399
|
+
const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
|
|
9400
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9401
|
+
if (!change)
|
|
9402
|
+
move = Object.assign({}, move);
|
|
9403
|
+
if (BoundsHelper.includes(childBox, dragBounds)) {
|
|
9404
|
+
if (x > dragBounds.x)
|
|
9405
|
+
move.x += dragBounds.x - x;
|
|
9406
|
+
else if (right < boundsRight)
|
|
9407
|
+
move.x += boundsRight - right;
|
|
9408
|
+
if (y > dragBounds.y)
|
|
9409
|
+
move.y += dragBounds.y - y;
|
|
9410
|
+
else if (bottom < boundsBottom)
|
|
9411
|
+
move.y += boundsBottom - bottom;
|
|
9412
|
+
}
|
|
9413
|
+
else {
|
|
9414
|
+
if (x < dragBounds.x)
|
|
9415
|
+
move.x += dragBounds.x - x;
|
|
9416
|
+
else if (right > boundsRight)
|
|
9417
|
+
move.x += boundsRight - right;
|
|
9418
|
+
if (y < dragBounds.y)
|
|
9419
|
+
move.y += dragBounds.y - y;
|
|
9420
|
+
else if (bottom > boundsBottom)
|
|
9421
|
+
move.y += boundsBottom - bottom;
|
|
9422
|
+
}
|
|
9423
|
+
return move;
|
|
9424
|
+
}
|
|
9425
|
+
getPageMove(total) {
|
|
9426
|
+
this.assignMove(total);
|
|
9427
|
+
return this.current.getPagePoint(tempMove, null, true);
|
|
9428
|
+
}
|
|
9429
|
+
getInnerMove(relative, total) {
|
|
9430
|
+
if (!relative)
|
|
9431
|
+
relative = this.current;
|
|
9432
|
+
this.assignMove(total);
|
|
9433
|
+
return relative.getInnerPoint(tempMove, null, true);
|
|
9434
|
+
}
|
|
9435
|
+
getLocalMove(relative, total) {
|
|
9436
|
+
if (!relative)
|
|
9437
|
+
relative = this.current;
|
|
9438
|
+
this.assignMove(total);
|
|
9439
|
+
return relative.getLocalPoint(tempMove, null, true);
|
|
9440
|
+
}
|
|
9441
|
+
getPageTotal() {
|
|
9442
|
+
return this.getPageMove(true);
|
|
9443
|
+
}
|
|
9444
|
+
getInnerTotal(relative) {
|
|
9445
|
+
return this.getInnerMove(relative, true);
|
|
9446
|
+
}
|
|
9447
|
+
getLocalTotal(relative) {
|
|
9448
|
+
return this.getLocalMove(relative, true);
|
|
9449
|
+
}
|
|
9450
|
+
getPageBounds() {
|
|
9451
|
+
const total = this.getPageTotal(), start = this.getPagePoint(), bounds = {};
|
|
9452
|
+
BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
|
|
9453
|
+
BoundsHelper.unsign(bounds);
|
|
9454
|
+
return bounds;
|
|
9455
|
+
}
|
|
9456
|
+
assignMove(total) {
|
|
9457
|
+
tempMove.x = total ? this.totalX : this.moveX;
|
|
9458
|
+
tempMove.y = total ? this.totalY : this.moveY;
|
|
9459
|
+
}
|
|
9460
|
+
};
|
|
9461
|
+
DragEvent$1.BEFORE_DRAG = 'drag.before_drag';
|
|
9462
|
+
DragEvent$1.START = 'drag.start';
|
|
9463
|
+
DragEvent$1.DRAG = 'drag';
|
|
9464
|
+
DragEvent$1.END = 'drag.end';
|
|
9465
|
+
DragEvent$1.OVER = 'drag.over';
|
|
9466
|
+
DragEvent$1.OUT = 'drag.out';
|
|
9467
|
+
DragEvent$1.ENTER = 'drag.enter';
|
|
9468
|
+
DragEvent$1.LEAVE = 'drag.leave';
|
|
9469
|
+
DragEvent$1 = __decorate([
|
|
9470
|
+
registerUIEvent()
|
|
9471
|
+
], DragEvent$1);
|
|
9472
|
+
|
|
9473
|
+
let DropEvent = class DropEvent extends PointerEvent$1 {
|
|
9474
|
+
static setList(data) {
|
|
9475
|
+
DragEvent$1.setList(data);
|
|
9476
|
+
}
|
|
9477
|
+
static setData(data) {
|
|
9478
|
+
DragEvent$1.setData(data);
|
|
9479
|
+
}
|
|
9480
|
+
};
|
|
9481
|
+
DropEvent.DROP = 'drop';
|
|
9482
|
+
DropEvent = __decorate([
|
|
9483
|
+
registerUIEvent()
|
|
9484
|
+
], DropEvent);
|
|
9485
|
+
|
|
9486
|
+
let MoveEvent = class MoveEvent extends DragEvent$1 {
|
|
9487
|
+
};
|
|
9488
|
+
MoveEvent.BEFORE_MOVE = 'move.before_move';
|
|
9489
|
+
MoveEvent.START = 'move.start';
|
|
9490
|
+
MoveEvent.MOVE = 'move';
|
|
9491
|
+
MoveEvent.END = 'move.end';
|
|
9492
|
+
MoveEvent = __decorate([
|
|
9493
|
+
registerUIEvent()
|
|
9494
|
+
], MoveEvent);
|
|
9495
|
+
|
|
9496
|
+
let RotateEvent = class RotateEvent extends PointerEvent$1 {
|
|
9497
|
+
};
|
|
9498
|
+
RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
|
|
9499
|
+
RotateEvent.START = 'rotate.start';
|
|
9500
|
+
RotateEvent.ROTATE = 'rotate';
|
|
9501
|
+
RotateEvent.END = 'rotate.end';
|
|
9502
|
+
RotateEvent = __decorate([
|
|
9503
|
+
registerUIEvent()
|
|
9504
|
+
], RotateEvent);
|
|
9505
|
+
|
|
9506
|
+
let SwipeEvent = class SwipeEvent extends DragEvent$1 {
|
|
9507
|
+
};
|
|
9508
|
+
SwipeEvent.SWIPE = 'swipe';
|
|
9509
|
+
SwipeEvent.LEFT = 'swipe.left';
|
|
9510
|
+
SwipeEvent.RIGHT = 'swipe.right';
|
|
9511
|
+
SwipeEvent.UP = 'swipe.up';
|
|
9512
|
+
SwipeEvent.DOWN = 'swipe.down';
|
|
9513
|
+
SwipeEvent = __decorate([
|
|
9514
|
+
registerUIEvent()
|
|
9515
|
+
], SwipeEvent);
|
|
9516
|
+
|
|
9517
|
+
let ZoomEvent = class ZoomEvent extends PointerEvent$1 {
|
|
9518
|
+
};
|
|
9519
|
+
ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
|
|
9520
|
+
ZoomEvent.START = 'zoom.start';
|
|
9521
|
+
ZoomEvent.ZOOM = 'zoom';
|
|
9522
|
+
ZoomEvent.END = 'zoom.end';
|
|
9523
|
+
ZoomEvent = __decorate([
|
|
9524
|
+
registerUIEvent()
|
|
9525
|
+
], ZoomEvent);
|
|
9526
|
+
|
|
9527
|
+
let KeyEvent = class KeyEvent extends UIEvent {
|
|
9528
|
+
};
|
|
9529
|
+
KeyEvent.DOWN = 'key.down';
|
|
9530
|
+
KeyEvent.HOLD = 'key.hold';
|
|
9531
|
+
KeyEvent.UP = 'key.up';
|
|
9532
|
+
KeyEvent = __decorate([
|
|
9533
|
+
registerUIEvent()
|
|
9534
|
+
], KeyEvent);
|
|
9535
|
+
|
|
9536
|
+
new LeafList();
|
|
9537
|
+
|
|
9538
|
+
Debug.get('emit');
|
|
9539
|
+
|
|
9540
|
+
const { toInnerRadiusPointOf, copy: copy$2, setRadius } = PointHelper;
|
|
9541
|
+
const inner = {};
|
|
9542
|
+
const leaf = Leaf.prototype;
|
|
9543
|
+
leaf.__hitWorld = function (point) {
|
|
9544
|
+
const data = this.__;
|
|
9545
|
+
if (!data.hitSelf)
|
|
9546
|
+
return false;
|
|
9547
|
+
const world = this.__world, layout = this.__layout;
|
|
9548
|
+
const isSmall = world.width < 10 && world.height < 10;
|
|
9549
|
+
if (data.hitRadius) {
|
|
9550
|
+
copy$2(inner, point), point = inner;
|
|
9551
|
+
setRadius(point, data.hitRadius);
|
|
9552
|
+
}
|
|
9553
|
+
toInnerRadiusPointOf(point, world, inner);
|
|
9554
|
+
if (data.hitBox || isSmall) {
|
|
9555
|
+
if (BoundsHelper.hitRadiusPoint(layout.boxBounds, inner))
|
|
9556
|
+
return true;
|
|
9557
|
+
if (isSmall)
|
|
9558
|
+
return false;
|
|
9559
|
+
}
|
|
9560
|
+
if (layout.hitCanvasChanged || !this.__hitCanvas) {
|
|
9561
|
+
this.__updateHitCanvas();
|
|
9562
|
+
if (!layout.boundsChanged)
|
|
9563
|
+
layout.hitCanvasChanged = false;
|
|
9564
|
+
}
|
|
9565
|
+
return this.__hit(inner);
|
|
9566
|
+
};
|
|
9567
|
+
leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
|
|
9568
|
+
leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
|
|
9569
|
+
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); };
|
|
9570
|
+
leaf.__drawHitPath = function (canvas) { if (canvas)
|
|
9571
|
+
this.__drawRenderPath(canvas); };
|
|
9572
|
+
|
|
9573
|
+
const matrix = new Matrix();
|
|
9574
|
+
const ui$1 = UI.prototype;
|
|
9575
|
+
ui$1.__updateHitCanvas = function () {
|
|
9576
|
+
if (this.__box)
|
|
9577
|
+
this.__box.__updateHitCanvas();
|
|
9578
|
+
const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
|
|
9579
|
+
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
9580
|
+
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
9581
|
+
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
9582
|
+
if (!this.__hitCanvas)
|
|
9583
|
+
this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
|
|
9584
|
+
const h = this.__hitCanvas;
|
|
9585
|
+
if (isHitPixel) {
|
|
9586
|
+
const { renderBounds } = this.__layout;
|
|
9587
|
+
const size = Platform.image.hitCanvasSize;
|
|
9588
|
+
const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds).a;
|
|
9589
|
+
const { x, y, width, height } = tempBounds$1.set(renderBounds).scale(scale);
|
|
9590
|
+
h.resize({ width, height, pixelRatio: 1 });
|
|
9591
|
+
h.clear();
|
|
9592
|
+
ImageManager.patternLocked = true;
|
|
9593
|
+
this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y) }, !isHitPixelFill, !isHitPixelStroke);
|
|
9594
|
+
ImageManager.patternLocked = false;
|
|
9595
|
+
h.resetTransform();
|
|
9596
|
+
data.__isHitPixel = true;
|
|
9597
|
+
}
|
|
9598
|
+
else {
|
|
9599
|
+
data.__isHitPixel && (data.__isHitPixel = false);
|
|
9600
|
+
}
|
|
9601
|
+
this.__drawHitPath(h);
|
|
9602
|
+
h.setStrokeOptions(data);
|
|
9603
|
+
};
|
|
9604
|
+
ui$1.__hit = function (inner) {
|
|
9605
|
+
if (this.__box && this.__box.__hit(inner))
|
|
9606
|
+
return true;
|
|
9607
|
+
const data = this.__;
|
|
9608
|
+
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
9609
|
+
return true;
|
|
9610
|
+
const { hitFill } = data;
|
|
9611
|
+
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
9612
|
+
if (needHitFillPath && this.__hitFill(inner))
|
|
9613
|
+
return true;
|
|
9614
|
+
const { hitStroke, __strokeWidth } = data;
|
|
9615
|
+
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
9616
|
+
if (!needHitFillPath && !needHitStrokePath)
|
|
9617
|
+
return false;
|
|
9618
|
+
const radiusWidth = inner.radiusX * 2;
|
|
9619
|
+
let hitWidth = radiusWidth;
|
|
9620
|
+
if (needHitStrokePath) {
|
|
9621
|
+
switch (data.strokeAlign) {
|
|
9622
|
+
case 'inside':
|
|
9623
|
+
hitWidth += __strokeWidth * 2;
|
|
9624
|
+
if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
9625
|
+
return true;
|
|
9626
|
+
hitWidth = radiusWidth;
|
|
9627
|
+
break;
|
|
9628
|
+
case 'center':
|
|
9629
|
+
hitWidth += __strokeWidth;
|
|
9630
|
+
break;
|
|
9631
|
+
case 'outside':
|
|
9632
|
+
hitWidth += __strokeWidth * 2;
|
|
9633
|
+
if (!needHitFillPath) {
|
|
9634
|
+
if (!this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
9635
|
+
return true;
|
|
9636
|
+
hitWidth = radiusWidth;
|
|
9637
|
+
}
|
|
9638
|
+
break;
|
|
9639
|
+
}
|
|
9640
|
+
}
|
|
9641
|
+
return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
|
|
9642
|
+
};
|
|
9643
|
+
|
|
9644
|
+
const ui = UI.prototype, rect = Rect.prototype, box$1 = Box.prototype;
|
|
9645
|
+
rect.__updateHitCanvas = box$1.__updateHitCanvas = function () {
|
|
9646
|
+
if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
|
|
9647
|
+
ui.__updateHitCanvas.call(this);
|
|
9648
|
+
else if (this.__hitCanvas)
|
|
9649
|
+
this.__hitCanvas = null;
|
|
9650
|
+
};
|
|
9651
|
+
rect.__hitFill = box$1.__hitFill = function (inner) {
|
|
9652
|
+
return this.__hitCanvas ? ui.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
|
|
9653
|
+
};
|
|
9654
|
+
|
|
9655
|
+
Text.prototype.__drawHitPath = function (canvas) {
|
|
9656
|
+
const { __lineHeight, fontSize, __baseLine, __letterSpacing, __textDrawData: data } = this.__;
|
|
9657
|
+
canvas.beginPath();
|
|
9658
|
+
if (__letterSpacing < 0)
|
|
9659
|
+
this.__drawPathByBox(canvas);
|
|
9660
|
+
else
|
|
9661
|
+
data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
|
|
9662
|
+
};
|
|
9663
|
+
|
|
9664
|
+
function getSelector(ui) {
|
|
9665
|
+
return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
|
|
9666
|
+
}
|
|
9667
|
+
Group.prototype.pick = function (hitPoint, options) {
|
|
9668
|
+
options || (options = emptyData);
|
|
9669
|
+
this.updateLayout();
|
|
9670
|
+
return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
|
|
9671
|
+
};
|
|
9672
|
+
|
|
9673
|
+
const canvas = LeaferCanvasBase.prototype;
|
|
9674
|
+
canvas.hitFill = function (point, fillRule) {
|
|
9675
|
+
return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
|
|
9676
|
+
};
|
|
9677
|
+
canvas.hitStroke = function (point, strokeWidth) {
|
|
9678
|
+
this.strokeWidth = strokeWidth;
|
|
9679
|
+
return this.context.isPointInStroke(point.x, point.y);
|
|
9680
|
+
};
|
|
9681
|
+
canvas.hitPixel = function (radiusPoint, offset, scale = 1) {
|
|
9682
|
+
let { x, y, radiusX, radiusY } = radiusPoint;
|
|
9683
|
+
if (offset)
|
|
9684
|
+
x -= offset.x, y -= offset.y;
|
|
9685
|
+
tempBounds$1.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
|
|
9686
|
+
const { data } = this.context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width || 1, tempBounds$1.height || 1);
|
|
9687
|
+
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
9688
|
+
if (data[i + 3] > 0)
|
|
9689
|
+
return true;
|
|
9690
|
+
}
|
|
9691
|
+
return data[3] > 0;
|
|
9692
|
+
};
|
|
9017
9693
|
|
|
9018
9694
|
function strokeText(stroke, ui, canvas) {
|
|
9019
|
-
|
|
9020
|
-
const isStrokes = typeof stroke !== 'string';
|
|
9021
|
-
switch (strokeAlign) {
|
|
9695
|
+
switch (ui.__.strokeAlign) {
|
|
9022
9696
|
case 'center':
|
|
9023
|
-
|
|
9024
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
9697
|
+
drawCenter$1(stroke, 1, ui, canvas);
|
|
9025
9698
|
break;
|
|
9026
9699
|
case 'inside':
|
|
9027
|
-
|
|
9700
|
+
drawAlign(stroke, 'inside', ui, canvas);
|
|
9028
9701
|
break;
|
|
9029
9702
|
case 'outside':
|
|
9030
|
-
|
|
9703
|
+
ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, 'outside', ui, canvas);
|
|
9031
9704
|
break;
|
|
9032
9705
|
}
|
|
9033
9706
|
}
|
|
9034
|
-
function
|
|
9035
|
-
const
|
|
9707
|
+
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
9708
|
+
const data = ui.__;
|
|
9709
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
|
|
9710
|
+
data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
9711
|
+
}
|
|
9712
|
+
function drawAlign(stroke, align, ui, canvas) {
|
|
9036
9713
|
const out = canvas.getSameCanvas(true, true);
|
|
9037
|
-
out.
|
|
9038
|
-
|
|
9039
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
|
|
9714
|
+
out.font = ui.__.__font;
|
|
9715
|
+
drawCenter$1(stroke, 2, ui, out);
|
|
9040
9716
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
9041
9717
|
fillText(ui, out);
|
|
9042
9718
|
out.blendMode = 'normal';
|
|
9043
|
-
if (ui.__worldFlipped)
|
|
9719
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
9044
9720
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9045
9721
|
else
|
|
9046
9722
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
@@ -9082,90 +9758,60 @@ function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
|
9082
9758
|
}
|
|
9083
9759
|
|
|
9084
9760
|
function stroke(stroke, ui, canvas) {
|
|
9085
|
-
const
|
|
9086
|
-
|
|
9087
|
-
if (!__strokeWidth)
|
|
9761
|
+
const data = ui.__;
|
|
9762
|
+
if (!data.__strokeWidth)
|
|
9088
9763
|
return;
|
|
9089
|
-
if (__font) {
|
|
9764
|
+
if (data.__font) {
|
|
9090
9765
|
strokeText(stroke, ui, canvas);
|
|
9091
9766
|
}
|
|
9092
9767
|
else {
|
|
9093
|
-
switch (strokeAlign) {
|
|
9768
|
+
switch (data.strokeAlign) {
|
|
9094
9769
|
case 'center':
|
|
9095
|
-
|
|
9096
|
-
canvas.stroke();
|
|
9097
|
-
if (options.__useArrow)
|
|
9098
|
-
strokeArrow(ui, canvas);
|
|
9770
|
+
drawCenter(stroke, 1, ui, canvas);
|
|
9099
9771
|
break;
|
|
9100
9772
|
case 'inside':
|
|
9101
|
-
canvas
|
|
9102
|
-
canvas.setStroke(stroke, __strokeWidth * 2, options);
|
|
9103
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
9104
|
-
canvas.stroke();
|
|
9105
|
-
canvas.restore();
|
|
9773
|
+
drawInside(stroke, ui, canvas);
|
|
9106
9774
|
break;
|
|
9107
9775
|
case 'outside':
|
|
9108
|
-
|
|
9109
|
-
out.setStroke(stroke, __strokeWidth * 2, options);
|
|
9110
|
-
ui.__drawRenderPath(out);
|
|
9111
|
-
out.stroke();
|
|
9112
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
9113
|
-
out.clearWorld(ui.__layout.renderBounds);
|
|
9114
|
-
if (ui.__worldFlipped)
|
|
9115
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9116
|
-
else
|
|
9117
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
9118
|
-
out.recycle(ui.__nowWorld);
|
|
9776
|
+
drawOutside(stroke, ui, canvas);
|
|
9119
9777
|
break;
|
|
9120
9778
|
}
|
|
9121
9779
|
}
|
|
9122
9780
|
}
|
|
9123
9781
|
function strokes(strokes, ui, canvas) {
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9782
|
+
stroke(strokes, ui, canvas);
|
|
9783
|
+
}
|
|
9784
|
+
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
9785
|
+
const data = ui.__;
|
|
9786
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
9787
|
+
data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
|
|
9788
|
+
if (data.__useArrow)
|
|
9789
|
+
Paint.strokeArrow(stroke, ui, canvas);
|
|
9790
|
+
}
|
|
9791
|
+
function drawInside(stroke, ui, canvas) {
|
|
9792
|
+
const data = ui.__;
|
|
9793
|
+
canvas.save();
|
|
9794
|
+
data.windingRule ? canvas.clip(data.windingRule) : canvas.clip();
|
|
9795
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
9796
|
+
canvas.restore();
|
|
9797
|
+
}
|
|
9798
|
+
function drawOutside(stroke, ui, canvas) {
|
|
9799
|
+
const data = ui.__;
|
|
9800
|
+
if (data.__fillAfterStroke) {
|
|
9801
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
9130
9802
|
}
|
|
9131
9803
|
else {
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
drawStrokesStyle(strokes, false, ui, canvas);
|
|
9144
|
-
canvas.restore();
|
|
9145
|
-
break;
|
|
9146
|
-
case 'outside':
|
|
9147
|
-
const { renderBounds } = ui.__layout;
|
|
9148
|
-
const out = canvas.getSameCanvas(true, true);
|
|
9149
|
-
ui.__drawRenderPath(out);
|
|
9150
|
-
out.setStroke(undefined, __strokeWidth * 2, options);
|
|
9151
|
-
drawStrokesStyle(strokes, false, ui, out);
|
|
9152
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
9153
|
-
out.clearWorld(renderBounds);
|
|
9154
|
-
if (ui.__worldFlipped)
|
|
9155
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9156
|
-
else
|
|
9157
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
9158
|
-
out.recycle(ui.__nowWorld);
|
|
9159
|
-
break;
|
|
9160
|
-
}
|
|
9161
|
-
}
|
|
9162
|
-
}
|
|
9163
|
-
function strokeArrow(ui, canvas) {
|
|
9164
|
-
if (ui.__.dashPattern) {
|
|
9165
|
-
canvas.beginPath();
|
|
9166
|
-
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
9167
|
-
canvas.dashPattern = null;
|
|
9168
|
-
canvas.stroke();
|
|
9804
|
+
const { renderBounds } = ui.__layout;
|
|
9805
|
+
const out = canvas.getSameCanvas(true, true);
|
|
9806
|
+
ui.__drawRenderPath(out);
|
|
9807
|
+
drawCenter(stroke, 2, ui, out);
|
|
9808
|
+
data.windingRule ? out.clip(data.windingRule) : out.clip();
|
|
9809
|
+
out.clearWorld(renderBounds);
|
|
9810
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
9811
|
+
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9812
|
+
else
|
|
9813
|
+
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
9814
|
+
out.recycle(ui.__nowWorld);
|
|
9169
9815
|
}
|
|
9170
9816
|
}
|
|
9171
9817
|
|
|
@@ -9212,9 +9858,10 @@ function shape(ui, current, options) {
|
|
|
9212
9858
|
}
|
|
9213
9859
|
|
|
9214
9860
|
let recycleMap;
|
|
9861
|
+
const { stintSet } = DataHelper, { hasTransparent: hasTransparent$1 } = ColorConvert;
|
|
9215
9862
|
function compute(attrName, ui) {
|
|
9216
9863
|
const data = ui.__, leafPaints = [];
|
|
9217
|
-
let paints = data.__input[attrName],
|
|
9864
|
+
let paints = data.__input[attrName], isAlphaPixel, isTransparent;
|
|
9218
9865
|
if (!(paints instanceof Array))
|
|
9219
9866
|
paints = [paints];
|
|
9220
9867
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
@@ -9224,35 +9871,62 @@ function compute(attrName, ui) {
|
|
|
9224
9871
|
leafPaints.push(item);
|
|
9225
9872
|
}
|
|
9226
9873
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
9227
|
-
if (leafPaints.length
|
|
9228
|
-
|
|
9229
|
-
|
|
9874
|
+
if (leafPaints.length) {
|
|
9875
|
+
if (leafPaints.every(item => item.isTransparent)) {
|
|
9876
|
+
if (leafPaints.some(item => item.image))
|
|
9877
|
+
isAlphaPixel = true;
|
|
9878
|
+
isTransparent = true;
|
|
9879
|
+
}
|
|
9880
|
+
}
|
|
9881
|
+
if (attrName === 'fill') {
|
|
9882
|
+
stintSet(data, '__isAlphaPixelFill', isAlphaPixel);
|
|
9883
|
+
stintSet(data, '__isTransparentFill', isTransparent);
|
|
9884
|
+
}
|
|
9885
|
+
else {
|
|
9886
|
+
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
9887
|
+
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
9888
|
+
}
|
|
9230
9889
|
}
|
|
9231
9890
|
function getLeafPaint(attrName, paint, ui) {
|
|
9232
9891
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
|
9233
9892
|
return undefined;
|
|
9893
|
+
let data;
|
|
9234
9894
|
const { boxBounds } = ui.__layout;
|
|
9235
9895
|
switch (paint.type) {
|
|
9236
|
-
case 'solid':
|
|
9237
|
-
let { type, blendMode, color, opacity } = paint;
|
|
9238
|
-
return { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
9239
9896
|
case 'image':
|
|
9240
|
-
|
|
9897
|
+
data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
9898
|
+
break;
|
|
9241
9899
|
case 'linear':
|
|
9242
|
-
|
|
9900
|
+
data = PaintGradient.linearGradient(paint, boxBounds);
|
|
9901
|
+
break;
|
|
9243
9902
|
case 'radial':
|
|
9244
|
-
|
|
9903
|
+
data = PaintGradient.radialGradient(paint, boxBounds);
|
|
9904
|
+
break;
|
|
9245
9905
|
case 'angular':
|
|
9246
|
-
|
|
9906
|
+
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
9907
|
+
break;
|
|
9908
|
+
case 'solid':
|
|
9909
|
+
const { type, blendMode, color, opacity } = paint;
|
|
9910
|
+
data = { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
9911
|
+
break;
|
|
9247
9912
|
default:
|
|
9248
|
-
|
|
9913
|
+
if (paint.r !== undefined)
|
|
9914
|
+
data = { type: 'solid', style: ColorConvert.string(paint) };
|
|
9915
|
+
}
|
|
9916
|
+
if (data) {
|
|
9917
|
+
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
9918
|
+
data.isTransparent = true;
|
|
9919
|
+
if (paint.blendMode)
|
|
9920
|
+
data.blendMode = paint.blendMode;
|
|
9249
9921
|
}
|
|
9922
|
+
return data;
|
|
9250
9923
|
}
|
|
9251
9924
|
|
|
9252
9925
|
const PaintModule = {
|
|
9253
9926
|
compute,
|
|
9254
9927
|
fill,
|
|
9255
9928
|
fills,
|
|
9929
|
+
fillPathOrText,
|
|
9256
9930
|
fillText,
|
|
9257
9931
|
stroke,
|
|
9258
9932
|
strokes,
|
|
@@ -9311,12 +9985,10 @@ function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, al
|
|
|
9311
9985
|
|
|
9312
9986
|
const { get: get$2, translate } = MatrixHelper;
|
|
9313
9987
|
const tempBox = new Bounds();
|
|
9314
|
-
const tempPoint = {};
|
|
9315
9988
|
const tempScaleData = {};
|
|
9989
|
+
const tempImage = {};
|
|
9316
9990
|
function createData(leafPaint, image, paint, box) {
|
|
9317
|
-
const {
|
|
9318
|
-
if (blendMode)
|
|
9319
|
-
leafPaint.blendMode = blendMode;
|
|
9991
|
+
const { changeful, sync } = paint;
|
|
9320
9992
|
if (changeful)
|
|
9321
9993
|
leafPaint.changeful = changeful;
|
|
9322
9994
|
if (sync)
|
|
@@ -9324,38 +9996,38 @@ function createData(leafPaint, image, paint, box) {
|
|
|
9324
9996
|
leafPaint.data = getPatternData(paint, box, image);
|
|
9325
9997
|
}
|
|
9326
9998
|
function getPatternData(paint, box, image) {
|
|
9327
|
-
let { width, height } = image;
|
|
9328
9999
|
if (paint.padding)
|
|
9329
10000
|
box = tempBox.set(box).shrink(paint.padding);
|
|
9330
10001
|
if (paint.mode === 'strench')
|
|
9331
10002
|
paint.mode = 'stretch';
|
|
10003
|
+
let { width, height } = image;
|
|
9332
10004
|
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
9333
10005
|
const sameBox = box.width === width && box.height === height;
|
|
9334
10006
|
const data = { mode };
|
|
9335
10007
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
9336
|
-
|
|
9337
|
-
let
|
|
10008
|
+
BoundsHelper.set(tempImage, 0, 0, swapSize ? height : width, swapSize ? width : height);
|
|
10009
|
+
let scaleX, scaleY;
|
|
9338
10010
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
9339
10011
|
if (!sameBox || rotation) {
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
10012
|
+
scaleX = scaleY = BoundsHelper.getFitScale(box, tempImage, mode !== 'fit');
|
|
10013
|
+
BoundsHelper.put(box, image, align, scaleX, false, tempImage);
|
|
10014
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
9343
10015
|
}
|
|
9344
10016
|
}
|
|
9345
|
-
else
|
|
9346
|
-
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
10017
|
+
else {
|
|
10018
|
+
if (scale || size) {
|
|
10019
|
+
MathHelper.getScaleData(scale, size, image, tempScaleData);
|
|
10020
|
+
scaleX = tempScaleData.scaleX;
|
|
10021
|
+
scaleY = tempScaleData.scaleY;
|
|
10022
|
+
}
|
|
10023
|
+
if (align) {
|
|
10024
|
+
if (scaleX)
|
|
10025
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
10026
|
+
AlignHelper.toPoint(align, tempImage, box, tempImage, true, true);
|
|
10027
|
+
}
|
|
9356
10028
|
}
|
|
9357
10029
|
if (offset)
|
|
9358
|
-
|
|
10030
|
+
PointHelper.move(tempImage, offset);
|
|
9359
10031
|
switch (mode) {
|
|
9360
10032
|
case 'stretch':
|
|
9361
10033
|
if (!sameBox)
|
|
@@ -9363,12 +10035,12 @@ function getPatternData(paint, box, image) {
|
|
|
9363
10035
|
break;
|
|
9364
10036
|
case 'normal':
|
|
9365
10037
|
case 'clip':
|
|
9366
|
-
if (x || y || scaleX || rotation)
|
|
9367
|
-
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
10038
|
+
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
10039
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9368
10040
|
break;
|
|
9369
10041
|
case 'repeat':
|
|
9370
10042
|
if (!sameBox || scaleX || rotation)
|
|
9371
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
10043
|
+
repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, align);
|
|
9372
10044
|
if (!repeat)
|
|
9373
10045
|
data.repeat = 'repeat';
|
|
9374
10046
|
break;
|
|
@@ -9376,7 +10048,7 @@ function getPatternData(paint, box, image) {
|
|
|
9376
10048
|
case 'cover':
|
|
9377
10049
|
default:
|
|
9378
10050
|
if (scaleX)
|
|
9379
|
-
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
10051
|
+
fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9380
10052
|
}
|
|
9381
10053
|
if (!data.transform) {
|
|
9382
10054
|
if (box.x || box.y) {
|
|
@@ -9409,6 +10081,8 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
9409
10081
|
}
|
|
9410
10082
|
else {
|
|
9411
10083
|
leafPaint = { type: paint.type, image };
|
|
10084
|
+
if (image.hasAlphaPixel)
|
|
10085
|
+
leafPaint.isTransparent = true;
|
|
9412
10086
|
cache = image.use > 1 ? { leafPaint, paint, boxBounds: box.set(boxBounds) } : null;
|
|
9413
10087
|
}
|
|
9414
10088
|
if (firstUse || image.loading)
|
|
@@ -9433,7 +10107,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
9433
10107
|
ignoreRender(ui, false);
|
|
9434
10108
|
if (!ui.destroyed) {
|
|
9435
10109
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
9436
|
-
if (image.
|
|
10110
|
+
if (image.hasAlphaPixel)
|
|
9437
10111
|
ui.__layout.hitCanvasChanged = true;
|
|
9438
10112
|
ui.forceUpdate('surface');
|
|
9439
10113
|
}
|
|
@@ -9445,6 +10119,17 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
9445
10119
|
onLoadError(ui, event, error);
|
|
9446
10120
|
leafPaint.loadId = null;
|
|
9447
10121
|
});
|
|
10122
|
+
if (ui.placeholderColor) {
|
|
10123
|
+
if (!ui.placeholderDelay)
|
|
10124
|
+
image.isPlacehold = true;
|
|
10125
|
+
else
|
|
10126
|
+
setTimeout(() => {
|
|
10127
|
+
if (!image.ready) {
|
|
10128
|
+
image.isPlacehold = true;
|
|
10129
|
+
ui.forceUpdate('surface');
|
|
10130
|
+
}
|
|
10131
|
+
}, ui.placeholderDelay);
|
|
10132
|
+
}
|
|
9448
10133
|
}
|
|
9449
10134
|
return leafPaint;
|
|
9450
10135
|
}
|
|
@@ -9650,32 +10335,33 @@ const PaintImageModule = {
|
|
|
9650
10335
|
repeatMode
|
|
9651
10336
|
};
|
|
9652
10337
|
|
|
9653
|
-
const { toPoint: toPoint$2 } = AroundHelper;
|
|
10338
|
+
const { toPoint: toPoint$2 } = AroundHelper, { hasTransparent } = ColorConvert;
|
|
9654
10339
|
const realFrom$2 = {};
|
|
9655
10340
|
const realTo$2 = {};
|
|
9656
10341
|
function linearGradient(paint, box) {
|
|
9657
|
-
let { from, to, type,
|
|
10342
|
+
let { from, to, type, opacity } = paint;
|
|
9658
10343
|
toPoint$2(from || 'top', box, realFrom$2);
|
|
9659
10344
|
toPoint$2(to || 'bottom', box, realTo$2);
|
|
9660
10345
|
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
9661
|
-
applyStops(style, paint.stops, opacity);
|
|
9662
10346
|
const data = { type, style };
|
|
9663
|
-
|
|
9664
|
-
data.blendMode = blendMode;
|
|
10347
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9665
10348
|
return data;
|
|
9666
10349
|
}
|
|
9667
|
-
function applyStops(gradient, stops, opacity) {
|
|
10350
|
+
function applyStops(data, gradient, stops, opacity) {
|
|
9668
10351
|
if (stops) {
|
|
9669
|
-
let stop;
|
|
10352
|
+
let stop, color, offset, isTransparent;
|
|
9670
10353
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
9671
10354
|
stop = stops[i];
|
|
9672
|
-
if (typeof stop === 'string')
|
|
9673
|
-
|
|
9674
|
-
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
10355
|
+
if (typeof stop === 'string')
|
|
10356
|
+
offset = i / (len - 1), color = ColorConvert.string(stop, opacity);
|
|
10357
|
+
else
|
|
10358
|
+
offset = stop.offset, color = ColorConvert.string(stop.color, opacity);
|
|
10359
|
+
gradient.addColorStop(offset, color);
|
|
10360
|
+
if (!isTransparent && hasTransparent(color))
|
|
10361
|
+
isTransparent = true;
|
|
9678
10362
|
}
|
|
10363
|
+
if (isTransparent)
|
|
10364
|
+
data.isTransparent = true;
|
|
9679
10365
|
}
|
|
9680
10366
|
}
|
|
9681
10367
|
|
|
@@ -9685,17 +10371,15 @@ const { toPoint: toPoint$1 } = AroundHelper;
|
|
|
9685
10371
|
const realFrom$1 = {};
|
|
9686
10372
|
const realTo$1 = {};
|
|
9687
10373
|
function radialGradient(paint, box) {
|
|
9688
|
-
let { from, to, type, opacity,
|
|
10374
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
9689
10375
|
toPoint$1(from || 'center', box, realFrom$1);
|
|
9690
10376
|
toPoint$1(to || 'bottom', box, realTo$1);
|
|
9691
10377
|
const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$1(realFrom$1, realTo$1));
|
|
9692
|
-
applyStops(style, paint.stops, opacity);
|
|
9693
10378
|
const data = { type, style };
|
|
10379
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9694
10380
|
const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
|
|
9695
10381
|
if (transform)
|
|
9696
10382
|
data.transform = transform;
|
|
9697
|
-
if (blendMode)
|
|
9698
|
-
data.blendMode = blendMode;
|
|
9699
10383
|
return data;
|
|
9700
10384
|
}
|
|
9701
10385
|
function getTransform(box, from, to, stretch, rotate90) {
|
|
@@ -9721,17 +10405,15 @@ const { toPoint } = AroundHelper;
|
|
|
9721
10405
|
const realFrom = {};
|
|
9722
10406
|
const realTo = {};
|
|
9723
10407
|
function conicGradient(paint, box) {
|
|
9724
|
-
let { from, to, type, opacity,
|
|
10408
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
9725
10409
|
toPoint(from || 'center', box, realFrom);
|
|
9726
10410
|
toPoint(to || 'bottom', box, realTo);
|
|
9727
10411
|
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));
|
|
9728
|
-
applyStops(style, paint.stops, opacity);
|
|
9729
10412
|
const data = { type, style };
|
|
10413
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9730
10414
|
const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
|
|
9731
10415
|
if (transform)
|
|
9732
10416
|
data.transform = transform;
|
|
9733
|
-
if (blendMode)
|
|
9734
|
-
data.blendMode = blendMode;
|
|
9735
10417
|
return data;
|
|
9736
10418
|
}
|
|
9737
10419
|
|
|
@@ -10064,6 +10746,8 @@ function createRows(drawData, content, style) {
|
|
|
10064
10746
|
lastCharType = null;
|
|
10065
10747
|
startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
|
|
10066
10748
|
word = { data: [] }, row = { words: [] };
|
|
10749
|
+
if (__letterSpacing)
|
|
10750
|
+
content = [...content];
|
|
10067
10751
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
10068
10752
|
char = content[i];
|
|
10069
10753
|
if (char === '\n') {
|
|
@@ -10477,5 +11161,4 @@ Object.assign(Effect, EffectModule);
|
|
|
10477
11161
|
|
|
10478
11162
|
useCanvas();
|
|
10479
11163
|
|
|
10480
|
-
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$1 as 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$
|
|
10481
|
-
//# sourceMappingURL=web.module.js.map
|
|
11164
|
+
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$1 as 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 };
|