@leafer/worker 1.6.2 → 1.6.3
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 +604 -458
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +603 -458
- 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.js
CHANGED
|
@@ -26,8 +26,6 @@ var LeaferUI = (function (exports) {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
const Creator = {};
|
|
30
|
-
|
|
31
29
|
const IncrementId = {
|
|
32
30
|
RUNTIME: 'runtime',
|
|
33
31
|
LEAF: 'leaf',
|
|
@@ -153,7 +151,7 @@ var LeaferUI = (function (exports) {
|
|
|
153
151
|
|
|
154
152
|
const { sin: sin$6, cos: cos$6, acos, sqrt: sqrt$5 } = Math;
|
|
155
153
|
const { float: float$2 } = MathHelper;
|
|
156
|
-
const tempPoint$
|
|
154
|
+
const tempPoint$4 = {};
|
|
157
155
|
function getWorld() {
|
|
158
156
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), { scaleX: 1, scaleY: 1, rotation: 0, skewX: 0, skewY: 0 });
|
|
159
157
|
}
|
|
@@ -196,8 +194,8 @@ var LeaferUI = (function (exports) {
|
|
|
196
194
|
t.d *= scaleY;
|
|
197
195
|
},
|
|
198
196
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
199
|
-
M$a.toInnerPoint(t, origin, tempPoint$
|
|
200
|
-
M$a.scaleOfInner(t, tempPoint$
|
|
197
|
+
M$a.toInnerPoint(t, origin, tempPoint$4);
|
|
198
|
+
M$a.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
|
|
201
199
|
},
|
|
202
200
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
203
201
|
M$a.translateInner(t, origin.x, origin.y);
|
|
@@ -215,8 +213,8 @@ var LeaferUI = (function (exports) {
|
|
|
215
213
|
t.d = c * sinR + d * cosR;
|
|
216
214
|
},
|
|
217
215
|
rotateOfOuter(t, origin, rotation) {
|
|
218
|
-
M$a.toInnerPoint(t, origin, tempPoint$
|
|
219
|
-
M$a.rotateOfInner(t, tempPoint$
|
|
216
|
+
M$a.toInnerPoint(t, origin, tempPoint$4);
|
|
217
|
+
M$a.rotateOfInner(t, tempPoint$4, rotation);
|
|
220
218
|
},
|
|
221
219
|
rotateOfInner(t, origin, rotation) {
|
|
222
220
|
M$a.translateInner(t, origin.x, origin.y);
|
|
@@ -237,8 +235,8 @@ var LeaferUI = (function (exports) {
|
|
|
237
235
|
}
|
|
238
236
|
},
|
|
239
237
|
skewOfOuter(t, origin, skewX, skewY) {
|
|
240
|
-
M$a.toInnerPoint(t, origin, tempPoint$
|
|
241
|
-
M$a.skewOfInner(t, tempPoint$
|
|
238
|
+
M$a.toInnerPoint(t, origin, tempPoint$4);
|
|
239
|
+
M$a.skewOfInner(t, tempPoint$4, skewX, skewY);
|
|
242
240
|
},
|
|
243
241
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
244
242
|
M$a.translateInner(t, origin.x, origin.y);
|
|
@@ -467,8 +465,10 @@ var LeaferUI = (function (exports) {
|
|
|
467
465
|
t.y = halfPixel ? round$5(t.y - 0.5) + 0.5 : round$5(t.y);
|
|
468
466
|
},
|
|
469
467
|
move(t, x, y) {
|
|
470
|
-
|
|
471
|
-
|
|
468
|
+
if (typeof x === 'object')
|
|
469
|
+
t.x += x.x, t.y += x.y;
|
|
470
|
+
else
|
|
471
|
+
t.x += x, t.y += y;
|
|
472
472
|
},
|
|
473
473
|
scale(t, scaleX, scaleY = scaleX) {
|
|
474
474
|
if (t.x)
|
|
@@ -646,7 +646,7 @@ var LeaferUI = (function (exports) {
|
|
|
646
646
|
return this;
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
|
-
const tempPoint$
|
|
649
|
+
const tempPoint$3 = new Point();
|
|
650
650
|
|
|
651
651
|
class Matrix {
|
|
652
652
|
constructor(a, b, c, d, e, f) {
|
|
@@ -804,15 +804,87 @@ var LeaferUI = (function (exports) {
|
|
|
804
804
|
};
|
|
805
805
|
const { addPoint: addPoint$4 } = TwoPointBoundsHelper;
|
|
806
806
|
|
|
807
|
+
exports.Direction4 = void 0;
|
|
808
|
+
(function (Direction4) {
|
|
809
|
+
Direction4[Direction4["top"] = 0] = "top";
|
|
810
|
+
Direction4[Direction4["right"] = 1] = "right";
|
|
811
|
+
Direction4[Direction4["bottom"] = 2] = "bottom";
|
|
812
|
+
Direction4[Direction4["left"] = 3] = "left";
|
|
813
|
+
})(exports.Direction4 || (exports.Direction4 = {}));
|
|
814
|
+
exports.Direction9 = void 0;
|
|
815
|
+
(function (Direction9) {
|
|
816
|
+
Direction9[Direction9["topLeft"] = 0] = "topLeft";
|
|
817
|
+
Direction9[Direction9["top"] = 1] = "top";
|
|
818
|
+
Direction9[Direction9["topRight"] = 2] = "topRight";
|
|
819
|
+
Direction9[Direction9["right"] = 3] = "right";
|
|
820
|
+
Direction9[Direction9["bottomRight"] = 4] = "bottomRight";
|
|
821
|
+
Direction9[Direction9["bottom"] = 5] = "bottom";
|
|
822
|
+
Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
|
|
823
|
+
Direction9[Direction9["left"] = 7] = "left";
|
|
824
|
+
Direction9[Direction9["center"] = 8] = "center";
|
|
825
|
+
Direction9[Direction9["top-left"] = 0] = "top-left";
|
|
826
|
+
Direction9[Direction9["top-right"] = 2] = "top-right";
|
|
827
|
+
Direction9[Direction9["bottom-right"] = 4] = "bottom-right";
|
|
828
|
+
Direction9[Direction9["bottom-left"] = 6] = "bottom-left";
|
|
829
|
+
})(exports.Direction9 || (exports.Direction9 = {}));
|
|
830
|
+
|
|
831
|
+
const directionData = [
|
|
832
|
+
{ x: 0, y: 0 },
|
|
833
|
+
{ x: 0.5, y: 0 },
|
|
834
|
+
{ x: 1, y: 0 },
|
|
835
|
+
{ x: 1, y: 0.5 },
|
|
836
|
+
{ x: 1, y: 1 },
|
|
837
|
+
{ x: 0.5, y: 1 },
|
|
838
|
+
{ x: 0, y: 1 },
|
|
839
|
+
{ x: 0, y: 0.5 },
|
|
840
|
+
{ x: 0.5, y: 0.5 }
|
|
841
|
+
];
|
|
842
|
+
directionData.forEach(item => item.type = 'percent');
|
|
843
|
+
const AroundHelper = {
|
|
844
|
+
directionData,
|
|
845
|
+
tempPoint: {},
|
|
846
|
+
get: get$4,
|
|
847
|
+
toPoint(around, box, to, onlyBoxSize, content, onlyContentSize) {
|
|
848
|
+
const point = get$4(around);
|
|
849
|
+
to.x = point.x;
|
|
850
|
+
to.y = point.y;
|
|
851
|
+
if (point.type === 'percent') {
|
|
852
|
+
to.x *= box.width;
|
|
853
|
+
to.y *= box.height;
|
|
854
|
+
if (content) {
|
|
855
|
+
if (!onlyContentSize)
|
|
856
|
+
to.x -= content.x, to.y -= content.y;
|
|
857
|
+
if (point.x)
|
|
858
|
+
to.x -= (point.x === 1) ? content.width : (point.x === 0.5 ? point.x * content.width : 0);
|
|
859
|
+
if (point.y)
|
|
860
|
+
to.y -= (point.y === 1) ? content.height : (point.y === 0.5 ? point.y * content.height : 0);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
if (!onlyBoxSize)
|
|
864
|
+
to.x += box.x, to.y += box.y;
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
function get$4(around) {
|
|
868
|
+
return typeof around === 'string' ? directionData[exports.Direction9[around]] : around;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
const { toPoint: toPoint$6 } = AroundHelper;
|
|
872
|
+
const AlignHelper = {
|
|
873
|
+
toPoint(align, content, box, to, onlyBoxSize, onlyContentSize) {
|
|
874
|
+
toPoint$6(align, box, to, onlyBoxSize, content, onlyContentSize);
|
|
875
|
+
}
|
|
876
|
+
};
|
|
877
|
+
|
|
807
878
|
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPoint$3, toBounds: toBounds$4 } = TwoPointBoundsHelper;
|
|
808
879
|
const { toOuterPoint: toOuterPoint$2 } = MatrixHelper;
|
|
809
880
|
const { float: float$1, fourNumber: fourNumber$1 } = MathHelper;
|
|
810
881
|
const { floor: floor$1, ceil: ceil$3 } = Math;
|
|
811
882
|
let right$4, bottom$3, boundsRight, boundsBottom;
|
|
812
883
|
const point$2 = {};
|
|
813
|
-
const toPoint$
|
|
884
|
+
const toPoint$5 = {};
|
|
885
|
+
const tempBounds$2 = {};
|
|
814
886
|
const BoundsHelper = {
|
|
815
|
-
tempBounds:
|
|
887
|
+
tempBounds: tempBounds$2,
|
|
816
888
|
set(t, x = 0, y = 0, width = 0, height = 0) {
|
|
817
889
|
t.x = x;
|
|
818
890
|
t.y = y;
|
|
@@ -875,8 +947,8 @@ var LeaferUI = (function (exports) {
|
|
|
875
947
|
}
|
|
876
948
|
B.move(to, -to.offsetX, -to.offsetY);
|
|
877
949
|
},
|
|
878
|
-
scale(t, scaleX, scaleY = scaleX) {
|
|
879
|
-
PointHelper.scale(t, scaleX, scaleY);
|
|
950
|
+
scale(t, scaleX, scaleY = scaleX, onlySize) {
|
|
951
|
+
onlySize || PointHelper.scale(t, scaleX, scaleY);
|
|
880
952
|
t.width *= scaleX;
|
|
881
953
|
t.height *= scaleY;
|
|
882
954
|
},
|
|
@@ -886,9 +958,9 @@ var LeaferUI = (function (exports) {
|
|
|
886
958
|
t.height *= scaleY;
|
|
887
959
|
},
|
|
888
960
|
tempToOuterOf(t, matrix) {
|
|
889
|
-
B.copy(
|
|
890
|
-
B.toOuterOf(
|
|
891
|
-
return
|
|
961
|
+
B.copy(tempBounds$2, t);
|
|
962
|
+
B.toOuterOf(tempBounds$2, matrix);
|
|
963
|
+
return tempBounds$2;
|
|
892
964
|
},
|
|
893
965
|
getOuterOf(t, matrix) {
|
|
894
966
|
t = Object.assign({}, t);
|
|
@@ -919,17 +991,17 @@ var LeaferUI = (function (exports) {
|
|
|
919
991
|
else {
|
|
920
992
|
point$2.x = t.x;
|
|
921
993
|
point$2.y = t.y;
|
|
922
|
-
toOuterPoint$2(matrix, point$2, toPoint$
|
|
923
|
-
setPoint$5(tempPointBounds$1, toPoint$
|
|
994
|
+
toOuterPoint$2(matrix, point$2, toPoint$5);
|
|
995
|
+
setPoint$5(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
924
996
|
point$2.x = t.x + t.width;
|
|
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.y = t.y + t.height;
|
|
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
|
point$2.x = t.x;
|
|
931
|
-
toOuterPoint$2(matrix, point$2, toPoint$
|
|
932
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
1003
|
+
toOuterPoint$2(matrix, point$2, toPoint$5);
|
|
1004
|
+
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
933
1005
|
toBounds$4(tempPointBounds$1, to);
|
|
934
1006
|
}
|
|
935
1007
|
},
|
|
@@ -939,9 +1011,21 @@ var LeaferUI = (function (exports) {
|
|
|
939
1011
|
B.scale(to, 1 / matrix.a, 1 / matrix.d);
|
|
940
1012
|
},
|
|
941
1013
|
getFitMatrix(t, put, baseScale = 1) {
|
|
942
|
-
const scale = Math.min(baseScale,
|
|
1014
|
+
const scale = Math.min(baseScale, B.getFitScale(t, put));
|
|
943
1015
|
return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
|
|
944
1016
|
},
|
|
1017
|
+
getFitScale(t, put, isCoverMode) {
|
|
1018
|
+
const sw = t.width / put.width, sh = t.height / put.height;
|
|
1019
|
+
return isCoverMode ? Math.max(sw, sh) : Math.min(sw, sh);
|
|
1020
|
+
},
|
|
1021
|
+
put(t, put, align = 'center', putScale = 1, changeSize = true, to) {
|
|
1022
|
+
to || (to = put);
|
|
1023
|
+
if (typeof putScale === 'string')
|
|
1024
|
+
putScale = B.getFitScale(t, put, putScale === 'cover');
|
|
1025
|
+
tempBounds$2.width = changeSize ? put.width *= putScale : put.width * putScale;
|
|
1026
|
+
tempBounds$2.height = changeSize ? put.height *= putScale : put.height * putScale;
|
|
1027
|
+
AlignHelper.toPoint(align, tempBounds$2, t, to, true, true);
|
|
1028
|
+
},
|
|
945
1029
|
getSpread(t, spread, side) {
|
|
946
1030
|
const n = {};
|
|
947
1031
|
B.copyAndSpread(n, t, spread, false, side);
|
|
@@ -1115,8 +1199,8 @@ var LeaferUI = (function (exports) {
|
|
|
1115
1199
|
BoundsHelper.move(this, x, y);
|
|
1116
1200
|
return this;
|
|
1117
1201
|
}
|
|
1118
|
-
scale(scaleX, scaleY) {
|
|
1119
|
-
BoundsHelper.scale(this, scaleX, scaleY);
|
|
1202
|
+
scale(scaleX, scaleY, onlySize) {
|
|
1203
|
+
BoundsHelper.scale(this, scaleX, scaleY, onlySize);
|
|
1120
1204
|
return this;
|
|
1121
1205
|
}
|
|
1122
1206
|
scaleOf(origin, scaleX, scaleY) {
|
|
@@ -1134,6 +1218,9 @@ var LeaferUI = (function (exports) {
|
|
|
1134
1218
|
getFitMatrix(put, baseScale) {
|
|
1135
1219
|
return BoundsHelper.getFitMatrix(this, put, baseScale);
|
|
1136
1220
|
}
|
|
1221
|
+
put(put, align, putScale) {
|
|
1222
|
+
BoundsHelper.put(this, put, align, putScale);
|
|
1223
|
+
}
|
|
1137
1224
|
spread(fourNumber, side) {
|
|
1138
1225
|
BoundsHelper.spread(this, fourNumber, side);
|
|
1139
1226
|
return this;
|
|
@@ -1242,79 +1329,6 @@ var LeaferUI = (function (exports) {
|
|
|
1242
1329
|
}
|
|
1243
1330
|
}
|
|
1244
1331
|
|
|
1245
|
-
exports.Direction4 = void 0;
|
|
1246
|
-
(function (Direction4) {
|
|
1247
|
-
Direction4[Direction4["top"] = 0] = "top";
|
|
1248
|
-
Direction4[Direction4["right"] = 1] = "right";
|
|
1249
|
-
Direction4[Direction4["bottom"] = 2] = "bottom";
|
|
1250
|
-
Direction4[Direction4["left"] = 3] = "left";
|
|
1251
|
-
})(exports.Direction4 || (exports.Direction4 = {}));
|
|
1252
|
-
exports.Direction9 = void 0;
|
|
1253
|
-
(function (Direction9) {
|
|
1254
|
-
Direction9[Direction9["topLeft"] = 0] = "topLeft";
|
|
1255
|
-
Direction9[Direction9["top"] = 1] = "top";
|
|
1256
|
-
Direction9[Direction9["topRight"] = 2] = "topRight";
|
|
1257
|
-
Direction9[Direction9["right"] = 3] = "right";
|
|
1258
|
-
Direction9[Direction9["bottomRight"] = 4] = "bottomRight";
|
|
1259
|
-
Direction9[Direction9["bottom"] = 5] = "bottom";
|
|
1260
|
-
Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
|
|
1261
|
-
Direction9[Direction9["left"] = 7] = "left";
|
|
1262
|
-
Direction9[Direction9["center"] = 8] = "center";
|
|
1263
|
-
Direction9[Direction9["top-left"] = 0] = "top-left";
|
|
1264
|
-
Direction9[Direction9["top-right"] = 2] = "top-right";
|
|
1265
|
-
Direction9[Direction9["bottom-right"] = 4] = "bottom-right";
|
|
1266
|
-
Direction9[Direction9["bottom-left"] = 6] = "bottom-left";
|
|
1267
|
-
})(exports.Direction9 || (exports.Direction9 = {}));
|
|
1268
|
-
|
|
1269
|
-
const directionData = [
|
|
1270
|
-
{ x: 0, y: 0 },
|
|
1271
|
-
{ x: 0.5, y: 0 },
|
|
1272
|
-
{ x: 1, y: 0 },
|
|
1273
|
-
{ x: 1, y: 0.5 },
|
|
1274
|
-
{ x: 1, y: 1 },
|
|
1275
|
-
{ x: 0.5, y: 1 },
|
|
1276
|
-
{ x: 0, y: 1 },
|
|
1277
|
-
{ x: 0, y: 0.5 },
|
|
1278
|
-
{ x: 0.5, y: 0.5 }
|
|
1279
|
-
];
|
|
1280
|
-
directionData.forEach(item => item.type = 'percent');
|
|
1281
|
-
const AroundHelper = {
|
|
1282
|
-
directionData,
|
|
1283
|
-
tempPoint: {},
|
|
1284
|
-
get: get$4,
|
|
1285
|
-
toPoint(around, bounds, to, onlySize, pointBounds) {
|
|
1286
|
-
const point = get$4(around);
|
|
1287
|
-
to.x = point.x;
|
|
1288
|
-
to.y = point.y;
|
|
1289
|
-
if (point.type === 'percent') {
|
|
1290
|
-
to.x *= bounds.width;
|
|
1291
|
-
to.y *= bounds.height;
|
|
1292
|
-
if (pointBounds) {
|
|
1293
|
-
to.x -= pointBounds.x;
|
|
1294
|
-
to.y -= pointBounds.y;
|
|
1295
|
-
if (point.x)
|
|
1296
|
-
to.x -= (point.x === 1) ? pointBounds.width : (point.x === 0.5 ? point.x * pointBounds.width : 0);
|
|
1297
|
-
if (point.y)
|
|
1298
|
-
to.y -= (point.y === 1) ? pointBounds.height : (point.y === 0.5 ? point.y * pointBounds.height : 0);
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1301
|
-
if (!onlySize) {
|
|
1302
|
-
to.x += bounds.x;
|
|
1303
|
-
to.y += bounds.y;
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
};
|
|
1307
|
-
function get$4(around) {
|
|
1308
|
-
return typeof around === 'string' ? directionData[exports.Direction9[around]] : around;
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
const { toPoint: toPoint$5 } = AroundHelper;
|
|
1312
|
-
const AlignHelper = {
|
|
1313
|
-
toPoint(align, contentBounds, bounds, to, onlySize) {
|
|
1314
|
-
toPoint$5(align, bounds, to, onlySize, contentBounds);
|
|
1315
|
-
}
|
|
1316
|
-
};
|
|
1317
|
-
|
|
1318
1332
|
const StringNumberMap = {
|
|
1319
1333
|
'0': 1,
|
|
1320
1334
|
'1': 1,
|
|
@@ -1445,11 +1459,17 @@ var LeaferUI = (function (exports) {
|
|
|
1445
1459
|
return rs;
|
|
1446
1460
|
},
|
|
1447
1461
|
need(name) {
|
|
1448
|
-
console.error('please install plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name);
|
|
1462
|
+
console.error('please install and import plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name);
|
|
1449
1463
|
}
|
|
1450
1464
|
};
|
|
1451
1465
|
setTimeout(() => check.forEach(name => Plugin.has(name, true)));
|
|
1452
1466
|
|
|
1467
|
+
const Creator = {
|
|
1468
|
+
editor(_options) {
|
|
1469
|
+
return Plugin.need('editor');
|
|
1470
|
+
}
|
|
1471
|
+
};
|
|
1472
|
+
|
|
1453
1473
|
const debug$h = Debug.get('UICreator');
|
|
1454
1474
|
const UICreator = {
|
|
1455
1475
|
list: {},
|
|
@@ -1587,6 +1607,10 @@ var LeaferUI = (function (exports) {
|
|
|
1587
1607
|
for (let i = 0, len = list.length; i < len; i++)
|
|
1588
1608
|
map[list[i]] = true;
|
|
1589
1609
|
return map;
|
|
1610
|
+
},
|
|
1611
|
+
stintSet(data, attrName, value) {
|
|
1612
|
+
value || (value = undefined);
|
|
1613
|
+
data[attrName] !== value && (data[attrName] = value);
|
|
1590
1614
|
}
|
|
1591
1615
|
};
|
|
1592
1616
|
const { assign: assign$1 } = DataHelper;
|
|
@@ -2388,7 +2412,7 @@ var LeaferUI = (function (exports) {
|
|
|
2388
2412
|
const { setPoint: setPoint$4, addPoint: addPoint$2 } = TwoPointBoundsHelper;
|
|
2389
2413
|
const { set, toNumberPoints: toNumberPoints$1 } = PointHelper;
|
|
2390
2414
|
const { M: M$9, L: L$a, C: C$8, Q: Q$7, Z: Z$8 } = PathCommandMap;
|
|
2391
|
-
const tempPoint$
|
|
2415
|
+
const tempPoint$2 = {};
|
|
2392
2416
|
const BezierHelper = {
|
|
2393
2417
|
points(data, originPoints, curve, close) {
|
|
2394
2418
|
let points = toNumberPoints$1(originPoints);
|
|
@@ -2410,6 +2434,8 @@ var LeaferUI = (function (exports) {
|
|
|
2410
2434
|
cY = points[i + 3];
|
|
2411
2435
|
ba = sqrt$3(pow$1(bX - aX, 2) + pow$1(bY - aY, 2));
|
|
2412
2436
|
cb = sqrt$3(pow$1(cX - bX, 2) + pow$1(cY - bY, 2));
|
|
2437
|
+
if (!ba && !cb)
|
|
2438
|
+
continue;
|
|
2413
2439
|
d = ba + cb;
|
|
2414
2440
|
ba = (t * ba) / d;
|
|
2415
2441
|
cb = (t * cb) / d;
|
|
@@ -2579,8 +2605,8 @@ var LeaferUI = (function (exports) {
|
|
|
2579
2605
|
addMode ? addPoint$2(pointBounds, fromX, fromY) : setPoint$4(pointBounds, fromX, fromY);
|
|
2580
2606
|
addPoint$2(pointBounds, toX, toY);
|
|
2581
2607
|
for (let i = 0, len = tList.length; i < len; i++) {
|
|
2582
|
-
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$
|
|
2583
|
-
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);
|
|
2584
2610
|
}
|
|
2585
2611
|
},
|
|
2586
2612
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -3389,7 +3415,7 @@ var LeaferUI = (function (exports) {
|
|
|
3389
3415
|
}
|
|
3390
3416
|
|
|
3391
3417
|
const FileHelper = {
|
|
3392
|
-
|
|
3418
|
+
alphaPixelTypes: ['png', 'webp', 'svg'],
|
|
3393
3419
|
upperCaseTypeMap: {},
|
|
3394
3420
|
mineType(type) {
|
|
3395
3421
|
if (!type || type.startsWith('image'))
|
|
@@ -3416,7 +3442,7 @@ var LeaferUI = (function (exports) {
|
|
|
3416
3442
|
}
|
|
3417
3443
|
};
|
|
3418
3444
|
const F$2 = FileHelper;
|
|
3419
|
-
F$2.
|
|
3445
|
+
F$2.alphaPixelTypes.forEach(type => F$2.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3420
3446
|
|
|
3421
3447
|
const debug$c = Debug.get('TaskProcessor');
|
|
3422
3448
|
class TaskItem {
|
|
@@ -3733,8 +3759,8 @@ var LeaferUI = (function (exports) {
|
|
|
3733
3759
|
list.length = 0;
|
|
3734
3760
|
}
|
|
3735
3761
|
},
|
|
3736
|
-
|
|
3737
|
-
return FileHelper.
|
|
3762
|
+
hasAlphaPixel(config) {
|
|
3763
|
+
return FileHelper.alphaPixelTypes.some(item => I$1.isFormat(item, config));
|
|
3738
3764
|
},
|
|
3739
3765
|
isFormat(format, config) {
|
|
3740
3766
|
if (config.format === format)
|
|
@@ -3772,7 +3798,7 @@ var LeaferUI = (function (exports) {
|
|
|
3772
3798
|
this.setView(view.config ? view.view : view);
|
|
3773
3799
|
}
|
|
3774
3800
|
ImageManager.isFormat('svg', config) && (this.isSVG = true);
|
|
3775
|
-
ImageManager.
|
|
3801
|
+
ImageManager.hasAlphaPixel(config) && (this.hasAlphaPixel = true);
|
|
3776
3802
|
}
|
|
3777
3803
|
load(onSuccess, onError) {
|
|
3778
3804
|
if (!this.loading) {
|
|
@@ -4460,7 +4486,7 @@ var LeaferUI = (function (exports) {
|
|
|
4460
4486
|
}
|
|
4461
4487
|
};
|
|
4462
4488
|
|
|
4463
|
-
const { updateBounds: updateBounds$
|
|
4489
|
+
const { updateBounds: updateBounds$4 } = LeafHelper;
|
|
4464
4490
|
const BranchHelper = {
|
|
4465
4491
|
sort(a, b) {
|
|
4466
4492
|
return (a.__.zIndex === b.__.zIndex) ? (a.__tempNumber - b.__tempNumber) : (a.__.zIndex - b.__.zIndex);
|
|
@@ -4522,11 +4548,11 @@ var LeaferUI = (function (exports) {
|
|
|
4522
4548
|
branch = branchStack[i];
|
|
4523
4549
|
children = branch.children;
|
|
4524
4550
|
for (let j = 0, len = children.length; j < len; j++) {
|
|
4525
|
-
updateBounds$
|
|
4551
|
+
updateBounds$4(children[j]);
|
|
4526
4552
|
}
|
|
4527
4553
|
if (exclude && exclude === branch)
|
|
4528
4554
|
continue;
|
|
4529
|
-
updateBounds$
|
|
4555
|
+
updateBounds$4(branch);
|
|
4530
4556
|
}
|
|
4531
4557
|
}
|
|
4532
4558
|
};
|
|
@@ -4544,7 +4570,7 @@ var LeaferUI = (function (exports) {
|
|
|
4544
4570
|
}
|
|
4545
4571
|
};
|
|
4546
4572
|
|
|
4547
|
-
const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
|
|
4573
|
+
const { getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$3 } = LeafHelper;
|
|
4548
4574
|
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$9 } = BoundsHelper;
|
|
4549
4575
|
const localContent = '_localContentBounds';
|
|
4550
4576
|
const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
|
|
@@ -4588,7 +4614,9 @@ var LeaferUI = (function (exports) {
|
|
|
4588
4614
|
this._localRenderBounds = local;
|
|
4589
4615
|
}
|
|
4590
4616
|
update() {
|
|
4591
|
-
const { leafer } =
|
|
4617
|
+
const { leaf } = this, { leafer } = leaf;
|
|
4618
|
+
if (leaf.isApp)
|
|
4619
|
+
return updateBounds$3(leaf);
|
|
4592
4620
|
if (leafer) {
|
|
4593
4621
|
if (leafer.ready)
|
|
4594
4622
|
leafer.watcher.changed && leafer.layouter.layout();
|
|
@@ -4596,7 +4624,7 @@ var LeaferUI = (function (exports) {
|
|
|
4596
4624
|
leafer.start();
|
|
4597
4625
|
}
|
|
4598
4626
|
else {
|
|
4599
|
-
let root =
|
|
4627
|
+
let root = leaf;
|
|
4600
4628
|
while (root.parent && !root.parent.leafer) {
|
|
4601
4629
|
root = root.parent;
|
|
4602
4630
|
}
|
|
@@ -4818,7 +4846,7 @@ var LeaferUI = (function (exports) {
|
|
|
4818
4846
|
}
|
|
4819
4847
|
childrenSortChange() {
|
|
4820
4848
|
if (!this.childrenSortChanged) {
|
|
4821
|
-
this.childrenSortChanged = true;
|
|
4849
|
+
this.childrenSortChanged = this.affectChildrenSort = true;
|
|
4822
4850
|
this.leaf.forceUpdate('surface');
|
|
4823
4851
|
}
|
|
4824
4852
|
}
|
|
@@ -4885,6 +4913,40 @@ var LeaferUI = (function (exports) {
|
|
|
4885
4913
|
ImageEvent.LOADED = 'image.loaded';
|
|
4886
4914
|
ImageEvent.ERROR = 'image.error';
|
|
4887
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
|
+
|
|
4888
4950
|
class ResizeEvent extends Event {
|
|
4889
4951
|
get bigger() {
|
|
4890
4952
|
if (!this.old)
|
|
@@ -4981,9 +5043,12 @@ var LeaferUI = (function (exports) {
|
|
|
4981
5043
|
set event(map) { this.on(map); }
|
|
4982
5044
|
on(type, listener, options) {
|
|
4983
5045
|
if (!listener) {
|
|
4984
|
-
let event
|
|
4985
|
-
|
|
4986
|
-
|
|
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);
|
|
4987
5052
|
return;
|
|
4988
5053
|
}
|
|
4989
5054
|
let capture, once;
|
|
@@ -5013,6 +5078,8 @@ var LeaferUI = (function (exports) {
|
|
|
5013
5078
|
else {
|
|
5014
5079
|
map[type] = [item];
|
|
5015
5080
|
}
|
|
5081
|
+
if (boundsEventMap[type])
|
|
5082
|
+
BoundsEvent.checkHas(this, type, 'on');
|
|
5016
5083
|
}
|
|
5017
5084
|
});
|
|
5018
5085
|
}
|
|
@@ -5034,6 +5101,8 @@ var LeaferUI = (function (exports) {
|
|
|
5034
5101
|
events.splice(index, 1);
|
|
5035
5102
|
if (!events.length)
|
|
5036
5103
|
delete map[type];
|
|
5104
|
+
if (boundsEventMap[type])
|
|
5105
|
+
BoundsEvent.checkHas(this, type, 'off');
|
|
5037
5106
|
}
|
|
5038
5107
|
}
|
|
5039
5108
|
});
|
|
@@ -5053,19 +5122,31 @@ var LeaferUI = (function (exports) {
|
|
|
5053
5122
|
}
|
|
5054
5123
|
}
|
|
5055
5124
|
on_(type, listener, bind, options) {
|
|
5056
|
-
if (
|
|
5057
|
-
|
|
5058
|
-
|
|
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);
|
|
5059
5129
|
return { type, current: this, listener, options };
|
|
5060
5130
|
}
|
|
5061
5131
|
off_(id) {
|
|
5062
5132
|
if (!id)
|
|
5063
5133
|
return;
|
|
5064
5134
|
const list = id instanceof Array ? id : [id];
|
|
5065
|
-
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
|
+
});
|
|
5066
5141
|
list.length = 0;
|
|
5067
5142
|
}
|
|
5068
|
-
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;
|
|
5069
5150
|
this.on(type, listener, { once: true, capture });
|
|
5070
5151
|
}
|
|
5071
5152
|
emit(type, event, capture) {
|
|
@@ -5177,7 +5258,7 @@ var LeaferUI = (function (exports) {
|
|
|
5177
5258
|
};
|
|
5178
5259
|
|
|
5179
5260
|
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
5180
|
-
const { toPoint: toPoint$4, tempPoint: tempPoint$
|
|
5261
|
+
const { toPoint: toPoint$4, tempPoint: tempPoint$1 } = AroundHelper;
|
|
5181
5262
|
const LeafMatrix = {
|
|
5182
5263
|
__updateWorldMatrix() {
|
|
5183
5264
|
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
|
|
@@ -5186,19 +5267,19 @@ var LeaferUI = (function (exports) {
|
|
|
5186
5267
|
if (this.__local) {
|
|
5187
5268
|
const layout = this.__layout, local = this.__local, data = this.__;
|
|
5188
5269
|
if (layout.affectScaleOrRotation) {
|
|
5189
|
-
if (layout.scaleChanged || layout.rotationChanged) {
|
|
5270
|
+
if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
|
|
5190
5271
|
setLayout(local, data, null, null, layout.affectRotation);
|
|
5191
|
-
layout.scaleChanged = layout.rotationChanged =
|
|
5272
|
+
layout.scaleChanged = layout.rotationChanged = undefined;
|
|
5192
5273
|
}
|
|
5193
5274
|
}
|
|
5194
5275
|
local.e = data.x + data.offsetX;
|
|
5195
5276
|
local.f = data.y + data.offsetY;
|
|
5196
5277
|
if (data.around || data.origin) {
|
|
5197
|
-
toPoint$4(data.around || data.origin, layout.boxBounds, tempPoint$
|
|
5198
|
-
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);
|
|
5199
5280
|
}
|
|
5200
5281
|
}
|
|
5201
|
-
this.__layout.matrixChanged =
|
|
5282
|
+
this.__layout.matrixChanged = undefined;
|
|
5202
5283
|
}
|
|
5203
5284
|
};
|
|
5204
5285
|
|
|
@@ -5208,11 +5289,17 @@ var LeaferUI = (function (exports) {
|
|
|
5208
5289
|
const { toBounds: toBounds$2 } = PathBounds;
|
|
5209
5290
|
const LeafBounds = {
|
|
5210
5291
|
__updateWorldBounds() {
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
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;
|
|
5215
5300
|
}
|
|
5301
|
+
if (this.__hasWorldEvent)
|
|
5302
|
+
BoundsEvent.emitWorld(this);
|
|
5216
5303
|
},
|
|
5217
5304
|
__updateLocalBounds() {
|
|
5218
5305
|
const layout = this.__layout;
|
|
@@ -5221,12 +5308,12 @@ var LeaferUI = (function (exports) {
|
|
|
5221
5308
|
this.__updatePath();
|
|
5222
5309
|
this.__updateRenderPath();
|
|
5223
5310
|
this.__updateBoxBounds();
|
|
5224
|
-
layout.resized =
|
|
5311
|
+
layout.resized = 'inner';
|
|
5225
5312
|
}
|
|
5226
5313
|
if (layout.localBoxChanged) {
|
|
5227
5314
|
if (this.__local)
|
|
5228
5315
|
this.__updateLocalBoxBounds();
|
|
5229
|
-
layout.localBoxChanged =
|
|
5316
|
+
layout.localBoxChanged = undefined;
|
|
5230
5317
|
if (layout.strokeSpread)
|
|
5231
5318
|
layout.strokeChanged = true;
|
|
5232
5319
|
if (layout.renderSpread)
|
|
@@ -5234,7 +5321,7 @@ var LeaferUI = (function (exports) {
|
|
|
5234
5321
|
if (this.parent)
|
|
5235
5322
|
this.parent.__layout.boxChange();
|
|
5236
5323
|
}
|
|
5237
|
-
layout.boxChanged =
|
|
5324
|
+
layout.boxChanged = undefined;
|
|
5238
5325
|
if (layout.strokeChanged) {
|
|
5239
5326
|
layout.strokeSpread = this.__updateStrokeSpread();
|
|
5240
5327
|
if (layout.strokeSpread) {
|
|
@@ -5246,12 +5333,12 @@ var LeaferUI = (function (exports) {
|
|
|
5246
5333
|
else {
|
|
5247
5334
|
layout.spreadStrokeCancel();
|
|
5248
5335
|
}
|
|
5249
|
-
layout.strokeChanged =
|
|
5336
|
+
layout.strokeChanged = undefined;
|
|
5250
5337
|
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
|
|
5251
5338
|
layout.renderChanged = true;
|
|
5252
5339
|
if (this.parent)
|
|
5253
5340
|
this.parent.__layout.strokeChange();
|
|
5254
|
-
layout.resized =
|
|
5341
|
+
layout.resized = 'inner';
|
|
5255
5342
|
}
|
|
5256
5343
|
if (layout.renderChanged) {
|
|
5257
5344
|
layout.renderSpread = this.__updateRenderSpread();
|
|
@@ -5264,11 +5351,12 @@ var LeaferUI = (function (exports) {
|
|
|
5264
5351
|
else {
|
|
5265
5352
|
layout.spreadRenderCancel();
|
|
5266
5353
|
}
|
|
5267
|
-
layout.renderChanged =
|
|
5354
|
+
layout.renderChanged = undefined;
|
|
5268
5355
|
if (this.parent)
|
|
5269
5356
|
this.parent.__layout.renderChange();
|
|
5270
5357
|
}
|
|
5271
|
-
layout.
|
|
5358
|
+
layout.resized || (layout.resized = 'local');
|
|
5359
|
+
layout.boundsChanged = undefined;
|
|
5272
5360
|
},
|
|
5273
5361
|
__updateLocalBoxBounds() {
|
|
5274
5362
|
if (this.__hasMotionPath)
|
|
@@ -5808,7 +5896,7 @@ var LeaferUI = (function (exports) {
|
|
|
5808
5896
|
off(_type, _listener, _options) { }
|
|
5809
5897
|
on_(_type, _listener, _bind, _options) { return undefined; }
|
|
5810
5898
|
off_(_id) { }
|
|
5811
|
-
once(_type, _listener, _capture) { }
|
|
5899
|
+
once(_type, _listener, _captureOrBind, _capture) { }
|
|
5812
5900
|
emit(_type, _event, _capture) { }
|
|
5813
5901
|
emitEvent(_event, _capture) { }
|
|
5814
5902
|
hasEvent(_type, _capture) { return false; }
|
|
@@ -6145,7 +6233,7 @@ var LeaferUI = (function (exports) {
|
|
|
6145
6233
|
}
|
|
6146
6234
|
}
|
|
6147
6235
|
|
|
6148
|
-
const version = "1.6.
|
|
6236
|
+
const version = "1.6.3";
|
|
6149
6237
|
|
|
6150
6238
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6151
6239
|
get allowBackgroundColor() { return true; }
|
|
@@ -6304,17 +6392,15 @@ var LeaferUI = (function (exports) {
|
|
|
6304
6392
|
this.target.emitEvent(new WatchEvent(WatchEvent.DATA, { updatedList: this.updatedList }));
|
|
6305
6393
|
this.__updatedList = new LeafList();
|
|
6306
6394
|
this.totalTimes++;
|
|
6307
|
-
this.changed = false;
|
|
6308
|
-
this.hasVisible = false;
|
|
6309
|
-
this.hasRemove = false;
|
|
6310
|
-
this.hasAdd = false;
|
|
6395
|
+
this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
6311
6396
|
}
|
|
6312
6397
|
__listenEvents() {
|
|
6313
|
-
const { target } = this;
|
|
6314
6398
|
this.__eventIds = [
|
|
6315
|
-
target.on_(
|
|
6316
|
-
|
|
6317
|
-
|
|
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
|
+
])
|
|
6318
6404
|
];
|
|
6319
6405
|
}
|
|
6320
6406
|
__removeListenEvents() {
|
|
@@ -6324,8 +6410,7 @@ var LeaferUI = (function (exports) {
|
|
|
6324
6410
|
if (this.target) {
|
|
6325
6411
|
this.stop();
|
|
6326
6412
|
this.__removeListenEvents();
|
|
6327
|
-
this.target = null;
|
|
6328
|
-
this.__updatedList = null;
|
|
6413
|
+
this.target = this.__updatedList = null;
|
|
6329
6414
|
}
|
|
6330
6415
|
}
|
|
6331
6416
|
}
|
|
@@ -6430,7 +6515,7 @@ var LeaferUI = (function (exports) {
|
|
|
6430
6515
|
this.disabled = true;
|
|
6431
6516
|
}
|
|
6432
6517
|
layout() {
|
|
6433
|
-
if (!this.running)
|
|
6518
|
+
if (this.layouting || !this.running)
|
|
6434
6519
|
return;
|
|
6435
6520
|
const { target } = this;
|
|
6436
6521
|
this.times = 0;
|
|
@@ -6513,12 +6598,10 @@ var LeaferUI = (function (exports) {
|
|
|
6513
6598
|
}
|
|
6514
6599
|
static fullLayout(target) {
|
|
6515
6600
|
updateAllMatrix$1(target, true);
|
|
6516
|
-
if (target.isBranch)
|
|
6601
|
+
if (target.isBranch)
|
|
6517
6602
|
BranchHelper.updateBounds(target);
|
|
6518
|
-
|
|
6519
|
-
else {
|
|
6603
|
+
else
|
|
6520
6604
|
LeafHelper.updateBounds(target);
|
|
6521
|
-
}
|
|
6522
6605
|
updateAllChange(target);
|
|
6523
6606
|
}
|
|
6524
6607
|
addExtra(leaf) {
|
|
@@ -6541,11 +6624,12 @@ var LeaferUI = (function (exports) {
|
|
|
6541
6624
|
this.__updatedList = event.data.updatedList;
|
|
6542
6625
|
}
|
|
6543
6626
|
__listenEvents() {
|
|
6544
|
-
const { target } = this;
|
|
6545
6627
|
this.__eventIds = [
|
|
6546
|
-
target.on_(
|
|
6547
|
-
|
|
6548
|
-
|
|
6628
|
+
this.target.on_([
|
|
6629
|
+
[LayoutEvent.REQUEST, this.layout, this],
|
|
6630
|
+
[LayoutEvent.AGAIN, this.layoutAgain, this],
|
|
6631
|
+
[WatchEvent.DATA, this.__onReceiveWatchData, this]
|
|
6632
|
+
])
|
|
6549
6633
|
];
|
|
6550
6634
|
}
|
|
6551
6635
|
__removeListenEvents() {
|
|
@@ -6776,12 +6860,13 @@ var LeaferUI = (function (exports) {
|
|
|
6776
6860
|
this.target.emitEvent(new RenderEvent(type, this.times, bounds, options));
|
|
6777
6861
|
}
|
|
6778
6862
|
__listenEvents() {
|
|
6779
|
-
const { target } = this;
|
|
6780
6863
|
this.__eventIds = [
|
|
6781
|
-
target.on_(
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
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
|
+
])
|
|
6785
6870
|
];
|
|
6786
6871
|
}
|
|
6787
6872
|
__removeListenEvents() {
|
|
@@ -6997,8 +7082,32 @@ var LeaferUI = (function (exports) {
|
|
|
6997
7082
|
};
|
|
6998
7083
|
}
|
|
6999
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
|
+
|
|
7000
7107
|
const TextConvert = {};
|
|
7001
|
-
const ColorConvert = {
|
|
7108
|
+
const ColorConvert = {
|
|
7109
|
+
hasTransparent: hasTransparent$3
|
|
7110
|
+
};
|
|
7002
7111
|
const UnitConvert = {
|
|
7003
7112
|
number(value, percentRefer) {
|
|
7004
7113
|
return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
|
|
@@ -7024,6 +7133,7 @@ var LeaferUI = (function (exports) {
|
|
|
7024
7133
|
};
|
|
7025
7134
|
|
|
7026
7135
|
const { parse, objectToCanvasData } = PathConvert;
|
|
7136
|
+
const { stintSet: stintSet$2 } = DataHelper, { hasTransparent: hasTransparent$2 } = ColorConvert;
|
|
7027
7137
|
const emptyPaint = {};
|
|
7028
7138
|
const debug$5 = Debug.get('UIData');
|
|
7029
7139
|
class UIData extends LeafData {
|
|
@@ -7082,38 +7192,22 @@ var LeaferUI = (function (exports) {
|
|
|
7082
7192
|
if (this.__naturalWidth)
|
|
7083
7193
|
this.__removeNaturalSize();
|
|
7084
7194
|
if (typeof value === 'string' || !value) {
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
PaintImage.recycleImage('fill', this);
|
|
7088
|
-
this.__isFills = false;
|
|
7089
|
-
this.__pixelFill && (this.__pixelFill = false);
|
|
7090
|
-
}
|
|
7195
|
+
stintSet$2(this, '__isTransparentFill', hasTransparent$2(value));
|
|
7196
|
+
this.__isFills && this.__removePaint('fill', true);
|
|
7091
7197
|
this._fill = value;
|
|
7092
7198
|
}
|
|
7093
7199
|
else if (typeof value === 'object') {
|
|
7094
|
-
this.
|
|
7095
|
-
const layout = this.__leaf.__layout;
|
|
7096
|
-
layout.boxChanged || layout.boxChange();
|
|
7097
|
-
this.__isFills = true;
|
|
7098
|
-
this._fill || (this._fill = emptyPaint);
|
|
7200
|
+
this.__setPaint('fill', value);
|
|
7099
7201
|
}
|
|
7100
7202
|
}
|
|
7101
7203
|
setStroke(value) {
|
|
7102
7204
|
if (typeof value === 'string' || !value) {
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
PaintImage.recycleImage('stroke', this);
|
|
7106
|
-
this.__isStrokes = false;
|
|
7107
|
-
this.__pixelStroke && (this.__pixelStroke = false);
|
|
7108
|
-
}
|
|
7205
|
+
stintSet$2(this, '__isTransparentStroke', hasTransparent$2(value));
|
|
7206
|
+
this.__isStrokes && this.__removePaint('stroke', true);
|
|
7109
7207
|
this._stroke = value;
|
|
7110
7208
|
}
|
|
7111
7209
|
else if (typeof value === 'object') {
|
|
7112
|
-
this.
|
|
7113
|
-
const layout = this.__leaf.__layout;
|
|
7114
|
-
layout.boxChanged || layout.boxChange();
|
|
7115
|
-
this.__isStrokes = true;
|
|
7116
|
-
this._stroke || (this._stroke = emptyPaint);
|
|
7210
|
+
this.__setPaint('stroke', value);
|
|
7117
7211
|
}
|
|
7118
7212
|
}
|
|
7119
7213
|
setPath(value) {
|
|
@@ -7143,7 +7237,34 @@ var LeaferUI = (function (exports) {
|
|
|
7143
7237
|
Paint.compute('fill', this.__leaf);
|
|
7144
7238
|
if (stroke)
|
|
7145
7239
|
Paint.compute('stroke', this.__leaf);
|
|
7146
|
-
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
|
+
}
|
|
7147
7268
|
}
|
|
7148
7269
|
}
|
|
7149
7270
|
function setArray(data, key, value) {
|
|
@@ -7151,10 +7272,10 @@ var LeaferUI = (function (exports) {
|
|
|
7151
7272
|
if (value instanceof Array) {
|
|
7152
7273
|
if (value.some((item) => item.visible === false))
|
|
7153
7274
|
value = value.filter((item) => item.visible !== false);
|
|
7154
|
-
value.length || (value =
|
|
7275
|
+
value.length || (value = undefined);
|
|
7155
7276
|
}
|
|
7156
7277
|
else
|
|
7157
|
-
value = value && value.visible !== false ? [value] :
|
|
7278
|
+
value = value && value.visible !== false ? [value] : undefined;
|
|
7158
7279
|
data['_' + key] = value;
|
|
7159
7280
|
}
|
|
7160
7281
|
|
|
@@ -7257,8 +7378,6 @@ var LeaferUI = (function (exports) {
|
|
|
7257
7378
|
this._url = value;
|
|
7258
7379
|
}
|
|
7259
7380
|
__setImageFill(value) {
|
|
7260
|
-
if (this.__leaf.image)
|
|
7261
|
-
this.__leaf.image = null;
|
|
7262
7381
|
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
7263
7382
|
}
|
|
7264
7383
|
__getData() {
|
|
@@ -7324,21 +7443,19 @@ var LeaferUI = (function (exports) {
|
|
|
7324
7443
|
}
|
|
7325
7444
|
};
|
|
7326
7445
|
|
|
7446
|
+
const { stintSet: stintSet$1 } = DataHelper;
|
|
7327
7447
|
const UIRender = {
|
|
7328
7448
|
__updateChange() {
|
|
7329
|
-
const data = this.__
|
|
7449
|
+
const data = this.__;
|
|
7330
7450
|
if (data.__useEffect) {
|
|
7331
|
-
const { shadow,
|
|
7332
|
-
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);
|
|
7333
7454
|
}
|
|
7334
|
-
|
|
7335
|
-
|
|
7455
|
+
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7456
|
+
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7336
7457
|
data.__checkSingle();
|
|
7337
|
-
|
|
7338
|
-
if (complex)
|
|
7339
|
-
data.__complex = true;
|
|
7340
|
-
else
|
|
7341
|
-
data.__complex && (data.__complex = false);
|
|
7458
|
+
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7342
7459
|
},
|
|
7343
7460
|
__drawFast(canvas, options) {
|
|
7344
7461
|
drawFast(this, canvas, options);
|
|
@@ -7348,21 +7465,23 @@ var LeaferUI = (function (exports) {
|
|
|
7348
7465
|
if (data.__complex) {
|
|
7349
7466
|
if (data.__needComputePaint)
|
|
7350
7467
|
data.__computePaint();
|
|
7351
|
-
const { fill, stroke, __drawAfterFill } = data;
|
|
7468
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke, __isFastShadow } = data;
|
|
7352
7469
|
this.__drawRenderPath(canvas);
|
|
7353
|
-
if (data.__useEffect) {
|
|
7470
|
+
if (data.__useEffect && !__isFastShadow) {
|
|
7354
7471
|
const shape = Paint.shape(this, canvas, options);
|
|
7355
7472
|
this.__nowWorld = this.__getNowWorld(options);
|
|
7356
7473
|
const { shadow, innerShadow, filter } = data;
|
|
7357
7474
|
if (shadow)
|
|
7358
7475
|
Effect.shadow(this, canvas, shape);
|
|
7476
|
+
if (__fillAfterStroke)
|
|
7477
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7359
7478
|
if (fill)
|
|
7360
7479
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7361
7480
|
if (__drawAfterFill)
|
|
7362
7481
|
this.__drawAfterFill(canvas, options);
|
|
7363
7482
|
if (innerShadow)
|
|
7364
7483
|
Effect.innerShadow(this, canvas, shape);
|
|
7365
|
-
if (stroke)
|
|
7484
|
+
if (stroke && !__fillAfterStroke)
|
|
7366
7485
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7367
7486
|
if (filter)
|
|
7368
7487
|
Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
@@ -7371,21 +7490,27 @@ var LeaferUI = (function (exports) {
|
|
|
7371
7490
|
shape.canvas.recycle();
|
|
7372
7491
|
}
|
|
7373
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
|
+
}
|
|
7374
7499
|
if (fill)
|
|
7375
7500
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7501
|
+
if (__isFastShadow)
|
|
7502
|
+
canvas.restore();
|
|
7376
7503
|
if (__drawAfterFill)
|
|
7377
7504
|
this.__drawAfterFill(canvas, options);
|
|
7378
|
-
if (stroke)
|
|
7505
|
+
if (stroke && !__fillAfterStroke)
|
|
7379
7506
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7380
7507
|
}
|
|
7381
7508
|
}
|
|
7382
7509
|
else {
|
|
7383
|
-
if (data.__pathInputed)
|
|
7510
|
+
if (data.__pathInputed)
|
|
7384
7511
|
drawFast(this, canvas, options);
|
|
7385
|
-
|
|
7386
|
-
else {
|
|
7512
|
+
else
|
|
7387
7513
|
this.__drawFast(canvas, options);
|
|
7388
|
-
}
|
|
7389
7514
|
}
|
|
7390
7515
|
},
|
|
7391
7516
|
__renderShape(canvas, options, ignoreFill, ignoreStroke) {
|
|
@@ -7394,11 +7519,11 @@ var LeaferUI = (function (exports) {
|
|
|
7394
7519
|
const { fill, stroke } = this.__;
|
|
7395
7520
|
this.__drawRenderPath(canvas);
|
|
7396
7521
|
if (fill && !ignoreFill)
|
|
7397
|
-
this.__.
|
|
7522
|
+
this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7398
7523
|
if (this.__.__isCanvas)
|
|
7399
7524
|
this.__drawAfterFill(canvas, options);
|
|
7400
7525
|
if (stroke && !ignoreStroke)
|
|
7401
|
-
this.__.
|
|
7526
|
+
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7402
7527
|
}
|
|
7403
7528
|
},
|
|
7404
7529
|
__drawAfterFill(canvas, options) {
|
|
@@ -7413,13 +7538,15 @@ var LeaferUI = (function (exports) {
|
|
|
7413
7538
|
}
|
|
7414
7539
|
};
|
|
7415
7540
|
function drawFast(ui, canvas, options) {
|
|
7416
|
-
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
7541
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke } = ui.__;
|
|
7417
7542
|
ui.__drawRenderPath(canvas);
|
|
7543
|
+
if (__fillAfterStroke)
|
|
7544
|
+
Paint.stroke(stroke, ui, canvas);
|
|
7418
7545
|
if (fill)
|
|
7419
7546
|
Paint.fill(fill, ui, canvas);
|
|
7420
7547
|
if (__drawAfterFill)
|
|
7421
7548
|
ui.__drawAfterFill(canvas, options);
|
|
7422
|
-
if (stroke)
|
|
7549
|
+
if (stroke && !__fillAfterStroke)
|
|
7423
7550
|
Paint.stroke(stroke, ui, canvas);
|
|
7424
7551
|
}
|
|
7425
7552
|
|
|
@@ -7791,6 +7918,9 @@ var LeaferUI = (function (exports) {
|
|
|
7791
7918
|
__decorate([
|
|
7792
7919
|
surfaceType()
|
|
7793
7920
|
], exports.UI.prototype, "placeholderColor", void 0);
|
|
7921
|
+
__decorate([
|
|
7922
|
+
dataType(100)
|
|
7923
|
+
], exports.UI.prototype, "placeholderDelay", void 0);
|
|
7794
7924
|
__decorate([
|
|
7795
7925
|
dataType({})
|
|
7796
7926
|
], exports.UI.prototype, "data", void 0);
|
|
@@ -8192,15 +8322,20 @@ var LeaferUI = (function (exports) {
|
|
|
8192
8322
|
}
|
|
8193
8323
|
__listenEvents() {
|
|
8194
8324
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8195
|
-
this.once(
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
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
|
+
]));
|
|
8200
8336
|
}
|
|
8201
8337
|
__removeListenEvents() {
|
|
8202
8338
|
this.off_(this.__eventIds);
|
|
8203
|
-
this.__eventIds.length = 0;
|
|
8204
8339
|
}
|
|
8205
8340
|
destroy(sync) {
|
|
8206
8341
|
const doDestory = () => {
|
|
@@ -8308,13 +8443,13 @@ var LeaferUI = (function (exports) {
|
|
|
8308
8443
|
super.__updateRenderBounds();
|
|
8309
8444
|
copy$6(childrenRenderBounds, renderBounds);
|
|
8310
8445
|
this.__updateRectRenderBounds();
|
|
8311
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8446
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8312
8447
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8313
8448
|
add(renderBounds, childrenRenderBounds);
|
|
8314
8449
|
}
|
|
8315
8450
|
else
|
|
8316
8451
|
this.__updateRectRenderBounds();
|
|
8317
|
-
|
|
8452
|
+
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8318
8453
|
}
|
|
8319
8454
|
__updateRectRenderBounds() { }
|
|
8320
8455
|
__updateRectChange() { }
|
|
@@ -8618,18 +8753,10 @@ var LeaferUI = (function (exports) {
|
|
|
8618
8753
|
|
|
8619
8754
|
exports.Image = class Image extends exports.Rect {
|
|
8620
8755
|
get __tag() { return 'Image'; }
|
|
8621
|
-
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; }
|
|
8622
8758
|
constructor(data) {
|
|
8623
8759
|
super(data);
|
|
8624
|
-
this.on_(ImageEvent.LOADED, this.__onLoaded, this);
|
|
8625
|
-
}
|
|
8626
|
-
__onLoaded(e) {
|
|
8627
|
-
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8628
|
-
this.image = e.image;
|
|
8629
|
-
}
|
|
8630
|
-
destroy() {
|
|
8631
|
-
this.image = null;
|
|
8632
|
-
super.destroy();
|
|
8633
8760
|
}
|
|
8634
8761
|
};
|
|
8635
8762
|
__decorate([
|
|
@@ -8645,11 +8772,11 @@ var LeaferUI = (function (exports) {
|
|
|
8645
8772
|
|
|
8646
8773
|
exports.Canvas = class Canvas extends exports.Rect {
|
|
8647
8774
|
get __tag() { return 'Canvas'; }
|
|
8775
|
+
get context() { return this.canvas.context; }
|
|
8648
8776
|
get ready() { return !this.url; }
|
|
8649
8777
|
constructor(data) {
|
|
8650
8778
|
super(data);
|
|
8651
8779
|
this.canvas = Creator.canvas(this.__);
|
|
8652
|
-
this.context = this.canvas.context;
|
|
8653
8780
|
if (data && data.url)
|
|
8654
8781
|
this.drawImage(data.url);
|
|
8655
8782
|
}
|
|
@@ -8693,7 +8820,7 @@ var LeaferUI = (function (exports) {
|
|
|
8693
8820
|
destroy() {
|
|
8694
8821
|
if (this.canvas) {
|
|
8695
8822
|
this.canvas.destroy();
|
|
8696
|
-
this.canvas =
|
|
8823
|
+
this.canvas = null;
|
|
8697
8824
|
}
|
|
8698
8825
|
super.destroy();
|
|
8699
8826
|
}
|
|
@@ -8769,12 +8896,11 @@ var LeaferUI = (function (exports) {
|
|
|
8769
8896
|
super.__updateBoxBounds();
|
|
8770
8897
|
if (italic)
|
|
8771
8898
|
b.width += fontSize * 0.16;
|
|
8772
|
-
|
|
8773
|
-
if (isOverflow)
|
|
8899
|
+
DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds));
|
|
8900
|
+
if (this.isOverflow)
|
|
8774
8901
|
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8775
8902
|
else
|
|
8776
8903
|
data.__textBoxBounds = b;
|
|
8777
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8778
8904
|
}
|
|
8779
8905
|
__onUpdateSize() {
|
|
8780
8906
|
if (this.__box)
|
|
@@ -8975,7 +9101,7 @@ var LeaferUI = (function (exports) {
|
|
|
8975
9101
|
if (sky || editor)
|
|
8976
9102
|
this.sky = this.addLeafer(sky);
|
|
8977
9103
|
if (editor)
|
|
8978
|
-
|
|
9104
|
+
Creator.editor(editor, this);
|
|
8979
9105
|
}
|
|
8980
9106
|
}
|
|
8981
9107
|
__setApp() {
|
|
@@ -8989,6 +9115,10 @@ var LeaferUI = (function (exports) {
|
|
|
8989
9115
|
this.watcher.disable();
|
|
8990
9116
|
this.layouter.disable();
|
|
8991
9117
|
}
|
|
9118
|
+
__updateLocalBounds() {
|
|
9119
|
+
this.forEach(leafer => leafer.updateLayout());
|
|
9120
|
+
super.__updateLocalBounds();
|
|
9121
|
+
}
|
|
8992
9122
|
start() {
|
|
8993
9123
|
super.start();
|
|
8994
9124
|
this.forEach(leafer => leafer.start());
|
|
@@ -9046,12 +9176,8 @@ var LeaferUI = (function (exports) {
|
|
|
9046
9176
|
this.renderer.update();
|
|
9047
9177
|
}
|
|
9048
9178
|
__render(canvas, options) {
|
|
9049
|
-
if (canvas.context)
|
|
9050
|
-
|
|
9051
|
-
if (m)
|
|
9052
|
-
canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
9053
|
-
this.forEach(leafer => canvas.copyWorld(leafer.canvas));
|
|
9054
|
-
}
|
|
9179
|
+
if (canvas.context)
|
|
9180
|
+
this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
|
|
9055
9181
|
}
|
|
9056
9182
|
__onResize(event) {
|
|
9057
9183
|
this.forEach(leafer => leafer.resize(event));
|
|
@@ -9072,9 +9198,11 @@ var LeaferUI = (function (exports) {
|
|
|
9072
9198
|
return config;
|
|
9073
9199
|
}
|
|
9074
9200
|
__listenChildEvents(leafer) {
|
|
9075
|
-
leafer.once(
|
|
9076
|
-
|
|
9077
|
-
|
|
9201
|
+
leafer.once([
|
|
9202
|
+
[LayoutEvent.END, this.__onReady, this],
|
|
9203
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
9204
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
9205
|
+
]);
|
|
9078
9206
|
if (this.realCanvas)
|
|
9079
9207
|
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9080
9208
|
}
|
|
@@ -9285,7 +9413,7 @@ var LeaferUI = (function (exports) {
|
|
|
9285
9413
|
registerUIEvent()
|
|
9286
9414
|
], exports.MoveEvent);
|
|
9287
9415
|
|
|
9288
|
-
exports.RotateEvent = class RotateEvent extends
|
|
9416
|
+
exports.RotateEvent = class RotateEvent extends exports.PointerEvent {
|
|
9289
9417
|
};
|
|
9290
9418
|
exports.RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
|
|
9291
9419
|
exports.RotateEvent.START = 'rotate.start';
|
|
@@ -9306,7 +9434,7 @@ var LeaferUI = (function (exports) {
|
|
|
9306
9434
|
registerUIEvent()
|
|
9307
9435
|
], exports.SwipeEvent);
|
|
9308
9436
|
|
|
9309
|
-
exports.ZoomEvent = class ZoomEvent extends
|
|
9437
|
+
exports.ZoomEvent = class ZoomEvent extends exports.PointerEvent {
|
|
9310
9438
|
};
|
|
9311
9439
|
exports.ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
|
|
9312
9440
|
exports.ZoomEvent.START = 'zoom.start';
|
|
@@ -10149,8 +10277,8 @@ var LeaferUI = (function (exports) {
|
|
|
10149
10277
|
if (this.__box)
|
|
10150
10278
|
this.__box.__updateHitCanvas();
|
|
10151
10279
|
const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
|
|
10152
|
-
const isHitPixelFill = (data.
|
|
10153
|
-
const isHitPixelStroke = data.
|
|
10280
|
+
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
10281
|
+
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
10154
10282
|
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
10155
10283
|
if (!this.__hitCanvas)
|
|
10156
10284
|
this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
|
|
@@ -10181,11 +10309,11 @@ var LeaferUI = (function (exports) {
|
|
|
10181
10309
|
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
10182
10310
|
return true;
|
|
10183
10311
|
const { hitFill } = data;
|
|
10184
|
-
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.
|
|
10312
|
+
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
10185
10313
|
if (needHitFillPath && this.__hitFill(inner))
|
|
10186
10314
|
return true;
|
|
10187
10315
|
const { hitStroke, __strokeWidth } = data;
|
|
10188
|
-
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.
|
|
10316
|
+
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
10189
10317
|
if (!needHitFillPath && !needHitStrokePath)
|
|
10190
10318
|
return false;
|
|
10191
10319
|
const radiusWidth = inner.radiusX * 2;
|
|
@@ -10326,31 +10454,31 @@ var LeaferUI = (function (exports) {
|
|
|
10326
10454
|
}
|
|
10327
10455
|
|
|
10328
10456
|
function strokeText(stroke, ui, canvas) {
|
|
10329
|
-
|
|
10330
|
-
const isStrokes = typeof stroke !== 'string';
|
|
10331
|
-
switch (strokeAlign) {
|
|
10457
|
+
switch (ui.__.strokeAlign) {
|
|
10332
10458
|
case 'center':
|
|
10333
|
-
|
|
10334
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
10459
|
+
drawCenter$1(stroke, 1, ui, canvas);
|
|
10335
10460
|
break;
|
|
10336
10461
|
case 'inside':
|
|
10337
|
-
|
|
10462
|
+
drawAlign(stroke, 'inside', ui, canvas);
|
|
10338
10463
|
break;
|
|
10339
10464
|
case 'outside':
|
|
10340
|
-
|
|
10465
|
+
ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, 'outside', ui, canvas);
|
|
10341
10466
|
break;
|
|
10342
10467
|
}
|
|
10343
10468
|
}
|
|
10344
|
-
function
|
|
10345
|
-
const
|
|
10469
|
+
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
10470
|
+
const data = ui.__;
|
|
10471
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
|
|
10472
|
+
data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
10473
|
+
}
|
|
10474
|
+
function drawAlign(stroke, align, ui, canvas) {
|
|
10346
10475
|
const out = canvas.getSameCanvas(true, true);
|
|
10347
|
-
out.
|
|
10348
|
-
|
|
10349
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
|
|
10476
|
+
out.font = ui.__.__font;
|
|
10477
|
+
drawCenter$1(stroke, 2, ui, out);
|
|
10350
10478
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10351
10479
|
fillText(ui, out);
|
|
10352
10480
|
out.blendMode = 'normal';
|
|
10353
|
-
if (ui.__worldFlipped)
|
|
10481
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
10354
10482
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10355
10483
|
else
|
|
10356
10484
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
@@ -10392,90 +10520,60 @@ var LeaferUI = (function (exports) {
|
|
|
10392
10520
|
}
|
|
10393
10521
|
|
|
10394
10522
|
function stroke(stroke, ui, canvas) {
|
|
10395
|
-
const
|
|
10396
|
-
|
|
10397
|
-
if (!__strokeWidth)
|
|
10523
|
+
const data = ui.__;
|
|
10524
|
+
if (!data.__strokeWidth)
|
|
10398
10525
|
return;
|
|
10399
|
-
if (__font) {
|
|
10526
|
+
if (data.__font) {
|
|
10400
10527
|
strokeText(stroke, ui, canvas);
|
|
10401
10528
|
}
|
|
10402
10529
|
else {
|
|
10403
|
-
switch (strokeAlign) {
|
|
10530
|
+
switch (data.strokeAlign) {
|
|
10404
10531
|
case 'center':
|
|
10405
|
-
|
|
10406
|
-
canvas.stroke();
|
|
10407
|
-
if (options.__useArrow)
|
|
10408
|
-
strokeArrow(ui, canvas);
|
|
10532
|
+
drawCenter(stroke, 1, ui, canvas);
|
|
10409
10533
|
break;
|
|
10410
10534
|
case 'inside':
|
|
10411
|
-
canvas
|
|
10412
|
-
canvas.setStroke(stroke, __strokeWidth * 2, options);
|
|
10413
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
10414
|
-
canvas.stroke();
|
|
10415
|
-
canvas.restore();
|
|
10535
|
+
drawInside(stroke, ui, canvas);
|
|
10416
10536
|
break;
|
|
10417
10537
|
case 'outside':
|
|
10418
|
-
|
|
10419
|
-
out.setStroke(stroke, __strokeWidth * 2, options);
|
|
10420
|
-
ui.__drawRenderPath(out);
|
|
10421
|
-
out.stroke();
|
|
10422
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10423
|
-
out.clearWorld(ui.__layout.renderBounds);
|
|
10424
|
-
if (ui.__worldFlipped)
|
|
10425
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10426
|
-
else
|
|
10427
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10428
|
-
out.recycle(ui.__nowWorld);
|
|
10538
|
+
drawOutside(stroke, ui, canvas);
|
|
10429
10539
|
break;
|
|
10430
10540
|
}
|
|
10431
10541
|
}
|
|
10432
10542
|
}
|
|
10433
10543
|
function strokes(strokes, ui, canvas) {
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
|
|
10439
|
-
|
|
10544
|
+
stroke(strokes, ui, canvas);
|
|
10545
|
+
}
|
|
10546
|
+
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
10547
|
+
const data = ui.__;
|
|
10548
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
10549
|
+
data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
|
|
10550
|
+
if (data.__useArrow)
|
|
10551
|
+
Paint.strokeArrow(stroke, ui, canvas);
|
|
10552
|
+
}
|
|
10553
|
+
function drawInside(stroke, ui, canvas) {
|
|
10554
|
+
const data = ui.__;
|
|
10555
|
+
canvas.save();
|
|
10556
|
+
data.windingRule ? canvas.clip(data.windingRule) : canvas.clip();
|
|
10557
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
10558
|
+
canvas.restore();
|
|
10559
|
+
}
|
|
10560
|
+
function drawOutside(stroke, ui, canvas) {
|
|
10561
|
+
const data = ui.__;
|
|
10562
|
+
if (data.__fillAfterStroke) {
|
|
10563
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
10440
10564
|
}
|
|
10441
10565
|
else {
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
drawStrokesStyle(strokes, false, ui, canvas);
|
|
10454
|
-
canvas.restore();
|
|
10455
|
-
break;
|
|
10456
|
-
case 'outside':
|
|
10457
|
-
const { renderBounds } = ui.__layout;
|
|
10458
|
-
const out = canvas.getSameCanvas(true, true);
|
|
10459
|
-
ui.__drawRenderPath(out);
|
|
10460
|
-
out.setStroke(undefined, __strokeWidth * 2, options);
|
|
10461
|
-
drawStrokesStyle(strokes, false, ui, out);
|
|
10462
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10463
|
-
out.clearWorld(renderBounds);
|
|
10464
|
-
if (ui.__worldFlipped)
|
|
10465
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10466
|
-
else
|
|
10467
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
10468
|
-
out.recycle(ui.__nowWorld);
|
|
10469
|
-
break;
|
|
10470
|
-
}
|
|
10471
|
-
}
|
|
10472
|
-
}
|
|
10473
|
-
function strokeArrow(ui, canvas) {
|
|
10474
|
-
if (ui.__.dashPattern) {
|
|
10475
|
-
canvas.beginPath();
|
|
10476
|
-
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
10477
|
-
canvas.dashPattern = null;
|
|
10478
|
-
canvas.stroke();
|
|
10566
|
+
const { renderBounds } = ui.__layout;
|
|
10567
|
+
const out = canvas.getSameCanvas(true, true);
|
|
10568
|
+
ui.__drawRenderPath(out);
|
|
10569
|
+
drawCenter(stroke, 2, ui, out);
|
|
10570
|
+
data.windingRule ? out.clip(data.windingRule) : out.clip();
|
|
10571
|
+
out.clearWorld(renderBounds);
|
|
10572
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
10573
|
+
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10574
|
+
else
|
|
10575
|
+
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
10576
|
+
out.recycle(ui.__nowWorld);
|
|
10479
10577
|
}
|
|
10480
10578
|
}
|
|
10481
10579
|
|
|
@@ -10522,9 +10620,10 @@ var LeaferUI = (function (exports) {
|
|
|
10522
10620
|
}
|
|
10523
10621
|
|
|
10524
10622
|
let recycleMap;
|
|
10623
|
+
const { stintSet } = DataHelper, { hasTransparent: hasTransparent$1 } = ColorConvert;
|
|
10525
10624
|
function compute(attrName, ui) {
|
|
10526
10625
|
const data = ui.__, leafPaints = [];
|
|
10527
|
-
let paints = data.__input[attrName],
|
|
10626
|
+
let paints = data.__input[attrName], isAlphaPixel, isTransparent;
|
|
10528
10627
|
if (!(paints instanceof Array))
|
|
10529
10628
|
paints = [paints];
|
|
10530
10629
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
@@ -10534,29 +10633,55 @@ var LeaferUI = (function (exports) {
|
|
|
10534
10633
|
leafPaints.push(item);
|
|
10535
10634
|
}
|
|
10536
10635
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
10537
|
-
if (leafPaints.length
|
|
10538
|
-
|
|
10539
|
-
|
|
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
|
+
}
|
|
10540
10651
|
}
|
|
10541
10652
|
function getLeafPaint(attrName, paint, ui) {
|
|
10542
10653
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
|
10543
10654
|
return undefined;
|
|
10655
|
+
let data;
|
|
10544
10656
|
const { boxBounds } = ui.__layout;
|
|
10545
10657
|
switch (paint.type) {
|
|
10546
|
-
case 'solid':
|
|
10547
|
-
let { type, blendMode, color, opacity } = paint;
|
|
10548
|
-
return { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
10549
10658
|
case 'image':
|
|
10550
|
-
|
|
10659
|
+
data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
10660
|
+
break;
|
|
10551
10661
|
case 'linear':
|
|
10552
|
-
|
|
10662
|
+
data = PaintGradient.linearGradient(paint, boxBounds);
|
|
10663
|
+
break;
|
|
10553
10664
|
case 'radial':
|
|
10554
|
-
|
|
10665
|
+
data = PaintGradient.radialGradient(paint, boxBounds);
|
|
10666
|
+
break;
|
|
10555
10667
|
case 'angular':
|
|
10556
|
-
|
|
10668
|
+
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
10669
|
+
break;
|
|
10670
|
+
case 'solid':
|
|
10671
|
+
const { type, blendMode, color, opacity } = paint;
|
|
10672
|
+
data = { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
10673
|
+
break;
|
|
10557
10674
|
default:
|
|
10558
|
-
|
|
10675
|
+
if (paint.r !== undefined)
|
|
10676
|
+
data = { type: 'solid', style: ColorConvert.string(paint) };
|
|
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;
|
|
10559
10683
|
}
|
|
10684
|
+
return data;
|
|
10560
10685
|
}
|
|
10561
10686
|
|
|
10562
10687
|
const PaintModule = {
|
|
@@ -10622,12 +10747,10 @@ var LeaferUI = (function (exports) {
|
|
|
10622
10747
|
|
|
10623
10748
|
const { get: get$2, translate } = MatrixHelper;
|
|
10624
10749
|
const tempBox = new Bounds();
|
|
10625
|
-
const tempPoint$1 = {};
|
|
10626
10750
|
const tempScaleData = {};
|
|
10751
|
+
const tempImage = {};
|
|
10627
10752
|
function createData(leafPaint, image, paint, box) {
|
|
10628
|
-
const {
|
|
10629
|
-
if (blendMode)
|
|
10630
|
-
leafPaint.blendMode = blendMode;
|
|
10753
|
+
const { changeful, sync } = paint;
|
|
10631
10754
|
if (changeful)
|
|
10632
10755
|
leafPaint.changeful = changeful;
|
|
10633
10756
|
if (sync)
|
|
@@ -10635,38 +10758,38 @@ var LeaferUI = (function (exports) {
|
|
|
10635
10758
|
leafPaint.data = getPatternData(paint, box, image);
|
|
10636
10759
|
}
|
|
10637
10760
|
function getPatternData(paint, box, image) {
|
|
10638
|
-
let { width, height } = image;
|
|
10639
10761
|
if (paint.padding)
|
|
10640
10762
|
box = tempBox.set(box).shrink(paint.padding);
|
|
10641
10763
|
if (paint.mode === 'strench')
|
|
10642
10764
|
paint.mode = 'stretch';
|
|
10765
|
+
let { width, height } = image;
|
|
10643
10766
|
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
10644
10767
|
const sameBox = box.width === width && box.height === height;
|
|
10645
10768
|
const data = { mode };
|
|
10646
10769
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
10647
|
-
|
|
10648
|
-
let
|
|
10770
|
+
BoundsHelper.set(tempImage, 0, 0, swapSize ? height : width, swapSize ? width : height);
|
|
10771
|
+
let scaleX, scaleY;
|
|
10649
10772
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
10650
10773
|
if (!sameBox || rotation) {
|
|
10651
|
-
|
|
10652
|
-
|
|
10653
|
-
|
|
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);
|
|
10654
10777
|
}
|
|
10655
10778
|
}
|
|
10656
|
-
else
|
|
10657
|
-
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10662
|
-
|
|
10663
|
-
|
|
10664
|
-
|
|
10665
|
-
|
|
10666
|
-
|
|
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
|
+
}
|
|
10667
10790
|
}
|
|
10668
10791
|
if (offset)
|
|
10669
|
-
|
|
10792
|
+
PointHelper.move(tempImage, offset);
|
|
10670
10793
|
switch (mode) {
|
|
10671
10794
|
case 'stretch':
|
|
10672
10795
|
if (!sameBox)
|
|
@@ -10674,12 +10797,12 @@ var LeaferUI = (function (exports) {
|
|
|
10674
10797
|
break;
|
|
10675
10798
|
case 'normal':
|
|
10676
10799
|
case 'clip':
|
|
10677
|
-
if (x || y || scaleX || rotation)
|
|
10678
|
-
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);
|
|
10679
10802
|
break;
|
|
10680
10803
|
case 'repeat':
|
|
10681
10804
|
if (!sameBox || scaleX || rotation)
|
|
10682
|
-
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);
|
|
10683
10806
|
if (!repeat)
|
|
10684
10807
|
data.repeat = 'repeat';
|
|
10685
10808
|
break;
|
|
@@ -10687,7 +10810,7 @@ var LeaferUI = (function (exports) {
|
|
|
10687
10810
|
case 'cover':
|
|
10688
10811
|
default:
|
|
10689
10812
|
if (scaleX)
|
|
10690
|
-
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
10813
|
+
fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
10691
10814
|
}
|
|
10692
10815
|
if (!data.transform) {
|
|
10693
10816
|
if (box.x || box.y) {
|
|
@@ -10720,6 +10843,8 @@ var LeaferUI = (function (exports) {
|
|
|
10720
10843
|
}
|
|
10721
10844
|
else {
|
|
10722
10845
|
leafPaint = { type: paint.type, image };
|
|
10846
|
+
if (image.hasAlphaPixel)
|
|
10847
|
+
leafPaint.isTransparent = true;
|
|
10723
10848
|
cache$1 = image.use > 1 ? { leafPaint, paint, boxBounds: box$1.set(boxBounds) } : null;
|
|
10724
10849
|
}
|
|
10725
10850
|
if (firstUse || image.loading)
|
|
@@ -10744,7 +10869,7 @@ var LeaferUI = (function (exports) {
|
|
|
10744
10869
|
ignoreRender(ui, false);
|
|
10745
10870
|
if (!ui.destroyed) {
|
|
10746
10871
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
10747
|
-
if (image.
|
|
10872
|
+
if (image.hasAlphaPixel)
|
|
10748
10873
|
ui.__layout.hitCanvasChanged = true;
|
|
10749
10874
|
ui.forceUpdate('surface');
|
|
10750
10875
|
}
|
|
@@ -10756,13 +10881,17 @@ var LeaferUI = (function (exports) {
|
|
|
10756
10881
|
onLoadError(ui, event, error);
|
|
10757
10882
|
leafPaint.loadId = null;
|
|
10758
10883
|
});
|
|
10759
|
-
if (ui.placeholderColor)
|
|
10760
|
-
|
|
10761
|
-
|
|
10762
|
-
|
|
10763
|
-
|
|
10764
|
-
|
|
10765
|
-
|
|
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
|
+
}
|
|
10766
10895
|
}
|
|
10767
10896
|
return leafPaint;
|
|
10768
10897
|
}
|
|
@@ -10968,32 +11097,33 @@ var LeaferUI = (function (exports) {
|
|
|
10968
11097
|
repeatMode
|
|
10969
11098
|
};
|
|
10970
11099
|
|
|
10971
|
-
const { toPoint: toPoint$3 } = AroundHelper;
|
|
11100
|
+
const { toPoint: toPoint$3 } = AroundHelper, { hasTransparent } = ColorConvert;
|
|
10972
11101
|
const realFrom$2 = {};
|
|
10973
11102
|
const realTo$2 = {};
|
|
10974
11103
|
function linearGradient(paint, box) {
|
|
10975
|
-
let { from, to, type,
|
|
11104
|
+
let { from, to, type, opacity } = paint;
|
|
10976
11105
|
toPoint$3(from || 'top', box, realFrom$2);
|
|
10977
11106
|
toPoint$3(to || 'bottom', box, realTo$2);
|
|
10978
11107
|
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
10979
|
-
applyStops(style, paint.stops, opacity);
|
|
10980
11108
|
const data = { type, style };
|
|
10981
|
-
|
|
10982
|
-
data.blendMode = blendMode;
|
|
11109
|
+
applyStops(data, style, paint.stops, opacity);
|
|
10983
11110
|
return data;
|
|
10984
11111
|
}
|
|
10985
|
-
function applyStops(gradient, stops, opacity) {
|
|
11112
|
+
function applyStops(data, gradient, stops, opacity) {
|
|
10986
11113
|
if (stops) {
|
|
10987
|
-
let stop;
|
|
11114
|
+
let stop, color, offset, isTransparent;
|
|
10988
11115
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
10989
11116
|
stop = stops[i];
|
|
10990
|
-
if (typeof stop === 'string')
|
|
10991
|
-
|
|
10992
|
-
|
|
10993
|
-
|
|
10994
|
-
|
|
10995
|
-
|
|
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;
|
|
10996
11124
|
}
|
|
11125
|
+
if (isTransparent)
|
|
11126
|
+
data.isTransparent = true;
|
|
10997
11127
|
}
|
|
10998
11128
|
}
|
|
10999
11129
|
|
|
@@ -11003,17 +11133,15 @@ var LeaferUI = (function (exports) {
|
|
|
11003
11133
|
const realFrom$1 = {};
|
|
11004
11134
|
const realTo$1 = {};
|
|
11005
11135
|
function radialGradient(paint, box) {
|
|
11006
|
-
let { from, to, type, opacity,
|
|
11136
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
11007
11137
|
toPoint$2(from || 'center', box, realFrom$1);
|
|
11008
11138
|
toPoint$2(to || 'bottom', box, realTo$1);
|
|
11009
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));
|
|
11010
|
-
applyStops(style, paint.stops, opacity);
|
|
11011
11140
|
const data = { type, style };
|
|
11141
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11012
11142
|
const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
|
|
11013
11143
|
if (transform)
|
|
11014
11144
|
data.transform = transform;
|
|
11015
|
-
if (blendMode)
|
|
11016
|
-
data.blendMode = blendMode;
|
|
11017
11145
|
return data;
|
|
11018
11146
|
}
|
|
11019
11147
|
function getTransform(box, from, to, stretch, rotate90) {
|
|
@@ -11039,17 +11167,15 @@ var LeaferUI = (function (exports) {
|
|
|
11039
11167
|
const realFrom = {};
|
|
11040
11168
|
const realTo = {};
|
|
11041
11169
|
function conicGradient(paint, box) {
|
|
11042
|
-
let { from, to, type, opacity,
|
|
11170
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
11043
11171
|
toPoint$1(from || 'center', box, realFrom);
|
|
11044
11172
|
toPoint$1(to || 'bottom', box, realTo);
|
|
11045
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));
|
|
11046
|
-
applyStops(style, paint.stops, opacity);
|
|
11047
11174
|
const data = { type, style };
|
|
11175
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11048
11176
|
const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
|
|
11049
11177
|
if (transform)
|
|
11050
11178
|
data.transform = transform;
|
|
11051
|
-
if (blendMode)
|
|
11052
|
-
data.blendMode = blendMode;
|
|
11053
11179
|
return data;
|
|
11054
11180
|
}
|
|
11055
11181
|
|
|
@@ -11382,6 +11508,8 @@ var LeaferUI = (function (exports) {
|
|
|
11382
11508
|
lastCharType = null;
|
|
11383
11509
|
startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
|
|
11384
11510
|
word = { data: [] }, row = { words: [] };
|
|
11511
|
+
if (__letterSpacing)
|
|
11512
|
+
content = [...content];
|
|
11385
11513
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
11386
11514
|
char = content[i];
|
|
11387
11515
|
if (char === '\n') {
|
|
@@ -12228,24 +12356,25 @@ var LeaferUI = (function (exports) {
|
|
|
12228
12356
|
const { app } = editor;
|
|
12229
12357
|
app.selector.proxy = editor;
|
|
12230
12358
|
this.__eventIds = [
|
|
12231
|
-
editor.on_(
|
|
12232
|
-
|
|
12233
|
-
|
|
12234
|
-
|
|
12235
|
-
app.on_(
|
|
12236
|
-
|
|
12237
|
-
|
|
12238
|
-
|
|
12239
|
-
|
|
12240
|
-
|
|
12359
|
+
editor.on_([
|
|
12360
|
+
[EditorEvent.HOVER, this.onHover, this],
|
|
12361
|
+
[EditorEvent.SELECT, this.onSelect, this]
|
|
12362
|
+
]),
|
|
12363
|
+
app.on_([
|
|
12364
|
+
[exports.PointerEvent.MOVE, this.onPointerMove, this],
|
|
12365
|
+
[exports.PointerEvent.BEFORE_DOWN, this.onBeforeDown, this],
|
|
12366
|
+
[exports.PointerEvent.TAP, this.onTap, this],
|
|
12367
|
+
[exports.DragEvent.START, this.onDragStart, this, true],
|
|
12368
|
+
[exports.DragEvent.DRAG, this.onDrag, this],
|
|
12369
|
+
[exports.DragEvent.END, this.onDragEnd, this],
|
|
12370
|
+
[exports.MoveEvent.MOVE, this.onAutoMove, this],
|
|
12371
|
+
[[exports.ZoomEvent.ZOOM, exports.MoveEvent.MOVE], () => { this.editor.hoverTarget = null; }],
|
|
12372
|
+
])
|
|
12241
12373
|
];
|
|
12242
12374
|
});
|
|
12243
12375
|
}
|
|
12244
12376
|
__removeListenEvents() {
|
|
12245
|
-
|
|
12246
|
-
this.off_(this.__eventIds);
|
|
12247
|
-
this.__eventIds.length = 0;
|
|
12248
|
-
}
|
|
12377
|
+
this.off_(this.__eventIds);
|
|
12249
12378
|
}
|
|
12250
12379
|
destroy() {
|
|
12251
12380
|
this.editor = this.originList = this.needRemoveItem = null;
|
|
@@ -12534,6 +12663,10 @@ var LeaferUI = (function (exports) {
|
|
|
12534
12663
|
}
|
|
12535
12664
|
|
|
12536
12665
|
class EditPoint extends exports.Box {
|
|
12666
|
+
constructor(data) {
|
|
12667
|
+
super(data);
|
|
12668
|
+
this.useFastShadow = true;
|
|
12669
|
+
}
|
|
12537
12670
|
}
|
|
12538
12671
|
|
|
12539
12672
|
const fourDirection = ['top', 'right', 'bottom', 'left'], editConfig = undefined;
|
|
@@ -12804,28 +12937,29 @@ var LeaferUI = (function (exports) {
|
|
|
12804
12937
|
const { editor } = this;
|
|
12805
12938
|
point.direction = direction;
|
|
12806
12939
|
point.pointType = type;
|
|
12807
|
-
|
|
12808
|
-
|
|
12809
|
-
|
|
12810
|
-
|
|
12940
|
+
const events = [
|
|
12941
|
+
[exports.DragEvent.START, this.onDragStart, this],
|
|
12942
|
+
[exports.DragEvent.DRAG, this.onDrag, this],
|
|
12943
|
+
[exports.DragEvent.END, this.onDragEnd, this],
|
|
12944
|
+
[exports.PointerEvent.LEAVE, () => { this.enterPoint = null; }],
|
|
12945
|
+
];
|
|
12811
12946
|
if (point.name !== 'circle')
|
|
12812
|
-
|
|
12947
|
+
events.push([exports.PointerEvent.ENTER, (e) => { this.enterPoint = point, updateCursor(editor, e); }]);
|
|
12948
|
+
this.__eventIds.push(point.on_(events));
|
|
12813
12949
|
}
|
|
12814
12950
|
__listenEvents() {
|
|
12815
12951
|
const { rect, editor } = this;
|
|
12816
|
-
this.__eventIds
|
|
12817
|
-
|
|
12818
|
-
|
|
12819
|
-
|
|
12820
|
-
|
|
12821
|
-
|
|
12822
|
-
|
|
12823
|
-
|
|
12824
|
-
];
|
|
12952
|
+
this.__eventIds.push(editor.on_(EditorEvent.SELECT, this.onSelect, this), rect.on_([
|
|
12953
|
+
[exports.DragEvent.START, this.onDragStart, this],
|
|
12954
|
+
[exports.DragEvent.DRAG, editor.onMove, editor],
|
|
12955
|
+
[exports.DragEvent.END, this.onDragEnd, this],
|
|
12956
|
+
[exports.PointerEvent.ENTER, () => updateMoveCursor(editor)],
|
|
12957
|
+
[exports.PointerEvent.DOUBLE_TAP, this.onDoubleTap, this],
|
|
12958
|
+
[exports.PointerEvent.LONG_PRESS, this.onLongPress, this]
|
|
12959
|
+
]));
|
|
12825
12960
|
}
|
|
12826
12961
|
__removeListenEvents() {
|
|
12827
12962
|
this.off_(this.__eventIds);
|
|
12828
|
-
this.__eventIds.length = 0;
|
|
12829
12963
|
}
|
|
12830
12964
|
destroy() {
|
|
12831
12965
|
this.editor = null;
|
|
@@ -13567,12 +13701,14 @@ ${filterStyle$1}
|
|
|
13567
13701
|
const { app, leafer, editBox, editMask } = this;
|
|
13568
13702
|
this.targetEventIds = [
|
|
13569
13703
|
leafer.on_(RenderEvent.START, this.onRenderStart, this),
|
|
13570
|
-
app.on_(
|
|
13571
|
-
|
|
13572
|
-
|
|
13573
|
-
|
|
13574
|
-
|
|
13575
|
-
|
|
13704
|
+
app.on_([
|
|
13705
|
+
[RenderEvent.CHILD_START, this.onAppRenderStart, this],
|
|
13706
|
+
[exports.MoveEvent.BEFORE_MOVE, this.onMove, this, true],
|
|
13707
|
+
[exports.ZoomEvent.BEFORE_ZOOM, this.onScale, this, true],
|
|
13708
|
+
[exports.RotateEvent.BEFORE_ROTATE, this.onRotate, this, true],
|
|
13709
|
+
[[exports.KeyEvent.HOLD, exports.KeyEvent.UP], this.onKey, this],
|
|
13710
|
+
[exports.KeyEvent.DOWN, editBox.onArrow, editBox]
|
|
13711
|
+
])
|
|
13576
13712
|
];
|
|
13577
13713
|
if (editMask.visible)
|
|
13578
13714
|
editMask.forceRender();
|
|
@@ -13582,7 +13718,6 @@ ${filterStyle$1}
|
|
|
13582
13718
|
const { targetEventIds, editMask } = this;
|
|
13583
13719
|
if (targetEventIds.length) {
|
|
13584
13720
|
this.off_(targetEventIds);
|
|
13585
|
-
targetEventIds.length = 0;
|
|
13586
13721
|
if (editMask.visible)
|
|
13587
13722
|
editMask.forceRender();
|
|
13588
13723
|
}
|
|
@@ -14051,7 +14186,12 @@ ${filterStyle$1}
|
|
|
14051
14186
|
Plugin.add('resize');
|
|
14052
14187
|
|
|
14053
14188
|
Plugin.add('editor', 'resize');
|
|
14054
|
-
Creator.editor = function (options) {
|
|
14189
|
+
Creator.editor = function (options, app) {
|
|
14190
|
+
const editor = new Editor(options);
|
|
14191
|
+
if (app)
|
|
14192
|
+
app.sky.add(app.editor = editor);
|
|
14193
|
+
return editor;
|
|
14194
|
+
};
|
|
14055
14195
|
exports.Box.addAttr('textBox', false, dataType);
|
|
14056
14196
|
exports.UI.addAttr('editConfig', undefined, dataType);
|
|
14057
14197
|
exports.UI.addAttr('editOuter', (ui) => ui.__.__isLinePath ? 'LineEditTool' : 'EditTool', dataType);
|
|
@@ -14236,31 +14376,31 @@ ${filterStyle$1}
|
|
|
14236
14376
|
textScale *= 12 / text.fontSize;
|
|
14237
14377
|
}
|
|
14238
14378
|
this.textScale = textScale;
|
|
14239
|
-
const { a, b, c, d, e, f } = new Matrix(text.worldTransform).scale(1 / textScale);
|
|
14240
14379
|
let { x, y } = this.inBody ? text.app.clientBounds : text.app.tree.clientBounds;
|
|
14241
14380
|
if (!this.inBody)
|
|
14242
14381
|
x -= window.scrollX, y -= window.scrollY;
|
|
14243
|
-
let { width, height } = text;
|
|
14382
|
+
let { width, height } = text, offsetX = 0, offsetY = 0;
|
|
14244
14383
|
width *= textScale, height *= textScale;
|
|
14245
14384
|
const data = text.__;
|
|
14246
14385
|
if (data.__autoWidth && data.autoSizeAlign) {
|
|
14247
14386
|
width += 20;
|
|
14248
14387
|
switch (data.textAlign) {
|
|
14249
14388
|
case 'center':
|
|
14250
|
-
|
|
14389
|
+
offsetX = -width / 2;
|
|
14251
14390
|
break;
|
|
14252
|
-
case 'right':
|
|
14391
|
+
case 'right': offsetX = -width;
|
|
14253
14392
|
}
|
|
14254
14393
|
}
|
|
14255
14394
|
if (data.__autoHeight && data.autoSizeAlign) {
|
|
14256
14395
|
height += 20;
|
|
14257
14396
|
switch (data.verticalAlign) {
|
|
14258
14397
|
case 'middle':
|
|
14259
|
-
|
|
14398
|
+
offsetY = -height / 2;
|
|
14260
14399
|
break;
|
|
14261
|
-
case 'bottom':
|
|
14400
|
+
case 'bottom': offsetY = -height;
|
|
14262
14401
|
}
|
|
14263
14402
|
}
|
|
14403
|
+
const { a, b, c, d, e, f } = new Matrix(text.worldTransform).scale(1 / textScale).translateInner(offsetX, offsetY);
|
|
14264
14404
|
const { style } = this.editDom;
|
|
14265
14405
|
style.transform = `matrix(${a},${b},${c},${d},${e},${f})`;
|
|
14266
14406
|
style.left = x + 'px';
|
|
@@ -14587,6 +14727,7 @@ ${filterStyle$1}
|
|
|
14587
14727
|
return;
|
|
14588
14728
|
const { move, rotation, scale, center } = MultiTouchHelper.getData(list);
|
|
14589
14729
|
Object.assign(data, center);
|
|
14730
|
+
data.multiTouch = true;
|
|
14590
14731
|
this.pointerWaitCancel();
|
|
14591
14732
|
this.rotate(getRotateEventData(rotation, data));
|
|
14592
14733
|
this.zoom(getZoomEventData(scale, data));
|
|
@@ -15188,6 +15329,16 @@ ${filterStyle$1}
|
|
|
15188
15329
|
exports.UI.addAttr('startArrow', 'none', arrowType);
|
|
15189
15330
|
exports.UI.addAttr('endArrow', 'none', arrowType);
|
|
15190
15331
|
Object.assign(PathArrow, PathArrowModule);
|
|
15332
|
+
Object.assign(Paint, {
|
|
15333
|
+
strokeArrow(_stroke, ui, canvas) {
|
|
15334
|
+
if (ui.__.dashPattern) {
|
|
15335
|
+
canvas.beginPath();
|
|
15336
|
+
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
15337
|
+
canvas.dashPattern = null;
|
|
15338
|
+
canvas.stroke();
|
|
15339
|
+
}
|
|
15340
|
+
}
|
|
15341
|
+
});
|
|
15191
15342
|
|
|
15192
15343
|
class FlowData extends BoxData {
|
|
15193
15344
|
}
|
|
@@ -17801,10 +17952,9 @@ ${filterStyle$1}
|
|
|
17801
17952
|
else {
|
|
17802
17953
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
17803
17954
|
const { worldTransform, isLeafer, leafer, isFrame } = leaf;
|
|
17804
|
-
const { slice, clip, trim, padding, onCanvas } = options;
|
|
17955
|
+
const { slice, clip, trim, screenshot, padding, onCanvas } = options;
|
|
17805
17956
|
const smooth = options.smooth === undefined ? (leafer ? leafer.config.smooth : true) : options.smooth;
|
|
17806
17957
|
const contextSettings = options.contextSettings || (leafer ? leafer.config.contextSettings : undefined);
|
|
17807
|
-
const screenshot = options.screenshot || leaf.isApp;
|
|
17808
17958
|
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
|
|
17809
17959
|
const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
|
|
17810
17960
|
if (screenshot) {
|
|
@@ -17840,11 +17990,6 @@ ${filterStyle$1}
|
|
|
17840
17990
|
const scaleData = { scaleX: 1, scaleY: 1 };
|
|
17841
17991
|
MathHelper.getScaleData(options.scale, options.size, renderBounds, scaleData);
|
|
17842
17992
|
let pixelRatio = options.pixelRatio || 1;
|
|
17843
|
-
if (leaf.isApp) {
|
|
17844
|
-
scaleData.scaleX *= pixelRatio;
|
|
17845
|
-
scaleData.scaleY *= pixelRatio;
|
|
17846
|
-
pixelRatio = leaf.app.pixelRatio;
|
|
17847
|
-
}
|
|
17848
17993
|
let { x, y, width, height } = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
|
|
17849
17994
|
if (clip)
|
|
17850
17995
|
x += clip.x, y += clip.y, width = clip.width, height = clip.height;
|
|
@@ -18007,6 +18152,7 @@ ${filterStyle$1}
|
|
|
18007
18152
|
exports.AutoBounds = AutoBounds;
|
|
18008
18153
|
exports.BezierHelper = BezierHelper;
|
|
18009
18154
|
exports.Bounds = Bounds;
|
|
18155
|
+
exports.BoundsEvent = BoundsEvent;
|
|
18010
18156
|
exports.BoundsHelper = BoundsHelper;
|
|
18011
18157
|
exports.BoxData = BoxData;
|
|
18012
18158
|
exports.BranchHelper = BranchHelper;
|
|
@@ -18209,7 +18355,7 @@ ${filterStyle$1}
|
|
|
18209
18355
|
exports.surfaceType = surfaceType;
|
|
18210
18356
|
exports.tempBounds = tempBounds$1;
|
|
18211
18357
|
exports.tempMatrix = tempMatrix;
|
|
18212
|
-
exports.tempPoint = tempPoint$
|
|
18358
|
+
exports.tempPoint = tempPoint$3;
|
|
18213
18359
|
exports.useCanvas = useCanvas;
|
|
18214
18360
|
exports.useModule = useModule;
|
|
18215
18361
|
exports.version = version;
|