leafer-ui 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 +555 -427
- 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 +554 -427
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +11 -11
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$f = 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$a = 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$1.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$6 } = 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$5 } =
|
|
|
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$5 = 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() {
|
|
@@ -7175,8 +7263,32 @@ function zoomLayerType() {
|
|
|
7175
7263
|
};
|
|
7176
7264
|
}
|
|
7177
7265
|
|
|
7266
|
+
function hasTransparent$3(color) {
|
|
7267
|
+
if (!color || color.length === 7 || color.length === 4)
|
|
7268
|
+
return false;
|
|
7269
|
+
if (color === 'transparent')
|
|
7270
|
+
return true;
|
|
7271
|
+
const first = color[0];
|
|
7272
|
+
if (first === '#') {
|
|
7273
|
+
switch (color.length) {
|
|
7274
|
+
case 5: return color[4] !== 'f' && color[4] !== 'F';
|
|
7275
|
+
case 9: return (color[7] !== 'f' && color[7] !== 'F') || (color[8] !== 'f' && color[8] !== 'F');
|
|
7276
|
+
}
|
|
7277
|
+
}
|
|
7278
|
+
else if (first === 'r' || first === 'h') {
|
|
7279
|
+
if (color[3] === 'a') {
|
|
7280
|
+
const i = color.lastIndexOf(',');
|
|
7281
|
+
if (i > -1)
|
|
7282
|
+
return parseFloat(color.slice(i + 1)) < 1;
|
|
7283
|
+
}
|
|
7284
|
+
}
|
|
7285
|
+
return false;
|
|
7286
|
+
}
|
|
7287
|
+
|
|
7178
7288
|
const TextConvert = {};
|
|
7179
|
-
const ColorConvert = {
|
|
7289
|
+
const ColorConvert = {
|
|
7290
|
+
hasTransparent: hasTransparent$3
|
|
7291
|
+
};
|
|
7180
7292
|
const UnitConvert = {
|
|
7181
7293
|
number(value, percentRefer) {
|
|
7182
7294
|
return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
|
|
@@ -7202,6 +7314,7 @@ const Transition = {
|
|
|
7202
7314
|
};
|
|
7203
7315
|
|
|
7204
7316
|
const { parse, objectToCanvasData } = PathConvert;
|
|
7317
|
+
const { stintSet: stintSet$2 } = DataHelper, { hasTransparent: hasTransparent$2 } = ColorConvert;
|
|
7205
7318
|
const emptyPaint = {};
|
|
7206
7319
|
const debug$2 = Debug.get('UIData');
|
|
7207
7320
|
class UIData extends LeafData {
|
|
@@ -7260,38 +7373,22 @@ class UIData extends LeafData {
|
|
|
7260
7373
|
if (this.__naturalWidth)
|
|
7261
7374
|
this.__removeNaturalSize();
|
|
7262
7375
|
if (typeof value === 'string' || !value) {
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
PaintImage.recycleImage('fill', this);
|
|
7266
|
-
this.__isFills = false;
|
|
7267
|
-
this.__pixelFill && (this.__pixelFill = false);
|
|
7268
|
-
}
|
|
7376
|
+
stintSet$2(this, '__isTransparentFill', hasTransparent$2(value));
|
|
7377
|
+
this.__isFills && this.__removePaint('fill', true);
|
|
7269
7378
|
this._fill = value;
|
|
7270
7379
|
}
|
|
7271
7380
|
else if (typeof value === 'object') {
|
|
7272
|
-
this.
|
|
7273
|
-
const layout = this.__leaf.__layout;
|
|
7274
|
-
layout.boxChanged || layout.boxChange();
|
|
7275
|
-
this.__isFills = true;
|
|
7276
|
-
this._fill || (this._fill = emptyPaint);
|
|
7381
|
+
this.__setPaint('fill', value);
|
|
7277
7382
|
}
|
|
7278
7383
|
}
|
|
7279
7384
|
setStroke(value) {
|
|
7280
7385
|
if (typeof value === 'string' || !value) {
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
PaintImage.recycleImage('stroke', this);
|
|
7284
|
-
this.__isStrokes = false;
|
|
7285
|
-
this.__pixelStroke && (this.__pixelStroke = false);
|
|
7286
|
-
}
|
|
7386
|
+
stintSet$2(this, '__isTransparentStroke', hasTransparent$2(value));
|
|
7387
|
+
this.__isStrokes && this.__removePaint('stroke', true);
|
|
7287
7388
|
this._stroke = value;
|
|
7288
7389
|
}
|
|
7289
7390
|
else if (typeof value === 'object') {
|
|
7290
|
-
this.
|
|
7291
|
-
const layout = this.__leaf.__layout;
|
|
7292
|
-
layout.boxChanged || layout.boxChange();
|
|
7293
|
-
this.__isStrokes = true;
|
|
7294
|
-
this._stroke || (this._stroke = emptyPaint);
|
|
7391
|
+
this.__setPaint('stroke', value);
|
|
7295
7392
|
}
|
|
7296
7393
|
}
|
|
7297
7394
|
setPath(value) {
|
|
@@ -7321,7 +7418,34 @@ class UIData extends LeafData {
|
|
|
7321
7418
|
Paint.compute('fill', this.__leaf);
|
|
7322
7419
|
if (stroke)
|
|
7323
7420
|
Paint.compute('stroke', this.__leaf);
|
|
7324
|
-
this.__needComputePaint =
|
|
7421
|
+
this.__needComputePaint = undefined;
|
|
7422
|
+
}
|
|
7423
|
+
__setPaint(attrName, value) {
|
|
7424
|
+
this.__setInput(attrName, value);
|
|
7425
|
+
const layout = this.__leaf.__layout;
|
|
7426
|
+
layout.boxChanged || layout.boxChange();
|
|
7427
|
+
if (value instanceof Array && !value.length) {
|
|
7428
|
+
this.__removePaint(attrName);
|
|
7429
|
+
}
|
|
7430
|
+
else {
|
|
7431
|
+
if (attrName === 'fill')
|
|
7432
|
+
this.__isFills = true, this._fill || (this._fill = emptyPaint);
|
|
7433
|
+
else
|
|
7434
|
+
this.__isStrokes = true, this._stroke || (this._stroke = emptyPaint);
|
|
7435
|
+
}
|
|
7436
|
+
}
|
|
7437
|
+
__removePaint(attrName, removeInput) {
|
|
7438
|
+
if (removeInput)
|
|
7439
|
+
this.__removeInput(attrName);
|
|
7440
|
+
PaintImage.recycleImage(attrName, this);
|
|
7441
|
+
if (attrName === 'fill') {
|
|
7442
|
+
stintSet$2(this, '__isAlphaPixelFill', undefined);
|
|
7443
|
+
this._fill = this.__isFills = undefined;
|
|
7444
|
+
}
|
|
7445
|
+
else {
|
|
7446
|
+
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7447
|
+
this._stroke = this.__isStrokes = undefined;
|
|
7448
|
+
}
|
|
7325
7449
|
}
|
|
7326
7450
|
}
|
|
7327
7451
|
function setArray(data, key, value) {
|
|
@@ -7329,10 +7453,10 @@ function setArray(data, key, value) {
|
|
|
7329
7453
|
if (value instanceof Array) {
|
|
7330
7454
|
if (value.some((item) => item.visible === false))
|
|
7331
7455
|
value = value.filter((item) => item.visible !== false);
|
|
7332
|
-
value.length || (value =
|
|
7456
|
+
value.length || (value = undefined);
|
|
7333
7457
|
}
|
|
7334
7458
|
else
|
|
7335
|
-
value = value && value.visible !== false ? [value] :
|
|
7459
|
+
value = value && value.visible !== false ? [value] : undefined;
|
|
7336
7460
|
data['_' + key] = value;
|
|
7337
7461
|
}
|
|
7338
7462
|
|
|
@@ -7435,8 +7559,6 @@ class ImageData extends RectData {
|
|
|
7435
7559
|
this._url = value;
|
|
7436
7560
|
}
|
|
7437
7561
|
__setImageFill(value) {
|
|
7438
|
-
if (this.__leaf.image)
|
|
7439
|
-
this.__leaf.image = null;
|
|
7440
7562
|
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
7441
7563
|
}
|
|
7442
7564
|
__getData() {
|
|
@@ -7502,21 +7624,19 @@ const UIBounds = {
|
|
|
7502
7624
|
}
|
|
7503
7625
|
};
|
|
7504
7626
|
|
|
7627
|
+
const { stintSet: stintSet$1 } = DataHelper;
|
|
7505
7628
|
const UIRender = {
|
|
7506
7629
|
__updateChange() {
|
|
7507
|
-
const data = this.__
|
|
7630
|
+
const data = this.__;
|
|
7508
7631
|
if (data.__useEffect) {
|
|
7509
|
-
const { shadow,
|
|
7510
|
-
data.
|
|
7632
|
+
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7633
|
+
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')));
|
|
7634
|
+
data.__useEffect = !!(shadow || otherEffect);
|
|
7511
7635
|
}
|
|
7512
|
-
|
|
7513
|
-
|
|
7636
|
+
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7637
|
+
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7514
7638
|
data.__checkSingle();
|
|
7515
|
-
|
|
7516
|
-
if (complex)
|
|
7517
|
-
data.__complex = true;
|
|
7518
|
-
else
|
|
7519
|
-
data.__complex && (data.__complex = false);
|
|
7639
|
+
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7520
7640
|
},
|
|
7521
7641
|
__drawFast(canvas, options) {
|
|
7522
7642
|
drawFast(this, canvas, options);
|
|
@@ -7526,21 +7646,23 @@ const UIRender = {
|
|
|
7526
7646
|
if (data.__complex) {
|
|
7527
7647
|
if (data.__needComputePaint)
|
|
7528
7648
|
data.__computePaint();
|
|
7529
|
-
const { fill, stroke, __drawAfterFill } = data;
|
|
7649
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke, __isFastShadow } = data;
|
|
7530
7650
|
this.__drawRenderPath(canvas);
|
|
7531
|
-
if (data.__useEffect) {
|
|
7651
|
+
if (data.__useEffect && !__isFastShadow) {
|
|
7532
7652
|
const shape = Paint.shape(this, canvas, options);
|
|
7533
7653
|
this.__nowWorld = this.__getNowWorld(options);
|
|
7534
7654
|
const { shadow, innerShadow, filter } = data;
|
|
7535
7655
|
if (shadow)
|
|
7536
7656
|
Effect.shadow(this, canvas, shape);
|
|
7657
|
+
if (__fillAfterStroke)
|
|
7658
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7537
7659
|
if (fill)
|
|
7538
7660
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7539
7661
|
if (__drawAfterFill)
|
|
7540
7662
|
this.__drawAfterFill(canvas, options);
|
|
7541
7663
|
if (innerShadow)
|
|
7542
7664
|
Effect.innerShadow(this, canvas, shape);
|
|
7543
|
-
if (stroke)
|
|
7665
|
+
if (stroke && !__fillAfterStroke)
|
|
7544
7666
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7545
7667
|
if (filter)
|
|
7546
7668
|
Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
@@ -7549,21 +7671,27 @@ const UIRender = {
|
|
|
7549
7671
|
shape.canvas.recycle();
|
|
7550
7672
|
}
|
|
7551
7673
|
else {
|
|
7674
|
+
if (__fillAfterStroke)
|
|
7675
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7676
|
+
if (__isFastShadow) {
|
|
7677
|
+
const shadow = data.shadow[0], { scaleX, scaleY } = this.__nowWorld;
|
|
7678
|
+
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
7679
|
+
}
|
|
7552
7680
|
if (fill)
|
|
7553
7681
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7682
|
+
if (__isFastShadow)
|
|
7683
|
+
canvas.restore();
|
|
7554
7684
|
if (__drawAfterFill)
|
|
7555
7685
|
this.__drawAfterFill(canvas, options);
|
|
7556
|
-
if (stroke)
|
|
7686
|
+
if (stroke && !__fillAfterStroke)
|
|
7557
7687
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7558
7688
|
}
|
|
7559
7689
|
}
|
|
7560
7690
|
else {
|
|
7561
|
-
if (data.__pathInputed)
|
|
7691
|
+
if (data.__pathInputed)
|
|
7562
7692
|
drawFast(this, canvas, options);
|
|
7563
|
-
|
|
7564
|
-
else {
|
|
7693
|
+
else
|
|
7565
7694
|
this.__drawFast(canvas, options);
|
|
7566
|
-
}
|
|
7567
7695
|
}
|
|
7568
7696
|
},
|
|
7569
7697
|
__renderShape(canvas, options, ignoreFill, ignoreStroke) {
|
|
@@ -7572,17 +7700,17 @@ const UIRender = {
|
|
|
7572
7700
|
const { fill, stroke } = this.__;
|
|
7573
7701
|
this.__drawRenderPath(canvas);
|
|
7574
7702
|
if (fill && !ignoreFill)
|
|
7575
|
-
this.__.
|
|
7703
|
+
this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7576
7704
|
if (this.__.__isCanvas)
|
|
7577
7705
|
this.__drawAfterFill(canvas, options);
|
|
7578
7706
|
if (stroke && !ignoreStroke)
|
|
7579
|
-
this.__.
|
|
7707
|
+
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7580
7708
|
}
|
|
7581
7709
|
},
|
|
7582
7710
|
__drawAfterFill(canvas, options) {
|
|
7583
7711
|
if (this.__.__clipAfterFill) {
|
|
7584
7712
|
canvas.save();
|
|
7585
|
-
|
|
7713
|
+
canvas.clipUI();
|
|
7586
7714
|
this.__drawContent(canvas, options);
|
|
7587
7715
|
canvas.restore();
|
|
7588
7716
|
}
|
|
@@ -7591,13 +7719,15 @@ const UIRender = {
|
|
|
7591
7719
|
}
|
|
7592
7720
|
};
|
|
7593
7721
|
function drawFast(ui, canvas, options) {
|
|
7594
|
-
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
7722
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke } = ui.__;
|
|
7595
7723
|
ui.__drawRenderPath(canvas);
|
|
7724
|
+
if (__fillAfterStroke)
|
|
7725
|
+
Paint.stroke(stroke, ui, canvas);
|
|
7596
7726
|
if (fill)
|
|
7597
7727
|
Paint.fill(fill, ui, canvas);
|
|
7598
7728
|
if (__drawAfterFill)
|
|
7599
7729
|
ui.__drawAfterFill(canvas, options);
|
|
7600
|
-
if (stroke)
|
|
7730
|
+
if (stroke && !__fillAfterStroke)
|
|
7601
7731
|
Paint.stroke(stroke, ui, canvas);
|
|
7602
7732
|
}
|
|
7603
7733
|
|
|
@@ -7969,6 +8099,9 @@ __decorate([
|
|
|
7969
8099
|
__decorate([
|
|
7970
8100
|
surfaceType()
|
|
7971
8101
|
], UI.prototype, "placeholderColor", void 0);
|
|
8102
|
+
__decorate([
|
|
8103
|
+
dataType(100)
|
|
8104
|
+
], UI.prototype, "placeholderDelay", void 0);
|
|
7972
8105
|
__decorate([
|
|
7973
8106
|
dataType({})
|
|
7974
8107
|
], UI.prototype, "data", void 0);
|
|
@@ -8370,15 +8503,20 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8370
8503
|
}
|
|
8371
8504
|
__listenEvents() {
|
|
8372
8505
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8373
|
-
this.once(
|
|
8374
|
-
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
|
|
8506
|
+
this.once([
|
|
8507
|
+
[LeaferEvent.START, () => Run.end(runId)],
|
|
8508
|
+
[LayoutEvent.START, this.updateLazyBounds, this],
|
|
8509
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
8510
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
8511
|
+
]);
|
|
8512
|
+
this.__eventIds.push(this.on_([
|
|
8513
|
+
[WatchEvent.DATA, this.__onWatchData, this],
|
|
8514
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
8515
|
+
[RenderEvent.NEXT, this.__onNextRender, this]
|
|
8516
|
+
]));
|
|
8378
8517
|
}
|
|
8379
8518
|
__removeListenEvents() {
|
|
8380
8519
|
this.off_(this.__eventIds);
|
|
8381
|
-
this.__eventIds.length = 0;
|
|
8382
8520
|
}
|
|
8383
8521
|
destroy(sync) {
|
|
8384
8522
|
const doDestory = () => {
|
|
@@ -8486,13 +8624,13 @@ let Box = class Box extends Group {
|
|
|
8486
8624
|
super.__updateRenderBounds();
|
|
8487
8625
|
copy$3(childrenRenderBounds, renderBounds);
|
|
8488
8626
|
this.__updateRectRenderBounds();
|
|
8489
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8627
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8490
8628
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8491
8629
|
add(renderBounds, childrenRenderBounds);
|
|
8492
8630
|
}
|
|
8493
8631
|
else
|
|
8494
8632
|
this.__updateRectRenderBounds();
|
|
8495
|
-
|
|
8633
|
+
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8496
8634
|
}
|
|
8497
8635
|
__updateRectRenderBounds() { }
|
|
8498
8636
|
__updateRectChange() { }
|
|
@@ -8796,18 +8934,10 @@ Star = __decorate([
|
|
|
8796
8934
|
|
|
8797
8935
|
let Image$1 = class Image extends Rect {
|
|
8798
8936
|
get __tag() { return 'Image'; }
|
|
8799
|
-
get ready() {
|
|
8937
|
+
get ready() { const { image } = this; return image && image.ready; }
|
|
8938
|
+
get image() { const { fill } = this.__; return fill instanceof Array && fill[0].image; }
|
|
8800
8939
|
constructor(data) {
|
|
8801
8940
|
super(data);
|
|
8802
|
-
this.on_(ImageEvent.LOADED, this.__onLoaded, this);
|
|
8803
|
-
}
|
|
8804
|
-
__onLoaded(e) {
|
|
8805
|
-
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8806
|
-
this.image = e.image;
|
|
8807
|
-
}
|
|
8808
|
-
destroy() {
|
|
8809
|
-
this.image = null;
|
|
8810
|
-
super.destroy();
|
|
8811
8941
|
}
|
|
8812
8942
|
};
|
|
8813
8943
|
__decorate([
|
|
@@ -8823,11 +8953,11 @@ const MyImage = Image$1;
|
|
|
8823
8953
|
|
|
8824
8954
|
let Canvas = class Canvas extends Rect {
|
|
8825
8955
|
get __tag() { return 'Canvas'; }
|
|
8956
|
+
get context() { return this.canvas.context; }
|
|
8826
8957
|
get ready() { return !this.url; }
|
|
8827
8958
|
constructor(data) {
|
|
8828
8959
|
super(data);
|
|
8829
8960
|
this.canvas = Creator.canvas(this.__);
|
|
8830
|
-
this.context = this.canvas.context;
|
|
8831
8961
|
if (data && data.url)
|
|
8832
8962
|
this.drawImage(data.url);
|
|
8833
8963
|
}
|
|
@@ -8871,7 +9001,7 @@ let Canvas = class Canvas extends Rect {
|
|
|
8871
9001
|
destroy() {
|
|
8872
9002
|
if (this.canvas) {
|
|
8873
9003
|
this.canvas.destroy();
|
|
8874
|
-
this.canvas =
|
|
9004
|
+
this.canvas = null;
|
|
8875
9005
|
}
|
|
8876
9006
|
super.destroy();
|
|
8877
9007
|
}
|
|
@@ -8947,12 +9077,11 @@ let Text = class Text extends UI {
|
|
|
8947
9077
|
super.__updateBoxBounds();
|
|
8948
9078
|
if (italic)
|
|
8949
9079
|
b.width += fontSize * 0.16;
|
|
8950
|
-
|
|
8951
|
-
if (isOverflow)
|
|
9080
|
+
DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds));
|
|
9081
|
+
if (this.isOverflow)
|
|
8952
9082
|
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8953
9083
|
else
|
|
8954
9084
|
data.__textBoxBounds = b;
|
|
8955
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8956
9085
|
}
|
|
8957
9086
|
__onUpdateSize() {
|
|
8958
9087
|
if (this.__box)
|
|
@@ -9066,6 +9195,9 @@ __decorate([
|
|
|
9066
9195
|
__decorate([
|
|
9067
9196
|
boundsType('show')
|
|
9068
9197
|
], Text.prototype, "textOverflow", void 0);
|
|
9198
|
+
__decorate([
|
|
9199
|
+
surfaceType(false)
|
|
9200
|
+
], Text.prototype, "textEditing", void 0);
|
|
9069
9201
|
Text = __decorate([
|
|
9070
9202
|
registerUI()
|
|
9071
9203
|
], Text);
|
|
@@ -9153,7 +9285,7 @@ let App = class App extends Leafer {
|
|
|
9153
9285
|
if (sky || editor)
|
|
9154
9286
|
this.sky = this.addLeafer(sky);
|
|
9155
9287
|
if (editor)
|
|
9156
|
-
|
|
9288
|
+
Creator.editor(editor, this);
|
|
9157
9289
|
}
|
|
9158
9290
|
}
|
|
9159
9291
|
__setApp() {
|
|
@@ -9167,6 +9299,10 @@ let App = class App extends Leafer {
|
|
|
9167
9299
|
this.watcher.disable();
|
|
9168
9300
|
this.layouter.disable();
|
|
9169
9301
|
}
|
|
9302
|
+
__updateLocalBounds() {
|
|
9303
|
+
this.forEach(leafer => leafer.updateLayout());
|
|
9304
|
+
super.__updateLocalBounds();
|
|
9305
|
+
}
|
|
9170
9306
|
start() {
|
|
9171
9307
|
super.start();
|
|
9172
9308
|
this.forEach(leafer => leafer.start());
|
|
@@ -9224,12 +9360,8 @@ let App = class App extends Leafer {
|
|
|
9224
9360
|
this.renderer.update();
|
|
9225
9361
|
}
|
|
9226
9362
|
__render(canvas, options) {
|
|
9227
|
-
if (canvas.context)
|
|
9228
|
-
|
|
9229
|
-
if (m)
|
|
9230
|
-
canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
9231
|
-
this.forEach(leafer => canvas.copyWorld(leafer.canvas));
|
|
9232
|
-
}
|
|
9363
|
+
if (canvas.context)
|
|
9364
|
+
this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
|
|
9233
9365
|
}
|
|
9234
9366
|
__onResize(event) {
|
|
9235
9367
|
this.forEach(leafer => leafer.resize(event));
|
|
@@ -9250,9 +9382,11 @@ let App = class App extends Leafer {
|
|
|
9250
9382
|
return config;
|
|
9251
9383
|
}
|
|
9252
9384
|
__listenChildEvents(leafer) {
|
|
9253
|
-
leafer.once(
|
|
9254
|
-
|
|
9255
|
-
|
|
9385
|
+
leafer.once([
|
|
9386
|
+
[LayoutEvent.END, this.__onReady, this],
|
|
9387
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
9388
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
9389
|
+
]);
|
|
9256
9390
|
if (this.realCanvas)
|
|
9257
9391
|
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9258
9392
|
}
|
|
@@ -9463,7 +9597,7 @@ MoveEvent = __decorate([
|
|
|
9463
9597
|
registerUIEvent()
|
|
9464
9598
|
], MoveEvent);
|
|
9465
9599
|
|
|
9466
|
-
let RotateEvent = class RotateEvent extends
|
|
9600
|
+
let RotateEvent = class RotateEvent extends PointerEvent$1 {
|
|
9467
9601
|
};
|
|
9468
9602
|
RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
|
|
9469
9603
|
RotateEvent.START = 'rotate.start';
|
|
@@ -9484,7 +9618,7 @@ SwipeEvent = __decorate([
|
|
|
9484
9618
|
registerUIEvent()
|
|
9485
9619
|
], SwipeEvent);
|
|
9486
9620
|
|
|
9487
|
-
let ZoomEvent = class ZoomEvent extends
|
|
9621
|
+
let ZoomEvent = class ZoomEvent extends PointerEvent$1 {
|
|
9488
9622
|
};
|
|
9489
9623
|
ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
|
|
9490
9624
|
ZoomEvent.START = 'zoom.start';
|
|
@@ -10327,8 +10461,8 @@ ui$1.__updateHitCanvas = function () {
|
|
|
10327
10461
|
if (this.__box)
|
|
10328
10462
|
this.__box.__updateHitCanvas();
|
|
10329
10463
|
const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
|
|
10330
|
-
const isHitPixelFill = (data.
|
|
10331
|
-
const isHitPixelStroke = data.
|
|
10464
|
+
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
10465
|
+
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
10332
10466
|
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
10333
10467
|
if (!this.__hitCanvas)
|
|
10334
10468
|
this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
|
|
@@ -10359,11 +10493,11 @@ ui$1.__hit = function (inner) {
|
|
|
10359
10493
|
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
10360
10494
|
return true;
|
|
10361
10495
|
const { hitFill } = data;
|
|
10362
|
-
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.
|
|
10496
|
+
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
10363
10497
|
if (needHitFillPath && this.__hitFill(inner))
|
|
10364
10498
|
return true;
|
|
10365
10499
|
const { hitStroke, __strokeWidth } = data;
|
|
10366
|
-
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.
|
|
10500
|
+
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
10367
10501
|
if (!needHitFillPath && !needHitStrokePath)
|
|
10368
10502
|
return false;
|
|
10369
10503
|
const radiusWidth = inner.radiusX * 2;
|
|
@@ -10813,35 +10947,38 @@ function fillPathOrText(ui, canvas) {
|
|
|
10813
10947
|
}
|
|
10814
10948
|
|
|
10815
10949
|
function strokeText(stroke, ui, canvas) {
|
|
10816
|
-
|
|
10817
|
-
const isStrokes = typeof stroke !== 'string';
|
|
10818
|
-
switch (strokeAlign) {
|
|
10950
|
+
switch (ui.__.strokeAlign) {
|
|
10819
10951
|
case 'center':
|
|
10820
|
-
|
|
10821
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
10952
|
+
drawCenter$1(stroke, 1, ui, canvas);
|
|
10822
10953
|
break;
|
|
10823
10954
|
case 'inside':
|
|
10824
|
-
|
|
10955
|
+
drawAlign(stroke, 'inside', ui, canvas);
|
|
10825
10956
|
break;
|
|
10826
10957
|
case 'outside':
|
|
10827
|
-
|
|
10958
|
+
ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, 'outside', ui, canvas);
|
|
10828
10959
|
break;
|
|
10829
10960
|
}
|
|
10830
10961
|
}
|
|
10831
|
-
function
|
|
10832
|
-
const
|
|
10962
|
+
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
10963
|
+
const data = ui.__;
|
|
10964
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
|
|
10965
|
+
data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
10966
|
+
}
|
|
10967
|
+
function drawAlign(stroke, align, ui, canvas) {
|
|
10833
10968
|
const out = canvas.getSameCanvas(true, true);
|
|
10834
|
-
out.
|
|
10835
|
-
|
|
10836
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
|
|
10969
|
+
out.font = ui.__.__font;
|
|
10970
|
+
drawCenter$1(stroke, 2, ui, out);
|
|
10837
10971
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10838
10972
|
fillText(ui, out);
|
|
10839
10973
|
out.blendMode = 'normal';
|
|
10840
|
-
|
|
10974
|
+
copyWorld(canvas, out, ui);
|
|
10975
|
+
out.recycle(ui.__nowWorld);
|
|
10976
|
+
}
|
|
10977
|
+
function copyWorld(canvas, out, ui) {
|
|
10978
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
10841
10979
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10842
10980
|
else
|
|
10843
10981
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10844
|
-
out.recycle(ui.__nowWorld);
|
|
10845
10982
|
}
|
|
10846
10983
|
function drawTextStroke(ui, canvas) {
|
|
10847
10984
|
let row, data = ui.__.__textDrawData;
|
|
@@ -10879,90 +11016,56 @@ function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
|
10879
11016
|
}
|
|
10880
11017
|
|
|
10881
11018
|
function stroke(stroke, ui, canvas) {
|
|
10882
|
-
const
|
|
10883
|
-
|
|
10884
|
-
if (!__strokeWidth)
|
|
11019
|
+
const data = ui.__;
|
|
11020
|
+
if (!data.__strokeWidth)
|
|
10885
11021
|
return;
|
|
10886
|
-
if (__font) {
|
|
11022
|
+
if (data.__font) {
|
|
10887
11023
|
strokeText(stroke, ui, canvas);
|
|
10888
11024
|
}
|
|
10889
11025
|
else {
|
|
10890
|
-
switch (strokeAlign) {
|
|
11026
|
+
switch (data.strokeAlign) {
|
|
10891
11027
|
case 'center':
|
|
10892
|
-
|
|
10893
|
-
canvas.stroke();
|
|
10894
|
-
if (options.__useArrow)
|
|
10895
|
-
strokeArrow(ui, canvas);
|
|
11028
|
+
drawCenter(stroke, 1, ui, canvas);
|
|
10896
11029
|
break;
|
|
10897
11030
|
case 'inside':
|
|
10898
|
-
canvas
|
|
10899
|
-
canvas.setStroke(stroke, __strokeWidth * 2, options);
|
|
10900
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
10901
|
-
canvas.stroke();
|
|
10902
|
-
canvas.restore();
|
|
11031
|
+
drawInside(stroke, ui, canvas);
|
|
10903
11032
|
break;
|
|
10904
11033
|
case 'outside':
|
|
10905
|
-
|
|
10906
|
-
out.setStroke(stroke, __strokeWidth * 2, options);
|
|
10907
|
-
ui.__drawRenderPath(out);
|
|
10908
|
-
out.stroke();
|
|
10909
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10910
|
-
out.clearWorld(ui.__layout.renderBounds);
|
|
10911
|
-
if (ui.__worldFlipped)
|
|
10912
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10913
|
-
else
|
|
10914
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10915
|
-
out.recycle(ui.__nowWorld);
|
|
11034
|
+
drawOutside(stroke, ui, canvas);
|
|
10916
11035
|
break;
|
|
10917
11036
|
}
|
|
10918
11037
|
}
|
|
10919
11038
|
}
|
|
10920
11039
|
function strokes(strokes, ui, canvas) {
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
|
|
11040
|
+
stroke(strokes, ui, canvas);
|
|
11041
|
+
}
|
|
11042
|
+
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
11043
|
+
const data = ui.__;
|
|
11044
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
11045
|
+
data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
|
|
11046
|
+
if (data.__useArrow)
|
|
11047
|
+
Paint.strokeArrow(stroke, ui, canvas);
|
|
11048
|
+
}
|
|
11049
|
+
function drawInside(stroke, ui, canvas) {
|
|
11050
|
+
canvas.save();
|
|
11051
|
+
canvas.clipUI(ui);
|
|
11052
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
11053
|
+
canvas.restore();
|
|
11054
|
+
}
|
|
11055
|
+
function drawOutside(stroke, ui, canvas) {
|
|
11056
|
+
const data = ui.__;
|
|
11057
|
+
if (data.__fillAfterStroke) {
|
|
11058
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
10927
11059
|
}
|
|
10928
11060
|
else {
|
|
10929
|
-
|
|
10930
|
-
|
|
10931
|
-
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
canvas.save();
|
|
10938
|
-
canvas.setStroke(undefined, __strokeWidth * 2, options);
|
|
10939
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
10940
|
-
drawStrokesStyle(strokes, false, ui, canvas);
|
|
10941
|
-
canvas.restore();
|
|
10942
|
-
break;
|
|
10943
|
-
case 'outside':
|
|
10944
|
-
const { renderBounds } = ui.__layout;
|
|
10945
|
-
const out = canvas.getSameCanvas(true, true);
|
|
10946
|
-
ui.__drawRenderPath(out);
|
|
10947
|
-
out.setStroke(undefined, __strokeWidth * 2, options);
|
|
10948
|
-
drawStrokesStyle(strokes, false, ui, out);
|
|
10949
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10950
|
-
out.clearWorld(renderBounds);
|
|
10951
|
-
if (ui.__worldFlipped)
|
|
10952
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10953
|
-
else
|
|
10954
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
10955
|
-
out.recycle(ui.__nowWorld);
|
|
10956
|
-
break;
|
|
10957
|
-
}
|
|
10958
|
-
}
|
|
10959
|
-
}
|
|
10960
|
-
function strokeArrow(ui, canvas) {
|
|
10961
|
-
if (ui.__.dashPattern) {
|
|
10962
|
-
canvas.beginPath();
|
|
10963
|
-
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
10964
|
-
canvas.dashPattern = null;
|
|
10965
|
-
canvas.stroke();
|
|
11061
|
+
const { renderBounds } = ui.__layout;
|
|
11062
|
+
const out = canvas.getSameCanvas(true, true);
|
|
11063
|
+
ui.__drawRenderPath(out);
|
|
11064
|
+
drawCenter(stroke, 2, ui, out);
|
|
11065
|
+
out.clipUI(data);
|
|
11066
|
+
out.clearWorld(renderBounds);
|
|
11067
|
+
copyWorld(canvas, out, ui);
|
|
11068
|
+
out.recycle(ui.__nowWorld);
|
|
10966
11069
|
}
|
|
10967
11070
|
}
|
|
10968
11071
|
|
|
@@ -11009,41 +11112,66 @@ function shape(ui, current, options) {
|
|
|
11009
11112
|
}
|
|
11010
11113
|
|
|
11011
11114
|
let recycleMap;
|
|
11115
|
+
const { stintSet } = DataHelper, { hasTransparent: hasTransparent$1 } = ColorConvert;
|
|
11012
11116
|
function compute(attrName, ui) {
|
|
11013
11117
|
const data = ui.__, leafPaints = [];
|
|
11014
|
-
let paints = data.__input[attrName],
|
|
11118
|
+
let paints = data.__input[attrName], isAlphaPixel, isTransparent;
|
|
11015
11119
|
if (!(paints instanceof Array))
|
|
11016
11120
|
paints = [paints];
|
|
11017
11121
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
11018
11122
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
11019
|
-
item = getLeafPaint(attrName, paints[i], ui);
|
|
11020
|
-
if (item)
|
|
11021
|
-
leafPaints.push(item);
|
|
11123
|
+
(item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
|
|
11022
11124
|
}
|
|
11023
11125
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
11024
|
-
if (leafPaints.length
|
|
11025
|
-
|
|
11026
|
-
|
|
11126
|
+
if (leafPaints.length) {
|
|
11127
|
+
if (leafPaints.every(item => item.isTransparent)) {
|
|
11128
|
+
if (leafPaints.some(item => item.image))
|
|
11129
|
+
isAlphaPixel = true;
|
|
11130
|
+
isTransparent = true;
|
|
11131
|
+
}
|
|
11132
|
+
}
|
|
11133
|
+
if (attrName === 'fill') {
|
|
11134
|
+
stintSet(data, '__isAlphaPixelFill', isAlphaPixel);
|
|
11135
|
+
stintSet(data, '__isTransparentFill', isTransparent);
|
|
11136
|
+
}
|
|
11137
|
+
else {
|
|
11138
|
+
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
11139
|
+
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
11140
|
+
}
|
|
11027
11141
|
}
|
|
11028
11142
|
function getLeafPaint(attrName, paint, ui) {
|
|
11029
11143
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
|
11030
11144
|
return undefined;
|
|
11145
|
+
let data;
|
|
11031
11146
|
const { boxBounds } = ui.__layout;
|
|
11032
11147
|
switch (paint.type) {
|
|
11033
|
-
case 'solid':
|
|
11034
|
-
let { type, blendMode, color, opacity } = paint;
|
|
11035
|
-
return { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
11036
11148
|
case 'image':
|
|
11037
|
-
|
|
11149
|
+
data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
11150
|
+
break;
|
|
11038
11151
|
case 'linear':
|
|
11039
|
-
|
|
11152
|
+
data = PaintGradient.linearGradient(paint, boxBounds);
|
|
11153
|
+
break;
|
|
11040
11154
|
case 'radial':
|
|
11041
|
-
|
|
11155
|
+
data = PaintGradient.radialGradient(paint, boxBounds);
|
|
11156
|
+
break;
|
|
11042
11157
|
case 'angular':
|
|
11043
|
-
|
|
11158
|
+
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
11159
|
+
break;
|
|
11160
|
+
case 'solid':
|
|
11161
|
+
const { type, color, opacity } = paint;
|
|
11162
|
+
data = { type, style: ColorConvert.string(color, opacity) };
|
|
11163
|
+
break;
|
|
11044
11164
|
default:
|
|
11045
|
-
|
|
11165
|
+
if (paint.r !== undefined)
|
|
11166
|
+
data = { type: 'solid', style: ColorConvert.string(paint) };
|
|
11167
|
+
}
|
|
11168
|
+
if (data) {
|
|
11169
|
+
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
11170
|
+
data.isTransparent = true;
|
|
11171
|
+
if (paint.blendMode)
|
|
11172
|
+
data.blendMode = paint.blendMode;
|
|
11046
11173
|
}
|
|
11174
|
+
return data;
|
|
11047
11175
|
}
|
|
11048
11176
|
|
|
11049
11177
|
const PaintModule = {
|
|
@@ -11109,12 +11237,10 @@ function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, al
|
|
|
11109
11237
|
|
|
11110
11238
|
const { get: get$2, translate } = MatrixHelper;
|
|
11111
11239
|
const tempBox = new Bounds();
|
|
11112
|
-
const tempPoint = {};
|
|
11113
11240
|
const tempScaleData = {};
|
|
11241
|
+
const tempImage = {};
|
|
11114
11242
|
function createData(leafPaint, image, paint, box) {
|
|
11115
|
-
const {
|
|
11116
|
-
if (blendMode)
|
|
11117
|
-
leafPaint.blendMode = blendMode;
|
|
11243
|
+
const { changeful, sync } = paint;
|
|
11118
11244
|
if (changeful)
|
|
11119
11245
|
leafPaint.changeful = changeful;
|
|
11120
11246
|
if (sync)
|
|
@@ -11122,38 +11248,38 @@ function createData(leafPaint, image, paint, box) {
|
|
|
11122
11248
|
leafPaint.data = getPatternData(paint, box, image);
|
|
11123
11249
|
}
|
|
11124
11250
|
function getPatternData(paint, box, image) {
|
|
11125
|
-
let { width, height } = image;
|
|
11126
11251
|
if (paint.padding)
|
|
11127
11252
|
box = tempBox.set(box).shrink(paint.padding);
|
|
11128
11253
|
if (paint.mode === 'strench')
|
|
11129
11254
|
paint.mode = 'stretch';
|
|
11255
|
+
let { width, height } = image;
|
|
11130
11256
|
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
11131
11257
|
const sameBox = box.width === width && box.height === height;
|
|
11132
11258
|
const data = { mode };
|
|
11133
11259
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
11134
|
-
|
|
11135
|
-
let
|
|
11260
|
+
BoundsHelper.set(tempImage, 0, 0, swapSize ? height : width, swapSize ? width : height);
|
|
11261
|
+
let scaleX, scaleY;
|
|
11136
11262
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
11137
11263
|
if (!sameBox || rotation) {
|
|
11138
|
-
|
|
11139
|
-
|
|
11140
|
-
|
|
11264
|
+
scaleX = scaleY = BoundsHelper.getFitScale(box, tempImage, mode !== 'fit');
|
|
11265
|
+
BoundsHelper.put(box, image, align, scaleX, false, tempImage);
|
|
11266
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
11141
11267
|
}
|
|
11142
11268
|
}
|
|
11143
|
-
else
|
|
11144
|
-
|
|
11145
|
-
|
|
11146
|
-
|
|
11147
|
-
|
|
11148
|
-
|
|
11149
|
-
|
|
11150
|
-
|
|
11151
|
-
|
|
11152
|
-
|
|
11153
|
-
|
|
11269
|
+
else {
|
|
11270
|
+
if (scale || size) {
|
|
11271
|
+
MathHelper.getScaleData(scale, size, image, tempScaleData);
|
|
11272
|
+
scaleX = tempScaleData.scaleX;
|
|
11273
|
+
scaleY = tempScaleData.scaleY;
|
|
11274
|
+
}
|
|
11275
|
+
if (align) {
|
|
11276
|
+
if (scaleX)
|
|
11277
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
11278
|
+
AlignHelper.toPoint(align, tempImage, box, tempImage, true, true);
|
|
11279
|
+
}
|
|
11154
11280
|
}
|
|
11155
11281
|
if (offset)
|
|
11156
|
-
|
|
11282
|
+
PointHelper.move(tempImage, offset);
|
|
11157
11283
|
switch (mode) {
|
|
11158
11284
|
case 'stretch':
|
|
11159
11285
|
if (!sameBox)
|
|
@@ -11161,12 +11287,12 @@ function getPatternData(paint, box, image) {
|
|
|
11161
11287
|
break;
|
|
11162
11288
|
case 'normal':
|
|
11163
11289
|
case 'clip':
|
|
11164
|
-
if (x || y || scaleX || rotation)
|
|
11165
|
-
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
11290
|
+
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
11291
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
11166
11292
|
break;
|
|
11167
11293
|
case 'repeat':
|
|
11168
11294
|
if (!sameBox || scaleX || rotation)
|
|
11169
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
11295
|
+
repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, align);
|
|
11170
11296
|
if (!repeat)
|
|
11171
11297
|
data.repeat = 'repeat';
|
|
11172
11298
|
break;
|
|
@@ -11174,7 +11300,7 @@ function getPatternData(paint, box, image) {
|
|
|
11174
11300
|
case 'cover':
|
|
11175
11301
|
default:
|
|
11176
11302
|
if (scaleX)
|
|
11177
|
-
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
11303
|
+
fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
11178
11304
|
}
|
|
11179
11305
|
if (!data.transform) {
|
|
11180
11306
|
if (box.x || box.y) {
|
|
@@ -11207,6 +11333,8 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
11207
11333
|
}
|
|
11208
11334
|
else {
|
|
11209
11335
|
leafPaint = { type: paint.type, image };
|
|
11336
|
+
if (image.hasAlphaPixel)
|
|
11337
|
+
leafPaint.isTransparent = true;
|
|
11210
11338
|
cache = image.use > 1 ? { leafPaint, paint, boxBounds: box.set(boxBounds) } : null;
|
|
11211
11339
|
}
|
|
11212
11340
|
if (firstUse || image.loading)
|
|
@@ -11231,7 +11359,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
11231
11359
|
ignoreRender(ui, false);
|
|
11232
11360
|
if (!ui.destroyed) {
|
|
11233
11361
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
11234
|
-
if (image.
|
|
11362
|
+
if (image.hasAlphaPixel)
|
|
11235
11363
|
ui.__layout.hitCanvasChanged = true;
|
|
11236
11364
|
ui.forceUpdate('surface');
|
|
11237
11365
|
}
|
|
@@ -11243,13 +11371,17 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
11243
11371
|
onLoadError(ui, event, error);
|
|
11244
11372
|
leafPaint.loadId = null;
|
|
11245
11373
|
});
|
|
11246
|
-
if (ui.placeholderColor)
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11250
|
-
|
|
11251
|
-
|
|
11252
|
-
|
|
11374
|
+
if (ui.placeholderColor) {
|
|
11375
|
+
if (!ui.placeholderDelay)
|
|
11376
|
+
image.isPlacehold = true;
|
|
11377
|
+
else
|
|
11378
|
+
setTimeout(() => {
|
|
11379
|
+
if (!image.ready) {
|
|
11380
|
+
image.isPlacehold = true;
|
|
11381
|
+
ui.forceUpdate('surface');
|
|
11382
|
+
}
|
|
11383
|
+
}, ui.placeholderDelay);
|
|
11384
|
+
}
|
|
11253
11385
|
}
|
|
11254
11386
|
return leafPaint;
|
|
11255
11387
|
}
|
|
@@ -11404,7 +11536,7 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
11404
11536
|
}
|
|
11405
11537
|
function drawImage(ui, canvas, paint, data) {
|
|
11406
11538
|
canvas.save();
|
|
11407
|
-
|
|
11539
|
+
canvas.clipUI(ui);
|
|
11408
11540
|
if (paint.blendMode)
|
|
11409
11541
|
canvas.blendMode = paint.blendMode;
|
|
11410
11542
|
if (data.opacity)
|
|
@@ -11455,32 +11587,33 @@ const PaintImageModule = {
|
|
|
11455
11587
|
repeatMode
|
|
11456
11588
|
};
|
|
11457
11589
|
|
|
11458
|
-
const { toPoint: toPoint$2 } = AroundHelper;
|
|
11590
|
+
const { toPoint: toPoint$2 } = AroundHelper, { hasTransparent } = ColorConvert;
|
|
11459
11591
|
const realFrom$2 = {};
|
|
11460
11592
|
const realTo$2 = {};
|
|
11461
11593
|
function linearGradient(paint, box) {
|
|
11462
|
-
let { from, to, type,
|
|
11594
|
+
let { from, to, type, opacity } = paint;
|
|
11463
11595
|
toPoint$2(from || 'top', box, realFrom$2);
|
|
11464
11596
|
toPoint$2(to || 'bottom', box, realTo$2);
|
|
11465
11597
|
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
11466
|
-
applyStops(style, paint.stops, opacity);
|
|
11467
11598
|
const data = { type, style };
|
|
11468
|
-
|
|
11469
|
-
data.blendMode = blendMode;
|
|
11599
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11470
11600
|
return data;
|
|
11471
11601
|
}
|
|
11472
|
-
function applyStops(gradient, stops, opacity) {
|
|
11602
|
+
function applyStops(data, gradient, stops, opacity) {
|
|
11473
11603
|
if (stops) {
|
|
11474
|
-
let stop;
|
|
11604
|
+
let stop, color, offset, isTransparent;
|
|
11475
11605
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
11476
11606
|
stop = stops[i];
|
|
11477
|
-
if (typeof stop === 'string')
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
|
|
11481
|
-
|
|
11482
|
-
|
|
11607
|
+
if (typeof stop === 'string')
|
|
11608
|
+
offset = i / (len - 1), color = ColorConvert.string(stop, opacity);
|
|
11609
|
+
else
|
|
11610
|
+
offset = stop.offset, color = ColorConvert.string(stop.color, opacity);
|
|
11611
|
+
gradient.addColorStop(offset, color);
|
|
11612
|
+
if (!isTransparent && hasTransparent(color))
|
|
11613
|
+
isTransparent = true;
|
|
11483
11614
|
}
|
|
11615
|
+
if (isTransparent)
|
|
11616
|
+
data.isTransparent = true;
|
|
11484
11617
|
}
|
|
11485
11618
|
}
|
|
11486
11619
|
|
|
@@ -11490,17 +11623,15 @@ const { toPoint: toPoint$1 } = AroundHelper;
|
|
|
11490
11623
|
const realFrom$1 = {};
|
|
11491
11624
|
const realTo$1 = {};
|
|
11492
11625
|
function radialGradient(paint, box) {
|
|
11493
|
-
let { from, to, type, opacity,
|
|
11626
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
11494
11627
|
toPoint$1(from || 'center', box, realFrom$1);
|
|
11495
11628
|
toPoint$1(to || 'bottom', box, realTo$1);
|
|
11496
11629
|
const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$1(realFrom$1, realTo$1));
|
|
11497
|
-
applyStops(style, paint.stops, opacity);
|
|
11498
11630
|
const data = { type, style };
|
|
11631
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11499
11632
|
const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
|
|
11500
11633
|
if (transform)
|
|
11501
11634
|
data.transform = transform;
|
|
11502
|
-
if (blendMode)
|
|
11503
|
-
data.blendMode = blendMode;
|
|
11504
11635
|
return data;
|
|
11505
11636
|
}
|
|
11506
11637
|
function getTransform(box, from, to, stretch, rotate90) {
|
|
@@ -11526,17 +11657,15 @@ const { toPoint } = AroundHelper;
|
|
|
11526
11657
|
const realFrom = {};
|
|
11527
11658
|
const realTo = {};
|
|
11528
11659
|
function conicGradient(paint, box) {
|
|
11529
|
-
let { from, to, type, opacity,
|
|
11660
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
11530
11661
|
toPoint(from || 'center', box, realFrom);
|
|
11531
11662
|
toPoint(to || 'bottom', box, realTo);
|
|
11532
11663
|
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));
|
|
11533
|
-
applyStops(style, paint.stops, opacity);
|
|
11534
11664
|
const data = { type, style };
|
|
11665
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11535
11666
|
const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
|
|
11536
11667
|
if (transform)
|
|
11537
11668
|
data.transform = transform;
|
|
11538
|
-
if (blendMode)
|
|
11539
|
-
data.blendMode = blendMode;
|
|
11540
11669
|
return data;
|
|
11541
11670
|
}
|
|
11542
11671
|
|
|
@@ -11572,12 +11701,10 @@ function shadow(ui, current, shape) {
|
|
|
11572
11701
|
}
|
|
11573
11702
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
11574
11703
|
}
|
|
11575
|
-
if (ui.__worldFlipped)
|
|
11704
|
+
if (ui.__worldFlipped)
|
|
11576
11705
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
11577
|
-
|
|
11578
|
-
else {
|
|
11706
|
+
else
|
|
11579
11707
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
11580
|
-
}
|
|
11581
11708
|
if (end && index < end)
|
|
11582
11709
|
other.clearWorld(copyBounds, true);
|
|
11583
11710
|
});
|
|
@@ -11636,12 +11763,10 @@ function innerShadow(ui, current, shape) {
|
|
|
11636
11763
|
copyBounds = bounds;
|
|
11637
11764
|
}
|
|
11638
11765
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
11639
|
-
if (ui.__worldFlipped)
|
|
11766
|
+
if (ui.__worldFlipped)
|
|
11640
11767
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
11641
|
-
|
|
11642
|
-
else {
|
|
11768
|
+
else
|
|
11643
11769
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
11644
|
-
}
|
|
11645
11770
|
if (end && index < end)
|
|
11646
11771
|
other.clearWorld(copyBounds, true);
|
|
11647
11772
|
});
|
|
@@ -11869,6 +11994,8 @@ function createRows(drawData, content, style) {
|
|
|
11869
11994
|
lastCharType = null;
|
|
11870
11995
|
startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
|
|
11871
11996
|
word = { data: [] }, row = { words: [] };
|
|
11997
|
+
if (__letterSpacing)
|
|
11998
|
+
content = [...content];
|
|
11872
11999
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
11873
12000
|
char = content[i];
|
|
11874
12001
|
if (char === '\n') {
|
|
@@ -12287,4 +12414,4 @@ Object.assign(Creator, {
|
|
|
12287
12414
|
});
|
|
12288
12415
|
useCanvas();
|
|
12289
12416
|
|
|
12290
|
-
export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, 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, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, 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$
|
|
12417
|
+
export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, 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, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, 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 };
|