@leafer-draw/worker 1.6.2 → 1.6.4
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/worker.cjs +175 -185
- package/dist/worker.esm.js +177 -187
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +537 -411
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +536 -411
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +9 -9
package/dist/worker.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)
|
|
@@ -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;
|
|
@@ -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);
|
|
@@ -1112,8 +1196,8 @@ class Bounds {
|
|
|
1112
1196
|
BoundsHelper.move(this, x, y);
|
|
1113
1197
|
return this;
|
|
1114
1198
|
}
|
|
1115
|
-
scale(scaleX, scaleY) {
|
|
1116
|
-
BoundsHelper.scale(this, scaleX, scaleY);
|
|
1199
|
+
scale(scaleX, scaleY, onlySize) {
|
|
1200
|
+
BoundsHelper.scale(this, scaleX, scaleY, onlySize);
|
|
1117
1201
|
return this;
|
|
1118
1202
|
}
|
|
1119
1203
|
scaleOf(origin, scaleX, scaleY) {
|
|
@@ -1131,6 +1215,9 @@ class Bounds {
|
|
|
1131
1215
|
getFitMatrix(put, baseScale) {
|
|
1132
1216
|
return BoundsHelper.getFitMatrix(this, put, baseScale);
|
|
1133
1217
|
}
|
|
1218
|
+
put(put, align, putScale) {
|
|
1219
|
+
BoundsHelper.put(this, put, align, putScale);
|
|
1220
|
+
}
|
|
1134
1221
|
spread(fourNumber, side) {
|
|
1135
1222
|
BoundsHelper.spread(this, fourNumber, side);
|
|
1136
1223
|
return this;
|
|
@@ -1239,79 +1326,6 @@ class AutoBounds {
|
|
|
1239
1326
|
}
|
|
1240
1327
|
}
|
|
1241
1328
|
|
|
1242
|
-
var Direction4;
|
|
1243
|
-
(function (Direction4) {
|
|
1244
|
-
Direction4[Direction4["top"] = 0] = "top";
|
|
1245
|
-
Direction4[Direction4["right"] = 1] = "right";
|
|
1246
|
-
Direction4[Direction4["bottom"] = 2] = "bottom";
|
|
1247
|
-
Direction4[Direction4["left"] = 3] = "left";
|
|
1248
|
-
})(Direction4 || (Direction4 = {}));
|
|
1249
|
-
var Direction9;
|
|
1250
|
-
(function (Direction9) {
|
|
1251
|
-
Direction9[Direction9["topLeft"] = 0] = "topLeft";
|
|
1252
|
-
Direction9[Direction9["top"] = 1] = "top";
|
|
1253
|
-
Direction9[Direction9["topRight"] = 2] = "topRight";
|
|
1254
|
-
Direction9[Direction9["right"] = 3] = "right";
|
|
1255
|
-
Direction9[Direction9["bottomRight"] = 4] = "bottomRight";
|
|
1256
|
-
Direction9[Direction9["bottom"] = 5] = "bottom";
|
|
1257
|
-
Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
|
|
1258
|
-
Direction9[Direction9["left"] = 7] = "left";
|
|
1259
|
-
Direction9[Direction9["center"] = 8] = "center";
|
|
1260
|
-
Direction9[Direction9["top-left"] = 0] = "top-left";
|
|
1261
|
-
Direction9[Direction9["top-right"] = 2] = "top-right";
|
|
1262
|
-
Direction9[Direction9["bottom-right"] = 4] = "bottom-right";
|
|
1263
|
-
Direction9[Direction9["bottom-left"] = 6] = "bottom-left";
|
|
1264
|
-
})(Direction9 || (Direction9 = {}));
|
|
1265
|
-
|
|
1266
|
-
const directionData = [
|
|
1267
|
-
{ x: 0, y: 0 },
|
|
1268
|
-
{ x: 0.5, y: 0 },
|
|
1269
|
-
{ x: 1, y: 0 },
|
|
1270
|
-
{ x: 1, y: 0.5 },
|
|
1271
|
-
{ x: 1, y: 1 },
|
|
1272
|
-
{ x: 0.5, y: 1 },
|
|
1273
|
-
{ x: 0, y: 1 },
|
|
1274
|
-
{ x: 0, y: 0.5 },
|
|
1275
|
-
{ x: 0.5, y: 0.5 }
|
|
1276
|
-
];
|
|
1277
|
-
directionData.forEach(item => item.type = 'percent');
|
|
1278
|
-
const AroundHelper = {
|
|
1279
|
-
directionData,
|
|
1280
|
-
tempPoint: {},
|
|
1281
|
-
get: get$4,
|
|
1282
|
-
toPoint(around, bounds, to, onlySize, pointBounds) {
|
|
1283
|
-
const point = get$4(around);
|
|
1284
|
-
to.x = point.x;
|
|
1285
|
-
to.y = point.y;
|
|
1286
|
-
if (point.type === 'percent') {
|
|
1287
|
-
to.x *= bounds.width;
|
|
1288
|
-
to.y *= bounds.height;
|
|
1289
|
-
if (pointBounds) {
|
|
1290
|
-
to.x -= pointBounds.x;
|
|
1291
|
-
to.y -= pointBounds.y;
|
|
1292
|
-
if (point.x)
|
|
1293
|
-
to.x -= (point.x === 1) ? pointBounds.width : (point.x === 0.5 ? point.x * pointBounds.width : 0);
|
|
1294
|
-
if (point.y)
|
|
1295
|
-
to.y -= (point.y === 1) ? pointBounds.height : (point.y === 0.5 ? point.y * pointBounds.height : 0);
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
if (!onlySize) {
|
|
1299
|
-
to.x += bounds.x;
|
|
1300
|
-
to.y += bounds.y;
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
};
|
|
1304
|
-
function get$4(around) {
|
|
1305
|
-
return typeof around === 'string' ? directionData[Direction9[around]] : around;
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
const { toPoint: toPoint$4 } = AroundHelper;
|
|
1309
|
-
const AlignHelper = {
|
|
1310
|
-
toPoint(align, contentBounds, bounds, to, onlySize) {
|
|
1311
|
-
toPoint$4(align, bounds, to, onlySize, contentBounds);
|
|
1312
|
-
}
|
|
1313
|
-
};
|
|
1314
|
-
|
|
1315
1329
|
const StringNumberMap = {
|
|
1316
1330
|
'0': 1,
|
|
1317
1331
|
'1': 1,
|
|
@@ -1442,11 +1456,17 @@ const Plugin = {
|
|
|
1442
1456
|
return rs;
|
|
1443
1457
|
},
|
|
1444
1458
|
need(name) {
|
|
1445
|
-
console.error('please install plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name);
|
|
1459
|
+
console.error('please install and import plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name);
|
|
1446
1460
|
}
|
|
1447
1461
|
};
|
|
1448
1462
|
setTimeout(() => check.forEach(name => Plugin.has(name, true)));
|
|
1449
1463
|
|
|
1464
|
+
const Creator = {
|
|
1465
|
+
editor(_options) {
|
|
1466
|
+
return Plugin.need('editor');
|
|
1467
|
+
}
|
|
1468
|
+
};
|
|
1469
|
+
|
|
1450
1470
|
const debug$d = Debug.get('UICreator');
|
|
1451
1471
|
const UICreator = {
|
|
1452
1472
|
list: {},
|
|
@@ -1584,6 +1604,10 @@ const DataHelper = {
|
|
|
1584
1604
|
for (let i = 0, len = list.length; i < len; i++)
|
|
1585
1605
|
map[list[i]] = true;
|
|
1586
1606
|
return map;
|
|
1607
|
+
},
|
|
1608
|
+
stintSet(data, attrName, value) {
|
|
1609
|
+
value || (value = undefined);
|
|
1610
|
+
data[attrName] !== value && (data[attrName] = value);
|
|
1587
1611
|
}
|
|
1588
1612
|
};
|
|
1589
1613
|
const { assign } = DataHelper;
|
|
@@ -2245,16 +2269,19 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2245
2269
|
if (blendMode)
|
|
2246
2270
|
this.blendMode = 'source-over';
|
|
2247
2271
|
}
|
|
2248
|
-
clearWorld(bounds, ceilPixel) {
|
|
2249
|
-
this.setTempBounds(bounds, ceilPixel);
|
|
2250
|
-
this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2251
|
-
}
|
|
2252
2272
|
clipWorld(bounds, ceilPixel) {
|
|
2253
2273
|
this.beginPath();
|
|
2254
2274
|
this.setTempBounds(bounds, ceilPixel);
|
|
2255
2275
|
this.rect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2256
2276
|
this.clip();
|
|
2257
2277
|
}
|
|
2278
|
+
clipUI(ruleData) {
|
|
2279
|
+
ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
|
|
2280
|
+
}
|
|
2281
|
+
clearWorld(bounds, ceilPixel) {
|
|
2282
|
+
this.setTempBounds(bounds, ceilPixel);
|
|
2283
|
+
this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2284
|
+
}
|
|
2258
2285
|
clear() {
|
|
2259
2286
|
const { pixelRatio } = this;
|
|
2260
2287
|
this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
|
|
@@ -2385,7 +2412,7 @@ const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI
|
|
|
2385
2412
|
const { setPoint: setPoint$1, addPoint: addPoint$1 } = TwoPointBoundsHelper;
|
|
2386
2413
|
const { set, toNumberPoints } = PointHelper;
|
|
2387
2414
|
const { M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
2388
|
-
const tempPoint$
|
|
2415
|
+
const tempPoint$1 = {};
|
|
2389
2416
|
const BezierHelper = {
|
|
2390
2417
|
points(data, originPoints, curve, close) {
|
|
2391
2418
|
let points = toNumberPoints(originPoints);
|
|
@@ -2407,6 +2434,8 @@ const BezierHelper = {
|
|
|
2407
2434
|
cY = points[i + 3];
|
|
2408
2435
|
ba = sqrt$1(pow(bX - aX, 2) + pow(bY - aY, 2));
|
|
2409
2436
|
cb = sqrt$1(pow(cX - bX, 2) + pow(cY - bY, 2));
|
|
2437
|
+
if (!ba && !cb)
|
|
2438
|
+
continue;
|
|
2410
2439
|
d = ba + cb;
|
|
2411
2440
|
ba = (t * ba) / d;
|
|
2412
2441
|
cb = (t * cb) / d;
|
|
@@ -2576,8 +2605,8 @@ const BezierHelper = {
|
|
|
2576
2605
|
addMode ? addPoint$1(pointBounds, fromX, fromY) : setPoint$1(pointBounds, fromX, fromY);
|
|
2577
2606
|
addPoint$1(pointBounds, toX, toY);
|
|
2578
2607
|
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$
|
|
2608
|
+
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$1);
|
|
2609
|
+
addPoint$1(pointBounds, tempPoint$1.x, tempPoint$1.y);
|
|
2581
2610
|
}
|
|
2582
2611
|
},
|
|
2583
2612
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -3386,7 +3415,7 @@ function canvasPatch(drawer) {
|
|
|
3386
3415
|
}
|
|
3387
3416
|
|
|
3388
3417
|
const FileHelper = {
|
|
3389
|
-
|
|
3418
|
+
alphaPixelTypes: ['png', 'webp', 'svg'],
|
|
3390
3419
|
upperCaseTypeMap: {},
|
|
3391
3420
|
mineType(type) {
|
|
3392
3421
|
if (!type || type.startsWith('image'))
|
|
@@ -3413,7 +3442,7 @@ const FileHelper = {
|
|
|
3413
3442
|
}
|
|
3414
3443
|
};
|
|
3415
3444
|
const F = FileHelper;
|
|
3416
|
-
F.
|
|
3445
|
+
F.alphaPixelTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3417
3446
|
|
|
3418
3447
|
const debug$8 = Debug.get('TaskProcessor');
|
|
3419
3448
|
class TaskItem {
|
|
@@ -3730,8 +3759,8 @@ const ImageManager = {
|
|
|
3730
3759
|
list.length = 0;
|
|
3731
3760
|
}
|
|
3732
3761
|
},
|
|
3733
|
-
|
|
3734
|
-
return FileHelper.
|
|
3762
|
+
hasAlphaPixel(config) {
|
|
3763
|
+
return FileHelper.alphaPixelTypes.some(item => I.isFormat(item, config));
|
|
3735
3764
|
},
|
|
3736
3765
|
isFormat(format, config) {
|
|
3737
3766
|
if (config.format === format)
|
|
@@ -3769,7 +3798,7 @@ class LeaferImage {
|
|
|
3769
3798
|
this.setView(view.config ? view.view : view);
|
|
3770
3799
|
}
|
|
3771
3800
|
ImageManager.isFormat('svg', config) && (this.isSVG = true);
|
|
3772
|
-
ImageManager.
|
|
3801
|
+
ImageManager.hasAlphaPixel(config) && (this.hasAlphaPixel = true);
|
|
3773
3802
|
}
|
|
3774
3803
|
load(onSuccess, onError) {
|
|
3775
3804
|
if (!this.loading) {
|
|
@@ -4457,7 +4486,7 @@ const LeafBoundsHelper = {
|
|
|
4457
4486
|
}
|
|
4458
4487
|
};
|
|
4459
4488
|
|
|
4460
|
-
const { updateBounds: updateBounds$
|
|
4489
|
+
const { updateBounds: updateBounds$3 } = LeafHelper;
|
|
4461
4490
|
const BranchHelper = {
|
|
4462
4491
|
sort(a, b) {
|
|
4463
4492
|
return (a.__.zIndex === b.__.zIndex) ? (a.__tempNumber - b.__tempNumber) : (a.__.zIndex - b.__.zIndex);
|
|
@@ -4519,11 +4548,11 @@ const BranchHelper = {
|
|
|
4519
4548
|
branch = branchStack[i];
|
|
4520
4549
|
children = branch.children;
|
|
4521
4550
|
for (let j = 0, len = children.length; j < len; j++) {
|
|
4522
|
-
updateBounds$
|
|
4551
|
+
updateBounds$3(children[j]);
|
|
4523
4552
|
}
|
|
4524
4553
|
if (exclude && exclude === branch)
|
|
4525
4554
|
continue;
|
|
4526
|
-
updateBounds$
|
|
4555
|
+
updateBounds$3(branch);
|
|
4527
4556
|
}
|
|
4528
4557
|
}
|
|
4529
4558
|
};
|
|
@@ -4541,7 +4570,7 @@ const WaitHelper = {
|
|
|
4541
4570
|
}
|
|
4542
4571
|
};
|
|
4543
4572
|
|
|
4544
|
-
const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
|
|
4573
|
+
const { getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2 } = LeafHelper;
|
|
4545
4574
|
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$5 } = BoundsHelper;
|
|
4546
4575
|
const localContent = '_localContentBounds';
|
|
4547
4576
|
const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
|
|
@@ -4585,7 +4614,9 @@ class LeafLayout {
|
|
|
4585
4614
|
this._localRenderBounds = local;
|
|
4586
4615
|
}
|
|
4587
4616
|
update() {
|
|
4588
|
-
const { leafer } =
|
|
4617
|
+
const { leaf } = this, { leafer } = leaf;
|
|
4618
|
+
if (leaf.isApp)
|
|
4619
|
+
return updateBounds$2(leaf);
|
|
4589
4620
|
if (leafer) {
|
|
4590
4621
|
if (leafer.ready)
|
|
4591
4622
|
leafer.watcher.changed && leafer.layouter.layout();
|
|
@@ -4593,7 +4624,7 @@ class LeafLayout {
|
|
|
4593
4624
|
leafer.start();
|
|
4594
4625
|
}
|
|
4595
4626
|
else {
|
|
4596
|
-
let root =
|
|
4627
|
+
let root = leaf;
|
|
4597
4628
|
while (root.parent && !root.parent.leafer) {
|
|
4598
4629
|
root = root.parent;
|
|
4599
4630
|
}
|
|
@@ -4815,7 +4846,7 @@ class LeafLayout {
|
|
|
4815
4846
|
}
|
|
4816
4847
|
childrenSortChange() {
|
|
4817
4848
|
if (!this.childrenSortChanged) {
|
|
4818
|
-
this.childrenSortChanged = true;
|
|
4849
|
+
this.childrenSortChanged = this.affectChildrenSort = true;
|
|
4819
4850
|
this.leaf.forceUpdate('surface');
|
|
4820
4851
|
}
|
|
4821
4852
|
}
|
|
@@ -4882,6 +4913,40 @@ ImageEvent.LOAD = 'image.load';
|
|
|
4882
4913
|
ImageEvent.LOADED = 'image.loaded';
|
|
4883
4914
|
ImageEvent.ERROR = 'image.error';
|
|
4884
4915
|
|
|
4916
|
+
class BoundsEvent extends Event {
|
|
4917
|
+
static checkHas(leaf, type, mode) {
|
|
4918
|
+
if (mode === 'on') {
|
|
4919
|
+
type === WORLD ? leaf.__hasWorldEvent = true : leaf.__hasLocalEvent = true;
|
|
4920
|
+
}
|
|
4921
|
+
else {
|
|
4922
|
+
leaf.__hasLocalEvent = leaf.hasEvent(RESIZE) || leaf.hasEvent(INNER) || leaf.hasEvent(LOCAL);
|
|
4923
|
+
leaf.__hasWorldEvent = leaf.hasEvent(WORLD);
|
|
4924
|
+
}
|
|
4925
|
+
}
|
|
4926
|
+
static emitLocal(leaf) {
|
|
4927
|
+
if (leaf.leaferIsReady) {
|
|
4928
|
+
const { resized } = leaf.__layout;
|
|
4929
|
+
if (resized !== 'local') {
|
|
4930
|
+
leaf.emit(RESIZE, leaf);
|
|
4931
|
+
if (resized === 'inner')
|
|
4932
|
+
leaf.emit(INNER, leaf);
|
|
4933
|
+
}
|
|
4934
|
+
leaf.emit(LOCAL, leaf);
|
|
4935
|
+
}
|
|
4936
|
+
}
|
|
4937
|
+
static emitWorld(leaf) {
|
|
4938
|
+
if (leaf.leaferIsReady)
|
|
4939
|
+
leaf.emit(WORLD, this);
|
|
4940
|
+
}
|
|
4941
|
+
}
|
|
4942
|
+
BoundsEvent.RESIZE = 'bounds.resize';
|
|
4943
|
+
BoundsEvent.INNER = 'bounds.inner';
|
|
4944
|
+
BoundsEvent.LOCAL = 'bounds.local';
|
|
4945
|
+
BoundsEvent.WORLD = 'bounds.world';
|
|
4946
|
+
const { RESIZE, INNER, LOCAL, WORLD } = BoundsEvent;
|
|
4947
|
+
const boundsEventMap = {};
|
|
4948
|
+
[RESIZE, INNER, LOCAL, WORLD].forEach(key => boundsEventMap[key] = 1);
|
|
4949
|
+
|
|
4885
4950
|
class ResizeEvent extends Event {
|
|
4886
4951
|
get bigger() {
|
|
4887
4952
|
if (!this.old)
|
|
@@ -4978,9 +5043,12 @@ class Eventer {
|
|
|
4978
5043
|
set event(map) { this.on(map); }
|
|
4979
5044
|
on(type, listener, options) {
|
|
4980
5045
|
if (!listener) {
|
|
4981
|
-
let event
|
|
4982
|
-
|
|
4983
|
-
|
|
5046
|
+
let event;
|
|
5047
|
+
if (type instanceof Array)
|
|
5048
|
+
type.forEach(item => this.on(item[0], item[1], item[2]));
|
|
5049
|
+
else
|
|
5050
|
+
for (let key in type)
|
|
5051
|
+
(event = type[key]) instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event);
|
|
4984
5052
|
return;
|
|
4985
5053
|
}
|
|
4986
5054
|
let capture, once;
|
|
@@ -5010,6 +5078,8 @@ class Eventer {
|
|
|
5010
5078
|
else {
|
|
5011
5079
|
map[type] = [item];
|
|
5012
5080
|
}
|
|
5081
|
+
if (boundsEventMap[type])
|
|
5082
|
+
BoundsEvent.checkHas(this, type, 'on');
|
|
5013
5083
|
}
|
|
5014
5084
|
});
|
|
5015
5085
|
}
|
|
@@ -5031,6 +5101,8 @@ class Eventer {
|
|
|
5031
5101
|
events.splice(index, 1);
|
|
5032
5102
|
if (!events.length)
|
|
5033
5103
|
delete map[type];
|
|
5104
|
+
if (boundsEventMap[type])
|
|
5105
|
+
BoundsEvent.checkHas(this, type, 'off');
|
|
5034
5106
|
}
|
|
5035
5107
|
}
|
|
5036
5108
|
});
|
|
@@ -5050,19 +5122,31 @@ class Eventer {
|
|
|
5050
5122
|
}
|
|
5051
5123
|
}
|
|
5052
5124
|
on_(type, listener, bind, options) {
|
|
5053
|
-
if (
|
|
5054
|
-
|
|
5055
|
-
|
|
5125
|
+
if (!listener)
|
|
5126
|
+
(type instanceof Array) && type.forEach(item => this.on(item[0], item[2] ? item[1] = item[1].bind(item[2]) : item[1], item[3]));
|
|
5127
|
+
else
|
|
5128
|
+
this.on(type, bind ? listener = listener.bind(bind) : listener, options);
|
|
5056
5129
|
return { type, current: this, listener, options };
|
|
5057
5130
|
}
|
|
5058
5131
|
off_(id) {
|
|
5059
5132
|
if (!id)
|
|
5060
5133
|
return;
|
|
5061
5134
|
const list = id instanceof Array ? id : [id];
|
|
5062
|
-
list.forEach(item =>
|
|
5135
|
+
list.forEach(item => {
|
|
5136
|
+
if (!item.listener)
|
|
5137
|
+
(item.type instanceof Array) && item.type.forEach(v => item.current.off(v[0], v[1], v[3]));
|
|
5138
|
+
else
|
|
5139
|
+
item.current.off(item.type, item.listener, item.options);
|
|
5140
|
+
});
|
|
5063
5141
|
list.length = 0;
|
|
5064
5142
|
}
|
|
5065
|
-
once(type, listener, capture) {
|
|
5143
|
+
once(type, listener, captureOrBind, capture) {
|
|
5144
|
+
if (!listener)
|
|
5145
|
+
return (type instanceof Array) && type.forEach(item => this.once(item[0], item[1], item[2], item[3]));
|
|
5146
|
+
if (typeof captureOrBind === 'object')
|
|
5147
|
+
listener = listener.bind(captureOrBind);
|
|
5148
|
+
else
|
|
5149
|
+
capture = captureOrBind;
|
|
5066
5150
|
this.on(type, listener, { once: true, capture });
|
|
5067
5151
|
}
|
|
5068
5152
|
emit(type, event, capture) {
|
|
@@ -5174,7 +5258,7 @@ const LeafDataProxy = {
|
|
|
5174
5258
|
};
|
|
5175
5259
|
|
|
5176
5260
|
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
5177
|
-
const { toPoint: toPoint$3, tempPoint
|
|
5261
|
+
const { toPoint: toPoint$3, tempPoint } = AroundHelper;
|
|
5178
5262
|
const LeafMatrix = {
|
|
5179
5263
|
__updateWorldMatrix() {
|
|
5180
5264
|
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
|
|
@@ -5183,19 +5267,19 @@ const LeafMatrix = {
|
|
|
5183
5267
|
if (this.__local) {
|
|
5184
5268
|
const layout = this.__layout, local = this.__local, data = this.__;
|
|
5185
5269
|
if (layout.affectScaleOrRotation) {
|
|
5186
|
-
if (layout.scaleChanged || layout.rotationChanged) {
|
|
5270
|
+
if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
|
|
5187
5271
|
setLayout(local, data, null, null, layout.affectRotation);
|
|
5188
|
-
layout.scaleChanged = layout.rotationChanged =
|
|
5272
|
+
layout.scaleChanged = layout.rotationChanged = undefined;
|
|
5189
5273
|
}
|
|
5190
5274
|
}
|
|
5191
5275
|
local.e = data.x + data.offsetX;
|
|
5192
5276
|
local.f = data.y + data.offsetY;
|
|
5193
5277
|
if (data.around || data.origin) {
|
|
5194
|
-
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint
|
|
5195
|
-
translateInner(local, -tempPoint
|
|
5278
|
+
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint);
|
|
5279
|
+
translateInner(local, -tempPoint.x, -tempPoint.y, !data.around);
|
|
5196
5280
|
}
|
|
5197
5281
|
}
|
|
5198
|
-
this.__layout.matrixChanged =
|
|
5282
|
+
this.__layout.matrixChanged = undefined;
|
|
5199
5283
|
}
|
|
5200
5284
|
};
|
|
5201
5285
|
|
|
@@ -5205,11 +5289,17 @@ const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4 } =
|
|
|
5205
5289
|
const { toBounds: toBounds$1 } = PathBounds;
|
|
5206
5290
|
const LeafBounds = {
|
|
5207
5291
|
__updateWorldBounds() {
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5292
|
+
const layout = this.__layout;
|
|
5293
|
+
toOuterOf$1(layout.renderBounds, this.__world, this.__world);
|
|
5294
|
+
if (layout.resized) {
|
|
5295
|
+
if (layout.resized === 'inner')
|
|
5296
|
+
this.__onUpdateSize();
|
|
5297
|
+
if (this.__hasLocalEvent)
|
|
5298
|
+
BoundsEvent.emitLocal(this);
|
|
5299
|
+
layout.resized = undefined;
|
|
5212
5300
|
}
|
|
5301
|
+
if (this.__hasWorldEvent)
|
|
5302
|
+
BoundsEvent.emitWorld(this);
|
|
5213
5303
|
},
|
|
5214
5304
|
__updateLocalBounds() {
|
|
5215
5305
|
const layout = this.__layout;
|
|
@@ -5218,12 +5308,12 @@ const LeafBounds = {
|
|
|
5218
5308
|
this.__updatePath();
|
|
5219
5309
|
this.__updateRenderPath();
|
|
5220
5310
|
this.__updateBoxBounds();
|
|
5221
|
-
layout.resized =
|
|
5311
|
+
layout.resized = 'inner';
|
|
5222
5312
|
}
|
|
5223
5313
|
if (layout.localBoxChanged) {
|
|
5224
5314
|
if (this.__local)
|
|
5225
5315
|
this.__updateLocalBoxBounds();
|
|
5226
|
-
layout.localBoxChanged =
|
|
5316
|
+
layout.localBoxChanged = undefined;
|
|
5227
5317
|
if (layout.strokeSpread)
|
|
5228
5318
|
layout.strokeChanged = true;
|
|
5229
5319
|
if (layout.renderSpread)
|
|
@@ -5231,7 +5321,7 @@ const LeafBounds = {
|
|
|
5231
5321
|
if (this.parent)
|
|
5232
5322
|
this.parent.__layout.boxChange();
|
|
5233
5323
|
}
|
|
5234
|
-
layout.boxChanged =
|
|
5324
|
+
layout.boxChanged = undefined;
|
|
5235
5325
|
if (layout.strokeChanged) {
|
|
5236
5326
|
layout.strokeSpread = this.__updateStrokeSpread();
|
|
5237
5327
|
if (layout.strokeSpread) {
|
|
@@ -5243,12 +5333,12 @@ const LeafBounds = {
|
|
|
5243
5333
|
else {
|
|
5244
5334
|
layout.spreadStrokeCancel();
|
|
5245
5335
|
}
|
|
5246
|
-
layout.strokeChanged =
|
|
5336
|
+
layout.strokeChanged = undefined;
|
|
5247
5337
|
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
|
|
5248
5338
|
layout.renderChanged = true;
|
|
5249
5339
|
if (this.parent)
|
|
5250
5340
|
this.parent.__layout.strokeChange();
|
|
5251
|
-
layout.resized =
|
|
5341
|
+
layout.resized = 'inner';
|
|
5252
5342
|
}
|
|
5253
5343
|
if (layout.renderChanged) {
|
|
5254
5344
|
layout.renderSpread = this.__updateRenderSpread();
|
|
@@ -5261,11 +5351,12 @@ const LeafBounds = {
|
|
|
5261
5351
|
else {
|
|
5262
5352
|
layout.spreadRenderCancel();
|
|
5263
5353
|
}
|
|
5264
|
-
layout.renderChanged =
|
|
5354
|
+
layout.renderChanged = undefined;
|
|
5265
5355
|
if (this.parent)
|
|
5266
5356
|
this.parent.__layout.renderChange();
|
|
5267
5357
|
}
|
|
5268
|
-
layout.
|
|
5358
|
+
layout.resized || (layout.resized = 'local');
|
|
5359
|
+
layout.boundsChanged = undefined;
|
|
5269
5360
|
},
|
|
5270
5361
|
__updateLocalBoxBounds() {
|
|
5271
5362
|
if (this.__hasMotionPath)
|
|
@@ -5359,7 +5450,7 @@ const LeafRender = {
|
|
|
5359
5450
|
if (this.__worldOpacity) {
|
|
5360
5451
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5361
5452
|
this.__drawRenderPath(canvas);
|
|
5362
|
-
|
|
5453
|
+
canvas.clipUI(this);
|
|
5363
5454
|
}
|
|
5364
5455
|
},
|
|
5365
5456
|
__updateWorldOpacity() {
|
|
@@ -5805,7 +5896,7 @@ let Leaf = class Leaf {
|
|
|
5805
5896
|
off(_type, _listener, _options) { }
|
|
5806
5897
|
on_(_type, _listener, _bind, _options) { return undefined; }
|
|
5807
5898
|
off_(_id) { }
|
|
5808
|
-
once(_type, _listener, _capture) { }
|
|
5899
|
+
once(_type, _listener, _captureOrBind, _capture) { }
|
|
5809
5900
|
emit(_type, _event, _capture) { }
|
|
5810
5901
|
emitEvent(_event, _capture) { }
|
|
5811
5902
|
hasEvent(_type, _capture) { return false; }
|
|
@@ -6142,7 +6233,7 @@ class LeafLevelList {
|
|
|
6142
6233
|
}
|
|
6143
6234
|
}
|
|
6144
6235
|
|
|
6145
|
-
const version = "1.6.
|
|
6236
|
+
const version = "1.6.4";
|
|
6146
6237
|
|
|
6147
6238
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6148
6239
|
get allowBackgroundColor() { return true; }
|
|
@@ -6301,17 +6392,15 @@ class Watcher {
|
|
|
6301
6392
|
this.target.emitEvent(new WatchEvent(WatchEvent.DATA, { updatedList: this.updatedList }));
|
|
6302
6393
|
this.__updatedList = new LeafList();
|
|
6303
6394
|
this.totalTimes++;
|
|
6304
|
-
this.changed = false;
|
|
6305
|
-
this.hasVisible = false;
|
|
6306
|
-
this.hasRemove = false;
|
|
6307
|
-
this.hasAdd = false;
|
|
6395
|
+
this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
6308
6396
|
}
|
|
6309
6397
|
__listenEvents() {
|
|
6310
|
-
const { target } = this;
|
|
6311
6398
|
this.__eventIds = [
|
|
6312
|
-
target.on_(
|
|
6313
|
-
|
|
6314
|
-
|
|
6399
|
+
this.target.on_([
|
|
6400
|
+
[PropertyEvent.CHANGE, this.__onAttrChange, this],
|
|
6401
|
+
[[ChildEvent.ADD, ChildEvent.REMOVE], this.__onChildEvent, this],
|
|
6402
|
+
[WatchEvent.REQUEST, this.__onRquestData, this]
|
|
6403
|
+
])
|
|
6315
6404
|
];
|
|
6316
6405
|
}
|
|
6317
6406
|
__removeListenEvents() {
|
|
@@ -6321,8 +6410,7 @@ class Watcher {
|
|
|
6321
6410
|
if (this.target) {
|
|
6322
6411
|
this.stop();
|
|
6323
6412
|
this.__removeListenEvents();
|
|
6324
|
-
this.target = null;
|
|
6325
|
-
this.__updatedList = null;
|
|
6413
|
+
this.target = this.__updatedList = null;
|
|
6326
6414
|
}
|
|
6327
6415
|
}
|
|
6328
6416
|
}
|
|
@@ -6427,7 +6515,7 @@ class Layouter {
|
|
|
6427
6515
|
this.disabled = true;
|
|
6428
6516
|
}
|
|
6429
6517
|
layout() {
|
|
6430
|
-
if (!this.running)
|
|
6518
|
+
if (this.layouting || !this.running)
|
|
6431
6519
|
return;
|
|
6432
6520
|
const { target } = this;
|
|
6433
6521
|
this.times = 0;
|
|
@@ -6510,12 +6598,10 @@ class Layouter {
|
|
|
6510
6598
|
}
|
|
6511
6599
|
static fullLayout(target) {
|
|
6512
6600
|
updateAllMatrix(target, true);
|
|
6513
|
-
if (target.isBranch)
|
|
6601
|
+
if (target.isBranch)
|
|
6514
6602
|
BranchHelper.updateBounds(target);
|
|
6515
|
-
|
|
6516
|
-
else {
|
|
6603
|
+
else
|
|
6517
6604
|
LeafHelper.updateBounds(target);
|
|
6518
|
-
}
|
|
6519
6605
|
updateAllChange(target);
|
|
6520
6606
|
}
|
|
6521
6607
|
addExtra(leaf) {
|
|
@@ -6538,11 +6624,12 @@ class Layouter {
|
|
|
6538
6624
|
this.__updatedList = event.data.updatedList;
|
|
6539
6625
|
}
|
|
6540
6626
|
__listenEvents() {
|
|
6541
|
-
const { target } = this;
|
|
6542
6627
|
this.__eventIds = [
|
|
6543
|
-
target.on_(
|
|
6544
|
-
|
|
6545
|
-
|
|
6628
|
+
this.target.on_([
|
|
6629
|
+
[LayoutEvent.REQUEST, this.layout, this],
|
|
6630
|
+
[LayoutEvent.AGAIN, this.layoutAgain, this],
|
|
6631
|
+
[WatchEvent.DATA, this.__onReceiveWatchData, this]
|
|
6632
|
+
])
|
|
6546
6633
|
];
|
|
6547
6634
|
}
|
|
6548
6635
|
__removeListenEvents() {
|
|
@@ -6773,12 +6860,13 @@ class Renderer {
|
|
|
6773
6860
|
this.target.emitEvent(new RenderEvent(type, this.times, bounds, options));
|
|
6774
6861
|
}
|
|
6775
6862
|
__listenEvents() {
|
|
6776
|
-
const { target } = this;
|
|
6777
6863
|
this.__eventIds = [
|
|
6778
|
-
target.on_(
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6864
|
+
this.target.on_([
|
|
6865
|
+
[RenderEvent.REQUEST, this.update, this],
|
|
6866
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
6867
|
+
[RenderEvent.AGAIN, this.renderAgain, this],
|
|
6868
|
+
[ResizeEvent.RESIZE, this.__onResize, this]
|
|
6869
|
+
])
|
|
6782
6870
|
];
|
|
6783
6871
|
}
|
|
6784
6872
|
__removeListenEvents() {
|
|
@@ -6837,8 +6925,32 @@ function zoomLayerType() {
|
|
|
6837
6925
|
};
|
|
6838
6926
|
}
|
|
6839
6927
|
|
|
6928
|
+
function hasTransparent$3(color) {
|
|
6929
|
+
if (!color || color.length === 7 || color.length === 4)
|
|
6930
|
+
return false;
|
|
6931
|
+
if (color === 'transparent')
|
|
6932
|
+
return true;
|
|
6933
|
+
const first = color[0];
|
|
6934
|
+
if (first === '#') {
|
|
6935
|
+
switch (color.length) {
|
|
6936
|
+
case 5: return color[4] !== 'f' && color[4] !== 'F';
|
|
6937
|
+
case 9: return (color[7] !== 'f' && color[7] !== 'F') || (color[8] !== 'f' && color[8] !== 'F');
|
|
6938
|
+
}
|
|
6939
|
+
}
|
|
6940
|
+
else if (first === 'r' || first === 'h') {
|
|
6941
|
+
if (color[3] === 'a') {
|
|
6942
|
+
const i = color.lastIndexOf(',');
|
|
6943
|
+
if (i > -1)
|
|
6944
|
+
return parseFloat(color.slice(i + 1)) < 1;
|
|
6945
|
+
}
|
|
6946
|
+
}
|
|
6947
|
+
return false;
|
|
6948
|
+
}
|
|
6949
|
+
|
|
6840
6950
|
const TextConvert = {};
|
|
6841
|
-
const ColorConvert = {
|
|
6951
|
+
const ColorConvert = {
|
|
6952
|
+
hasTransparent: hasTransparent$3
|
|
6953
|
+
};
|
|
6842
6954
|
const UnitConvert = {
|
|
6843
6955
|
number(value, percentRefer) {
|
|
6844
6956
|
return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
|
|
@@ -6864,6 +6976,7 @@ const Transition = {
|
|
|
6864
6976
|
};
|
|
6865
6977
|
|
|
6866
6978
|
const { parse, objectToCanvasData } = PathConvert;
|
|
6979
|
+
const { stintSet: stintSet$2 } = DataHelper, { hasTransparent: hasTransparent$2 } = ColorConvert;
|
|
6867
6980
|
const emptyPaint = {};
|
|
6868
6981
|
const debug$1 = Debug.get('UIData');
|
|
6869
6982
|
class UIData extends LeafData {
|
|
@@ -6922,38 +7035,22 @@ class UIData extends LeafData {
|
|
|
6922
7035
|
if (this.__naturalWidth)
|
|
6923
7036
|
this.__removeNaturalSize();
|
|
6924
7037
|
if (typeof value === 'string' || !value) {
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
PaintImage.recycleImage('fill', this);
|
|
6928
|
-
this.__isFills = false;
|
|
6929
|
-
this.__pixelFill && (this.__pixelFill = false);
|
|
6930
|
-
}
|
|
7038
|
+
stintSet$2(this, '__isTransparentFill', hasTransparent$2(value));
|
|
7039
|
+
this.__isFills && this.__removePaint('fill', true);
|
|
6931
7040
|
this._fill = value;
|
|
6932
7041
|
}
|
|
6933
7042
|
else if (typeof value === 'object') {
|
|
6934
|
-
this.
|
|
6935
|
-
const layout = this.__leaf.__layout;
|
|
6936
|
-
layout.boxChanged || layout.boxChange();
|
|
6937
|
-
this.__isFills = true;
|
|
6938
|
-
this._fill || (this._fill = emptyPaint);
|
|
7043
|
+
this.__setPaint('fill', value);
|
|
6939
7044
|
}
|
|
6940
7045
|
}
|
|
6941
7046
|
setStroke(value) {
|
|
6942
7047
|
if (typeof value === 'string' || !value) {
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
PaintImage.recycleImage('stroke', this);
|
|
6946
|
-
this.__isStrokes = false;
|
|
6947
|
-
this.__pixelStroke && (this.__pixelStroke = false);
|
|
6948
|
-
}
|
|
7048
|
+
stintSet$2(this, '__isTransparentStroke', hasTransparent$2(value));
|
|
7049
|
+
this.__isStrokes && this.__removePaint('stroke', true);
|
|
6949
7050
|
this._stroke = value;
|
|
6950
7051
|
}
|
|
6951
7052
|
else if (typeof value === 'object') {
|
|
6952
|
-
this.
|
|
6953
|
-
const layout = this.__leaf.__layout;
|
|
6954
|
-
layout.boxChanged || layout.boxChange();
|
|
6955
|
-
this.__isStrokes = true;
|
|
6956
|
-
this._stroke || (this._stroke = emptyPaint);
|
|
7053
|
+
this.__setPaint('stroke', value);
|
|
6957
7054
|
}
|
|
6958
7055
|
}
|
|
6959
7056
|
setPath(value) {
|
|
@@ -6983,7 +7080,34 @@ class UIData extends LeafData {
|
|
|
6983
7080
|
Paint.compute('fill', this.__leaf);
|
|
6984
7081
|
if (stroke)
|
|
6985
7082
|
Paint.compute('stroke', this.__leaf);
|
|
6986
|
-
this.__needComputePaint =
|
|
7083
|
+
this.__needComputePaint = undefined;
|
|
7084
|
+
}
|
|
7085
|
+
__setPaint(attrName, value) {
|
|
7086
|
+
this.__setInput(attrName, value);
|
|
7087
|
+
const layout = this.__leaf.__layout;
|
|
7088
|
+
layout.boxChanged || layout.boxChange();
|
|
7089
|
+
if (value instanceof Array && !value.length) {
|
|
7090
|
+
this.__removePaint(attrName);
|
|
7091
|
+
}
|
|
7092
|
+
else {
|
|
7093
|
+
if (attrName === 'fill')
|
|
7094
|
+
this.__isFills = true, this._fill || (this._fill = emptyPaint);
|
|
7095
|
+
else
|
|
7096
|
+
this.__isStrokes = true, this._stroke || (this._stroke = emptyPaint);
|
|
7097
|
+
}
|
|
7098
|
+
}
|
|
7099
|
+
__removePaint(attrName, removeInput) {
|
|
7100
|
+
if (removeInput)
|
|
7101
|
+
this.__removeInput(attrName);
|
|
7102
|
+
PaintImage.recycleImage(attrName, this);
|
|
7103
|
+
if (attrName === 'fill') {
|
|
7104
|
+
stintSet$2(this, '__isAlphaPixelFill', undefined);
|
|
7105
|
+
this._fill = this.__isFills = undefined;
|
|
7106
|
+
}
|
|
7107
|
+
else {
|
|
7108
|
+
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7109
|
+
this._stroke = this.__isStrokes = undefined;
|
|
7110
|
+
}
|
|
6987
7111
|
}
|
|
6988
7112
|
}
|
|
6989
7113
|
function setArray(data, key, value) {
|
|
@@ -6991,10 +7115,10 @@ function setArray(data, key, value) {
|
|
|
6991
7115
|
if (value instanceof Array) {
|
|
6992
7116
|
if (value.some((item) => item.visible === false))
|
|
6993
7117
|
value = value.filter((item) => item.visible !== false);
|
|
6994
|
-
value.length || (value =
|
|
7118
|
+
value.length || (value = undefined);
|
|
6995
7119
|
}
|
|
6996
7120
|
else
|
|
6997
|
-
value = value && value.visible !== false ? [value] :
|
|
7121
|
+
value = value && value.visible !== false ? [value] : undefined;
|
|
6998
7122
|
data['_' + key] = value;
|
|
6999
7123
|
}
|
|
7000
7124
|
|
|
@@ -7097,8 +7221,6 @@ class ImageData extends RectData {
|
|
|
7097
7221
|
this._url = value;
|
|
7098
7222
|
}
|
|
7099
7223
|
__setImageFill(value) {
|
|
7100
|
-
if (this.__leaf.image)
|
|
7101
|
-
this.__leaf.image = null;
|
|
7102
7224
|
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
7103
7225
|
}
|
|
7104
7226
|
__getData() {
|
|
@@ -7164,21 +7286,19 @@ const UIBounds = {
|
|
|
7164
7286
|
}
|
|
7165
7287
|
};
|
|
7166
7288
|
|
|
7289
|
+
const { stintSet: stintSet$1 } = DataHelper;
|
|
7167
7290
|
const UIRender = {
|
|
7168
7291
|
__updateChange() {
|
|
7169
|
-
const data = this.__
|
|
7292
|
+
const data = this.__;
|
|
7170
7293
|
if (data.__useEffect) {
|
|
7171
|
-
const { shadow,
|
|
7172
|
-
data.
|
|
7294
|
+
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7295
|
+
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')));
|
|
7296
|
+
data.__useEffect = !!(shadow || otherEffect);
|
|
7173
7297
|
}
|
|
7174
|
-
|
|
7175
|
-
|
|
7298
|
+
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7299
|
+
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7176
7300
|
data.__checkSingle();
|
|
7177
|
-
|
|
7178
|
-
if (complex)
|
|
7179
|
-
data.__complex = true;
|
|
7180
|
-
else
|
|
7181
|
-
data.__complex && (data.__complex = false);
|
|
7301
|
+
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7182
7302
|
},
|
|
7183
7303
|
__drawFast(canvas, options) {
|
|
7184
7304
|
drawFast(this, canvas, options);
|
|
@@ -7188,21 +7308,23 @@ const UIRender = {
|
|
|
7188
7308
|
if (data.__complex) {
|
|
7189
7309
|
if (data.__needComputePaint)
|
|
7190
7310
|
data.__computePaint();
|
|
7191
|
-
const { fill, stroke, __drawAfterFill } = data;
|
|
7311
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke, __isFastShadow } = data;
|
|
7192
7312
|
this.__drawRenderPath(canvas);
|
|
7193
|
-
if (data.__useEffect) {
|
|
7313
|
+
if (data.__useEffect && !__isFastShadow) {
|
|
7194
7314
|
const shape = Paint.shape(this, canvas, options);
|
|
7195
7315
|
this.__nowWorld = this.__getNowWorld(options);
|
|
7196
7316
|
const { shadow, innerShadow, filter } = data;
|
|
7197
7317
|
if (shadow)
|
|
7198
7318
|
Effect.shadow(this, canvas, shape);
|
|
7319
|
+
if (__fillAfterStroke)
|
|
7320
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7199
7321
|
if (fill)
|
|
7200
7322
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7201
7323
|
if (__drawAfterFill)
|
|
7202
7324
|
this.__drawAfterFill(canvas, options);
|
|
7203
7325
|
if (innerShadow)
|
|
7204
7326
|
Effect.innerShadow(this, canvas, shape);
|
|
7205
|
-
if (stroke)
|
|
7327
|
+
if (stroke && !__fillAfterStroke)
|
|
7206
7328
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7207
7329
|
if (filter)
|
|
7208
7330
|
Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
@@ -7211,21 +7333,27 @@ const UIRender = {
|
|
|
7211
7333
|
shape.canvas.recycle();
|
|
7212
7334
|
}
|
|
7213
7335
|
else {
|
|
7336
|
+
if (__fillAfterStroke)
|
|
7337
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7338
|
+
if (__isFastShadow) {
|
|
7339
|
+
const shadow = data.shadow[0], { scaleX, scaleY } = this.__nowWorld;
|
|
7340
|
+
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
7341
|
+
}
|
|
7214
7342
|
if (fill)
|
|
7215
7343
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7344
|
+
if (__isFastShadow)
|
|
7345
|
+
canvas.restore();
|
|
7216
7346
|
if (__drawAfterFill)
|
|
7217
7347
|
this.__drawAfterFill(canvas, options);
|
|
7218
|
-
if (stroke)
|
|
7348
|
+
if (stroke && !__fillAfterStroke)
|
|
7219
7349
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7220
7350
|
}
|
|
7221
7351
|
}
|
|
7222
7352
|
else {
|
|
7223
|
-
if (data.__pathInputed)
|
|
7353
|
+
if (data.__pathInputed)
|
|
7224
7354
|
drawFast(this, canvas, options);
|
|
7225
|
-
|
|
7226
|
-
else {
|
|
7355
|
+
else
|
|
7227
7356
|
this.__drawFast(canvas, options);
|
|
7228
|
-
}
|
|
7229
7357
|
}
|
|
7230
7358
|
},
|
|
7231
7359
|
__renderShape(canvas, options, ignoreFill, ignoreStroke) {
|
|
@@ -7234,17 +7362,17 @@ const UIRender = {
|
|
|
7234
7362
|
const { fill, stroke } = this.__;
|
|
7235
7363
|
this.__drawRenderPath(canvas);
|
|
7236
7364
|
if (fill && !ignoreFill)
|
|
7237
|
-
this.__.
|
|
7365
|
+
this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7238
7366
|
if (this.__.__isCanvas)
|
|
7239
7367
|
this.__drawAfterFill(canvas, options);
|
|
7240
7368
|
if (stroke && !ignoreStroke)
|
|
7241
|
-
this.__.
|
|
7369
|
+
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7242
7370
|
}
|
|
7243
7371
|
},
|
|
7244
7372
|
__drawAfterFill(canvas, options) {
|
|
7245
7373
|
if (this.__.__clipAfterFill) {
|
|
7246
7374
|
canvas.save();
|
|
7247
|
-
|
|
7375
|
+
canvas.clipUI();
|
|
7248
7376
|
this.__drawContent(canvas, options);
|
|
7249
7377
|
canvas.restore();
|
|
7250
7378
|
}
|
|
@@ -7253,13 +7381,15 @@ const UIRender = {
|
|
|
7253
7381
|
}
|
|
7254
7382
|
};
|
|
7255
7383
|
function drawFast(ui, canvas, options) {
|
|
7256
|
-
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
7384
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke } = ui.__;
|
|
7257
7385
|
ui.__drawRenderPath(canvas);
|
|
7386
|
+
if (__fillAfterStroke)
|
|
7387
|
+
Paint.stroke(stroke, ui, canvas);
|
|
7258
7388
|
if (fill)
|
|
7259
7389
|
Paint.fill(fill, ui, canvas);
|
|
7260
7390
|
if (__drawAfterFill)
|
|
7261
7391
|
ui.__drawAfterFill(canvas, options);
|
|
7262
|
-
if (stroke)
|
|
7392
|
+
if (stroke && !__fillAfterStroke)
|
|
7263
7393
|
Paint.stroke(stroke, ui, canvas);
|
|
7264
7394
|
}
|
|
7265
7395
|
|
|
@@ -7631,6 +7761,9 @@ __decorate([
|
|
|
7631
7761
|
__decorate([
|
|
7632
7762
|
surfaceType()
|
|
7633
7763
|
], UI.prototype, "placeholderColor", void 0);
|
|
7764
|
+
__decorate([
|
|
7765
|
+
dataType(100)
|
|
7766
|
+
], UI.prototype, "placeholderDelay", void 0);
|
|
7634
7767
|
__decorate([
|
|
7635
7768
|
dataType({})
|
|
7636
7769
|
], UI.prototype, "data", void 0);
|
|
@@ -8032,15 +8165,20 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8032
8165
|
}
|
|
8033
8166
|
__listenEvents() {
|
|
8034
8167
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8035
|
-
this.once(
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8168
|
+
this.once([
|
|
8169
|
+
[LeaferEvent.START, () => Run.end(runId)],
|
|
8170
|
+
[LayoutEvent.START, this.updateLazyBounds, this],
|
|
8171
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
8172
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
8173
|
+
]);
|
|
8174
|
+
this.__eventIds.push(this.on_([
|
|
8175
|
+
[WatchEvent.DATA, this.__onWatchData, this],
|
|
8176
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
8177
|
+
[RenderEvent.NEXT, this.__onNextRender, this]
|
|
8178
|
+
]));
|
|
8040
8179
|
}
|
|
8041
8180
|
__removeListenEvents() {
|
|
8042
8181
|
this.off_(this.__eventIds);
|
|
8043
|
-
this.__eventIds.length = 0;
|
|
8044
8182
|
}
|
|
8045
8183
|
destroy(sync) {
|
|
8046
8184
|
const doDestory = () => {
|
|
@@ -8148,13 +8286,13 @@ let Box = class Box extends Group {
|
|
|
8148
8286
|
super.__updateRenderBounds();
|
|
8149
8287
|
copy$2(childrenRenderBounds, renderBounds);
|
|
8150
8288
|
this.__updateRectRenderBounds();
|
|
8151
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8289
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8152
8290
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8153
8291
|
add(renderBounds, childrenRenderBounds);
|
|
8154
8292
|
}
|
|
8155
8293
|
else
|
|
8156
8294
|
this.__updateRectRenderBounds();
|
|
8157
|
-
|
|
8295
|
+
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8158
8296
|
}
|
|
8159
8297
|
__updateRectRenderBounds() { }
|
|
8160
8298
|
__updateRectChange() { }
|
|
@@ -8458,18 +8596,10 @@ Star = __decorate([
|
|
|
8458
8596
|
|
|
8459
8597
|
let Image = class Image extends Rect {
|
|
8460
8598
|
get __tag() { return 'Image'; }
|
|
8461
|
-
get ready() {
|
|
8599
|
+
get ready() { const { image } = this; return image && image.ready; }
|
|
8600
|
+
get image() { const { fill } = this.__; return fill instanceof Array && fill[0].image; }
|
|
8462
8601
|
constructor(data) {
|
|
8463
8602
|
super(data);
|
|
8464
|
-
this.on_(ImageEvent.LOADED, this.__onLoaded, this);
|
|
8465
|
-
}
|
|
8466
|
-
__onLoaded(e) {
|
|
8467
|
-
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8468
|
-
this.image = e.image;
|
|
8469
|
-
}
|
|
8470
|
-
destroy() {
|
|
8471
|
-
this.image = null;
|
|
8472
|
-
super.destroy();
|
|
8473
8603
|
}
|
|
8474
8604
|
};
|
|
8475
8605
|
__decorate([
|
|
@@ -8485,11 +8615,11 @@ const MyImage = Image;
|
|
|
8485
8615
|
|
|
8486
8616
|
let Canvas = class Canvas extends Rect {
|
|
8487
8617
|
get __tag() { return 'Canvas'; }
|
|
8618
|
+
get context() { return this.canvas.context; }
|
|
8488
8619
|
get ready() { return !this.url; }
|
|
8489
8620
|
constructor(data) {
|
|
8490
8621
|
super(data);
|
|
8491
8622
|
this.canvas = Creator.canvas(this.__);
|
|
8492
|
-
this.context = this.canvas.context;
|
|
8493
8623
|
if (data && data.url)
|
|
8494
8624
|
this.drawImage(data.url);
|
|
8495
8625
|
}
|
|
@@ -8533,7 +8663,7 @@ let Canvas = class Canvas extends Rect {
|
|
|
8533
8663
|
destroy() {
|
|
8534
8664
|
if (this.canvas) {
|
|
8535
8665
|
this.canvas.destroy();
|
|
8536
|
-
this.canvas =
|
|
8666
|
+
this.canvas = null;
|
|
8537
8667
|
}
|
|
8538
8668
|
super.destroy();
|
|
8539
8669
|
}
|
|
@@ -8609,12 +8739,11 @@ let Text = class Text extends UI {
|
|
|
8609
8739
|
super.__updateBoxBounds();
|
|
8610
8740
|
if (italic)
|
|
8611
8741
|
b.width += fontSize * 0.16;
|
|
8612
|
-
|
|
8613
|
-
if (isOverflow)
|
|
8742
|
+
DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds));
|
|
8743
|
+
if (this.isOverflow)
|
|
8614
8744
|
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8615
8745
|
else
|
|
8616
8746
|
data.__textBoxBounds = b;
|
|
8617
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8618
8747
|
}
|
|
8619
8748
|
__onUpdateSize() {
|
|
8620
8749
|
if (this.__box)
|
|
@@ -8728,6 +8857,9 @@ __decorate([
|
|
|
8728
8857
|
__decorate([
|
|
8729
8858
|
boundsType('show')
|
|
8730
8859
|
], Text.prototype, "textOverflow", void 0);
|
|
8860
|
+
__decorate([
|
|
8861
|
+
surfaceType(false)
|
|
8862
|
+
], Text.prototype, "textEditing", void 0);
|
|
8731
8863
|
Text = __decorate([
|
|
8732
8864
|
registerUI()
|
|
8733
8865
|
], Text);
|
|
@@ -8860,35 +8992,38 @@ function fillPathOrText(ui, canvas) {
|
|
|
8860
8992
|
}
|
|
8861
8993
|
|
|
8862
8994
|
function strokeText(stroke, ui, canvas) {
|
|
8863
|
-
|
|
8864
|
-
const isStrokes = typeof stroke !== 'string';
|
|
8865
|
-
switch (strokeAlign) {
|
|
8995
|
+
switch (ui.__.strokeAlign) {
|
|
8866
8996
|
case 'center':
|
|
8867
|
-
|
|
8868
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
8997
|
+
drawCenter$1(stroke, 1, ui, canvas);
|
|
8869
8998
|
break;
|
|
8870
8999
|
case 'inside':
|
|
8871
|
-
|
|
9000
|
+
drawAlign(stroke, 'inside', ui, canvas);
|
|
8872
9001
|
break;
|
|
8873
9002
|
case 'outside':
|
|
8874
|
-
|
|
9003
|
+
ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, 'outside', ui, canvas);
|
|
8875
9004
|
break;
|
|
8876
9005
|
}
|
|
8877
9006
|
}
|
|
8878
|
-
function
|
|
8879
|
-
const
|
|
9007
|
+
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
9008
|
+
const data = ui.__;
|
|
9009
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
|
|
9010
|
+
data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
9011
|
+
}
|
|
9012
|
+
function drawAlign(stroke, align, ui, canvas) {
|
|
8880
9013
|
const out = canvas.getSameCanvas(true, true);
|
|
8881
|
-
out.
|
|
8882
|
-
|
|
8883
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
|
|
9014
|
+
out.font = ui.__.__font;
|
|
9015
|
+
drawCenter$1(stroke, 2, ui, out);
|
|
8884
9016
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
8885
9017
|
fillText(ui, out);
|
|
8886
9018
|
out.blendMode = 'normal';
|
|
8887
|
-
|
|
9019
|
+
copyWorld(canvas, out, ui);
|
|
9020
|
+
out.recycle(ui.__nowWorld);
|
|
9021
|
+
}
|
|
9022
|
+
function copyWorld(canvas, out, ui) {
|
|
9023
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
8888
9024
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
8889
9025
|
else
|
|
8890
9026
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
8891
|
-
out.recycle(ui.__nowWorld);
|
|
8892
9027
|
}
|
|
8893
9028
|
function drawTextStroke(ui, canvas) {
|
|
8894
9029
|
let row, data = ui.__.__textDrawData;
|
|
@@ -8926,90 +9061,56 @@ function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
|
8926
9061
|
}
|
|
8927
9062
|
|
|
8928
9063
|
function stroke(stroke, ui, canvas) {
|
|
8929
|
-
const
|
|
8930
|
-
|
|
8931
|
-
if (!__strokeWidth)
|
|
9064
|
+
const data = ui.__;
|
|
9065
|
+
if (!data.__strokeWidth)
|
|
8932
9066
|
return;
|
|
8933
|
-
if (__font) {
|
|
9067
|
+
if (data.__font) {
|
|
8934
9068
|
strokeText(stroke, ui, canvas);
|
|
8935
9069
|
}
|
|
8936
9070
|
else {
|
|
8937
|
-
switch (strokeAlign) {
|
|
9071
|
+
switch (data.strokeAlign) {
|
|
8938
9072
|
case 'center':
|
|
8939
|
-
|
|
8940
|
-
canvas.stroke();
|
|
8941
|
-
if (options.__useArrow)
|
|
8942
|
-
strokeArrow(ui, canvas);
|
|
9073
|
+
drawCenter(stroke, 1, ui, canvas);
|
|
8943
9074
|
break;
|
|
8944
9075
|
case 'inside':
|
|
8945
|
-
canvas
|
|
8946
|
-
canvas.setStroke(stroke, __strokeWidth * 2, options);
|
|
8947
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
8948
|
-
canvas.stroke();
|
|
8949
|
-
canvas.restore();
|
|
9076
|
+
drawInside(stroke, ui, canvas);
|
|
8950
9077
|
break;
|
|
8951
9078
|
case 'outside':
|
|
8952
|
-
|
|
8953
|
-
out.setStroke(stroke, __strokeWidth * 2, options);
|
|
8954
|
-
ui.__drawRenderPath(out);
|
|
8955
|
-
out.stroke();
|
|
8956
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
8957
|
-
out.clearWorld(ui.__layout.renderBounds);
|
|
8958
|
-
if (ui.__worldFlipped)
|
|
8959
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
8960
|
-
else
|
|
8961
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
8962
|
-
out.recycle(ui.__nowWorld);
|
|
9079
|
+
drawOutside(stroke, ui, canvas);
|
|
8963
9080
|
break;
|
|
8964
9081
|
}
|
|
8965
9082
|
}
|
|
8966
9083
|
}
|
|
8967
9084
|
function strokes(strokes, ui, canvas) {
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
9085
|
+
stroke(strokes, ui, canvas);
|
|
9086
|
+
}
|
|
9087
|
+
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
9088
|
+
const data = ui.__;
|
|
9089
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
9090
|
+
data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
|
|
9091
|
+
if (data.__useArrow)
|
|
9092
|
+
Paint.strokeArrow(stroke, ui, canvas);
|
|
9093
|
+
}
|
|
9094
|
+
function drawInside(stroke, ui, canvas) {
|
|
9095
|
+
canvas.save();
|
|
9096
|
+
canvas.clipUI(ui);
|
|
9097
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
9098
|
+
canvas.restore();
|
|
9099
|
+
}
|
|
9100
|
+
function drawOutside(stroke, ui, canvas) {
|
|
9101
|
+
const data = ui.__;
|
|
9102
|
+
if (data.__fillAfterStroke) {
|
|
9103
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
8974
9104
|
}
|
|
8975
9105
|
else {
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
canvas.save();
|
|
8985
|
-
canvas.setStroke(undefined, __strokeWidth * 2, options);
|
|
8986
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
8987
|
-
drawStrokesStyle(strokes, false, ui, canvas);
|
|
8988
|
-
canvas.restore();
|
|
8989
|
-
break;
|
|
8990
|
-
case 'outside':
|
|
8991
|
-
const { renderBounds } = ui.__layout;
|
|
8992
|
-
const out = canvas.getSameCanvas(true, true);
|
|
8993
|
-
ui.__drawRenderPath(out);
|
|
8994
|
-
out.setStroke(undefined, __strokeWidth * 2, options);
|
|
8995
|
-
drawStrokesStyle(strokes, false, ui, out);
|
|
8996
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
8997
|
-
out.clearWorld(renderBounds);
|
|
8998
|
-
if (ui.__worldFlipped)
|
|
8999
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9000
|
-
else
|
|
9001
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
9002
|
-
out.recycle(ui.__nowWorld);
|
|
9003
|
-
break;
|
|
9004
|
-
}
|
|
9005
|
-
}
|
|
9006
|
-
}
|
|
9007
|
-
function strokeArrow(ui, canvas) {
|
|
9008
|
-
if (ui.__.dashPattern) {
|
|
9009
|
-
canvas.beginPath();
|
|
9010
|
-
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
9011
|
-
canvas.dashPattern = null;
|
|
9012
|
-
canvas.stroke();
|
|
9106
|
+
const { renderBounds } = ui.__layout;
|
|
9107
|
+
const out = canvas.getSameCanvas(true, true);
|
|
9108
|
+
ui.__drawRenderPath(out);
|
|
9109
|
+
drawCenter(stroke, 2, ui, out);
|
|
9110
|
+
out.clipUI(data);
|
|
9111
|
+
out.clearWorld(renderBounds);
|
|
9112
|
+
copyWorld(canvas, out, ui);
|
|
9113
|
+
out.recycle(ui.__nowWorld);
|
|
9013
9114
|
}
|
|
9014
9115
|
}
|
|
9015
9116
|
|
|
@@ -9056,41 +9157,66 @@ function shape(ui, current, options) {
|
|
|
9056
9157
|
}
|
|
9057
9158
|
|
|
9058
9159
|
let recycleMap;
|
|
9160
|
+
const { stintSet } = DataHelper, { hasTransparent: hasTransparent$1 } = ColorConvert;
|
|
9059
9161
|
function compute(attrName, ui) {
|
|
9060
9162
|
const data = ui.__, leafPaints = [];
|
|
9061
|
-
let paints = data.__input[attrName],
|
|
9163
|
+
let paints = data.__input[attrName], isAlphaPixel, isTransparent;
|
|
9062
9164
|
if (!(paints instanceof Array))
|
|
9063
9165
|
paints = [paints];
|
|
9064
9166
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
9065
9167
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
9066
|
-
item = getLeafPaint(attrName, paints[i], ui);
|
|
9067
|
-
if (item)
|
|
9068
|
-
leafPaints.push(item);
|
|
9168
|
+
(item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
|
|
9069
9169
|
}
|
|
9070
9170
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
9071
|
-
if (leafPaints.length
|
|
9072
|
-
|
|
9073
|
-
|
|
9171
|
+
if (leafPaints.length) {
|
|
9172
|
+
if (leafPaints.every(item => item.isTransparent)) {
|
|
9173
|
+
if (leafPaints.some(item => item.image))
|
|
9174
|
+
isAlphaPixel = true;
|
|
9175
|
+
isTransparent = true;
|
|
9176
|
+
}
|
|
9177
|
+
}
|
|
9178
|
+
if (attrName === 'fill') {
|
|
9179
|
+
stintSet(data, '__isAlphaPixelFill', isAlphaPixel);
|
|
9180
|
+
stintSet(data, '__isTransparentFill', isTransparent);
|
|
9181
|
+
}
|
|
9182
|
+
else {
|
|
9183
|
+
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
9184
|
+
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
9185
|
+
}
|
|
9074
9186
|
}
|
|
9075
9187
|
function getLeafPaint(attrName, paint, ui) {
|
|
9076
9188
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
|
9077
9189
|
return undefined;
|
|
9190
|
+
let data;
|
|
9078
9191
|
const { boxBounds } = ui.__layout;
|
|
9079
9192
|
switch (paint.type) {
|
|
9080
|
-
case 'solid':
|
|
9081
|
-
let { type, blendMode, color, opacity } = paint;
|
|
9082
|
-
return { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
9083
9193
|
case 'image':
|
|
9084
|
-
|
|
9194
|
+
data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
9195
|
+
break;
|
|
9085
9196
|
case 'linear':
|
|
9086
|
-
|
|
9197
|
+
data = PaintGradient.linearGradient(paint, boxBounds);
|
|
9198
|
+
break;
|
|
9087
9199
|
case 'radial':
|
|
9088
|
-
|
|
9200
|
+
data = PaintGradient.radialGradient(paint, boxBounds);
|
|
9201
|
+
break;
|
|
9089
9202
|
case 'angular':
|
|
9090
|
-
|
|
9203
|
+
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
9204
|
+
break;
|
|
9205
|
+
case 'solid':
|
|
9206
|
+
const { type, color, opacity } = paint;
|
|
9207
|
+
data = { type, style: ColorConvert.string(color, opacity) };
|
|
9208
|
+
break;
|
|
9091
9209
|
default:
|
|
9092
|
-
|
|
9210
|
+
if (paint.r !== undefined)
|
|
9211
|
+
data = { type: 'solid', style: ColorConvert.string(paint) };
|
|
9093
9212
|
}
|
|
9213
|
+
if (data) {
|
|
9214
|
+
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
9215
|
+
data.isTransparent = true;
|
|
9216
|
+
if (paint.blendMode)
|
|
9217
|
+
data.blendMode = paint.blendMode;
|
|
9218
|
+
}
|
|
9219
|
+
return data;
|
|
9094
9220
|
}
|
|
9095
9221
|
|
|
9096
9222
|
const PaintModule = {
|
|
@@ -9156,12 +9282,10 @@ function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, al
|
|
|
9156
9282
|
|
|
9157
9283
|
const { get: get$2, translate } = MatrixHelper;
|
|
9158
9284
|
const tempBox = new Bounds();
|
|
9159
|
-
const tempPoint = {};
|
|
9160
9285
|
const tempScaleData = {};
|
|
9286
|
+
const tempImage = {};
|
|
9161
9287
|
function createData(leafPaint, image, paint, box) {
|
|
9162
|
-
const {
|
|
9163
|
-
if (blendMode)
|
|
9164
|
-
leafPaint.blendMode = blendMode;
|
|
9288
|
+
const { changeful, sync } = paint;
|
|
9165
9289
|
if (changeful)
|
|
9166
9290
|
leafPaint.changeful = changeful;
|
|
9167
9291
|
if (sync)
|
|
@@ -9169,38 +9293,38 @@ function createData(leafPaint, image, paint, box) {
|
|
|
9169
9293
|
leafPaint.data = getPatternData(paint, box, image);
|
|
9170
9294
|
}
|
|
9171
9295
|
function getPatternData(paint, box, image) {
|
|
9172
|
-
let { width, height } = image;
|
|
9173
9296
|
if (paint.padding)
|
|
9174
9297
|
box = tempBox.set(box).shrink(paint.padding);
|
|
9175
9298
|
if (paint.mode === 'strench')
|
|
9176
9299
|
paint.mode = 'stretch';
|
|
9300
|
+
let { width, height } = image;
|
|
9177
9301
|
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
9178
9302
|
const sameBox = box.width === width && box.height === height;
|
|
9179
9303
|
const data = { mode };
|
|
9180
9304
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
9181
|
-
|
|
9182
|
-
let
|
|
9305
|
+
BoundsHelper.set(tempImage, 0, 0, swapSize ? height : width, swapSize ? width : height);
|
|
9306
|
+
let scaleX, scaleY;
|
|
9183
9307
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
9184
9308
|
if (!sameBox || rotation) {
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9309
|
+
scaleX = scaleY = BoundsHelper.getFitScale(box, tempImage, mode !== 'fit');
|
|
9310
|
+
BoundsHelper.put(box, image, align, scaleX, false, tempImage);
|
|
9311
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
9188
9312
|
}
|
|
9189
9313
|
}
|
|
9190
|
-
else
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9314
|
+
else {
|
|
9315
|
+
if (scale || size) {
|
|
9316
|
+
MathHelper.getScaleData(scale, size, image, tempScaleData);
|
|
9317
|
+
scaleX = tempScaleData.scaleX;
|
|
9318
|
+
scaleY = tempScaleData.scaleY;
|
|
9319
|
+
}
|
|
9320
|
+
if (align) {
|
|
9321
|
+
if (scaleX)
|
|
9322
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
9323
|
+
AlignHelper.toPoint(align, tempImage, box, tempImage, true, true);
|
|
9324
|
+
}
|
|
9201
9325
|
}
|
|
9202
9326
|
if (offset)
|
|
9203
|
-
|
|
9327
|
+
PointHelper.move(tempImage, offset);
|
|
9204
9328
|
switch (mode) {
|
|
9205
9329
|
case 'stretch':
|
|
9206
9330
|
if (!sameBox)
|
|
@@ -9208,12 +9332,12 @@ function getPatternData(paint, box, image) {
|
|
|
9208
9332
|
break;
|
|
9209
9333
|
case 'normal':
|
|
9210
9334
|
case 'clip':
|
|
9211
|
-
if (x || y || scaleX || rotation)
|
|
9212
|
-
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
9335
|
+
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
9336
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9213
9337
|
break;
|
|
9214
9338
|
case 'repeat':
|
|
9215
9339
|
if (!sameBox || scaleX || rotation)
|
|
9216
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
9340
|
+
repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, align);
|
|
9217
9341
|
if (!repeat)
|
|
9218
9342
|
data.repeat = 'repeat';
|
|
9219
9343
|
break;
|
|
@@ -9221,7 +9345,7 @@ function getPatternData(paint, box, image) {
|
|
|
9221
9345
|
case 'cover':
|
|
9222
9346
|
default:
|
|
9223
9347
|
if (scaleX)
|
|
9224
|
-
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
9348
|
+
fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9225
9349
|
}
|
|
9226
9350
|
if (!data.transform) {
|
|
9227
9351
|
if (box.x || box.y) {
|
|
@@ -9254,6 +9378,8 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
9254
9378
|
}
|
|
9255
9379
|
else {
|
|
9256
9380
|
leafPaint = { type: paint.type, image };
|
|
9381
|
+
if (image.hasAlphaPixel)
|
|
9382
|
+
leafPaint.isTransparent = true;
|
|
9257
9383
|
cache = image.use > 1 ? { leafPaint, paint, boxBounds: box.set(boxBounds) } : null;
|
|
9258
9384
|
}
|
|
9259
9385
|
if (firstUse || image.loading)
|
|
@@ -9278,7 +9404,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
9278
9404
|
ignoreRender(ui, false);
|
|
9279
9405
|
if (!ui.destroyed) {
|
|
9280
9406
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
9281
|
-
if (image.
|
|
9407
|
+
if (image.hasAlphaPixel)
|
|
9282
9408
|
ui.__layout.hitCanvasChanged = true;
|
|
9283
9409
|
ui.forceUpdate('surface');
|
|
9284
9410
|
}
|
|
@@ -9290,13 +9416,17 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
9290
9416
|
onLoadError(ui, event, error);
|
|
9291
9417
|
leafPaint.loadId = null;
|
|
9292
9418
|
});
|
|
9293
|
-
if (ui.placeholderColor)
|
|
9294
|
-
|
|
9295
|
-
|
|
9296
|
-
|
|
9297
|
-
|
|
9298
|
-
|
|
9299
|
-
|
|
9419
|
+
if (ui.placeholderColor) {
|
|
9420
|
+
if (!ui.placeholderDelay)
|
|
9421
|
+
image.isPlacehold = true;
|
|
9422
|
+
else
|
|
9423
|
+
setTimeout(() => {
|
|
9424
|
+
if (!image.ready) {
|
|
9425
|
+
image.isPlacehold = true;
|
|
9426
|
+
ui.forceUpdate('surface');
|
|
9427
|
+
}
|
|
9428
|
+
}, ui.placeholderDelay);
|
|
9429
|
+
}
|
|
9300
9430
|
}
|
|
9301
9431
|
return leafPaint;
|
|
9302
9432
|
}
|
|
@@ -9451,7 +9581,7 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
9451
9581
|
}
|
|
9452
9582
|
function drawImage(ui, canvas, paint, data) {
|
|
9453
9583
|
canvas.save();
|
|
9454
|
-
|
|
9584
|
+
canvas.clipUI(ui);
|
|
9455
9585
|
if (paint.blendMode)
|
|
9456
9586
|
canvas.blendMode = paint.blendMode;
|
|
9457
9587
|
if (data.opacity)
|
|
@@ -9502,32 +9632,33 @@ const PaintImageModule = {
|
|
|
9502
9632
|
repeatMode
|
|
9503
9633
|
};
|
|
9504
9634
|
|
|
9505
|
-
const { toPoint: toPoint$2 } = AroundHelper;
|
|
9635
|
+
const { toPoint: toPoint$2 } = AroundHelper, { hasTransparent } = ColorConvert;
|
|
9506
9636
|
const realFrom$2 = {};
|
|
9507
9637
|
const realTo$2 = {};
|
|
9508
9638
|
function linearGradient(paint, box) {
|
|
9509
|
-
let { from, to, type,
|
|
9639
|
+
let { from, to, type, opacity } = paint;
|
|
9510
9640
|
toPoint$2(from || 'top', box, realFrom$2);
|
|
9511
9641
|
toPoint$2(to || 'bottom', box, realTo$2);
|
|
9512
9642
|
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
9513
|
-
applyStops(style, paint.stops, opacity);
|
|
9514
9643
|
const data = { type, style };
|
|
9515
|
-
|
|
9516
|
-
data.blendMode = blendMode;
|
|
9644
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9517
9645
|
return data;
|
|
9518
9646
|
}
|
|
9519
|
-
function applyStops(gradient, stops, opacity) {
|
|
9647
|
+
function applyStops(data, gradient, stops, opacity) {
|
|
9520
9648
|
if (stops) {
|
|
9521
|
-
let stop;
|
|
9649
|
+
let stop, color, offset, isTransparent;
|
|
9522
9650
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
9523
9651
|
stop = stops[i];
|
|
9524
|
-
if (typeof stop === 'string')
|
|
9525
|
-
|
|
9526
|
-
|
|
9527
|
-
|
|
9528
|
-
|
|
9529
|
-
|
|
9652
|
+
if (typeof stop === 'string')
|
|
9653
|
+
offset = i / (len - 1), color = ColorConvert.string(stop, opacity);
|
|
9654
|
+
else
|
|
9655
|
+
offset = stop.offset, color = ColorConvert.string(stop.color, opacity);
|
|
9656
|
+
gradient.addColorStop(offset, color);
|
|
9657
|
+
if (!isTransparent && hasTransparent(color))
|
|
9658
|
+
isTransparent = true;
|
|
9530
9659
|
}
|
|
9660
|
+
if (isTransparent)
|
|
9661
|
+
data.isTransparent = true;
|
|
9531
9662
|
}
|
|
9532
9663
|
}
|
|
9533
9664
|
|
|
@@ -9537,17 +9668,15 @@ const { toPoint: toPoint$1 } = AroundHelper;
|
|
|
9537
9668
|
const realFrom$1 = {};
|
|
9538
9669
|
const realTo$1 = {};
|
|
9539
9670
|
function radialGradient(paint, box) {
|
|
9540
|
-
let { from, to, type, opacity,
|
|
9671
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
9541
9672
|
toPoint$1(from || 'center', box, realFrom$1);
|
|
9542
9673
|
toPoint$1(to || 'bottom', box, realTo$1);
|
|
9543
9674
|
const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$1(realFrom$1, realTo$1));
|
|
9544
|
-
applyStops(style, paint.stops, opacity);
|
|
9545
9675
|
const data = { type, style };
|
|
9676
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9546
9677
|
const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
|
|
9547
9678
|
if (transform)
|
|
9548
9679
|
data.transform = transform;
|
|
9549
|
-
if (blendMode)
|
|
9550
|
-
data.blendMode = blendMode;
|
|
9551
9680
|
return data;
|
|
9552
9681
|
}
|
|
9553
9682
|
function getTransform(box, from, to, stretch, rotate90) {
|
|
@@ -9573,17 +9702,15 @@ const { toPoint } = AroundHelper;
|
|
|
9573
9702
|
const realFrom = {};
|
|
9574
9703
|
const realTo = {};
|
|
9575
9704
|
function conicGradient(paint, box) {
|
|
9576
|
-
let { from, to, type, opacity,
|
|
9705
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
9577
9706
|
toPoint(from || 'center', box, realFrom);
|
|
9578
9707
|
toPoint(to || 'bottom', box, realTo);
|
|
9579
9708
|
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));
|
|
9580
|
-
applyStops(style, paint.stops, opacity);
|
|
9581
9709
|
const data = { type, style };
|
|
9710
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9582
9711
|
const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
|
|
9583
9712
|
if (transform)
|
|
9584
9713
|
data.transform = transform;
|
|
9585
|
-
if (blendMode)
|
|
9586
|
-
data.blendMode = blendMode;
|
|
9587
9714
|
return data;
|
|
9588
9715
|
}
|
|
9589
9716
|
|
|
@@ -9619,12 +9746,10 @@ function shadow(ui, current, shape) {
|
|
|
9619
9746
|
}
|
|
9620
9747
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
9621
9748
|
}
|
|
9622
|
-
if (ui.__worldFlipped)
|
|
9749
|
+
if (ui.__worldFlipped)
|
|
9623
9750
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
9624
|
-
|
|
9625
|
-
else {
|
|
9751
|
+
else
|
|
9626
9752
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
9627
|
-
}
|
|
9628
9753
|
if (end && index < end)
|
|
9629
9754
|
other.clearWorld(copyBounds, true);
|
|
9630
9755
|
});
|
|
@@ -9683,12 +9808,10 @@ function innerShadow(ui, current, shape) {
|
|
|
9683
9808
|
copyBounds = bounds;
|
|
9684
9809
|
}
|
|
9685
9810
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
9686
|
-
if (ui.__worldFlipped)
|
|
9811
|
+
if (ui.__worldFlipped)
|
|
9687
9812
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
9688
|
-
|
|
9689
|
-
else {
|
|
9813
|
+
else
|
|
9690
9814
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
9691
|
-
}
|
|
9692
9815
|
if (end && index < end)
|
|
9693
9816
|
other.clearWorld(copyBounds, true);
|
|
9694
9817
|
});
|
|
@@ -9916,6 +10039,8 @@ function createRows(drawData, content, style) {
|
|
|
9916
10039
|
lastCharType = null;
|
|
9917
10040
|
startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
|
|
9918
10041
|
word = { data: [] }, row = { words: [] };
|
|
10042
|
+
if (__letterSpacing)
|
|
10043
|
+
content = [...content];
|
|
9919
10044
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
9920
10045
|
char = content[i];
|
|
9921
10046
|
if (char === '\n') {
|
|
@@ -10329,4 +10454,4 @@ Object.assign(Effect, EffectModule);
|
|
|
10329
10454
|
|
|
10330
10455
|
useCanvas();
|
|
10331
10456
|
|
|
10332
|
-
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isEmptyData, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$
|
|
10457
|
+
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isEmptyData, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$2 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|