leafer-ui 1.6.2 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web.cjs +171 -172
- package/dist/web.esm.js +175 -176
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +537 -408
- 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 +536 -408
- 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.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) {
|
|
@@ -3389,7 +3415,7 @@ var LeaferUI = (function (exports) {
|
|
|
3389
3415
|
}
|
|
3390
3416
|
|
|
3391
3417
|
const FileHelper = {
|
|
3392
|
-
|
|
3418
|
+
alphaPixelTypes: ['png', 'webp', 'svg'],
|
|
3393
3419
|
upperCaseTypeMap: {},
|
|
3394
3420
|
mineType(type) {
|
|
3395
3421
|
if (!type || type.startsWith('image'))
|
|
@@ -3416,7 +3442,7 @@ var LeaferUI = (function (exports) {
|
|
|
3416
3442
|
}
|
|
3417
3443
|
};
|
|
3418
3444
|
const F = FileHelper;
|
|
3419
|
-
F.
|
|
3445
|
+
F.alphaPixelTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3420
3446
|
|
|
3421
3447
|
const debug$a = Debug.get('TaskProcessor');
|
|
3422
3448
|
class TaskItem {
|
|
@@ -3733,8 +3759,8 @@ var LeaferUI = (function (exports) {
|
|
|
3733
3759
|
list.length = 0;
|
|
3734
3760
|
}
|
|
3735
3761
|
},
|
|
3736
|
-
|
|
3737
|
-
return FileHelper.
|
|
3762
|
+
hasAlphaPixel(config) {
|
|
3763
|
+
return FileHelper.alphaPixelTypes.some(item => I$1.isFormat(item, config));
|
|
3738
3764
|
},
|
|
3739
3765
|
isFormat(format, config) {
|
|
3740
3766
|
if (config.format === format)
|
|
@@ -3772,7 +3798,7 @@ var LeaferUI = (function (exports) {
|
|
|
3772
3798
|
this.setView(view.config ? view.view : view);
|
|
3773
3799
|
}
|
|
3774
3800
|
ImageManager.isFormat('svg', config) && (this.isSVG = true);
|
|
3775
|
-
ImageManager.
|
|
3801
|
+
ImageManager.hasAlphaPixel(config) && (this.hasAlphaPixel = true);
|
|
3776
3802
|
}
|
|
3777
3803
|
load(onSuccess, onError) {
|
|
3778
3804
|
if (!this.loading) {
|
|
@@ -4460,7 +4486,7 @@ var LeaferUI = (function (exports) {
|
|
|
4460
4486
|
}
|
|
4461
4487
|
};
|
|
4462
4488
|
|
|
4463
|
-
const { updateBounds: updateBounds$
|
|
4489
|
+
const { updateBounds: updateBounds$3 } = LeafHelper;
|
|
4464
4490
|
const BranchHelper = {
|
|
4465
4491
|
sort(a, b) {
|
|
4466
4492
|
return (a.__.zIndex === b.__.zIndex) ? (a.__tempNumber - b.__tempNumber) : (a.__.zIndex - b.__.zIndex);
|
|
@@ -4522,11 +4548,11 @@ var LeaferUI = (function (exports) {
|
|
|
4522
4548
|
branch = branchStack[i];
|
|
4523
4549
|
children = branch.children;
|
|
4524
4550
|
for (let j = 0, len = children.length; j < len; j++) {
|
|
4525
|
-
updateBounds$
|
|
4551
|
+
updateBounds$3(children[j]);
|
|
4526
4552
|
}
|
|
4527
4553
|
if (exclude && exclude === branch)
|
|
4528
4554
|
continue;
|
|
4529
|
-
updateBounds$
|
|
4555
|
+
updateBounds$3(branch);
|
|
4530
4556
|
}
|
|
4531
4557
|
}
|
|
4532
4558
|
};
|
|
@@ -4544,7 +4570,7 @@ var LeaferUI = (function (exports) {
|
|
|
4544
4570
|
}
|
|
4545
4571
|
};
|
|
4546
4572
|
|
|
4547
|
-
const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
|
|
4573
|
+
const { getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2 } = LeafHelper;
|
|
4548
4574
|
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$6 } = BoundsHelper;
|
|
4549
4575
|
const localContent = '_localContentBounds';
|
|
4550
4576
|
const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
|
|
@@ -4588,7 +4614,9 @@ var LeaferUI = (function (exports) {
|
|
|
4588
4614
|
this._localRenderBounds = local;
|
|
4589
4615
|
}
|
|
4590
4616
|
update() {
|
|
4591
|
-
const { leafer } =
|
|
4617
|
+
const { leaf } = this, { leafer } = leaf;
|
|
4618
|
+
if (leaf.isApp)
|
|
4619
|
+
return updateBounds$2(leaf);
|
|
4592
4620
|
if (leafer) {
|
|
4593
4621
|
if (leafer.ready)
|
|
4594
4622
|
leafer.watcher.changed && leafer.layouter.layout();
|
|
@@ -4596,7 +4624,7 @@ var LeaferUI = (function (exports) {
|
|
|
4596
4624
|
leafer.start();
|
|
4597
4625
|
}
|
|
4598
4626
|
else {
|
|
4599
|
-
let root =
|
|
4627
|
+
let root = leaf;
|
|
4600
4628
|
while (root.parent && !root.parent.leafer) {
|
|
4601
4629
|
root = root.parent;
|
|
4602
4630
|
}
|
|
@@ -4818,7 +4846,7 @@ var LeaferUI = (function (exports) {
|
|
|
4818
4846
|
}
|
|
4819
4847
|
childrenSortChange() {
|
|
4820
4848
|
if (!this.childrenSortChanged) {
|
|
4821
|
-
this.childrenSortChanged = true;
|
|
4849
|
+
this.childrenSortChanged = this.affectChildrenSort = true;
|
|
4822
4850
|
this.leaf.forceUpdate('surface');
|
|
4823
4851
|
}
|
|
4824
4852
|
}
|
|
@@ -4885,6 +4913,40 @@ var LeaferUI = (function (exports) {
|
|
|
4885
4913
|
ImageEvent.LOADED = 'image.loaded';
|
|
4886
4914
|
ImageEvent.ERROR = 'image.error';
|
|
4887
4915
|
|
|
4916
|
+
class BoundsEvent extends Event {
|
|
4917
|
+
static checkHas(leaf, type, mode) {
|
|
4918
|
+
if (mode === 'on') {
|
|
4919
|
+
type === WORLD ? leaf.__hasWorldEvent = true : leaf.__hasLocalEvent = true;
|
|
4920
|
+
}
|
|
4921
|
+
else {
|
|
4922
|
+
leaf.__hasLocalEvent = leaf.hasEvent(RESIZE) || leaf.hasEvent(INNER) || leaf.hasEvent(LOCAL);
|
|
4923
|
+
leaf.__hasWorldEvent = leaf.hasEvent(WORLD);
|
|
4924
|
+
}
|
|
4925
|
+
}
|
|
4926
|
+
static emitLocal(leaf) {
|
|
4927
|
+
if (leaf.leaferIsReady) {
|
|
4928
|
+
const { resized } = leaf.__layout;
|
|
4929
|
+
if (resized !== 'local') {
|
|
4930
|
+
leaf.emit(RESIZE, leaf);
|
|
4931
|
+
if (resized === 'inner')
|
|
4932
|
+
leaf.emit(INNER, leaf);
|
|
4933
|
+
}
|
|
4934
|
+
leaf.emit(LOCAL, leaf);
|
|
4935
|
+
}
|
|
4936
|
+
}
|
|
4937
|
+
static emitWorld(leaf) {
|
|
4938
|
+
if (leaf.leaferIsReady)
|
|
4939
|
+
leaf.emit(WORLD, this);
|
|
4940
|
+
}
|
|
4941
|
+
}
|
|
4942
|
+
BoundsEvent.RESIZE = 'bounds.resize';
|
|
4943
|
+
BoundsEvent.INNER = 'bounds.inner';
|
|
4944
|
+
BoundsEvent.LOCAL = 'bounds.local';
|
|
4945
|
+
BoundsEvent.WORLD = 'bounds.world';
|
|
4946
|
+
const { RESIZE, INNER, LOCAL, WORLD } = BoundsEvent;
|
|
4947
|
+
const boundsEventMap = {};
|
|
4948
|
+
[RESIZE, INNER, LOCAL, WORLD].forEach(key => boundsEventMap[key] = 1);
|
|
4949
|
+
|
|
4888
4950
|
class ResizeEvent extends Event {
|
|
4889
4951
|
get bigger() {
|
|
4890
4952
|
if (!this.old)
|
|
@@ -4981,9 +5043,12 @@ var LeaferUI = (function (exports) {
|
|
|
4981
5043
|
set event(map) { this.on(map); }
|
|
4982
5044
|
on(type, listener, options) {
|
|
4983
5045
|
if (!listener) {
|
|
4984
|
-
let event
|
|
4985
|
-
|
|
4986
|
-
|
|
5046
|
+
let event;
|
|
5047
|
+
if (type instanceof Array)
|
|
5048
|
+
type.forEach(item => this.on(item[0], item[1], item[2]));
|
|
5049
|
+
else
|
|
5050
|
+
for (let key in type)
|
|
5051
|
+
(event = type[key]) instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event);
|
|
4987
5052
|
return;
|
|
4988
5053
|
}
|
|
4989
5054
|
let capture, once;
|
|
@@ -5013,6 +5078,8 @@ var LeaferUI = (function (exports) {
|
|
|
5013
5078
|
else {
|
|
5014
5079
|
map[type] = [item];
|
|
5015
5080
|
}
|
|
5081
|
+
if (boundsEventMap[type])
|
|
5082
|
+
BoundsEvent.checkHas(this, type, 'on');
|
|
5016
5083
|
}
|
|
5017
5084
|
});
|
|
5018
5085
|
}
|
|
@@ -5034,6 +5101,8 @@ var LeaferUI = (function (exports) {
|
|
|
5034
5101
|
events.splice(index, 1);
|
|
5035
5102
|
if (!events.length)
|
|
5036
5103
|
delete map[type];
|
|
5104
|
+
if (boundsEventMap[type])
|
|
5105
|
+
BoundsEvent.checkHas(this, type, 'off');
|
|
5037
5106
|
}
|
|
5038
5107
|
}
|
|
5039
5108
|
});
|
|
@@ -5053,19 +5122,31 @@ var LeaferUI = (function (exports) {
|
|
|
5053
5122
|
}
|
|
5054
5123
|
}
|
|
5055
5124
|
on_(type, listener, bind, options) {
|
|
5056
|
-
if (
|
|
5057
|
-
|
|
5058
|
-
|
|
5125
|
+
if (!listener)
|
|
5126
|
+
(type instanceof Array) && type.forEach(item => this.on(item[0], item[2] ? item[1] = item[1].bind(item[2]) : item[1], item[3]));
|
|
5127
|
+
else
|
|
5128
|
+
this.on(type, bind ? listener = listener.bind(bind) : listener, options);
|
|
5059
5129
|
return { type, current: this, listener, options };
|
|
5060
5130
|
}
|
|
5061
5131
|
off_(id) {
|
|
5062
5132
|
if (!id)
|
|
5063
5133
|
return;
|
|
5064
5134
|
const list = id instanceof Array ? id : [id];
|
|
5065
|
-
list.forEach(item =>
|
|
5135
|
+
list.forEach(item => {
|
|
5136
|
+
if (!item.listener)
|
|
5137
|
+
(item.type instanceof Array) && item.type.forEach(v => item.current.off(v[0], v[1], v[3]));
|
|
5138
|
+
else
|
|
5139
|
+
item.current.off(item.type, item.listener, item.options);
|
|
5140
|
+
});
|
|
5066
5141
|
list.length = 0;
|
|
5067
5142
|
}
|
|
5068
|
-
once(type, listener, capture) {
|
|
5143
|
+
once(type, listener, captureOrBind, capture) {
|
|
5144
|
+
if (!listener)
|
|
5145
|
+
return (type instanceof Array) && type.forEach(item => this.once(item[0], item[1], item[2], item[3]));
|
|
5146
|
+
if (typeof captureOrBind === 'object')
|
|
5147
|
+
listener = listener.bind(captureOrBind);
|
|
5148
|
+
else
|
|
5149
|
+
capture = captureOrBind;
|
|
5069
5150
|
this.on(type, listener, { once: true, capture });
|
|
5070
5151
|
}
|
|
5071
5152
|
emit(type, event, capture) {
|
|
@@ -5177,7 +5258,7 @@ var LeaferUI = (function (exports) {
|
|
|
5177
5258
|
};
|
|
5178
5259
|
|
|
5179
5260
|
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
5180
|
-
const { toPoint: toPoint$3, tempPoint
|
|
5261
|
+
const { toPoint: toPoint$3, tempPoint } = AroundHelper;
|
|
5181
5262
|
const LeafMatrix = {
|
|
5182
5263
|
__updateWorldMatrix() {
|
|
5183
5264
|
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
|
|
@@ -5186,19 +5267,19 @@ var LeaferUI = (function (exports) {
|
|
|
5186
5267
|
if (this.__local) {
|
|
5187
5268
|
const layout = this.__layout, local = this.__local, data = this.__;
|
|
5188
5269
|
if (layout.affectScaleOrRotation) {
|
|
5189
|
-
if (layout.scaleChanged || layout.rotationChanged) {
|
|
5270
|
+
if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
|
|
5190
5271
|
setLayout(local, data, null, null, layout.affectRotation);
|
|
5191
|
-
layout.scaleChanged = layout.rotationChanged =
|
|
5272
|
+
layout.scaleChanged = layout.rotationChanged = undefined;
|
|
5192
5273
|
}
|
|
5193
5274
|
}
|
|
5194
5275
|
local.e = data.x + data.offsetX;
|
|
5195
5276
|
local.f = data.y + data.offsetY;
|
|
5196
5277
|
if (data.around || data.origin) {
|
|
5197
|
-
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint
|
|
5198
|
-
translateInner(local, -tempPoint
|
|
5278
|
+
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint);
|
|
5279
|
+
translateInner(local, -tempPoint.x, -tempPoint.y, !data.around);
|
|
5199
5280
|
}
|
|
5200
5281
|
}
|
|
5201
|
-
this.__layout.matrixChanged =
|
|
5282
|
+
this.__layout.matrixChanged = undefined;
|
|
5202
5283
|
}
|
|
5203
5284
|
};
|
|
5204
5285
|
|
|
@@ -5208,11 +5289,17 @@ var LeaferUI = (function (exports) {
|
|
|
5208
5289
|
const { toBounds: toBounds$1 } = PathBounds;
|
|
5209
5290
|
const LeafBounds = {
|
|
5210
5291
|
__updateWorldBounds() {
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5292
|
+
const layout = this.__layout;
|
|
5293
|
+
toOuterOf$1(layout.renderBounds, this.__world, this.__world);
|
|
5294
|
+
if (layout.resized) {
|
|
5295
|
+
if (layout.resized === 'inner')
|
|
5296
|
+
this.__onUpdateSize();
|
|
5297
|
+
if (this.__hasLocalEvent)
|
|
5298
|
+
BoundsEvent.emitLocal(this);
|
|
5299
|
+
layout.resized = undefined;
|
|
5215
5300
|
}
|
|
5301
|
+
if (this.__hasWorldEvent)
|
|
5302
|
+
BoundsEvent.emitWorld(this);
|
|
5216
5303
|
},
|
|
5217
5304
|
__updateLocalBounds() {
|
|
5218
5305
|
const layout = this.__layout;
|
|
@@ -5221,12 +5308,12 @@ var LeaferUI = (function (exports) {
|
|
|
5221
5308
|
this.__updatePath();
|
|
5222
5309
|
this.__updateRenderPath();
|
|
5223
5310
|
this.__updateBoxBounds();
|
|
5224
|
-
layout.resized =
|
|
5311
|
+
layout.resized = 'inner';
|
|
5225
5312
|
}
|
|
5226
5313
|
if (layout.localBoxChanged) {
|
|
5227
5314
|
if (this.__local)
|
|
5228
5315
|
this.__updateLocalBoxBounds();
|
|
5229
|
-
layout.localBoxChanged =
|
|
5316
|
+
layout.localBoxChanged = undefined;
|
|
5230
5317
|
if (layout.strokeSpread)
|
|
5231
5318
|
layout.strokeChanged = true;
|
|
5232
5319
|
if (layout.renderSpread)
|
|
@@ -5234,7 +5321,7 @@ var LeaferUI = (function (exports) {
|
|
|
5234
5321
|
if (this.parent)
|
|
5235
5322
|
this.parent.__layout.boxChange();
|
|
5236
5323
|
}
|
|
5237
|
-
layout.boxChanged =
|
|
5324
|
+
layout.boxChanged = undefined;
|
|
5238
5325
|
if (layout.strokeChanged) {
|
|
5239
5326
|
layout.strokeSpread = this.__updateStrokeSpread();
|
|
5240
5327
|
if (layout.strokeSpread) {
|
|
@@ -5246,12 +5333,12 @@ var LeaferUI = (function (exports) {
|
|
|
5246
5333
|
else {
|
|
5247
5334
|
layout.spreadStrokeCancel();
|
|
5248
5335
|
}
|
|
5249
|
-
layout.strokeChanged =
|
|
5336
|
+
layout.strokeChanged = undefined;
|
|
5250
5337
|
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
|
|
5251
5338
|
layout.renderChanged = true;
|
|
5252
5339
|
if (this.parent)
|
|
5253
5340
|
this.parent.__layout.strokeChange();
|
|
5254
|
-
layout.resized =
|
|
5341
|
+
layout.resized = 'inner';
|
|
5255
5342
|
}
|
|
5256
5343
|
if (layout.renderChanged) {
|
|
5257
5344
|
layout.renderSpread = this.__updateRenderSpread();
|
|
@@ -5264,11 +5351,12 @@ var LeaferUI = (function (exports) {
|
|
|
5264
5351
|
else {
|
|
5265
5352
|
layout.spreadRenderCancel();
|
|
5266
5353
|
}
|
|
5267
|
-
layout.renderChanged =
|
|
5354
|
+
layout.renderChanged = undefined;
|
|
5268
5355
|
if (this.parent)
|
|
5269
5356
|
this.parent.__layout.renderChange();
|
|
5270
5357
|
}
|
|
5271
|
-
layout.
|
|
5358
|
+
layout.resized || (layout.resized = 'local');
|
|
5359
|
+
layout.boundsChanged = undefined;
|
|
5272
5360
|
},
|
|
5273
5361
|
__updateLocalBoxBounds() {
|
|
5274
5362
|
if (this.__hasMotionPath)
|
|
@@ -5808,7 +5896,7 @@ var LeaferUI = (function (exports) {
|
|
|
5808
5896
|
off(_type, _listener, _options) { }
|
|
5809
5897
|
on_(_type, _listener, _bind, _options) { return undefined; }
|
|
5810
5898
|
off_(_id) { }
|
|
5811
|
-
once(_type, _listener, _capture) { }
|
|
5899
|
+
once(_type, _listener, _captureOrBind, _capture) { }
|
|
5812
5900
|
emit(_type, _event, _capture) { }
|
|
5813
5901
|
emitEvent(_event, _capture) { }
|
|
5814
5902
|
hasEvent(_type, _capture) { return false; }
|
|
@@ -6145,7 +6233,7 @@ var LeaferUI = (function (exports) {
|
|
|
6145
6233
|
}
|
|
6146
6234
|
}
|
|
6147
6235
|
|
|
6148
|
-
const version = "1.6.
|
|
6236
|
+
const version = "1.6.3";
|
|
6149
6237
|
|
|
6150
6238
|
const debug$5 = Debug.get('LeaferCanvas');
|
|
6151
6239
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6485,17 +6573,15 @@ var LeaferUI = (function (exports) {
|
|
|
6485
6573
|
this.target.emitEvent(new WatchEvent(WatchEvent.DATA, { updatedList: this.updatedList }));
|
|
6486
6574
|
this.__updatedList = new LeafList();
|
|
6487
6575
|
this.totalTimes++;
|
|
6488
|
-
this.changed = false;
|
|
6489
|
-
this.hasVisible = false;
|
|
6490
|
-
this.hasRemove = false;
|
|
6491
|
-
this.hasAdd = false;
|
|
6576
|
+
this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
6492
6577
|
}
|
|
6493
6578
|
__listenEvents() {
|
|
6494
|
-
const { target } = this;
|
|
6495
6579
|
this.__eventIds = [
|
|
6496
|
-
target.on_(
|
|
6497
|
-
|
|
6498
|
-
|
|
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
|
+
])
|
|
6499
6585
|
];
|
|
6500
6586
|
}
|
|
6501
6587
|
__removeListenEvents() {
|
|
@@ -6505,8 +6591,7 @@ var LeaferUI = (function (exports) {
|
|
|
6505
6591
|
if (this.target) {
|
|
6506
6592
|
this.stop();
|
|
6507
6593
|
this.__removeListenEvents();
|
|
6508
|
-
this.target = null;
|
|
6509
|
-
this.__updatedList = null;
|
|
6594
|
+
this.target = this.__updatedList = null;
|
|
6510
6595
|
}
|
|
6511
6596
|
}
|
|
6512
6597
|
}
|
|
@@ -6611,7 +6696,7 @@ var LeaferUI = (function (exports) {
|
|
|
6611
6696
|
this.disabled = true;
|
|
6612
6697
|
}
|
|
6613
6698
|
layout() {
|
|
6614
|
-
if (!this.running)
|
|
6699
|
+
if (this.layouting || !this.running)
|
|
6615
6700
|
return;
|
|
6616
6701
|
const { target } = this;
|
|
6617
6702
|
this.times = 0;
|
|
@@ -6694,12 +6779,10 @@ var LeaferUI = (function (exports) {
|
|
|
6694
6779
|
}
|
|
6695
6780
|
static fullLayout(target) {
|
|
6696
6781
|
updateAllMatrix(target, true);
|
|
6697
|
-
if (target.isBranch)
|
|
6782
|
+
if (target.isBranch)
|
|
6698
6783
|
BranchHelper.updateBounds(target);
|
|
6699
|
-
|
|
6700
|
-
else {
|
|
6784
|
+
else
|
|
6701
6785
|
LeafHelper.updateBounds(target);
|
|
6702
|
-
}
|
|
6703
6786
|
updateAllChange(target);
|
|
6704
6787
|
}
|
|
6705
6788
|
addExtra(leaf) {
|
|
@@ -6722,11 +6805,12 @@ var LeaferUI = (function (exports) {
|
|
|
6722
6805
|
this.__updatedList = event.data.updatedList;
|
|
6723
6806
|
}
|
|
6724
6807
|
__listenEvents() {
|
|
6725
|
-
const { target } = this;
|
|
6726
6808
|
this.__eventIds = [
|
|
6727
|
-
target.on_(
|
|
6728
|
-
|
|
6729
|
-
|
|
6809
|
+
this.target.on_([
|
|
6810
|
+
[LayoutEvent.REQUEST, this.layout, this],
|
|
6811
|
+
[LayoutEvent.AGAIN, this.layoutAgain, this],
|
|
6812
|
+
[WatchEvent.DATA, this.__onReceiveWatchData, this]
|
|
6813
|
+
])
|
|
6730
6814
|
];
|
|
6731
6815
|
}
|
|
6732
6816
|
__removeListenEvents() {
|
|
@@ -6957,12 +7041,13 @@ var LeaferUI = (function (exports) {
|
|
|
6957
7041
|
this.target.emitEvent(new RenderEvent(type, this.times, bounds, options));
|
|
6958
7042
|
}
|
|
6959
7043
|
__listenEvents() {
|
|
6960
|
-
const { target } = this;
|
|
6961
7044
|
this.__eventIds = [
|
|
6962
|
-
target.on_(
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
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
|
+
])
|
|
6966
7051
|
];
|
|
6967
7052
|
}
|
|
6968
7053
|
__removeListenEvents() {
|
|
@@ -7178,8 +7263,32 @@ var LeaferUI = (function (exports) {
|
|
|
7178
7263
|
};
|
|
7179
7264
|
}
|
|
7180
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
|
+
|
|
7181
7288
|
const TextConvert = {};
|
|
7182
|
-
const ColorConvert = {
|
|
7289
|
+
const ColorConvert = {
|
|
7290
|
+
hasTransparent: hasTransparent$3
|
|
7291
|
+
};
|
|
7183
7292
|
const UnitConvert = {
|
|
7184
7293
|
number(value, percentRefer) {
|
|
7185
7294
|
return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
|
|
@@ -7205,6 +7314,7 @@ var LeaferUI = (function (exports) {
|
|
|
7205
7314
|
};
|
|
7206
7315
|
|
|
7207
7316
|
const { parse, objectToCanvasData } = PathConvert;
|
|
7317
|
+
const { stintSet: stintSet$2 } = DataHelper, { hasTransparent: hasTransparent$2 } = ColorConvert;
|
|
7208
7318
|
const emptyPaint = {};
|
|
7209
7319
|
const debug$2 = Debug.get('UIData');
|
|
7210
7320
|
class UIData extends LeafData {
|
|
@@ -7263,38 +7373,22 @@ var LeaferUI = (function (exports) {
|
|
|
7263
7373
|
if (this.__naturalWidth)
|
|
7264
7374
|
this.__removeNaturalSize();
|
|
7265
7375
|
if (typeof value === 'string' || !value) {
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
PaintImage.recycleImage('fill', this);
|
|
7269
|
-
this.__isFills = false;
|
|
7270
|
-
this.__pixelFill && (this.__pixelFill = false);
|
|
7271
|
-
}
|
|
7376
|
+
stintSet$2(this, '__isTransparentFill', hasTransparent$2(value));
|
|
7377
|
+
this.__isFills && this.__removePaint('fill', true);
|
|
7272
7378
|
this._fill = value;
|
|
7273
7379
|
}
|
|
7274
7380
|
else if (typeof value === 'object') {
|
|
7275
|
-
this.
|
|
7276
|
-
const layout = this.__leaf.__layout;
|
|
7277
|
-
layout.boxChanged || layout.boxChange();
|
|
7278
|
-
this.__isFills = true;
|
|
7279
|
-
this._fill || (this._fill = emptyPaint);
|
|
7381
|
+
this.__setPaint('fill', value);
|
|
7280
7382
|
}
|
|
7281
7383
|
}
|
|
7282
7384
|
setStroke(value) {
|
|
7283
7385
|
if (typeof value === 'string' || !value) {
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
PaintImage.recycleImage('stroke', this);
|
|
7287
|
-
this.__isStrokes = false;
|
|
7288
|
-
this.__pixelStroke && (this.__pixelStroke = false);
|
|
7289
|
-
}
|
|
7386
|
+
stintSet$2(this, '__isTransparentStroke', hasTransparent$2(value));
|
|
7387
|
+
this.__isStrokes && this.__removePaint('stroke', true);
|
|
7290
7388
|
this._stroke = value;
|
|
7291
7389
|
}
|
|
7292
7390
|
else if (typeof value === 'object') {
|
|
7293
|
-
this.
|
|
7294
|
-
const layout = this.__leaf.__layout;
|
|
7295
|
-
layout.boxChanged || layout.boxChange();
|
|
7296
|
-
this.__isStrokes = true;
|
|
7297
|
-
this._stroke || (this._stroke = emptyPaint);
|
|
7391
|
+
this.__setPaint('stroke', value);
|
|
7298
7392
|
}
|
|
7299
7393
|
}
|
|
7300
7394
|
setPath(value) {
|
|
@@ -7324,7 +7418,34 @@ var LeaferUI = (function (exports) {
|
|
|
7324
7418
|
Paint.compute('fill', this.__leaf);
|
|
7325
7419
|
if (stroke)
|
|
7326
7420
|
Paint.compute('stroke', this.__leaf);
|
|
7327
|
-
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
|
+
}
|
|
7328
7449
|
}
|
|
7329
7450
|
}
|
|
7330
7451
|
function setArray(data, key, value) {
|
|
@@ -7332,10 +7453,10 @@ var LeaferUI = (function (exports) {
|
|
|
7332
7453
|
if (value instanceof Array) {
|
|
7333
7454
|
if (value.some((item) => item.visible === false))
|
|
7334
7455
|
value = value.filter((item) => item.visible !== false);
|
|
7335
|
-
value.length || (value =
|
|
7456
|
+
value.length || (value = undefined);
|
|
7336
7457
|
}
|
|
7337
7458
|
else
|
|
7338
|
-
value = value && value.visible !== false ? [value] :
|
|
7459
|
+
value = value && value.visible !== false ? [value] : undefined;
|
|
7339
7460
|
data['_' + key] = value;
|
|
7340
7461
|
}
|
|
7341
7462
|
|
|
@@ -7438,8 +7559,6 @@ var LeaferUI = (function (exports) {
|
|
|
7438
7559
|
this._url = value;
|
|
7439
7560
|
}
|
|
7440
7561
|
__setImageFill(value) {
|
|
7441
|
-
if (this.__leaf.image)
|
|
7442
|
-
this.__leaf.image = null;
|
|
7443
7562
|
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
7444
7563
|
}
|
|
7445
7564
|
__getData() {
|
|
@@ -7505,21 +7624,19 @@ var LeaferUI = (function (exports) {
|
|
|
7505
7624
|
}
|
|
7506
7625
|
};
|
|
7507
7626
|
|
|
7627
|
+
const { stintSet: stintSet$1 } = DataHelper;
|
|
7508
7628
|
const UIRender = {
|
|
7509
7629
|
__updateChange() {
|
|
7510
|
-
const data = this.__
|
|
7630
|
+
const data = this.__;
|
|
7511
7631
|
if (data.__useEffect) {
|
|
7512
|
-
const { shadow,
|
|
7513
|
-
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);
|
|
7514
7635
|
}
|
|
7515
|
-
|
|
7516
|
-
|
|
7636
|
+
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7637
|
+
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7517
7638
|
data.__checkSingle();
|
|
7518
|
-
|
|
7519
|
-
if (complex)
|
|
7520
|
-
data.__complex = true;
|
|
7521
|
-
else
|
|
7522
|
-
data.__complex && (data.__complex = false);
|
|
7639
|
+
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7523
7640
|
},
|
|
7524
7641
|
__drawFast(canvas, options) {
|
|
7525
7642
|
drawFast(this, canvas, options);
|
|
@@ -7529,21 +7646,23 @@ var LeaferUI = (function (exports) {
|
|
|
7529
7646
|
if (data.__complex) {
|
|
7530
7647
|
if (data.__needComputePaint)
|
|
7531
7648
|
data.__computePaint();
|
|
7532
|
-
const { fill, stroke, __drawAfterFill } = data;
|
|
7649
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke, __isFastShadow } = data;
|
|
7533
7650
|
this.__drawRenderPath(canvas);
|
|
7534
|
-
if (data.__useEffect) {
|
|
7651
|
+
if (data.__useEffect && !__isFastShadow) {
|
|
7535
7652
|
const shape = Paint.shape(this, canvas, options);
|
|
7536
7653
|
this.__nowWorld = this.__getNowWorld(options);
|
|
7537
7654
|
const { shadow, innerShadow, filter } = data;
|
|
7538
7655
|
if (shadow)
|
|
7539
7656
|
Effect.shadow(this, canvas, shape);
|
|
7657
|
+
if (__fillAfterStroke)
|
|
7658
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7540
7659
|
if (fill)
|
|
7541
7660
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7542
7661
|
if (__drawAfterFill)
|
|
7543
7662
|
this.__drawAfterFill(canvas, options);
|
|
7544
7663
|
if (innerShadow)
|
|
7545
7664
|
Effect.innerShadow(this, canvas, shape);
|
|
7546
|
-
if (stroke)
|
|
7665
|
+
if (stroke && !__fillAfterStroke)
|
|
7547
7666
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7548
7667
|
if (filter)
|
|
7549
7668
|
Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
@@ -7552,21 +7671,27 @@ var LeaferUI = (function (exports) {
|
|
|
7552
7671
|
shape.canvas.recycle();
|
|
7553
7672
|
}
|
|
7554
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
|
+
}
|
|
7555
7680
|
if (fill)
|
|
7556
7681
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7682
|
+
if (__isFastShadow)
|
|
7683
|
+
canvas.restore();
|
|
7557
7684
|
if (__drawAfterFill)
|
|
7558
7685
|
this.__drawAfterFill(canvas, options);
|
|
7559
|
-
if (stroke)
|
|
7686
|
+
if (stroke && !__fillAfterStroke)
|
|
7560
7687
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7561
7688
|
}
|
|
7562
7689
|
}
|
|
7563
7690
|
else {
|
|
7564
|
-
if (data.__pathInputed)
|
|
7691
|
+
if (data.__pathInputed)
|
|
7565
7692
|
drawFast(this, canvas, options);
|
|
7566
|
-
|
|
7567
|
-
else {
|
|
7693
|
+
else
|
|
7568
7694
|
this.__drawFast(canvas, options);
|
|
7569
|
-
}
|
|
7570
7695
|
}
|
|
7571
7696
|
},
|
|
7572
7697
|
__renderShape(canvas, options, ignoreFill, ignoreStroke) {
|
|
@@ -7575,11 +7700,11 @@ var LeaferUI = (function (exports) {
|
|
|
7575
7700
|
const { fill, stroke } = this.__;
|
|
7576
7701
|
this.__drawRenderPath(canvas);
|
|
7577
7702
|
if (fill && !ignoreFill)
|
|
7578
|
-
this.__.
|
|
7703
|
+
this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7579
7704
|
if (this.__.__isCanvas)
|
|
7580
7705
|
this.__drawAfterFill(canvas, options);
|
|
7581
7706
|
if (stroke && !ignoreStroke)
|
|
7582
|
-
this.__.
|
|
7707
|
+
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7583
7708
|
}
|
|
7584
7709
|
},
|
|
7585
7710
|
__drawAfterFill(canvas, options) {
|
|
@@ -7594,13 +7719,15 @@ var LeaferUI = (function (exports) {
|
|
|
7594
7719
|
}
|
|
7595
7720
|
};
|
|
7596
7721
|
function drawFast(ui, canvas, options) {
|
|
7597
|
-
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
7722
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke } = ui.__;
|
|
7598
7723
|
ui.__drawRenderPath(canvas);
|
|
7724
|
+
if (__fillAfterStroke)
|
|
7725
|
+
Paint.stroke(stroke, ui, canvas);
|
|
7599
7726
|
if (fill)
|
|
7600
7727
|
Paint.fill(fill, ui, canvas);
|
|
7601
7728
|
if (__drawAfterFill)
|
|
7602
7729
|
ui.__drawAfterFill(canvas, options);
|
|
7603
|
-
if (stroke)
|
|
7730
|
+
if (stroke && !__fillAfterStroke)
|
|
7604
7731
|
Paint.stroke(stroke, ui, canvas);
|
|
7605
7732
|
}
|
|
7606
7733
|
|
|
@@ -7972,6 +8099,9 @@ var LeaferUI = (function (exports) {
|
|
|
7972
8099
|
__decorate([
|
|
7973
8100
|
surfaceType()
|
|
7974
8101
|
], exports.UI.prototype, "placeholderColor", void 0);
|
|
8102
|
+
__decorate([
|
|
8103
|
+
dataType(100)
|
|
8104
|
+
], exports.UI.prototype, "placeholderDelay", void 0);
|
|
7975
8105
|
__decorate([
|
|
7976
8106
|
dataType({})
|
|
7977
8107
|
], exports.UI.prototype, "data", void 0);
|
|
@@ -8373,15 +8503,20 @@ var LeaferUI = (function (exports) {
|
|
|
8373
8503
|
}
|
|
8374
8504
|
__listenEvents() {
|
|
8375
8505
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8376
|
-
this.once(
|
|
8377
|
-
|
|
8378
|
-
|
|
8379
|
-
|
|
8380
|
-
|
|
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
|
+
]));
|
|
8381
8517
|
}
|
|
8382
8518
|
__removeListenEvents() {
|
|
8383
8519
|
this.off_(this.__eventIds);
|
|
8384
|
-
this.__eventIds.length = 0;
|
|
8385
8520
|
}
|
|
8386
8521
|
destroy(sync) {
|
|
8387
8522
|
const doDestory = () => {
|
|
@@ -8489,13 +8624,13 @@ var LeaferUI = (function (exports) {
|
|
|
8489
8624
|
super.__updateRenderBounds();
|
|
8490
8625
|
copy$3(childrenRenderBounds, renderBounds);
|
|
8491
8626
|
this.__updateRectRenderBounds();
|
|
8492
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8627
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8493
8628
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8494
8629
|
add(renderBounds, childrenRenderBounds);
|
|
8495
8630
|
}
|
|
8496
8631
|
else
|
|
8497
8632
|
this.__updateRectRenderBounds();
|
|
8498
|
-
|
|
8633
|
+
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8499
8634
|
}
|
|
8500
8635
|
__updateRectRenderBounds() { }
|
|
8501
8636
|
__updateRectChange() { }
|
|
@@ -8799,18 +8934,10 @@ var LeaferUI = (function (exports) {
|
|
|
8799
8934
|
|
|
8800
8935
|
exports.Image = class Image extends exports.Rect {
|
|
8801
8936
|
get __tag() { return 'Image'; }
|
|
8802
|
-
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; }
|
|
8803
8939
|
constructor(data) {
|
|
8804
8940
|
super(data);
|
|
8805
|
-
this.on_(ImageEvent.LOADED, this.__onLoaded, this);
|
|
8806
|
-
}
|
|
8807
|
-
__onLoaded(e) {
|
|
8808
|
-
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8809
|
-
this.image = e.image;
|
|
8810
|
-
}
|
|
8811
|
-
destroy() {
|
|
8812
|
-
this.image = null;
|
|
8813
|
-
super.destroy();
|
|
8814
8941
|
}
|
|
8815
8942
|
};
|
|
8816
8943
|
__decorate([
|
|
@@ -8826,11 +8953,11 @@ var LeaferUI = (function (exports) {
|
|
|
8826
8953
|
|
|
8827
8954
|
exports.Canvas = class Canvas extends exports.Rect {
|
|
8828
8955
|
get __tag() { return 'Canvas'; }
|
|
8956
|
+
get context() { return this.canvas.context; }
|
|
8829
8957
|
get ready() { return !this.url; }
|
|
8830
8958
|
constructor(data) {
|
|
8831
8959
|
super(data);
|
|
8832
8960
|
this.canvas = Creator.canvas(this.__);
|
|
8833
|
-
this.context = this.canvas.context;
|
|
8834
8961
|
if (data && data.url)
|
|
8835
8962
|
this.drawImage(data.url);
|
|
8836
8963
|
}
|
|
@@ -8874,7 +9001,7 @@ var LeaferUI = (function (exports) {
|
|
|
8874
9001
|
destroy() {
|
|
8875
9002
|
if (this.canvas) {
|
|
8876
9003
|
this.canvas.destroy();
|
|
8877
|
-
this.canvas =
|
|
9004
|
+
this.canvas = null;
|
|
8878
9005
|
}
|
|
8879
9006
|
super.destroy();
|
|
8880
9007
|
}
|
|
@@ -8950,12 +9077,11 @@ var LeaferUI = (function (exports) {
|
|
|
8950
9077
|
super.__updateBoxBounds();
|
|
8951
9078
|
if (italic)
|
|
8952
9079
|
b.width += fontSize * 0.16;
|
|
8953
|
-
|
|
8954
|
-
if (isOverflow)
|
|
9080
|
+
DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds));
|
|
9081
|
+
if (this.isOverflow)
|
|
8955
9082
|
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8956
9083
|
else
|
|
8957
9084
|
data.__textBoxBounds = b;
|
|
8958
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8959
9085
|
}
|
|
8960
9086
|
__onUpdateSize() {
|
|
8961
9087
|
if (this.__box)
|
|
@@ -9156,7 +9282,7 @@ var LeaferUI = (function (exports) {
|
|
|
9156
9282
|
if (sky || editor)
|
|
9157
9283
|
this.sky = this.addLeafer(sky);
|
|
9158
9284
|
if (editor)
|
|
9159
|
-
|
|
9285
|
+
Creator.editor(editor, this);
|
|
9160
9286
|
}
|
|
9161
9287
|
}
|
|
9162
9288
|
__setApp() {
|
|
@@ -9170,6 +9296,10 @@ var LeaferUI = (function (exports) {
|
|
|
9170
9296
|
this.watcher.disable();
|
|
9171
9297
|
this.layouter.disable();
|
|
9172
9298
|
}
|
|
9299
|
+
__updateLocalBounds() {
|
|
9300
|
+
this.forEach(leafer => leafer.updateLayout());
|
|
9301
|
+
super.__updateLocalBounds();
|
|
9302
|
+
}
|
|
9173
9303
|
start() {
|
|
9174
9304
|
super.start();
|
|
9175
9305
|
this.forEach(leafer => leafer.start());
|
|
@@ -9227,12 +9357,8 @@ var LeaferUI = (function (exports) {
|
|
|
9227
9357
|
this.renderer.update();
|
|
9228
9358
|
}
|
|
9229
9359
|
__render(canvas, options) {
|
|
9230
|
-
if (canvas.context)
|
|
9231
|
-
|
|
9232
|
-
if (m)
|
|
9233
|
-
canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
9234
|
-
this.forEach(leafer => canvas.copyWorld(leafer.canvas));
|
|
9235
|
-
}
|
|
9360
|
+
if (canvas.context)
|
|
9361
|
+
this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
|
|
9236
9362
|
}
|
|
9237
9363
|
__onResize(event) {
|
|
9238
9364
|
this.forEach(leafer => leafer.resize(event));
|
|
@@ -9253,9 +9379,11 @@ var LeaferUI = (function (exports) {
|
|
|
9253
9379
|
return config;
|
|
9254
9380
|
}
|
|
9255
9381
|
__listenChildEvents(leafer) {
|
|
9256
|
-
leafer.once(
|
|
9257
|
-
|
|
9258
|
-
|
|
9382
|
+
leafer.once([
|
|
9383
|
+
[LayoutEvent.END, this.__onReady, this],
|
|
9384
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
9385
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
9386
|
+
]);
|
|
9259
9387
|
if (this.realCanvas)
|
|
9260
9388
|
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9261
9389
|
}
|
|
@@ -9466,7 +9594,7 @@ var LeaferUI = (function (exports) {
|
|
|
9466
9594
|
registerUIEvent()
|
|
9467
9595
|
], exports.MoveEvent);
|
|
9468
9596
|
|
|
9469
|
-
exports.RotateEvent = class RotateEvent extends
|
|
9597
|
+
exports.RotateEvent = class RotateEvent extends exports.PointerEvent {
|
|
9470
9598
|
};
|
|
9471
9599
|
exports.RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
|
|
9472
9600
|
exports.RotateEvent.START = 'rotate.start';
|
|
@@ -9487,7 +9615,7 @@ var LeaferUI = (function (exports) {
|
|
|
9487
9615
|
registerUIEvent()
|
|
9488
9616
|
], exports.SwipeEvent);
|
|
9489
9617
|
|
|
9490
|
-
exports.ZoomEvent = class ZoomEvent extends
|
|
9618
|
+
exports.ZoomEvent = class ZoomEvent extends exports.PointerEvent {
|
|
9491
9619
|
};
|
|
9492
9620
|
exports.ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
|
|
9493
9621
|
exports.ZoomEvent.START = 'zoom.start';
|
|
@@ -10330,8 +10458,8 @@ var LeaferUI = (function (exports) {
|
|
|
10330
10458
|
if (this.__box)
|
|
10331
10459
|
this.__box.__updateHitCanvas();
|
|
10332
10460
|
const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
|
|
10333
|
-
const isHitPixelFill = (data.
|
|
10334
|
-
const isHitPixelStroke = data.
|
|
10461
|
+
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
10462
|
+
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
10335
10463
|
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
10336
10464
|
if (!this.__hitCanvas)
|
|
10337
10465
|
this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
|
|
@@ -10362,11 +10490,11 @@ var LeaferUI = (function (exports) {
|
|
|
10362
10490
|
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
10363
10491
|
return true;
|
|
10364
10492
|
const { hitFill } = data;
|
|
10365
|
-
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';
|
|
10366
10494
|
if (needHitFillPath && this.__hitFill(inner))
|
|
10367
10495
|
return true;
|
|
10368
10496
|
const { hitStroke, __strokeWidth } = data;
|
|
10369
|
-
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.
|
|
10497
|
+
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
10370
10498
|
if (!needHitFillPath && !needHitStrokePath)
|
|
10371
10499
|
return false;
|
|
10372
10500
|
const radiusWidth = inner.radiusX * 2;
|
|
@@ -10816,31 +10944,31 @@ var LeaferUI = (function (exports) {
|
|
|
10816
10944
|
}
|
|
10817
10945
|
|
|
10818
10946
|
function strokeText(stroke, ui, canvas) {
|
|
10819
|
-
|
|
10820
|
-
const isStrokes = typeof stroke !== 'string';
|
|
10821
|
-
switch (strokeAlign) {
|
|
10947
|
+
switch (ui.__.strokeAlign) {
|
|
10822
10948
|
case 'center':
|
|
10823
|
-
|
|
10824
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
10949
|
+
drawCenter$1(stroke, 1, ui, canvas);
|
|
10825
10950
|
break;
|
|
10826
10951
|
case 'inside':
|
|
10827
|
-
|
|
10952
|
+
drawAlign(stroke, 'inside', ui, canvas);
|
|
10828
10953
|
break;
|
|
10829
10954
|
case 'outside':
|
|
10830
|
-
|
|
10955
|
+
ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, 'outside', ui, canvas);
|
|
10831
10956
|
break;
|
|
10832
10957
|
}
|
|
10833
10958
|
}
|
|
10834
|
-
function
|
|
10835
|
-
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) {
|
|
10836
10965
|
const out = canvas.getSameCanvas(true, true);
|
|
10837
|
-
out.
|
|
10838
|
-
|
|
10839
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
|
|
10966
|
+
out.font = ui.__.__font;
|
|
10967
|
+
drawCenter$1(stroke, 2, ui, out);
|
|
10840
10968
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10841
10969
|
fillText(ui, out);
|
|
10842
10970
|
out.blendMode = 'normal';
|
|
10843
|
-
if (ui.__worldFlipped)
|
|
10971
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
10844
10972
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10845
10973
|
else
|
|
10846
10974
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
@@ -10882,90 +11010,60 @@ var LeaferUI = (function (exports) {
|
|
|
10882
11010
|
}
|
|
10883
11011
|
|
|
10884
11012
|
function stroke(stroke, ui, canvas) {
|
|
10885
|
-
const
|
|
10886
|
-
|
|
10887
|
-
if (!__strokeWidth)
|
|
11013
|
+
const data = ui.__;
|
|
11014
|
+
if (!data.__strokeWidth)
|
|
10888
11015
|
return;
|
|
10889
|
-
if (__font) {
|
|
11016
|
+
if (data.__font) {
|
|
10890
11017
|
strokeText(stroke, ui, canvas);
|
|
10891
11018
|
}
|
|
10892
11019
|
else {
|
|
10893
|
-
switch (strokeAlign) {
|
|
11020
|
+
switch (data.strokeAlign) {
|
|
10894
11021
|
case 'center':
|
|
10895
|
-
|
|
10896
|
-
canvas.stroke();
|
|
10897
|
-
if (options.__useArrow)
|
|
10898
|
-
strokeArrow(ui, canvas);
|
|
11022
|
+
drawCenter(stroke, 1, ui, canvas);
|
|
10899
11023
|
break;
|
|
10900
11024
|
case 'inside':
|
|
10901
|
-
canvas
|
|
10902
|
-
canvas.setStroke(stroke, __strokeWidth * 2, options);
|
|
10903
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
10904
|
-
canvas.stroke();
|
|
10905
|
-
canvas.restore();
|
|
11025
|
+
drawInside(stroke, ui, canvas);
|
|
10906
11026
|
break;
|
|
10907
11027
|
case 'outside':
|
|
10908
|
-
|
|
10909
|
-
out.setStroke(stroke, __strokeWidth * 2, options);
|
|
10910
|
-
ui.__drawRenderPath(out);
|
|
10911
|
-
out.stroke();
|
|
10912
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10913
|
-
out.clearWorld(ui.__layout.renderBounds);
|
|
10914
|
-
if (ui.__worldFlipped)
|
|
10915
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10916
|
-
else
|
|
10917
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10918
|
-
out.recycle(ui.__nowWorld);
|
|
11028
|
+
drawOutside(stroke, ui, canvas);
|
|
10919
11029
|
break;
|
|
10920
11030
|
}
|
|
10921
11031
|
}
|
|
10922
11032
|
}
|
|
10923
11033
|
function strokes(strokes, ui, canvas) {
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
|
|
10929
|
-
|
|
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);
|
|
10930
11054
|
}
|
|
10931
11055
|
else {
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
|
|
10938
|
-
|
|
10939
|
-
|
|
10940
|
-
|
|
10941
|
-
|
|
10942
|
-
|
|
10943
|
-
drawStrokesStyle(strokes, false, ui, canvas);
|
|
10944
|
-
canvas.restore();
|
|
10945
|
-
break;
|
|
10946
|
-
case 'outside':
|
|
10947
|
-
const { renderBounds } = ui.__layout;
|
|
10948
|
-
const out = canvas.getSameCanvas(true, true);
|
|
10949
|
-
ui.__drawRenderPath(out);
|
|
10950
|
-
out.setStroke(undefined, __strokeWidth * 2, options);
|
|
10951
|
-
drawStrokesStyle(strokes, false, ui, out);
|
|
10952
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10953
|
-
out.clearWorld(renderBounds);
|
|
10954
|
-
if (ui.__worldFlipped)
|
|
10955
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10956
|
-
else
|
|
10957
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
10958
|
-
out.recycle(ui.__nowWorld);
|
|
10959
|
-
break;
|
|
10960
|
-
}
|
|
10961
|
-
}
|
|
10962
|
-
}
|
|
10963
|
-
function strokeArrow(ui, canvas) {
|
|
10964
|
-
if (ui.__.dashPattern) {
|
|
10965
|
-
canvas.beginPath();
|
|
10966
|
-
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
10967
|
-
canvas.dashPattern = null;
|
|
10968
|
-
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);
|
|
10969
11067
|
}
|
|
10970
11068
|
}
|
|
10971
11069
|
|
|
@@ -11012,9 +11110,10 @@ var LeaferUI = (function (exports) {
|
|
|
11012
11110
|
}
|
|
11013
11111
|
|
|
11014
11112
|
let recycleMap;
|
|
11113
|
+
const { stintSet } = DataHelper, { hasTransparent: hasTransparent$1 } = ColorConvert;
|
|
11015
11114
|
function compute(attrName, ui) {
|
|
11016
11115
|
const data = ui.__, leafPaints = [];
|
|
11017
|
-
let paints = data.__input[attrName],
|
|
11116
|
+
let paints = data.__input[attrName], isAlphaPixel, isTransparent;
|
|
11018
11117
|
if (!(paints instanceof Array))
|
|
11019
11118
|
paints = [paints];
|
|
11020
11119
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
@@ -11024,29 +11123,55 @@ var LeaferUI = (function (exports) {
|
|
|
11024
11123
|
leafPaints.push(item);
|
|
11025
11124
|
}
|
|
11026
11125
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
11027
|
-
if (leafPaints.length
|
|
11028
|
-
|
|
11029
|
-
|
|
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
|
+
}
|
|
11030
11141
|
}
|
|
11031
11142
|
function getLeafPaint(attrName, paint, ui) {
|
|
11032
11143
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
|
11033
11144
|
return undefined;
|
|
11145
|
+
let data;
|
|
11034
11146
|
const { boxBounds } = ui.__layout;
|
|
11035
11147
|
switch (paint.type) {
|
|
11036
|
-
case 'solid':
|
|
11037
|
-
let { type, blendMode, color, opacity } = paint;
|
|
11038
|
-
return { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
11039
11148
|
case 'image':
|
|
11040
|
-
|
|
11149
|
+
data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
11150
|
+
break;
|
|
11041
11151
|
case 'linear':
|
|
11042
|
-
|
|
11152
|
+
data = PaintGradient.linearGradient(paint, boxBounds);
|
|
11153
|
+
break;
|
|
11043
11154
|
case 'radial':
|
|
11044
|
-
|
|
11155
|
+
data = PaintGradient.radialGradient(paint, boxBounds);
|
|
11156
|
+
break;
|
|
11045
11157
|
case 'angular':
|
|
11046
|
-
|
|
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;
|
|
11047
11164
|
default:
|
|
11048
|
-
|
|
11165
|
+
if (paint.r !== undefined)
|
|
11166
|
+
data = { type: 'solid', style: ColorConvert.string(paint) };
|
|
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;
|
|
11049
11173
|
}
|
|
11174
|
+
return data;
|
|
11050
11175
|
}
|
|
11051
11176
|
|
|
11052
11177
|
const PaintModule = {
|
|
@@ -11112,12 +11237,10 @@ var LeaferUI = (function (exports) {
|
|
|
11112
11237
|
|
|
11113
11238
|
const { get: get$2, translate } = MatrixHelper;
|
|
11114
11239
|
const tempBox = new Bounds();
|
|
11115
|
-
const tempPoint = {};
|
|
11116
11240
|
const tempScaleData = {};
|
|
11241
|
+
const tempImage = {};
|
|
11117
11242
|
function createData(leafPaint, image, paint, box) {
|
|
11118
|
-
const {
|
|
11119
|
-
if (blendMode)
|
|
11120
|
-
leafPaint.blendMode = blendMode;
|
|
11243
|
+
const { changeful, sync } = paint;
|
|
11121
11244
|
if (changeful)
|
|
11122
11245
|
leafPaint.changeful = changeful;
|
|
11123
11246
|
if (sync)
|
|
@@ -11125,38 +11248,38 @@ var LeaferUI = (function (exports) {
|
|
|
11125
11248
|
leafPaint.data = getPatternData(paint, box, image);
|
|
11126
11249
|
}
|
|
11127
11250
|
function getPatternData(paint, box, image) {
|
|
11128
|
-
let { width, height } = image;
|
|
11129
11251
|
if (paint.padding)
|
|
11130
11252
|
box = tempBox.set(box).shrink(paint.padding);
|
|
11131
11253
|
if (paint.mode === 'strench')
|
|
11132
11254
|
paint.mode = 'stretch';
|
|
11255
|
+
let { width, height } = image;
|
|
11133
11256
|
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
11134
11257
|
const sameBox = box.width === width && box.height === height;
|
|
11135
11258
|
const data = { mode };
|
|
11136
11259
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
11137
|
-
|
|
11138
|
-
let
|
|
11260
|
+
BoundsHelper.set(tempImage, 0, 0, swapSize ? height : width, swapSize ? width : height);
|
|
11261
|
+
let scaleX, scaleY;
|
|
11139
11262
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
11140
11263
|
if (!sameBox || rotation) {
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
|
|
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);
|
|
11144
11267
|
}
|
|
11145
11268
|
}
|
|
11146
|
-
else
|
|
11147
|
-
|
|
11148
|
-
|
|
11149
|
-
|
|
11150
|
-
|
|
11151
|
-
|
|
11152
|
-
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
|
|
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
|
+
}
|
|
11157
11280
|
}
|
|
11158
11281
|
if (offset)
|
|
11159
|
-
|
|
11282
|
+
PointHelper.move(tempImage, offset);
|
|
11160
11283
|
switch (mode) {
|
|
11161
11284
|
case 'stretch':
|
|
11162
11285
|
if (!sameBox)
|
|
@@ -11164,12 +11287,12 @@ var LeaferUI = (function (exports) {
|
|
|
11164
11287
|
break;
|
|
11165
11288
|
case 'normal':
|
|
11166
11289
|
case 'clip':
|
|
11167
|
-
if (x || y || scaleX || rotation)
|
|
11168
|
-
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);
|
|
11169
11292
|
break;
|
|
11170
11293
|
case 'repeat':
|
|
11171
11294
|
if (!sameBox || scaleX || rotation)
|
|
11172
|
-
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);
|
|
11173
11296
|
if (!repeat)
|
|
11174
11297
|
data.repeat = 'repeat';
|
|
11175
11298
|
break;
|
|
@@ -11177,7 +11300,7 @@ var LeaferUI = (function (exports) {
|
|
|
11177
11300
|
case 'cover':
|
|
11178
11301
|
default:
|
|
11179
11302
|
if (scaleX)
|
|
11180
|
-
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
11303
|
+
fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
11181
11304
|
}
|
|
11182
11305
|
if (!data.transform) {
|
|
11183
11306
|
if (box.x || box.y) {
|
|
@@ -11210,6 +11333,8 @@ var LeaferUI = (function (exports) {
|
|
|
11210
11333
|
}
|
|
11211
11334
|
else {
|
|
11212
11335
|
leafPaint = { type: paint.type, image };
|
|
11336
|
+
if (image.hasAlphaPixel)
|
|
11337
|
+
leafPaint.isTransparent = true;
|
|
11213
11338
|
cache = image.use > 1 ? { leafPaint, paint, boxBounds: box.set(boxBounds) } : null;
|
|
11214
11339
|
}
|
|
11215
11340
|
if (firstUse || image.loading)
|
|
@@ -11234,7 +11359,7 @@ var LeaferUI = (function (exports) {
|
|
|
11234
11359
|
ignoreRender(ui, false);
|
|
11235
11360
|
if (!ui.destroyed) {
|
|
11236
11361
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
11237
|
-
if (image.
|
|
11362
|
+
if (image.hasAlphaPixel)
|
|
11238
11363
|
ui.__layout.hitCanvasChanged = true;
|
|
11239
11364
|
ui.forceUpdate('surface');
|
|
11240
11365
|
}
|
|
@@ -11246,13 +11371,17 @@ var LeaferUI = (function (exports) {
|
|
|
11246
11371
|
onLoadError(ui, event, error);
|
|
11247
11372
|
leafPaint.loadId = null;
|
|
11248
11373
|
});
|
|
11249
|
-
if (ui.placeholderColor)
|
|
11250
|
-
|
|
11251
|
-
|
|
11252
|
-
|
|
11253
|
-
|
|
11254
|
-
|
|
11255
|
-
|
|
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
|
+
}
|
|
11256
11385
|
}
|
|
11257
11386
|
return leafPaint;
|
|
11258
11387
|
}
|
|
@@ -11458,32 +11587,33 @@ var LeaferUI = (function (exports) {
|
|
|
11458
11587
|
repeatMode
|
|
11459
11588
|
};
|
|
11460
11589
|
|
|
11461
|
-
const { toPoint: toPoint$2 } = AroundHelper;
|
|
11590
|
+
const { toPoint: toPoint$2 } = AroundHelper, { hasTransparent } = ColorConvert;
|
|
11462
11591
|
const realFrom$2 = {};
|
|
11463
11592
|
const realTo$2 = {};
|
|
11464
11593
|
function linearGradient(paint, box) {
|
|
11465
|
-
let { from, to, type,
|
|
11594
|
+
let { from, to, type, opacity } = paint;
|
|
11466
11595
|
toPoint$2(from || 'top', box, realFrom$2);
|
|
11467
11596
|
toPoint$2(to || 'bottom', box, realTo$2);
|
|
11468
11597
|
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
11469
|
-
applyStops(style, paint.stops, opacity);
|
|
11470
11598
|
const data = { type, style };
|
|
11471
|
-
|
|
11472
|
-
data.blendMode = blendMode;
|
|
11599
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11473
11600
|
return data;
|
|
11474
11601
|
}
|
|
11475
|
-
function applyStops(gradient, stops, opacity) {
|
|
11602
|
+
function applyStops(data, gradient, stops, opacity) {
|
|
11476
11603
|
if (stops) {
|
|
11477
|
-
let stop;
|
|
11604
|
+
let stop, color, offset, isTransparent;
|
|
11478
11605
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
11479
11606
|
stop = stops[i];
|
|
11480
|
-
if (typeof stop === 'string')
|
|
11481
|
-
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
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;
|
|
11486
11614
|
}
|
|
11615
|
+
if (isTransparent)
|
|
11616
|
+
data.isTransparent = true;
|
|
11487
11617
|
}
|
|
11488
11618
|
}
|
|
11489
11619
|
|
|
@@ -11493,17 +11623,15 @@ var LeaferUI = (function (exports) {
|
|
|
11493
11623
|
const realFrom$1 = {};
|
|
11494
11624
|
const realTo$1 = {};
|
|
11495
11625
|
function radialGradient(paint, box) {
|
|
11496
|
-
let { from, to, type, opacity,
|
|
11626
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
11497
11627
|
toPoint$1(from || 'center', box, realFrom$1);
|
|
11498
11628
|
toPoint$1(to || 'bottom', box, realTo$1);
|
|
11499
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));
|
|
11500
|
-
applyStops(style, paint.stops, opacity);
|
|
11501
11630
|
const data = { type, style };
|
|
11631
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11502
11632
|
const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
|
|
11503
11633
|
if (transform)
|
|
11504
11634
|
data.transform = transform;
|
|
11505
|
-
if (blendMode)
|
|
11506
|
-
data.blendMode = blendMode;
|
|
11507
11635
|
return data;
|
|
11508
11636
|
}
|
|
11509
11637
|
function getTransform(box, from, to, stretch, rotate90) {
|
|
@@ -11529,17 +11657,15 @@ var LeaferUI = (function (exports) {
|
|
|
11529
11657
|
const realFrom = {};
|
|
11530
11658
|
const realTo = {};
|
|
11531
11659
|
function conicGradient(paint, box) {
|
|
11532
|
-
let { from, to, type, opacity,
|
|
11660
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
11533
11661
|
toPoint(from || 'center', box, realFrom);
|
|
11534
11662
|
toPoint(to || 'bottom', box, realTo);
|
|
11535
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));
|
|
11536
|
-
applyStops(style, paint.stops, opacity);
|
|
11537
11664
|
const data = { type, style };
|
|
11665
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11538
11666
|
const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
|
|
11539
11667
|
if (transform)
|
|
11540
11668
|
data.transform = transform;
|
|
11541
|
-
if (blendMode)
|
|
11542
|
-
data.blendMode = blendMode;
|
|
11543
11669
|
return data;
|
|
11544
11670
|
}
|
|
11545
11671
|
|
|
@@ -11872,6 +11998,8 @@ var LeaferUI = (function (exports) {
|
|
|
11872
11998
|
lastCharType = null;
|
|
11873
11999
|
startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
|
|
11874
12000
|
word = { data: [] }, row = { words: [] };
|
|
12001
|
+
if (__letterSpacing)
|
|
12002
|
+
content = [...content];
|
|
11875
12003
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
11876
12004
|
char = content[i];
|
|
11877
12005
|
if (char === '\n') {
|
|
@@ -12295,6 +12423,7 @@ var LeaferUI = (function (exports) {
|
|
|
12295
12423
|
exports.AutoBounds = AutoBounds;
|
|
12296
12424
|
exports.BezierHelper = BezierHelper;
|
|
12297
12425
|
exports.Bounds = Bounds;
|
|
12426
|
+
exports.BoundsEvent = BoundsEvent;
|
|
12298
12427
|
exports.BoundsHelper = BoundsHelper;
|
|
12299
12428
|
exports.BoxData = BoxData;
|
|
12300
12429
|
exports.BranchHelper = BranchHelper;
|
|
@@ -12454,7 +12583,7 @@ var LeaferUI = (function (exports) {
|
|
|
12454
12583
|
exports.surfaceType = surfaceType;
|
|
12455
12584
|
exports.tempBounds = tempBounds$1;
|
|
12456
12585
|
exports.tempMatrix = tempMatrix;
|
|
12457
|
-
exports.tempPoint = tempPoint$
|
|
12586
|
+
exports.tempPoint = tempPoint$2;
|
|
12458
12587
|
exports.useCanvas = useCanvas;
|
|
12459
12588
|
exports.useModule = useModule;
|
|
12460
12589
|
exports.version = version;
|