leafer-draw 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/web.cjs +175 -185
- package/dist/web.esm.js +177 -187
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +537 -411
- 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 +536 -411
- 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.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$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;
|
|
@@ -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$9 = 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
|
const debug$4 = Debug.get('LeaferCanvas');
|
|
6148
6239
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6482,17 +6573,15 @@ class Watcher {
|
|
|
6482
6573
|
this.target.emitEvent(new WatchEvent(WatchEvent.DATA, { updatedList: this.updatedList }));
|
|
6483
6574
|
this.__updatedList = new LeafList();
|
|
6484
6575
|
this.totalTimes++;
|
|
6485
|
-
this.changed = false;
|
|
6486
|
-
this.hasVisible = false;
|
|
6487
|
-
this.hasRemove = false;
|
|
6488
|
-
this.hasAdd = false;
|
|
6576
|
+
this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
6489
6577
|
}
|
|
6490
6578
|
__listenEvents() {
|
|
6491
|
-
const { target } = this;
|
|
6492
6579
|
this.__eventIds = [
|
|
6493
|
-
target.on_(
|
|
6494
|
-
|
|
6495
|
-
|
|
6580
|
+
this.target.on_([
|
|
6581
|
+
[PropertyEvent.CHANGE, this.__onAttrChange, this],
|
|
6582
|
+
[[ChildEvent.ADD, ChildEvent.REMOVE], this.__onChildEvent, this],
|
|
6583
|
+
[WatchEvent.REQUEST, this.__onRquestData, this]
|
|
6584
|
+
])
|
|
6496
6585
|
];
|
|
6497
6586
|
}
|
|
6498
6587
|
__removeListenEvents() {
|
|
@@ -6502,8 +6591,7 @@ class Watcher {
|
|
|
6502
6591
|
if (this.target) {
|
|
6503
6592
|
this.stop();
|
|
6504
6593
|
this.__removeListenEvents();
|
|
6505
|
-
this.target = null;
|
|
6506
|
-
this.__updatedList = null;
|
|
6594
|
+
this.target = this.__updatedList = null;
|
|
6507
6595
|
}
|
|
6508
6596
|
}
|
|
6509
6597
|
}
|
|
@@ -6608,7 +6696,7 @@ class Layouter {
|
|
|
6608
6696
|
this.disabled = true;
|
|
6609
6697
|
}
|
|
6610
6698
|
layout() {
|
|
6611
|
-
if (!this.running)
|
|
6699
|
+
if (this.layouting || !this.running)
|
|
6612
6700
|
return;
|
|
6613
6701
|
const { target } = this;
|
|
6614
6702
|
this.times = 0;
|
|
@@ -6691,12 +6779,10 @@ class Layouter {
|
|
|
6691
6779
|
}
|
|
6692
6780
|
static fullLayout(target) {
|
|
6693
6781
|
updateAllMatrix(target, true);
|
|
6694
|
-
if (target.isBranch)
|
|
6782
|
+
if (target.isBranch)
|
|
6695
6783
|
BranchHelper.updateBounds(target);
|
|
6696
|
-
|
|
6697
|
-
else {
|
|
6784
|
+
else
|
|
6698
6785
|
LeafHelper.updateBounds(target);
|
|
6699
|
-
}
|
|
6700
6786
|
updateAllChange(target);
|
|
6701
6787
|
}
|
|
6702
6788
|
addExtra(leaf) {
|
|
@@ -6719,11 +6805,12 @@ class Layouter {
|
|
|
6719
6805
|
this.__updatedList = event.data.updatedList;
|
|
6720
6806
|
}
|
|
6721
6807
|
__listenEvents() {
|
|
6722
|
-
const { target } = this;
|
|
6723
6808
|
this.__eventIds = [
|
|
6724
|
-
target.on_(
|
|
6725
|
-
|
|
6726
|
-
|
|
6809
|
+
this.target.on_([
|
|
6810
|
+
[LayoutEvent.REQUEST, this.layout, this],
|
|
6811
|
+
[LayoutEvent.AGAIN, this.layoutAgain, this],
|
|
6812
|
+
[WatchEvent.DATA, this.__onReceiveWatchData, this]
|
|
6813
|
+
])
|
|
6727
6814
|
];
|
|
6728
6815
|
}
|
|
6729
6816
|
__removeListenEvents() {
|
|
@@ -6954,12 +7041,13 @@ class Renderer {
|
|
|
6954
7041
|
this.target.emitEvent(new RenderEvent(type, this.times, bounds, options));
|
|
6955
7042
|
}
|
|
6956
7043
|
__listenEvents() {
|
|
6957
|
-
const { target } = this;
|
|
6958
7044
|
this.__eventIds = [
|
|
6959
|
-
target.on_(
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
7045
|
+
this.target.on_([
|
|
7046
|
+
[RenderEvent.REQUEST, this.update, this],
|
|
7047
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
7048
|
+
[RenderEvent.AGAIN, this.renderAgain, this],
|
|
7049
|
+
[ResizeEvent.RESIZE, this.__onResize, this]
|
|
7050
|
+
])
|
|
6963
7051
|
];
|
|
6964
7052
|
}
|
|
6965
7053
|
__removeListenEvents() {
|
|
@@ -7018,8 +7106,32 @@ function zoomLayerType() {
|
|
|
7018
7106
|
};
|
|
7019
7107
|
}
|
|
7020
7108
|
|
|
7109
|
+
function hasTransparent$3(color) {
|
|
7110
|
+
if (!color || color.length === 7 || color.length === 4)
|
|
7111
|
+
return false;
|
|
7112
|
+
if (color === 'transparent')
|
|
7113
|
+
return true;
|
|
7114
|
+
const first = color[0];
|
|
7115
|
+
if (first === '#') {
|
|
7116
|
+
switch (color.length) {
|
|
7117
|
+
case 5: return color[4] !== 'f' && color[4] !== 'F';
|
|
7118
|
+
case 9: return (color[7] !== 'f' && color[7] !== 'F') || (color[8] !== 'f' && color[8] !== 'F');
|
|
7119
|
+
}
|
|
7120
|
+
}
|
|
7121
|
+
else if (first === 'r' || first === 'h') {
|
|
7122
|
+
if (color[3] === 'a') {
|
|
7123
|
+
const i = color.lastIndexOf(',');
|
|
7124
|
+
if (i > -1)
|
|
7125
|
+
return parseFloat(color.slice(i + 1)) < 1;
|
|
7126
|
+
}
|
|
7127
|
+
}
|
|
7128
|
+
return false;
|
|
7129
|
+
}
|
|
7130
|
+
|
|
7021
7131
|
const TextConvert = {};
|
|
7022
|
-
const ColorConvert = {
|
|
7132
|
+
const ColorConvert = {
|
|
7133
|
+
hasTransparent: hasTransparent$3
|
|
7134
|
+
};
|
|
7023
7135
|
const UnitConvert = {
|
|
7024
7136
|
number(value, percentRefer) {
|
|
7025
7137
|
return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
|
|
@@ -7045,6 +7157,7 @@ const Transition = {
|
|
|
7045
7157
|
};
|
|
7046
7158
|
|
|
7047
7159
|
const { parse, objectToCanvasData } = PathConvert;
|
|
7160
|
+
const { stintSet: stintSet$2 } = DataHelper, { hasTransparent: hasTransparent$2 } = ColorConvert;
|
|
7048
7161
|
const emptyPaint = {};
|
|
7049
7162
|
const debug$1 = Debug.get('UIData');
|
|
7050
7163
|
class UIData extends LeafData {
|
|
@@ -7103,38 +7216,22 @@ class UIData extends LeafData {
|
|
|
7103
7216
|
if (this.__naturalWidth)
|
|
7104
7217
|
this.__removeNaturalSize();
|
|
7105
7218
|
if (typeof value === 'string' || !value) {
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
PaintImage.recycleImage('fill', this);
|
|
7109
|
-
this.__isFills = false;
|
|
7110
|
-
this.__pixelFill && (this.__pixelFill = false);
|
|
7111
|
-
}
|
|
7219
|
+
stintSet$2(this, '__isTransparentFill', hasTransparent$2(value));
|
|
7220
|
+
this.__isFills && this.__removePaint('fill', true);
|
|
7112
7221
|
this._fill = value;
|
|
7113
7222
|
}
|
|
7114
7223
|
else if (typeof value === 'object') {
|
|
7115
|
-
this.
|
|
7116
|
-
const layout = this.__leaf.__layout;
|
|
7117
|
-
layout.boxChanged || layout.boxChange();
|
|
7118
|
-
this.__isFills = true;
|
|
7119
|
-
this._fill || (this._fill = emptyPaint);
|
|
7224
|
+
this.__setPaint('fill', value);
|
|
7120
7225
|
}
|
|
7121
7226
|
}
|
|
7122
7227
|
setStroke(value) {
|
|
7123
7228
|
if (typeof value === 'string' || !value) {
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
PaintImage.recycleImage('stroke', this);
|
|
7127
|
-
this.__isStrokes = false;
|
|
7128
|
-
this.__pixelStroke && (this.__pixelStroke = false);
|
|
7129
|
-
}
|
|
7229
|
+
stintSet$2(this, '__isTransparentStroke', hasTransparent$2(value));
|
|
7230
|
+
this.__isStrokes && this.__removePaint('stroke', true);
|
|
7130
7231
|
this._stroke = value;
|
|
7131
7232
|
}
|
|
7132
7233
|
else if (typeof value === 'object') {
|
|
7133
|
-
this.
|
|
7134
|
-
const layout = this.__leaf.__layout;
|
|
7135
|
-
layout.boxChanged || layout.boxChange();
|
|
7136
|
-
this.__isStrokes = true;
|
|
7137
|
-
this._stroke || (this._stroke = emptyPaint);
|
|
7234
|
+
this.__setPaint('stroke', value);
|
|
7138
7235
|
}
|
|
7139
7236
|
}
|
|
7140
7237
|
setPath(value) {
|
|
@@ -7164,7 +7261,34 @@ class UIData extends LeafData {
|
|
|
7164
7261
|
Paint.compute('fill', this.__leaf);
|
|
7165
7262
|
if (stroke)
|
|
7166
7263
|
Paint.compute('stroke', this.__leaf);
|
|
7167
|
-
this.__needComputePaint =
|
|
7264
|
+
this.__needComputePaint = undefined;
|
|
7265
|
+
}
|
|
7266
|
+
__setPaint(attrName, value) {
|
|
7267
|
+
this.__setInput(attrName, value);
|
|
7268
|
+
const layout = this.__leaf.__layout;
|
|
7269
|
+
layout.boxChanged || layout.boxChange();
|
|
7270
|
+
if (value instanceof Array && !value.length) {
|
|
7271
|
+
this.__removePaint(attrName);
|
|
7272
|
+
}
|
|
7273
|
+
else {
|
|
7274
|
+
if (attrName === 'fill')
|
|
7275
|
+
this.__isFills = true, this._fill || (this._fill = emptyPaint);
|
|
7276
|
+
else
|
|
7277
|
+
this.__isStrokes = true, this._stroke || (this._stroke = emptyPaint);
|
|
7278
|
+
}
|
|
7279
|
+
}
|
|
7280
|
+
__removePaint(attrName, removeInput) {
|
|
7281
|
+
if (removeInput)
|
|
7282
|
+
this.__removeInput(attrName);
|
|
7283
|
+
PaintImage.recycleImage(attrName, this);
|
|
7284
|
+
if (attrName === 'fill') {
|
|
7285
|
+
stintSet$2(this, '__isAlphaPixelFill', undefined);
|
|
7286
|
+
this._fill = this.__isFills = undefined;
|
|
7287
|
+
}
|
|
7288
|
+
else {
|
|
7289
|
+
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7290
|
+
this._stroke = this.__isStrokes = undefined;
|
|
7291
|
+
}
|
|
7168
7292
|
}
|
|
7169
7293
|
}
|
|
7170
7294
|
function setArray(data, key, value) {
|
|
@@ -7172,10 +7296,10 @@ function setArray(data, key, value) {
|
|
|
7172
7296
|
if (value instanceof Array) {
|
|
7173
7297
|
if (value.some((item) => item.visible === false))
|
|
7174
7298
|
value = value.filter((item) => item.visible !== false);
|
|
7175
|
-
value.length || (value =
|
|
7299
|
+
value.length || (value = undefined);
|
|
7176
7300
|
}
|
|
7177
7301
|
else
|
|
7178
|
-
value = value && value.visible !== false ? [value] :
|
|
7302
|
+
value = value && value.visible !== false ? [value] : undefined;
|
|
7179
7303
|
data['_' + key] = value;
|
|
7180
7304
|
}
|
|
7181
7305
|
|
|
@@ -7278,8 +7402,6 @@ class ImageData extends RectData {
|
|
|
7278
7402
|
this._url = value;
|
|
7279
7403
|
}
|
|
7280
7404
|
__setImageFill(value) {
|
|
7281
|
-
if (this.__leaf.image)
|
|
7282
|
-
this.__leaf.image = null;
|
|
7283
7405
|
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
7284
7406
|
}
|
|
7285
7407
|
__getData() {
|
|
@@ -7345,21 +7467,19 @@ const UIBounds = {
|
|
|
7345
7467
|
}
|
|
7346
7468
|
};
|
|
7347
7469
|
|
|
7470
|
+
const { stintSet: stintSet$1 } = DataHelper;
|
|
7348
7471
|
const UIRender = {
|
|
7349
7472
|
__updateChange() {
|
|
7350
|
-
const data = this.__
|
|
7473
|
+
const data = this.__;
|
|
7351
7474
|
if (data.__useEffect) {
|
|
7352
|
-
const { shadow,
|
|
7353
|
-
data.
|
|
7475
|
+
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7476
|
+
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')));
|
|
7477
|
+
data.__useEffect = !!(shadow || otherEffect);
|
|
7354
7478
|
}
|
|
7355
|
-
|
|
7356
|
-
|
|
7479
|
+
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7480
|
+
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7357
7481
|
data.__checkSingle();
|
|
7358
|
-
|
|
7359
|
-
if (complex)
|
|
7360
|
-
data.__complex = true;
|
|
7361
|
-
else
|
|
7362
|
-
data.__complex && (data.__complex = false);
|
|
7482
|
+
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7363
7483
|
},
|
|
7364
7484
|
__drawFast(canvas, options) {
|
|
7365
7485
|
drawFast(this, canvas, options);
|
|
@@ -7369,21 +7489,23 @@ const UIRender = {
|
|
|
7369
7489
|
if (data.__complex) {
|
|
7370
7490
|
if (data.__needComputePaint)
|
|
7371
7491
|
data.__computePaint();
|
|
7372
|
-
const { fill, stroke, __drawAfterFill } = data;
|
|
7492
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke, __isFastShadow } = data;
|
|
7373
7493
|
this.__drawRenderPath(canvas);
|
|
7374
|
-
if (data.__useEffect) {
|
|
7494
|
+
if (data.__useEffect && !__isFastShadow) {
|
|
7375
7495
|
const shape = Paint.shape(this, canvas, options);
|
|
7376
7496
|
this.__nowWorld = this.__getNowWorld(options);
|
|
7377
7497
|
const { shadow, innerShadow, filter } = data;
|
|
7378
7498
|
if (shadow)
|
|
7379
7499
|
Effect.shadow(this, canvas, shape);
|
|
7500
|
+
if (__fillAfterStroke)
|
|
7501
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7380
7502
|
if (fill)
|
|
7381
7503
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7382
7504
|
if (__drawAfterFill)
|
|
7383
7505
|
this.__drawAfterFill(canvas, options);
|
|
7384
7506
|
if (innerShadow)
|
|
7385
7507
|
Effect.innerShadow(this, canvas, shape);
|
|
7386
|
-
if (stroke)
|
|
7508
|
+
if (stroke && !__fillAfterStroke)
|
|
7387
7509
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7388
7510
|
if (filter)
|
|
7389
7511
|
Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
@@ -7392,21 +7514,27 @@ const UIRender = {
|
|
|
7392
7514
|
shape.canvas.recycle();
|
|
7393
7515
|
}
|
|
7394
7516
|
else {
|
|
7517
|
+
if (__fillAfterStroke)
|
|
7518
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7519
|
+
if (__isFastShadow) {
|
|
7520
|
+
const shadow = data.shadow[0], { scaleX, scaleY } = this.__nowWorld;
|
|
7521
|
+
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
7522
|
+
}
|
|
7395
7523
|
if (fill)
|
|
7396
7524
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7525
|
+
if (__isFastShadow)
|
|
7526
|
+
canvas.restore();
|
|
7397
7527
|
if (__drawAfterFill)
|
|
7398
7528
|
this.__drawAfterFill(canvas, options);
|
|
7399
|
-
if (stroke)
|
|
7529
|
+
if (stroke && !__fillAfterStroke)
|
|
7400
7530
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7401
7531
|
}
|
|
7402
7532
|
}
|
|
7403
7533
|
else {
|
|
7404
|
-
if (data.__pathInputed)
|
|
7534
|
+
if (data.__pathInputed)
|
|
7405
7535
|
drawFast(this, canvas, options);
|
|
7406
|
-
|
|
7407
|
-
else {
|
|
7536
|
+
else
|
|
7408
7537
|
this.__drawFast(canvas, options);
|
|
7409
|
-
}
|
|
7410
7538
|
}
|
|
7411
7539
|
},
|
|
7412
7540
|
__renderShape(canvas, options, ignoreFill, ignoreStroke) {
|
|
@@ -7415,17 +7543,17 @@ const UIRender = {
|
|
|
7415
7543
|
const { fill, stroke } = this.__;
|
|
7416
7544
|
this.__drawRenderPath(canvas);
|
|
7417
7545
|
if (fill && !ignoreFill)
|
|
7418
|
-
this.__.
|
|
7546
|
+
this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7419
7547
|
if (this.__.__isCanvas)
|
|
7420
7548
|
this.__drawAfterFill(canvas, options);
|
|
7421
7549
|
if (stroke && !ignoreStroke)
|
|
7422
|
-
this.__.
|
|
7550
|
+
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7423
7551
|
}
|
|
7424
7552
|
},
|
|
7425
7553
|
__drawAfterFill(canvas, options) {
|
|
7426
7554
|
if (this.__.__clipAfterFill) {
|
|
7427
7555
|
canvas.save();
|
|
7428
|
-
|
|
7556
|
+
canvas.clipUI();
|
|
7429
7557
|
this.__drawContent(canvas, options);
|
|
7430
7558
|
canvas.restore();
|
|
7431
7559
|
}
|
|
@@ -7434,13 +7562,15 @@ const UIRender = {
|
|
|
7434
7562
|
}
|
|
7435
7563
|
};
|
|
7436
7564
|
function drawFast(ui, canvas, options) {
|
|
7437
|
-
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
7565
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke } = ui.__;
|
|
7438
7566
|
ui.__drawRenderPath(canvas);
|
|
7567
|
+
if (__fillAfterStroke)
|
|
7568
|
+
Paint.stroke(stroke, ui, canvas);
|
|
7439
7569
|
if (fill)
|
|
7440
7570
|
Paint.fill(fill, ui, canvas);
|
|
7441
7571
|
if (__drawAfterFill)
|
|
7442
7572
|
ui.__drawAfterFill(canvas, options);
|
|
7443
|
-
if (stroke)
|
|
7573
|
+
if (stroke && !__fillAfterStroke)
|
|
7444
7574
|
Paint.stroke(stroke, ui, canvas);
|
|
7445
7575
|
}
|
|
7446
7576
|
|
|
@@ -7812,6 +7942,9 @@ __decorate([
|
|
|
7812
7942
|
__decorate([
|
|
7813
7943
|
surfaceType()
|
|
7814
7944
|
], UI.prototype, "placeholderColor", void 0);
|
|
7945
|
+
__decorate([
|
|
7946
|
+
dataType(100)
|
|
7947
|
+
], UI.prototype, "placeholderDelay", void 0);
|
|
7815
7948
|
__decorate([
|
|
7816
7949
|
dataType({})
|
|
7817
7950
|
], UI.prototype, "data", void 0);
|
|
@@ -8213,15 +8346,20 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8213
8346
|
}
|
|
8214
8347
|
__listenEvents() {
|
|
8215
8348
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8216
|
-
this.once(
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8349
|
+
this.once([
|
|
8350
|
+
[LeaferEvent.START, () => Run.end(runId)],
|
|
8351
|
+
[LayoutEvent.START, this.updateLazyBounds, this],
|
|
8352
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
8353
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
8354
|
+
]);
|
|
8355
|
+
this.__eventIds.push(this.on_([
|
|
8356
|
+
[WatchEvent.DATA, this.__onWatchData, this],
|
|
8357
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
8358
|
+
[RenderEvent.NEXT, this.__onNextRender, this]
|
|
8359
|
+
]));
|
|
8221
8360
|
}
|
|
8222
8361
|
__removeListenEvents() {
|
|
8223
8362
|
this.off_(this.__eventIds);
|
|
8224
|
-
this.__eventIds.length = 0;
|
|
8225
8363
|
}
|
|
8226
8364
|
destroy(sync) {
|
|
8227
8365
|
const doDestory = () => {
|
|
@@ -8329,13 +8467,13 @@ let Box = class Box extends Group {
|
|
|
8329
8467
|
super.__updateRenderBounds();
|
|
8330
8468
|
copy$2(childrenRenderBounds, renderBounds);
|
|
8331
8469
|
this.__updateRectRenderBounds();
|
|
8332
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8470
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8333
8471
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8334
8472
|
add(renderBounds, childrenRenderBounds);
|
|
8335
8473
|
}
|
|
8336
8474
|
else
|
|
8337
8475
|
this.__updateRectRenderBounds();
|
|
8338
|
-
|
|
8476
|
+
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8339
8477
|
}
|
|
8340
8478
|
__updateRectRenderBounds() { }
|
|
8341
8479
|
__updateRectChange() { }
|
|
@@ -8639,18 +8777,10 @@ Star = __decorate([
|
|
|
8639
8777
|
|
|
8640
8778
|
let Image$1 = class Image extends Rect {
|
|
8641
8779
|
get __tag() { return 'Image'; }
|
|
8642
|
-
get ready() {
|
|
8780
|
+
get ready() { const { image } = this; return image && image.ready; }
|
|
8781
|
+
get image() { const { fill } = this.__; return fill instanceof Array && fill[0].image; }
|
|
8643
8782
|
constructor(data) {
|
|
8644
8783
|
super(data);
|
|
8645
|
-
this.on_(ImageEvent.LOADED, this.__onLoaded, this);
|
|
8646
|
-
}
|
|
8647
|
-
__onLoaded(e) {
|
|
8648
|
-
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8649
|
-
this.image = e.image;
|
|
8650
|
-
}
|
|
8651
|
-
destroy() {
|
|
8652
|
-
this.image = null;
|
|
8653
|
-
super.destroy();
|
|
8654
8784
|
}
|
|
8655
8785
|
};
|
|
8656
8786
|
__decorate([
|
|
@@ -8666,11 +8796,11 @@ const MyImage = Image$1;
|
|
|
8666
8796
|
|
|
8667
8797
|
let Canvas = class Canvas extends Rect {
|
|
8668
8798
|
get __tag() { return 'Canvas'; }
|
|
8799
|
+
get context() { return this.canvas.context; }
|
|
8669
8800
|
get ready() { return !this.url; }
|
|
8670
8801
|
constructor(data) {
|
|
8671
8802
|
super(data);
|
|
8672
8803
|
this.canvas = Creator.canvas(this.__);
|
|
8673
|
-
this.context = this.canvas.context;
|
|
8674
8804
|
if (data && data.url)
|
|
8675
8805
|
this.drawImage(data.url);
|
|
8676
8806
|
}
|
|
@@ -8714,7 +8844,7 @@ let Canvas = class Canvas extends Rect {
|
|
|
8714
8844
|
destroy() {
|
|
8715
8845
|
if (this.canvas) {
|
|
8716
8846
|
this.canvas.destroy();
|
|
8717
|
-
this.canvas =
|
|
8847
|
+
this.canvas = null;
|
|
8718
8848
|
}
|
|
8719
8849
|
super.destroy();
|
|
8720
8850
|
}
|
|
@@ -8790,12 +8920,11 @@ let Text = class Text extends UI {
|
|
|
8790
8920
|
super.__updateBoxBounds();
|
|
8791
8921
|
if (italic)
|
|
8792
8922
|
b.width += fontSize * 0.16;
|
|
8793
|
-
|
|
8794
|
-
if (isOverflow)
|
|
8923
|
+
DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds));
|
|
8924
|
+
if (this.isOverflow)
|
|
8795
8925
|
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8796
8926
|
else
|
|
8797
8927
|
data.__textBoxBounds = b;
|
|
8798
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8799
8928
|
}
|
|
8800
8929
|
__onUpdateSize() {
|
|
8801
8930
|
if (this.__box)
|
|
@@ -8909,6 +9038,9 @@ __decorate([
|
|
|
8909
9038
|
__decorate([
|
|
8910
9039
|
boundsType('show')
|
|
8911
9040
|
], Text.prototype, "textOverflow", void 0);
|
|
9041
|
+
__decorate([
|
|
9042
|
+
surfaceType(false)
|
|
9043
|
+
], Text.prototype, "textEditing", void 0);
|
|
8912
9044
|
Text = __decorate([
|
|
8913
9045
|
registerUI()
|
|
8914
9046
|
], Text);
|
|
@@ -9041,35 +9173,38 @@ function fillPathOrText(ui, canvas) {
|
|
|
9041
9173
|
}
|
|
9042
9174
|
|
|
9043
9175
|
function strokeText(stroke, ui, canvas) {
|
|
9044
|
-
|
|
9045
|
-
const isStrokes = typeof stroke !== 'string';
|
|
9046
|
-
switch (strokeAlign) {
|
|
9176
|
+
switch (ui.__.strokeAlign) {
|
|
9047
9177
|
case 'center':
|
|
9048
|
-
|
|
9049
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
9178
|
+
drawCenter$1(stroke, 1, ui, canvas);
|
|
9050
9179
|
break;
|
|
9051
9180
|
case 'inside':
|
|
9052
|
-
|
|
9181
|
+
drawAlign(stroke, 'inside', ui, canvas);
|
|
9053
9182
|
break;
|
|
9054
9183
|
case 'outside':
|
|
9055
|
-
|
|
9184
|
+
ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, 'outside', ui, canvas);
|
|
9056
9185
|
break;
|
|
9057
9186
|
}
|
|
9058
9187
|
}
|
|
9059
|
-
function
|
|
9060
|
-
const
|
|
9188
|
+
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
9189
|
+
const data = ui.__;
|
|
9190
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
|
|
9191
|
+
data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
9192
|
+
}
|
|
9193
|
+
function drawAlign(stroke, align, ui, canvas) {
|
|
9061
9194
|
const out = canvas.getSameCanvas(true, true);
|
|
9062
|
-
out.
|
|
9063
|
-
|
|
9064
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
|
|
9195
|
+
out.font = ui.__.__font;
|
|
9196
|
+
drawCenter$1(stroke, 2, ui, out);
|
|
9065
9197
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
9066
9198
|
fillText(ui, out);
|
|
9067
9199
|
out.blendMode = 'normal';
|
|
9068
|
-
|
|
9200
|
+
copyWorld(canvas, out, ui);
|
|
9201
|
+
out.recycle(ui.__nowWorld);
|
|
9202
|
+
}
|
|
9203
|
+
function copyWorld(canvas, out, ui) {
|
|
9204
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
9069
9205
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9070
9206
|
else
|
|
9071
9207
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
9072
|
-
out.recycle(ui.__nowWorld);
|
|
9073
9208
|
}
|
|
9074
9209
|
function drawTextStroke(ui, canvas) {
|
|
9075
9210
|
let row, data = ui.__.__textDrawData;
|
|
@@ -9107,90 +9242,56 @@ function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
|
9107
9242
|
}
|
|
9108
9243
|
|
|
9109
9244
|
function stroke(stroke, ui, canvas) {
|
|
9110
|
-
const
|
|
9111
|
-
|
|
9112
|
-
if (!__strokeWidth)
|
|
9245
|
+
const data = ui.__;
|
|
9246
|
+
if (!data.__strokeWidth)
|
|
9113
9247
|
return;
|
|
9114
|
-
if (__font) {
|
|
9248
|
+
if (data.__font) {
|
|
9115
9249
|
strokeText(stroke, ui, canvas);
|
|
9116
9250
|
}
|
|
9117
9251
|
else {
|
|
9118
|
-
switch (strokeAlign) {
|
|
9252
|
+
switch (data.strokeAlign) {
|
|
9119
9253
|
case 'center':
|
|
9120
|
-
|
|
9121
|
-
canvas.stroke();
|
|
9122
|
-
if (options.__useArrow)
|
|
9123
|
-
strokeArrow(ui, canvas);
|
|
9254
|
+
drawCenter(stroke, 1, ui, canvas);
|
|
9124
9255
|
break;
|
|
9125
9256
|
case 'inside':
|
|
9126
|
-
canvas
|
|
9127
|
-
canvas.setStroke(stroke, __strokeWidth * 2, options);
|
|
9128
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
9129
|
-
canvas.stroke();
|
|
9130
|
-
canvas.restore();
|
|
9257
|
+
drawInside(stroke, ui, canvas);
|
|
9131
9258
|
break;
|
|
9132
9259
|
case 'outside':
|
|
9133
|
-
|
|
9134
|
-
out.setStroke(stroke, __strokeWidth * 2, options);
|
|
9135
|
-
ui.__drawRenderPath(out);
|
|
9136
|
-
out.stroke();
|
|
9137
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
9138
|
-
out.clearWorld(ui.__layout.renderBounds);
|
|
9139
|
-
if (ui.__worldFlipped)
|
|
9140
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9141
|
-
else
|
|
9142
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
9143
|
-
out.recycle(ui.__nowWorld);
|
|
9260
|
+
drawOutside(stroke, ui, canvas);
|
|
9144
9261
|
break;
|
|
9145
9262
|
}
|
|
9146
9263
|
}
|
|
9147
9264
|
}
|
|
9148
9265
|
function strokes(strokes, ui, canvas) {
|
|
9149
|
-
|
|
9150
|
-
|
|
9151
|
-
|
|
9152
|
-
|
|
9153
|
-
|
|
9154
|
-
|
|
9266
|
+
stroke(strokes, ui, canvas);
|
|
9267
|
+
}
|
|
9268
|
+
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
9269
|
+
const data = ui.__;
|
|
9270
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
9271
|
+
data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
|
|
9272
|
+
if (data.__useArrow)
|
|
9273
|
+
Paint.strokeArrow(stroke, ui, canvas);
|
|
9274
|
+
}
|
|
9275
|
+
function drawInside(stroke, ui, canvas) {
|
|
9276
|
+
canvas.save();
|
|
9277
|
+
canvas.clipUI(ui);
|
|
9278
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
9279
|
+
canvas.restore();
|
|
9280
|
+
}
|
|
9281
|
+
function drawOutside(stroke, ui, canvas) {
|
|
9282
|
+
const data = ui.__;
|
|
9283
|
+
if (data.__fillAfterStroke) {
|
|
9284
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
9155
9285
|
}
|
|
9156
9286
|
else {
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
canvas.save();
|
|
9166
|
-
canvas.setStroke(undefined, __strokeWidth * 2, options);
|
|
9167
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
9168
|
-
drawStrokesStyle(strokes, false, ui, canvas);
|
|
9169
|
-
canvas.restore();
|
|
9170
|
-
break;
|
|
9171
|
-
case 'outside':
|
|
9172
|
-
const { renderBounds } = ui.__layout;
|
|
9173
|
-
const out = canvas.getSameCanvas(true, true);
|
|
9174
|
-
ui.__drawRenderPath(out);
|
|
9175
|
-
out.setStroke(undefined, __strokeWidth * 2, options);
|
|
9176
|
-
drawStrokesStyle(strokes, false, ui, out);
|
|
9177
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
9178
|
-
out.clearWorld(renderBounds);
|
|
9179
|
-
if (ui.__worldFlipped)
|
|
9180
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9181
|
-
else
|
|
9182
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
9183
|
-
out.recycle(ui.__nowWorld);
|
|
9184
|
-
break;
|
|
9185
|
-
}
|
|
9186
|
-
}
|
|
9187
|
-
}
|
|
9188
|
-
function strokeArrow(ui, canvas) {
|
|
9189
|
-
if (ui.__.dashPattern) {
|
|
9190
|
-
canvas.beginPath();
|
|
9191
|
-
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
9192
|
-
canvas.dashPattern = null;
|
|
9193
|
-
canvas.stroke();
|
|
9287
|
+
const { renderBounds } = ui.__layout;
|
|
9288
|
+
const out = canvas.getSameCanvas(true, true);
|
|
9289
|
+
ui.__drawRenderPath(out);
|
|
9290
|
+
drawCenter(stroke, 2, ui, out);
|
|
9291
|
+
out.clipUI(data);
|
|
9292
|
+
out.clearWorld(renderBounds);
|
|
9293
|
+
copyWorld(canvas, out, ui);
|
|
9294
|
+
out.recycle(ui.__nowWorld);
|
|
9194
9295
|
}
|
|
9195
9296
|
}
|
|
9196
9297
|
|
|
@@ -9237,41 +9338,66 @@ function shape(ui, current, options) {
|
|
|
9237
9338
|
}
|
|
9238
9339
|
|
|
9239
9340
|
let recycleMap;
|
|
9341
|
+
const { stintSet } = DataHelper, { hasTransparent: hasTransparent$1 } = ColorConvert;
|
|
9240
9342
|
function compute(attrName, ui) {
|
|
9241
9343
|
const data = ui.__, leafPaints = [];
|
|
9242
|
-
let paints = data.__input[attrName],
|
|
9344
|
+
let paints = data.__input[attrName], isAlphaPixel, isTransparent;
|
|
9243
9345
|
if (!(paints instanceof Array))
|
|
9244
9346
|
paints = [paints];
|
|
9245
9347
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
9246
9348
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
9247
|
-
item = getLeafPaint(attrName, paints[i], ui);
|
|
9248
|
-
if (item)
|
|
9249
|
-
leafPaints.push(item);
|
|
9349
|
+
(item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
|
|
9250
9350
|
}
|
|
9251
9351
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
9252
|
-
if (leafPaints.length
|
|
9253
|
-
|
|
9254
|
-
|
|
9352
|
+
if (leafPaints.length) {
|
|
9353
|
+
if (leafPaints.every(item => item.isTransparent)) {
|
|
9354
|
+
if (leafPaints.some(item => item.image))
|
|
9355
|
+
isAlphaPixel = true;
|
|
9356
|
+
isTransparent = true;
|
|
9357
|
+
}
|
|
9358
|
+
}
|
|
9359
|
+
if (attrName === 'fill') {
|
|
9360
|
+
stintSet(data, '__isAlphaPixelFill', isAlphaPixel);
|
|
9361
|
+
stintSet(data, '__isTransparentFill', isTransparent);
|
|
9362
|
+
}
|
|
9363
|
+
else {
|
|
9364
|
+
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
9365
|
+
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
9366
|
+
}
|
|
9255
9367
|
}
|
|
9256
9368
|
function getLeafPaint(attrName, paint, ui) {
|
|
9257
9369
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
|
9258
9370
|
return undefined;
|
|
9371
|
+
let data;
|
|
9259
9372
|
const { boxBounds } = ui.__layout;
|
|
9260
9373
|
switch (paint.type) {
|
|
9261
|
-
case 'solid':
|
|
9262
|
-
let { type, blendMode, color, opacity } = paint;
|
|
9263
|
-
return { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
9264
9374
|
case 'image':
|
|
9265
|
-
|
|
9375
|
+
data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
9376
|
+
break;
|
|
9266
9377
|
case 'linear':
|
|
9267
|
-
|
|
9378
|
+
data = PaintGradient.linearGradient(paint, boxBounds);
|
|
9379
|
+
break;
|
|
9268
9380
|
case 'radial':
|
|
9269
|
-
|
|
9381
|
+
data = PaintGradient.radialGradient(paint, boxBounds);
|
|
9382
|
+
break;
|
|
9270
9383
|
case 'angular':
|
|
9271
|
-
|
|
9384
|
+
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
9385
|
+
break;
|
|
9386
|
+
case 'solid':
|
|
9387
|
+
const { type, color, opacity } = paint;
|
|
9388
|
+
data = { type, style: ColorConvert.string(color, opacity) };
|
|
9389
|
+
break;
|
|
9272
9390
|
default:
|
|
9273
|
-
|
|
9391
|
+
if (paint.r !== undefined)
|
|
9392
|
+
data = { type: 'solid', style: ColorConvert.string(paint) };
|
|
9274
9393
|
}
|
|
9394
|
+
if (data) {
|
|
9395
|
+
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
9396
|
+
data.isTransparent = true;
|
|
9397
|
+
if (paint.blendMode)
|
|
9398
|
+
data.blendMode = paint.blendMode;
|
|
9399
|
+
}
|
|
9400
|
+
return data;
|
|
9275
9401
|
}
|
|
9276
9402
|
|
|
9277
9403
|
const PaintModule = {
|
|
@@ -9337,12 +9463,10 @@ function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, al
|
|
|
9337
9463
|
|
|
9338
9464
|
const { get: get$2, translate } = MatrixHelper;
|
|
9339
9465
|
const tempBox = new Bounds();
|
|
9340
|
-
const tempPoint = {};
|
|
9341
9466
|
const tempScaleData = {};
|
|
9467
|
+
const tempImage = {};
|
|
9342
9468
|
function createData(leafPaint, image, paint, box) {
|
|
9343
|
-
const {
|
|
9344
|
-
if (blendMode)
|
|
9345
|
-
leafPaint.blendMode = blendMode;
|
|
9469
|
+
const { changeful, sync } = paint;
|
|
9346
9470
|
if (changeful)
|
|
9347
9471
|
leafPaint.changeful = changeful;
|
|
9348
9472
|
if (sync)
|
|
@@ -9350,38 +9474,38 @@ function createData(leafPaint, image, paint, box) {
|
|
|
9350
9474
|
leafPaint.data = getPatternData(paint, box, image);
|
|
9351
9475
|
}
|
|
9352
9476
|
function getPatternData(paint, box, image) {
|
|
9353
|
-
let { width, height } = image;
|
|
9354
9477
|
if (paint.padding)
|
|
9355
9478
|
box = tempBox.set(box).shrink(paint.padding);
|
|
9356
9479
|
if (paint.mode === 'strench')
|
|
9357
9480
|
paint.mode = 'stretch';
|
|
9481
|
+
let { width, height } = image;
|
|
9358
9482
|
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
9359
9483
|
const sameBox = box.width === width && box.height === height;
|
|
9360
9484
|
const data = { mode };
|
|
9361
9485
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
9362
|
-
|
|
9363
|
-
let
|
|
9486
|
+
BoundsHelper.set(tempImage, 0, 0, swapSize ? height : width, swapSize ? width : height);
|
|
9487
|
+
let scaleX, scaleY;
|
|
9364
9488
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
9365
9489
|
if (!sameBox || rotation) {
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9490
|
+
scaleX = scaleY = BoundsHelper.getFitScale(box, tempImage, mode !== 'fit');
|
|
9491
|
+
BoundsHelper.put(box, image, align, scaleX, false, tempImage);
|
|
9492
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
9369
9493
|
}
|
|
9370
9494
|
}
|
|
9371
|
-
else
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9495
|
+
else {
|
|
9496
|
+
if (scale || size) {
|
|
9497
|
+
MathHelper.getScaleData(scale, size, image, tempScaleData);
|
|
9498
|
+
scaleX = tempScaleData.scaleX;
|
|
9499
|
+
scaleY = tempScaleData.scaleY;
|
|
9500
|
+
}
|
|
9501
|
+
if (align) {
|
|
9502
|
+
if (scaleX)
|
|
9503
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
9504
|
+
AlignHelper.toPoint(align, tempImage, box, tempImage, true, true);
|
|
9505
|
+
}
|
|
9382
9506
|
}
|
|
9383
9507
|
if (offset)
|
|
9384
|
-
|
|
9508
|
+
PointHelper.move(tempImage, offset);
|
|
9385
9509
|
switch (mode) {
|
|
9386
9510
|
case 'stretch':
|
|
9387
9511
|
if (!sameBox)
|
|
@@ -9389,12 +9513,12 @@ function getPatternData(paint, box, image) {
|
|
|
9389
9513
|
break;
|
|
9390
9514
|
case 'normal':
|
|
9391
9515
|
case 'clip':
|
|
9392
|
-
if (x || y || scaleX || rotation)
|
|
9393
|
-
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
9516
|
+
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
9517
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9394
9518
|
break;
|
|
9395
9519
|
case 'repeat':
|
|
9396
9520
|
if (!sameBox || scaleX || rotation)
|
|
9397
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
9521
|
+
repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, align);
|
|
9398
9522
|
if (!repeat)
|
|
9399
9523
|
data.repeat = 'repeat';
|
|
9400
9524
|
break;
|
|
@@ -9402,7 +9526,7 @@ function getPatternData(paint, box, image) {
|
|
|
9402
9526
|
case 'cover':
|
|
9403
9527
|
default:
|
|
9404
9528
|
if (scaleX)
|
|
9405
|
-
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
9529
|
+
fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9406
9530
|
}
|
|
9407
9531
|
if (!data.transform) {
|
|
9408
9532
|
if (box.x || box.y) {
|
|
@@ -9435,6 +9559,8 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
9435
9559
|
}
|
|
9436
9560
|
else {
|
|
9437
9561
|
leafPaint = { type: paint.type, image };
|
|
9562
|
+
if (image.hasAlphaPixel)
|
|
9563
|
+
leafPaint.isTransparent = true;
|
|
9438
9564
|
cache = image.use > 1 ? { leafPaint, paint, boxBounds: box.set(boxBounds) } : null;
|
|
9439
9565
|
}
|
|
9440
9566
|
if (firstUse || image.loading)
|
|
@@ -9459,7 +9585,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
9459
9585
|
ignoreRender(ui, false);
|
|
9460
9586
|
if (!ui.destroyed) {
|
|
9461
9587
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
9462
|
-
if (image.
|
|
9588
|
+
if (image.hasAlphaPixel)
|
|
9463
9589
|
ui.__layout.hitCanvasChanged = true;
|
|
9464
9590
|
ui.forceUpdate('surface');
|
|
9465
9591
|
}
|
|
@@ -9471,13 +9597,17 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
9471
9597
|
onLoadError(ui, event, error);
|
|
9472
9598
|
leafPaint.loadId = null;
|
|
9473
9599
|
});
|
|
9474
|
-
if (ui.placeholderColor)
|
|
9475
|
-
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9600
|
+
if (ui.placeholderColor) {
|
|
9601
|
+
if (!ui.placeholderDelay)
|
|
9602
|
+
image.isPlacehold = true;
|
|
9603
|
+
else
|
|
9604
|
+
setTimeout(() => {
|
|
9605
|
+
if (!image.ready) {
|
|
9606
|
+
image.isPlacehold = true;
|
|
9607
|
+
ui.forceUpdate('surface');
|
|
9608
|
+
}
|
|
9609
|
+
}, ui.placeholderDelay);
|
|
9610
|
+
}
|
|
9481
9611
|
}
|
|
9482
9612
|
return leafPaint;
|
|
9483
9613
|
}
|
|
@@ -9632,7 +9762,7 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
9632
9762
|
}
|
|
9633
9763
|
function drawImage(ui, canvas, paint, data) {
|
|
9634
9764
|
canvas.save();
|
|
9635
|
-
|
|
9765
|
+
canvas.clipUI(ui);
|
|
9636
9766
|
if (paint.blendMode)
|
|
9637
9767
|
canvas.blendMode = paint.blendMode;
|
|
9638
9768
|
if (data.opacity)
|
|
@@ -9683,32 +9813,33 @@ const PaintImageModule = {
|
|
|
9683
9813
|
repeatMode
|
|
9684
9814
|
};
|
|
9685
9815
|
|
|
9686
|
-
const { toPoint: toPoint$2 } = AroundHelper;
|
|
9816
|
+
const { toPoint: toPoint$2 } = AroundHelper, { hasTransparent } = ColorConvert;
|
|
9687
9817
|
const realFrom$2 = {};
|
|
9688
9818
|
const realTo$2 = {};
|
|
9689
9819
|
function linearGradient(paint, box) {
|
|
9690
|
-
let { from, to, type,
|
|
9820
|
+
let { from, to, type, opacity } = paint;
|
|
9691
9821
|
toPoint$2(from || 'top', box, realFrom$2);
|
|
9692
9822
|
toPoint$2(to || 'bottom', box, realTo$2);
|
|
9693
9823
|
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
9694
|
-
applyStops(style, paint.stops, opacity);
|
|
9695
9824
|
const data = { type, style };
|
|
9696
|
-
|
|
9697
|
-
data.blendMode = blendMode;
|
|
9825
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9698
9826
|
return data;
|
|
9699
9827
|
}
|
|
9700
|
-
function applyStops(gradient, stops, opacity) {
|
|
9828
|
+
function applyStops(data, gradient, stops, opacity) {
|
|
9701
9829
|
if (stops) {
|
|
9702
|
-
let stop;
|
|
9830
|
+
let stop, color, offset, isTransparent;
|
|
9703
9831
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
9704
9832
|
stop = stops[i];
|
|
9705
|
-
if (typeof stop === 'string')
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
|
|
9833
|
+
if (typeof stop === 'string')
|
|
9834
|
+
offset = i / (len - 1), color = ColorConvert.string(stop, opacity);
|
|
9835
|
+
else
|
|
9836
|
+
offset = stop.offset, color = ColorConvert.string(stop.color, opacity);
|
|
9837
|
+
gradient.addColorStop(offset, color);
|
|
9838
|
+
if (!isTransparent && hasTransparent(color))
|
|
9839
|
+
isTransparent = true;
|
|
9711
9840
|
}
|
|
9841
|
+
if (isTransparent)
|
|
9842
|
+
data.isTransparent = true;
|
|
9712
9843
|
}
|
|
9713
9844
|
}
|
|
9714
9845
|
|
|
@@ -9718,17 +9849,15 @@ const { toPoint: toPoint$1 } = AroundHelper;
|
|
|
9718
9849
|
const realFrom$1 = {};
|
|
9719
9850
|
const realTo$1 = {};
|
|
9720
9851
|
function radialGradient(paint, box) {
|
|
9721
|
-
let { from, to, type, opacity,
|
|
9852
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
9722
9853
|
toPoint$1(from || 'center', box, realFrom$1);
|
|
9723
9854
|
toPoint$1(to || 'bottom', box, realTo$1);
|
|
9724
9855
|
const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$1(realFrom$1, realTo$1));
|
|
9725
|
-
applyStops(style, paint.stops, opacity);
|
|
9726
9856
|
const data = { type, style };
|
|
9857
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9727
9858
|
const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
|
|
9728
9859
|
if (transform)
|
|
9729
9860
|
data.transform = transform;
|
|
9730
|
-
if (blendMode)
|
|
9731
|
-
data.blendMode = blendMode;
|
|
9732
9861
|
return data;
|
|
9733
9862
|
}
|
|
9734
9863
|
function getTransform(box, from, to, stretch, rotate90) {
|
|
@@ -9754,17 +9883,15 @@ const { toPoint } = AroundHelper;
|
|
|
9754
9883
|
const realFrom = {};
|
|
9755
9884
|
const realTo = {};
|
|
9756
9885
|
function conicGradient(paint, box) {
|
|
9757
|
-
let { from, to, type, opacity,
|
|
9886
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
9758
9887
|
toPoint(from || 'center', box, realFrom);
|
|
9759
9888
|
toPoint(to || 'bottom', box, realTo);
|
|
9760
9889
|
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));
|
|
9761
|
-
applyStops(style, paint.stops, opacity);
|
|
9762
9890
|
const data = { type, style };
|
|
9891
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9763
9892
|
const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
|
|
9764
9893
|
if (transform)
|
|
9765
9894
|
data.transform = transform;
|
|
9766
|
-
if (blendMode)
|
|
9767
|
-
data.blendMode = blendMode;
|
|
9768
9895
|
return data;
|
|
9769
9896
|
}
|
|
9770
9897
|
|
|
@@ -9800,12 +9927,10 @@ function shadow(ui, current, shape) {
|
|
|
9800
9927
|
}
|
|
9801
9928
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
9802
9929
|
}
|
|
9803
|
-
if (ui.__worldFlipped)
|
|
9930
|
+
if (ui.__worldFlipped)
|
|
9804
9931
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
9805
|
-
|
|
9806
|
-
else {
|
|
9932
|
+
else
|
|
9807
9933
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
9808
|
-
}
|
|
9809
9934
|
if (end && index < end)
|
|
9810
9935
|
other.clearWorld(copyBounds, true);
|
|
9811
9936
|
});
|
|
@@ -9864,12 +9989,10 @@ function innerShadow(ui, current, shape) {
|
|
|
9864
9989
|
copyBounds = bounds;
|
|
9865
9990
|
}
|
|
9866
9991
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
9867
|
-
if (ui.__worldFlipped)
|
|
9992
|
+
if (ui.__worldFlipped)
|
|
9868
9993
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
9869
|
-
|
|
9870
|
-
else {
|
|
9994
|
+
else
|
|
9871
9995
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
9872
|
-
}
|
|
9873
9996
|
if (end && index < end)
|
|
9874
9997
|
other.clearWorld(copyBounds, true);
|
|
9875
9998
|
});
|
|
@@ -10097,6 +10220,8 @@ function createRows(drawData, content, style) {
|
|
|
10097
10220
|
lastCharType = null;
|
|
10098
10221
|
startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
|
|
10099
10222
|
word = { data: [] }, row = { words: [] };
|
|
10223
|
+
if (__letterSpacing)
|
|
10224
|
+
content = [...content];
|
|
10100
10225
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
10101
10226
|
char = content[i];
|
|
10102
10227
|
if (char === '\n') {
|
|
@@ -10510,4 +10635,4 @@ Object.assign(Effect, EffectModule);
|
|
|
10510
10635
|
|
|
10511
10636
|
useCanvas();
|
|
10512
10637
|
|
|
10513
|
-
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$
|
|
10638
|
+
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 };
|