@leafer/worker 1.6.2 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.js +622 -478
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +621 -478
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +20 -20
package/dist/worker.module.js
CHANGED
|
@@ -23,8 +23,6 @@ const Platform = {
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
const Creator = {};
|
|
27
|
-
|
|
28
26
|
const IncrementId = {
|
|
29
27
|
RUNTIME: 'runtime',
|
|
30
28
|
LEAF: 'leaf',
|
|
@@ -150,7 +148,7 @@ function getMatrixData() { return { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }; }
|
|
|
150
148
|
|
|
151
149
|
const { sin: sin$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 true; }
|
|
@@ -6301,17 +6392,15 @@ class Watcher {
|
|
|
6301
6392
|
this.target.emitEvent(new WatchEvent(WatchEvent.DATA, { updatedList: this.updatedList }));
|
|
6302
6393
|
this.__updatedList = new LeafList();
|
|
6303
6394
|
this.totalTimes++;
|
|
6304
|
-
this.changed = false;
|
|
6305
|
-
this.hasVisible = false;
|
|
6306
|
-
this.hasRemove = false;
|
|
6307
|
-
this.hasAdd = false;
|
|
6395
|
+
this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
6308
6396
|
}
|
|
6309
6397
|
__listenEvents() {
|
|
6310
|
-
const { target } = this;
|
|
6311
6398
|
this.__eventIds = [
|
|
6312
|
-
target.on_(
|
|
6313
|
-
|
|
6314
|
-
|
|
6399
|
+
this.target.on_([
|
|
6400
|
+
[PropertyEvent.CHANGE, this.__onAttrChange, this],
|
|
6401
|
+
[[ChildEvent.ADD, ChildEvent.REMOVE], this.__onChildEvent, this],
|
|
6402
|
+
[WatchEvent.REQUEST, this.__onRquestData, this]
|
|
6403
|
+
])
|
|
6315
6404
|
];
|
|
6316
6405
|
}
|
|
6317
6406
|
__removeListenEvents() {
|
|
@@ -6321,8 +6410,7 @@ class Watcher {
|
|
|
6321
6410
|
if (this.target) {
|
|
6322
6411
|
this.stop();
|
|
6323
6412
|
this.__removeListenEvents();
|
|
6324
|
-
this.target = null;
|
|
6325
|
-
this.__updatedList = null;
|
|
6413
|
+
this.target = this.__updatedList = null;
|
|
6326
6414
|
}
|
|
6327
6415
|
}
|
|
6328
6416
|
}
|
|
@@ -6427,7 +6515,7 @@ class Layouter {
|
|
|
6427
6515
|
this.disabled = true;
|
|
6428
6516
|
}
|
|
6429
6517
|
layout() {
|
|
6430
|
-
if (!this.running)
|
|
6518
|
+
if (this.layouting || !this.running)
|
|
6431
6519
|
return;
|
|
6432
6520
|
const { target } = this;
|
|
6433
6521
|
this.times = 0;
|
|
@@ -6510,12 +6598,10 @@ class Layouter {
|
|
|
6510
6598
|
}
|
|
6511
6599
|
static fullLayout(target) {
|
|
6512
6600
|
updateAllMatrix$1(target, true);
|
|
6513
|
-
if (target.isBranch)
|
|
6601
|
+
if (target.isBranch)
|
|
6514
6602
|
BranchHelper.updateBounds(target);
|
|
6515
|
-
|
|
6516
|
-
else {
|
|
6603
|
+
else
|
|
6517
6604
|
LeafHelper.updateBounds(target);
|
|
6518
|
-
}
|
|
6519
6605
|
updateAllChange(target);
|
|
6520
6606
|
}
|
|
6521
6607
|
addExtra(leaf) {
|
|
@@ -6538,11 +6624,12 @@ class Layouter {
|
|
|
6538
6624
|
this.__updatedList = event.data.updatedList;
|
|
6539
6625
|
}
|
|
6540
6626
|
__listenEvents() {
|
|
6541
|
-
const { target } = this;
|
|
6542
6627
|
this.__eventIds = [
|
|
6543
|
-
target.on_(
|
|
6544
|
-
|
|
6545
|
-
|
|
6628
|
+
this.target.on_([
|
|
6629
|
+
[LayoutEvent.REQUEST, this.layout, this],
|
|
6630
|
+
[LayoutEvent.AGAIN, this.layoutAgain, this],
|
|
6631
|
+
[WatchEvent.DATA, this.__onReceiveWatchData, this]
|
|
6632
|
+
])
|
|
6546
6633
|
];
|
|
6547
6634
|
}
|
|
6548
6635
|
__removeListenEvents() {
|
|
@@ -6773,12 +6860,13 @@ class Renderer {
|
|
|
6773
6860
|
this.target.emitEvent(new RenderEvent(type, this.times, bounds, options));
|
|
6774
6861
|
}
|
|
6775
6862
|
__listenEvents() {
|
|
6776
|
-
const { target } = this;
|
|
6777
6863
|
this.__eventIds = [
|
|
6778
|
-
target.on_(
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6864
|
+
this.target.on_([
|
|
6865
|
+
[RenderEvent.REQUEST, this.update, this],
|
|
6866
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
6867
|
+
[RenderEvent.AGAIN, this.renderAgain, this],
|
|
6868
|
+
[ResizeEvent.RESIZE, this.__onResize, this]
|
|
6869
|
+
])
|
|
6782
6870
|
];
|
|
6783
6871
|
}
|
|
6784
6872
|
__removeListenEvents() {
|
|
@@ -6994,8 +7082,32 @@ function zoomLayerType() {
|
|
|
6994
7082
|
};
|
|
6995
7083
|
}
|
|
6996
7084
|
|
|
7085
|
+
function hasTransparent$3(color) {
|
|
7086
|
+
if (!color || color.length === 7 || color.length === 4)
|
|
7087
|
+
return false;
|
|
7088
|
+
if (color === 'transparent')
|
|
7089
|
+
return true;
|
|
7090
|
+
const first = color[0];
|
|
7091
|
+
if (first === '#') {
|
|
7092
|
+
switch (color.length) {
|
|
7093
|
+
case 5: return color[4] !== 'f' && color[4] !== 'F';
|
|
7094
|
+
case 9: return (color[7] !== 'f' && color[7] !== 'F') || (color[8] !== 'f' && color[8] !== 'F');
|
|
7095
|
+
}
|
|
7096
|
+
}
|
|
7097
|
+
else if (first === 'r' || first === 'h') {
|
|
7098
|
+
if (color[3] === 'a') {
|
|
7099
|
+
const i = color.lastIndexOf(',');
|
|
7100
|
+
if (i > -1)
|
|
7101
|
+
return parseFloat(color.slice(i + 1)) < 1;
|
|
7102
|
+
}
|
|
7103
|
+
}
|
|
7104
|
+
return false;
|
|
7105
|
+
}
|
|
7106
|
+
|
|
6997
7107
|
const TextConvert = {};
|
|
6998
|
-
const ColorConvert = {
|
|
7108
|
+
const ColorConvert = {
|
|
7109
|
+
hasTransparent: hasTransparent$3
|
|
7110
|
+
};
|
|
6999
7111
|
const UnitConvert = {
|
|
7000
7112
|
number(value, percentRefer) {
|
|
7001
7113
|
return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
|
|
@@ -7021,6 +7133,7 @@ const Transition = {
|
|
|
7021
7133
|
};
|
|
7022
7134
|
|
|
7023
7135
|
const { parse, objectToCanvasData } = PathConvert;
|
|
7136
|
+
const { stintSet: stintSet$2 } = DataHelper, { hasTransparent: hasTransparent$2 } = ColorConvert;
|
|
7024
7137
|
const emptyPaint = {};
|
|
7025
7138
|
const debug$5 = Debug.get('UIData');
|
|
7026
7139
|
class UIData extends LeafData {
|
|
@@ -7079,38 +7192,22 @@ class UIData extends LeafData {
|
|
|
7079
7192
|
if (this.__naturalWidth)
|
|
7080
7193
|
this.__removeNaturalSize();
|
|
7081
7194
|
if (typeof value === 'string' || !value) {
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
PaintImage.recycleImage('fill', this);
|
|
7085
|
-
this.__isFills = false;
|
|
7086
|
-
this.__pixelFill && (this.__pixelFill = false);
|
|
7087
|
-
}
|
|
7195
|
+
stintSet$2(this, '__isTransparentFill', hasTransparent$2(value));
|
|
7196
|
+
this.__isFills && this.__removePaint('fill', true);
|
|
7088
7197
|
this._fill = value;
|
|
7089
7198
|
}
|
|
7090
7199
|
else if (typeof value === 'object') {
|
|
7091
|
-
this.
|
|
7092
|
-
const layout = this.__leaf.__layout;
|
|
7093
|
-
layout.boxChanged || layout.boxChange();
|
|
7094
|
-
this.__isFills = true;
|
|
7095
|
-
this._fill || (this._fill = emptyPaint);
|
|
7200
|
+
this.__setPaint('fill', value);
|
|
7096
7201
|
}
|
|
7097
7202
|
}
|
|
7098
7203
|
setStroke(value) {
|
|
7099
7204
|
if (typeof value === 'string' || !value) {
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
PaintImage.recycleImage('stroke', this);
|
|
7103
|
-
this.__isStrokes = false;
|
|
7104
|
-
this.__pixelStroke && (this.__pixelStroke = false);
|
|
7105
|
-
}
|
|
7205
|
+
stintSet$2(this, '__isTransparentStroke', hasTransparent$2(value));
|
|
7206
|
+
this.__isStrokes && this.__removePaint('stroke', true);
|
|
7106
7207
|
this._stroke = value;
|
|
7107
7208
|
}
|
|
7108
7209
|
else if (typeof value === 'object') {
|
|
7109
|
-
this.
|
|
7110
|
-
const layout = this.__leaf.__layout;
|
|
7111
|
-
layout.boxChanged || layout.boxChange();
|
|
7112
|
-
this.__isStrokes = true;
|
|
7113
|
-
this._stroke || (this._stroke = emptyPaint);
|
|
7210
|
+
this.__setPaint('stroke', value);
|
|
7114
7211
|
}
|
|
7115
7212
|
}
|
|
7116
7213
|
setPath(value) {
|
|
@@ -7140,7 +7237,34 @@ class UIData extends LeafData {
|
|
|
7140
7237
|
Paint.compute('fill', this.__leaf);
|
|
7141
7238
|
if (stroke)
|
|
7142
7239
|
Paint.compute('stroke', this.__leaf);
|
|
7143
|
-
this.__needComputePaint =
|
|
7240
|
+
this.__needComputePaint = undefined;
|
|
7241
|
+
}
|
|
7242
|
+
__setPaint(attrName, value) {
|
|
7243
|
+
this.__setInput(attrName, value);
|
|
7244
|
+
const layout = this.__leaf.__layout;
|
|
7245
|
+
layout.boxChanged || layout.boxChange();
|
|
7246
|
+
if (value instanceof Array && !value.length) {
|
|
7247
|
+
this.__removePaint(attrName);
|
|
7248
|
+
}
|
|
7249
|
+
else {
|
|
7250
|
+
if (attrName === 'fill')
|
|
7251
|
+
this.__isFills = true, this._fill || (this._fill = emptyPaint);
|
|
7252
|
+
else
|
|
7253
|
+
this.__isStrokes = true, this._stroke || (this._stroke = emptyPaint);
|
|
7254
|
+
}
|
|
7255
|
+
}
|
|
7256
|
+
__removePaint(attrName, removeInput) {
|
|
7257
|
+
if (removeInput)
|
|
7258
|
+
this.__removeInput(attrName);
|
|
7259
|
+
PaintImage.recycleImage(attrName, this);
|
|
7260
|
+
if (attrName === 'fill') {
|
|
7261
|
+
stintSet$2(this, '__isAlphaPixelFill', undefined);
|
|
7262
|
+
this._fill = this.__isFills = undefined;
|
|
7263
|
+
}
|
|
7264
|
+
else {
|
|
7265
|
+
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7266
|
+
this._stroke = this.__isStrokes = undefined;
|
|
7267
|
+
}
|
|
7144
7268
|
}
|
|
7145
7269
|
}
|
|
7146
7270
|
function setArray(data, key, value) {
|
|
@@ -7148,10 +7272,10 @@ function setArray(data, key, value) {
|
|
|
7148
7272
|
if (value instanceof Array) {
|
|
7149
7273
|
if (value.some((item) => item.visible === false))
|
|
7150
7274
|
value = value.filter((item) => item.visible !== false);
|
|
7151
|
-
value.length || (value =
|
|
7275
|
+
value.length || (value = undefined);
|
|
7152
7276
|
}
|
|
7153
7277
|
else
|
|
7154
|
-
value = value && value.visible !== false ? [value] :
|
|
7278
|
+
value = value && value.visible !== false ? [value] : undefined;
|
|
7155
7279
|
data['_' + key] = value;
|
|
7156
7280
|
}
|
|
7157
7281
|
|
|
@@ -7254,8 +7378,6 @@ class ImageData extends RectData {
|
|
|
7254
7378
|
this._url = value;
|
|
7255
7379
|
}
|
|
7256
7380
|
__setImageFill(value) {
|
|
7257
|
-
if (this.__leaf.image)
|
|
7258
|
-
this.__leaf.image = null;
|
|
7259
7381
|
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
7260
7382
|
}
|
|
7261
7383
|
__getData() {
|
|
@@ -7321,21 +7443,19 @@ const UIBounds = {
|
|
|
7321
7443
|
}
|
|
7322
7444
|
};
|
|
7323
7445
|
|
|
7446
|
+
const { stintSet: stintSet$1 } = DataHelper;
|
|
7324
7447
|
const UIRender = {
|
|
7325
7448
|
__updateChange() {
|
|
7326
|
-
const data = this.__
|
|
7449
|
+
const data = this.__;
|
|
7327
7450
|
if (data.__useEffect) {
|
|
7328
|
-
const { shadow,
|
|
7329
|
-
data.
|
|
7451
|
+
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7452
|
+
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')));
|
|
7453
|
+
data.__useEffect = !!(shadow || otherEffect);
|
|
7330
7454
|
}
|
|
7331
|
-
|
|
7332
|
-
|
|
7455
|
+
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7456
|
+
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7333
7457
|
data.__checkSingle();
|
|
7334
|
-
|
|
7335
|
-
if (complex)
|
|
7336
|
-
data.__complex = true;
|
|
7337
|
-
else
|
|
7338
|
-
data.__complex && (data.__complex = false);
|
|
7458
|
+
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7339
7459
|
},
|
|
7340
7460
|
__drawFast(canvas, options) {
|
|
7341
7461
|
drawFast(this, canvas, options);
|
|
@@ -7345,21 +7465,23 @@ const UIRender = {
|
|
|
7345
7465
|
if (data.__complex) {
|
|
7346
7466
|
if (data.__needComputePaint)
|
|
7347
7467
|
data.__computePaint();
|
|
7348
|
-
const { fill, stroke, __drawAfterFill } = data;
|
|
7468
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke, __isFastShadow } = data;
|
|
7349
7469
|
this.__drawRenderPath(canvas);
|
|
7350
|
-
if (data.__useEffect) {
|
|
7470
|
+
if (data.__useEffect && !__isFastShadow) {
|
|
7351
7471
|
const shape = Paint.shape(this, canvas, options);
|
|
7352
7472
|
this.__nowWorld = this.__getNowWorld(options);
|
|
7353
7473
|
const { shadow, innerShadow, filter } = data;
|
|
7354
7474
|
if (shadow)
|
|
7355
7475
|
Effect.shadow(this, canvas, shape);
|
|
7476
|
+
if (__fillAfterStroke)
|
|
7477
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7356
7478
|
if (fill)
|
|
7357
7479
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7358
7480
|
if (__drawAfterFill)
|
|
7359
7481
|
this.__drawAfterFill(canvas, options);
|
|
7360
7482
|
if (innerShadow)
|
|
7361
7483
|
Effect.innerShadow(this, canvas, shape);
|
|
7362
|
-
if (stroke)
|
|
7484
|
+
if (stroke && !__fillAfterStroke)
|
|
7363
7485
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7364
7486
|
if (filter)
|
|
7365
7487
|
Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
@@ -7368,21 +7490,27 @@ const UIRender = {
|
|
|
7368
7490
|
shape.canvas.recycle();
|
|
7369
7491
|
}
|
|
7370
7492
|
else {
|
|
7493
|
+
if (__fillAfterStroke)
|
|
7494
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7495
|
+
if (__isFastShadow) {
|
|
7496
|
+
const shadow = data.shadow[0], { scaleX, scaleY } = this.__nowWorld;
|
|
7497
|
+
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
7498
|
+
}
|
|
7371
7499
|
if (fill)
|
|
7372
7500
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7501
|
+
if (__isFastShadow)
|
|
7502
|
+
canvas.restore();
|
|
7373
7503
|
if (__drawAfterFill)
|
|
7374
7504
|
this.__drawAfterFill(canvas, options);
|
|
7375
|
-
if (stroke)
|
|
7505
|
+
if (stroke && !__fillAfterStroke)
|
|
7376
7506
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7377
7507
|
}
|
|
7378
7508
|
}
|
|
7379
7509
|
else {
|
|
7380
|
-
if (data.__pathInputed)
|
|
7510
|
+
if (data.__pathInputed)
|
|
7381
7511
|
drawFast(this, canvas, options);
|
|
7382
|
-
|
|
7383
|
-
else {
|
|
7512
|
+
else
|
|
7384
7513
|
this.__drawFast(canvas, options);
|
|
7385
|
-
}
|
|
7386
7514
|
}
|
|
7387
7515
|
},
|
|
7388
7516
|
__renderShape(canvas, options, ignoreFill, ignoreStroke) {
|
|
@@ -7391,17 +7519,17 @@ const UIRender = {
|
|
|
7391
7519
|
const { fill, stroke } = this.__;
|
|
7392
7520
|
this.__drawRenderPath(canvas);
|
|
7393
7521
|
if (fill && !ignoreFill)
|
|
7394
|
-
this.__.
|
|
7522
|
+
this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7395
7523
|
if (this.__.__isCanvas)
|
|
7396
7524
|
this.__drawAfterFill(canvas, options);
|
|
7397
7525
|
if (stroke && !ignoreStroke)
|
|
7398
|
-
this.__.
|
|
7526
|
+
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7399
7527
|
}
|
|
7400
7528
|
},
|
|
7401
7529
|
__drawAfterFill(canvas, options) {
|
|
7402
7530
|
if (this.__.__clipAfterFill) {
|
|
7403
7531
|
canvas.save();
|
|
7404
|
-
|
|
7532
|
+
canvas.clipUI();
|
|
7405
7533
|
this.__drawContent(canvas, options);
|
|
7406
7534
|
canvas.restore();
|
|
7407
7535
|
}
|
|
@@ -7410,13 +7538,15 @@ const UIRender = {
|
|
|
7410
7538
|
}
|
|
7411
7539
|
};
|
|
7412
7540
|
function drawFast(ui, canvas, options) {
|
|
7413
|
-
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
7541
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke } = ui.__;
|
|
7414
7542
|
ui.__drawRenderPath(canvas);
|
|
7543
|
+
if (__fillAfterStroke)
|
|
7544
|
+
Paint.stroke(stroke, ui, canvas);
|
|
7415
7545
|
if (fill)
|
|
7416
7546
|
Paint.fill(fill, ui, canvas);
|
|
7417
7547
|
if (__drawAfterFill)
|
|
7418
7548
|
ui.__drawAfterFill(canvas, options);
|
|
7419
|
-
if (stroke)
|
|
7549
|
+
if (stroke && !__fillAfterStroke)
|
|
7420
7550
|
Paint.stroke(stroke, ui, canvas);
|
|
7421
7551
|
}
|
|
7422
7552
|
|
|
@@ -7788,6 +7918,9 @@ __decorate([
|
|
|
7788
7918
|
__decorate([
|
|
7789
7919
|
surfaceType()
|
|
7790
7920
|
], UI.prototype, "placeholderColor", void 0);
|
|
7921
|
+
__decorate([
|
|
7922
|
+
dataType(100)
|
|
7923
|
+
], UI.prototype, "placeholderDelay", void 0);
|
|
7791
7924
|
__decorate([
|
|
7792
7925
|
dataType({})
|
|
7793
7926
|
], UI.prototype, "data", void 0);
|
|
@@ -8189,15 +8322,20 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8189
8322
|
}
|
|
8190
8323
|
__listenEvents() {
|
|
8191
8324
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8192
|
-
this.once(
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8325
|
+
this.once([
|
|
8326
|
+
[LeaferEvent.START, () => Run.end(runId)],
|
|
8327
|
+
[LayoutEvent.START, this.updateLazyBounds, this],
|
|
8328
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
8329
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
8330
|
+
]);
|
|
8331
|
+
this.__eventIds.push(this.on_([
|
|
8332
|
+
[WatchEvent.DATA, this.__onWatchData, this],
|
|
8333
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
8334
|
+
[RenderEvent.NEXT, this.__onNextRender, this]
|
|
8335
|
+
]));
|
|
8197
8336
|
}
|
|
8198
8337
|
__removeListenEvents() {
|
|
8199
8338
|
this.off_(this.__eventIds);
|
|
8200
|
-
this.__eventIds.length = 0;
|
|
8201
8339
|
}
|
|
8202
8340
|
destroy(sync) {
|
|
8203
8341
|
const doDestory = () => {
|
|
@@ -8305,13 +8443,13 @@ let Box = class Box extends Group {
|
|
|
8305
8443
|
super.__updateRenderBounds();
|
|
8306
8444
|
copy$6(childrenRenderBounds, renderBounds);
|
|
8307
8445
|
this.__updateRectRenderBounds();
|
|
8308
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8446
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8309
8447
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8310
8448
|
add(renderBounds, childrenRenderBounds);
|
|
8311
8449
|
}
|
|
8312
8450
|
else
|
|
8313
8451
|
this.__updateRectRenderBounds();
|
|
8314
|
-
|
|
8452
|
+
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8315
8453
|
}
|
|
8316
8454
|
__updateRectRenderBounds() { }
|
|
8317
8455
|
__updateRectChange() { }
|
|
@@ -8615,18 +8753,10 @@ Star = __decorate([
|
|
|
8615
8753
|
|
|
8616
8754
|
let Image = class Image extends Rect {
|
|
8617
8755
|
get __tag() { return 'Image'; }
|
|
8618
|
-
get ready() {
|
|
8756
|
+
get ready() { const { image } = this; return image && image.ready; }
|
|
8757
|
+
get image() { const { fill } = this.__; return fill instanceof Array && fill[0].image; }
|
|
8619
8758
|
constructor(data) {
|
|
8620
8759
|
super(data);
|
|
8621
|
-
this.on_(ImageEvent.LOADED, this.__onLoaded, this);
|
|
8622
|
-
}
|
|
8623
|
-
__onLoaded(e) {
|
|
8624
|
-
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8625
|
-
this.image = e.image;
|
|
8626
|
-
}
|
|
8627
|
-
destroy() {
|
|
8628
|
-
this.image = null;
|
|
8629
|
-
super.destroy();
|
|
8630
8760
|
}
|
|
8631
8761
|
};
|
|
8632
8762
|
__decorate([
|
|
@@ -8642,11 +8772,11 @@ const MyImage = Image;
|
|
|
8642
8772
|
|
|
8643
8773
|
let Canvas = class Canvas extends Rect {
|
|
8644
8774
|
get __tag() { return 'Canvas'; }
|
|
8775
|
+
get context() { return this.canvas.context; }
|
|
8645
8776
|
get ready() { return !this.url; }
|
|
8646
8777
|
constructor(data) {
|
|
8647
8778
|
super(data);
|
|
8648
8779
|
this.canvas = Creator.canvas(this.__);
|
|
8649
|
-
this.context = this.canvas.context;
|
|
8650
8780
|
if (data && data.url)
|
|
8651
8781
|
this.drawImage(data.url);
|
|
8652
8782
|
}
|
|
@@ -8690,7 +8820,7 @@ let Canvas = class Canvas extends Rect {
|
|
|
8690
8820
|
destroy() {
|
|
8691
8821
|
if (this.canvas) {
|
|
8692
8822
|
this.canvas.destroy();
|
|
8693
|
-
this.canvas =
|
|
8823
|
+
this.canvas = null;
|
|
8694
8824
|
}
|
|
8695
8825
|
super.destroy();
|
|
8696
8826
|
}
|
|
@@ -8766,12 +8896,11 @@ let Text = class Text extends UI {
|
|
|
8766
8896
|
super.__updateBoxBounds();
|
|
8767
8897
|
if (italic)
|
|
8768
8898
|
b.width += fontSize * 0.16;
|
|
8769
|
-
|
|
8770
|
-
if (isOverflow)
|
|
8899
|
+
DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds));
|
|
8900
|
+
if (this.isOverflow)
|
|
8771
8901
|
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8772
8902
|
else
|
|
8773
8903
|
data.__textBoxBounds = b;
|
|
8774
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8775
8904
|
}
|
|
8776
8905
|
__onUpdateSize() {
|
|
8777
8906
|
if (this.__box)
|
|
@@ -8885,6 +9014,9 @@ __decorate([
|
|
|
8885
9014
|
__decorate([
|
|
8886
9015
|
boundsType('show')
|
|
8887
9016
|
], Text.prototype, "textOverflow", void 0);
|
|
9017
|
+
__decorate([
|
|
9018
|
+
surfaceType(false)
|
|
9019
|
+
], Text.prototype, "textEditing", void 0);
|
|
8888
9020
|
Text = __decorate([
|
|
8889
9021
|
registerUI()
|
|
8890
9022
|
], Text);
|
|
@@ -8972,7 +9104,7 @@ let App = class App extends Leafer {
|
|
|
8972
9104
|
if (sky || editor)
|
|
8973
9105
|
this.sky = this.addLeafer(sky);
|
|
8974
9106
|
if (editor)
|
|
8975
|
-
|
|
9107
|
+
Creator.editor(editor, this);
|
|
8976
9108
|
}
|
|
8977
9109
|
}
|
|
8978
9110
|
__setApp() {
|
|
@@ -8986,6 +9118,10 @@ let App = class App extends Leafer {
|
|
|
8986
9118
|
this.watcher.disable();
|
|
8987
9119
|
this.layouter.disable();
|
|
8988
9120
|
}
|
|
9121
|
+
__updateLocalBounds() {
|
|
9122
|
+
this.forEach(leafer => leafer.updateLayout());
|
|
9123
|
+
super.__updateLocalBounds();
|
|
9124
|
+
}
|
|
8989
9125
|
start() {
|
|
8990
9126
|
super.start();
|
|
8991
9127
|
this.forEach(leafer => leafer.start());
|
|
@@ -9043,12 +9179,8 @@ let App = class App extends Leafer {
|
|
|
9043
9179
|
this.renderer.update();
|
|
9044
9180
|
}
|
|
9045
9181
|
__render(canvas, options) {
|
|
9046
|
-
if (canvas.context)
|
|
9047
|
-
|
|
9048
|
-
if (m)
|
|
9049
|
-
canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
9050
|
-
this.forEach(leafer => canvas.copyWorld(leafer.canvas));
|
|
9051
|
-
}
|
|
9182
|
+
if (canvas.context)
|
|
9183
|
+
this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
|
|
9052
9184
|
}
|
|
9053
9185
|
__onResize(event) {
|
|
9054
9186
|
this.forEach(leafer => leafer.resize(event));
|
|
@@ -9069,9 +9201,11 @@ let App = class App extends Leafer {
|
|
|
9069
9201
|
return config;
|
|
9070
9202
|
}
|
|
9071
9203
|
__listenChildEvents(leafer) {
|
|
9072
|
-
leafer.once(
|
|
9073
|
-
|
|
9074
|
-
|
|
9204
|
+
leafer.once([
|
|
9205
|
+
[LayoutEvent.END, this.__onReady, this],
|
|
9206
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
9207
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
9208
|
+
]);
|
|
9075
9209
|
if (this.realCanvas)
|
|
9076
9210
|
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9077
9211
|
}
|
|
@@ -9282,7 +9416,7 @@ MoveEvent = __decorate([
|
|
|
9282
9416
|
registerUIEvent()
|
|
9283
9417
|
], MoveEvent);
|
|
9284
9418
|
|
|
9285
|
-
let RotateEvent = class RotateEvent extends
|
|
9419
|
+
let RotateEvent = class RotateEvent extends PointerEvent {
|
|
9286
9420
|
};
|
|
9287
9421
|
RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
|
|
9288
9422
|
RotateEvent.START = 'rotate.start';
|
|
@@ -9303,7 +9437,7 @@ SwipeEvent = __decorate([
|
|
|
9303
9437
|
registerUIEvent()
|
|
9304
9438
|
], SwipeEvent);
|
|
9305
9439
|
|
|
9306
|
-
let ZoomEvent = class ZoomEvent extends
|
|
9440
|
+
let ZoomEvent = class ZoomEvent extends PointerEvent {
|
|
9307
9441
|
};
|
|
9308
9442
|
ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
|
|
9309
9443
|
ZoomEvent.START = 'zoom.start';
|
|
@@ -10146,8 +10280,8 @@ ui$5.__updateHitCanvas = function () {
|
|
|
10146
10280
|
if (this.__box)
|
|
10147
10281
|
this.__box.__updateHitCanvas();
|
|
10148
10282
|
const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
|
|
10149
|
-
const isHitPixelFill = (data.
|
|
10150
|
-
const isHitPixelStroke = data.
|
|
10283
|
+
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
10284
|
+
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
10151
10285
|
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
10152
10286
|
if (!this.__hitCanvas)
|
|
10153
10287
|
this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
|
|
@@ -10178,11 +10312,11 @@ ui$5.__hit = function (inner) {
|
|
|
10178
10312
|
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
10179
10313
|
return true;
|
|
10180
10314
|
const { hitFill } = data;
|
|
10181
|
-
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.
|
|
10315
|
+
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
10182
10316
|
if (needHitFillPath && this.__hitFill(inner))
|
|
10183
10317
|
return true;
|
|
10184
10318
|
const { hitStroke, __strokeWidth } = data;
|
|
10185
|
-
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.
|
|
10319
|
+
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
10186
10320
|
if (!needHitFillPath && !needHitStrokePath)
|
|
10187
10321
|
return false;
|
|
10188
10322
|
const radiusWidth = inner.radiusX * 2;
|
|
@@ -10323,35 +10457,38 @@ function fillPathOrText(ui, canvas) {
|
|
|
10323
10457
|
}
|
|
10324
10458
|
|
|
10325
10459
|
function strokeText(stroke, ui, canvas) {
|
|
10326
|
-
|
|
10327
|
-
const isStrokes = typeof stroke !== 'string';
|
|
10328
|
-
switch (strokeAlign) {
|
|
10460
|
+
switch (ui.__.strokeAlign) {
|
|
10329
10461
|
case 'center':
|
|
10330
|
-
|
|
10331
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
10462
|
+
drawCenter$1(stroke, 1, ui, canvas);
|
|
10332
10463
|
break;
|
|
10333
10464
|
case 'inside':
|
|
10334
|
-
|
|
10465
|
+
drawAlign(stroke, 'inside', ui, canvas);
|
|
10335
10466
|
break;
|
|
10336
10467
|
case 'outside':
|
|
10337
|
-
|
|
10468
|
+
ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, 'outside', ui, canvas);
|
|
10338
10469
|
break;
|
|
10339
10470
|
}
|
|
10340
10471
|
}
|
|
10341
|
-
function
|
|
10342
|
-
const
|
|
10472
|
+
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
10473
|
+
const data = ui.__;
|
|
10474
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
|
|
10475
|
+
data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
10476
|
+
}
|
|
10477
|
+
function drawAlign(stroke, align, ui, canvas) {
|
|
10343
10478
|
const out = canvas.getSameCanvas(true, true);
|
|
10344
|
-
out.
|
|
10345
|
-
|
|
10346
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
|
|
10479
|
+
out.font = ui.__.__font;
|
|
10480
|
+
drawCenter$1(stroke, 2, ui, out);
|
|
10347
10481
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10348
10482
|
fillText(ui, out);
|
|
10349
10483
|
out.blendMode = 'normal';
|
|
10350
|
-
|
|
10484
|
+
copyWorld(canvas, out, ui);
|
|
10485
|
+
out.recycle(ui.__nowWorld);
|
|
10486
|
+
}
|
|
10487
|
+
function copyWorld(canvas, out, ui) {
|
|
10488
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
10351
10489
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10352
10490
|
else
|
|
10353
10491
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10354
|
-
out.recycle(ui.__nowWorld);
|
|
10355
10492
|
}
|
|
10356
10493
|
function drawTextStroke(ui, canvas) {
|
|
10357
10494
|
let row, data = ui.__.__textDrawData;
|
|
@@ -10389,90 +10526,56 @@ function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
|
10389
10526
|
}
|
|
10390
10527
|
|
|
10391
10528
|
function stroke(stroke, ui, canvas) {
|
|
10392
|
-
const
|
|
10393
|
-
|
|
10394
|
-
if (!__strokeWidth)
|
|
10529
|
+
const data = ui.__;
|
|
10530
|
+
if (!data.__strokeWidth)
|
|
10395
10531
|
return;
|
|
10396
|
-
if (__font) {
|
|
10532
|
+
if (data.__font) {
|
|
10397
10533
|
strokeText(stroke, ui, canvas);
|
|
10398
10534
|
}
|
|
10399
10535
|
else {
|
|
10400
|
-
switch (strokeAlign) {
|
|
10536
|
+
switch (data.strokeAlign) {
|
|
10401
10537
|
case 'center':
|
|
10402
|
-
|
|
10403
|
-
canvas.stroke();
|
|
10404
|
-
if (options.__useArrow)
|
|
10405
|
-
strokeArrow(ui, canvas);
|
|
10538
|
+
drawCenter(stroke, 1, ui, canvas);
|
|
10406
10539
|
break;
|
|
10407
10540
|
case 'inside':
|
|
10408
|
-
canvas
|
|
10409
|
-
canvas.setStroke(stroke, __strokeWidth * 2, options);
|
|
10410
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
10411
|
-
canvas.stroke();
|
|
10412
|
-
canvas.restore();
|
|
10541
|
+
drawInside(stroke, ui, canvas);
|
|
10413
10542
|
break;
|
|
10414
10543
|
case 'outside':
|
|
10415
|
-
|
|
10416
|
-
out.setStroke(stroke, __strokeWidth * 2, options);
|
|
10417
|
-
ui.__drawRenderPath(out);
|
|
10418
|
-
out.stroke();
|
|
10419
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10420
|
-
out.clearWorld(ui.__layout.renderBounds);
|
|
10421
|
-
if (ui.__worldFlipped)
|
|
10422
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10423
|
-
else
|
|
10424
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10425
|
-
out.recycle(ui.__nowWorld);
|
|
10544
|
+
drawOutside(stroke, ui, canvas);
|
|
10426
10545
|
break;
|
|
10427
10546
|
}
|
|
10428
10547
|
}
|
|
10429
10548
|
}
|
|
10430
10549
|
function strokes(strokes, ui, canvas) {
|
|
10431
|
-
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
|
|
10550
|
+
stroke(strokes, ui, canvas);
|
|
10551
|
+
}
|
|
10552
|
+
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
10553
|
+
const data = ui.__;
|
|
10554
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
10555
|
+
data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
|
|
10556
|
+
if (data.__useArrow)
|
|
10557
|
+
Paint.strokeArrow(stroke, ui, canvas);
|
|
10558
|
+
}
|
|
10559
|
+
function drawInside(stroke, ui, canvas) {
|
|
10560
|
+
canvas.save();
|
|
10561
|
+
canvas.clipUI(ui);
|
|
10562
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
10563
|
+
canvas.restore();
|
|
10564
|
+
}
|
|
10565
|
+
function drawOutside(stroke, ui, canvas) {
|
|
10566
|
+
const data = ui.__;
|
|
10567
|
+
if (data.__fillAfterStroke) {
|
|
10568
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
10437
10569
|
}
|
|
10438
10570
|
else {
|
|
10439
|
-
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
canvas.save();
|
|
10448
|
-
canvas.setStroke(undefined, __strokeWidth * 2, options);
|
|
10449
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
10450
|
-
drawStrokesStyle(strokes, false, ui, canvas);
|
|
10451
|
-
canvas.restore();
|
|
10452
|
-
break;
|
|
10453
|
-
case 'outside':
|
|
10454
|
-
const { renderBounds } = ui.__layout;
|
|
10455
|
-
const out = canvas.getSameCanvas(true, true);
|
|
10456
|
-
ui.__drawRenderPath(out);
|
|
10457
|
-
out.setStroke(undefined, __strokeWidth * 2, options);
|
|
10458
|
-
drawStrokesStyle(strokes, false, ui, out);
|
|
10459
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10460
|
-
out.clearWorld(renderBounds);
|
|
10461
|
-
if (ui.__worldFlipped)
|
|
10462
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10463
|
-
else
|
|
10464
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
10465
|
-
out.recycle(ui.__nowWorld);
|
|
10466
|
-
break;
|
|
10467
|
-
}
|
|
10468
|
-
}
|
|
10469
|
-
}
|
|
10470
|
-
function strokeArrow(ui, canvas) {
|
|
10471
|
-
if (ui.__.dashPattern) {
|
|
10472
|
-
canvas.beginPath();
|
|
10473
|
-
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
10474
|
-
canvas.dashPattern = null;
|
|
10475
|
-
canvas.stroke();
|
|
10571
|
+
const { renderBounds } = ui.__layout;
|
|
10572
|
+
const out = canvas.getSameCanvas(true, true);
|
|
10573
|
+
ui.__drawRenderPath(out);
|
|
10574
|
+
drawCenter(stroke, 2, ui, out);
|
|
10575
|
+
out.clipUI(data);
|
|
10576
|
+
out.clearWorld(renderBounds);
|
|
10577
|
+
copyWorld(canvas, out, ui);
|
|
10578
|
+
out.recycle(ui.__nowWorld);
|
|
10476
10579
|
}
|
|
10477
10580
|
}
|
|
10478
10581
|
|
|
@@ -10519,41 +10622,66 @@ function shape(ui, current, options) {
|
|
|
10519
10622
|
}
|
|
10520
10623
|
|
|
10521
10624
|
let recycleMap;
|
|
10625
|
+
const { stintSet } = DataHelper, { hasTransparent: hasTransparent$1 } = ColorConvert;
|
|
10522
10626
|
function compute(attrName, ui) {
|
|
10523
10627
|
const data = ui.__, leafPaints = [];
|
|
10524
|
-
let paints = data.__input[attrName],
|
|
10628
|
+
let paints = data.__input[attrName], isAlphaPixel, isTransparent;
|
|
10525
10629
|
if (!(paints instanceof Array))
|
|
10526
10630
|
paints = [paints];
|
|
10527
10631
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
10528
10632
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
10529
|
-
item = getLeafPaint(attrName, paints[i], ui);
|
|
10530
|
-
if (item)
|
|
10531
|
-
leafPaints.push(item);
|
|
10633
|
+
(item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
|
|
10532
10634
|
}
|
|
10533
10635
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
10534
|
-
if (leafPaints.length
|
|
10535
|
-
|
|
10536
|
-
|
|
10636
|
+
if (leafPaints.length) {
|
|
10637
|
+
if (leafPaints.every(item => item.isTransparent)) {
|
|
10638
|
+
if (leafPaints.some(item => item.image))
|
|
10639
|
+
isAlphaPixel = true;
|
|
10640
|
+
isTransparent = true;
|
|
10641
|
+
}
|
|
10642
|
+
}
|
|
10643
|
+
if (attrName === 'fill') {
|
|
10644
|
+
stintSet(data, '__isAlphaPixelFill', isAlphaPixel);
|
|
10645
|
+
stintSet(data, '__isTransparentFill', isTransparent);
|
|
10646
|
+
}
|
|
10647
|
+
else {
|
|
10648
|
+
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
10649
|
+
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
10650
|
+
}
|
|
10537
10651
|
}
|
|
10538
10652
|
function getLeafPaint(attrName, paint, ui) {
|
|
10539
10653
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
|
10540
10654
|
return undefined;
|
|
10655
|
+
let data;
|
|
10541
10656
|
const { boxBounds } = ui.__layout;
|
|
10542
10657
|
switch (paint.type) {
|
|
10543
|
-
case 'solid':
|
|
10544
|
-
let { type, blendMode, color, opacity } = paint;
|
|
10545
|
-
return { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
10546
10658
|
case 'image':
|
|
10547
|
-
|
|
10659
|
+
data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
10660
|
+
break;
|
|
10548
10661
|
case 'linear':
|
|
10549
|
-
|
|
10662
|
+
data = PaintGradient.linearGradient(paint, boxBounds);
|
|
10663
|
+
break;
|
|
10550
10664
|
case 'radial':
|
|
10551
|
-
|
|
10665
|
+
data = PaintGradient.radialGradient(paint, boxBounds);
|
|
10666
|
+
break;
|
|
10552
10667
|
case 'angular':
|
|
10553
|
-
|
|
10668
|
+
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
10669
|
+
break;
|
|
10670
|
+
case 'solid':
|
|
10671
|
+
const { type, color, opacity } = paint;
|
|
10672
|
+
data = { type, style: ColorConvert.string(color, opacity) };
|
|
10673
|
+
break;
|
|
10554
10674
|
default:
|
|
10555
|
-
|
|
10675
|
+
if (paint.r !== undefined)
|
|
10676
|
+
data = { type: 'solid', style: ColorConvert.string(paint) };
|
|
10556
10677
|
}
|
|
10678
|
+
if (data) {
|
|
10679
|
+
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
10680
|
+
data.isTransparent = true;
|
|
10681
|
+
if (paint.blendMode)
|
|
10682
|
+
data.blendMode = paint.blendMode;
|
|
10683
|
+
}
|
|
10684
|
+
return data;
|
|
10557
10685
|
}
|
|
10558
10686
|
|
|
10559
10687
|
const PaintModule = {
|
|
@@ -10619,12 +10747,10 @@ function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, al
|
|
|
10619
10747
|
|
|
10620
10748
|
const { get: get$2, translate } = MatrixHelper;
|
|
10621
10749
|
const tempBox = new Bounds();
|
|
10622
|
-
const tempPoint$1 = {};
|
|
10623
10750
|
const tempScaleData = {};
|
|
10751
|
+
const tempImage = {};
|
|
10624
10752
|
function createData(leafPaint, image, paint, box) {
|
|
10625
|
-
const {
|
|
10626
|
-
if (blendMode)
|
|
10627
|
-
leafPaint.blendMode = blendMode;
|
|
10753
|
+
const { changeful, sync } = paint;
|
|
10628
10754
|
if (changeful)
|
|
10629
10755
|
leafPaint.changeful = changeful;
|
|
10630
10756
|
if (sync)
|
|
@@ -10632,38 +10758,38 @@ function createData(leafPaint, image, paint, box) {
|
|
|
10632
10758
|
leafPaint.data = getPatternData(paint, box, image);
|
|
10633
10759
|
}
|
|
10634
10760
|
function getPatternData(paint, box, image) {
|
|
10635
|
-
let { width, height } = image;
|
|
10636
10761
|
if (paint.padding)
|
|
10637
10762
|
box = tempBox.set(box).shrink(paint.padding);
|
|
10638
10763
|
if (paint.mode === 'strench')
|
|
10639
10764
|
paint.mode = 'stretch';
|
|
10765
|
+
let { width, height } = image;
|
|
10640
10766
|
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
10641
10767
|
const sameBox = box.width === width && box.height === height;
|
|
10642
10768
|
const data = { mode };
|
|
10643
10769
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
10644
|
-
|
|
10645
|
-
let
|
|
10770
|
+
BoundsHelper.set(tempImage, 0, 0, swapSize ? height : width, swapSize ? width : height);
|
|
10771
|
+
let scaleX, scaleY;
|
|
10646
10772
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
10647
10773
|
if (!sameBox || rotation) {
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10774
|
+
scaleX = scaleY = BoundsHelper.getFitScale(box, tempImage, mode !== 'fit');
|
|
10775
|
+
BoundsHelper.put(box, image, align, scaleX, false, tempImage);
|
|
10776
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
10651
10777
|
}
|
|
10652
10778
|
}
|
|
10653
|
-
else
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10662
|
-
|
|
10663
|
-
|
|
10779
|
+
else {
|
|
10780
|
+
if (scale || size) {
|
|
10781
|
+
MathHelper.getScaleData(scale, size, image, tempScaleData);
|
|
10782
|
+
scaleX = tempScaleData.scaleX;
|
|
10783
|
+
scaleY = tempScaleData.scaleY;
|
|
10784
|
+
}
|
|
10785
|
+
if (align) {
|
|
10786
|
+
if (scaleX)
|
|
10787
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
10788
|
+
AlignHelper.toPoint(align, tempImage, box, tempImage, true, true);
|
|
10789
|
+
}
|
|
10664
10790
|
}
|
|
10665
10791
|
if (offset)
|
|
10666
|
-
|
|
10792
|
+
PointHelper.move(tempImage, offset);
|
|
10667
10793
|
switch (mode) {
|
|
10668
10794
|
case 'stretch':
|
|
10669
10795
|
if (!sameBox)
|
|
@@ -10671,12 +10797,12 @@ function getPatternData(paint, box, image) {
|
|
|
10671
10797
|
break;
|
|
10672
10798
|
case 'normal':
|
|
10673
10799
|
case 'clip':
|
|
10674
|
-
if (x || y || scaleX || rotation)
|
|
10675
|
-
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
10800
|
+
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
10801
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
10676
10802
|
break;
|
|
10677
10803
|
case 'repeat':
|
|
10678
10804
|
if (!sameBox || scaleX || rotation)
|
|
10679
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
10805
|
+
repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, align);
|
|
10680
10806
|
if (!repeat)
|
|
10681
10807
|
data.repeat = 'repeat';
|
|
10682
10808
|
break;
|
|
@@ -10684,7 +10810,7 @@ function getPatternData(paint, box, image) {
|
|
|
10684
10810
|
case 'cover':
|
|
10685
10811
|
default:
|
|
10686
10812
|
if (scaleX)
|
|
10687
|
-
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
10813
|
+
fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
10688
10814
|
}
|
|
10689
10815
|
if (!data.transform) {
|
|
10690
10816
|
if (box.x || box.y) {
|
|
@@ -10717,6 +10843,8 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
10717
10843
|
}
|
|
10718
10844
|
else {
|
|
10719
10845
|
leafPaint = { type: paint.type, image };
|
|
10846
|
+
if (image.hasAlphaPixel)
|
|
10847
|
+
leafPaint.isTransparent = true;
|
|
10720
10848
|
cache$1 = image.use > 1 ? { leafPaint, paint, boxBounds: box$1.set(boxBounds) } : null;
|
|
10721
10849
|
}
|
|
10722
10850
|
if (firstUse || image.loading)
|
|
@@ -10741,7 +10869,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
10741
10869
|
ignoreRender(ui, false);
|
|
10742
10870
|
if (!ui.destroyed) {
|
|
10743
10871
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
10744
|
-
if (image.
|
|
10872
|
+
if (image.hasAlphaPixel)
|
|
10745
10873
|
ui.__layout.hitCanvasChanged = true;
|
|
10746
10874
|
ui.forceUpdate('surface');
|
|
10747
10875
|
}
|
|
@@ -10753,13 +10881,17 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
10753
10881
|
onLoadError(ui, event, error);
|
|
10754
10882
|
leafPaint.loadId = null;
|
|
10755
10883
|
});
|
|
10756
|
-
if (ui.placeholderColor)
|
|
10757
|
-
|
|
10758
|
-
|
|
10759
|
-
|
|
10760
|
-
|
|
10761
|
-
|
|
10762
|
-
|
|
10884
|
+
if (ui.placeholderColor) {
|
|
10885
|
+
if (!ui.placeholderDelay)
|
|
10886
|
+
image.isPlacehold = true;
|
|
10887
|
+
else
|
|
10888
|
+
setTimeout(() => {
|
|
10889
|
+
if (!image.ready) {
|
|
10890
|
+
image.isPlacehold = true;
|
|
10891
|
+
ui.forceUpdate('surface');
|
|
10892
|
+
}
|
|
10893
|
+
}, ui.placeholderDelay);
|
|
10894
|
+
}
|
|
10763
10895
|
}
|
|
10764
10896
|
return leafPaint;
|
|
10765
10897
|
}
|
|
@@ -10914,7 +11046,7 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
10914
11046
|
}
|
|
10915
11047
|
function drawImage(ui, canvas, paint, data) {
|
|
10916
11048
|
canvas.save();
|
|
10917
|
-
|
|
11049
|
+
canvas.clipUI(ui);
|
|
10918
11050
|
if (paint.blendMode)
|
|
10919
11051
|
canvas.blendMode = paint.blendMode;
|
|
10920
11052
|
if (data.opacity)
|
|
@@ -10965,32 +11097,33 @@ const PaintImageModule = {
|
|
|
10965
11097
|
repeatMode
|
|
10966
11098
|
};
|
|
10967
11099
|
|
|
10968
|
-
const { toPoint: toPoint$3 } = AroundHelper;
|
|
11100
|
+
const { toPoint: toPoint$3 } = AroundHelper, { hasTransparent } = ColorConvert;
|
|
10969
11101
|
const realFrom$2 = {};
|
|
10970
11102
|
const realTo$2 = {};
|
|
10971
11103
|
function linearGradient(paint, box) {
|
|
10972
|
-
let { from, to, type,
|
|
11104
|
+
let { from, to, type, opacity } = paint;
|
|
10973
11105
|
toPoint$3(from || 'top', box, realFrom$2);
|
|
10974
11106
|
toPoint$3(to || 'bottom', box, realTo$2);
|
|
10975
11107
|
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
10976
|
-
applyStops(style, paint.stops, opacity);
|
|
10977
11108
|
const data = { type, style };
|
|
10978
|
-
|
|
10979
|
-
data.blendMode = blendMode;
|
|
11109
|
+
applyStops(data, style, paint.stops, opacity);
|
|
10980
11110
|
return data;
|
|
10981
11111
|
}
|
|
10982
|
-
function applyStops(gradient, stops, opacity) {
|
|
11112
|
+
function applyStops(data, gradient, stops, opacity) {
|
|
10983
11113
|
if (stops) {
|
|
10984
|
-
let stop;
|
|
11114
|
+
let stop, color, offset, isTransparent;
|
|
10985
11115
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
10986
11116
|
stop = stops[i];
|
|
10987
|
-
if (typeof stop === 'string')
|
|
10988
|
-
|
|
10989
|
-
|
|
10990
|
-
|
|
10991
|
-
|
|
10992
|
-
|
|
11117
|
+
if (typeof stop === 'string')
|
|
11118
|
+
offset = i / (len - 1), color = ColorConvert.string(stop, opacity);
|
|
11119
|
+
else
|
|
11120
|
+
offset = stop.offset, color = ColorConvert.string(stop.color, opacity);
|
|
11121
|
+
gradient.addColorStop(offset, color);
|
|
11122
|
+
if (!isTransparent && hasTransparent(color))
|
|
11123
|
+
isTransparent = true;
|
|
10993
11124
|
}
|
|
11125
|
+
if (isTransparent)
|
|
11126
|
+
data.isTransparent = true;
|
|
10994
11127
|
}
|
|
10995
11128
|
}
|
|
10996
11129
|
|
|
@@ -11000,17 +11133,15 @@ const { toPoint: toPoint$2 } = AroundHelper;
|
|
|
11000
11133
|
const realFrom$1 = {};
|
|
11001
11134
|
const realTo$1 = {};
|
|
11002
11135
|
function radialGradient(paint, box) {
|
|
11003
|
-
let { from, to, type, opacity,
|
|
11136
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
11004
11137
|
toPoint$2(from || 'center', box, realFrom$1);
|
|
11005
11138
|
toPoint$2(to || 'bottom', box, realTo$1);
|
|
11006
11139
|
const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$2(realFrom$1, realTo$1));
|
|
11007
|
-
applyStops(style, paint.stops, opacity);
|
|
11008
11140
|
const data = { type, style };
|
|
11141
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11009
11142
|
const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
|
|
11010
11143
|
if (transform)
|
|
11011
11144
|
data.transform = transform;
|
|
11012
|
-
if (blendMode)
|
|
11013
|
-
data.blendMode = blendMode;
|
|
11014
11145
|
return data;
|
|
11015
11146
|
}
|
|
11016
11147
|
function getTransform(box, from, to, stretch, rotate90) {
|
|
@@ -11036,17 +11167,15 @@ const { toPoint: toPoint$1 } = AroundHelper;
|
|
|
11036
11167
|
const realFrom = {};
|
|
11037
11168
|
const realTo = {};
|
|
11038
11169
|
function conicGradient(paint, box) {
|
|
11039
|
-
let { from, to, type, opacity,
|
|
11170
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
11040
11171
|
toPoint$1(from || 'center', box, realFrom);
|
|
11041
11172
|
toPoint$1(to || 'bottom', box, realTo);
|
|
11042
11173
|
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));
|
|
11043
|
-
applyStops(style, paint.stops, opacity);
|
|
11044
11174
|
const data = { type, style };
|
|
11175
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11045
11176
|
const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
|
|
11046
11177
|
if (transform)
|
|
11047
11178
|
data.transform = transform;
|
|
11048
|
-
if (blendMode)
|
|
11049
|
-
data.blendMode = blendMode;
|
|
11050
11179
|
return data;
|
|
11051
11180
|
}
|
|
11052
11181
|
|
|
@@ -11082,12 +11211,10 @@ function shadow$1(ui, current, shape) {
|
|
|
11082
11211
|
}
|
|
11083
11212
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
11084
11213
|
}
|
|
11085
|
-
if (ui.__worldFlipped)
|
|
11214
|
+
if (ui.__worldFlipped)
|
|
11086
11215
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
11087
|
-
|
|
11088
|
-
else {
|
|
11216
|
+
else
|
|
11089
11217
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
11090
|
-
}
|
|
11091
11218
|
if (end && index < end)
|
|
11092
11219
|
other.clearWorld(copyBounds, true);
|
|
11093
11220
|
});
|
|
@@ -11146,12 +11273,10 @@ function innerShadow(ui, current, shape) {
|
|
|
11146
11273
|
copyBounds = bounds;
|
|
11147
11274
|
}
|
|
11148
11275
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
11149
|
-
if (ui.__worldFlipped)
|
|
11276
|
+
if (ui.__worldFlipped)
|
|
11150
11277
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
11151
|
-
|
|
11152
|
-
else {
|
|
11278
|
+
else
|
|
11153
11279
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
11154
|
-
}
|
|
11155
11280
|
if (end && index < end)
|
|
11156
11281
|
other.clearWorld(copyBounds, true);
|
|
11157
11282
|
});
|
|
@@ -11379,6 +11504,8 @@ function createRows(drawData, content, style) {
|
|
|
11379
11504
|
lastCharType = null;
|
|
11380
11505
|
startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
|
|
11381
11506
|
word = { data: [] }, row = { words: [] };
|
|
11507
|
+
if (__letterSpacing)
|
|
11508
|
+
content = [...content];
|
|
11382
11509
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
11383
11510
|
char = content[i];
|
|
11384
11511
|
if (char === '\n') {
|
|
@@ -12225,24 +12352,25 @@ class EditSelect extends Group {
|
|
|
12225
12352
|
const { app } = editor;
|
|
12226
12353
|
app.selector.proxy = editor;
|
|
12227
12354
|
this.__eventIds = [
|
|
12228
|
-
editor.on_(
|
|
12229
|
-
|
|
12230
|
-
|
|
12231
|
-
|
|
12232
|
-
app.on_(
|
|
12233
|
-
|
|
12234
|
-
|
|
12235
|
-
|
|
12236
|
-
|
|
12237
|
-
|
|
12355
|
+
editor.on_([
|
|
12356
|
+
[EditorEvent.HOVER, this.onHover, this],
|
|
12357
|
+
[EditorEvent.SELECT, this.onSelect, this]
|
|
12358
|
+
]),
|
|
12359
|
+
app.on_([
|
|
12360
|
+
[PointerEvent.MOVE, this.onPointerMove, this],
|
|
12361
|
+
[PointerEvent.BEFORE_DOWN, this.onBeforeDown, this],
|
|
12362
|
+
[PointerEvent.TAP, this.onTap, this],
|
|
12363
|
+
[DragEvent.START, this.onDragStart, this, true],
|
|
12364
|
+
[DragEvent.DRAG, this.onDrag, this],
|
|
12365
|
+
[DragEvent.END, this.onDragEnd, this],
|
|
12366
|
+
[MoveEvent.MOVE, this.onAutoMove, this],
|
|
12367
|
+
[[ZoomEvent.ZOOM, MoveEvent.MOVE], () => { this.editor.hoverTarget = null; }],
|
|
12368
|
+
])
|
|
12238
12369
|
];
|
|
12239
12370
|
});
|
|
12240
12371
|
}
|
|
12241
12372
|
__removeListenEvents() {
|
|
12242
|
-
|
|
12243
|
-
this.off_(this.__eventIds);
|
|
12244
|
-
this.__eventIds.length = 0;
|
|
12245
|
-
}
|
|
12373
|
+
this.off_(this.__eventIds);
|
|
12246
12374
|
}
|
|
12247
12375
|
destroy() {
|
|
12248
12376
|
this.editor = this.originList = this.needRemoveItem = null;
|
|
@@ -12531,6 +12659,10 @@ function toDataURL(svg, rotation) {
|
|
|
12531
12659
|
}
|
|
12532
12660
|
|
|
12533
12661
|
class EditPoint extends Box {
|
|
12662
|
+
constructor(data) {
|
|
12663
|
+
super(data);
|
|
12664
|
+
this.useFastShadow = true;
|
|
12665
|
+
}
|
|
12534
12666
|
}
|
|
12535
12667
|
|
|
12536
12668
|
const fourDirection = ['top', 'right', 'bottom', 'left'], editConfig = undefined;
|
|
@@ -12801,28 +12933,29 @@ class EditBox extends Group {
|
|
|
12801
12933
|
const { editor } = this;
|
|
12802
12934
|
point.direction = direction;
|
|
12803
12935
|
point.pointType = type;
|
|
12804
|
-
|
|
12805
|
-
|
|
12806
|
-
|
|
12807
|
-
|
|
12936
|
+
const events = [
|
|
12937
|
+
[DragEvent.START, this.onDragStart, this],
|
|
12938
|
+
[DragEvent.DRAG, this.onDrag, this],
|
|
12939
|
+
[DragEvent.END, this.onDragEnd, this],
|
|
12940
|
+
[PointerEvent.LEAVE, () => { this.enterPoint = null; }],
|
|
12941
|
+
];
|
|
12808
12942
|
if (point.name !== 'circle')
|
|
12809
|
-
|
|
12943
|
+
events.push([PointerEvent.ENTER, (e) => { this.enterPoint = point, updateCursor(editor, e); }]);
|
|
12944
|
+
this.__eventIds.push(point.on_(events));
|
|
12810
12945
|
}
|
|
12811
12946
|
__listenEvents() {
|
|
12812
12947
|
const { rect, editor } = this;
|
|
12813
|
-
this.__eventIds
|
|
12814
|
-
|
|
12815
|
-
|
|
12816
|
-
|
|
12817
|
-
|
|
12818
|
-
|
|
12819
|
-
|
|
12820
|
-
|
|
12821
|
-
];
|
|
12948
|
+
this.__eventIds.push(editor.on_(EditorEvent.SELECT, this.onSelect, this), rect.on_([
|
|
12949
|
+
[DragEvent.START, this.onDragStart, this],
|
|
12950
|
+
[DragEvent.DRAG, editor.onMove, editor],
|
|
12951
|
+
[DragEvent.END, this.onDragEnd, this],
|
|
12952
|
+
[PointerEvent.ENTER, () => updateMoveCursor(editor)],
|
|
12953
|
+
[PointerEvent.DOUBLE_TAP, this.onDoubleTap, this],
|
|
12954
|
+
[PointerEvent.LONG_PRESS, this.onLongPress, this]
|
|
12955
|
+
]));
|
|
12822
12956
|
}
|
|
12823
12957
|
__removeListenEvents() {
|
|
12824
12958
|
this.off_(this.__eventIds);
|
|
12825
|
-
this.__eventIds.length = 0;
|
|
12826
12959
|
}
|
|
12827
12960
|
destroy() {
|
|
12828
12961
|
this.editor = null;
|
|
@@ -13564,12 +13697,14 @@ class Editor extends Group {
|
|
|
13564
13697
|
const { app, leafer, editBox, editMask } = this;
|
|
13565
13698
|
this.targetEventIds = [
|
|
13566
13699
|
leafer.on_(RenderEvent.START, this.onRenderStart, this),
|
|
13567
|
-
app.on_(
|
|
13568
|
-
|
|
13569
|
-
|
|
13570
|
-
|
|
13571
|
-
|
|
13572
|
-
|
|
13700
|
+
app.on_([
|
|
13701
|
+
[RenderEvent.CHILD_START, this.onAppRenderStart, this],
|
|
13702
|
+
[MoveEvent.BEFORE_MOVE, this.onMove, this, true],
|
|
13703
|
+
[ZoomEvent.BEFORE_ZOOM, this.onScale, this, true],
|
|
13704
|
+
[RotateEvent.BEFORE_ROTATE, this.onRotate, this, true],
|
|
13705
|
+
[[KeyEvent.HOLD, KeyEvent.UP], this.onKey, this],
|
|
13706
|
+
[KeyEvent.DOWN, editBox.onArrow, editBox]
|
|
13707
|
+
])
|
|
13573
13708
|
];
|
|
13574
13709
|
if (editMask.visible)
|
|
13575
13710
|
editMask.forceRender();
|
|
@@ -13579,7 +13714,6 @@ class Editor extends Group {
|
|
|
13579
13714
|
const { targetEventIds, editMask } = this;
|
|
13580
13715
|
if (targetEventIds.length) {
|
|
13581
13716
|
this.off_(targetEventIds);
|
|
13582
|
-
targetEventIds.length = 0;
|
|
13583
13717
|
if (editMask.visible)
|
|
13584
13718
|
editMask.forceRender();
|
|
13585
13719
|
}
|
|
@@ -14048,7 +14182,12 @@ Box.prototype.__scaleResize = function (scaleX, scaleY) {
|
|
|
14048
14182
|
Plugin.add('resize');
|
|
14049
14183
|
|
|
14050
14184
|
Plugin.add('editor', 'resize');
|
|
14051
|
-
Creator.editor = function (options) {
|
|
14185
|
+
Creator.editor = function (options, app) {
|
|
14186
|
+
const editor = new Editor(options);
|
|
14187
|
+
if (app)
|
|
14188
|
+
app.sky.add(app.editor = editor);
|
|
14189
|
+
return editor;
|
|
14190
|
+
};
|
|
14052
14191
|
Box.addAttr('textBox', false, dataType);
|
|
14053
14192
|
UI.addAttr('editConfig', undefined, dataType);
|
|
14054
14193
|
UI.addAttr('editOuter', (ui) => ui.__.__isLinePath ? 'LineEditTool' : 'EditTool', dataType);
|
|
@@ -14233,31 +14372,31 @@ let TextEditor = class TextEditor extends InnerEditor {
|
|
|
14233
14372
|
textScale *= 12 / text.fontSize;
|
|
14234
14373
|
}
|
|
14235
14374
|
this.textScale = textScale;
|
|
14236
|
-
const { a, b, c, d, e, f } = new Matrix(text.worldTransform).scale(1 / textScale);
|
|
14237
14375
|
let { x, y } = this.inBody ? text.app.clientBounds : text.app.tree.clientBounds;
|
|
14238
14376
|
if (!this.inBody)
|
|
14239
14377
|
x -= window.scrollX, y -= window.scrollY;
|
|
14240
|
-
let { width, height } = text;
|
|
14378
|
+
let { width, height } = text, offsetX = 0, offsetY = 0;
|
|
14241
14379
|
width *= textScale, height *= textScale;
|
|
14242
14380
|
const data = text.__;
|
|
14243
14381
|
if (data.__autoWidth && data.autoSizeAlign) {
|
|
14244
14382
|
width += 20;
|
|
14245
14383
|
switch (data.textAlign) {
|
|
14246
14384
|
case 'center':
|
|
14247
|
-
|
|
14385
|
+
offsetX = -width / 2;
|
|
14248
14386
|
break;
|
|
14249
|
-
case 'right':
|
|
14387
|
+
case 'right': offsetX = -width;
|
|
14250
14388
|
}
|
|
14251
14389
|
}
|
|
14252
14390
|
if (data.__autoHeight && data.autoSizeAlign) {
|
|
14253
14391
|
height += 20;
|
|
14254
14392
|
switch (data.verticalAlign) {
|
|
14255
14393
|
case 'middle':
|
|
14256
|
-
|
|
14394
|
+
offsetY = -height / 2;
|
|
14257
14395
|
break;
|
|
14258
|
-
case 'bottom':
|
|
14396
|
+
case 'bottom': offsetY = -height;
|
|
14259
14397
|
}
|
|
14260
14398
|
}
|
|
14399
|
+
const { a, b, c, d, e, f } = new Matrix(text.worldTransform).scale(1 / textScale).translateInner(offsetX, offsetY);
|
|
14261
14400
|
const { style } = this.editDom;
|
|
14262
14401
|
style.transform = `matrix(${a},${b},${c},${d},${e},${f})`;
|
|
14263
14402
|
style.left = x + 'px';
|
|
@@ -14290,7 +14429,6 @@ TextEditor = __decorate([
|
|
|
14290
14429
|
], TextEditor);
|
|
14291
14430
|
|
|
14292
14431
|
Plugin.add('text-editor', 'editor');
|
|
14293
|
-
Text.addAttr('textEditing', false, surfaceType);
|
|
14294
14432
|
|
|
14295
14433
|
function addViewport(leafer, mergeConfig, custom) {
|
|
14296
14434
|
addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);
|
|
@@ -14584,6 +14722,7 @@ interaction.multiTouch = function (data, list) {
|
|
|
14584
14722
|
return;
|
|
14585
14723
|
const { move, rotation, scale, center } = MultiTouchHelper.getData(list);
|
|
14586
14724
|
Object.assign(data, center);
|
|
14725
|
+
data.multiTouch = true;
|
|
14587
14726
|
this.pointerWaitCancel();
|
|
14588
14727
|
this.rotate(getRotateEventData(rotation, data));
|
|
14589
14728
|
this.zoom(getZoomEventData(scale, data));
|
|
@@ -15185,6 +15324,16 @@ Plugin.add('arrow');
|
|
|
15185
15324
|
UI.addAttr('startArrow', 'none', arrowType);
|
|
15186
15325
|
UI.addAttr('endArrow', 'none', arrowType);
|
|
15187
15326
|
Object.assign(PathArrow, PathArrowModule);
|
|
15327
|
+
Object.assign(Paint, {
|
|
15328
|
+
strokeArrow(_stroke, ui, canvas) {
|
|
15329
|
+
if (ui.__.dashPattern) {
|
|
15330
|
+
canvas.beginPath();
|
|
15331
|
+
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
15332
|
+
canvas.dashPattern = null;
|
|
15333
|
+
canvas.stroke();
|
|
15334
|
+
}
|
|
15335
|
+
}
|
|
15336
|
+
});
|
|
15188
15337
|
|
|
15189
15338
|
class FlowData extends BoxData {
|
|
15190
15339
|
}
|
|
@@ -17798,10 +17947,9 @@ const ExportModule = {
|
|
|
17798
17947
|
else {
|
|
17799
17948
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
17800
17949
|
const { worldTransform, isLeafer, leafer, isFrame } = leaf;
|
|
17801
|
-
const { slice, clip, trim, padding, onCanvas } = options;
|
|
17950
|
+
const { slice, clip, trim, screenshot, padding, onCanvas } = options;
|
|
17802
17951
|
const smooth = options.smooth === undefined ? (leafer ? leafer.config.smooth : true) : options.smooth;
|
|
17803
17952
|
const contextSettings = options.contextSettings || (leafer ? leafer.config.contextSettings : undefined);
|
|
17804
|
-
const screenshot = options.screenshot || leaf.isApp;
|
|
17805
17953
|
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
|
|
17806
17954
|
const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
|
|
17807
17955
|
if (screenshot) {
|
|
@@ -17837,11 +17985,6 @@ const ExportModule = {
|
|
|
17837
17985
|
const scaleData = { scaleX: 1, scaleY: 1 };
|
|
17838
17986
|
MathHelper.getScaleData(options.scale, options.size, renderBounds, scaleData);
|
|
17839
17987
|
let pixelRatio = options.pixelRatio || 1;
|
|
17840
|
-
if (leaf.isApp) {
|
|
17841
|
-
scaleData.scaleX *= pixelRatio;
|
|
17842
|
-
scaleData.scaleY *= pixelRatio;
|
|
17843
|
-
pixelRatio = leaf.app.pixelRatio;
|
|
17844
|
-
}
|
|
17845
17988
|
let { x, y, width, height } = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
|
|
17846
17989
|
if (clip)
|
|
17847
17990
|
x += clip.x, y += clip.y, width = clip.width, height = clip.height;
|
|
@@ -17996,4 +18139,4 @@ Object.assign(Filter, {
|
|
|
17996
18139
|
}
|
|
17997
18140
|
});
|
|
17998
18141
|
|
|
17999
|
-
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, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, 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, TextEditor, 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$
|
|
18142
|
+
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, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, 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, TextEditor, 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 };
|