@leafer/miniapp 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/miniapp.module.js +615 -471
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +18 -18
package/dist/miniapp.module.js
CHANGED
|
@@ -23,8 +23,6 @@ const Platform = {
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
const Creator = {};
|
|
27
|
-
|
|
28
26
|
const IncrementId = {
|
|
29
27
|
RUNTIME: 'runtime',
|
|
30
28
|
LEAF: 'leaf',
|
|
@@ -150,7 +148,7 @@ function getMatrixData() { return { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }; }
|
|
|
150
148
|
|
|
151
149
|
const { sin: sin$6, cos: cos$6, acos, sqrt: sqrt$5 } = Math;
|
|
152
150
|
const { float: float$2 } = MathHelper;
|
|
153
|
-
const tempPoint$
|
|
151
|
+
const tempPoint$4 = {};
|
|
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$a.toInnerPoint(t, origin, tempPoint$
|
|
197
|
-
M$a.scaleOfInner(t, tempPoint$
|
|
194
|
+
M$a.toInnerPoint(t, origin, tempPoint$4);
|
|
195
|
+
M$a.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
|
|
198
196
|
},
|
|
199
197
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
200
198
|
M$a.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$a.toInnerPoint(t, origin, tempPoint$
|
|
216
|
-
M$a.rotateOfInner(t, tempPoint$
|
|
213
|
+
M$a.toInnerPoint(t, origin, tempPoint$4);
|
|
214
|
+
M$a.rotateOfInner(t, tempPoint$4, rotation);
|
|
217
215
|
},
|
|
218
216
|
rotateOfInner(t, origin, rotation) {
|
|
219
217
|
M$a.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$a.toInnerPoint(t, origin, tempPoint$
|
|
238
|
-
M$a.skewOfInner(t, tempPoint$
|
|
235
|
+
M$a.toInnerPoint(t, origin, tempPoint$4);
|
|
236
|
+
M$a.skewOfInner(t, tempPoint$4, skewX, skewY);
|
|
239
237
|
},
|
|
240
238
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
241
239
|
M$a.translateInner(t, origin.x, origin.y);
|
|
@@ -464,8 +462,10 @@ const PointHelper = {
|
|
|
464
462
|
t.y = halfPixel ? round$5(t.y - 0.5) + 0.5 : round$5(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$3 = 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$4 } = 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$6 } = AroundHelper;
|
|
869
|
+
const AlignHelper = {
|
|
870
|
+
toPoint(align, content, box, to, onlyBoxSize, onlyContentSize) {
|
|
871
|
+
toPoint$6(align, box, to, onlyBoxSize, content, onlyContentSize);
|
|
872
|
+
}
|
|
873
|
+
};
|
|
874
|
+
|
|
804
875
|
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPoint$3, toBounds: toBounds$4 } = TwoPointBoundsHelper;
|
|
805
876
|
const { toOuterPoint: toOuterPoint$2 } = MatrixHelper;
|
|
806
877
|
const { float: float$1, fourNumber: fourNumber$1 } = MathHelper;
|
|
807
878
|
const { floor: floor$1, ceil: ceil$3 } = Math;
|
|
808
879
|
let right$4, bottom$3, boundsRight, boundsBottom;
|
|
809
880
|
const point$2 = {};
|
|
810
|
-
const toPoint$
|
|
881
|
+
const toPoint$5 = {};
|
|
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$2.x = t.x;
|
|
918
990
|
point$2.y = t.y;
|
|
919
|
-
toOuterPoint$2(matrix, point$2, toPoint$
|
|
920
|
-
setPoint$5(tempPointBounds$1, toPoint$
|
|
991
|
+
toOuterPoint$2(matrix, point$2, toPoint$5);
|
|
992
|
+
setPoint$5(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
921
993
|
point$2.x = t.x + t.width;
|
|
922
|
-
toOuterPoint$2(matrix, point$2, toPoint$
|
|
923
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
994
|
+
toOuterPoint$2(matrix, point$2, toPoint$5);
|
|
995
|
+
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
924
996
|
point$2.y = t.y + t.height;
|
|
925
|
-
toOuterPoint$2(matrix, point$2, toPoint$
|
|
926
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
997
|
+
toOuterPoint$2(matrix, point$2, toPoint$5);
|
|
998
|
+
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
927
999
|
point$2.x = t.x;
|
|
928
|
-
toOuterPoint$2(matrix, point$2, toPoint$
|
|
929
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
1000
|
+
toOuterPoint$2(matrix, point$2, toPoint$5);
|
|
1001
|
+
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
930
1002
|
toBounds$4(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$5 } = AroundHelper;
|
|
1309
|
-
const AlignHelper = {
|
|
1310
|
-
toPoint(align, contentBounds, bounds, to, onlySize) {
|
|
1311
|
-
toPoint$5(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$h = 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: assign$1 } = 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$4, cos: cos$4, atan2: atan2$1, ceil: ceil$2, abs: abs$6, PI: PI
|
|
|
2385
2412
|
const { setPoint: setPoint$4, addPoint: addPoint$2 } = TwoPointBoundsHelper;
|
|
2386
2413
|
const { set, toNumberPoints: toNumberPoints$1 } = PointHelper;
|
|
2387
2414
|
const { M: M$9, L: L$a, C: C$8, Q: Q$7, Z: Z$8 } = PathCommandMap;
|
|
2388
|
-
const tempPoint$
|
|
2415
|
+
const tempPoint$2 = {};
|
|
2389
2416
|
const BezierHelper = {
|
|
2390
2417
|
points(data, originPoints, curve, close) {
|
|
2391
2418
|
let points = toNumberPoints$1(originPoints);
|
|
@@ -2407,6 +2434,8 @@ const BezierHelper = {
|
|
|
2407
2434
|
cY = points[i + 3];
|
|
2408
2435
|
ba = sqrt$3(pow$1(bX - aX, 2) + pow$1(bY - aY, 2));
|
|
2409
2436
|
cb = sqrt$3(pow$1(cX - bX, 2) + pow$1(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$2(pointBounds, fromX, fromY) : setPoint$4(pointBounds, fromX, fromY);
|
|
2577
2606
|
addPoint$2(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$2(pointBounds, tempPoint$
|
|
2608
|
+
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$2);
|
|
2609
|
+
addPoint$2(pointBounds, tempPoint$2.x, tempPoint$2.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$2 = FileHelper;
|
|
3416
|
-
F$2.
|
|
3445
|
+
F$2.alphaPixelTypes.forEach(type => F$2.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3417
3446
|
|
|
3418
3447
|
const debug$c = 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$4 } = 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$4(children[j]);
|
|
4523
4552
|
}
|
|
4524
4553
|
if (exclude && exclude === branch)
|
|
4525
4554
|
continue;
|
|
4526
|
-
updateBounds$
|
|
4555
|
+
updateBounds$4(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$3 } = LeafHelper;
|
|
4545
4574
|
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$9 } = 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$3(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$4, tempPoint: tempPoint$
|
|
5261
|
+
const { toPoint: toPoint$4, tempPoint: tempPoint$1 } = 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$4(data.around || data.origin, layout.boxBounds, tempPoint$
|
|
5195
|
-
translateInner(local, -tempPoint$
|
|
5278
|
+
toPoint$4(data.around || data.origin, layout.boxBounds, tempPoint$1);
|
|
5279
|
+
translateInner(local, -tempPoint$1.x, -tempPoint$1.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$2, copy: copy$8 } =
|
|
|
5205
5289
|
const { toBounds: toBounds$2 } = PathBounds;
|
|
5206
5290
|
const LeafBounds = {
|
|
5207
5291
|
__updateWorldBounds() {
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5292
|
+
const layout = this.__layout;
|
|
5293
|
+
toOuterOf$1(layout.renderBounds, this.__world, this.__world);
|
|
5294
|
+
if (layout.resized) {
|
|
5295
|
+
if (layout.resized === 'inner')
|
|
5296
|
+
this.__onUpdateSize();
|
|
5297
|
+
if (this.__hasLocalEvent)
|
|
5298
|
+
BoundsEvent.emitLocal(this);
|
|
5299
|
+
layout.resized = undefined;
|
|
5212
5300
|
}
|
|
5301
|
+
if (this.__hasWorldEvent)
|
|
5302
|
+
BoundsEvent.emitWorld(this);
|
|
5213
5303
|
},
|
|
5214
5304
|
__updateLocalBounds() {
|
|
5215
5305
|
const layout = this.__layout;
|
|
@@ -5218,12 +5308,12 @@ const LeafBounds = {
|
|
|
5218
5308
|
this.__updatePath();
|
|
5219
5309
|
this.__updateRenderPath();
|
|
5220
5310
|
this.__updateBoxBounds();
|
|
5221
|
-
layout.resized =
|
|
5311
|
+
layout.resized = 'inner';
|
|
5222
5312
|
}
|
|
5223
5313
|
if (layout.localBoxChanged) {
|
|
5224
5314
|
if (this.__local)
|
|
5225
5315
|
this.__updateLocalBoxBounds();
|
|
5226
|
-
layout.localBoxChanged =
|
|
5316
|
+
layout.localBoxChanged = undefined;
|
|
5227
5317
|
if (layout.strokeSpread)
|
|
5228
5318
|
layout.strokeChanged = true;
|
|
5229
5319
|
if (layout.renderSpread)
|
|
@@ -5231,7 +5321,7 @@ const LeafBounds = {
|
|
|
5231
5321
|
if (this.parent)
|
|
5232
5322
|
this.parent.__layout.boxChange();
|
|
5233
5323
|
}
|
|
5234
|
-
layout.boxChanged =
|
|
5324
|
+
layout.boxChanged = undefined;
|
|
5235
5325
|
if (layout.strokeChanged) {
|
|
5236
5326
|
layout.strokeSpread = this.__updateStrokeSpread();
|
|
5237
5327
|
if (layout.strokeSpread) {
|
|
@@ -5243,12 +5333,12 @@ const LeafBounds = {
|
|
|
5243
5333
|
else {
|
|
5244
5334
|
layout.spreadStrokeCancel();
|
|
5245
5335
|
}
|
|
5246
|
-
layout.strokeChanged =
|
|
5336
|
+
layout.strokeChanged = undefined;
|
|
5247
5337
|
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
|
|
5248
5338
|
layout.renderChanged = true;
|
|
5249
5339
|
if (this.parent)
|
|
5250
5340
|
this.parent.__layout.strokeChange();
|
|
5251
|
-
layout.resized =
|
|
5341
|
+
layout.resized = 'inner';
|
|
5252
5342
|
}
|
|
5253
5343
|
if (layout.renderChanged) {
|
|
5254
5344
|
layout.renderSpread = this.__updateRenderSpread();
|
|
@@ -5261,11 +5351,12 @@ const LeafBounds = {
|
|
|
5261
5351
|
else {
|
|
5262
5352
|
layout.spreadRenderCancel();
|
|
5263
5353
|
}
|
|
5264
|
-
layout.renderChanged =
|
|
5354
|
+
layout.renderChanged = undefined;
|
|
5265
5355
|
if (this.parent)
|
|
5266
5356
|
this.parent.__layout.renderChange();
|
|
5267
5357
|
}
|
|
5268
|
-
layout.
|
|
5358
|
+
layout.resized || (layout.resized = 'local');
|
|
5359
|
+
layout.boundsChanged = undefined;
|
|
5269
5360
|
},
|
|
5270
5361
|
__updateLocalBoxBounds() {
|
|
5271
5362
|
if (this.__hasMotionPath)
|
|
@@ -5359,7 +5450,7 @@ const LeafRender = {
|
|
|
5359
5450
|
if (this.__worldOpacity) {
|
|
5360
5451
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5361
5452
|
this.__drawRenderPath(canvas);
|
|
5362
|
-
|
|
5453
|
+
canvas.clipUI(this);
|
|
5363
5454
|
}
|
|
5364
5455
|
},
|
|
5365
5456
|
__updateWorldOpacity() {
|
|
@@ -5805,7 +5896,7 @@ let Leaf = class Leaf {
|
|
|
5805
5896
|
off(_type, _listener, _options) { }
|
|
5806
5897
|
on_(_type, _listener, _bind, _options) { return undefined; }
|
|
5807
5898
|
off_(_id) { }
|
|
5808
|
-
once(_type, _listener, _capture) { }
|
|
5899
|
+
once(_type, _listener, _captureOrBind, _capture) { }
|
|
5809
5900
|
emit(_type, _event, _capture) { }
|
|
5810
5901
|
emitEvent(_event, _capture) { }
|
|
5811
5902
|
hasEvent(_type, _capture) { return false; }
|
|
@@ -6142,7 +6233,7 @@ class LeafLevelList {
|
|
|
6142
6233
|
}
|
|
6143
6234
|
}
|
|
6144
6235
|
|
|
6145
|
-
const version = "1.6.
|
|
6236
|
+
const version = "1.6.4";
|
|
6146
6237
|
|
|
6147
6238
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6148
6239
|
get allowBackgroundColor() { return false; }
|
|
@@ -6440,17 +6531,15 @@ class Watcher {
|
|
|
6440
6531
|
this.target.emitEvent(new WatchEvent(WatchEvent.DATA, { updatedList: this.updatedList }));
|
|
6441
6532
|
this.__updatedList = new LeafList();
|
|
6442
6533
|
this.totalTimes++;
|
|
6443
|
-
this.changed = false;
|
|
6444
|
-
this.hasVisible = false;
|
|
6445
|
-
this.hasRemove = false;
|
|
6446
|
-
this.hasAdd = false;
|
|
6534
|
+
this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
6447
6535
|
}
|
|
6448
6536
|
__listenEvents() {
|
|
6449
|
-
const { target } = this;
|
|
6450
6537
|
this.__eventIds = [
|
|
6451
|
-
target.on_(
|
|
6452
|
-
|
|
6453
|
-
|
|
6538
|
+
this.target.on_([
|
|
6539
|
+
[PropertyEvent.CHANGE, this.__onAttrChange, this],
|
|
6540
|
+
[[ChildEvent.ADD, ChildEvent.REMOVE], this.__onChildEvent, this],
|
|
6541
|
+
[WatchEvent.REQUEST, this.__onRquestData, this]
|
|
6542
|
+
])
|
|
6454
6543
|
];
|
|
6455
6544
|
}
|
|
6456
6545
|
__removeListenEvents() {
|
|
@@ -6460,8 +6549,7 @@ class Watcher {
|
|
|
6460
6549
|
if (this.target) {
|
|
6461
6550
|
this.stop();
|
|
6462
6551
|
this.__removeListenEvents();
|
|
6463
|
-
this.target = null;
|
|
6464
|
-
this.__updatedList = null;
|
|
6552
|
+
this.target = this.__updatedList = null;
|
|
6465
6553
|
}
|
|
6466
6554
|
}
|
|
6467
6555
|
}
|
|
@@ -6566,7 +6654,7 @@ class Layouter {
|
|
|
6566
6654
|
this.disabled = true;
|
|
6567
6655
|
}
|
|
6568
6656
|
layout() {
|
|
6569
|
-
if (!this.running)
|
|
6657
|
+
if (this.layouting || !this.running)
|
|
6570
6658
|
return;
|
|
6571
6659
|
const { target } = this;
|
|
6572
6660
|
this.times = 0;
|
|
@@ -6649,12 +6737,10 @@ class Layouter {
|
|
|
6649
6737
|
}
|
|
6650
6738
|
static fullLayout(target) {
|
|
6651
6739
|
updateAllMatrix$1(target, true);
|
|
6652
|
-
if (target.isBranch)
|
|
6740
|
+
if (target.isBranch)
|
|
6653
6741
|
BranchHelper.updateBounds(target);
|
|
6654
|
-
|
|
6655
|
-
else {
|
|
6742
|
+
else
|
|
6656
6743
|
LeafHelper.updateBounds(target);
|
|
6657
|
-
}
|
|
6658
6744
|
updateAllChange(target);
|
|
6659
6745
|
}
|
|
6660
6746
|
addExtra(leaf) {
|
|
@@ -6677,11 +6763,12 @@ class Layouter {
|
|
|
6677
6763
|
this.__updatedList = event.data.updatedList;
|
|
6678
6764
|
}
|
|
6679
6765
|
__listenEvents() {
|
|
6680
|
-
const { target } = this;
|
|
6681
6766
|
this.__eventIds = [
|
|
6682
|
-
target.on_(
|
|
6683
|
-
|
|
6684
|
-
|
|
6767
|
+
this.target.on_([
|
|
6768
|
+
[LayoutEvent.REQUEST, this.layout, this],
|
|
6769
|
+
[LayoutEvent.AGAIN, this.layoutAgain, this],
|
|
6770
|
+
[WatchEvent.DATA, this.__onReceiveWatchData, this]
|
|
6771
|
+
])
|
|
6685
6772
|
];
|
|
6686
6773
|
}
|
|
6687
6774
|
__removeListenEvents() {
|
|
@@ -6912,12 +6999,13 @@ class Renderer {
|
|
|
6912
6999
|
this.target.emitEvent(new RenderEvent(type, this.times, bounds, options));
|
|
6913
7000
|
}
|
|
6914
7001
|
__listenEvents() {
|
|
6915
|
-
const { target } = this;
|
|
6916
7002
|
this.__eventIds = [
|
|
6917
|
-
target.on_(
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
7003
|
+
this.target.on_([
|
|
7004
|
+
[RenderEvent.REQUEST, this.update, this],
|
|
7005
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
7006
|
+
[RenderEvent.AGAIN, this.renderAgain, this],
|
|
7007
|
+
[ResizeEvent.RESIZE, this.__onResize, this]
|
|
7008
|
+
])
|
|
6921
7009
|
];
|
|
6922
7010
|
}
|
|
6923
7011
|
__removeListenEvents() {
|
|
@@ -7133,8 +7221,32 @@ function zoomLayerType() {
|
|
|
7133
7221
|
};
|
|
7134
7222
|
}
|
|
7135
7223
|
|
|
7224
|
+
function hasTransparent$3(color) {
|
|
7225
|
+
if (!color || color.length === 7 || color.length === 4)
|
|
7226
|
+
return false;
|
|
7227
|
+
if (color === 'transparent')
|
|
7228
|
+
return true;
|
|
7229
|
+
const first = color[0];
|
|
7230
|
+
if (first === '#') {
|
|
7231
|
+
switch (color.length) {
|
|
7232
|
+
case 5: return color[4] !== 'f' && color[4] !== 'F';
|
|
7233
|
+
case 9: return (color[7] !== 'f' && color[7] !== 'F') || (color[8] !== 'f' && color[8] !== 'F');
|
|
7234
|
+
}
|
|
7235
|
+
}
|
|
7236
|
+
else if (first === 'r' || first === 'h') {
|
|
7237
|
+
if (color[3] === 'a') {
|
|
7238
|
+
const i = color.lastIndexOf(',');
|
|
7239
|
+
if (i > -1)
|
|
7240
|
+
return parseFloat(color.slice(i + 1)) < 1;
|
|
7241
|
+
}
|
|
7242
|
+
}
|
|
7243
|
+
return false;
|
|
7244
|
+
}
|
|
7245
|
+
|
|
7136
7246
|
const TextConvert = {};
|
|
7137
|
-
const ColorConvert = {
|
|
7247
|
+
const ColorConvert = {
|
|
7248
|
+
hasTransparent: hasTransparent$3
|
|
7249
|
+
};
|
|
7138
7250
|
const UnitConvert = {
|
|
7139
7251
|
number(value, percentRefer) {
|
|
7140
7252
|
return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
|
|
@@ -7160,6 +7272,7 @@ const Transition = {
|
|
|
7160
7272
|
};
|
|
7161
7273
|
|
|
7162
7274
|
const { parse, objectToCanvasData } = PathConvert;
|
|
7275
|
+
const { stintSet: stintSet$2 } = DataHelper, { hasTransparent: hasTransparent$2 } = ColorConvert;
|
|
7163
7276
|
const emptyPaint = {};
|
|
7164
7277
|
const debug$5 = Debug.get('UIData');
|
|
7165
7278
|
class UIData extends LeafData {
|
|
@@ -7218,38 +7331,22 @@ class UIData extends LeafData {
|
|
|
7218
7331
|
if (this.__naturalWidth)
|
|
7219
7332
|
this.__removeNaturalSize();
|
|
7220
7333
|
if (typeof value === 'string' || !value) {
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
PaintImage.recycleImage('fill', this);
|
|
7224
|
-
this.__isFills = false;
|
|
7225
|
-
this.__pixelFill && (this.__pixelFill = false);
|
|
7226
|
-
}
|
|
7334
|
+
stintSet$2(this, '__isTransparentFill', hasTransparent$2(value));
|
|
7335
|
+
this.__isFills && this.__removePaint('fill', true);
|
|
7227
7336
|
this._fill = value;
|
|
7228
7337
|
}
|
|
7229
7338
|
else if (typeof value === 'object') {
|
|
7230
|
-
this.
|
|
7231
|
-
const layout = this.__leaf.__layout;
|
|
7232
|
-
layout.boxChanged || layout.boxChange();
|
|
7233
|
-
this.__isFills = true;
|
|
7234
|
-
this._fill || (this._fill = emptyPaint);
|
|
7339
|
+
this.__setPaint('fill', value);
|
|
7235
7340
|
}
|
|
7236
7341
|
}
|
|
7237
7342
|
setStroke(value) {
|
|
7238
7343
|
if (typeof value === 'string' || !value) {
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
PaintImage.recycleImage('stroke', this);
|
|
7242
|
-
this.__isStrokes = false;
|
|
7243
|
-
this.__pixelStroke && (this.__pixelStroke = false);
|
|
7244
|
-
}
|
|
7344
|
+
stintSet$2(this, '__isTransparentStroke', hasTransparent$2(value));
|
|
7345
|
+
this.__isStrokes && this.__removePaint('stroke', true);
|
|
7245
7346
|
this._stroke = value;
|
|
7246
7347
|
}
|
|
7247
7348
|
else if (typeof value === 'object') {
|
|
7248
|
-
this.
|
|
7249
|
-
const layout = this.__leaf.__layout;
|
|
7250
|
-
layout.boxChanged || layout.boxChange();
|
|
7251
|
-
this.__isStrokes = true;
|
|
7252
|
-
this._stroke || (this._stroke = emptyPaint);
|
|
7349
|
+
this.__setPaint('stroke', value);
|
|
7253
7350
|
}
|
|
7254
7351
|
}
|
|
7255
7352
|
setPath(value) {
|
|
@@ -7279,7 +7376,34 @@ class UIData extends LeafData {
|
|
|
7279
7376
|
Paint.compute('fill', this.__leaf);
|
|
7280
7377
|
if (stroke)
|
|
7281
7378
|
Paint.compute('stroke', this.__leaf);
|
|
7282
|
-
this.__needComputePaint =
|
|
7379
|
+
this.__needComputePaint = undefined;
|
|
7380
|
+
}
|
|
7381
|
+
__setPaint(attrName, value) {
|
|
7382
|
+
this.__setInput(attrName, value);
|
|
7383
|
+
const layout = this.__leaf.__layout;
|
|
7384
|
+
layout.boxChanged || layout.boxChange();
|
|
7385
|
+
if (value instanceof Array && !value.length) {
|
|
7386
|
+
this.__removePaint(attrName);
|
|
7387
|
+
}
|
|
7388
|
+
else {
|
|
7389
|
+
if (attrName === 'fill')
|
|
7390
|
+
this.__isFills = true, this._fill || (this._fill = emptyPaint);
|
|
7391
|
+
else
|
|
7392
|
+
this.__isStrokes = true, this._stroke || (this._stroke = emptyPaint);
|
|
7393
|
+
}
|
|
7394
|
+
}
|
|
7395
|
+
__removePaint(attrName, removeInput) {
|
|
7396
|
+
if (removeInput)
|
|
7397
|
+
this.__removeInput(attrName);
|
|
7398
|
+
PaintImage.recycleImage(attrName, this);
|
|
7399
|
+
if (attrName === 'fill') {
|
|
7400
|
+
stintSet$2(this, '__isAlphaPixelFill', undefined);
|
|
7401
|
+
this._fill = this.__isFills = undefined;
|
|
7402
|
+
}
|
|
7403
|
+
else {
|
|
7404
|
+
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7405
|
+
this._stroke = this.__isStrokes = undefined;
|
|
7406
|
+
}
|
|
7283
7407
|
}
|
|
7284
7408
|
}
|
|
7285
7409
|
function setArray(data, key, value) {
|
|
@@ -7287,10 +7411,10 @@ function setArray(data, key, value) {
|
|
|
7287
7411
|
if (value instanceof Array) {
|
|
7288
7412
|
if (value.some((item) => item.visible === false))
|
|
7289
7413
|
value = value.filter((item) => item.visible !== false);
|
|
7290
|
-
value.length || (value =
|
|
7414
|
+
value.length || (value = undefined);
|
|
7291
7415
|
}
|
|
7292
7416
|
else
|
|
7293
|
-
value = value && value.visible !== false ? [value] :
|
|
7417
|
+
value = value && value.visible !== false ? [value] : undefined;
|
|
7294
7418
|
data['_' + key] = value;
|
|
7295
7419
|
}
|
|
7296
7420
|
|
|
@@ -7393,8 +7517,6 @@ class ImageData extends RectData {
|
|
|
7393
7517
|
this._url = value;
|
|
7394
7518
|
}
|
|
7395
7519
|
__setImageFill(value) {
|
|
7396
|
-
if (this.__leaf.image)
|
|
7397
|
-
this.__leaf.image = null;
|
|
7398
7520
|
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
7399
7521
|
}
|
|
7400
7522
|
__getData() {
|
|
@@ -7460,21 +7582,19 @@ const UIBounds = {
|
|
|
7460
7582
|
}
|
|
7461
7583
|
};
|
|
7462
7584
|
|
|
7585
|
+
const { stintSet: stintSet$1 } = DataHelper;
|
|
7463
7586
|
const UIRender = {
|
|
7464
7587
|
__updateChange() {
|
|
7465
|
-
const data = this.__
|
|
7588
|
+
const data = this.__;
|
|
7466
7589
|
if (data.__useEffect) {
|
|
7467
|
-
const { shadow,
|
|
7468
|
-
data.
|
|
7590
|
+
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7591
|
+
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')));
|
|
7592
|
+
data.__useEffect = !!(shadow || otherEffect);
|
|
7469
7593
|
}
|
|
7470
|
-
|
|
7471
|
-
|
|
7594
|
+
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7595
|
+
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7472
7596
|
data.__checkSingle();
|
|
7473
|
-
|
|
7474
|
-
if (complex)
|
|
7475
|
-
data.__complex = true;
|
|
7476
|
-
else
|
|
7477
|
-
data.__complex && (data.__complex = false);
|
|
7597
|
+
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7478
7598
|
},
|
|
7479
7599
|
__drawFast(canvas, options) {
|
|
7480
7600
|
drawFast(this, canvas, options);
|
|
@@ -7484,21 +7604,23 @@ const UIRender = {
|
|
|
7484
7604
|
if (data.__complex) {
|
|
7485
7605
|
if (data.__needComputePaint)
|
|
7486
7606
|
data.__computePaint();
|
|
7487
|
-
const { fill, stroke, __drawAfterFill } = data;
|
|
7607
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke, __isFastShadow } = data;
|
|
7488
7608
|
this.__drawRenderPath(canvas);
|
|
7489
|
-
if (data.__useEffect) {
|
|
7609
|
+
if (data.__useEffect && !__isFastShadow) {
|
|
7490
7610
|
const shape = Paint.shape(this, canvas, options);
|
|
7491
7611
|
this.__nowWorld = this.__getNowWorld(options);
|
|
7492
7612
|
const { shadow, innerShadow, filter } = data;
|
|
7493
7613
|
if (shadow)
|
|
7494
7614
|
Effect.shadow(this, canvas, shape);
|
|
7615
|
+
if (__fillAfterStroke)
|
|
7616
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7495
7617
|
if (fill)
|
|
7496
7618
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7497
7619
|
if (__drawAfterFill)
|
|
7498
7620
|
this.__drawAfterFill(canvas, options);
|
|
7499
7621
|
if (innerShadow)
|
|
7500
7622
|
Effect.innerShadow(this, canvas, shape);
|
|
7501
|
-
if (stroke)
|
|
7623
|
+
if (stroke && !__fillAfterStroke)
|
|
7502
7624
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7503
7625
|
if (filter)
|
|
7504
7626
|
Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
@@ -7507,21 +7629,27 @@ const UIRender = {
|
|
|
7507
7629
|
shape.canvas.recycle();
|
|
7508
7630
|
}
|
|
7509
7631
|
else {
|
|
7632
|
+
if (__fillAfterStroke)
|
|
7633
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7634
|
+
if (__isFastShadow) {
|
|
7635
|
+
const shadow = data.shadow[0], { scaleX, scaleY } = this.__nowWorld;
|
|
7636
|
+
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
7637
|
+
}
|
|
7510
7638
|
if (fill)
|
|
7511
7639
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7640
|
+
if (__isFastShadow)
|
|
7641
|
+
canvas.restore();
|
|
7512
7642
|
if (__drawAfterFill)
|
|
7513
7643
|
this.__drawAfterFill(canvas, options);
|
|
7514
|
-
if (stroke)
|
|
7644
|
+
if (stroke && !__fillAfterStroke)
|
|
7515
7645
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7516
7646
|
}
|
|
7517
7647
|
}
|
|
7518
7648
|
else {
|
|
7519
|
-
if (data.__pathInputed)
|
|
7649
|
+
if (data.__pathInputed)
|
|
7520
7650
|
drawFast(this, canvas, options);
|
|
7521
|
-
|
|
7522
|
-
else {
|
|
7651
|
+
else
|
|
7523
7652
|
this.__drawFast(canvas, options);
|
|
7524
|
-
}
|
|
7525
7653
|
}
|
|
7526
7654
|
},
|
|
7527
7655
|
__renderShape(canvas, options, ignoreFill, ignoreStroke) {
|
|
@@ -7530,17 +7658,17 @@ const UIRender = {
|
|
|
7530
7658
|
const { fill, stroke } = this.__;
|
|
7531
7659
|
this.__drawRenderPath(canvas);
|
|
7532
7660
|
if (fill && !ignoreFill)
|
|
7533
|
-
this.__.
|
|
7661
|
+
this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7534
7662
|
if (this.__.__isCanvas)
|
|
7535
7663
|
this.__drawAfterFill(canvas, options);
|
|
7536
7664
|
if (stroke && !ignoreStroke)
|
|
7537
|
-
this.__.
|
|
7665
|
+
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7538
7666
|
}
|
|
7539
7667
|
},
|
|
7540
7668
|
__drawAfterFill(canvas, options) {
|
|
7541
7669
|
if (this.__.__clipAfterFill) {
|
|
7542
7670
|
canvas.save();
|
|
7543
|
-
|
|
7671
|
+
canvas.clipUI();
|
|
7544
7672
|
this.__drawContent(canvas, options);
|
|
7545
7673
|
canvas.restore();
|
|
7546
7674
|
}
|
|
@@ -7549,13 +7677,15 @@ const UIRender = {
|
|
|
7549
7677
|
}
|
|
7550
7678
|
};
|
|
7551
7679
|
function drawFast(ui, canvas, options) {
|
|
7552
|
-
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
7680
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke } = ui.__;
|
|
7553
7681
|
ui.__drawRenderPath(canvas);
|
|
7682
|
+
if (__fillAfterStroke)
|
|
7683
|
+
Paint.stroke(stroke, ui, canvas);
|
|
7554
7684
|
if (fill)
|
|
7555
7685
|
Paint.fill(fill, ui, canvas);
|
|
7556
7686
|
if (__drawAfterFill)
|
|
7557
7687
|
ui.__drawAfterFill(canvas, options);
|
|
7558
|
-
if (stroke)
|
|
7688
|
+
if (stroke && !__fillAfterStroke)
|
|
7559
7689
|
Paint.stroke(stroke, ui, canvas);
|
|
7560
7690
|
}
|
|
7561
7691
|
|
|
@@ -7927,6 +8057,9 @@ __decorate([
|
|
|
7927
8057
|
__decorate([
|
|
7928
8058
|
surfaceType()
|
|
7929
8059
|
], UI.prototype, "placeholderColor", void 0);
|
|
8060
|
+
__decorate([
|
|
8061
|
+
dataType(100)
|
|
8062
|
+
], UI.prototype, "placeholderDelay", void 0);
|
|
7930
8063
|
__decorate([
|
|
7931
8064
|
dataType({})
|
|
7932
8065
|
], UI.prototype, "data", void 0);
|
|
@@ -8328,15 +8461,20 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8328
8461
|
}
|
|
8329
8462
|
__listenEvents() {
|
|
8330
8463
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8331
|
-
this.once(
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
8464
|
+
this.once([
|
|
8465
|
+
[LeaferEvent.START, () => Run.end(runId)],
|
|
8466
|
+
[LayoutEvent.START, this.updateLazyBounds, this],
|
|
8467
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
8468
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
8469
|
+
]);
|
|
8470
|
+
this.__eventIds.push(this.on_([
|
|
8471
|
+
[WatchEvent.DATA, this.__onWatchData, this],
|
|
8472
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
8473
|
+
[RenderEvent.NEXT, this.__onNextRender, this]
|
|
8474
|
+
]));
|
|
8336
8475
|
}
|
|
8337
8476
|
__removeListenEvents() {
|
|
8338
8477
|
this.off_(this.__eventIds);
|
|
8339
|
-
this.__eventIds.length = 0;
|
|
8340
8478
|
}
|
|
8341
8479
|
destroy(sync) {
|
|
8342
8480
|
const doDestory = () => {
|
|
@@ -8444,13 +8582,13 @@ let Box = class Box extends Group {
|
|
|
8444
8582
|
super.__updateRenderBounds();
|
|
8445
8583
|
copy$6(childrenRenderBounds, renderBounds);
|
|
8446
8584
|
this.__updateRectRenderBounds();
|
|
8447
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8585
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8448
8586
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8449
8587
|
add(renderBounds, childrenRenderBounds);
|
|
8450
8588
|
}
|
|
8451
8589
|
else
|
|
8452
8590
|
this.__updateRectRenderBounds();
|
|
8453
|
-
|
|
8591
|
+
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8454
8592
|
}
|
|
8455
8593
|
__updateRectRenderBounds() { }
|
|
8456
8594
|
__updateRectChange() { }
|
|
@@ -8754,18 +8892,10 @@ Star = __decorate([
|
|
|
8754
8892
|
|
|
8755
8893
|
let Image = class Image extends Rect {
|
|
8756
8894
|
get __tag() { return 'Image'; }
|
|
8757
|
-
get ready() {
|
|
8895
|
+
get ready() { const { image } = this; return image && image.ready; }
|
|
8896
|
+
get image() { const { fill } = this.__; return fill instanceof Array && fill[0].image; }
|
|
8758
8897
|
constructor(data) {
|
|
8759
8898
|
super(data);
|
|
8760
|
-
this.on_(ImageEvent.LOADED, this.__onLoaded, this);
|
|
8761
|
-
}
|
|
8762
|
-
__onLoaded(e) {
|
|
8763
|
-
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8764
|
-
this.image = e.image;
|
|
8765
|
-
}
|
|
8766
|
-
destroy() {
|
|
8767
|
-
this.image = null;
|
|
8768
|
-
super.destroy();
|
|
8769
8899
|
}
|
|
8770
8900
|
};
|
|
8771
8901
|
__decorate([
|
|
@@ -8781,11 +8911,11 @@ const MyImage = Image;
|
|
|
8781
8911
|
|
|
8782
8912
|
let Canvas = class Canvas extends Rect {
|
|
8783
8913
|
get __tag() { return 'Canvas'; }
|
|
8914
|
+
get context() { return this.canvas.context; }
|
|
8784
8915
|
get ready() { return !this.url; }
|
|
8785
8916
|
constructor(data) {
|
|
8786
8917
|
super(data);
|
|
8787
8918
|
this.canvas = Creator.canvas(this.__);
|
|
8788
|
-
this.context = this.canvas.context;
|
|
8789
8919
|
if (data && data.url)
|
|
8790
8920
|
this.drawImage(data.url);
|
|
8791
8921
|
}
|
|
@@ -8829,7 +8959,7 @@ let Canvas = class Canvas extends Rect {
|
|
|
8829
8959
|
destroy() {
|
|
8830
8960
|
if (this.canvas) {
|
|
8831
8961
|
this.canvas.destroy();
|
|
8832
|
-
this.canvas =
|
|
8962
|
+
this.canvas = null;
|
|
8833
8963
|
}
|
|
8834
8964
|
super.destroy();
|
|
8835
8965
|
}
|
|
@@ -8905,12 +9035,11 @@ let Text = class Text extends UI {
|
|
|
8905
9035
|
super.__updateBoxBounds();
|
|
8906
9036
|
if (italic)
|
|
8907
9037
|
b.width += fontSize * 0.16;
|
|
8908
|
-
|
|
8909
|
-
if (isOverflow)
|
|
9038
|
+
DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds));
|
|
9039
|
+
if (this.isOverflow)
|
|
8910
9040
|
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8911
9041
|
else
|
|
8912
9042
|
data.__textBoxBounds = b;
|
|
8913
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8914
9043
|
}
|
|
8915
9044
|
__onUpdateSize() {
|
|
8916
9045
|
if (this.__box)
|
|
@@ -9024,6 +9153,9 @@ __decorate([
|
|
|
9024
9153
|
__decorate([
|
|
9025
9154
|
boundsType('show')
|
|
9026
9155
|
], Text.prototype, "textOverflow", void 0);
|
|
9156
|
+
__decorate([
|
|
9157
|
+
surfaceType(false)
|
|
9158
|
+
], Text.prototype, "textEditing", void 0);
|
|
9027
9159
|
Text = __decorate([
|
|
9028
9160
|
registerUI()
|
|
9029
9161
|
], Text);
|
|
@@ -9111,7 +9243,7 @@ let App = class App extends Leafer {
|
|
|
9111
9243
|
if (sky || editor)
|
|
9112
9244
|
this.sky = this.addLeafer(sky);
|
|
9113
9245
|
if (editor)
|
|
9114
|
-
|
|
9246
|
+
Creator.editor(editor, this);
|
|
9115
9247
|
}
|
|
9116
9248
|
}
|
|
9117
9249
|
__setApp() {
|
|
@@ -9125,6 +9257,10 @@ let App = class App extends Leafer {
|
|
|
9125
9257
|
this.watcher.disable();
|
|
9126
9258
|
this.layouter.disable();
|
|
9127
9259
|
}
|
|
9260
|
+
__updateLocalBounds() {
|
|
9261
|
+
this.forEach(leafer => leafer.updateLayout());
|
|
9262
|
+
super.__updateLocalBounds();
|
|
9263
|
+
}
|
|
9128
9264
|
start() {
|
|
9129
9265
|
super.start();
|
|
9130
9266
|
this.forEach(leafer => leafer.start());
|
|
@@ -9182,12 +9318,8 @@ let App = class App extends Leafer {
|
|
|
9182
9318
|
this.renderer.update();
|
|
9183
9319
|
}
|
|
9184
9320
|
__render(canvas, options) {
|
|
9185
|
-
if (canvas.context)
|
|
9186
|
-
|
|
9187
|
-
if (m)
|
|
9188
|
-
canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
9189
|
-
this.forEach(leafer => canvas.copyWorld(leafer.canvas));
|
|
9190
|
-
}
|
|
9321
|
+
if (canvas.context)
|
|
9322
|
+
this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
|
|
9191
9323
|
}
|
|
9192
9324
|
__onResize(event) {
|
|
9193
9325
|
this.forEach(leafer => leafer.resize(event));
|
|
@@ -9208,9 +9340,11 @@ let App = class App extends Leafer {
|
|
|
9208
9340
|
return config;
|
|
9209
9341
|
}
|
|
9210
9342
|
__listenChildEvents(leafer) {
|
|
9211
|
-
leafer.once(
|
|
9212
|
-
|
|
9213
|
-
|
|
9343
|
+
leafer.once([
|
|
9344
|
+
[LayoutEvent.END, this.__onReady, this],
|
|
9345
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
9346
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
9347
|
+
]);
|
|
9214
9348
|
if (this.realCanvas)
|
|
9215
9349
|
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9216
9350
|
}
|
|
@@ -9421,7 +9555,7 @@ MoveEvent = __decorate([
|
|
|
9421
9555
|
registerUIEvent()
|
|
9422
9556
|
], MoveEvent);
|
|
9423
9557
|
|
|
9424
|
-
let RotateEvent = class RotateEvent extends
|
|
9558
|
+
let RotateEvent = class RotateEvent extends PointerEvent {
|
|
9425
9559
|
};
|
|
9426
9560
|
RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
|
|
9427
9561
|
RotateEvent.START = 'rotate.start';
|
|
@@ -9442,7 +9576,7 @@ SwipeEvent = __decorate([
|
|
|
9442
9576
|
registerUIEvent()
|
|
9443
9577
|
], SwipeEvent);
|
|
9444
9578
|
|
|
9445
|
-
let ZoomEvent = class ZoomEvent extends
|
|
9579
|
+
let ZoomEvent = class ZoomEvent extends PointerEvent {
|
|
9446
9580
|
};
|
|
9447
9581
|
ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
|
|
9448
9582
|
ZoomEvent.START = 'zoom.start';
|
|
@@ -10285,8 +10419,8 @@ ui$5.__updateHitCanvas = function () {
|
|
|
10285
10419
|
if (this.__box)
|
|
10286
10420
|
this.__box.__updateHitCanvas();
|
|
10287
10421
|
const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
|
|
10288
|
-
const isHitPixelFill = (data.
|
|
10289
|
-
const isHitPixelStroke = data.
|
|
10422
|
+
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
10423
|
+
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
10290
10424
|
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
10291
10425
|
if (!this.__hitCanvas)
|
|
10292
10426
|
this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
|
|
@@ -10317,11 +10451,11 @@ ui$5.__hit = function (inner) {
|
|
|
10317
10451
|
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
10318
10452
|
return true;
|
|
10319
10453
|
const { hitFill } = data;
|
|
10320
|
-
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.
|
|
10454
|
+
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
10321
10455
|
if (needHitFillPath && this.__hitFill(inner))
|
|
10322
10456
|
return true;
|
|
10323
10457
|
const { hitStroke, __strokeWidth } = data;
|
|
10324
|
-
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.
|
|
10458
|
+
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
10325
10459
|
if (!needHitFillPath && !needHitStrokePath)
|
|
10326
10460
|
return false;
|
|
10327
10461
|
const radiusWidth = inner.radiusX * 2;
|
|
@@ -10567,35 +10701,38 @@ function fillPathOrText(ui, canvas) {
|
|
|
10567
10701
|
}
|
|
10568
10702
|
|
|
10569
10703
|
function strokeText(stroke, ui, canvas) {
|
|
10570
|
-
|
|
10571
|
-
const isStrokes = typeof stroke !== 'string';
|
|
10572
|
-
switch (strokeAlign) {
|
|
10704
|
+
switch (ui.__.strokeAlign) {
|
|
10573
10705
|
case 'center':
|
|
10574
|
-
|
|
10575
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
10706
|
+
drawCenter$1(stroke, 1, ui, canvas);
|
|
10576
10707
|
break;
|
|
10577
10708
|
case 'inside':
|
|
10578
|
-
|
|
10709
|
+
drawAlign(stroke, 'inside', ui, canvas);
|
|
10579
10710
|
break;
|
|
10580
10711
|
case 'outside':
|
|
10581
|
-
|
|
10712
|
+
ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, 'outside', ui, canvas);
|
|
10582
10713
|
break;
|
|
10583
10714
|
}
|
|
10584
10715
|
}
|
|
10585
|
-
function
|
|
10586
|
-
const
|
|
10716
|
+
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
10717
|
+
const data = ui.__;
|
|
10718
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
|
|
10719
|
+
data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
10720
|
+
}
|
|
10721
|
+
function drawAlign(stroke, align, ui, canvas) {
|
|
10587
10722
|
const out = canvas.getSameCanvas(true, true);
|
|
10588
|
-
out.
|
|
10589
|
-
|
|
10590
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
|
|
10723
|
+
out.font = ui.__.__font;
|
|
10724
|
+
drawCenter$1(stroke, 2, ui, out);
|
|
10591
10725
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10592
10726
|
fillText(ui, out);
|
|
10593
10727
|
out.blendMode = 'normal';
|
|
10594
|
-
|
|
10728
|
+
copyWorld(canvas, out, ui);
|
|
10729
|
+
out.recycle(ui.__nowWorld);
|
|
10730
|
+
}
|
|
10731
|
+
function copyWorld(canvas, out, ui) {
|
|
10732
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
10595
10733
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10596
10734
|
else
|
|
10597
10735
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10598
|
-
out.recycle(ui.__nowWorld);
|
|
10599
10736
|
}
|
|
10600
10737
|
function drawTextStroke(ui, canvas) {
|
|
10601
10738
|
let row, data = ui.__.__textDrawData;
|
|
@@ -10633,90 +10770,56 @@ function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
|
10633
10770
|
}
|
|
10634
10771
|
|
|
10635
10772
|
function stroke(stroke, ui, canvas) {
|
|
10636
|
-
const
|
|
10637
|
-
|
|
10638
|
-
if (!__strokeWidth)
|
|
10773
|
+
const data = ui.__;
|
|
10774
|
+
if (!data.__strokeWidth)
|
|
10639
10775
|
return;
|
|
10640
|
-
if (__font) {
|
|
10776
|
+
if (data.__font) {
|
|
10641
10777
|
strokeText(stroke, ui, canvas);
|
|
10642
10778
|
}
|
|
10643
10779
|
else {
|
|
10644
|
-
switch (strokeAlign) {
|
|
10780
|
+
switch (data.strokeAlign) {
|
|
10645
10781
|
case 'center':
|
|
10646
|
-
|
|
10647
|
-
canvas.stroke();
|
|
10648
|
-
if (options.__useArrow)
|
|
10649
|
-
strokeArrow(ui, canvas);
|
|
10782
|
+
drawCenter(stroke, 1, ui, canvas);
|
|
10650
10783
|
break;
|
|
10651
10784
|
case 'inside':
|
|
10652
|
-
canvas
|
|
10653
|
-
canvas.setStroke(stroke, __strokeWidth * 2, options);
|
|
10654
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
10655
|
-
canvas.stroke();
|
|
10656
|
-
canvas.restore();
|
|
10785
|
+
drawInside(stroke, ui, canvas);
|
|
10657
10786
|
break;
|
|
10658
10787
|
case 'outside':
|
|
10659
|
-
|
|
10660
|
-
out.setStroke(stroke, __strokeWidth * 2, options);
|
|
10661
|
-
ui.__drawRenderPath(out);
|
|
10662
|
-
out.stroke();
|
|
10663
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10664
|
-
out.clearWorld(ui.__layout.renderBounds);
|
|
10665
|
-
if (ui.__worldFlipped)
|
|
10666
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10667
|
-
else
|
|
10668
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10669
|
-
out.recycle(ui.__nowWorld);
|
|
10788
|
+
drawOutside(stroke, ui, canvas);
|
|
10670
10789
|
break;
|
|
10671
10790
|
}
|
|
10672
10791
|
}
|
|
10673
10792
|
}
|
|
10674
10793
|
function strokes(strokes, ui, canvas) {
|
|
10675
|
-
|
|
10676
|
-
|
|
10677
|
-
|
|
10678
|
-
|
|
10679
|
-
|
|
10680
|
-
|
|
10794
|
+
stroke(strokes, ui, canvas);
|
|
10795
|
+
}
|
|
10796
|
+
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
10797
|
+
const data = ui.__;
|
|
10798
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
10799
|
+
data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
|
|
10800
|
+
if (data.__useArrow)
|
|
10801
|
+
Paint.strokeArrow(stroke, ui, canvas);
|
|
10802
|
+
}
|
|
10803
|
+
function drawInside(stroke, ui, canvas) {
|
|
10804
|
+
canvas.save();
|
|
10805
|
+
canvas.clipUI(ui);
|
|
10806
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
10807
|
+
canvas.restore();
|
|
10808
|
+
}
|
|
10809
|
+
function drawOutside(stroke, ui, canvas) {
|
|
10810
|
+
const data = ui.__;
|
|
10811
|
+
if (data.__fillAfterStroke) {
|
|
10812
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
10681
10813
|
}
|
|
10682
10814
|
else {
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
canvas.save();
|
|
10692
|
-
canvas.setStroke(undefined, __strokeWidth * 2, options);
|
|
10693
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
10694
|
-
drawStrokesStyle(strokes, false, ui, canvas);
|
|
10695
|
-
canvas.restore();
|
|
10696
|
-
break;
|
|
10697
|
-
case 'outside':
|
|
10698
|
-
const { renderBounds } = ui.__layout;
|
|
10699
|
-
const out = canvas.getSameCanvas(true, true);
|
|
10700
|
-
ui.__drawRenderPath(out);
|
|
10701
|
-
out.setStroke(undefined, __strokeWidth * 2, options);
|
|
10702
|
-
drawStrokesStyle(strokes, false, ui, out);
|
|
10703
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10704
|
-
out.clearWorld(renderBounds);
|
|
10705
|
-
if (ui.__worldFlipped)
|
|
10706
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10707
|
-
else
|
|
10708
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
10709
|
-
out.recycle(ui.__nowWorld);
|
|
10710
|
-
break;
|
|
10711
|
-
}
|
|
10712
|
-
}
|
|
10713
|
-
}
|
|
10714
|
-
function strokeArrow(ui, canvas) {
|
|
10715
|
-
if (ui.__.dashPattern) {
|
|
10716
|
-
canvas.beginPath();
|
|
10717
|
-
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
10718
|
-
canvas.dashPattern = null;
|
|
10719
|
-
canvas.stroke();
|
|
10815
|
+
const { renderBounds } = ui.__layout;
|
|
10816
|
+
const out = canvas.getSameCanvas(true, true);
|
|
10817
|
+
ui.__drawRenderPath(out);
|
|
10818
|
+
drawCenter(stroke, 2, ui, out);
|
|
10819
|
+
out.clipUI(data);
|
|
10820
|
+
out.clearWorld(renderBounds);
|
|
10821
|
+
copyWorld(canvas, out, ui);
|
|
10822
|
+
out.recycle(ui.__nowWorld);
|
|
10720
10823
|
}
|
|
10721
10824
|
}
|
|
10722
10825
|
|
|
@@ -10763,41 +10866,66 @@ function shape(ui, current, options) {
|
|
|
10763
10866
|
}
|
|
10764
10867
|
|
|
10765
10868
|
let recycleMap;
|
|
10869
|
+
const { stintSet } = DataHelper, { hasTransparent: hasTransparent$1 } = ColorConvert;
|
|
10766
10870
|
function compute(attrName, ui) {
|
|
10767
10871
|
const data = ui.__, leafPaints = [];
|
|
10768
|
-
let paints = data.__input[attrName],
|
|
10872
|
+
let paints = data.__input[attrName], isAlphaPixel, isTransparent;
|
|
10769
10873
|
if (!(paints instanceof Array))
|
|
10770
10874
|
paints = [paints];
|
|
10771
10875
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
10772
10876
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
10773
|
-
item = getLeafPaint(attrName, paints[i], ui);
|
|
10774
|
-
if (item)
|
|
10775
|
-
leafPaints.push(item);
|
|
10877
|
+
(item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
|
|
10776
10878
|
}
|
|
10777
10879
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
10778
|
-
if (leafPaints.length
|
|
10779
|
-
|
|
10780
|
-
|
|
10880
|
+
if (leafPaints.length) {
|
|
10881
|
+
if (leafPaints.every(item => item.isTransparent)) {
|
|
10882
|
+
if (leafPaints.some(item => item.image))
|
|
10883
|
+
isAlphaPixel = true;
|
|
10884
|
+
isTransparent = true;
|
|
10885
|
+
}
|
|
10886
|
+
}
|
|
10887
|
+
if (attrName === 'fill') {
|
|
10888
|
+
stintSet(data, '__isAlphaPixelFill', isAlphaPixel);
|
|
10889
|
+
stintSet(data, '__isTransparentFill', isTransparent);
|
|
10890
|
+
}
|
|
10891
|
+
else {
|
|
10892
|
+
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
10893
|
+
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
10894
|
+
}
|
|
10781
10895
|
}
|
|
10782
10896
|
function getLeafPaint(attrName, paint, ui) {
|
|
10783
10897
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
|
10784
10898
|
return undefined;
|
|
10899
|
+
let data;
|
|
10785
10900
|
const { boxBounds } = ui.__layout;
|
|
10786
10901
|
switch (paint.type) {
|
|
10787
|
-
case 'solid':
|
|
10788
|
-
let { type, blendMode, color, opacity } = paint;
|
|
10789
|
-
return { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
10790
10902
|
case 'image':
|
|
10791
|
-
|
|
10903
|
+
data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
10904
|
+
break;
|
|
10792
10905
|
case 'linear':
|
|
10793
|
-
|
|
10906
|
+
data = PaintGradient.linearGradient(paint, boxBounds);
|
|
10907
|
+
break;
|
|
10794
10908
|
case 'radial':
|
|
10795
|
-
|
|
10909
|
+
data = PaintGradient.radialGradient(paint, boxBounds);
|
|
10910
|
+
break;
|
|
10796
10911
|
case 'angular':
|
|
10797
|
-
|
|
10912
|
+
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
10913
|
+
break;
|
|
10914
|
+
case 'solid':
|
|
10915
|
+
const { type, color, opacity } = paint;
|
|
10916
|
+
data = { type, style: ColorConvert.string(color, opacity) };
|
|
10917
|
+
break;
|
|
10798
10918
|
default:
|
|
10799
|
-
|
|
10919
|
+
if (paint.r !== undefined)
|
|
10920
|
+
data = { type: 'solid', style: ColorConvert.string(paint) };
|
|
10800
10921
|
}
|
|
10922
|
+
if (data) {
|
|
10923
|
+
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
10924
|
+
data.isTransparent = true;
|
|
10925
|
+
if (paint.blendMode)
|
|
10926
|
+
data.blendMode = paint.blendMode;
|
|
10927
|
+
}
|
|
10928
|
+
return data;
|
|
10801
10929
|
}
|
|
10802
10930
|
|
|
10803
10931
|
const PaintModule = {
|
|
@@ -10863,12 +10991,10 @@ function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, al
|
|
|
10863
10991
|
|
|
10864
10992
|
const { get: get$2, translate } = MatrixHelper;
|
|
10865
10993
|
const tempBox = new Bounds();
|
|
10866
|
-
const tempPoint$1 = {};
|
|
10867
10994
|
const tempScaleData = {};
|
|
10995
|
+
const tempImage = {};
|
|
10868
10996
|
function createData(leafPaint, image, paint, box) {
|
|
10869
|
-
const {
|
|
10870
|
-
if (blendMode)
|
|
10871
|
-
leafPaint.blendMode = blendMode;
|
|
10997
|
+
const { changeful, sync } = paint;
|
|
10872
10998
|
if (changeful)
|
|
10873
10999
|
leafPaint.changeful = changeful;
|
|
10874
11000
|
if (sync)
|
|
@@ -10876,38 +11002,38 @@ function createData(leafPaint, image, paint, box) {
|
|
|
10876
11002
|
leafPaint.data = getPatternData(paint, box, image);
|
|
10877
11003
|
}
|
|
10878
11004
|
function getPatternData(paint, box, image) {
|
|
10879
|
-
let { width, height } = image;
|
|
10880
11005
|
if (paint.padding)
|
|
10881
11006
|
box = tempBox.set(box).shrink(paint.padding);
|
|
10882
11007
|
if (paint.mode === 'strench')
|
|
10883
11008
|
paint.mode = 'stretch';
|
|
11009
|
+
let { width, height } = image;
|
|
10884
11010
|
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
10885
11011
|
const sameBox = box.width === width && box.height === height;
|
|
10886
11012
|
const data = { mode };
|
|
10887
11013
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
10888
|
-
|
|
10889
|
-
let
|
|
11014
|
+
BoundsHelper.set(tempImage, 0, 0, swapSize ? height : width, swapSize ? width : height);
|
|
11015
|
+
let scaleX, scaleY;
|
|
10890
11016
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
10891
11017
|
if (!sameBox || rotation) {
|
|
10892
|
-
|
|
10893
|
-
|
|
10894
|
-
|
|
11018
|
+
scaleX = scaleY = BoundsHelper.getFitScale(box, tempImage, mode !== 'fit');
|
|
11019
|
+
BoundsHelper.put(box, image, align, scaleX, false, tempImage);
|
|
11020
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
10895
11021
|
}
|
|
10896
11022
|
}
|
|
10897
|
-
else
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
|
|
11023
|
+
else {
|
|
11024
|
+
if (scale || size) {
|
|
11025
|
+
MathHelper.getScaleData(scale, size, image, tempScaleData);
|
|
11026
|
+
scaleX = tempScaleData.scaleX;
|
|
11027
|
+
scaleY = tempScaleData.scaleY;
|
|
11028
|
+
}
|
|
11029
|
+
if (align) {
|
|
11030
|
+
if (scaleX)
|
|
11031
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
11032
|
+
AlignHelper.toPoint(align, tempImage, box, tempImage, true, true);
|
|
11033
|
+
}
|
|
10908
11034
|
}
|
|
10909
11035
|
if (offset)
|
|
10910
|
-
|
|
11036
|
+
PointHelper.move(tempImage, offset);
|
|
10911
11037
|
switch (mode) {
|
|
10912
11038
|
case 'stretch':
|
|
10913
11039
|
if (!sameBox)
|
|
@@ -10915,12 +11041,12 @@ function getPatternData(paint, box, image) {
|
|
|
10915
11041
|
break;
|
|
10916
11042
|
case 'normal':
|
|
10917
11043
|
case 'clip':
|
|
10918
|
-
if (x || y || scaleX || rotation)
|
|
10919
|
-
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
11044
|
+
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
11045
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
10920
11046
|
break;
|
|
10921
11047
|
case 'repeat':
|
|
10922
11048
|
if (!sameBox || scaleX || rotation)
|
|
10923
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
11049
|
+
repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, align);
|
|
10924
11050
|
if (!repeat)
|
|
10925
11051
|
data.repeat = 'repeat';
|
|
10926
11052
|
break;
|
|
@@ -10928,7 +11054,7 @@ function getPatternData(paint, box, image) {
|
|
|
10928
11054
|
case 'cover':
|
|
10929
11055
|
default:
|
|
10930
11056
|
if (scaleX)
|
|
10931
|
-
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
11057
|
+
fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
10932
11058
|
}
|
|
10933
11059
|
if (!data.transform) {
|
|
10934
11060
|
if (box.x || box.y) {
|
|
@@ -10961,6 +11087,8 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
10961
11087
|
}
|
|
10962
11088
|
else {
|
|
10963
11089
|
leafPaint = { type: paint.type, image };
|
|
11090
|
+
if (image.hasAlphaPixel)
|
|
11091
|
+
leafPaint.isTransparent = true;
|
|
10964
11092
|
cache$1 = image.use > 1 ? { leafPaint, paint, boxBounds: box$1.set(boxBounds) } : null;
|
|
10965
11093
|
}
|
|
10966
11094
|
if (firstUse || image.loading)
|
|
@@ -10985,7 +11113,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
10985
11113
|
ignoreRender(ui, false);
|
|
10986
11114
|
if (!ui.destroyed) {
|
|
10987
11115
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
10988
|
-
if (image.
|
|
11116
|
+
if (image.hasAlphaPixel)
|
|
10989
11117
|
ui.__layout.hitCanvasChanged = true;
|
|
10990
11118
|
ui.forceUpdate('surface');
|
|
10991
11119
|
}
|
|
@@ -10997,13 +11125,17 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
10997
11125
|
onLoadError(ui, event, error);
|
|
10998
11126
|
leafPaint.loadId = null;
|
|
10999
11127
|
});
|
|
11000
|
-
if (ui.placeholderColor)
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11128
|
+
if (ui.placeholderColor) {
|
|
11129
|
+
if (!ui.placeholderDelay)
|
|
11130
|
+
image.isPlacehold = true;
|
|
11131
|
+
else
|
|
11132
|
+
setTimeout(() => {
|
|
11133
|
+
if (!image.ready) {
|
|
11134
|
+
image.isPlacehold = true;
|
|
11135
|
+
ui.forceUpdate('surface');
|
|
11136
|
+
}
|
|
11137
|
+
}, ui.placeholderDelay);
|
|
11138
|
+
}
|
|
11007
11139
|
}
|
|
11008
11140
|
return leafPaint;
|
|
11009
11141
|
}
|
|
@@ -11158,7 +11290,7 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
11158
11290
|
}
|
|
11159
11291
|
function drawImage(ui, canvas, paint, data) {
|
|
11160
11292
|
canvas.save();
|
|
11161
|
-
|
|
11293
|
+
canvas.clipUI(ui);
|
|
11162
11294
|
if (paint.blendMode)
|
|
11163
11295
|
canvas.blendMode = paint.blendMode;
|
|
11164
11296
|
if (data.opacity)
|
|
@@ -11209,32 +11341,33 @@ const PaintImageModule = {
|
|
|
11209
11341
|
repeatMode
|
|
11210
11342
|
};
|
|
11211
11343
|
|
|
11212
|
-
const { toPoint: toPoint$3 } = AroundHelper;
|
|
11344
|
+
const { toPoint: toPoint$3 } = AroundHelper, { hasTransparent } = ColorConvert;
|
|
11213
11345
|
const realFrom$2 = {};
|
|
11214
11346
|
const realTo$2 = {};
|
|
11215
11347
|
function linearGradient(paint, box) {
|
|
11216
|
-
let { from, to, type,
|
|
11348
|
+
let { from, to, type, opacity } = paint;
|
|
11217
11349
|
toPoint$3(from || 'top', box, realFrom$2);
|
|
11218
11350
|
toPoint$3(to || 'bottom', box, realTo$2);
|
|
11219
11351
|
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
11220
|
-
applyStops(style, paint.stops, opacity);
|
|
11221
11352
|
const data = { type, style };
|
|
11222
|
-
|
|
11223
|
-
data.blendMode = blendMode;
|
|
11353
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11224
11354
|
return data;
|
|
11225
11355
|
}
|
|
11226
|
-
function applyStops(gradient, stops, opacity) {
|
|
11356
|
+
function applyStops(data, gradient, stops, opacity) {
|
|
11227
11357
|
if (stops) {
|
|
11228
|
-
let stop;
|
|
11358
|
+
let stop, color, offset, isTransparent;
|
|
11229
11359
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
11230
11360
|
stop = stops[i];
|
|
11231
|
-
if (typeof stop === 'string')
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
|
|
11361
|
+
if (typeof stop === 'string')
|
|
11362
|
+
offset = i / (len - 1), color = ColorConvert.string(stop, opacity);
|
|
11363
|
+
else
|
|
11364
|
+
offset = stop.offset, color = ColorConvert.string(stop.color, opacity);
|
|
11365
|
+
gradient.addColorStop(offset, color);
|
|
11366
|
+
if (!isTransparent && hasTransparent(color))
|
|
11367
|
+
isTransparent = true;
|
|
11237
11368
|
}
|
|
11369
|
+
if (isTransparent)
|
|
11370
|
+
data.isTransparent = true;
|
|
11238
11371
|
}
|
|
11239
11372
|
}
|
|
11240
11373
|
|
|
@@ -11244,17 +11377,15 @@ const { toPoint: toPoint$2 } = AroundHelper;
|
|
|
11244
11377
|
const realFrom$1 = {};
|
|
11245
11378
|
const realTo$1 = {};
|
|
11246
11379
|
function radialGradient(paint, box) {
|
|
11247
|
-
let { from, to, type, opacity,
|
|
11380
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
11248
11381
|
toPoint$2(from || 'center', box, realFrom$1);
|
|
11249
11382
|
toPoint$2(to || 'bottom', box, realTo$1);
|
|
11250
11383
|
const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$2(realFrom$1, realTo$1));
|
|
11251
|
-
applyStops(style, paint.stops, opacity);
|
|
11252
11384
|
const data = { type, style };
|
|
11385
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11253
11386
|
const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
|
|
11254
11387
|
if (transform)
|
|
11255
11388
|
data.transform = transform;
|
|
11256
|
-
if (blendMode)
|
|
11257
|
-
data.blendMode = blendMode;
|
|
11258
11389
|
return data;
|
|
11259
11390
|
}
|
|
11260
11391
|
function getTransform(box, from, to, stretch, rotate90) {
|
|
@@ -11280,17 +11411,15 @@ const { toPoint: toPoint$1 } = AroundHelper;
|
|
|
11280
11411
|
const realFrom = {};
|
|
11281
11412
|
const realTo = {};
|
|
11282
11413
|
function conicGradient(paint, box) {
|
|
11283
|
-
let { from, to, type, opacity,
|
|
11414
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
11284
11415
|
toPoint$1(from || 'center', box, realFrom);
|
|
11285
11416
|
toPoint$1(to || 'bottom', box, realTo);
|
|
11286
11417
|
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$1(realFrom, realTo));
|
|
11287
|
-
applyStops(style, paint.stops, opacity);
|
|
11288
11418
|
const data = { type, style };
|
|
11419
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11289
11420
|
const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
|
|
11290
11421
|
if (transform)
|
|
11291
11422
|
data.transform = transform;
|
|
11292
|
-
if (blendMode)
|
|
11293
|
-
data.blendMode = blendMode;
|
|
11294
11423
|
return data;
|
|
11295
11424
|
}
|
|
11296
11425
|
|
|
@@ -11326,12 +11455,10 @@ function shadow$1(ui, current, shape) {
|
|
|
11326
11455
|
}
|
|
11327
11456
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
11328
11457
|
}
|
|
11329
|
-
if (ui.__worldFlipped)
|
|
11458
|
+
if (ui.__worldFlipped)
|
|
11330
11459
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
11331
|
-
|
|
11332
|
-
else {
|
|
11460
|
+
else
|
|
11333
11461
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
11334
|
-
}
|
|
11335
11462
|
if (end && index < end)
|
|
11336
11463
|
other.clearWorld(copyBounds, true);
|
|
11337
11464
|
});
|
|
@@ -11390,12 +11517,10 @@ function innerShadow(ui, current, shape) {
|
|
|
11390
11517
|
copyBounds = bounds;
|
|
11391
11518
|
}
|
|
11392
11519
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
11393
|
-
if (ui.__worldFlipped)
|
|
11520
|
+
if (ui.__worldFlipped)
|
|
11394
11521
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
11395
|
-
|
|
11396
|
-
else {
|
|
11522
|
+
else
|
|
11397
11523
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
11398
|
-
}
|
|
11399
11524
|
if (end && index < end)
|
|
11400
11525
|
other.clearWorld(copyBounds, true);
|
|
11401
11526
|
});
|
|
@@ -11623,6 +11748,8 @@ function createRows(drawData, content, style) {
|
|
|
11623
11748
|
lastCharType = null;
|
|
11624
11749
|
startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
|
|
11625
11750
|
word = { data: [] }, row = { words: [] };
|
|
11751
|
+
if (__letterSpacing)
|
|
11752
|
+
content = [...content];
|
|
11626
11753
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
11627
11754
|
char = content[i];
|
|
11628
11755
|
if (char === '\n') {
|
|
@@ -12476,24 +12603,25 @@ class EditSelect extends Group {
|
|
|
12476
12603
|
const { app } = editor;
|
|
12477
12604
|
app.selector.proxy = editor;
|
|
12478
12605
|
this.__eventIds = [
|
|
12479
|
-
editor.on_(
|
|
12480
|
-
|
|
12481
|
-
|
|
12482
|
-
|
|
12483
|
-
app.on_(
|
|
12484
|
-
|
|
12485
|
-
|
|
12486
|
-
|
|
12487
|
-
|
|
12488
|
-
|
|
12606
|
+
editor.on_([
|
|
12607
|
+
[EditorEvent.HOVER, this.onHover, this],
|
|
12608
|
+
[EditorEvent.SELECT, this.onSelect, this]
|
|
12609
|
+
]),
|
|
12610
|
+
app.on_([
|
|
12611
|
+
[PointerEvent.MOVE, this.onPointerMove, this],
|
|
12612
|
+
[PointerEvent.BEFORE_DOWN, this.onBeforeDown, this],
|
|
12613
|
+
[PointerEvent.TAP, this.onTap, this],
|
|
12614
|
+
[DragEvent.START, this.onDragStart, this, true],
|
|
12615
|
+
[DragEvent.DRAG, this.onDrag, this],
|
|
12616
|
+
[DragEvent.END, this.onDragEnd, this],
|
|
12617
|
+
[MoveEvent.MOVE, this.onAutoMove, this],
|
|
12618
|
+
[[ZoomEvent.ZOOM, MoveEvent.MOVE], () => { this.editor.hoverTarget = null; }],
|
|
12619
|
+
])
|
|
12489
12620
|
];
|
|
12490
12621
|
});
|
|
12491
12622
|
}
|
|
12492
12623
|
__removeListenEvents() {
|
|
12493
|
-
|
|
12494
|
-
this.off_(this.__eventIds);
|
|
12495
|
-
this.__eventIds.length = 0;
|
|
12496
|
-
}
|
|
12624
|
+
this.off_(this.__eventIds);
|
|
12497
12625
|
}
|
|
12498
12626
|
destroy() {
|
|
12499
12627
|
this.editor = this.originList = this.needRemoveItem = null;
|
|
@@ -12782,6 +12910,10 @@ function toDataURL(svg, rotation) {
|
|
|
12782
12910
|
}
|
|
12783
12911
|
|
|
12784
12912
|
class EditPoint extends Box {
|
|
12913
|
+
constructor(data) {
|
|
12914
|
+
super(data);
|
|
12915
|
+
this.useFastShadow = true;
|
|
12916
|
+
}
|
|
12785
12917
|
}
|
|
12786
12918
|
|
|
12787
12919
|
const fourDirection = ['top', 'right', 'bottom', 'left'], editConfig = undefined;
|
|
@@ -13052,28 +13184,29 @@ class EditBox extends Group {
|
|
|
13052
13184
|
const { editor } = this;
|
|
13053
13185
|
point.direction = direction;
|
|
13054
13186
|
point.pointType = type;
|
|
13055
|
-
|
|
13056
|
-
|
|
13057
|
-
|
|
13058
|
-
|
|
13187
|
+
const events = [
|
|
13188
|
+
[DragEvent.START, this.onDragStart, this],
|
|
13189
|
+
[DragEvent.DRAG, this.onDrag, this],
|
|
13190
|
+
[DragEvent.END, this.onDragEnd, this],
|
|
13191
|
+
[PointerEvent.LEAVE, () => { this.enterPoint = null; }],
|
|
13192
|
+
];
|
|
13059
13193
|
if (point.name !== 'circle')
|
|
13060
|
-
|
|
13194
|
+
events.push([PointerEvent.ENTER, (e) => { this.enterPoint = point, updateCursor(editor, e); }]);
|
|
13195
|
+
this.__eventIds.push(point.on_(events));
|
|
13061
13196
|
}
|
|
13062
13197
|
__listenEvents() {
|
|
13063
13198
|
const { rect, editor } = this;
|
|
13064
|
-
this.__eventIds
|
|
13065
|
-
|
|
13066
|
-
|
|
13067
|
-
|
|
13068
|
-
|
|
13069
|
-
|
|
13070
|
-
|
|
13071
|
-
|
|
13072
|
-
];
|
|
13199
|
+
this.__eventIds.push(editor.on_(EditorEvent.SELECT, this.onSelect, this), rect.on_([
|
|
13200
|
+
[DragEvent.START, this.onDragStart, this],
|
|
13201
|
+
[DragEvent.DRAG, editor.onMove, editor],
|
|
13202
|
+
[DragEvent.END, this.onDragEnd, this],
|
|
13203
|
+
[PointerEvent.ENTER, () => updateMoveCursor(editor)],
|
|
13204
|
+
[PointerEvent.DOUBLE_TAP, this.onDoubleTap, this],
|
|
13205
|
+
[PointerEvent.LONG_PRESS, this.onLongPress, this]
|
|
13206
|
+
]));
|
|
13073
13207
|
}
|
|
13074
13208
|
__removeListenEvents() {
|
|
13075
13209
|
this.off_(this.__eventIds);
|
|
13076
|
-
this.__eventIds.length = 0;
|
|
13077
13210
|
}
|
|
13078
13211
|
destroy() {
|
|
13079
13212
|
this.editor = null;
|
|
@@ -13815,12 +13948,14 @@ class Editor extends Group {
|
|
|
13815
13948
|
const { app, leafer, editBox, editMask } = this;
|
|
13816
13949
|
this.targetEventIds = [
|
|
13817
13950
|
leafer.on_(RenderEvent.START, this.onRenderStart, this),
|
|
13818
|
-
app.on_(
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13951
|
+
app.on_([
|
|
13952
|
+
[RenderEvent.CHILD_START, this.onAppRenderStart, this],
|
|
13953
|
+
[MoveEvent.BEFORE_MOVE, this.onMove, this, true],
|
|
13954
|
+
[ZoomEvent.BEFORE_ZOOM, this.onScale, this, true],
|
|
13955
|
+
[RotateEvent.BEFORE_ROTATE, this.onRotate, this, true],
|
|
13956
|
+
[[KeyEvent.HOLD, KeyEvent.UP], this.onKey, this],
|
|
13957
|
+
[KeyEvent.DOWN, editBox.onArrow, editBox]
|
|
13958
|
+
])
|
|
13824
13959
|
];
|
|
13825
13960
|
if (editMask.visible)
|
|
13826
13961
|
editMask.forceRender();
|
|
@@ -13830,7 +13965,6 @@ class Editor extends Group {
|
|
|
13830
13965
|
const { targetEventIds, editMask } = this;
|
|
13831
13966
|
if (targetEventIds.length) {
|
|
13832
13967
|
this.off_(targetEventIds);
|
|
13833
|
-
targetEventIds.length = 0;
|
|
13834
13968
|
if (editMask.visible)
|
|
13835
13969
|
editMask.forceRender();
|
|
13836
13970
|
}
|
|
@@ -14299,7 +14433,12 @@ Box.prototype.__scaleResize = function (scaleX, scaleY) {
|
|
|
14299
14433
|
Plugin.add('resize');
|
|
14300
14434
|
|
|
14301
14435
|
Plugin.add('editor', 'resize');
|
|
14302
|
-
Creator.editor = function (options) {
|
|
14436
|
+
Creator.editor = function (options, app) {
|
|
14437
|
+
const editor = new Editor(options);
|
|
14438
|
+
if (app)
|
|
14439
|
+
app.sky.add(app.editor = editor);
|
|
14440
|
+
return editor;
|
|
14441
|
+
};
|
|
14303
14442
|
Box.addAttr('textBox', false, dataType);
|
|
14304
14443
|
UI.addAttr('editConfig', undefined, dataType);
|
|
14305
14444
|
UI.addAttr('editOuter', (ui) => ui.__.__isLinePath ? 'LineEditTool' : 'EditTool', dataType);
|
|
@@ -14602,6 +14741,7 @@ interaction.multiTouch = function (data, list) {
|
|
|
14602
14741
|
return;
|
|
14603
14742
|
const { move, rotation, scale, center } = MultiTouchHelper.getData(list);
|
|
14604
14743
|
Object.assign(data, center);
|
|
14744
|
+
data.multiTouch = true;
|
|
14605
14745
|
this.pointerWaitCancel();
|
|
14606
14746
|
this.rotate(getRotateEventData(rotation, data));
|
|
14607
14747
|
this.zoom(getZoomEventData(scale, data));
|
|
@@ -15141,6 +15281,16 @@ Plugin.add('arrow');
|
|
|
15141
15281
|
UI.addAttr('startArrow', 'none', arrowType);
|
|
15142
15282
|
UI.addAttr('endArrow', 'none', arrowType);
|
|
15143
15283
|
Object.assign(PathArrow, PathArrowModule);
|
|
15284
|
+
Object.assign(Paint, {
|
|
15285
|
+
strokeArrow(_stroke, ui, canvas) {
|
|
15286
|
+
if (ui.__.dashPattern) {
|
|
15287
|
+
canvas.beginPath();
|
|
15288
|
+
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
15289
|
+
canvas.dashPattern = null;
|
|
15290
|
+
canvas.stroke();
|
|
15291
|
+
}
|
|
15292
|
+
}
|
|
15293
|
+
});
|
|
15144
15294
|
|
|
15145
15295
|
class FlowData extends BoxData {
|
|
15146
15296
|
}
|
|
@@ -17754,10 +17904,9 @@ const ExportModule = {
|
|
|
17754
17904
|
else {
|
|
17755
17905
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
17756
17906
|
const { worldTransform, isLeafer, leafer, isFrame } = leaf;
|
|
17757
|
-
const { slice, clip, trim, padding, onCanvas } = options;
|
|
17907
|
+
const { slice, clip, trim, screenshot, padding, onCanvas } = options;
|
|
17758
17908
|
const smooth = options.smooth === undefined ? (leafer ? leafer.config.smooth : true) : options.smooth;
|
|
17759
17909
|
const contextSettings = options.contextSettings || (leafer ? leafer.config.contextSettings : undefined);
|
|
17760
|
-
const screenshot = options.screenshot || leaf.isApp;
|
|
17761
17910
|
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
|
|
17762
17911
|
const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
|
|
17763
17912
|
if (screenshot) {
|
|
@@ -17793,11 +17942,6 @@ const ExportModule = {
|
|
|
17793
17942
|
const scaleData = { scaleX: 1, scaleY: 1 };
|
|
17794
17943
|
MathHelper.getScaleData(options.scale, options.size, renderBounds, scaleData);
|
|
17795
17944
|
let pixelRatio = options.pixelRatio || 1;
|
|
17796
|
-
if (leaf.isApp) {
|
|
17797
|
-
scaleData.scaleX *= pixelRatio;
|
|
17798
|
-
scaleData.scaleY *= pixelRatio;
|
|
17799
|
-
pixelRatio = leaf.app.pixelRatio;
|
|
17800
|
-
}
|
|
17801
17945
|
let { x, y, width, height } = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
|
|
17802
17946
|
if (clip)
|
|
17803
17947
|
x += clip.x, y += clip.y, width = clip.width, height = clip.height;
|
|
@@ -17952,4 +18096,4 @@ Object.assign(Filter, {
|
|
|
17952
18096
|
}
|
|
17953
18097
|
});
|
|
17954
18098
|
|
|
17955
|
-
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, 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, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, 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, motionPathType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$
|
|
18099
|
+
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, 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, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, 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, motionPathType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|