@leafer-draw/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.cjs +175 -185
- package/dist/worker.esm.js +177 -187
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +537 -411
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +536 -411
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +9 -9
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$5, cos: cos$5, acos, sqrt: sqrt$3 } = Math;
|
|
155
153
|
const { float: float$1 } = MathHelper;
|
|
156
|
-
const tempPoint$
|
|
154
|
+
const tempPoint$3 = {};
|
|
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$6.toInnerPoint(t, origin, tempPoint$
|
|
200
|
-
M$6.scaleOfInner(t, tempPoint$
|
|
197
|
+
M$6.toInnerPoint(t, origin, tempPoint$3);
|
|
198
|
+
M$6.scaleOfInner(t, tempPoint$3, scaleX, scaleY);
|
|
201
199
|
},
|
|
202
200
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
203
201
|
M$6.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$6.toInnerPoint(t, origin, tempPoint$
|
|
219
|
-
M$6.rotateOfInner(t, tempPoint$
|
|
216
|
+
M$6.toInnerPoint(t, origin, tempPoint$3);
|
|
217
|
+
M$6.rotateOfInner(t, tempPoint$3, rotation);
|
|
220
218
|
},
|
|
221
219
|
rotateOfInner(t, origin, rotation) {
|
|
222
220
|
M$6.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$6.toInnerPoint(t, origin, tempPoint$
|
|
241
|
-
M$6.skewOfInner(t, tempPoint$
|
|
238
|
+
M$6.toInnerPoint(t, origin, tempPoint$3);
|
|
239
|
+
M$6.skewOfInner(t, tempPoint$3, skewX, skewY);
|
|
242
240
|
},
|
|
243
241
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
244
242
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -467,8 +465,10 @@ var LeaferUI = (function (exports) {
|
|
|
467
465
|
t.y = halfPixel ? round$2(t.y - 0.5) + 0.5 : round$2(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$2 = 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$3 } = 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$5 } = AroundHelper;
|
|
872
|
+
const AlignHelper = {
|
|
873
|
+
toPoint(align, content, box, to, onlyBoxSize, onlyContentSize) {
|
|
874
|
+
toPoint$5(align, box, to, onlyBoxSize, content, onlyContentSize);
|
|
875
|
+
}
|
|
876
|
+
};
|
|
877
|
+
|
|
807
878
|
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$3 } = TwoPointBoundsHelper;
|
|
808
879
|
const { toOuterPoint: toOuterPoint$2 } = MatrixHelper;
|
|
809
880
|
const { float, fourNumber } = MathHelper;
|
|
810
881
|
const { floor, ceil: ceil$2 } = Math;
|
|
811
882
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
812
883
|
const point = {};
|
|
813
|
-
const toPoint$
|
|
884
|
+
const toPoint$4 = {};
|
|
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.x = t.x;
|
|
921
993
|
point.y = t.y;
|
|
922
|
-
toOuterPoint$2(matrix, point, toPoint$
|
|
923
|
-
setPoint$2(tempPointBounds$1, toPoint$
|
|
994
|
+
toOuterPoint$2(matrix, point, toPoint$4);
|
|
995
|
+
setPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
|
|
924
996
|
point.x = t.x + t.width;
|
|
925
|
-
toOuterPoint$2(matrix, point, toPoint$
|
|
926
|
-
addPoint$2(tempPointBounds$1, toPoint$
|
|
997
|
+
toOuterPoint$2(matrix, point, toPoint$4);
|
|
998
|
+
addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
|
|
927
999
|
point.y = t.y + t.height;
|
|
928
|
-
toOuterPoint$2(matrix, point, toPoint$
|
|
929
|
-
addPoint$2(tempPointBounds$1, toPoint$
|
|
1000
|
+
toOuterPoint$2(matrix, point, toPoint$4);
|
|
1001
|
+
addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
|
|
930
1002
|
point.x = t.x;
|
|
931
|
-
toOuterPoint$2(matrix, point, toPoint$
|
|
932
|
-
addPoint$2(tempPointBounds$1, toPoint$
|
|
1003
|
+
toOuterPoint$2(matrix, point, toPoint$4);
|
|
1004
|
+
addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
|
|
933
1005
|
toBounds$3(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$4 } = AroundHelper;
|
|
1312
|
-
const AlignHelper = {
|
|
1313
|
-
toPoint(align, contentBounds, bounds, to, onlySize) {
|
|
1314
|
-
toPoint$4(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$d = 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 } = DataHelper;
|
|
@@ -2248,16 +2272,19 @@ var LeaferUI = (function (exports) {
|
|
|
2248
2272
|
if (blendMode)
|
|
2249
2273
|
this.blendMode = 'source-over';
|
|
2250
2274
|
}
|
|
2251
|
-
clearWorld(bounds, ceilPixel) {
|
|
2252
|
-
this.setTempBounds(bounds, ceilPixel);
|
|
2253
|
-
this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2254
|
-
}
|
|
2255
2275
|
clipWorld(bounds, ceilPixel) {
|
|
2256
2276
|
this.beginPath();
|
|
2257
2277
|
this.setTempBounds(bounds, ceilPixel);
|
|
2258
2278
|
this.rect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2259
2279
|
this.clip();
|
|
2260
2280
|
}
|
|
2281
|
+
clipUI(ruleData) {
|
|
2282
|
+
ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
|
|
2283
|
+
}
|
|
2284
|
+
clearWorld(bounds, ceilPixel) {
|
|
2285
|
+
this.setTempBounds(bounds, ceilPixel);
|
|
2286
|
+
this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2287
|
+
}
|
|
2261
2288
|
clear() {
|
|
2262
2289
|
const { pixelRatio } = this;
|
|
2263
2290
|
this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
|
|
@@ -2388,7 +2415,7 @@ var LeaferUI = (function (exports) {
|
|
|
2388
2415
|
const { setPoint: setPoint$1, addPoint: addPoint$1 } = TwoPointBoundsHelper;
|
|
2389
2416
|
const { set, toNumberPoints } = PointHelper;
|
|
2390
2417
|
const { M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
2391
|
-
const tempPoint$
|
|
2418
|
+
const tempPoint$1 = {};
|
|
2392
2419
|
const BezierHelper = {
|
|
2393
2420
|
points(data, originPoints, curve, close) {
|
|
2394
2421
|
let points = toNumberPoints(originPoints);
|
|
@@ -2410,6 +2437,8 @@ var LeaferUI = (function (exports) {
|
|
|
2410
2437
|
cY = points[i + 3];
|
|
2411
2438
|
ba = sqrt$1(pow(bX - aX, 2) + pow(bY - aY, 2));
|
|
2412
2439
|
cb = sqrt$1(pow(cX - bX, 2) + pow(cY - bY, 2));
|
|
2440
|
+
if (!ba && !cb)
|
|
2441
|
+
continue;
|
|
2413
2442
|
d = ba + cb;
|
|
2414
2443
|
ba = (t * ba) / d;
|
|
2415
2444
|
cb = (t * cb) / d;
|
|
@@ -2579,8 +2608,8 @@ var LeaferUI = (function (exports) {
|
|
|
2579
2608
|
addMode ? addPoint$1(pointBounds, fromX, fromY) : setPoint$1(pointBounds, fromX, fromY);
|
|
2580
2609
|
addPoint$1(pointBounds, toX, toY);
|
|
2581
2610
|
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$1(pointBounds, tempPoint$
|
|
2611
|
+
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$1);
|
|
2612
|
+
addPoint$1(pointBounds, tempPoint$1.x, tempPoint$1.y);
|
|
2584
2613
|
}
|
|
2585
2614
|
},
|
|
2586
2615
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -3389,7 +3418,7 @@ var LeaferUI = (function (exports) {
|
|
|
3389
3418
|
}
|
|
3390
3419
|
|
|
3391
3420
|
const FileHelper = {
|
|
3392
|
-
|
|
3421
|
+
alphaPixelTypes: ['png', 'webp', 'svg'],
|
|
3393
3422
|
upperCaseTypeMap: {},
|
|
3394
3423
|
mineType(type) {
|
|
3395
3424
|
if (!type || type.startsWith('image'))
|
|
@@ -3416,7 +3445,7 @@ var LeaferUI = (function (exports) {
|
|
|
3416
3445
|
}
|
|
3417
3446
|
};
|
|
3418
3447
|
const F = FileHelper;
|
|
3419
|
-
F.
|
|
3448
|
+
F.alphaPixelTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3420
3449
|
|
|
3421
3450
|
const debug$8 = Debug.get('TaskProcessor');
|
|
3422
3451
|
class TaskItem {
|
|
@@ -3733,8 +3762,8 @@ var LeaferUI = (function (exports) {
|
|
|
3733
3762
|
list.length = 0;
|
|
3734
3763
|
}
|
|
3735
3764
|
},
|
|
3736
|
-
|
|
3737
|
-
return FileHelper.
|
|
3765
|
+
hasAlphaPixel(config) {
|
|
3766
|
+
return FileHelper.alphaPixelTypes.some(item => I.isFormat(item, config));
|
|
3738
3767
|
},
|
|
3739
3768
|
isFormat(format, config) {
|
|
3740
3769
|
if (config.format === format)
|
|
@@ -3772,7 +3801,7 @@ var LeaferUI = (function (exports) {
|
|
|
3772
3801
|
this.setView(view.config ? view.view : view);
|
|
3773
3802
|
}
|
|
3774
3803
|
ImageManager.isFormat('svg', config) && (this.isSVG = true);
|
|
3775
|
-
ImageManager.
|
|
3804
|
+
ImageManager.hasAlphaPixel(config) && (this.hasAlphaPixel = true);
|
|
3776
3805
|
}
|
|
3777
3806
|
load(onSuccess, onError) {
|
|
3778
3807
|
if (!this.loading) {
|
|
@@ -4460,7 +4489,7 @@ var LeaferUI = (function (exports) {
|
|
|
4460
4489
|
}
|
|
4461
4490
|
};
|
|
4462
4491
|
|
|
4463
|
-
const { updateBounds: updateBounds$
|
|
4492
|
+
const { updateBounds: updateBounds$3 } = LeafHelper;
|
|
4464
4493
|
const BranchHelper = {
|
|
4465
4494
|
sort(a, b) {
|
|
4466
4495
|
return (a.__.zIndex === b.__.zIndex) ? (a.__tempNumber - b.__tempNumber) : (a.__.zIndex - b.__.zIndex);
|
|
@@ -4522,11 +4551,11 @@ var LeaferUI = (function (exports) {
|
|
|
4522
4551
|
branch = branchStack[i];
|
|
4523
4552
|
children = branch.children;
|
|
4524
4553
|
for (let j = 0, len = children.length; j < len; j++) {
|
|
4525
|
-
updateBounds$
|
|
4554
|
+
updateBounds$3(children[j]);
|
|
4526
4555
|
}
|
|
4527
4556
|
if (exclude && exclude === branch)
|
|
4528
4557
|
continue;
|
|
4529
|
-
updateBounds$
|
|
4558
|
+
updateBounds$3(branch);
|
|
4530
4559
|
}
|
|
4531
4560
|
}
|
|
4532
4561
|
};
|
|
@@ -4544,7 +4573,7 @@ var LeaferUI = (function (exports) {
|
|
|
4544
4573
|
}
|
|
4545
4574
|
};
|
|
4546
4575
|
|
|
4547
|
-
const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
|
|
4576
|
+
const { getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2 } = LeafHelper;
|
|
4548
4577
|
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$5 } = BoundsHelper;
|
|
4549
4578
|
const localContent = '_localContentBounds';
|
|
4550
4579
|
const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
|
|
@@ -4588,7 +4617,9 @@ var LeaferUI = (function (exports) {
|
|
|
4588
4617
|
this._localRenderBounds = local;
|
|
4589
4618
|
}
|
|
4590
4619
|
update() {
|
|
4591
|
-
const { leafer } =
|
|
4620
|
+
const { leaf } = this, { leafer } = leaf;
|
|
4621
|
+
if (leaf.isApp)
|
|
4622
|
+
return updateBounds$2(leaf);
|
|
4592
4623
|
if (leafer) {
|
|
4593
4624
|
if (leafer.ready)
|
|
4594
4625
|
leafer.watcher.changed && leafer.layouter.layout();
|
|
@@ -4596,7 +4627,7 @@ var LeaferUI = (function (exports) {
|
|
|
4596
4627
|
leafer.start();
|
|
4597
4628
|
}
|
|
4598
4629
|
else {
|
|
4599
|
-
let root =
|
|
4630
|
+
let root = leaf;
|
|
4600
4631
|
while (root.parent && !root.parent.leafer) {
|
|
4601
4632
|
root = root.parent;
|
|
4602
4633
|
}
|
|
@@ -4818,7 +4849,7 @@ var LeaferUI = (function (exports) {
|
|
|
4818
4849
|
}
|
|
4819
4850
|
childrenSortChange() {
|
|
4820
4851
|
if (!this.childrenSortChanged) {
|
|
4821
|
-
this.childrenSortChanged = true;
|
|
4852
|
+
this.childrenSortChanged = this.affectChildrenSort = true;
|
|
4822
4853
|
this.leaf.forceUpdate('surface');
|
|
4823
4854
|
}
|
|
4824
4855
|
}
|
|
@@ -4885,6 +4916,40 @@ var LeaferUI = (function (exports) {
|
|
|
4885
4916
|
ImageEvent.LOADED = 'image.loaded';
|
|
4886
4917
|
ImageEvent.ERROR = 'image.error';
|
|
4887
4918
|
|
|
4919
|
+
class BoundsEvent extends Event {
|
|
4920
|
+
static checkHas(leaf, type, mode) {
|
|
4921
|
+
if (mode === 'on') {
|
|
4922
|
+
type === WORLD ? leaf.__hasWorldEvent = true : leaf.__hasLocalEvent = true;
|
|
4923
|
+
}
|
|
4924
|
+
else {
|
|
4925
|
+
leaf.__hasLocalEvent = leaf.hasEvent(RESIZE) || leaf.hasEvent(INNER) || leaf.hasEvent(LOCAL);
|
|
4926
|
+
leaf.__hasWorldEvent = leaf.hasEvent(WORLD);
|
|
4927
|
+
}
|
|
4928
|
+
}
|
|
4929
|
+
static emitLocal(leaf) {
|
|
4930
|
+
if (leaf.leaferIsReady) {
|
|
4931
|
+
const { resized } = leaf.__layout;
|
|
4932
|
+
if (resized !== 'local') {
|
|
4933
|
+
leaf.emit(RESIZE, leaf);
|
|
4934
|
+
if (resized === 'inner')
|
|
4935
|
+
leaf.emit(INNER, leaf);
|
|
4936
|
+
}
|
|
4937
|
+
leaf.emit(LOCAL, leaf);
|
|
4938
|
+
}
|
|
4939
|
+
}
|
|
4940
|
+
static emitWorld(leaf) {
|
|
4941
|
+
if (leaf.leaferIsReady)
|
|
4942
|
+
leaf.emit(WORLD, this);
|
|
4943
|
+
}
|
|
4944
|
+
}
|
|
4945
|
+
BoundsEvent.RESIZE = 'bounds.resize';
|
|
4946
|
+
BoundsEvent.INNER = 'bounds.inner';
|
|
4947
|
+
BoundsEvent.LOCAL = 'bounds.local';
|
|
4948
|
+
BoundsEvent.WORLD = 'bounds.world';
|
|
4949
|
+
const { RESIZE, INNER, LOCAL, WORLD } = BoundsEvent;
|
|
4950
|
+
const boundsEventMap = {};
|
|
4951
|
+
[RESIZE, INNER, LOCAL, WORLD].forEach(key => boundsEventMap[key] = 1);
|
|
4952
|
+
|
|
4888
4953
|
class ResizeEvent extends Event {
|
|
4889
4954
|
get bigger() {
|
|
4890
4955
|
if (!this.old)
|
|
@@ -4981,9 +5046,12 @@ var LeaferUI = (function (exports) {
|
|
|
4981
5046
|
set event(map) { this.on(map); }
|
|
4982
5047
|
on(type, listener, options) {
|
|
4983
5048
|
if (!listener) {
|
|
4984
|
-
let event
|
|
4985
|
-
|
|
4986
|
-
|
|
5049
|
+
let event;
|
|
5050
|
+
if (type instanceof Array)
|
|
5051
|
+
type.forEach(item => this.on(item[0], item[1], item[2]));
|
|
5052
|
+
else
|
|
5053
|
+
for (let key in type)
|
|
5054
|
+
(event = type[key]) instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event);
|
|
4987
5055
|
return;
|
|
4988
5056
|
}
|
|
4989
5057
|
let capture, once;
|
|
@@ -5013,6 +5081,8 @@ var LeaferUI = (function (exports) {
|
|
|
5013
5081
|
else {
|
|
5014
5082
|
map[type] = [item];
|
|
5015
5083
|
}
|
|
5084
|
+
if (boundsEventMap[type])
|
|
5085
|
+
BoundsEvent.checkHas(this, type, 'on');
|
|
5016
5086
|
}
|
|
5017
5087
|
});
|
|
5018
5088
|
}
|
|
@@ -5034,6 +5104,8 @@ var LeaferUI = (function (exports) {
|
|
|
5034
5104
|
events.splice(index, 1);
|
|
5035
5105
|
if (!events.length)
|
|
5036
5106
|
delete map[type];
|
|
5107
|
+
if (boundsEventMap[type])
|
|
5108
|
+
BoundsEvent.checkHas(this, type, 'off');
|
|
5037
5109
|
}
|
|
5038
5110
|
}
|
|
5039
5111
|
});
|
|
@@ -5053,19 +5125,31 @@ var LeaferUI = (function (exports) {
|
|
|
5053
5125
|
}
|
|
5054
5126
|
}
|
|
5055
5127
|
on_(type, listener, bind, options) {
|
|
5056
|
-
if (
|
|
5057
|
-
|
|
5058
|
-
|
|
5128
|
+
if (!listener)
|
|
5129
|
+
(type instanceof Array) && type.forEach(item => this.on(item[0], item[2] ? item[1] = item[1].bind(item[2]) : item[1], item[3]));
|
|
5130
|
+
else
|
|
5131
|
+
this.on(type, bind ? listener = listener.bind(bind) : listener, options);
|
|
5059
5132
|
return { type, current: this, listener, options };
|
|
5060
5133
|
}
|
|
5061
5134
|
off_(id) {
|
|
5062
5135
|
if (!id)
|
|
5063
5136
|
return;
|
|
5064
5137
|
const list = id instanceof Array ? id : [id];
|
|
5065
|
-
list.forEach(item =>
|
|
5138
|
+
list.forEach(item => {
|
|
5139
|
+
if (!item.listener)
|
|
5140
|
+
(item.type instanceof Array) && item.type.forEach(v => item.current.off(v[0], v[1], v[3]));
|
|
5141
|
+
else
|
|
5142
|
+
item.current.off(item.type, item.listener, item.options);
|
|
5143
|
+
});
|
|
5066
5144
|
list.length = 0;
|
|
5067
5145
|
}
|
|
5068
|
-
once(type, listener, capture) {
|
|
5146
|
+
once(type, listener, captureOrBind, capture) {
|
|
5147
|
+
if (!listener)
|
|
5148
|
+
return (type instanceof Array) && type.forEach(item => this.once(item[0], item[1], item[2], item[3]));
|
|
5149
|
+
if (typeof captureOrBind === 'object')
|
|
5150
|
+
listener = listener.bind(captureOrBind);
|
|
5151
|
+
else
|
|
5152
|
+
capture = captureOrBind;
|
|
5069
5153
|
this.on(type, listener, { once: true, capture });
|
|
5070
5154
|
}
|
|
5071
5155
|
emit(type, event, capture) {
|
|
@@ -5177,7 +5261,7 @@ var LeaferUI = (function (exports) {
|
|
|
5177
5261
|
};
|
|
5178
5262
|
|
|
5179
5263
|
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
5180
|
-
const { toPoint: toPoint$3, tempPoint
|
|
5264
|
+
const { toPoint: toPoint$3, tempPoint } = AroundHelper;
|
|
5181
5265
|
const LeafMatrix = {
|
|
5182
5266
|
__updateWorldMatrix() {
|
|
5183
5267
|
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
|
|
@@ -5186,19 +5270,19 @@ var LeaferUI = (function (exports) {
|
|
|
5186
5270
|
if (this.__local) {
|
|
5187
5271
|
const layout = this.__layout, local = this.__local, data = this.__;
|
|
5188
5272
|
if (layout.affectScaleOrRotation) {
|
|
5189
|
-
if (layout.scaleChanged || layout.rotationChanged) {
|
|
5273
|
+
if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
|
|
5190
5274
|
setLayout(local, data, null, null, layout.affectRotation);
|
|
5191
|
-
layout.scaleChanged = layout.rotationChanged =
|
|
5275
|
+
layout.scaleChanged = layout.rotationChanged = undefined;
|
|
5192
5276
|
}
|
|
5193
5277
|
}
|
|
5194
5278
|
local.e = data.x + data.offsetX;
|
|
5195
5279
|
local.f = data.y + data.offsetY;
|
|
5196
5280
|
if (data.around || data.origin) {
|
|
5197
|
-
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint
|
|
5198
|
-
translateInner(local, -tempPoint
|
|
5281
|
+
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint);
|
|
5282
|
+
translateInner(local, -tempPoint.x, -tempPoint.y, !data.around);
|
|
5199
5283
|
}
|
|
5200
5284
|
}
|
|
5201
|
-
this.__layout.matrixChanged =
|
|
5285
|
+
this.__layout.matrixChanged = undefined;
|
|
5202
5286
|
}
|
|
5203
5287
|
};
|
|
5204
5288
|
|
|
@@ -5208,11 +5292,17 @@ var LeaferUI = (function (exports) {
|
|
|
5208
5292
|
const { toBounds: toBounds$1 } = PathBounds;
|
|
5209
5293
|
const LeafBounds = {
|
|
5210
5294
|
__updateWorldBounds() {
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5295
|
+
const layout = this.__layout;
|
|
5296
|
+
toOuterOf$1(layout.renderBounds, this.__world, this.__world);
|
|
5297
|
+
if (layout.resized) {
|
|
5298
|
+
if (layout.resized === 'inner')
|
|
5299
|
+
this.__onUpdateSize();
|
|
5300
|
+
if (this.__hasLocalEvent)
|
|
5301
|
+
BoundsEvent.emitLocal(this);
|
|
5302
|
+
layout.resized = undefined;
|
|
5215
5303
|
}
|
|
5304
|
+
if (this.__hasWorldEvent)
|
|
5305
|
+
BoundsEvent.emitWorld(this);
|
|
5216
5306
|
},
|
|
5217
5307
|
__updateLocalBounds() {
|
|
5218
5308
|
const layout = this.__layout;
|
|
@@ -5221,12 +5311,12 @@ var LeaferUI = (function (exports) {
|
|
|
5221
5311
|
this.__updatePath();
|
|
5222
5312
|
this.__updateRenderPath();
|
|
5223
5313
|
this.__updateBoxBounds();
|
|
5224
|
-
layout.resized =
|
|
5314
|
+
layout.resized = 'inner';
|
|
5225
5315
|
}
|
|
5226
5316
|
if (layout.localBoxChanged) {
|
|
5227
5317
|
if (this.__local)
|
|
5228
5318
|
this.__updateLocalBoxBounds();
|
|
5229
|
-
layout.localBoxChanged =
|
|
5319
|
+
layout.localBoxChanged = undefined;
|
|
5230
5320
|
if (layout.strokeSpread)
|
|
5231
5321
|
layout.strokeChanged = true;
|
|
5232
5322
|
if (layout.renderSpread)
|
|
@@ -5234,7 +5324,7 @@ var LeaferUI = (function (exports) {
|
|
|
5234
5324
|
if (this.parent)
|
|
5235
5325
|
this.parent.__layout.boxChange();
|
|
5236
5326
|
}
|
|
5237
|
-
layout.boxChanged =
|
|
5327
|
+
layout.boxChanged = undefined;
|
|
5238
5328
|
if (layout.strokeChanged) {
|
|
5239
5329
|
layout.strokeSpread = this.__updateStrokeSpread();
|
|
5240
5330
|
if (layout.strokeSpread) {
|
|
@@ -5246,12 +5336,12 @@ var LeaferUI = (function (exports) {
|
|
|
5246
5336
|
else {
|
|
5247
5337
|
layout.spreadStrokeCancel();
|
|
5248
5338
|
}
|
|
5249
|
-
layout.strokeChanged =
|
|
5339
|
+
layout.strokeChanged = undefined;
|
|
5250
5340
|
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
|
|
5251
5341
|
layout.renderChanged = true;
|
|
5252
5342
|
if (this.parent)
|
|
5253
5343
|
this.parent.__layout.strokeChange();
|
|
5254
|
-
layout.resized =
|
|
5344
|
+
layout.resized = 'inner';
|
|
5255
5345
|
}
|
|
5256
5346
|
if (layout.renderChanged) {
|
|
5257
5347
|
layout.renderSpread = this.__updateRenderSpread();
|
|
@@ -5264,11 +5354,12 @@ var LeaferUI = (function (exports) {
|
|
|
5264
5354
|
else {
|
|
5265
5355
|
layout.spreadRenderCancel();
|
|
5266
5356
|
}
|
|
5267
|
-
layout.renderChanged =
|
|
5357
|
+
layout.renderChanged = undefined;
|
|
5268
5358
|
if (this.parent)
|
|
5269
5359
|
this.parent.__layout.renderChange();
|
|
5270
5360
|
}
|
|
5271
|
-
layout.
|
|
5361
|
+
layout.resized || (layout.resized = 'local');
|
|
5362
|
+
layout.boundsChanged = undefined;
|
|
5272
5363
|
},
|
|
5273
5364
|
__updateLocalBoxBounds() {
|
|
5274
5365
|
if (this.__hasMotionPath)
|
|
@@ -5362,7 +5453,7 @@ var LeaferUI = (function (exports) {
|
|
|
5362
5453
|
if (this.__worldOpacity) {
|
|
5363
5454
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5364
5455
|
this.__drawRenderPath(canvas);
|
|
5365
|
-
|
|
5456
|
+
canvas.clipUI(this);
|
|
5366
5457
|
}
|
|
5367
5458
|
},
|
|
5368
5459
|
__updateWorldOpacity() {
|
|
@@ -5808,7 +5899,7 @@ var LeaferUI = (function (exports) {
|
|
|
5808
5899
|
off(_type, _listener, _options) { }
|
|
5809
5900
|
on_(_type, _listener, _bind, _options) { return undefined; }
|
|
5810
5901
|
off_(_id) { }
|
|
5811
|
-
once(_type, _listener, _capture) { }
|
|
5902
|
+
once(_type, _listener, _captureOrBind, _capture) { }
|
|
5812
5903
|
emit(_type, _event, _capture) { }
|
|
5813
5904
|
emitEvent(_event, _capture) { }
|
|
5814
5905
|
hasEvent(_type, _capture) { return false; }
|
|
@@ -6145,7 +6236,7 @@ var LeaferUI = (function (exports) {
|
|
|
6145
6236
|
}
|
|
6146
6237
|
}
|
|
6147
6238
|
|
|
6148
|
-
const version = "1.6.
|
|
6239
|
+
const version = "1.6.4";
|
|
6149
6240
|
|
|
6150
6241
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6151
6242
|
get allowBackgroundColor() { return true; }
|
|
@@ -6304,17 +6395,15 @@ var LeaferUI = (function (exports) {
|
|
|
6304
6395
|
this.target.emitEvent(new WatchEvent(WatchEvent.DATA, { updatedList: this.updatedList }));
|
|
6305
6396
|
this.__updatedList = new LeafList();
|
|
6306
6397
|
this.totalTimes++;
|
|
6307
|
-
this.changed = false;
|
|
6308
|
-
this.hasVisible = false;
|
|
6309
|
-
this.hasRemove = false;
|
|
6310
|
-
this.hasAdd = false;
|
|
6398
|
+
this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
6311
6399
|
}
|
|
6312
6400
|
__listenEvents() {
|
|
6313
|
-
const { target } = this;
|
|
6314
6401
|
this.__eventIds = [
|
|
6315
|
-
target.on_(
|
|
6316
|
-
|
|
6317
|
-
|
|
6402
|
+
this.target.on_([
|
|
6403
|
+
[PropertyEvent.CHANGE, this.__onAttrChange, this],
|
|
6404
|
+
[[ChildEvent.ADD, ChildEvent.REMOVE], this.__onChildEvent, this],
|
|
6405
|
+
[WatchEvent.REQUEST, this.__onRquestData, this]
|
|
6406
|
+
])
|
|
6318
6407
|
];
|
|
6319
6408
|
}
|
|
6320
6409
|
__removeListenEvents() {
|
|
@@ -6324,8 +6413,7 @@ var LeaferUI = (function (exports) {
|
|
|
6324
6413
|
if (this.target) {
|
|
6325
6414
|
this.stop();
|
|
6326
6415
|
this.__removeListenEvents();
|
|
6327
|
-
this.target = null;
|
|
6328
|
-
this.__updatedList = null;
|
|
6416
|
+
this.target = this.__updatedList = null;
|
|
6329
6417
|
}
|
|
6330
6418
|
}
|
|
6331
6419
|
}
|
|
@@ -6430,7 +6518,7 @@ var LeaferUI = (function (exports) {
|
|
|
6430
6518
|
this.disabled = true;
|
|
6431
6519
|
}
|
|
6432
6520
|
layout() {
|
|
6433
|
-
if (!this.running)
|
|
6521
|
+
if (this.layouting || !this.running)
|
|
6434
6522
|
return;
|
|
6435
6523
|
const { target } = this;
|
|
6436
6524
|
this.times = 0;
|
|
@@ -6513,12 +6601,10 @@ var LeaferUI = (function (exports) {
|
|
|
6513
6601
|
}
|
|
6514
6602
|
static fullLayout(target) {
|
|
6515
6603
|
updateAllMatrix(target, true);
|
|
6516
|
-
if (target.isBranch)
|
|
6604
|
+
if (target.isBranch)
|
|
6517
6605
|
BranchHelper.updateBounds(target);
|
|
6518
|
-
|
|
6519
|
-
else {
|
|
6606
|
+
else
|
|
6520
6607
|
LeafHelper.updateBounds(target);
|
|
6521
|
-
}
|
|
6522
6608
|
updateAllChange(target);
|
|
6523
6609
|
}
|
|
6524
6610
|
addExtra(leaf) {
|
|
@@ -6541,11 +6627,12 @@ var LeaferUI = (function (exports) {
|
|
|
6541
6627
|
this.__updatedList = event.data.updatedList;
|
|
6542
6628
|
}
|
|
6543
6629
|
__listenEvents() {
|
|
6544
|
-
const { target } = this;
|
|
6545
6630
|
this.__eventIds = [
|
|
6546
|
-
target.on_(
|
|
6547
|
-
|
|
6548
|
-
|
|
6631
|
+
this.target.on_([
|
|
6632
|
+
[LayoutEvent.REQUEST, this.layout, this],
|
|
6633
|
+
[LayoutEvent.AGAIN, this.layoutAgain, this],
|
|
6634
|
+
[WatchEvent.DATA, this.__onReceiveWatchData, this]
|
|
6635
|
+
])
|
|
6549
6636
|
];
|
|
6550
6637
|
}
|
|
6551
6638
|
__removeListenEvents() {
|
|
@@ -6776,12 +6863,13 @@ var LeaferUI = (function (exports) {
|
|
|
6776
6863
|
this.target.emitEvent(new RenderEvent(type, this.times, bounds, options));
|
|
6777
6864
|
}
|
|
6778
6865
|
__listenEvents() {
|
|
6779
|
-
const { target } = this;
|
|
6780
6866
|
this.__eventIds = [
|
|
6781
|
-
target.on_(
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6867
|
+
this.target.on_([
|
|
6868
|
+
[RenderEvent.REQUEST, this.update, this],
|
|
6869
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
6870
|
+
[RenderEvent.AGAIN, this.renderAgain, this],
|
|
6871
|
+
[ResizeEvent.RESIZE, this.__onResize, this]
|
|
6872
|
+
])
|
|
6785
6873
|
];
|
|
6786
6874
|
}
|
|
6787
6875
|
__removeListenEvents() {
|
|
@@ -6840,8 +6928,32 @@ var LeaferUI = (function (exports) {
|
|
|
6840
6928
|
};
|
|
6841
6929
|
}
|
|
6842
6930
|
|
|
6931
|
+
function hasTransparent$3(color) {
|
|
6932
|
+
if (!color || color.length === 7 || color.length === 4)
|
|
6933
|
+
return false;
|
|
6934
|
+
if (color === 'transparent')
|
|
6935
|
+
return true;
|
|
6936
|
+
const first = color[0];
|
|
6937
|
+
if (first === '#') {
|
|
6938
|
+
switch (color.length) {
|
|
6939
|
+
case 5: return color[4] !== 'f' && color[4] !== 'F';
|
|
6940
|
+
case 9: return (color[7] !== 'f' && color[7] !== 'F') || (color[8] !== 'f' && color[8] !== 'F');
|
|
6941
|
+
}
|
|
6942
|
+
}
|
|
6943
|
+
else if (first === 'r' || first === 'h') {
|
|
6944
|
+
if (color[3] === 'a') {
|
|
6945
|
+
const i = color.lastIndexOf(',');
|
|
6946
|
+
if (i > -1)
|
|
6947
|
+
return parseFloat(color.slice(i + 1)) < 1;
|
|
6948
|
+
}
|
|
6949
|
+
}
|
|
6950
|
+
return false;
|
|
6951
|
+
}
|
|
6952
|
+
|
|
6843
6953
|
const TextConvert = {};
|
|
6844
|
-
const ColorConvert = {
|
|
6954
|
+
const ColorConvert = {
|
|
6955
|
+
hasTransparent: hasTransparent$3
|
|
6956
|
+
};
|
|
6845
6957
|
const UnitConvert = {
|
|
6846
6958
|
number(value, percentRefer) {
|
|
6847
6959
|
return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
|
|
@@ -6867,6 +6979,7 @@ var LeaferUI = (function (exports) {
|
|
|
6867
6979
|
};
|
|
6868
6980
|
|
|
6869
6981
|
const { parse, objectToCanvasData } = PathConvert;
|
|
6982
|
+
const { stintSet: stintSet$2 } = DataHelper, { hasTransparent: hasTransparent$2 } = ColorConvert;
|
|
6870
6983
|
const emptyPaint = {};
|
|
6871
6984
|
const debug$1 = Debug.get('UIData');
|
|
6872
6985
|
class UIData extends LeafData {
|
|
@@ -6925,38 +7038,22 @@ var LeaferUI = (function (exports) {
|
|
|
6925
7038
|
if (this.__naturalWidth)
|
|
6926
7039
|
this.__removeNaturalSize();
|
|
6927
7040
|
if (typeof value === 'string' || !value) {
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
PaintImage.recycleImage('fill', this);
|
|
6931
|
-
this.__isFills = false;
|
|
6932
|
-
this.__pixelFill && (this.__pixelFill = false);
|
|
6933
|
-
}
|
|
7041
|
+
stintSet$2(this, '__isTransparentFill', hasTransparent$2(value));
|
|
7042
|
+
this.__isFills && this.__removePaint('fill', true);
|
|
6934
7043
|
this._fill = value;
|
|
6935
7044
|
}
|
|
6936
7045
|
else if (typeof value === 'object') {
|
|
6937
|
-
this.
|
|
6938
|
-
const layout = this.__leaf.__layout;
|
|
6939
|
-
layout.boxChanged || layout.boxChange();
|
|
6940
|
-
this.__isFills = true;
|
|
6941
|
-
this._fill || (this._fill = emptyPaint);
|
|
7046
|
+
this.__setPaint('fill', value);
|
|
6942
7047
|
}
|
|
6943
7048
|
}
|
|
6944
7049
|
setStroke(value) {
|
|
6945
7050
|
if (typeof value === 'string' || !value) {
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
PaintImage.recycleImage('stroke', this);
|
|
6949
|
-
this.__isStrokes = false;
|
|
6950
|
-
this.__pixelStroke && (this.__pixelStroke = false);
|
|
6951
|
-
}
|
|
7051
|
+
stintSet$2(this, '__isTransparentStroke', hasTransparent$2(value));
|
|
7052
|
+
this.__isStrokes && this.__removePaint('stroke', true);
|
|
6952
7053
|
this._stroke = value;
|
|
6953
7054
|
}
|
|
6954
7055
|
else if (typeof value === 'object') {
|
|
6955
|
-
this.
|
|
6956
|
-
const layout = this.__leaf.__layout;
|
|
6957
|
-
layout.boxChanged || layout.boxChange();
|
|
6958
|
-
this.__isStrokes = true;
|
|
6959
|
-
this._stroke || (this._stroke = emptyPaint);
|
|
7056
|
+
this.__setPaint('stroke', value);
|
|
6960
7057
|
}
|
|
6961
7058
|
}
|
|
6962
7059
|
setPath(value) {
|
|
@@ -6986,7 +7083,34 @@ var LeaferUI = (function (exports) {
|
|
|
6986
7083
|
Paint.compute('fill', this.__leaf);
|
|
6987
7084
|
if (stroke)
|
|
6988
7085
|
Paint.compute('stroke', this.__leaf);
|
|
6989
|
-
this.__needComputePaint =
|
|
7086
|
+
this.__needComputePaint = undefined;
|
|
7087
|
+
}
|
|
7088
|
+
__setPaint(attrName, value) {
|
|
7089
|
+
this.__setInput(attrName, value);
|
|
7090
|
+
const layout = this.__leaf.__layout;
|
|
7091
|
+
layout.boxChanged || layout.boxChange();
|
|
7092
|
+
if (value instanceof Array && !value.length) {
|
|
7093
|
+
this.__removePaint(attrName);
|
|
7094
|
+
}
|
|
7095
|
+
else {
|
|
7096
|
+
if (attrName === 'fill')
|
|
7097
|
+
this.__isFills = true, this._fill || (this._fill = emptyPaint);
|
|
7098
|
+
else
|
|
7099
|
+
this.__isStrokes = true, this._stroke || (this._stroke = emptyPaint);
|
|
7100
|
+
}
|
|
7101
|
+
}
|
|
7102
|
+
__removePaint(attrName, removeInput) {
|
|
7103
|
+
if (removeInput)
|
|
7104
|
+
this.__removeInput(attrName);
|
|
7105
|
+
PaintImage.recycleImage(attrName, this);
|
|
7106
|
+
if (attrName === 'fill') {
|
|
7107
|
+
stintSet$2(this, '__isAlphaPixelFill', undefined);
|
|
7108
|
+
this._fill = this.__isFills = undefined;
|
|
7109
|
+
}
|
|
7110
|
+
else {
|
|
7111
|
+
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7112
|
+
this._stroke = this.__isStrokes = undefined;
|
|
7113
|
+
}
|
|
6990
7114
|
}
|
|
6991
7115
|
}
|
|
6992
7116
|
function setArray(data, key, value) {
|
|
@@ -6994,10 +7118,10 @@ var LeaferUI = (function (exports) {
|
|
|
6994
7118
|
if (value instanceof Array) {
|
|
6995
7119
|
if (value.some((item) => item.visible === false))
|
|
6996
7120
|
value = value.filter((item) => item.visible !== false);
|
|
6997
|
-
value.length || (value =
|
|
7121
|
+
value.length || (value = undefined);
|
|
6998
7122
|
}
|
|
6999
7123
|
else
|
|
7000
|
-
value = value && value.visible !== false ? [value] :
|
|
7124
|
+
value = value && value.visible !== false ? [value] : undefined;
|
|
7001
7125
|
data['_' + key] = value;
|
|
7002
7126
|
}
|
|
7003
7127
|
|
|
@@ -7100,8 +7224,6 @@ var LeaferUI = (function (exports) {
|
|
|
7100
7224
|
this._url = value;
|
|
7101
7225
|
}
|
|
7102
7226
|
__setImageFill(value) {
|
|
7103
|
-
if (this.__leaf.image)
|
|
7104
|
-
this.__leaf.image = null;
|
|
7105
7227
|
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
7106
7228
|
}
|
|
7107
7229
|
__getData() {
|
|
@@ -7167,21 +7289,19 @@ var LeaferUI = (function (exports) {
|
|
|
7167
7289
|
}
|
|
7168
7290
|
};
|
|
7169
7291
|
|
|
7292
|
+
const { stintSet: stintSet$1 } = DataHelper;
|
|
7170
7293
|
const UIRender = {
|
|
7171
7294
|
__updateChange() {
|
|
7172
|
-
const data = this.__
|
|
7295
|
+
const data = this.__;
|
|
7173
7296
|
if (data.__useEffect) {
|
|
7174
|
-
const { shadow,
|
|
7175
|
-
data.
|
|
7297
|
+
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7298
|
+
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')));
|
|
7299
|
+
data.__useEffect = !!(shadow || otherEffect);
|
|
7176
7300
|
}
|
|
7177
|
-
|
|
7178
|
-
|
|
7301
|
+
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7302
|
+
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7179
7303
|
data.__checkSingle();
|
|
7180
|
-
|
|
7181
|
-
if (complex)
|
|
7182
|
-
data.__complex = true;
|
|
7183
|
-
else
|
|
7184
|
-
data.__complex && (data.__complex = false);
|
|
7304
|
+
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7185
7305
|
},
|
|
7186
7306
|
__drawFast(canvas, options) {
|
|
7187
7307
|
drawFast(this, canvas, options);
|
|
@@ -7191,21 +7311,23 @@ var LeaferUI = (function (exports) {
|
|
|
7191
7311
|
if (data.__complex) {
|
|
7192
7312
|
if (data.__needComputePaint)
|
|
7193
7313
|
data.__computePaint();
|
|
7194
|
-
const { fill, stroke, __drawAfterFill } = data;
|
|
7314
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke, __isFastShadow } = data;
|
|
7195
7315
|
this.__drawRenderPath(canvas);
|
|
7196
|
-
if (data.__useEffect) {
|
|
7316
|
+
if (data.__useEffect && !__isFastShadow) {
|
|
7197
7317
|
const shape = Paint.shape(this, canvas, options);
|
|
7198
7318
|
this.__nowWorld = this.__getNowWorld(options);
|
|
7199
7319
|
const { shadow, innerShadow, filter } = data;
|
|
7200
7320
|
if (shadow)
|
|
7201
7321
|
Effect.shadow(this, canvas, shape);
|
|
7322
|
+
if (__fillAfterStroke)
|
|
7323
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7202
7324
|
if (fill)
|
|
7203
7325
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7204
7326
|
if (__drawAfterFill)
|
|
7205
7327
|
this.__drawAfterFill(canvas, options);
|
|
7206
7328
|
if (innerShadow)
|
|
7207
7329
|
Effect.innerShadow(this, canvas, shape);
|
|
7208
|
-
if (stroke)
|
|
7330
|
+
if (stroke && !__fillAfterStroke)
|
|
7209
7331
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7210
7332
|
if (filter)
|
|
7211
7333
|
Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
@@ -7214,21 +7336,27 @@ var LeaferUI = (function (exports) {
|
|
|
7214
7336
|
shape.canvas.recycle();
|
|
7215
7337
|
}
|
|
7216
7338
|
else {
|
|
7339
|
+
if (__fillAfterStroke)
|
|
7340
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7341
|
+
if (__isFastShadow) {
|
|
7342
|
+
const shadow = data.shadow[0], { scaleX, scaleY } = this.__nowWorld;
|
|
7343
|
+
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
7344
|
+
}
|
|
7217
7345
|
if (fill)
|
|
7218
7346
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7347
|
+
if (__isFastShadow)
|
|
7348
|
+
canvas.restore();
|
|
7219
7349
|
if (__drawAfterFill)
|
|
7220
7350
|
this.__drawAfterFill(canvas, options);
|
|
7221
|
-
if (stroke)
|
|
7351
|
+
if (stroke && !__fillAfterStroke)
|
|
7222
7352
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7223
7353
|
}
|
|
7224
7354
|
}
|
|
7225
7355
|
else {
|
|
7226
|
-
if (data.__pathInputed)
|
|
7356
|
+
if (data.__pathInputed)
|
|
7227
7357
|
drawFast(this, canvas, options);
|
|
7228
|
-
|
|
7229
|
-
else {
|
|
7358
|
+
else
|
|
7230
7359
|
this.__drawFast(canvas, options);
|
|
7231
|
-
}
|
|
7232
7360
|
}
|
|
7233
7361
|
},
|
|
7234
7362
|
__renderShape(canvas, options, ignoreFill, ignoreStroke) {
|
|
@@ -7237,17 +7365,17 @@ var LeaferUI = (function (exports) {
|
|
|
7237
7365
|
const { fill, stroke } = this.__;
|
|
7238
7366
|
this.__drawRenderPath(canvas);
|
|
7239
7367
|
if (fill && !ignoreFill)
|
|
7240
|
-
this.__.
|
|
7368
|
+
this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7241
7369
|
if (this.__.__isCanvas)
|
|
7242
7370
|
this.__drawAfterFill(canvas, options);
|
|
7243
7371
|
if (stroke && !ignoreStroke)
|
|
7244
|
-
this.__.
|
|
7372
|
+
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7245
7373
|
}
|
|
7246
7374
|
},
|
|
7247
7375
|
__drawAfterFill(canvas, options) {
|
|
7248
7376
|
if (this.__.__clipAfterFill) {
|
|
7249
7377
|
canvas.save();
|
|
7250
|
-
|
|
7378
|
+
canvas.clipUI();
|
|
7251
7379
|
this.__drawContent(canvas, options);
|
|
7252
7380
|
canvas.restore();
|
|
7253
7381
|
}
|
|
@@ -7256,13 +7384,15 @@ var LeaferUI = (function (exports) {
|
|
|
7256
7384
|
}
|
|
7257
7385
|
};
|
|
7258
7386
|
function drawFast(ui, canvas, options) {
|
|
7259
|
-
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
7387
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke } = ui.__;
|
|
7260
7388
|
ui.__drawRenderPath(canvas);
|
|
7389
|
+
if (__fillAfterStroke)
|
|
7390
|
+
Paint.stroke(stroke, ui, canvas);
|
|
7261
7391
|
if (fill)
|
|
7262
7392
|
Paint.fill(fill, ui, canvas);
|
|
7263
7393
|
if (__drawAfterFill)
|
|
7264
7394
|
ui.__drawAfterFill(canvas, options);
|
|
7265
|
-
if (stroke)
|
|
7395
|
+
if (stroke && !__fillAfterStroke)
|
|
7266
7396
|
Paint.stroke(stroke, ui, canvas);
|
|
7267
7397
|
}
|
|
7268
7398
|
|
|
@@ -7634,6 +7764,9 @@ var LeaferUI = (function (exports) {
|
|
|
7634
7764
|
__decorate([
|
|
7635
7765
|
surfaceType()
|
|
7636
7766
|
], exports.UI.prototype, "placeholderColor", void 0);
|
|
7767
|
+
__decorate([
|
|
7768
|
+
dataType(100)
|
|
7769
|
+
], exports.UI.prototype, "placeholderDelay", void 0);
|
|
7637
7770
|
__decorate([
|
|
7638
7771
|
dataType({})
|
|
7639
7772
|
], exports.UI.prototype, "data", void 0);
|
|
@@ -8035,15 +8168,20 @@ var LeaferUI = (function (exports) {
|
|
|
8035
8168
|
}
|
|
8036
8169
|
__listenEvents() {
|
|
8037
8170
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8038
|
-
this.once(
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8171
|
+
this.once([
|
|
8172
|
+
[LeaferEvent.START, () => Run.end(runId)],
|
|
8173
|
+
[LayoutEvent.START, this.updateLazyBounds, this],
|
|
8174
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
8175
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
8176
|
+
]);
|
|
8177
|
+
this.__eventIds.push(this.on_([
|
|
8178
|
+
[WatchEvent.DATA, this.__onWatchData, this],
|
|
8179
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
8180
|
+
[RenderEvent.NEXT, this.__onNextRender, this]
|
|
8181
|
+
]));
|
|
8043
8182
|
}
|
|
8044
8183
|
__removeListenEvents() {
|
|
8045
8184
|
this.off_(this.__eventIds);
|
|
8046
|
-
this.__eventIds.length = 0;
|
|
8047
8185
|
}
|
|
8048
8186
|
destroy(sync) {
|
|
8049
8187
|
const doDestory = () => {
|
|
@@ -8151,13 +8289,13 @@ var LeaferUI = (function (exports) {
|
|
|
8151
8289
|
super.__updateRenderBounds();
|
|
8152
8290
|
copy$2(childrenRenderBounds, renderBounds);
|
|
8153
8291
|
this.__updateRectRenderBounds();
|
|
8154
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8292
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8155
8293
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8156
8294
|
add(renderBounds, childrenRenderBounds);
|
|
8157
8295
|
}
|
|
8158
8296
|
else
|
|
8159
8297
|
this.__updateRectRenderBounds();
|
|
8160
|
-
|
|
8298
|
+
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8161
8299
|
}
|
|
8162
8300
|
__updateRectRenderBounds() { }
|
|
8163
8301
|
__updateRectChange() { }
|
|
@@ -8461,18 +8599,10 @@ var LeaferUI = (function (exports) {
|
|
|
8461
8599
|
|
|
8462
8600
|
exports.Image = class Image extends exports.Rect {
|
|
8463
8601
|
get __tag() { return 'Image'; }
|
|
8464
|
-
get ready() {
|
|
8602
|
+
get ready() { const { image } = this; return image && image.ready; }
|
|
8603
|
+
get image() { const { fill } = this.__; return fill instanceof Array && fill[0].image; }
|
|
8465
8604
|
constructor(data) {
|
|
8466
8605
|
super(data);
|
|
8467
|
-
this.on_(ImageEvent.LOADED, this.__onLoaded, this);
|
|
8468
|
-
}
|
|
8469
|
-
__onLoaded(e) {
|
|
8470
|
-
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8471
|
-
this.image = e.image;
|
|
8472
|
-
}
|
|
8473
|
-
destroy() {
|
|
8474
|
-
this.image = null;
|
|
8475
|
-
super.destroy();
|
|
8476
8606
|
}
|
|
8477
8607
|
};
|
|
8478
8608
|
__decorate([
|
|
@@ -8488,11 +8618,11 @@ var LeaferUI = (function (exports) {
|
|
|
8488
8618
|
|
|
8489
8619
|
exports.Canvas = class Canvas extends exports.Rect {
|
|
8490
8620
|
get __tag() { return 'Canvas'; }
|
|
8621
|
+
get context() { return this.canvas.context; }
|
|
8491
8622
|
get ready() { return !this.url; }
|
|
8492
8623
|
constructor(data) {
|
|
8493
8624
|
super(data);
|
|
8494
8625
|
this.canvas = Creator.canvas(this.__);
|
|
8495
|
-
this.context = this.canvas.context;
|
|
8496
8626
|
if (data && data.url)
|
|
8497
8627
|
this.drawImage(data.url);
|
|
8498
8628
|
}
|
|
@@ -8536,7 +8666,7 @@ var LeaferUI = (function (exports) {
|
|
|
8536
8666
|
destroy() {
|
|
8537
8667
|
if (this.canvas) {
|
|
8538
8668
|
this.canvas.destroy();
|
|
8539
|
-
this.canvas =
|
|
8669
|
+
this.canvas = null;
|
|
8540
8670
|
}
|
|
8541
8671
|
super.destroy();
|
|
8542
8672
|
}
|
|
@@ -8612,12 +8742,11 @@ var LeaferUI = (function (exports) {
|
|
|
8612
8742
|
super.__updateBoxBounds();
|
|
8613
8743
|
if (italic)
|
|
8614
8744
|
b.width += fontSize * 0.16;
|
|
8615
|
-
|
|
8616
|
-
if (isOverflow)
|
|
8745
|
+
DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds));
|
|
8746
|
+
if (this.isOverflow)
|
|
8617
8747
|
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8618
8748
|
else
|
|
8619
8749
|
data.__textBoxBounds = b;
|
|
8620
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8621
8750
|
}
|
|
8622
8751
|
__onUpdateSize() {
|
|
8623
8752
|
if (this.__box)
|
|
@@ -8731,6 +8860,9 @@ var LeaferUI = (function (exports) {
|
|
|
8731
8860
|
__decorate([
|
|
8732
8861
|
boundsType('show')
|
|
8733
8862
|
], exports.Text.prototype, "textOverflow", void 0);
|
|
8863
|
+
__decorate([
|
|
8864
|
+
surfaceType(false)
|
|
8865
|
+
], exports.Text.prototype, "textEditing", void 0);
|
|
8734
8866
|
exports.Text = __decorate([
|
|
8735
8867
|
registerUI()
|
|
8736
8868
|
], exports.Text);
|
|
@@ -8863,35 +8995,38 @@ var LeaferUI = (function (exports) {
|
|
|
8863
8995
|
}
|
|
8864
8996
|
|
|
8865
8997
|
function strokeText(stroke, ui, canvas) {
|
|
8866
|
-
|
|
8867
|
-
const isStrokes = typeof stroke !== 'string';
|
|
8868
|
-
switch (strokeAlign) {
|
|
8998
|
+
switch (ui.__.strokeAlign) {
|
|
8869
8999
|
case 'center':
|
|
8870
|
-
|
|
8871
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
9000
|
+
drawCenter$1(stroke, 1, ui, canvas);
|
|
8872
9001
|
break;
|
|
8873
9002
|
case 'inside':
|
|
8874
|
-
|
|
9003
|
+
drawAlign(stroke, 'inside', ui, canvas);
|
|
8875
9004
|
break;
|
|
8876
9005
|
case 'outside':
|
|
8877
|
-
|
|
9006
|
+
ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, 'outside', ui, canvas);
|
|
8878
9007
|
break;
|
|
8879
9008
|
}
|
|
8880
9009
|
}
|
|
8881
|
-
function
|
|
8882
|
-
const
|
|
9010
|
+
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
9011
|
+
const data = ui.__;
|
|
9012
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
|
|
9013
|
+
data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
9014
|
+
}
|
|
9015
|
+
function drawAlign(stroke, align, ui, canvas) {
|
|
8883
9016
|
const out = canvas.getSameCanvas(true, true);
|
|
8884
|
-
out.
|
|
8885
|
-
|
|
8886
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
|
|
9017
|
+
out.font = ui.__.__font;
|
|
9018
|
+
drawCenter$1(stroke, 2, ui, out);
|
|
8887
9019
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
8888
9020
|
fillText(ui, out);
|
|
8889
9021
|
out.blendMode = 'normal';
|
|
8890
|
-
|
|
9022
|
+
copyWorld(canvas, out, ui);
|
|
9023
|
+
out.recycle(ui.__nowWorld);
|
|
9024
|
+
}
|
|
9025
|
+
function copyWorld(canvas, out, ui) {
|
|
9026
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
8891
9027
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
8892
9028
|
else
|
|
8893
9029
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
8894
|
-
out.recycle(ui.__nowWorld);
|
|
8895
9030
|
}
|
|
8896
9031
|
function drawTextStroke(ui, canvas) {
|
|
8897
9032
|
let row, data = ui.__.__textDrawData;
|
|
@@ -8929,90 +9064,56 @@ var LeaferUI = (function (exports) {
|
|
|
8929
9064
|
}
|
|
8930
9065
|
|
|
8931
9066
|
function stroke(stroke, ui, canvas) {
|
|
8932
|
-
const
|
|
8933
|
-
|
|
8934
|
-
if (!__strokeWidth)
|
|
9067
|
+
const data = ui.__;
|
|
9068
|
+
if (!data.__strokeWidth)
|
|
8935
9069
|
return;
|
|
8936
|
-
if (__font) {
|
|
9070
|
+
if (data.__font) {
|
|
8937
9071
|
strokeText(stroke, ui, canvas);
|
|
8938
9072
|
}
|
|
8939
9073
|
else {
|
|
8940
|
-
switch (strokeAlign) {
|
|
9074
|
+
switch (data.strokeAlign) {
|
|
8941
9075
|
case 'center':
|
|
8942
|
-
|
|
8943
|
-
canvas.stroke();
|
|
8944
|
-
if (options.__useArrow)
|
|
8945
|
-
strokeArrow(ui, canvas);
|
|
9076
|
+
drawCenter(stroke, 1, ui, canvas);
|
|
8946
9077
|
break;
|
|
8947
9078
|
case 'inside':
|
|
8948
|
-
canvas
|
|
8949
|
-
canvas.setStroke(stroke, __strokeWidth * 2, options);
|
|
8950
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
8951
|
-
canvas.stroke();
|
|
8952
|
-
canvas.restore();
|
|
9079
|
+
drawInside(stroke, ui, canvas);
|
|
8953
9080
|
break;
|
|
8954
9081
|
case 'outside':
|
|
8955
|
-
|
|
8956
|
-
out.setStroke(stroke, __strokeWidth * 2, options);
|
|
8957
|
-
ui.__drawRenderPath(out);
|
|
8958
|
-
out.stroke();
|
|
8959
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
8960
|
-
out.clearWorld(ui.__layout.renderBounds);
|
|
8961
|
-
if (ui.__worldFlipped)
|
|
8962
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
8963
|
-
else
|
|
8964
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
8965
|
-
out.recycle(ui.__nowWorld);
|
|
9082
|
+
drawOutside(stroke, ui, canvas);
|
|
8966
9083
|
break;
|
|
8967
9084
|
}
|
|
8968
9085
|
}
|
|
8969
9086
|
}
|
|
8970
9087
|
function strokes(strokes, ui, canvas) {
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
9088
|
+
stroke(strokes, ui, canvas);
|
|
9089
|
+
}
|
|
9090
|
+
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
9091
|
+
const data = ui.__;
|
|
9092
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
9093
|
+
data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
|
|
9094
|
+
if (data.__useArrow)
|
|
9095
|
+
Paint.strokeArrow(stroke, ui, canvas);
|
|
9096
|
+
}
|
|
9097
|
+
function drawInside(stroke, ui, canvas) {
|
|
9098
|
+
canvas.save();
|
|
9099
|
+
canvas.clipUI(ui);
|
|
9100
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
9101
|
+
canvas.restore();
|
|
9102
|
+
}
|
|
9103
|
+
function drawOutside(stroke, ui, canvas) {
|
|
9104
|
+
const data = ui.__;
|
|
9105
|
+
if (data.__fillAfterStroke) {
|
|
9106
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
8977
9107
|
}
|
|
8978
9108
|
else {
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
canvas.save();
|
|
8988
|
-
canvas.setStroke(undefined, __strokeWidth * 2, options);
|
|
8989
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
8990
|
-
drawStrokesStyle(strokes, false, ui, canvas);
|
|
8991
|
-
canvas.restore();
|
|
8992
|
-
break;
|
|
8993
|
-
case 'outside':
|
|
8994
|
-
const { renderBounds } = ui.__layout;
|
|
8995
|
-
const out = canvas.getSameCanvas(true, true);
|
|
8996
|
-
ui.__drawRenderPath(out);
|
|
8997
|
-
out.setStroke(undefined, __strokeWidth * 2, options);
|
|
8998
|
-
drawStrokesStyle(strokes, false, ui, out);
|
|
8999
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
9000
|
-
out.clearWorld(renderBounds);
|
|
9001
|
-
if (ui.__worldFlipped)
|
|
9002
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9003
|
-
else
|
|
9004
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
9005
|
-
out.recycle(ui.__nowWorld);
|
|
9006
|
-
break;
|
|
9007
|
-
}
|
|
9008
|
-
}
|
|
9009
|
-
}
|
|
9010
|
-
function strokeArrow(ui, canvas) {
|
|
9011
|
-
if (ui.__.dashPattern) {
|
|
9012
|
-
canvas.beginPath();
|
|
9013
|
-
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
9014
|
-
canvas.dashPattern = null;
|
|
9015
|
-
canvas.stroke();
|
|
9109
|
+
const { renderBounds } = ui.__layout;
|
|
9110
|
+
const out = canvas.getSameCanvas(true, true);
|
|
9111
|
+
ui.__drawRenderPath(out);
|
|
9112
|
+
drawCenter(stroke, 2, ui, out);
|
|
9113
|
+
out.clipUI(data);
|
|
9114
|
+
out.clearWorld(renderBounds);
|
|
9115
|
+
copyWorld(canvas, out, ui);
|
|
9116
|
+
out.recycle(ui.__nowWorld);
|
|
9016
9117
|
}
|
|
9017
9118
|
}
|
|
9018
9119
|
|
|
@@ -9059,41 +9160,66 @@ var LeaferUI = (function (exports) {
|
|
|
9059
9160
|
}
|
|
9060
9161
|
|
|
9061
9162
|
let recycleMap;
|
|
9163
|
+
const { stintSet } = DataHelper, { hasTransparent: hasTransparent$1 } = ColorConvert;
|
|
9062
9164
|
function compute(attrName, ui) {
|
|
9063
9165
|
const data = ui.__, leafPaints = [];
|
|
9064
|
-
let paints = data.__input[attrName],
|
|
9166
|
+
let paints = data.__input[attrName], isAlphaPixel, isTransparent;
|
|
9065
9167
|
if (!(paints instanceof Array))
|
|
9066
9168
|
paints = [paints];
|
|
9067
9169
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
9068
9170
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
9069
|
-
item = getLeafPaint(attrName, paints[i], ui);
|
|
9070
|
-
if (item)
|
|
9071
|
-
leafPaints.push(item);
|
|
9171
|
+
(item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
|
|
9072
9172
|
}
|
|
9073
9173
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
9074
|
-
if (leafPaints.length
|
|
9075
|
-
|
|
9076
|
-
|
|
9174
|
+
if (leafPaints.length) {
|
|
9175
|
+
if (leafPaints.every(item => item.isTransparent)) {
|
|
9176
|
+
if (leafPaints.some(item => item.image))
|
|
9177
|
+
isAlphaPixel = true;
|
|
9178
|
+
isTransparent = true;
|
|
9179
|
+
}
|
|
9180
|
+
}
|
|
9181
|
+
if (attrName === 'fill') {
|
|
9182
|
+
stintSet(data, '__isAlphaPixelFill', isAlphaPixel);
|
|
9183
|
+
stintSet(data, '__isTransparentFill', isTransparent);
|
|
9184
|
+
}
|
|
9185
|
+
else {
|
|
9186
|
+
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
9187
|
+
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
9188
|
+
}
|
|
9077
9189
|
}
|
|
9078
9190
|
function getLeafPaint(attrName, paint, ui) {
|
|
9079
9191
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
|
9080
9192
|
return undefined;
|
|
9193
|
+
let data;
|
|
9081
9194
|
const { boxBounds } = ui.__layout;
|
|
9082
9195
|
switch (paint.type) {
|
|
9083
|
-
case 'solid':
|
|
9084
|
-
let { type, blendMode, color, opacity } = paint;
|
|
9085
|
-
return { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
9086
9196
|
case 'image':
|
|
9087
|
-
|
|
9197
|
+
data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
9198
|
+
break;
|
|
9088
9199
|
case 'linear':
|
|
9089
|
-
|
|
9200
|
+
data = PaintGradient.linearGradient(paint, boxBounds);
|
|
9201
|
+
break;
|
|
9090
9202
|
case 'radial':
|
|
9091
|
-
|
|
9203
|
+
data = PaintGradient.radialGradient(paint, boxBounds);
|
|
9204
|
+
break;
|
|
9092
9205
|
case 'angular':
|
|
9093
|
-
|
|
9206
|
+
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
9207
|
+
break;
|
|
9208
|
+
case 'solid':
|
|
9209
|
+
const { type, color, opacity } = paint;
|
|
9210
|
+
data = { type, style: ColorConvert.string(color, opacity) };
|
|
9211
|
+
break;
|
|
9094
9212
|
default:
|
|
9095
|
-
|
|
9213
|
+
if (paint.r !== undefined)
|
|
9214
|
+
data = { type: 'solid', style: ColorConvert.string(paint) };
|
|
9096
9215
|
}
|
|
9216
|
+
if (data) {
|
|
9217
|
+
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
9218
|
+
data.isTransparent = true;
|
|
9219
|
+
if (paint.blendMode)
|
|
9220
|
+
data.blendMode = paint.blendMode;
|
|
9221
|
+
}
|
|
9222
|
+
return data;
|
|
9097
9223
|
}
|
|
9098
9224
|
|
|
9099
9225
|
const PaintModule = {
|
|
@@ -9159,12 +9285,10 @@ var LeaferUI = (function (exports) {
|
|
|
9159
9285
|
|
|
9160
9286
|
const { get: get$2, translate } = MatrixHelper;
|
|
9161
9287
|
const tempBox = new Bounds();
|
|
9162
|
-
const tempPoint = {};
|
|
9163
9288
|
const tempScaleData = {};
|
|
9289
|
+
const tempImage = {};
|
|
9164
9290
|
function createData(leafPaint, image, paint, box) {
|
|
9165
|
-
const {
|
|
9166
|
-
if (blendMode)
|
|
9167
|
-
leafPaint.blendMode = blendMode;
|
|
9291
|
+
const { changeful, sync } = paint;
|
|
9168
9292
|
if (changeful)
|
|
9169
9293
|
leafPaint.changeful = changeful;
|
|
9170
9294
|
if (sync)
|
|
@@ -9172,38 +9296,38 @@ var LeaferUI = (function (exports) {
|
|
|
9172
9296
|
leafPaint.data = getPatternData(paint, box, image);
|
|
9173
9297
|
}
|
|
9174
9298
|
function getPatternData(paint, box, image) {
|
|
9175
|
-
let { width, height } = image;
|
|
9176
9299
|
if (paint.padding)
|
|
9177
9300
|
box = tempBox.set(box).shrink(paint.padding);
|
|
9178
9301
|
if (paint.mode === 'strench')
|
|
9179
9302
|
paint.mode = 'stretch';
|
|
9303
|
+
let { width, height } = image;
|
|
9180
9304
|
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
9181
9305
|
const sameBox = box.width === width && box.height === height;
|
|
9182
9306
|
const data = { mode };
|
|
9183
9307
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
9184
|
-
|
|
9185
|
-
let
|
|
9308
|
+
BoundsHelper.set(tempImage, 0, 0, swapSize ? height : width, swapSize ? width : height);
|
|
9309
|
+
let scaleX, scaleY;
|
|
9186
9310
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
9187
9311
|
if (!sameBox || rotation) {
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9312
|
+
scaleX = scaleY = BoundsHelper.getFitScale(box, tempImage, mode !== 'fit');
|
|
9313
|
+
BoundsHelper.put(box, image, align, scaleX, false, tempImage);
|
|
9314
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
9191
9315
|
}
|
|
9192
9316
|
}
|
|
9193
|
-
else
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
|
|
9203
|
-
|
|
9317
|
+
else {
|
|
9318
|
+
if (scale || size) {
|
|
9319
|
+
MathHelper.getScaleData(scale, size, image, tempScaleData);
|
|
9320
|
+
scaleX = tempScaleData.scaleX;
|
|
9321
|
+
scaleY = tempScaleData.scaleY;
|
|
9322
|
+
}
|
|
9323
|
+
if (align) {
|
|
9324
|
+
if (scaleX)
|
|
9325
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
9326
|
+
AlignHelper.toPoint(align, tempImage, box, tempImage, true, true);
|
|
9327
|
+
}
|
|
9204
9328
|
}
|
|
9205
9329
|
if (offset)
|
|
9206
|
-
|
|
9330
|
+
PointHelper.move(tempImage, offset);
|
|
9207
9331
|
switch (mode) {
|
|
9208
9332
|
case 'stretch':
|
|
9209
9333
|
if (!sameBox)
|
|
@@ -9211,12 +9335,12 @@ var LeaferUI = (function (exports) {
|
|
|
9211
9335
|
break;
|
|
9212
9336
|
case 'normal':
|
|
9213
9337
|
case 'clip':
|
|
9214
|
-
if (x || y || scaleX || rotation)
|
|
9215
|
-
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
9338
|
+
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
9339
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9216
9340
|
break;
|
|
9217
9341
|
case 'repeat':
|
|
9218
9342
|
if (!sameBox || scaleX || rotation)
|
|
9219
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
9343
|
+
repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, align);
|
|
9220
9344
|
if (!repeat)
|
|
9221
9345
|
data.repeat = 'repeat';
|
|
9222
9346
|
break;
|
|
@@ -9224,7 +9348,7 @@ var LeaferUI = (function (exports) {
|
|
|
9224
9348
|
case 'cover':
|
|
9225
9349
|
default:
|
|
9226
9350
|
if (scaleX)
|
|
9227
|
-
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
9351
|
+
fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9228
9352
|
}
|
|
9229
9353
|
if (!data.transform) {
|
|
9230
9354
|
if (box.x || box.y) {
|
|
@@ -9257,6 +9381,8 @@ var LeaferUI = (function (exports) {
|
|
|
9257
9381
|
}
|
|
9258
9382
|
else {
|
|
9259
9383
|
leafPaint = { type: paint.type, image };
|
|
9384
|
+
if (image.hasAlphaPixel)
|
|
9385
|
+
leafPaint.isTransparent = true;
|
|
9260
9386
|
cache = image.use > 1 ? { leafPaint, paint, boxBounds: box.set(boxBounds) } : null;
|
|
9261
9387
|
}
|
|
9262
9388
|
if (firstUse || image.loading)
|
|
@@ -9281,7 +9407,7 @@ var LeaferUI = (function (exports) {
|
|
|
9281
9407
|
ignoreRender(ui, false);
|
|
9282
9408
|
if (!ui.destroyed) {
|
|
9283
9409
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
9284
|
-
if (image.
|
|
9410
|
+
if (image.hasAlphaPixel)
|
|
9285
9411
|
ui.__layout.hitCanvasChanged = true;
|
|
9286
9412
|
ui.forceUpdate('surface');
|
|
9287
9413
|
}
|
|
@@ -9293,13 +9419,17 @@ var LeaferUI = (function (exports) {
|
|
|
9293
9419
|
onLoadError(ui, event, error);
|
|
9294
9420
|
leafPaint.loadId = null;
|
|
9295
9421
|
});
|
|
9296
|
-
if (ui.placeholderColor)
|
|
9297
|
-
|
|
9298
|
-
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9422
|
+
if (ui.placeholderColor) {
|
|
9423
|
+
if (!ui.placeholderDelay)
|
|
9424
|
+
image.isPlacehold = true;
|
|
9425
|
+
else
|
|
9426
|
+
setTimeout(() => {
|
|
9427
|
+
if (!image.ready) {
|
|
9428
|
+
image.isPlacehold = true;
|
|
9429
|
+
ui.forceUpdate('surface');
|
|
9430
|
+
}
|
|
9431
|
+
}, ui.placeholderDelay);
|
|
9432
|
+
}
|
|
9303
9433
|
}
|
|
9304
9434
|
return leafPaint;
|
|
9305
9435
|
}
|
|
@@ -9454,7 +9584,7 @@ var LeaferUI = (function (exports) {
|
|
|
9454
9584
|
}
|
|
9455
9585
|
function drawImage(ui, canvas, paint, data) {
|
|
9456
9586
|
canvas.save();
|
|
9457
|
-
|
|
9587
|
+
canvas.clipUI(ui);
|
|
9458
9588
|
if (paint.blendMode)
|
|
9459
9589
|
canvas.blendMode = paint.blendMode;
|
|
9460
9590
|
if (data.opacity)
|
|
@@ -9505,32 +9635,33 @@ var LeaferUI = (function (exports) {
|
|
|
9505
9635
|
repeatMode
|
|
9506
9636
|
};
|
|
9507
9637
|
|
|
9508
|
-
const { toPoint: toPoint$2 } = AroundHelper;
|
|
9638
|
+
const { toPoint: toPoint$2 } = AroundHelper, { hasTransparent } = ColorConvert;
|
|
9509
9639
|
const realFrom$2 = {};
|
|
9510
9640
|
const realTo$2 = {};
|
|
9511
9641
|
function linearGradient(paint, box) {
|
|
9512
|
-
let { from, to, type,
|
|
9642
|
+
let { from, to, type, opacity } = paint;
|
|
9513
9643
|
toPoint$2(from || 'top', box, realFrom$2);
|
|
9514
9644
|
toPoint$2(to || 'bottom', box, realTo$2);
|
|
9515
9645
|
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
9516
|
-
applyStops(style, paint.stops, opacity);
|
|
9517
9646
|
const data = { type, style };
|
|
9518
|
-
|
|
9519
|
-
data.blendMode = blendMode;
|
|
9647
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9520
9648
|
return data;
|
|
9521
9649
|
}
|
|
9522
|
-
function applyStops(gradient, stops, opacity) {
|
|
9650
|
+
function applyStops(data, gradient, stops, opacity) {
|
|
9523
9651
|
if (stops) {
|
|
9524
|
-
let stop;
|
|
9652
|
+
let stop, color, offset, isTransparent;
|
|
9525
9653
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
9526
9654
|
stop = stops[i];
|
|
9527
|
-
if (typeof stop === 'string')
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
|
|
9655
|
+
if (typeof stop === 'string')
|
|
9656
|
+
offset = i / (len - 1), color = ColorConvert.string(stop, opacity);
|
|
9657
|
+
else
|
|
9658
|
+
offset = stop.offset, color = ColorConvert.string(stop.color, opacity);
|
|
9659
|
+
gradient.addColorStop(offset, color);
|
|
9660
|
+
if (!isTransparent && hasTransparent(color))
|
|
9661
|
+
isTransparent = true;
|
|
9533
9662
|
}
|
|
9663
|
+
if (isTransparent)
|
|
9664
|
+
data.isTransparent = true;
|
|
9534
9665
|
}
|
|
9535
9666
|
}
|
|
9536
9667
|
|
|
@@ -9540,17 +9671,15 @@ var LeaferUI = (function (exports) {
|
|
|
9540
9671
|
const realFrom$1 = {};
|
|
9541
9672
|
const realTo$1 = {};
|
|
9542
9673
|
function radialGradient(paint, box) {
|
|
9543
|
-
let { from, to, type, opacity,
|
|
9674
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
9544
9675
|
toPoint$1(from || 'center', box, realFrom$1);
|
|
9545
9676
|
toPoint$1(to || 'bottom', box, realTo$1);
|
|
9546
9677
|
const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$1(realFrom$1, realTo$1));
|
|
9547
|
-
applyStops(style, paint.stops, opacity);
|
|
9548
9678
|
const data = { type, style };
|
|
9679
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9549
9680
|
const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
|
|
9550
9681
|
if (transform)
|
|
9551
9682
|
data.transform = transform;
|
|
9552
|
-
if (blendMode)
|
|
9553
|
-
data.blendMode = blendMode;
|
|
9554
9683
|
return data;
|
|
9555
9684
|
}
|
|
9556
9685
|
function getTransform(box, from, to, stretch, rotate90) {
|
|
@@ -9576,17 +9705,15 @@ var LeaferUI = (function (exports) {
|
|
|
9576
9705
|
const realFrom = {};
|
|
9577
9706
|
const realTo = {};
|
|
9578
9707
|
function conicGradient(paint, box) {
|
|
9579
|
-
let { from, to, type, opacity,
|
|
9708
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
9580
9709
|
toPoint(from || 'center', box, realFrom);
|
|
9581
9710
|
toPoint(to || 'bottom', box, realTo);
|
|
9582
9711
|
const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance(realFrom, realTo));
|
|
9583
|
-
applyStops(style, paint.stops, opacity);
|
|
9584
9712
|
const data = { type, style };
|
|
9713
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9585
9714
|
const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
|
|
9586
9715
|
if (transform)
|
|
9587
9716
|
data.transform = transform;
|
|
9588
|
-
if (blendMode)
|
|
9589
|
-
data.blendMode = blendMode;
|
|
9590
9717
|
return data;
|
|
9591
9718
|
}
|
|
9592
9719
|
|
|
@@ -9622,12 +9749,10 @@ var LeaferUI = (function (exports) {
|
|
|
9622
9749
|
}
|
|
9623
9750
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
9624
9751
|
}
|
|
9625
|
-
if (ui.__worldFlipped)
|
|
9752
|
+
if (ui.__worldFlipped)
|
|
9626
9753
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
9627
|
-
|
|
9628
|
-
else {
|
|
9754
|
+
else
|
|
9629
9755
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
9630
|
-
}
|
|
9631
9756
|
if (end && index < end)
|
|
9632
9757
|
other.clearWorld(copyBounds, true);
|
|
9633
9758
|
});
|
|
@@ -9686,12 +9811,10 @@ var LeaferUI = (function (exports) {
|
|
|
9686
9811
|
copyBounds = bounds;
|
|
9687
9812
|
}
|
|
9688
9813
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
9689
|
-
if (ui.__worldFlipped)
|
|
9814
|
+
if (ui.__worldFlipped)
|
|
9690
9815
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
9691
|
-
|
|
9692
|
-
else {
|
|
9816
|
+
else
|
|
9693
9817
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
9694
|
-
}
|
|
9695
9818
|
if (end && index < end)
|
|
9696
9819
|
other.clearWorld(copyBounds, true);
|
|
9697
9820
|
});
|
|
@@ -9919,6 +10042,8 @@ var LeaferUI = (function (exports) {
|
|
|
9919
10042
|
lastCharType = null;
|
|
9920
10043
|
startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
|
|
9921
10044
|
word = { data: [] }, row = { words: [] };
|
|
10045
|
+
if (__letterSpacing)
|
|
10046
|
+
content = [...content];
|
|
9922
10047
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
9923
10048
|
char = content[i];
|
|
9924
10049
|
if (char === '\n') {
|
|
@@ -10337,6 +10462,7 @@ var LeaferUI = (function (exports) {
|
|
|
10337
10462
|
exports.AutoBounds = AutoBounds;
|
|
10338
10463
|
exports.BezierHelper = BezierHelper;
|
|
10339
10464
|
exports.Bounds = Bounds;
|
|
10465
|
+
exports.BoundsEvent = BoundsEvent;
|
|
10340
10466
|
exports.BoundsHelper = BoundsHelper;
|
|
10341
10467
|
exports.BoxData = BoxData;
|
|
10342
10468
|
exports.BranchHelper = BranchHelper;
|
|
@@ -10483,7 +10609,7 @@ var LeaferUI = (function (exports) {
|
|
|
10483
10609
|
exports.surfaceType = surfaceType;
|
|
10484
10610
|
exports.tempBounds = tempBounds$1;
|
|
10485
10611
|
exports.tempMatrix = tempMatrix;
|
|
10486
|
-
exports.tempPoint = tempPoint$
|
|
10612
|
+
exports.tempPoint = tempPoint$2;
|
|
10487
10613
|
exports.useCanvas = useCanvas;
|
|
10488
10614
|
exports.useModule = useModule;
|
|
10489
10615
|
exports.version = version;
|