leafer-ui 1.6.1 → 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/web.cjs +207 -201
- package/dist/web.esm.js +211 -205
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +614 -449
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +609 -449
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +11 -11
- package/dist/web.cjs.map +0 -1
- package/dist/web.esm.js.map +0 -1
- package/dist/web.js.map +0 -1
- package/dist/web.module.js.map +0 -1
package/dist/web.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$f = 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;
|
|
@@ -2388,7 +2412,7 @@ var LeaferUI = (function (exports) {
|
|
|
2388
2412
|
const { setPoint: setPoint$1, addPoint: addPoint$1 } = TwoPointBoundsHelper;
|
|
2389
2413
|
const { set, toNumberPoints } = PointHelper;
|
|
2390
2414
|
const { M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
2391
|
-
const tempPoint$
|
|
2415
|
+
const tempPoint$1 = {};
|
|
2392
2416
|
const BezierHelper = {
|
|
2393
2417
|
points(data, originPoints, curve, close) {
|
|
2394
2418
|
let points = toNumberPoints(originPoints);
|
|
@@ -2410,6 +2434,8 @@ var LeaferUI = (function (exports) {
|
|
|
2410
2434
|
cY = points[i + 3];
|
|
2411
2435
|
ba = sqrt$1(pow(bX - aX, 2) + pow(bY - aY, 2));
|
|
2412
2436
|
cb = sqrt$1(pow(cX - bX, 2) + pow(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$1(pointBounds, fromX, fromY) : setPoint$1(pointBounds, fromX, fromY);
|
|
2580
2606
|
addPoint$1(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$1(pointBounds, tempPoint$
|
|
2608
|
+
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$1);
|
|
2609
|
+
addPoint$1(pointBounds, tempPoint$1.x, tempPoint$1.y);
|
|
2584
2610
|
}
|
|
2585
2611
|
},
|
|
2586
2612
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -2592,7 +2618,11 @@ var LeaferUI = (function (exports) {
|
|
|
2592
2618
|
const point = {};
|
|
2593
2619
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, point);
|
|
2594
2620
|
return point;
|
|
2595
|
-
}
|
|
2621
|
+
},
|
|
2622
|
+
getDerivative(t, fromV, v1, v2, toV) {
|
|
2623
|
+
const o = 1 - t;
|
|
2624
|
+
return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
|
|
2625
|
+
},
|
|
2596
2626
|
};
|
|
2597
2627
|
const { getPointAndSet, toTwoPointBounds: toTwoPointBounds$1, ellipse: ellipse$6 } = BezierHelper;
|
|
2598
2628
|
|
|
@@ -3385,7 +3415,7 @@ var LeaferUI = (function (exports) {
|
|
|
3385
3415
|
}
|
|
3386
3416
|
|
|
3387
3417
|
const FileHelper = {
|
|
3388
|
-
|
|
3418
|
+
alphaPixelTypes: ['png', 'webp', 'svg'],
|
|
3389
3419
|
upperCaseTypeMap: {},
|
|
3390
3420
|
mineType(type) {
|
|
3391
3421
|
if (!type || type.startsWith('image'))
|
|
@@ -3412,7 +3442,7 @@ var LeaferUI = (function (exports) {
|
|
|
3412
3442
|
}
|
|
3413
3443
|
};
|
|
3414
3444
|
const F = FileHelper;
|
|
3415
|
-
F.
|
|
3445
|
+
F.alphaPixelTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3416
3446
|
|
|
3417
3447
|
const debug$a = Debug.get('TaskProcessor');
|
|
3418
3448
|
class TaskItem {
|
|
@@ -3729,8 +3759,8 @@ var LeaferUI = (function (exports) {
|
|
|
3729
3759
|
list.length = 0;
|
|
3730
3760
|
}
|
|
3731
3761
|
},
|
|
3732
|
-
|
|
3733
|
-
return FileHelper.
|
|
3762
|
+
hasAlphaPixel(config) {
|
|
3763
|
+
return FileHelper.alphaPixelTypes.some(item => I$1.isFormat(item, config));
|
|
3734
3764
|
},
|
|
3735
3765
|
isFormat(format, config) {
|
|
3736
3766
|
if (config.format === format)
|
|
@@ -3768,13 +3798,16 @@ var LeaferUI = (function (exports) {
|
|
|
3768
3798
|
this.setView(view.config ? view.view : view);
|
|
3769
3799
|
}
|
|
3770
3800
|
ImageManager.isFormat('svg', config) && (this.isSVG = true);
|
|
3771
|
-
ImageManager.
|
|
3801
|
+
ImageManager.hasAlphaPixel(config) && (this.hasAlphaPixel = true);
|
|
3772
3802
|
}
|
|
3773
3803
|
load(onSuccess, onError) {
|
|
3774
3804
|
if (!this.loading) {
|
|
3775
3805
|
this.loading = true;
|
|
3806
|
+
let { loadImage, loadImageWithProgress } = Platform.origin, onProgress = this.config.showProgress && loadImageWithProgress && this.onProgress.bind(this);
|
|
3807
|
+
if (onProgress)
|
|
3808
|
+
loadImage = loadImageWithProgress;
|
|
3776
3809
|
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
3777
|
-
return yield
|
|
3810
|
+
return yield loadImage(this.url, onProgress).then(img => this.setView(img)).catch((e) => {
|
|
3778
3811
|
this.error = e;
|
|
3779
3812
|
this.onComplete(false);
|
|
3780
3813
|
});
|
|
@@ -3799,6 +3832,9 @@ var LeaferUI = (function (exports) {
|
|
|
3799
3832
|
this.view = img;
|
|
3800
3833
|
this.onComplete(true);
|
|
3801
3834
|
}
|
|
3835
|
+
onProgress(progress) {
|
|
3836
|
+
this.progress = progress;
|
|
3837
|
+
}
|
|
3802
3838
|
onComplete(isSuccess) {
|
|
3803
3839
|
let odd;
|
|
3804
3840
|
this.waitComplete.forEach((item, index) => {
|
|
@@ -4264,13 +4300,20 @@ var LeaferUI = (function (exports) {
|
|
|
4264
4300
|
if (leaf.isBranch) {
|
|
4265
4301
|
const { children } = leaf;
|
|
4266
4302
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
4267
|
-
updateAllWorldOpacity
|
|
4303
|
+
updateAllWorldOpacity(children[i]);
|
|
4268
4304
|
}
|
|
4269
4305
|
}
|
|
4270
4306
|
},
|
|
4271
|
-
|
|
4272
|
-
|
|
4307
|
+
updateChange(leaf) {
|
|
4308
|
+
const layout = leaf.__layout;
|
|
4309
|
+
if (layout.stateStyleChanged)
|
|
4310
|
+
leaf.updateState();
|
|
4311
|
+
if (layout.opacityChanged)
|
|
4312
|
+
updateAllWorldOpacity(leaf);
|
|
4273
4313
|
leaf.__updateChange();
|
|
4314
|
+
},
|
|
4315
|
+
updateAllChange(leaf) {
|
|
4316
|
+
updateChange$1(leaf);
|
|
4274
4317
|
if (leaf.isBranch) {
|
|
4275
4318
|
const { children } = leaf;
|
|
4276
4319
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
@@ -4406,7 +4449,7 @@ var LeaferUI = (function (exports) {
|
|
|
4406
4449
|
}
|
|
4407
4450
|
};
|
|
4408
4451
|
const L = LeafHelper;
|
|
4409
|
-
const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity:
|
|
4452
|
+
const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1 } = L;
|
|
4410
4453
|
function getTempLocal(t, world) {
|
|
4411
4454
|
t.__layout.update();
|
|
4412
4455
|
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
@@ -4443,7 +4486,7 @@ var LeaferUI = (function (exports) {
|
|
|
4443
4486
|
}
|
|
4444
4487
|
};
|
|
4445
4488
|
|
|
4446
|
-
const { updateBounds: updateBounds$
|
|
4489
|
+
const { updateBounds: updateBounds$3 } = LeafHelper;
|
|
4447
4490
|
const BranchHelper = {
|
|
4448
4491
|
sort(a, b) {
|
|
4449
4492
|
return (a.__.zIndex === b.__.zIndex) ? (a.__tempNumber - b.__tempNumber) : (a.__.zIndex - b.__.zIndex);
|
|
@@ -4505,11 +4548,11 @@ var LeaferUI = (function (exports) {
|
|
|
4505
4548
|
branch = branchStack[i];
|
|
4506
4549
|
children = branch.children;
|
|
4507
4550
|
for (let j = 0, len = children.length; j < len; j++) {
|
|
4508
|
-
updateBounds$
|
|
4551
|
+
updateBounds$3(children[j]);
|
|
4509
4552
|
}
|
|
4510
4553
|
if (exclude && exclude === branch)
|
|
4511
4554
|
continue;
|
|
4512
|
-
updateBounds$
|
|
4555
|
+
updateBounds$3(branch);
|
|
4513
4556
|
}
|
|
4514
4557
|
}
|
|
4515
4558
|
};
|
|
@@ -4527,7 +4570,7 @@ var LeaferUI = (function (exports) {
|
|
|
4527
4570
|
}
|
|
4528
4571
|
};
|
|
4529
4572
|
|
|
4530
|
-
const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
|
|
4573
|
+
const { getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2 } = LeafHelper;
|
|
4531
4574
|
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$6 } = BoundsHelper;
|
|
4532
4575
|
const localContent = '_localContentBounds';
|
|
4533
4576
|
const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
|
|
@@ -4571,7 +4614,9 @@ var LeaferUI = (function (exports) {
|
|
|
4571
4614
|
this._localRenderBounds = local;
|
|
4572
4615
|
}
|
|
4573
4616
|
update() {
|
|
4574
|
-
const { leafer } =
|
|
4617
|
+
const { leaf } = this, { leafer } = leaf;
|
|
4618
|
+
if (leaf.isApp)
|
|
4619
|
+
return updateBounds$2(leaf);
|
|
4575
4620
|
if (leafer) {
|
|
4576
4621
|
if (leafer.ready)
|
|
4577
4622
|
leafer.watcher.changed && leafer.layouter.layout();
|
|
@@ -4579,7 +4624,7 @@ var LeaferUI = (function (exports) {
|
|
|
4579
4624
|
leafer.start();
|
|
4580
4625
|
}
|
|
4581
4626
|
else {
|
|
4582
|
-
let root =
|
|
4627
|
+
let root = leaf;
|
|
4583
4628
|
while (root.parent && !root.parent.leafer) {
|
|
4584
4629
|
root = root.parent;
|
|
4585
4630
|
}
|
|
@@ -4801,7 +4846,7 @@ var LeaferUI = (function (exports) {
|
|
|
4801
4846
|
}
|
|
4802
4847
|
childrenSortChange() {
|
|
4803
4848
|
if (!this.childrenSortChanged) {
|
|
4804
|
-
this.childrenSortChanged = true;
|
|
4849
|
+
this.childrenSortChanged = this.affectChildrenSort = true;
|
|
4805
4850
|
this.leaf.forceUpdate('surface');
|
|
4806
4851
|
}
|
|
4807
4852
|
}
|
|
@@ -4868,6 +4913,40 @@ var LeaferUI = (function (exports) {
|
|
|
4868
4913
|
ImageEvent.LOADED = 'image.loaded';
|
|
4869
4914
|
ImageEvent.ERROR = 'image.error';
|
|
4870
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
|
+
|
|
4871
4950
|
class ResizeEvent extends Event {
|
|
4872
4951
|
get bigger() {
|
|
4873
4952
|
if (!this.old)
|
|
@@ -4964,9 +5043,12 @@ var LeaferUI = (function (exports) {
|
|
|
4964
5043
|
set event(map) { this.on(map); }
|
|
4965
5044
|
on(type, listener, options) {
|
|
4966
5045
|
if (!listener) {
|
|
4967
|
-
let event
|
|
4968
|
-
|
|
4969
|
-
|
|
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);
|
|
4970
5052
|
return;
|
|
4971
5053
|
}
|
|
4972
5054
|
let capture, once;
|
|
@@ -4996,6 +5078,8 @@ var LeaferUI = (function (exports) {
|
|
|
4996
5078
|
else {
|
|
4997
5079
|
map[type] = [item];
|
|
4998
5080
|
}
|
|
5081
|
+
if (boundsEventMap[type])
|
|
5082
|
+
BoundsEvent.checkHas(this, type, 'on');
|
|
4999
5083
|
}
|
|
5000
5084
|
});
|
|
5001
5085
|
}
|
|
@@ -5017,6 +5101,8 @@ var LeaferUI = (function (exports) {
|
|
|
5017
5101
|
events.splice(index, 1);
|
|
5018
5102
|
if (!events.length)
|
|
5019
5103
|
delete map[type];
|
|
5104
|
+
if (boundsEventMap[type])
|
|
5105
|
+
BoundsEvent.checkHas(this, type, 'off');
|
|
5020
5106
|
}
|
|
5021
5107
|
}
|
|
5022
5108
|
});
|
|
@@ -5036,19 +5122,31 @@ var LeaferUI = (function (exports) {
|
|
|
5036
5122
|
}
|
|
5037
5123
|
}
|
|
5038
5124
|
on_(type, listener, bind, options) {
|
|
5039
|
-
if (
|
|
5040
|
-
|
|
5041
|
-
|
|
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);
|
|
5042
5129
|
return { type, current: this, listener, options };
|
|
5043
5130
|
}
|
|
5044
5131
|
off_(id) {
|
|
5045
5132
|
if (!id)
|
|
5046
5133
|
return;
|
|
5047
5134
|
const list = id instanceof Array ? id : [id];
|
|
5048
|
-
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
|
+
});
|
|
5049
5141
|
list.length = 0;
|
|
5050
5142
|
}
|
|
5051
|
-
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;
|
|
5052
5150
|
this.on(type, listener, { once: true, capture });
|
|
5053
5151
|
}
|
|
5054
5152
|
emit(type, event, capture) {
|
|
@@ -5160,7 +5258,7 @@ var LeaferUI = (function (exports) {
|
|
|
5160
5258
|
};
|
|
5161
5259
|
|
|
5162
5260
|
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
5163
|
-
const { toPoint: toPoint$3, tempPoint
|
|
5261
|
+
const { toPoint: toPoint$3, tempPoint } = AroundHelper;
|
|
5164
5262
|
const LeafMatrix = {
|
|
5165
5263
|
__updateWorldMatrix() {
|
|
5166
5264
|
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
|
|
@@ -5169,19 +5267,19 @@ var LeaferUI = (function (exports) {
|
|
|
5169
5267
|
if (this.__local) {
|
|
5170
5268
|
const layout = this.__layout, local = this.__local, data = this.__;
|
|
5171
5269
|
if (layout.affectScaleOrRotation) {
|
|
5172
|
-
if (layout.scaleChanged || layout.rotationChanged) {
|
|
5270
|
+
if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
|
|
5173
5271
|
setLayout(local, data, null, null, layout.affectRotation);
|
|
5174
|
-
layout.scaleChanged = layout.rotationChanged =
|
|
5272
|
+
layout.scaleChanged = layout.rotationChanged = undefined;
|
|
5175
5273
|
}
|
|
5176
5274
|
}
|
|
5177
5275
|
local.e = data.x + data.offsetX;
|
|
5178
5276
|
local.f = data.y + data.offsetY;
|
|
5179
5277
|
if (data.around || data.origin) {
|
|
5180
|
-
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint
|
|
5181
|
-
translateInner(local, -tempPoint
|
|
5278
|
+
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint);
|
|
5279
|
+
translateInner(local, -tempPoint.x, -tempPoint.y, !data.around);
|
|
5182
5280
|
}
|
|
5183
5281
|
}
|
|
5184
|
-
this.__layout.matrixChanged =
|
|
5282
|
+
this.__layout.matrixChanged = undefined;
|
|
5185
5283
|
}
|
|
5186
5284
|
};
|
|
5187
5285
|
|
|
@@ -5191,11 +5289,17 @@ var LeaferUI = (function (exports) {
|
|
|
5191
5289
|
const { toBounds: toBounds$1 } = PathBounds;
|
|
5192
5290
|
const LeafBounds = {
|
|
5193
5291
|
__updateWorldBounds() {
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
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;
|
|
5198
5300
|
}
|
|
5301
|
+
if (this.__hasWorldEvent)
|
|
5302
|
+
BoundsEvent.emitWorld(this);
|
|
5199
5303
|
},
|
|
5200
5304
|
__updateLocalBounds() {
|
|
5201
5305
|
const layout = this.__layout;
|
|
@@ -5204,12 +5308,12 @@ var LeaferUI = (function (exports) {
|
|
|
5204
5308
|
this.__updatePath();
|
|
5205
5309
|
this.__updateRenderPath();
|
|
5206
5310
|
this.__updateBoxBounds();
|
|
5207
|
-
layout.resized =
|
|
5311
|
+
layout.resized = 'inner';
|
|
5208
5312
|
}
|
|
5209
5313
|
if (layout.localBoxChanged) {
|
|
5210
5314
|
if (this.__local)
|
|
5211
5315
|
this.__updateLocalBoxBounds();
|
|
5212
|
-
layout.localBoxChanged =
|
|
5316
|
+
layout.localBoxChanged = undefined;
|
|
5213
5317
|
if (layout.strokeSpread)
|
|
5214
5318
|
layout.strokeChanged = true;
|
|
5215
5319
|
if (layout.renderSpread)
|
|
@@ -5217,7 +5321,7 @@ var LeaferUI = (function (exports) {
|
|
|
5217
5321
|
if (this.parent)
|
|
5218
5322
|
this.parent.__layout.boxChange();
|
|
5219
5323
|
}
|
|
5220
|
-
layout.boxChanged =
|
|
5324
|
+
layout.boxChanged = undefined;
|
|
5221
5325
|
if (layout.strokeChanged) {
|
|
5222
5326
|
layout.strokeSpread = this.__updateStrokeSpread();
|
|
5223
5327
|
if (layout.strokeSpread) {
|
|
@@ -5229,12 +5333,12 @@ var LeaferUI = (function (exports) {
|
|
|
5229
5333
|
else {
|
|
5230
5334
|
layout.spreadStrokeCancel();
|
|
5231
5335
|
}
|
|
5232
|
-
layout.strokeChanged =
|
|
5336
|
+
layout.strokeChanged = undefined;
|
|
5233
5337
|
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
|
|
5234
5338
|
layout.renderChanged = true;
|
|
5235
5339
|
if (this.parent)
|
|
5236
5340
|
this.parent.__layout.strokeChange();
|
|
5237
|
-
layout.resized =
|
|
5341
|
+
layout.resized = 'inner';
|
|
5238
5342
|
}
|
|
5239
5343
|
if (layout.renderChanged) {
|
|
5240
5344
|
layout.renderSpread = this.__updateRenderSpread();
|
|
@@ -5247,11 +5351,12 @@ var LeaferUI = (function (exports) {
|
|
|
5247
5351
|
else {
|
|
5248
5352
|
layout.spreadRenderCancel();
|
|
5249
5353
|
}
|
|
5250
|
-
layout.renderChanged =
|
|
5354
|
+
layout.renderChanged = undefined;
|
|
5251
5355
|
if (this.parent)
|
|
5252
5356
|
this.parent.__layout.renderChange();
|
|
5253
5357
|
}
|
|
5254
|
-
layout.
|
|
5358
|
+
layout.resized || (layout.resized = 'local');
|
|
5359
|
+
layout.boundsChanged = undefined;
|
|
5255
5360
|
},
|
|
5256
5361
|
__updateLocalBoxBounds() {
|
|
5257
5362
|
if (this.__hasMotionPath)
|
|
@@ -5791,7 +5896,7 @@ var LeaferUI = (function (exports) {
|
|
|
5791
5896
|
off(_type, _listener, _options) { }
|
|
5792
5897
|
on_(_type, _listener, _bind, _options) { return undefined; }
|
|
5793
5898
|
off_(_id) { }
|
|
5794
|
-
once(_type, _listener, _capture) { }
|
|
5899
|
+
once(_type, _listener, _captureOrBind, _capture) { }
|
|
5795
5900
|
emit(_type, _event, _capture) { }
|
|
5796
5901
|
emitEvent(_event, _capture) { }
|
|
5797
5902
|
hasEvent(_type, _capture) { return false; }
|
|
@@ -6128,7 +6233,7 @@ var LeaferUI = (function (exports) {
|
|
|
6128
6233
|
}
|
|
6129
6234
|
}
|
|
6130
6235
|
|
|
6131
|
-
const version = "1.6.
|
|
6236
|
+
const version = "1.6.3";
|
|
6132
6237
|
|
|
6133
6238
|
const debug$5 = Debug.get('LeaferCanvas');
|
|
6134
6239
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6468,17 +6573,15 @@ var LeaferUI = (function (exports) {
|
|
|
6468
6573
|
this.target.emitEvent(new WatchEvent(WatchEvent.DATA, { updatedList: this.updatedList }));
|
|
6469
6574
|
this.__updatedList = new LeafList();
|
|
6470
6575
|
this.totalTimes++;
|
|
6471
|
-
this.changed = false;
|
|
6472
|
-
this.hasVisible = false;
|
|
6473
|
-
this.hasRemove = false;
|
|
6474
|
-
this.hasAdd = false;
|
|
6576
|
+
this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
6475
6577
|
}
|
|
6476
6578
|
__listenEvents() {
|
|
6477
|
-
const { target } = this;
|
|
6478
6579
|
this.__eventIds = [
|
|
6479
|
-
target.on_(
|
|
6480
|
-
|
|
6481
|
-
|
|
6580
|
+
this.target.on_([
|
|
6581
|
+
[PropertyEvent.CHANGE, this.__onAttrChange, this],
|
|
6582
|
+
[[ChildEvent.ADD, ChildEvent.REMOVE], this.__onChildEvent, this],
|
|
6583
|
+
[WatchEvent.REQUEST, this.__onRquestData, this]
|
|
6584
|
+
])
|
|
6482
6585
|
];
|
|
6483
6586
|
}
|
|
6484
6587
|
__removeListenEvents() {
|
|
@@ -6488,13 +6591,12 @@ var LeaferUI = (function (exports) {
|
|
|
6488
6591
|
if (this.target) {
|
|
6489
6592
|
this.stop();
|
|
6490
6593
|
this.__removeListenEvents();
|
|
6491
|
-
this.target = null;
|
|
6492
|
-
this.__updatedList = null;
|
|
6594
|
+
this.target = this.__updatedList = null;
|
|
6493
6595
|
}
|
|
6494
6596
|
}
|
|
6495
6597
|
}
|
|
6496
6598
|
|
|
6497
|
-
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds,
|
|
6599
|
+
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds, updateChange: updateOneChange } = LeafHelper;
|
|
6498
6600
|
const { pushAllChildBranch, pushAllParent } = BranchHelper;
|
|
6499
6601
|
function updateMatrix(updateList, levelList) {
|
|
6500
6602
|
let layout;
|
|
@@ -6537,15 +6639,7 @@ var LeaferUI = (function (exports) {
|
|
|
6537
6639
|
});
|
|
6538
6640
|
}
|
|
6539
6641
|
function updateChange(updateList) {
|
|
6540
|
-
|
|
6541
|
-
updateList.list.forEach(leaf => {
|
|
6542
|
-
layout = leaf.__layout;
|
|
6543
|
-
if (layout.opacityChanged)
|
|
6544
|
-
updateAllWorldOpacity(leaf);
|
|
6545
|
-
if (layout.stateStyleChanged)
|
|
6546
|
-
setTimeout(() => layout.stateStyleChanged && leaf.updateState());
|
|
6547
|
-
leaf.__updateChange();
|
|
6548
|
-
});
|
|
6642
|
+
updateList.list.forEach(updateOneChange);
|
|
6549
6643
|
}
|
|
6550
6644
|
|
|
6551
6645
|
const { worldBounds } = LeafBoundsHelper;
|
|
@@ -6602,7 +6696,7 @@ var LeaferUI = (function (exports) {
|
|
|
6602
6696
|
this.disabled = true;
|
|
6603
6697
|
}
|
|
6604
6698
|
layout() {
|
|
6605
|
-
if (!this.running)
|
|
6699
|
+
if (this.layouting || !this.running)
|
|
6606
6700
|
return;
|
|
6607
6701
|
const { target } = this;
|
|
6608
6702
|
this.times = 0;
|
|
@@ -6685,12 +6779,10 @@ var LeaferUI = (function (exports) {
|
|
|
6685
6779
|
}
|
|
6686
6780
|
static fullLayout(target) {
|
|
6687
6781
|
updateAllMatrix(target, true);
|
|
6688
|
-
if (target.isBranch)
|
|
6782
|
+
if (target.isBranch)
|
|
6689
6783
|
BranchHelper.updateBounds(target);
|
|
6690
|
-
|
|
6691
|
-
else {
|
|
6784
|
+
else
|
|
6692
6785
|
LeafHelper.updateBounds(target);
|
|
6693
|
-
}
|
|
6694
6786
|
updateAllChange(target);
|
|
6695
6787
|
}
|
|
6696
6788
|
addExtra(leaf) {
|
|
@@ -6713,11 +6805,12 @@ var LeaferUI = (function (exports) {
|
|
|
6713
6805
|
this.__updatedList = event.data.updatedList;
|
|
6714
6806
|
}
|
|
6715
6807
|
__listenEvents() {
|
|
6716
|
-
const { target } = this;
|
|
6717
6808
|
this.__eventIds = [
|
|
6718
|
-
target.on_(
|
|
6719
|
-
|
|
6720
|
-
|
|
6809
|
+
this.target.on_([
|
|
6810
|
+
[LayoutEvent.REQUEST, this.layout, this],
|
|
6811
|
+
[LayoutEvent.AGAIN, this.layoutAgain, this],
|
|
6812
|
+
[WatchEvent.DATA, this.__onReceiveWatchData, this]
|
|
6813
|
+
])
|
|
6721
6814
|
];
|
|
6722
6815
|
}
|
|
6723
6816
|
__removeListenEvents() {
|
|
@@ -6948,12 +7041,13 @@ var LeaferUI = (function (exports) {
|
|
|
6948
7041
|
this.target.emitEvent(new RenderEvent(type, this.times, bounds, options));
|
|
6949
7042
|
}
|
|
6950
7043
|
__listenEvents() {
|
|
6951
|
-
const { target } = this;
|
|
6952
7044
|
this.__eventIds = [
|
|
6953
|
-
target.on_(
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
7045
|
+
this.target.on_([
|
|
7046
|
+
[RenderEvent.REQUEST, this.update, this],
|
|
7047
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
7048
|
+
[RenderEvent.AGAIN, this.renderAgain, this],
|
|
7049
|
+
[ResizeEvent.RESIZE, this.__onResize, this]
|
|
7050
|
+
])
|
|
6957
7051
|
];
|
|
6958
7052
|
}
|
|
6959
7053
|
__removeListenEvents() {
|
|
@@ -7169,8 +7263,32 @@ var LeaferUI = (function (exports) {
|
|
|
7169
7263
|
};
|
|
7170
7264
|
}
|
|
7171
7265
|
|
|
7266
|
+
function hasTransparent$3(color) {
|
|
7267
|
+
if (!color || color.length === 7 || color.length === 4)
|
|
7268
|
+
return false;
|
|
7269
|
+
if (color === 'transparent')
|
|
7270
|
+
return true;
|
|
7271
|
+
const first = color[0];
|
|
7272
|
+
if (first === '#') {
|
|
7273
|
+
switch (color.length) {
|
|
7274
|
+
case 5: return color[4] !== 'f' && color[4] !== 'F';
|
|
7275
|
+
case 9: return (color[7] !== 'f' && color[7] !== 'F') || (color[8] !== 'f' && color[8] !== 'F');
|
|
7276
|
+
}
|
|
7277
|
+
}
|
|
7278
|
+
else if (first === 'r' || first === 'h') {
|
|
7279
|
+
if (color[3] === 'a') {
|
|
7280
|
+
const i = color.lastIndexOf(',');
|
|
7281
|
+
if (i > -1)
|
|
7282
|
+
return parseFloat(color.slice(i + 1)) < 1;
|
|
7283
|
+
}
|
|
7284
|
+
}
|
|
7285
|
+
return false;
|
|
7286
|
+
}
|
|
7287
|
+
|
|
7172
7288
|
const TextConvert = {};
|
|
7173
|
-
const ColorConvert = {
|
|
7289
|
+
const ColorConvert = {
|
|
7290
|
+
hasTransparent: hasTransparent$3
|
|
7291
|
+
};
|
|
7174
7292
|
const UnitConvert = {
|
|
7175
7293
|
number(value, percentRefer) {
|
|
7176
7294
|
return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
|
|
@@ -7196,6 +7314,7 @@ var LeaferUI = (function (exports) {
|
|
|
7196
7314
|
};
|
|
7197
7315
|
|
|
7198
7316
|
const { parse, objectToCanvasData } = PathConvert;
|
|
7317
|
+
const { stintSet: stintSet$2 } = DataHelper, { hasTransparent: hasTransparent$2 } = ColorConvert;
|
|
7199
7318
|
const emptyPaint = {};
|
|
7200
7319
|
const debug$2 = Debug.get('UIData');
|
|
7201
7320
|
class UIData extends LeafData {
|
|
@@ -7254,38 +7373,22 @@ var LeaferUI = (function (exports) {
|
|
|
7254
7373
|
if (this.__naturalWidth)
|
|
7255
7374
|
this.__removeNaturalSize();
|
|
7256
7375
|
if (typeof value === 'string' || !value) {
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
PaintImage.recycleImage('fill', this);
|
|
7260
|
-
this.__isFills = false;
|
|
7261
|
-
this.__pixelFill && (this.__pixelFill = false);
|
|
7262
|
-
}
|
|
7376
|
+
stintSet$2(this, '__isTransparentFill', hasTransparent$2(value));
|
|
7377
|
+
this.__isFills && this.__removePaint('fill', true);
|
|
7263
7378
|
this._fill = value;
|
|
7264
7379
|
}
|
|
7265
7380
|
else if (typeof value === 'object') {
|
|
7266
|
-
this.
|
|
7267
|
-
const layout = this.__leaf.__layout;
|
|
7268
|
-
layout.boxChanged || layout.boxChange();
|
|
7269
|
-
this.__isFills = true;
|
|
7270
|
-
this._fill || (this._fill = emptyPaint);
|
|
7381
|
+
this.__setPaint('fill', value);
|
|
7271
7382
|
}
|
|
7272
7383
|
}
|
|
7273
7384
|
setStroke(value) {
|
|
7274
7385
|
if (typeof value === 'string' || !value) {
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
PaintImage.recycleImage('stroke', this);
|
|
7278
|
-
this.__isStrokes = false;
|
|
7279
|
-
this.__pixelStroke && (this.__pixelStroke = false);
|
|
7280
|
-
}
|
|
7386
|
+
stintSet$2(this, '__isTransparentStroke', hasTransparent$2(value));
|
|
7387
|
+
this.__isStrokes && this.__removePaint('stroke', true);
|
|
7281
7388
|
this._stroke = value;
|
|
7282
7389
|
}
|
|
7283
7390
|
else if (typeof value === 'object') {
|
|
7284
|
-
this.
|
|
7285
|
-
const layout = this.__leaf.__layout;
|
|
7286
|
-
layout.boxChanged || layout.boxChange();
|
|
7287
|
-
this.__isStrokes = true;
|
|
7288
|
-
this._stroke || (this._stroke = emptyPaint);
|
|
7391
|
+
this.__setPaint('stroke', value);
|
|
7289
7392
|
}
|
|
7290
7393
|
}
|
|
7291
7394
|
setPath(value) {
|
|
@@ -7315,7 +7418,34 @@ var LeaferUI = (function (exports) {
|
|
|
7315
7418
|
Paint.compute('fill', this.__leaf);
|
|
7316
7419
|
if (stroke)
|
|
7317
7420
|
Paint.compute('stroke', this.__leaf);
|
|
7318
|
-
this.__needComputePaint =
|
|
7421
|
+
this.__needComputePaint = undefined;
|
|
7422
|
+
}
|
|
7423
|
+
__setPaint(attrName, value) {
|
|
7424
|
+
this.__setInput(attrName, value);
|
|
7425
|
+
const layout = this.__leaf.__layout;
|
|
7426
|
+
layout.boxChanged || layout.boxChange();
|
|
7427
|
+
if (value instanceof Array && !value.length) {
|
|
7428
|
+
this.__removePaint(attrName);
|
|
7429
|
+
}
|
|
7430
|
+
else {
|
|
7431
|
+
if (attrName === 'fill')
|
|
7432
|
+
this.__isFills = true, this._fill || (this._fill = emptyPaint);
|
|
7433
|
+
else
|
|
7434
|
+
this.__isStrokes = true, this._stroke || (this._stroke = emptyPaint);
|
|
7435
|
+
}
|
|
7436
|
+
}
|
|
7437
|
+
__removePaint(attrName, removeInput) {
|
|
7438
|
+
if (removeInput)
|
|
7439
|
+
this.__removeInput(attrName);
|
|
7440
|
+
PaintImage.recycleImage(attrName, this);
|
|
7441
|
+
if (attrName === 'fill') {
|
|
7442
|
+
stintSet$2(this, '__isAlphaPixelFill', undefined);
|
|
7443
|
+
this._fill = this.__isFills = undefined;
|
|
7444
|
+
}
|
|
7445
|
+
else {
|
|
7446
|
+
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7447
|
+
this._stroke = this.__isStrokes = undefined;
|
|
7448
|
+
}
|
|
7319
7449
|
}
|
|
7320
7450
|
}
|
|
7321
7451
|
function setArray(data, key, value) {
|
|
@@ -7323,10 +7453,10 @@ var LeaferUI = (function (exports) {
|
|
|
7323
7453
|
if (value instanceof Array) {
|
|
7324
7454
|
if (value.some((item) => item.visible === false))
|
|
7325
7455
|
value = value.filter((item) => item.visible !== false);
|
|
7326
|
-
value.length || (value =
|
|
7456
|
+
value.length || (value = undefined);
|
|
7327
7457
|
}
|
|
7328
7458
|
else
|
|
7329
|
-
value = value && value.visible !== false ? [value] :
|
|
7459
|
+
value = value && value.visible !== false ? [value] : undefined;
|
|
7330
7460
|
data['_' + key] = value;
|
|
7331
7461
|
}
|
|
7332
7462
|
|
|
@@ -7390,13 +7520,11 @@ var LeaferUI = (function (exports) {
|
|
|
7390
7520
|
setFontWeight(value) {
|
|
7391
7521
|
if (typeof value === 'string') {
|
|
7392
7522
|
this.__setInput('fontWeight', value);
|
|
7393
|
-
|
|
7394
|
-
}
|
|
7395
|
-
else {
|
|
7396
|
-
if (this.__input)
|
|
7397
|
-
this.__removeInput('fontWeight');
|
|
7398
|
-
this._fontWeight = value;
|
|
7523
|
+
value = fontWeightMap[value] || 400;
|
|
7399
7524
|
}
|
|
7525
|
+
else if (this.__input)
|
|
7526
|
+
this.__removeInput('fontWeight');
|
|
7527
|
+
this._fontWeight = value;
|
|
7400
7528
|
}
|
|
7401
7529
|
setBoxStyle(value) {
|
|
7402
7530
|
let t = this.__leaf, box = t.__box;
|
|
@@ -7431,8 +7559,6 @@ var LeaferUI = (function (exports) {
|
|
|
7431
7559
|
this._url = value;
|
|
7432
7560
|
}
|
|
7433
7561
|
__setImageFill(value) {
|
|
7434
|
-
if (this.__leaf.image)
|
|
7435
|
-
this.__leaf.image = null;
|
|
7436
7562
|
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
7437
7563
|
}
|
|
7438
7564
|
__getData() {
|
|
@@ -7498,21 +7624,19 @@ var LeaferUI = (function (exports) {
|
|
|
7498
7624
|
}
|
|
7499
7625
|
};
|
|
7500
7626
|
|
|
7627
|
+
const { stintSet: stintSet$1 } = DataHelper;
|
|
7501
7628
|
const UIRender = {
|
|
7502
7629
|
__updateChange() {
|
|
7503
|
-
const data = this.__
|
|
7630
|
+
const data = this.__;
|
|
7504
7631
|
if (data.__useEffect) {
|
|
7505
|
-
const { shadow,
|
|
7506
|
-
data.
|
|
7632
|
+
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7633
|
+
stintSet$1(data, '__isFastShadow', shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !(shadow[0].box && data.__isTransparentFill) && fill && !(fill instanceof Array && fill.length > 1) && (this.useFastShadow || !stroke || (stroke && data.strokeAlign === 'inside')));
|
|
7634
|
+
data.__useEffect = !!(shadow || otherEffect);
|
|
7507
7635
|
}
|
|
7508
|
-
|
|
7509
|
-
|
|
7636
|
+
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7637
|
+
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7510
7638
|
data.__checkSingle();
|
|
7511
|
-
|
|
7512
|
-
if (complex)
|
|
7513
|
-
data.__complex = true;
|
|
7514
|
-
else
|
|
7515
|
-
data.__complex && (data.__complex = false);
|
|
7639
|
+
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7516
7640
|
},
|
|
7517
7641
|
__drawFast(canvas, options) {
|
|
7518
7642
|
drawFast(this, canvas, options);
|
|
@@ -7522,21 +7646,23 @@ var LeaferUI = (function (exports) {
|
|
|
7522
7646
|
if (data.__complex) {
|
|
7523
7647
|
if (data.__needComputePaint)
|
|
7524
7648
|
data.__computePaint();
|
|
7525
|
-
const { fill, stroke, __drawAfterFill } = data;
|
|
7649
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke, __isFastShadow } = data;
|
|
7526
7650
|
this.__drawRenderPath(canvas);
|
|
7527
|
-
if (data.__useEffect) {
|
|
7651
|
+
if (data.__useEffect && !__isFastShadow) {
|
|
7528
7652
|
const shape = Paint.shape(this, canvas, options);
|
|
7529
7653
|
this.__nowWorld = this.__getNowWorld(options);
|
|
7530
7654
|
const { shadow, innerShadow, filter } = data;
|
|
7531
7655
|
if (shadow)
|
|
7532
7656
|
Effect.shadow(this, canvas, shape);
|
|
7657
|
+
if (__fillAfterStroke)
|
|
7658
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7533
7659
|
if (fill)
|
|
7534
7660
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7535
7661
|
if (__drawAfterFill)
|
|
7536
7662
|
this.__drawAfterFill(canvas, options);
|
|
7537
7663
|
if (innerShadow)
|
|
7538
7664
|
Effect.innerShadow(this, canvas, shape);
|
|
7539
|
-
if (stroke)
|
|
7665
|
+
if (stroke && !__fillAfterStroke)
|
|
7540
7666
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7541
7667
|
if (filter)
|
|
7542
7668
|
Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
@@ -7545,21 +7671,27 @@ var LeaferUI = (function (exports) {
|
|
|
7545
7671
|
shape.canvas.recycle();
|
|
7546
7672
|
}
|
|
7547
7673
|
else {
|
|
7674
|
+
if (__fillAfterStroke)
|
|
7675
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7676
|
+
if (__isFastShadow) {
|
|
7677
|
+
const shadow = data.shadow[0], { scaleX, scaleY } = this.__nowWorld;
|
|
7678
|
+
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
7679
|
+
}
|
|
7548
7680
|
if (fill)
|
|
7549
7681
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7682
|
+
if (__isFastShadow)
|
|
7683
|
+
canvas.restore();
|
|
7550
7684
|
if (__drawAfterFill)
|
|
7551
7685
|
this.__drawAfterFill(canvas, options);
|
|
7552
|
-
if (stroke)
|
|
7686
|
+
if (stroke && !__fillAfterStroke)
|
|
7553
7687
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7554
7688
|
}
|
|
7555
7689
|
}
|
|
7556
7690
|
else {
|
|
7557
|
-
if (data.__pathInputed)
|
|
7691
|
+
if (data.__pathInputed)
|
|
7558
7692
|
drawFast(this, canvas, options);
|
|
7559
|
-
|
|
7560
|
-
else {
|
|
7693
|
+
else
|
|
7561
7694
|
this.__drawFast(canvas, options);
|
|
7562
|
-
}
|
|
7563
7695
|
}
|
|
7564
7696
|
},
|
|
7565
7697
|
__renderShape(canvas, options, ignoreFill, ignoreStroke) {
|
|
@@ -7568,11 +7700,11 @@ var LeaferUI = (function (exports) {
|
|
|
7568
7700
|
const { fill, stroke } = this.__;
|
|
7569
7701
|
this.__drawRenderPath(canvas);
|
|
7570
7702
|
if (fill && !ignoreFill)
|
|
7571
|
-
this.__.
|
|
7703
|
+
this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7572
7704
|
if (this.__.__isCanvas)
|
|
7573
7705
|
this.__drawAfterFill(canvas, options);
|
|
7574
7706
|
if (stroke && !ignoreStroke)
|
|
7575
|
-
this.__.
|
|
7707
|
+
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7576
7708
|
}
|
|
7577
7709
|
},
|
|
7578
7710
|
__drawAfterFill(canvas, options) {
|
|
@@ -7587,13 +7719,15 @@ var LeaferUI = (function (exports) {
|
|
|
7587
7719
|
}
|
|
7588
7720
|
};
|
|
7589
7721
|
function drawFast(ui, canvas, options) {
|
|
7590
|
-
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
7722
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke } = ui.__;
|
|
7591
7723
|
ui.__drawRenderPath(canvas);
|
|
7724
|
+
if (__fillAfterStroke)
|
|
7725
|
+
Paint.stroke(stroke, ui, canvas);
|
|
7592
7726
|
if (fill)
|
|
7593
7727
|
Paint.fill(fill, ui, canvas);
|
|
7594
7728
|
if (__drawAfterFill)
|
|
7595
7729
|
ui.__drawAfterFill(canvas, options);
|
|
7596
|
-
if (stroke)
|
|
7730
|
+
if (stroke && !__fillAfterStroke)
|
|
7597
7731
|
Paint.stroke(stroke, ui, canvas);
|
|
7598
7732
|
}
|
|
7599
7733
|
|
|
@@ -7723,6 +7857,9 @@ var LeaferUI = (function (exports) {
|
|
|
7723
7857
|
else
|
|
7724
7858
|
drawer.rect(x, y, width, height);
|
|
7725
7859
|
}
|
|
7860
|
+
drawImagePlaceholder(canvas, _image) {
|
|
7861
|
+
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7862
|
+
}
|
|
7726
7863
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7727
7864
|
return Plugin.need('animate');
|
|
7728
7865
|
}
|
|
@@ -7959,6 +8096,12 @@ var LeaferUI = (function (exports) {
|
|
|
7959
8096
|
__decorate([
|
|
7960
8097
|
effectType()
|
|
7961
8098
|
], exports.UI.prototype, "filter", void 0);
|
|
8099
|
+
__decorate([
|
|
8100
|
+
surfaceType()
|
|
8101
|
+
], exports.UI.prototype, "placeholderColor", void 0);
|
|
8102
|
+
__decorate([
|
|
8103
|
+
dataType(100)
|
|
8104
|
+
], exports.UI.prototype, "placeholderDelay", void 0);
|
|
7962
8105
|
__decorate([
|
|
7963
8106
|
dataType({})
|
|
7964
8107
|
], exports.UI.prototype, "data", void 0);
|
|
@@ -8360,15 +8503,20 @@ var LeaferUI = (function (exports) {
|
|
|
8360
8503
|
}
|
|
8361
8504
|
__listenEvents() {
|
|
8362
8505
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8363
|
-
this.once(
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8506
|
+
this.once([
|
|
8507
|
+
[LeaferEvent.START, () => Run.end(runId)],
|
|
8508
|
+
[LayoutEvent.START, this.updateLazyBounds, this],
|
|
8509
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
8510
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
8511
|
+
]);
|
|
8512
|
+
this.__eventIds.push(this.on_([
|
|
8513
|
+
[WatchEvent.DATA, this.__onWatchData, this],
|
|
8514
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
8515
|
+
[RenderEvent.NEXT, this.__onNextRender, this]
|
|
8516
|
+
]));
|
|
8368
8517
|
}
|
|
8369
8518
|
__removeListenEvents() {
|
|
8370
8519
|
this.off_(this.__eventIds);
|
|
8371
|
-
this.__eventIds.length = 0;
|
|
8372
8520
|
}
|
|
8373
8521
|
destroy(sync) {
|
|
8374
8522
|
const doDestory = () => {
|
|
@@ -8476,13 +8624,13 @@ var LeaferUI = (function (exports) {
|
|
|
8476
8624
|
super.__updateRenderBounds();
|
|
8477
8625
|
copy$3(childrenRenderBounds, renderBounds);
|
|
8478
8626
|
this.__updateRectRenderBounds();
|
|
8479
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8627
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8480
8628
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8481
8629
|
add(renderBounds, childrenRenderBounds);
|
|
8482
8630
|
}
|
|
8483
8631
|
else
|
|
8484
8632
|
this.__updateRectRenderBounds();
|
|
8485
|
-
|
|
8633
|
+
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8486
8634
|
}
|
|
8487
8635
|
__updateRectRenderBounds() { }
|
|
8488
8636
|
__updateRectChange() { }
|
|
@@ -8786,17 +8934,10 @@ var LeaferUI = (function (exports) {
|
|
|
8786
8934
|
|
|
8787
8935
|
exports.Image = class Image extends exports.Rect {
|
|
8788
8936
|
get __tag() { return 'Image'; }
|
|
8789
|
-
get ready() {
|
|
8937
|
+
get ready() { const { image } = this; return image && image.ready; }
|
|
8938
|
+
get image() { const { fill } = this.__; return fill instanceof Array && fill[0].image; }
|
|
8790
8939
|
constructor(data) {
|
|
8791
8940
|
super(data);
|
|
8792
|
-
this.on(ImageEvent.LOADED, (e) => {
|
|
8793
|
-
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8794
|
-
this.image = e.image;
|
|
8795
|
-
});
|
|
8796
|
-
}
|
|
8797
|
-
destroy() {
|
|
8798
|
-
this.image = null;
|
|
8799
|
-
super.destroy();
|
|
8800
8941
|
}
|
|
8801
8942
|
};
|
|
8802
8943
|
__decorate([
|
|
@@ -8812,11 +8953,11 @@ var LeaferUI = (function (exports) {
|
|
|
8812
8953
|
|
|
8813
8954
|
exports.Canvas = class Canvas extends exports.Rect {
|
|
8814
8955
|
get __tag() { return 'Canvas'; }
|
|
8956
|
+
get context() { return this.canvas.context; }
|
|
8815
8957
|
get ready() { return !this.url; }
|
|
8816
8958
|
constructor(data) {
|
|
8817
8959
|
super(data);
|
|
8818
8960
|
this.canvas = Creator.canvas(this.__);
|
|
8819
|
-
this.context = this.canvas.context;
|
|
8820
8961
|
if (data && data.url)
|
|
8821
8962
|
this.drawImage(data.url);
|
|
8822
8963
|
}
|
|
@@ -8860,7 +9001,7 @@ var LeaferUI = (function (exports) {
|
|
|
8860
9001
|
destroy() {
|
|
8861
9002
|
if (this.canvas) {
|
|
8862
9003
|
this.canvas.destroy();
|
|
8863
|
-
this.canvas =
|
|
9004
|
+
this.canvas = null;
|
|
8864
9005
|
}
|
|
8865
9006
|
super.destroy();
|
|
8866
9007
|
}
|
|
@@ -8906,7 +9047,7 @@ var LeaferUI = (function (exports) {
|
|
|
8906
9047
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8907
9048
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8908
9049
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8909
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
9050
|
+
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__);
|
|
8910
9051
|
}
|
|
8911
9052
|
__updateBoxBounds() {
|
|
8912
9053
|
const data = this.__;
|
|
@@ -8936,12 +9077,11 @@ var LeaferUI = (function (exports) {
|
|
|
8936
9077
|
super.__updateBoxBounds();
|
|
8937
9078
|
if (italic)
|
|
8938
9079
|
b.width += fontSize * 0.16;
|
|
8939
|
-
|
|
8940
|
-
if (isOverflow)
|
|
9080
|
+
DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds));
|
|
9081
|
+
if (this.isOverflow)
|
|
8941
9082
|
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8942
9083
|
else
|
|
8943
9084
|
data.__textBoxBounds = b;
|
|
8944
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8945
9085
|
}
|
|
8946
9086
|
__onUpdateSize() {
|
|
8947
9087
|
if (this.__box)
|
|
@@ -9004,6 +9144,9 @@ var LeaferUI = (function (exports) {
|
|
|
9004
9144
|
__decorate([
|
|
9005
9145
|
boundsType('')
|
|
9006
9146
|
], exports.Text.prototype, "text", void 0);
|
|
9147
|
+
__decorate([
|
|
9148
|
+
boundsType('')
|
|
9149
|
+
], exports.Text.prototype, "placeholder", void 0);
|
|
9007
9150
|
__decorate([
|
|
9008
9151
|
boundsType('caption')
|
|
9009
9152
|
], exports.Text.prototype, "fontFamily", void 0);
|
|
@@ -9139,7 +9282,7 @@ var LeaferUI = (function (exports) {
|
|
|
9139
9282
|
if (sky || editor)
|
|
9140
9283
|
this.sky = this.addLeafer(sky);
|
|
9141
9284
|
if (editor)
|
|
9142
|
-
|
|
9285
|
+
Creator.editor(editor, this);
|
|
9143
9286
|
}
|
|
9144
9287
|
}
|
|
9145
9288
|
__setApp() {
|
|
@@ -9153,6 +9296,10 @@ var LeaferUI = (function (exports) {
|
|
|
9153
9296
|
this.watcher.disable();
|
|
9154
9297
|
this.layouter.disable();
|
|
9155
9298
|
}
|
|
9299
|
+
__updateLocalBounds() {
|
|
9300
|
+
this.forEach(leafer => leafer.updateLayout());
|
|
9301
|
+
super.__updateLocalBounds();
|
|
9302
|
+
}
|
|
9156
9303
|
start() {
|
|
9157
9304
|
super.start();
|
|
9158
9305
|
this.forEach(leafer => leafer.start());
|
|
@@ -9210,12 +9357,8 @@ var LeaferUI = (function (exports) {
|
|
|
9210
9357
|
this.renderer.update();
|
|
9211
9358
|
}
|
|
9212
9359
|
__render(canvas, options) {
|
|
9213
|
-
if (canvas.context)
|
|
9214
|
-
|
|
9215
|
-
if (m)
|
|
9216
|
-
canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
9217
|
-
this.forEach(leafer => canvas.copyWorld(leafer.canvas));
|
|
9218
|
-
}
|
|
9360
|
+
if (canvas.context)
|
|
9361
|
+
this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
|
|
9219
9362
|
}
|
|
9220
9363
|
__onResize(event) {
|
|
9221
9364
|
this.forEach(leafer => leafer.resize(event));
|
|
@@ -9236,9 +9379,11 @@ var LeaferUI = (function (exports) {
|
|
|
9236
9379
|
return config;
|
|
9237
9380
|
}
|
|
9238
9381
|
__listenChildEvents(leafer) {
|
|
9239
|
-
leafer.once(
|
|
9240
|
-
|
|
9241
|
-
|
|
9382
|
+
leafer.once([
|
|
9383
|
+
[LayoutEvent.END, this.__onReady, this],
|
|
9384
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
9385
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
9386
|
+
]);
|
|
9242
9387
|
if (this.realCanvas)
|
|
9243
9388
|
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9244
9389
|
}
|
|
@@ -9449,7 +9594,7 @@ var LeaferUI = (function (exports) {
|
|
|
9449
9594
|
registerUIEvent()
|
|
9450
9595
|
], exports.MoveEvent);
|
|
9451
9596
|
|
|
9452
|
-
exports.RotateEvent = class RotateEvent extends
|
|
9597
|
+
exports.RotateEvent = class RotateEvent extends exports.PointerEvent {
|
|
9453
9598
|
};
|
|
9454
9599
|
exports.RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
|
|
9455
9600
|
exports.RotateEvent.START = 'rotate.start';
|
|
@@ -9470,7 +9615,7 @@ var LeaferUI = (function (exports) {
|
|
|
9470
9615
|
registerUIEvent()
|
|
9471
9616
|
], exports.SwipeEvent);
|
|
9472
9617
|
|
|
9473
|
-
exports.ZoomEvent = class ZoomEvent extends
|
|
9618
|
+
exports.ZoomEvent = class ZoomEvent extends exports.PointerEvent {
|
|
9474
9619
|
};
|
|
9475
9620
|
exports.ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
|
|
9476
9621
|
exports.ZoomEvent.START = 'zoom.start';
|
|
@@ -10313,8 +10458,8 @@ var LeaferUI = (function (exports) {
|
|
|
10313
10458
|
if (this.__box)
|
|
10314
10459
|
this.__box.__updateHitCanvas();
|
|
10315
10460
|
const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
|
|
10316
|
-
const isHitPixelFill = (data.
|
|
10317
|
-
const isHitPixelStroke = data.
|
|
10461
|
+
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
10462
|
+
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
10318
10463
|
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
10319
10464
|
if (!this.__hitCanvas)
|
|
10320
10465
|
this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
|
|
@@ -10345,11 +10490,11 @@ var LeaferUI = (function (exports) {
|
|
|
10345
10490
|
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
10346
10491
|
return true;
|
|
10347
10492
|
const { hitFill } = data;
|
|
10348
|
-
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.
|
|
10493
|
+
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
10349
10494
|
if (needHitFillPath && this.__hitFill(inner))
|
|
10350
10495
|
return true;
|
|
10351
10496
|
const { hitStroke, __strokeWidth } = data;
|
|
10352
|
-
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.
|
|
10497
|
+
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
10353
10498
|
if (!needHitFillPath && !needHitStrokePath)
|
|
10354
10499
|
return false;
|
|
10355
10500
|
const radiusWidth = inner.radiusX * 2;
|
|
@@ -10738,8 +10883,10 @@ var LeaferUI = (function (exports) {
|
|
|
10738
10883
|
}
|
|
10739
10884
|
|
|
10740
10885
|
function fillText(ui, canvas) {
|
|
10741
|
-
|
|
10742
|
-
|
|
10886
|
+
const data = ui.__, { rows, decorationY } = data.__textDrawData;
|
|
10887
|
+
if (data.__isPlacehold && data.placeholderColor)
|
|
10888
|
+
canvas.fillStyle = data.placeholderColor;
|
|
10889
|
+
let row;
|
|
10743
10890
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10744
10891
|
row = rows[i];
|
|
10745
10892
|
if (row.text)
|
|
@@ -10748,7 +10895,7 @@ var LeaferUI = (function (exports) {
|
|
|
10748
10895
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
10749
10896
|
}
|
|
10750
10897
|
if (decorationY) {
|
|
10751
|
-
const { decorationColor, decorationHeight } = data;
|
|
10898
|
+
const { decorationColor, decorationHeight } = data.__textDrawData;
|
|
10752
10899
|
if (decorationColor)
|
|
10753
10900
|
canvas.fillStyle = decorationColor;
|
|
10754
10901
|
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
@@ -10757,65 +10904,71 @@ var LeaferUI = (function (exports) {
|
|
|
10757
10904
|
|
|
10758
10905
|
function fill(fill, ui, canvas) {
|
|
10759
10906
|
canvas.fillStyle = fill;
|
|
10760
|
-
|
|
10907
|
+
fillPathOrText(ui, canvas);
|
|
10761
10908
|
}
|
|
10762
10909
|
function fills(fills, ui, canvas) {
|
|
10763
10910
|
let item;
|
|
10764
|
-
const { windingRule, __font } = ui.__;
|
|
10765
10911
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
10766
10912
|
item = fills[i];
|
|
10767
|
-
if (item.image
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
if (item.blendMode)
|
|
10775
|
-
canvas.blendMode = item.blendMode;
|
|
10776
|
-
__font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
|
|
10777
|
-
canvas.restore();
|
|
10913
|
+
if (item.image) {
|
|
10914
|
+
if (PaintImage.checkImage(ui, canvas, item, !ui.__.__font))
|
|
10915
|
+
continue;
|
|
10916
|
+
if (!item.style) {
|
|
10917
|
+
if (!i && item.image.isPlacehold)
|
|
10918
|
+
ui.drawImagePlaceholder(canvas, item.image);
|
|
10919
|
+
continue;
|
|
10778
10920
|
}
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10921
|
+
}
|
|
10922
|
+
canvas.fillStyle = item.style;
|
|
10923
|
+
if (item.transform) {
|
|
10924
|
+
canvas.save();
|
|
10925
|
+
canvas.transform(item.transform);
|
|
10926
|
+
if (item.blendMode)
|
|
10927
|
+
canvas.blendMode = item.blendMode;
|
|
10928
|
+
fillPathOrText(ui, canvas);
|
|
10929
|
+
canvas.restore();
|
|
10930
|
+
}
|
|
10931
|
+
else {
|
|
10932
|
+
if (item.blendMode) {
|
|
10933
|
+
canvas.saveBlendMode(item.blendMode);
|
|
10934
|
+
fillPathOrText(ui, canvas);
|
|
10935
|
+
canvas.restoreBlendMode();
|
|
10788
10936
|
}
|
|
10937
|
+
else
|
|
10938
|
+
fillPathOrText(ui, canvas);
|
|
10789
10939
|
}
|
|
10790
10940
|
}
|
|
10791
10941
|
}
|
|
10942
|
+
function fillPathOrText(ui, canvas) {
|
|
10943
|
+
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
10944
|
+
}
|
|
10792
10945
|
|
|
10793
10946
|
function strokeText(stroke, ui, canvas) {
|
|
10794
|
-
|
|
10795
|
-
const isStrokes = typeof stroke !== 'string';
|
|
10796
|
-
switch (strokeAlign) {
|
|
10947
|
+
switch (ui.__.strokeAlign) {
|
|
10797
10948
|
case 'center':
|
|
10798
|
-
|
|
10799
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
10949
|
+
drawCenter$1(stroke, 1, ui, canvas);
|
|
10800
10950
|
break;
|
|
10801
10951
|
case 'inside':
|
|
10802
|
-
|
|
10952
|
+
drawAlign(stroke, 'inside', ui, canvas);
|
|
10803
10953
|
break;
|
|
10804
10954
|
case 'outside':
|
|
10805
|
-
|
|
10955
|
+
ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, 'outside', ui, canvas);
|
|
10806
10956
|
break;
|
|
10807
10957
|
}
|
|
10808
10958
|
}
|
|
10809
|
-
function
|
|
10810
|
-
const
|
|
10959
|
+
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
10960
|
+
const data = ui.__;
|
|
10961
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
|
|
10962
|
+
data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
10963
|
+
}
|
|
10964
|
+
function drawAlign(stroke, align, ui, canvas) {
|
|
10811
10965
|
const out = canvas.getSameCanvas(true, true);
|
|
10812
|
-
out.
|
|
10813
|
-
|
|
10814
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
|
|
10966
|
+
out.font = ui.__.__font;
|
|
10967
|
+
drawCenter$1(stroke, 2, ui, out);
|
|
10815
10968
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10816
10969
|
fillText(ui, out);
|
|
10817
10970
|
out.blendMode = 'normal';
|
|
10818
|
-
if (ui.__worldFlipped)
|
|
10971
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
10819
10972
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10820
10973
|
else
|
|
10821
10974
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
@@ -10857,90 +11010,60 @@ var LeaferUI = (function (exports) {
|
|
|
10857
11010
|
}
|
|
10858
11011
|
|
|
10859
11012
|
function stroke(stroke, ui, canvas) {
|
|
10860
|
-
const
|
|
10861
|
-
|
|
10862
|
-
if (!__strokeWidth)
|
|
11013
|
+
const data = ui.__;
|
|
11014
|
+
if (!data.__strokeWidth)
|
|
10863
11015
|
return;
|
|
10864
|
-
if (__font) {
|
|
11016
|
+
if (data.__font) {
|
|
10865
11017
|
strokeText(stroke, ui, canvas);
|
|
10866
11018
|
}
|
|
10867
11019
|
else {
|
|
10868
|
-
switch (strokeAlign) {
|
|
11020
|
+
switch (data.strokeAlign) {
|
|
10869
11021
|
case 'center':
|
|
10870
|
-
|
|
10871
|
-
canvas.stroke();
|
|
10872
|
-
if (options.__useArrow)
|
|
10873
|
-
strokeArrow(ui, canvas);
|
|
11022
|
+
drawCenter(stroke, 1, ui, canvas);
|
|
10874
11023
|
break;
|
|
10875
11024
|
case 'inside':
|
|
10876
|
-
canvas
|
|
10877
|
-
canvas.setStroke(stroke, __strokeWidth * 2, options);
|
|
10878
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
10879
|
-
canvas.stroke();
|
|
10880
|
-
canvas.restore();
|
|
11025
|
+
drawInside(stroke, ui, canvas);
|
|
10881
11026
|
break;
|
|
10882
11027
|
case 'outside':
|
|
10883
|
-
|
|
10884
|
-
out.setStroke(stroke, __strokeWidth * 2, options);
|
|
10885
|
-
ui.__drawRenderPath(out);
|
|
10886
|
-
out.stroke();
|
|
10887
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10888
|
-
out.clearWorld(ui.__layout.renderBounds);
|
|
10889
|
-
if (ui.__worldFlipped)
|
|
10890
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10891
|
-
else
|
|
10892
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10893
|
-
out.recycle(ui.__nowWorld);
|
|
11028
|
+
drawOutside(stroke, ui, canvas);
|
|
10894
11029
|
break;
|
|
10895
11030
|
}
|
|
10896
11031
|
}
|
|
10897
11032
|
}
|
|
10898
11033
|
function strokes(strokes, ui, canvas) {
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
11034
|
+
stroke(strokes, ui, canvas);
|
|
11035
|
+
}
|
|
11036
|
+
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
11037
|
+
const data = ui.__;
|
|
11038
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
11039
|
+
data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
|
|
11040
|
+
if (data.__useArrow)
|
|
11041
|
+
Paint.strokeArrow(stroke, ui, canvas);
|
|
11042
|
+
}
|
|
11043
|
+
function drawInside(stroke, ui, canvas) {
|
|
11044
|
+
const data = ui.__;
|
|
11045
|
+
canvas.save();
|
|
11046
|
+
data.windingRule ? canvas.clip(data.windingRule) : canvas.clip();
|
|
11047
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
11048
|
+
canvas.restore();
|
|
11049
|
+
}
|
|
11050
|
+
function drawOutside(stroke, ui, canvas) {
|
|
11051
|
+
const data = ui.__;
|
|
11052
|
+
if (data.__fillAfterStroke) {
|
|
11053
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
10905
11054
|
}
|
|
10906
11055
|
else {
|
|
10907
|
-
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
drawStrokesStyle(strokes, false, ui, canvas);
|
|
10919
|
-
canvas.restore();
|
|
10920
|
-
break;
|
|
10921
|
-
case 'outside':
|
|
10922
|
-
const { renderBounds } = ui.__layout;
|
|
10923
|
-
const out = canvas.getSameCanvas(true, true);
|
|
10924
|
-
ui.__drawRenderPath(out);
|
|
10925
|
-
out.setStroke(undefined, __strokeWidth * 2, options);
|
|
10926
|
-
drawStrokesStyle(strokes, false, ui, out);
|
|
10927
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10928
|
-
out.clearWorld(renderBounds);
|
|
10929
|
-
if (ui.__worldFlipped)
|
|
10930
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10931
|
-
else
|
|
10932
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
10933
|
-
out.recycle(ui.__nowWorld);
|
|
10934
|
-
break;
|
|
10935
|
-
}
|
|
10936
|
-
}
|
|
10937
|
-
}
|
|
10938
|
-
function strokeArrow(ui, canvas) {
|
|
10939
|
-
if (ui.__.dashPattern) {
|
|
10940
|
-
canvas.beginPath();
|
|
10941
|
-
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
10942
|
-
canvas.dashPattern = null;
|
|
10943
|
-
canvas.stroke();
|
|
11056
|
+
const { renderBounds } = ui.__layout;
|
|
11057
|
+
const out = canvas.getSameCanvas(true, true);
|
|
11058
|
+
ui.__drawRenderPath(out);
|
|
11059
|
+
drawCenter(stroke, 2, ui, out);
|
|
11060
|
+
data.windingRule ? out.clip(data.windingRule) : out.clip();
|
|
11061
|
+
out.clearWorld(renderBounds);
|
|
11062
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
11063
|
+
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
11064
|
+
else
|
|
11065
|
+
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
11066
|
+
out.recycle(ui.__nowWorld);
|
|
10944
11067
|
}
|
|
10945
11068
|
}
|
|
10946
11069
|
|
|
@@ -10987,9 +11110,10 @@ var LeaferUI = (function (exports) {
|
|
|
10987
11110
|
}
|
|
10988
11111
|
|
|
10989
11112
|
let recycleMap;
|
|
11113
|
+
const { stintSet } = DataHelper, { hasTransparent: hasTransparent$1 } = ColorConvert;
|
|
10990
11114
|
function compute(attrName, ui) {
|
|
10991
11115
|
const data = ui.__, leafPaints = [];
|
|
10992
|
-
let paints = data.__input[attrName],
|
|
11116
|
+
let paints = data.__input[attrName], isAlphaPixel, isTransparent;
|
|
10993
11117
|
if (!(paints instanceof Array))
|
|
10994
11118
|
paints = [paints];
|
|
10995
11119
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
@@ -10999,35 +11123,62 @@ var LeaferUI = (function (exports) {
|
|
|
10999
11123
|
leafPaints.push(item);
|
|
11000
11124
|
}
|
|
11001
11125
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
11002
|
-
if (leafPaints.length
|
|
11003
|
-
|
|
11004
|
-
|
|
11126
|
+
if (leafPaints.length) {
|
|
11127
|
+
if (leafPaints.every(item => item.isTransparent)) {
|
|
11128
|
+
if (leafPaints.some(item => item.image))
|
|
11129
|
+
isAlphaPixel = true;
|
|
11130
|
+
isTransparent = true;
|
|
11131
|
+
}
|
|
11132
|
+
}
|
|
11133
|
+
if (attrName === 'fill') {
|
|
11134
|
+
stintSet(data, '__isAlphaPixelFill', isAlphaPixel);
|
|
11135
|
+
stintSet(data, '__isTransparentFill', isTransparent);
|
|
11136
|
+
}
|
|
11137
|
+
else {
|
|
11138
|
+
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
11139
|
+
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
11140
|
+
}
|
|
11005
11141
|
}
|
|
11006
11142
|
function getLeafPaint(attrName, paint, ui) {
|
|
11007
11143
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
|
11008
11144
|
return undefined;
|
|
11145
|
+
let data;
|
|
11009
11146
|
const { boxBounds } = ui.__layout;
|
|
11010
11147
|
switch (paint.type) {
|
|
11011
|
-
case 'solid':
|
|
11012
|
-
let { type, blendMode, color, opacity } = paint;
|
|
11013
|
-
return { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
11014
11148
|
case 'image':
|
|
11015
|
-
|
|
11149
|
+
data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
11150
|
+
break;
|
|
11016
11151
|
case 'linear':
|
|
11017
|
-
|
|
11152
|
+
data = PaintGradient.linearGradient(paint, boxBounds);
|
|
11153
|
+
break;
|
|
11018
11154
|
case 'radial':
|
|
11019
|
-
|
|
11155
|
+
data = PaintGradient.radialGradient(paint, boxBounds);
|
|
11156
|
+
break;
|
|
11020
11157
|
case 'angular':
|
|
11021
|
-
|
|
11158
|
+
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
11159
|
+
break;
|
|
11160
|
+
case 'solid':
|
|
11161
|
+
const { type, blendMode, color, opacity } = paint;
|
|
11162
|
+
data = { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
11163
|
+
break;
|
|
11022
11164
|
default:
|
|
11023
|
-
|
|
11165
|
+
if (paint.r !== undefined)
|
|
11166
|
+
data = { type: 'solid', style: ColorConvert.string(paint) };
|
|
11024
11167
|
}
|
|
11168
|
+
if (data) {
|
|
11169
|
+
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
11170
|
+
data.isTransparent = true;
|
|
11171
|
+
if (paint.blendMode)
|
|
11172
|
+
data.blendMode = paint.blendMode;
|
|
11173
|
+
}
|
|
11174
|
+
return data;
|
|
11025
11175
|
}
|
|
11026
11176
|
|
|
11027
11177
|
const PaintModule = {
|
|
11028
11178
|
compute,
|
|
11029
11179
|
fill,
|
|
11030
11180
|
fills,
|
|
11181
|
+
fillPathOrText,
|
|
11031
11182
|
fillText,
|
|
11032
11183
|
stroke,
|
|
11033
11184
|
strokes,
|
|
@@ -11086,12 +11237,10 @@ var LeaferUI = (function (exports) {
|
|
|
11086
11237
|
|
|
11087
11238
|
const { get: get$2, translate } = MatrixHelper;
|
|
11088
11239
|
const tempBox = new Bounds();
|
|
11089
|
-
const tempPoint = {};
|
|
11090
11240
|
const tempScaleData = {};
|
|
11241
|
+
const tempImage = {};
|
|
11091
11242
|
function createData(leafPaint, image, paint, box) {
|
|
11092
|
-
const {
|
|
11093
|
-
if (blendMode)
|
|
11094
|
-
leafPaint.blendMode = blendMode;
|
|
11243
|
+
const { changeful, sync } = paint;
|
|
11095
11244
|
if (changeful)
|
|
11096
11245
|
leafPaint.changeful = changeful;
|
|
11097
11246
|
if (sync)
|
|
@@ -11099,38 +11248,38 @@ var LeaferUI = (function (exports) {
|
|
|
11099
11248
|
leafPaint.data = getPatternData(paint, box, image);
|
|
11100
11249
|
}
|
|
11101
11250
|
function getPatternData(paint, box, image) {
|
|
11102
|
-
let { width, height } = image;
|
|
11103
11251
|
if (paint.padding)
|
|
11104
11252
|
box = tempBox.set(box).shrink(paint.padding);
|
|
11105
11253
|
if (paint.mode === 'strench')
|
|
11106
11254
|
paint.mode = 'stretch';
|
|
11255
|
+
let { width, height } = image;
|
|
11107
11256
|
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
11108
11257
|
const sameBox = box.width === width && box.height === height;
|
|
11109
11258
|
const data = { mode };
|
|
11110
11259
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
11111
|
-
|
|
11112
|
-
let
|
|
11260
|
+
BoundsHelper.set(tempImage, 0, 0, swapSize ? height : width, swapSize ? width : height);
|
|
11261
|
+
let scaleX, scaleY;
|
|
11113
11262
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
11114
11263
|
if (!sameBox || rotation) {
|
|
11115
|
-
|
|
11116
|
-
|
|
11117
|
-
|
|
11264
|
+
scaleX = scaleY = BoundsHelper.getFitScale(box, tempImage, mode !== 'fit');
|
|
11265
|
+
BoundsHelper.put(box, image, align, scaleX, false, tempImage);
|
|
11266
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
11118
11267
|
}
|
|
11119
11268
|
}
|
|
11120
|
-
else
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11269
|
+
else {
|
|
11270
|
+
if (scale || size) {
|
|
11271
|
+
MathHelper.getScaleData(scale, size, image, tempScaleData);
|
|
11272
|
+
scaleX = tempScaleData.scaleX;
|
|
11273
|
+
scaleY = tempScaleData.scaleY;
|
|
11274
|
+
}
|
|
11275
|
+
if (align) {
|
|
11276
|
+
if (scaleX)
|
|
11277
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
11278
|
+
AlignHelper.toPoint(align, tempImage, box, tempImage, true, true);
|
|
11279
|
+
}
|
|
11131
11280
|
}
|
|
11132
11281
|
if (offset)
|
|
11133
|
-
|
|
11282
|
+
PointHelper.move(tempImage, offset);
|
|
11134
11283
|
switch (mode) {
|
|
11135
11284
|
case 'stretch':
|
|
11136
11285
|
if (!sameBox)
|
|
@@ -11138,12 +11287,12 @@ var LeaferUI = (function (exports) {
|
|
|
11138
11287
|
break;
|
|
11139
11288
|
case 'normal':
|
|
11140
11289
|
case 'clip':
|
|
11141
|
-
if (x || y || scaleX || rotation)
|
|
11142
|
-
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
11290
|
+
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
11291
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
11143
11292
|
break;
|
|
11144
11293
|
case 'repeat':
|
|
11145
11294
|
if (!sameBox || scaleX || rotation)
|
|
11146
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
11295
|
+
repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, align);
|
|
11147
11296
|
if (!repeat)
|
|
11148
11297
|
data.repeat = 'repeat';
|
|
11149
11298
|
break;
|
|
@@ -11151,7 +11300,7 @@ var LeaferUI = (function (exports) {
|
|
|
11151
11300
|
case 'cover':
|
|
11152
11301
|
default:
|
|
11153
11302
|
if (scaleX)
|
|
11154
|
-
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
11303
|
+
fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
11155
11304
|
}
|
|
11156
11305
|
if (!data.transform) {
|
|
11157
11306
|
if (box.x || box.y) {
|
|
@@ -11184,6 +11333,8 @@ var LeaferUI = (function (exports) {
|
|
|
11184
11333
|
}
|
|
11185
11334
|
else {
|
|
11186
11335
|
leafPaint = { type: paint.type, image };
|
|
11336
|
+
if (image.hasAlphaPixel)
|
|
11337
|
+
leafPaint.isTransparent = true;
|
|
11187
11338
|
cache = image.use > 1 ? { leafPaint, paint, boxBounds: box.set(boxBounds) } : null;
|
|
11188
11339
|
}
|
|
11189
11340
|
if (firstUse || image.loading)
|
|
@@ -11208,7 +11359,7 @@ var LeaferUI = (function (exports) {
|
|
|
11208
11359
|
ignoreRender(ui, false);
|
|
11209
11360
|
if (!ui.destroyed) {
|
|
11210
11361
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
11211
|
-
if (image.
|
|
11362
|
+
if (image.hasAlphaPixel)
|
|
11212
11363
|
ui.__layout.hitCanvasChanged = true;
|
|
11213
11364
|
ui.forceUpdate('surface');
|
|
11214
11365
|
}
|
|
@@ -11220,6 +11371,17 @@ var LeaferUI = (function (exports) {
|
|
|
11220
11371
|
onLoadError(ui, event, error);
|
|
11221
11372
|
leafPaint.loadId = null;
|
|
11222
11373
|
});
|
|
11374
|
+
if (ui.placeholderColor) {
|
|
11375
|
+
if (!ui.placeholderDelay)
|
|
11376
|
+
image.isPlacehold = true;
|
|
11377
|
+
else
|
|
11378
|
+
setTimeout(() => {
|
|
11379
|
+
if (!image.ready) {
|
|
11380
|
+
image.isPlacehold = true;
|
|
11381
|
+
ui.forceUpdate('surface');
|
|
11382
|
+
}
|
|
11383
|
+
}, ui.placeholderDelay);
|
|
11384
|
+
}
|
|
11223
11385
|
}
|
|
11224
11386
|
return leafPaint;
|
|
11225
11387
|
}
|
|
@@ -11425,32 +11587,33 @@ var LeaferUI = (function (exports) {
|
|
|
11425
11587
|
repeatMode
|
|
11426
11588
|
};
|
|
11427
11589
|
|
|
11428
|
-
const { toPoint: toPoint$2 } = AroundHelper;
|
|
11590
|
+
const { toPoint: toPoint$2 } = AroundHelper, { hasTransparent } = ColorConvert;
|
|
11429
11591
|
const realFrom$2 = {};
|
|
11430
11592
|
const realTo$2 = {};
|
|
11431
11593
|
function linearGradient(paint, box) {
|
|
11432
|
-
let { from, to, type,
|
|
11594
|
+
let { from, to, type, opacity } = paint;
|
|
11433
11595
|
toPoint$2(from || 'top', box, realFrom$2);
|
|
11434
11596
|
toPoint$2(to || 'bottom', box, realTo$2);
|
|
11435
11597
|
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
11436
|
-
applyStops(style, paint.stops, opacity);
|
|
11437
11598
|
const data = { type, style };
|
|
11438
|
-
|
|
11439
|
-
data.blendMode = blendMode;
|
|
11599
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11440
11600
|
return data;
|
|
11441
11601
|
}
|
|
11442
|
-
function applyStops(gradient, stops, opacity) {
|
|
11602
|
+
function applyStops(data, gradient, stops, opacity) {
|
|
11443
11603
|
if (stops) {
|
|
11444
|
-
let stop;
|
|
11604
|
+
let stop, color, offset, isTransparent;
|
|
11445
11605
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
11446
11606
|
stop = stops[i];
|
|
11447
|
-
if (typeof stop === 'string')
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11607
|
+
if (typeof stop === 'string')
|
|
11608
|
+
offset = i / (len - 1), color = ColorConvert.string(stop, opacity);
|
|
11609
|
+
else
|
|
11610
|
+
offset = stop.offset, color = ColorConvert.string(stop.color, opacity);
|
|
11611
|
+
gradient.addColorStop(offset, color);
|
|
11612
|
+
if (!isTransparent && hasTransparent(color))
|
|
11613
|
+
isTransparent = true;
|
|
11453
11614
|
}
|
|
11615
|
+
if (isTransparent)
|
|
11616
|
+
data.isTransparent = true;
|
|
11454
11617
|
}
|
|
11455
11618
|
}
|
|
11456
11619
|
|
|
@@ -11460,17 +11623,15 @@ var LeaferUI = (function (exports) {
|
|
|
11460
11623
|
const realFrom$1 = {};
|
|
11461
11624
|
const realTo$1 = {};
|
|
11462
11625
|
function radialGradient(paint, box) {
|
|
11463
|
-
let { from, to, type, opacity,
|
|
11626
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
11464
11627
|
toPoint$1(from || 'center', box, realFrom$1);
|
|
11465
11628
|
toPoint$1(to || 'bottom', box, realTo$1);
|
|
11466
11629
|
const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$1(realFrom$1, realTo$1));
|
|
11467
|
-
applyStops(style, paint.stops, opacity);
|
|
11468
11630
|
const data = { type, style };
|
|
11631
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11469
11632
|
const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
|
|
11470
11633
|
if (transform)
|
|
11471
11634
|
data.transform = transform;
|
|
11472
|
-
if (blendMode)
|
|
11473
|
-
data.blendMode = blendMode;
|
|
11474
11635
|
return data;
|
|
11475
11636
|
}
|
|
11476
11637
|
function getTransform(box, from, to, stretch, rotate90) {
|
|
@@ -11496,17 +11657,15 @@ var LeaferUI = (function (exports) {
|
|
|
11496
11657
|
const realFrom = {};
|
|
11497
11658
|
const realTo = {};
|
|
11498
11659
|
function conicGradient(paint, box) {
|
|
11499
|
-
let { from, to, type, opacity,
|
|
11660
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
11500
11661
|
toPoint(from || 'center', box, realFrom);
|
|
11501
11662
|
toPoint(to || 'bottom', box, realTo);
|
|
11502
11663
|
const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance(realFrom, realTo));
|
|
11503
|
-
applyStops(style, paint.stops, opacity);
|
|
11504
11664
|
const data = { type, style };
|
|
11665
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11505
11666
|
const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
|
|
11506
11667
|
if (transform)
|
|
11507
11668
|
data.transform = transform;
|
|
11508
|
-
if (blendMode)
|
|
11509
|
-
data.blendMode = blendMode;
|
|
11510
11669
|
return data;
|
|
11511
11670
|
}
|
|
11512
11671
|
|
|
@@ -11839,6 +11998,8 @@ var LeaferUI = (function (exports) {
|
|
|
11839
11998
|
lastCharType = null;
|
|
11840
11999
|
startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
|
|
11841
12000
|
word = { data: [] }, row = { words: [] };
|
|
12001
|
+
if (__letterSpacing)
|
|
12002
|
+
content = [...content];
|
|
11842
12003
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
11843
12004
|
char = content[i];
|
|
11844
12005
|
if (char === '\n') {
|
|
@@ -12262,6 +12423,7 @@ var LeaferUI = (function (exports) {
|
|
|
12262
12423
|
exports.AutoBounds = AutoBounds;
|
|
12263
12424
|
exports.BezierHelper = BezierHelper;
|
|
12264
12425
|
exports.Bounds = Bounds;
|
|
12426
|
+
exports.BoundsEvent = BoundsEvent;
|
|
12265
12427
|
exports.BoundsHelper = BoundsHelper;
|
|
12266
12428
|
exports.BoxData = BoxData;
|
|
12267
12429
|
exports.BranchHelper = BranchHelper;
|
|
@@ -12421,7 +12583,7 @@ var LeaferUI = (function (exports) {
|
|
|
12421
12583
|
exports.surfaceType = surfaceType;
|
|
12422
12584
|
exports.tempBounds = tempBounds$1;
|
|
12423
12585
|
exports.tempMatrix = tempMatrix;
|
|
12424
|
-
exports.tempPoint = tempPoint$
|
|
12586
|
+
exports.tempPoint = tempPoint$2;
|
|
12425
12587
|
exports.useCanvas = useCanvas;
|
|
12426
12588
|
exports.useModule = useModule;
|
|
12427
12589
|
exports.version = version;
|
|
@@ -12431,4 +12593,7 @@ var LeaferUI = (function (exports) {
|
|
|
12431
12593
|
return exports;
|
|
12432
12594
|
|
|
12433
12595
|
})({});
|
|
12434
|
-
|
|
12596
|
+
|
|
12597
|
+
function Leafer(opt) { return new LeaferUI.Leafer(opt); }
|
|
12598
|
+
Object.setPrototypeOf(Leafer, LeaferUI);
|
|
12599
|
+
Leafer.prototype = LeaferUI.Leafer.prototype;
|