leafer-ui 1.6.2 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web.cjs +175 -185
- package/dist/web.esm.js +177 -187
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +555 -427
- 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 +554 -427
- 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;
|
|
@@ -2248,16 +2272,19 @@ var LeaferUI = (function (exports) {
|
|
|
2248
2272
|
if (blendMode)
|
|
2249
2273
|
this.blendMode = 'source-over';
|
|
2250
2274
|
}
|
|
2251
|
-
clearWorld(bounds, ceilPixel) {
|
|
2252
|
-
this.setTempBounds(bounds, ceilPixel);
|
|
2253
|
-
this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2254
|
-
}
|
|
2255
2275
|
clipWorld(bounds, ceilPixel) {
|
|
2256
2276
|
this.beginPath();
|
|
2257
2277
|
this.setTempBounds(bounds, ceilPixel);
|
|
2258
2278
|
this.rect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2259
2279
|
this.clip();
|
|
2260
2280
|
}
|
|
2281
|
+
clipUI(ruleData) {
|
|
2282
|
+
ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
|
|
2283
|
+
}
|
|
2284
|
+
clearWorld(bounds, ceilPixel) {
|
|
2285
|
+
this.setTempBounds(bounds, ceilPixel);
|
|
2286
|
+
this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2287
|
+
}
|
|
2261
2288
|
clear() {
|
|
2262
2289
|
const { pixelRatio } = this;
|
|
2263
2290
|
this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
|
|
@@ -2388,7 +2415,7 @@ var LeaferUI = (function (exports) {
|
|
|
2388
2415
|
const { setPoint: setPoint$1, addPoint: addPoint$1 } = TwoPointBoundsHelper;
|
|
2389
2416
|
const { set, toNumberPoints } = PointHelper;
|
|
2390
2417
|
const { M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
2391
|
-
const tempPoint$
|
|
2418
|
+
const tempPoint$1 = {};
|
|
2392
2419
|
const BezierHelper = {
|
|
2393
2420
|
points(data, originPoints, curve, close) {
|
|
2394
2421
|
let points = toNumberPoints(originPoints);
|
|
@@ -2410,6 +2437,8 @@ var LeaferUI = (function (exports) {
|
|
|
2410
2437
|
cY = points[i + 3];
|
|
2411
2438
|
ba = sqrt$1(pow(bX - aX, 2) + pow(bY - aY, 2));
|
|
2412
2439
|
cb = sqrt$1(pow(cX - bX, 2) + pow(cY - bY, 2));
|
|
2440
|
+
if (!ba && !cb)
|
|
2441
|
+
continue;
|
|
2413
2442
|
d = ba + cb;
|
|
2414
2443
|
ba = (t * ba) / d;
|
|
2415
2444
|
cb = (t * cb) / d;
|
|
@@ -2579,8 +2608,8 @@ var LeaferUI = (function (exports) {
|
|
|
2579
2608
|
addMode ? addPoint$1(pointBounds, fromX, fromY) : setPoint$1(pointBounds, fromX, fromY);
|
|
2580
2609
|
addPoint$1(pointBounds, toX, toY);
|
|
2581
2610
|
for (let i = 0, len = tList.length; i < len; i++) {
|
|
2582
|
-
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$
|
|
2583
|
-
addPoint$1(pointBounds, tempPoint$
|
|
2611
|
+
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$1);
|
|
2612
|
+
addPoint$1(pointBounds, tempPoint$1.x, tempPoint$1.y);
|
|
2584
2613
|
}
|
|
2585
2614
|
},
|
|
2586
2615
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -3389,7 +3418,7 @@ var LeaferUI = (function (exports) {
|
|
|
3389
3418
|
}
|
|
3390
3419
|
|
|
3391
3420
|
const FileHelper = {
|
|
3392
|
-
|
|
3421
|
+
alphaPixelTypes: ['png', 'webp', 'svg'],
|
|
3393
3422
|
upperCaseTypeMap: {},
|
|
3394
3423
|
mineType(type) {
|
|
3395
3424
|
if (!type || type.startsWith('image'))
|
|
@@ -3416,7 +3445,7 @@ var LeaferUI = (function (exports) {
|
|
|
3416
3445
|
}
|
|
3417
3446
|
};
|
|
3418
3447
|
const F = FileHelper;
|
|
3419
|
-
F.
|
|
3448
|
+
F.alphaPixelTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3420
3449
|
|
|
3421
3450
|
const debug$a = Debug.get('TaskProcessor');
|
|
3422
3451
|
class TaskItem {
|
|
@@ -3733,8 +3762,8 @@ var LeaferUI = (function (exports) {
|
|
|
3733
3762
|
list.length = 0;
|
|
3734
3763
|
}
|
|
3735
3764
|
},
|
|
3736
|
-
|
|
3737
|
-
return FileHelper.
|
|
3765
|
+
hasAlphaPixel(config) {
|
|
3766
|
+
return FileHelper.alphaPixelTypes.some(item => I$1.isFormat(item, config));
|
|
3738
3767
|
},
|
|
3739
3768
|
isFormat(format, config) {
|
|
3740
3769
|
if (config.format === format)
|
|
@@ -3772,7 +3801,7 @@ var LeaferUI = (function (exports) {
|
|
|
3772
3801
|
this.setView(view.config ? view.view : view);
|
|
3773
3802
|
}
|
|
3774
3803
|
ImageManager.isFormat('svg', config) && (this.isSVG = true);
|
|
3775
|
-
ImageManager.
|
|
3804
|
+
ImageManager.hasAlphaPixel(config) && (this.hasAlphaPixel = true);
|
|
3776
3805
|
}
|
|
3777
3806
|
load(onSuccess, onError) {
|
|
3778
3807
|
if (!this.loading) {
|
|
@@ -4460,7 +4489,7 @@ var LeaferUI = (function (exports) {
|
|
|
4460
4489
|
}
|
|
4461
4490
|
};
|
|
4462
4491
|
|
|
4463
|
-
const { updateBounds: updateBounds$
|
|
4492
|
+
const { updateBounds: updateBounds$3 } = LeafHelper;
|
|
4464
4493
|
const BranchHelper = {
|
|
4465
4494
|
sort(a, b) {
|
|
4466
4495
|
return (a.__.zIndex === b.__.zIndex) ? (a.__tempNumber - b.__tempNumber) : (a.__.zIndex - b.__.zIndex);
|
|
@@ -4522,11 +4551,11 @@ var LeaferUI = (function (exports) {
|
|
|
4522
4551
|
branch = branchStack[i];
|
|
4523
4552
|
children = branch.children;
|
|
4524
4553
|
for (let j = 0, len = children.length; j < len; j++) {
|
|
4525
|
-
updateBounds$
|
|
4554
|
+
updateBounds$3(children[j]);
|
|
4526
4555
|
}
|
|
4527
4556
|
if (exclude && exclude === branch)
|
|
4528
4557
|
continue;
|
|
4529
|
-
updateBounds$
|
|
4558
|
+
updateBounds$3(branch);
|
|
4530
4559
|
}
|
|
4531
4560
|
}
|
|
4532
4561
|
};
|
|
@@ -4544,7 +4573,7 @@ var LeaferUI = (function (exports) {
|
|
|
4544
4573
|
}
|
|
4545
4574
|
};
|
|
4546
4575
|
|
|
4547
|
-
const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
|
|
4576
|
+
const { getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2 } = LeafHelper;
|
|
4548
4577
|
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$6 } = BoundsHelper;
|
|
4549
4578
|
const localContent = '_localContentBounds';
|
|
4550
4579
|
const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
|
|
@@ -4588,7 +4617,9 @@ var LeaferUI = (function (exports) {
|
|
|
4588
4617
|
this._localRenderBounds = local;
|
|
4589
4618
|
}
|
|
4590
4619
|
update() {
|
|
4591
|
-
const { leafer } =
|
|
4620
|
+
const { leaf } = this, { leafer } = leaf;
|
|
4621
|
+
if (leaf.isApp)
|
|
4622
|
+
return updateBounds$2(leaf);
|
|
4592
4623
|
if (leafer) {
|
|
4593
4624
|
if (leafer.ready)
|
|
4594
4625
|
leafer.watcher.changed && leafer.layouter.layout();
|
|
@@ -4596,7 +4627,7 @@ var LeaferUI = (function (exports) {
|
|
|
4596
4627
|
leafer.start();
|
|
4597
4628
|
}
|
|
4598
4629
|
else {
|
|
4599
|
-
let root =
|
|
4630
|
+
let root = leaf;
|
|
4600
4631
|
while (root.parent && !root.parent.leafer) {
|
|
4601
4632
|
root = root.parent;
|
|
4602
4633
|
}
|
|
@@ -4818,7 +4849,7 @@ var LeaferUI = (function (exports) {
|
|
|
4818
4849
|
}
|
|
4819
4850
|
childrenSortChange() {
|
|
4820
4851
|
if (!this.childrenSortChanged) {
|
|
4821
|
-
this.childrenSortChanged = true;
|
|
4852
|
+
this.childrenSortChanged = this.affectChildrenSort = true;
|
|
4822
4853
|
this.leaf.forceUpdate('surface');
|
|
4823
4854
|
}
|
|
4824
4855
|
}
|
|
@@ -4885,6 +4916,40 @@ var LeaferUI = (function (exports) {
|
|
|
4885
4916
|
ImageEvent.LOADED = 'image.loaded';
|
|
4886
4917
|
ImageEvent.ERROR = 'image.error';
|
|
4887
4918
|
|
|
4919
|
+
class BoundsEvent extends Event {
|
|
4920
|
+
static checkHas(leaf, type, mode) {
|
|
4921
|
+
if (mode === 'on') {
|
|
4922
|
+
type === WORLD ? leaf.__hasWorldEvent = true : leaf.__hasLocalEvent = true;
|
|
4923
|
+
}
|
|
4924
|
+
else {
|
|
4925
|
+
leaf.__hasLocalEvent = leaf.hasEvent(RESIZE) || leaf.hasEvent(INNER) || leaf.hasEvent(LOCAL);
|
|
4926
|
+
leaf.__hasWorldEvent = leaf.hasEvent(WORLD);
|
|
4927
|
+
}
|
|
4928
|
+
}
|
|
4929
|
+
static emitLocal(leaf) {
|
|
4930
|
+
if (leaf.leaferIsReady) {
|
|
4931
|
+
const { resized } = leaf.__layout;
|
|
4932
|
+
if (resized !== 'local') {
|
|
4933
|
+
leaf.emit(RESIZE, leaf);
|
|
4934
|
+
if (resized === 'inner')
|
|
4935
|
+
leaf.emit(INNER, leaf);
|
|
4936
|
+
}
|
|
4937
|
+
leaf.emit(LOCAL, leaf);
|
|
4938
|
+
}
|
|
4939
|
+
}
|
|
4940
|
+
static emitWorld(leaf) {
|
|
4941
|
+
if (leaf.leaferIsReady)
|
|
4942
|
+
leaf.emit(WORLD, this);
|
|
4943
|
+
}
|
|
4944
|
+
}
|
|
4945
|
+
BoundsEvent.RESIZE = 'bounds.resize';
|
|
4946
|
+
BoundsEvent.INNER = 'bounds.inner';
|
|
4947
|
+
BoundsEvent.LOCAL = 'bounds.local';
|
|
4948
|
+
BoundsEvent.WORLD = 'bounds.world';
|
|
4949
|
+
const { RESIZE, INNER, LOCAL, WORLD } = BoundsEvent;
|
|
4950
|
+
const boundsEventMap = {};
|
|
4951
|
+
[RESIZE, INNER, LOCAL, WORLD].forEach(key => boundsEventMap[key] = 1);
|
|
4952
|
+
|
|
4888
4953
|
class ResizeEvent extends Event {
|
|
4889
4954
|
get bigger() {
|
|
4890
4955
|
if (!this.old)
|
|
@@ -4981,9 +5046,12 @@ var LeaferUI = (function (exports) {
|
|
|
4981
5046
|
set event(map) { this.on(map); }
|
|
4982
5047
|
on(type, listener, options) {
|
|
4983
5048
|
if (!listener) {
|
|
4984
|
-
let event
|
|
4985
|
-
|
|
4986
|
-
|
|
5049
|
+
let event;
|
|
5050
|
+
if (type instanceof Array)
|
|
5051
|
+
type.forEach(item => this.on(item[0], item[1], item[2]));
|
|
5052
|
+
else
|
|
5053
|
+
for (let key in type)
|
|
5054
|
+
(event = type[key]) instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event);
|
|
4987
5055
|
return;
|
|
4988
5056
|
}
|
|
4989
5057
|
let capture, once;
|
|
@@ -5013,6 +5081,8 @@ var LeaferUI = (function (exports) {
|
|
|
5013
5081
|
else {
|
|
5014
5082
|
map[type] = [item];
|
|
5015
5083
|
}
|
|
5084
|
+
if (boundsEventMap[type])
|
|
5085
|
+
BoundsEvent.checkHas(this, type, 'on');
|
|
5016
5086
|
}
|
|
5017
5087
|
});
|
|
5018
5088
|
}
|
|
@@ -5034,6 +5104,8 @@ var LeaferUI = (function (exports) {
|
|
|
5034
5104
|
events.splice(index, 1);
|
|
5035
5105
|
if (!events.length)
|
|
5036
5106
|
delete map[type];
|
|
5107
|
+
if (boundsEventMap[type])
|
|
5108
|
+
BoundsEvent.checkHas(this, type, 'off');
|
|
5037
5109
|
}
|
|
5038
5110
|
}
|
|
5039
5111
|
});
|
|
@@ -5053,19 +5125,31 @@ var LeaferUI = (function (exports) {
|
|
|
5053
5125
|
}
|
|
5054
5126
|
}
|
|
5055
5127
|
on_(type, listener, bind, options) {
|
|
5056
|
-
if (
|
|
5057
|
-
|
|
5058
|
-
|
|
5128
|
+
if (!listener)
|
|
5129
|
+
(type instanceof Array) && type.forEach(item => this.on(item[0], item[2] ? item[1] = item[1].bind(item[2]) : item[1], item[3]));
|
|
5130
|
+
else
|
|
5131
|
+
this.on(type, bind ? listener = listener.bind(bind) : listener, options);
|
|
5059
5132
|
return { type, current: this, listener, options };
|
|
5060
5133
|
}
|
|
5061
5134
|
off_(id) {
|
|
5062
5135
|
if (!id)
|
|
5063
5136
|
return;
|
|
5064
5137
|
const list = id instanceof Array ? id : [id];
|
|
5065
|
-
list.forEach(item =>
|
|
5138
|
+
list.forEach(item => {
|
|
5139
|
+
if (!item.listener)
|
|
5140
|
+
(item.type instanceof Array) && item.type.forEach(v => item.current.off(v[0], v[1], v[3]));
|
|
5141
|
+
else
|
|
5142
|
+
item.current.off(item.type, item.listener, item.options);
|
|
5143
|
+
});
|
|
5066
5144
|
list.length = 0;
|
|
5067
5145
|
}
|
|
5068
|
-
once(type, listener, capture) {
|
|
5146
|
+
once(type, listener, captureOrBind, capture) {
|
|
5147
|
+
if (!listener)
|
|
5148
|
+
return (type instanceof Array) && type.forEach(item => this.once(item[0], item[1], item[2], item[3]));
|
|
5149
|
+
if (typeof captureOrBind === 'object')
|
|
5150
|
+
listener = listener.bind(captureOrBind);
|
|
5151
|
+
else
|
|
5152
|
+
capture = captureOrBind;
|
|
5069
5153
|
this.on(type, listener, { once: true, capture });
|
|
5070
5154
|
}
|
|
5071
5155
|
emit(type, event, capture) {
|
|
@@ -5177,7 +5261,7 @@ var LeaferUI = (function (exports) {
|
|
|
5177
5261
|
};
|
|
5178
5262
|
|
|
5179
5263
|
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
5180
|
-
const { toPoint: toPoint$3, tempPoint
|
|
5264
|
+
const { toPoint: toPoint$3, tempPoint } = AroundHelper;
|
|
5181
5265
|
const LeafMatrix = {
|
|
5182
5266
|
__updateWorldMatrix() {
|
|
5183
5267
|
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
|
|
@@ -5186,19 +5270,19 @@ var LeaferUI = (function (exports) {
|
|
|
5186
5270
|
if (this.__local) {
|
|
5187
5271
|
const layout = this.__layout, local = this.__local, data = this.__;
|
|
5188
5272
|
if (layout.affectScaleOrRotation) {
|
|
5189
|
-
if (layout.scaleChanged || layout.rotationChanged) {
|
|
5273
|
+
if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
|
|
5190
5274
|
setLayout(local, data, null, null, layout.affectRotation);
|
|
5191
|
-
layout.scaleChanged = layout.rotationChanged =
|
|
5275
|
+
layout.scaleChanged = layout.rotationChanged = undefined;
|
|
5192
5276
|
}
|
|
5193
5277
|
}
|
|
5194
5278
|
local.e = data.x + data.offsetX;
|
|
5195
5279
|
local.f = data.y + data.offsetY;
|
|
5196
5280
|
if (data.around || data.origin) {
|
|
5197
|
-
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint
|
|
5198
|
-
translateInner(local, -tempPoint
|
|
5281
|
+
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint);
|
|
5282
|
+
translateInner(local, -tempPoint.x, -tempPoint.y, !data.around);
|
|
5199
5283
|
}
|
|
5200
5284
|
}
|
|
5201
|
-
this.__layout.matrixChanged =
|
|
5285
|
+
this.__layout.matrixChanged = undefined;
|
|
5202
5286
|
}
|
|
5203
5287
|
};
|
|
5204
5288
|
|
|
@@ -5208,11 +5292,17 @@ var LeaferUI = (function (exports) {
|
|
|
5208
5292
|
const { toBounds: toBounds$1 } = PathBounds;
|
|
5209
5293
|
const LeafBounds = {
|
|
5210
5294
|
__updateWorldBounds() {
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5295
|
+
const layout = this.__layout;
|
|
5296
|
+
toOuterOf$1(layout.renderBounds, this.__world, this.__world);
|
|
5297
|
+
if (layout.resized) {
|
|
5298
|
+
if (layout.resized === 'inner')
|
|
5299
|
+
this.__onUpdateSize();
|
|
5300
|
+
if (this.__hasLocalEvent)
|
|
5301
|
+
BoundsEvent.emitLocal(this);
|
|
5302
|
+
layout.resized = undefined;
|
|
5215
5303
|
}
|
|
5304
|
+
if (this.__hasWorldEvent)
|
|
5305
|
+
BoundsEvent.emitWorld(this);
|
|
5216
5306
|
},
|
|
5217
5307
|
__updateLocalBounds() {
|
|
5218
5308
|
const layout = this.__layout;
|
|
@@ -5221,12 +5311,12 @@ var LeaferUI = (function (exports) {
|
|
|
5221
5311
|
this.__updatePath();
|
|
5222
5312
|
this.__updateRenderPath();
|
|
5223
5313
|
this.__updateBoxBounds();
|
|
5224
|
-
layout.resized =
|
|
5314
|
+
layout.resized = 'inner';
|
|
5225
5315
|
}
|
|
5226
5316
|
if (layout.localBoxChanged) {
|
|
5227
5317
|
if (this.__local)
|
|
5228
5318
|
this.__updateLocalBoxBounds();
|
|
5229
|
-
layout.localBoxChanged =
|
|
5319
|
+
layout.localBoxChanged = undefined;
|
|
5230
5320
|
if (layout.strokeSpread)
|
|
5231
5321
|
layout.strokeChanged = true;
|
|
5232
5322
|
if (layout.renderSpread)
|
|
@@ -5234,7 +5324,7 @@ var LeaferUI = (function (exports) {
|
|
|
5234
5324
|
if (this.parent)
|
|
5235
5325
|
this.parent.__layout.boxChange();
|
|
5236
5326
|
}
|
|
5237
|
-
layout.boxChanged =
|
|
5327
|
+
layout.boxChanged = undefined;
|
|
5238
5328
|
if (layout.strokeChanged) {
|
|
5239
5329
|
layout.strokeSpread = this.__updateStrokeSpread();
|
|
5240
5330
|
if (layout.strokeSpread) {
|
|
@@ -5246,12 +5336,12 @@ var LeaferUI = (function (exports) {
|
|
|
5246
5336
|
else {
|
|
5247
5337
|
layout.spreadStrokeCancel();
|
|
5248
5338
|
}
|
|
5249
|
-
layout.strokeChanged =
|
|
5339
|
+
layout.strokeChanged = undefined;
|
|
5250
5340
|
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
|
|
5251
5341
|
layout.renderChanged = true;
|
|
5252
5342
|
if (this.parent)
|
|
5253
5343
|
this.parent.__layout.strokeChange();
|
|
5254
|
-
layout.resized =
|
|
5344
|
+
layout.resized = 'inner';
|
|
5255
5345
|
}
|
|
5256
5346
|
if (layout.renderChanged) {
|
|
5257
5347
|
layout.renderSpread = this.__updateRenderSpread();
|
|
@@ -5264,11 +5354,12 @@ var LeaferUI = (function (exports) {
|
|
|
5264
5354
|
else {
|
|
5265
5355
|
layout.spreadRenderCancel();
|
|
5266
5356
|
}
|
|
5267
|
-
layout.renderChanged =
|
|
5357
|
+
layout.renderChanged = undefined;
|
|
5268
5358
|
if (this.parent)
|
|
5269
5359
|
this.parent.__layout.renderChange();
|
|
5270
5360
|
}
|
|
5271
|
-
layout.
|
|
5361
|
+
layout.resized || (layout.resized = 'local');
|
|
5362
|
+
layout.boundsChanged = undefined;
|
|
5272
5363
|
},
|
|
5273
5364
|
__updateLocalBoxBounds() {
|
|
5274
5365
|
if (this.__hasMotionPath)
|
|
@@ -5362,7 +5453,7 @@ var LeaferUI = (function (exports) {
|
|
|
5362
5453
|
if (this.__worldOpacity) {
|
|
5363
5454
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5364
5455
|
this.__drawRenderPath(canvas);
|
|
5365
|
-
|
|
5456
|
+
canvas.clipUI(this);
|
|
5366
5457
|
}
|
|
5367
5458
|
},
|
|
5368
5459
|
__updateWorldOpacity() {
|
|
@@ -5808,7 +5899,7 @@ var LeaferUI = (function (exports) {
|
|
|
5808
5899
|
off(_type, _listener, _options) { }
|
|
5809
5900
|
on_(_type, _listener, _bind, _options) { return undefined; }
|
|
5810
5901
|
off_(_id) { }
|
|
5811
|
-
once(_type, _listener, _capture) { }
|
|
5902
|
+
once(_type, _listener, _captureOrBind, _capture) { }
|
|
5812
5903
|
emit(_type, _event, _capture) { }
|
|
5813
5904
|
emitEvent(_event, _capture) { }
|
|
5814
5905
|
hasEvent(_type, _capture) { return false; }
|
|
@@ -6145,7 +6236,7 @@ var LeaferUI = (function (exports) {
|
|
|
6145
6236
|
}
|
|
6146
6237
|
}
|
|
6147
6238
|
|
|
6148
|
-
const version = "1.6.
|
|
6239
|
+
const version = "1.6.4";
|
|
6149
6240
|
|
|
6150
6241
|
const debug$5 = Debug.get('LeaferCanvas');
|
|
6151
6242
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6485,17 +6576,15 @@ var LeaferUI = (function (exports) {
|
|
|
6485
6576
|
this.target.emitEvent(new WatchEvent(WatchEvent.DATA, { updatedList: this.updatedList }));
|
|
6486
6577
|
this.__updatedList = new LeafList();
|
|
6487
6578
|
this.totalTimes++;
|
|
6488
|
-
this.changed = false;
|
|
6489
|
-
this.hasVisible = false;
|
|
6490
|
-
this.hasRemove = false;
|
|
6491
|
-
this.hasAdd = false;
|
|
6579
|
+
this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
6492
6580
|
}
|
|
6493
6581
|
__listenEvents() {
|
|
6494
|
-
const { target } = this;
|
|
6495
6582
|
this.__eventIds = [
|
|
6496
|
-
target.on_(
|
|
6497
|
-
|
|
6498
|
-
|
|
6583
|
+
this.target.on_([
|
|
6584
|
+
[PropertyEvent.CHANGE, this.__onAttrChange, this],
|
|
6585
|
+
[[ChildEvent.ADD, ChildEvent.REMOVE], this.__onChildEvent, this],
|
|
6586
|
+
[WatchEvent.REQUEST, this.__onRquestData, this]
|
|
6587
|
+
])
|
|
6499
6588
|
];
|
|
6500
6589
|
}
|
|
6501
6590
|
__removeListenEvents() {
|
|
@@ -6505,8 +6594,7 @@ var LeaferUI = (function (exports) {
|
|
|
6505
6594
|
if (this.target) {
|
|
6506
6595
|
this.stop();
|
|
6507
6596
|
this.__removeListenEvents();
|
|
6508
|
-
this.target = null;
|
|
6509
|
-
this.__updatedList = null;
|
|
6597
|
+
this.target = this.__updatedList = null;
|
|
6510
6598
|
}
|
|
6511
6599
|
}
|
|
6512
6600
|
}
|
|
@@ -6611,7 +6699,7 @@ var LeaferUI = (function (exports) {
|
|
|
6611
6699
|
this.disabled = true;
|
|
6612
6700
|
}
|
|
6613
6701
|
layout() {
|
|
6614
|
-
if (!this.running)
|
|
6702
|
+
if (this.layouting || !this.running)
|
|
6615
6703
|
return;
|
|
6616
6704
|
const { target } = this;
|
|
6617
6705
|
this.times = 0;
|
|
@@ -6694,12 +6782,10 @@ var LeaferUI = (function (exports) {
|
|
|
6694
6782
|
}
|
|
6695
6783
|
static fullLayout(target) {
|
|
6696
6784
|
updateAllMatrix(target, true);
|
|
6697
|
-
if (target.isBranch)
|
|
6785
|
+
if (target.isBranch)
|
|
6698
6786
|
BranchHelper.updateBounds(target);
|
|
6699
|
-
|
|
6700
|
-
else {
|
|
6787
|
+
else
|
|
6701
6788
|
LeafHelper.updateBounds(target);
|
|
6702
|
-
}
|
|
6703
6789
|
updateAllChange(target);
|
|
6704
6790
|
}
|
|
6705
6791
|
addExtra(leaf) {
|
|
@@ -6722,11 +6808,12 @@ var LeaferUI = (function (exports) {
|
|
|
6722
6808
|
this.__updatedList = event.data.updatedList;
|
|
6723
6809
|
}
|
|
6724
6810
|
__listenEvents() {
|
|
6725
|
-
const { target } = this;
|
|
6726
6811
|
this.__eventIds = [
|
|
6727
|
-
target.on_(
|
|
6728
|
-
|
|
6729
|
-
|
|
6812
|
+
this.target.on_([
|
|
6813
|
+
[LayoutEvent.REQUEST, this.layout, this],
|
|
6814
|
+
[LayoutEvent.AGAIN, this.layoutAgain, this],
|
|
6815
|
+
[WatchEvent.DATA, this.__onReceiveWatchData, this]
|
|
6816
|
+
])
|
|
6730
6817
|
];
|
|
6731
6818
|
}
|
|
6732
6819
|
__removeListenEvents() {
|
|
@@ -6957,12 +7044,13 @@ var LeaferUI = (function (exports) {
|
|
|
6957
7044
|
this.target.emitEvent(new RenderEvent(type, this.times, bounds, options));
|
|
6958
7045
|
}
|
|
6959
7046
|
__listenEvents() {
|
|
6960
|
-
const { target } = this;
|
|
6961
7047
|
this.__eventIds = [
|
|
6962
|
-
target.on_(
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
7048
|
+
this.target.on_([
|
|
7049
|
+
[RenderEvent.REQUEST, this.update, this],
|
|
7050
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
7051
|
+
[RenderEvent.AGAIN, this.renderAgain, this],
|
|
7052
|
+
[ResizeEvent.RESIZE, this.__onResize, this]
|
|
7053
|
+
])
|
|
6966
7054
|
];
|
|
6967
7055
|
}
|
|
6968
7056
|
__removeListenEvents() {
|
|
@@ -7178,8 +7266,32 @@ var LeaferUI = (function (exports) {
|
|
|
7178
7266
|
};
|
|
7179
7267
|
}
|
|
7180
7268
|
|
|
7269
|
+
function hasTransparent$3(color) {
|
|
7270
|
+
if (!color || color.length === 7 || color.length === 4)
|
|
7271
|
+
return false;
|
|
7272
|
+
if (color === 'transparent')
|
|
7273
|
+
return true;
|
|
7274
|
+
const first = color[0];
|
|
7275
|
+
if (first === '#') {
|
|
7276
|
+
switch (color.length) {
|
|
7277
|
+
case 5: return color[4] !== 'f' && color[4] !== 'F';
|
|
7278
|
+
case 9: return (color[7] !== 'f' && color[7] !== 'F') || (color[8] !== 'f' && color[8] !== 'F');
|
|
7279
|
+
}
|
|
7280
|
+
}
|
|
7281
|
+
else if (first === 'r' || first === 'h') {
|
|
7282
|
+
if (color[3] === 'a') {
|
|
7283
|
+
const i = color.lastIndexOf(',');
|
|
7284
|
+
if (i > -1)
|
|
7285
|
+
return parseFloat(color.slice(i + 1)) < 1;
|
|
7286
|
+
}
|
|
7287
|
+
}
|
|
7288
|
+
return false;
|
|
7289
|
+
}
|
|
7290
|
+
|
|
7181
7291
|
const TextConvert = {};
|
|
7182
|
-
const ColorConvert = {
|
|
7292
|
+
const ColorConvert = {
|
|
7293
|
+
hasTransparent: hasTransparent$3
|
|
7294
|
+
};
|
|
7183
7295
|
const UnitConvert = {
|
|
7184
7296
|
number(value, percentRefer) {
|
|
7185
7297
|
return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
|
|
@@ -7205,6 +7317,7 @@ var LeaferUI = (function (exports) {
|
|
|
7205
7317
|
};
|
|
7206
7318
|
|
|
7207
7319
|
const { parse, objectToCanvasData } = PathConvert;
|
|
7320
|
+
const { stintSet: stintSet$2 } = DataHelper, { hasTransparent: hasTransparent$2 } = ColorConvert;
|
|
7208
7321
|
const emptyPaint = {};
|
|
7209
7322
|
const debug$2 = Debug.get('UIData');
|
|
7210
7323
|
class UIData extends LeafData {
|
|
@@ -7263,38 +7376,22 @@ var LeaferUI = (function (exports) {
|
|
|
7263
7376
|
if (this.__naturalWidth)
|
|
7264
7377
|
this.__removeNaturalSize();
|
|
7265
7378
|
if (typeof value === 'string' || !value) {
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
PaintImage.recycleImage('fill', this);
|
|
7269
|
-
this.__isFills = false;
|
|
7270
|
-
this.__pixelFill && (this.__pixelFill = false);
|
|
7271
|
-
}
|
|
7379
|
+
stintSet$2(this, '__isTransparentFill', hasTransparent$2(value));
|
|
7380
|
+
this.__isFills && this.__removePaint('fill', true);
|
|
7272
7381
|
this._fill = value;
|
|
7273
7382
|
}
|
|
7274
7383
|
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);
|
|
7384
|
+
this.__setPaint('fill', value);
|
|
7280
7385
|
}
|
|
7281
7386
|
}
|
|
7282
7387
|
setStroke(value) {
|
|
7283
7388
|
if (typeof value === 'string' || !value) {
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
PaintImage.recycleImage('stroke', this);
|
|
7287
|
-
this.__isStrokes = false;
|
|
7288
|
-
this.__pixelStroke && (this.__pixelStroke = false);
|
|
7289
|
-
}
|
|
7389
|
+
stintSet$2(this, '__isTransparentStroke', hasTransparent$2(value));
|
|
7390
|
+
this.__isStrokes && this.__removePaint('stroke', true);
|
|
7290
7391
|
this._stroke = value;
|
|
7291
7392
|
}
|
|
7292
7393
|
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);
|
|
7394
|
+
this.__setPaint('stroke', value);
|
|
7298
7395
|
}
|
|
7299
7396
|
}
|
|
7300
7397
|
setPath(value) {
|
|
@@ -7324,7 +7421,34 @@ var LeaferUI = (function (exports) {
|
|
|
7324
7421
|
Paint.compute('fill', this.__leaf);
|
|
7325
7422
|
if (stroke)
|
|
7326
7423
|
Paint.compute('stroke', this.__leaf);
|
|
7327
|
-
this.__needComputePaint =
|
|
7424
|
+
this.__needComputePaint = undefined;
|
|
7425
|
+
}
|
|
7426
|
+
__setPaint(attrName, value) {
|
|
7427
|
+
this.__setInput(attrName, value);
|
|
7428
|
+
const layout = this.__leaf.__layout;
|
|
7429
|
+
layout.boxChanged || layout.boxChange();
|
|
7430
|
+
if (value instanceof Array && !value.length) {
|
|
7431
|
+
this.__removePaint(attrName);
|
|
7432
|
+
}
|
|
7433
|
+
else {
|
|
7434
|
+
if (attrName === 'fill')
|
|
7435
|
+
this.__isFills = true, this._fill || (this._fill = emptyPaint);
|
|
7436
|
+
else
|
|
7437
|
+
this.__isStrokes = true, this._stroke || (this._stroke = emptyPaint);
|
|
7438
|
+
}
|
|
7439
|
+
}
|
|
7440
|
+
__removePaint(attrName, removeInput) {
|
|
7441
|
+
if (removeInput)
|
|
7442
|
+
this.__removeInput(attrName);
|
|
7443
|
+
PaintImage.recycleImage(attrName, this);
|
|
7444
|
+
if (attrName === 'fill') {
|
|
7445
|
+
stintSet$2(this, '__isAlphaPixelFill', undefined);
|
|
7446
|
+
this._fill = this.__isFills = undefined;
|
|
7447
|
+
}
|
|
7448
|
+
else {
|
|
7449
|
+
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7450
|
+
this._stroke = this.__isStrokes = undefined;
|
|
7451
|
+
}
|
|
7328
7452
|
}
|
|
7329
7453
|
}
|
|
7330
7454
|
function setArray(data, key, value) {
|
|
@@ -7332,10 +7456,10 @@ var LeaferUI = (function (exports) {
|
|
|
7332
7456
|
if (value instanceof Array) {
|
|
7333
7457
|
if (value.some((item) => item.visible === false))
|
|
7334
7458
|
value = value.filter((item) => item.visible !== false);
|
|
7335
|
-
value.length || (value =
|
|
7459
|
+
value.length || (value = undefined);
|
|
7336
7460
|
}
|
|
7337
7461
|
else
|
|
7338
|
-
value = value && value.visible !== false ? [value] :
|
|
7462
|
+
value = value && value.visible !== false ? [value] : undefined;
|
|
7339
7463
|
data['_' + key] = value;
|
|
7340
7464
|
}
|
|
7341
7465
|
|
|
@@ -7438,8 +7562,6 @@ var LeaferUI = (function (exports) {
|
|
|
7438
7562
|
this._url = value;
|
|
7439
7563
|
}
|
|
7440
7564
|
__setImageFill(value) {
|
|
7441
|
-
if (this.__leaf.image)
|
|
7442
|
-
this.__leaf.image = null;
|
|
7443
7565
|
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
7444
7566
|
}
|
|
7445
7567
|
__getData() {
|
|
@@ -7505,21 +7627,19 @@ var LeaferUI = (function (exports) {
|
|
|
7505
7627
|
}
|
|
7506
7628
|
};
|
|
7507
7629
|
|
|
7630
|
+
const { stintSet: stintSet$1 } = DataHelper;
|
|
7508
7631
|
const UIRender = {
|
|
7509
7632
|
__updateChange() {
|
|
7510
|
-
const data = this.__
|
|
7633
|
+
const data = this.__;
|
|
7511
7634
|
if (data.__useEffect) {
|
|
7512
|
-
const { shadow,
|
|
7513
|
-
data.
|
|
7635
|
+
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7636
|
+
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')));
|
|
7637
|
+
data.__useEffect = !!(shadow || otherEffect);
|
|
7514
7638
|
}
|
|
7515
|
-
|
|
7516
|
-
|
|
7639
|
+
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7640
|
+
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7517
7641
|
data.__checkSingle();
|
|
7518
|
-
|
|
7519
|
-
if (complex)
|
|
7520
|
-
data.__complex = true;
|
|
7521
|
-
else
|
|
7522
|
-
data.__complex && (data.__complex = false);
|
|
7642
|
+
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7523
7643
|
},
|
|
7524
7644
|
__drawFast(canvas, options) {
|
|
7525
7645
|
drawFast(this, canvas, options);
|
|
@@ -7529,21 +7649,23 @@ var LeaferUI = (function (exports) {
|
|
|
7529
7649
|
if (data.__complex) {
|
|
7530
7650
|
if (data.__needComputePaint)
|
|
7531
7651
|
data.__computePaint();
|
|
7532
|
-
const { fill, stroke, __drawAfterFill } = data;
|
|
7652
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke, __isFastShadow } = data;
|
|
7533
7653
|
this.__drawRenderPath(canvas);
|
|
7534
|
-
if (data.__useEffect) {
|
|
7654
|
+
if (data.__useEffect && !__isFastShadow) {
|
|
7535
7655
|
const shape = Paint.shape(this, canvas, options);
|
|
7536
7656
|
this.__nowWorld = this.__getNowWorld(options);
|
|
7537
7657
|
const { shadow, innerShadow, filter } = data;
|
|
7538
7658
|
if (shadow)
|
|
7539
7659
|
Effect.shadow(this, canvas, shape);
|
|
7660
|
+
if (__fillAfterStroke)
|
|
7661
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7540
7662
|
if (fill)
|
|
7541
7663
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7542
7664
|
if (__drawAfterFill)
|
|
7543
7665
|
this.__drawAfterFill(canvas, options);
|
|
7544
7666
|
if (innerShadow)
|
|
7545
7667
|
Effect.innerShadow(this, canvas, shape);
|
|
7546
|
-
if (stroke)
|
|
7668
|
+
if (stroke && !__fillAfterStroke)
|
|
7547
7669
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7548
7670
|
if (filter)
|
|
7549
7671
|
Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
@@ -7552,21 +7674,27 @@ var LeaferUI = (function (exports) {
|
|
|
7552
7674
|
shape.canvas.recycle();
|
|
7553
7675
|
}
|
|
7554
7676
|
else {
|
|
7677
|
+
if (__fillAfterStroke)
|
|
7678
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7679
|
+
if (__isFastShadow) {
|
|
7680
|
+
const shadow = data.shadow[0], { scaleX, scaleY } = this.__nowWorld;
|
|
7681
|
+
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
7682
|
+
}
|
|
7555
7683
|
if (fill)
|
|
7556
7684
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7685
|
+
if (__isFastShadow)
|
|
7686
|
+
canvas.restore();
|
|
7557
7687
|
if (__drawAfterFill)
|
|
7558
7688
|
this.__drawAfterFill(canvas, options);
|
|
7559
|
-
if (stroke)
|
|
7689
|
+
if (stroke && !__fillAfterStroke)
|
|
7560
7690
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7561
7691
|
}
|
|
7562
7692
|
}
|
|
7563
7693
|
else {
|
|
7564
|
-
if (data.__pathInputed)
|
|
7694
|
+
if (data.__pathInputed)
|
|
7565
7695
|
drawFast(this, canvas, options);
|
|
7566
|
-
|
|
7567
|
-
else {
|
|
7696
|
+
else
|
|
7568
7697
|
this.__drawFast(canvas, options);
|
|
7569
|
-
}
|
|
7570
7698
|
}
|
|
7571
7699
|
},
|
|
7572
7700
|
__renderShape(canvas, options, ignoreFill, ignoreStroke) {
|
|
@@ -7575,17 +7703,17 @@ var LeaferUI = (function (exports) {
|
|
|
7575
7703
|
const { fill, stroke } = this.__;
|
|
7576
7704
|
this.__drawRenderPath(canvas);
|
|
7577
7705
|
if (fill && !ignoreFill)
|
|
7578
|
-
this.__.
|
|
7706
|
+
this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7579
7707
|
if (this.__.__isCanvas)
|
|
7580
7708
|
this.__drawAfterFill(canvas, options);
|
|
7581
7709
|
if (stroke && !ignoreStroke)
|
|
7582
|
-
this.__.
|
|
7710
|
+
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7583
7711
|
}
|
|
7584
7712
|
},
|
|
7585
7713
|
__drawAfterFill(canvas, options) {
|
|
7586
7714
|
if (this.__.__clipAfterFill) {
|
|
7587
7715
|
canvas.save();
|
|
7588
|
-
|
|
7716
|
+
canvas.clipUI();
|
|
7589
7717
|
this.__drawContent(canvas, options);
|
|
7590
7718
|
canvas.restore();
|
|
7591
7719
|
}
|
|
@@ -7594,13 +7722,15 @@ var LeaferUI = (function (exports) {
|
|
|
7594
7722
|
}
|
|
7595
7723
|
};
|
|
7596
7724
|
function drawFast(ui, canvas, options) {
|
|
7597
|
-
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
7725
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke } = ui.__;
|
|
7598
7726
|
ui.__drawRenderPath(canvas);
|
|
7727
|
+
if (__fillAfterStroke)
|
|
7728
|
+
Paint.stroke(stroke, ui, canvas);
|
|
7599
7729
|
if (fill)
|
|
7600
7730
|
Paint.fill(fill, ui, canvas);
|
|
7601
7731
|
if (__drawAfterFill)
|
|
7602
7732
|
ui.__drawAfterFill(canvas, options);
|
|
7603
|
-
if (stroke)
|
|
7733
|
+
if (stroke && !__fillAfterStroke)
|
|
7604
7734
|
Paint.stroke(stroke, ui, canvas);
|
|
7605
7735
|
}
|
|
7606
7736
|
|
|
@@ -7972,6 +8102,9 @@ var LeaferUI = (function (exports) {
|
|
|
7972
8102
|
__decorate([
|
|
7973
8103
|
surfaceType()
|
|
7974
8104
|
], exports.UI.prototype, "placeholderColor", void 0);
|
|
8105
|
+
__decorate([
|
|
8106
|
+
dataType(100)
|
|
8107
|
+
], exports.UI.prototype, "placeholderDelay", void 0);
|
|
7975
8108
|
__decorate([
|
|
7976
8109
|
dataType({})
|
|
7977
8110
|
], exports.UI.prototype, "data", void 0);
|
|
@@ -8373,15 +8506,20 @@ var LeaferUI = (function (exports) {
|
|
|
8373
8506
|
}
|
|
8374
8507
|
__listenEvents() {
|
|
8375
8508
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8376
|
-
this.once(
|
|
8377
|
-
|
|
8378
|
-
|
|
8379
|
-
|
|
8380
|
-
|
|
8509
|
+
this.once([
|
|
8510
|
+
[LeaferEvent.START, () => Run.end(runId)],
|
|
8511
|
+
[LayoutEvent.START, this.updateLazyBounds, this],
|
|
8512
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
8513
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
8514
|
+
]);
|
|
8515
|
+
this.__eventIds.push(this.on_([
|
|
8516
|
+
[WatchEvent.DATA, this.__onWatchData, this],
|
|
8517
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
8518
|
+
[RenderEvent.NEXT, this.__onNextRender, this]
|
|
8519
|
+
]));
|
|
8381
8520
|
}
|
|
8382
8521
|
__removeListenEvents() {
|
|
8383
8522
|
this.off_(this.__eventIds);
|
|
8384
|
-
this.__eventIds.length = 0;
|
|
8385
8523
|
}
|
|
8386
8524
|
destroy(sync) {
|
|
8387
8525
|
const doDestory = () => {
|
|
@@ -8489,13 +8627,13 @@ var LeaferUI = (function (exports) {
|
|
|
8489
8627
|
super.__updateRenderBounds();
|
|
8490
8628
|
copy$3(childrenRenderBounds, renderBounds);
|
|
8491
8629
|
this.__updateRectRenderBounds();
|
|
8492
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8630
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8493
8631
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8494
8632
|
add(renderBounds, childrenRenderBounds);
|
|
8495
8633
|
}
|
|
8496
8634
|
else
|
|
8497
8635
|
this.__updateRectRenderBounds();
|
|
8498
|
-
|
|
8636
|
+
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8499
8637
|
}
|
|
8500
8638
|
__updateRectRenderBounds() { }
|
|
8501
8639
|
__updateRectChange() { }
|
|
@@ -8799,18 +8937,10 @@ var LeaferUI = (function (exports) {
|
|
|
8799
8937
|
|
|
8800
8938
|
exports.Image = class Image extends exports.Rect {
|
|
8801
8939
|
get __tag() { return 'Image'; }
|
|
8802
|
-
get ready() {
|
|
8940
|
+
get ready() { const { image } = this; return image && image.ready; }
|
|
8941
|
+
get image() { const { fill } = this.__; return fill instanceof Array && fill[0].image; }
|
|
8803
8942
|
constructor(data) {
|
|
8804
8943
|
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
8944
|
}
|
|
8815
8945
|
};
|
|
8816
8946
|
__decorate([
|
|
@@ -8826,11 +8956,11 @@ var LeaferUI = (function (exports) {
|
|
|
8826
8956
|
|
|
8827
8957
|
exports.Canvas = class Canvas extends exports.Rect {
|
|
8828
8958
|
get __tag() { return 'Canvas'; }
|
|
8959
|
+
get context() { return this.canvas.context; }
|
|
8829
8960
|
get ready() { return !this.url; }
|
|
8830
8961
|
constructor(data) {
|
|
8831
8962
|
super(data);
|
|
8832
8963
|
this.canvas = Creator.canvas(this.__);
|
|
8833
|
-
this.context = this.canvas.context;
|
|
8834
8964
|
if (data && data.url)
|
|
8835
8965
|
this.drawImage(data.url);
|
|
8836
8966
|
}
|
|
@@ -8874,7 +9004,7 @@ var LeaferUI = (function (exports) {
|
|
|
8874
9004
|
destroy() {
|
|
8875
9005
|
if (this.canvas) {
|
|
8876
9006
|
this.canvas.destroy();
|
|
8877
|
-
this.canvas =
|
|
9007
|
+
this.canvas = null;
|
|
8878
9008
|
}
|
|
8879
9009
|
super.destroy();
|
|
8880
9010
|
}
|
|
@@ -8950,12 +9080,11 @@ var LeaferUI = (function (exports) {
|
|
|
8950
9080
|
super.__updateBoxBounds();
|
|
8951
9081
|
if (italic)
|
|
8952
9082
|
b.width += fontSize * 0.16;
|
|
8953
|
-
|
|
8954
|
-
if (isOverflow)
|
|
9083
|
+
DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds));
|
|
9084
|
+
if (this.isOverflow)
|
|
8955
9085
|
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8956
9086
|
else
|
|
8957
9087
|
data.__textBoxBounds = b;
|
|
8958
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8959
9088
|
}
|
|
8960
9089
|
__onUpdateSize() {
|
|
8961
9090
|
if (this.__box)
|
|
@@ -9069,6 +9198,9 @@ var LeaferUI = (function (exports) {
|
|
|
9069
9198
|
__decorate([
|
|
9070
9199
|
boundsType('show')
|
|
9071
9200
|
], exports.Text.prototype, "textOverflow", void 0);
|
|
9201
|
+
__decorate([
|
|
9202
|
+
surfaceType(false)
|
|
9203
|
+
], exports.Text.prototype, "textEditing", void 0);
|
|
9072
9204
|
exports.Text = __decorate([
|
|
9073
9205
|
registerUI()
|
|
9074
9206
|
], exports.Text);
|
|
@@ -9156,7 +9288,7 @@ var LeaferUI = (function (exports) {
|
|
|
9156
9288
|
if (sky || editor)
|
|
9157
9289
|
this.sky = this.addLeafer(sky);
|
|
9158
9290
|
if (editor)
|
|
9159
|
-
|
|
9291
|
+
Creator.editor(editor, this);
|
|
9160
9292
|
}
|
|
9161
9293
|
}
|
|
9162
9294
|
__setApp() {
|
|
@@ -9170,6 +9302,10 @@ var LeaferUI = (function (exports) {
|
|
|
9170
9302
|
this.watcher.disable();
|
|
9171
9303
|
this.layouter.disable();
|
|
9172
9304
|
}
|
|
9305
|
+
__updateLocalBounds() {
|
|
9306
|
+
this.forEach(leafer => leafer.updateLayout());
|
|
9307
|
+
super.__updateLocalBounds();
|
|
9308
|
+
}
|
|
9173
9309
|
start() {
|
|
9174
9310
|
super.start();
|
|
9175
9311
|
this.forEach(leafer => leafer.start());
|
|
@@ -9227,12 +9363,8 @@ var LeaferUI = (function (exports) {
|
|
|
9227
9363
|
this.renderer.update();
|
|
9228
9364
|
}
|
|
9229
9365
|
__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
|
-
}
|
|
9366
|
+
if (canvas.context)
|
|
9367
|
+
this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
|
|
9236
9368
|
}
|
|
9237
9369
|
__onResize(event) {
|
|
9238
9370
|
this.forEach(leafer => leafer.resize(event));
|
|
@@ -9253,9 +9385,11 @@ var LeaferUI = (function (exports) {
|
|
|
9253
9385
|
return config;
|
|
9254
9386
|
}
|
|
9255
9387
|
__listenChildEvents(leafer) {
|
|
9256
|
-
leafer.once(
|
|
9257
|
-
|
|
9258
|
-
|
|
9388
|
+
leafer.once([
|
|
9389
|
+
[LayoutEvent.END, this.__onReady, this],
|
|
9390
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
9391
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
9392
|
+
]);
|
|
9259
9393
|
if (this.realCanvas)
|
|
9260
9394
|
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9261
9395
|
}
|
|
@@ -9466,7 +9600,7 @@ var LeaferUI = (function (exports) {
|
|
|
9466
9600
|
registerUIEvent()
|
|
9467
9601
|
], exports.MoveEvent);
|
|
9468
9602
|
|
|
9469
|
-
exports.RotateEvent = class RotateEvent extends
|
|
9603
|
+
exports.RotateEvent = class RotateEvent extends exports.PointerEvent {
|
|
9470
9604
|
};
|
|
9471
9605
|
exports.RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
|
|
9472
9606
|
exports.RotateEvent.START = 'rotate.start';
|
|
@@ -9487,7 +9621,7 @@ var LeaferUI = (function (exports) {
|
|
|
9487
9621
|
registerUIEvent()
|
|
9488
9622
|
], exports.SwipeEvent);
|
|
9489
9623
|
|
|
9490
|
-
exports.ZoomEvent = class ZoomEvent extends
|
|
9624
|
+
exports.ZoomEvent = class ZoomEvent extends exports.PointerEvent {
|
|
9491
9625
|
};
|
|
9492
9626
|
exports.ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
|
|
9493
9627
|
exports.ZoomEvent.START = 'zoom.start';
|
|
@@ -10330,8 +10464,8 @@ var LeaferUI = (function (exports) {
|
|
|
10330
10464
|
if (this.__box)
|
|
10331
10465
|
this.__box.__updateHitCanvas();
|
|
10332
10466
|
const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
|
|
10333
|
-
const isHitPixelFill = (data.
|
|
10334
|
-
const isHitPixelStroke = data.
|
|
10467
|
+
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
10468
|
+
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
10335
10469
|
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
10336
10470
|
if (!this.__hitCanvas)
|
|
10337
10471
|
this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
|
|
@@ -10362,11 +10496,11 @@ var LeaferUI = (function (exports) {
|
|
|
10362
10496
|
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
10363
10497
|
return true;
|
|
10364
10498
|
const { hitFill } = data;
|
|
10365
|
-
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.
|
|
10499
|
+
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
10366
10500
|
if (needHitFillPath && this.__hitFill(inner))
|
|
10367
10501
|
return true;
|
|
10368
10502
|
const { hitStroke, __strokeWidth } = data;
|
|
10369
|
-
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.
|
|
10503
|
+
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
10370
10504
|
if (!needHitFillPath && !needHitStrokePath)
|
|
10371
10505
|
return false;
|
|
10372
10506
|
const radiusWidth = inner.radiusX * 2;
|
|
@@ -10816,35 +10950,38 @@ var LeaferUI = (function (exports) {
|
|
|
10816
10950
|
}
|
|
10817
10951
|
|
|
10818
10952
|
function strokeText(stroke, ui, canvas) {
|
|
10819
|
-
|
|
10820
|
-
const isStrokes = typeof stroke !== 'string';
|
|
10821
|
-
switch (strokeAlign) {
|
|
10953
|
+
switch (ui.__.strokeAlign) {
|
|
10822
10954
|
case 'center':
|
|
10823
|
-
|
|
10824
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
10955
|
+
drawCenter$1(stroke, 1, ui, canvas);
|
|
10825
10956
|
break;
|
|
10826
10957
|
case 'inside':
|
|
10827
|
-
|
|
10958
|
+
drawAlign(stroke, 'inside', ui, canvas);
|
|
10828
10959
|
break;
|
|
10829
10960
|
case 'outside':
|
|
10830
|
-
|
|
10961
|
+
ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, 'outside', ui, canvas);
|
|
10831
10962
|
break;
|
|
10832
10963
|
}
|
|
10833
10964
|
}
|
|
10834
|
-
function
|
|
10835
|
-
const
|
|
10965
|
+
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
10966
|
+
const data = ui.__;
|
|
10967
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
|
|
10968
|
+
data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
10969
|
+
}
|
|
10970
|
+
function drawAlign(stroke, align, ui, canvas) {
|
|
10836
10971
|
const out = canvas.getSameCanvas(true, true);
|
|
10837
|
-
out.
|
|
10838
|
-
|
|
10839
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
|
|
10972
|
+
out.font = ui.__.__font;
|
|
10973
|
+
drawCenter$1(stroke, 2, ui, out);
|
|
10840
10974
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10841
10975
|
fillText(ui, out);
|
|
10842
10976
|
out.blendMode = 'normal';
|
|
10843
|
-
|
|
10977
|
+
copyWorld(canvas, out, ui);
|
|
10978
|
+
out.recycle(ui.__nowWorld);
|
|
10979
|
+
}
|
|
10980
|
+
function copyWorld(canvas, out, ui) {
|
|
10981
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
10844
10982
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10845
10983
|
else
|
|
10846
10984
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10847
|
-
out.recycle(ui.__nowWorld);
|
|
10848
10985
|
}
|
|
10849
10986
|
function drawTextStroke(ui, canvas) {
|
|
10850
10987
|
let row, data = ui.__.__textDrawData;
|
|
@@ -10882,90 +11019,56 @@ var LeaferUI = (function (exports) {
|
|
|
10882
11019
|
}
|
|
10883
11020
|
|
|
10884
11021
|
function stroke(stroke, ui, canvas) {
|
|
10885
|
-
const
|
|
10886
|
-
|
|
10887
|
-
if (!__strokeWidth)
|
|
11022
|
+
const data = ui.__;
|
|
11023
|
+
if (!data.__strokeWidth)
|
|
10888
11024
|
return;
|
|
10889
|
-
if (__font) {
|
|
11025
|
+
if (data.__font) {
|
|
10890
11026
|
strokeText(stroke, ui, canvas);
|
|
10891
11027
|
}
|
|
10892
11028
|
else {
|
|
10893
|
-
switch (strokeAlign) {
|
|
11029
|
+
switch (data.strokeAlign) {
|
|
10894
11030
|
case 'center':
|
|
10895
|
-
|
|
10896
|
-
canvas.stroke();
|
|
10897
|
-
if (options.__useArrow)
|
|
10898
|
-
strokeArrow(ui, canvas);
|
|
11031
|
+
drawCenter(stroke, 1, ui, canvas);
|
|
10899
11032
|
break;
|
|
10900
11033
|
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();
|
|
11034
|
+
drawInside(stroke, ui, canvas);
|
|
10906
11035
|
break;
|
|
10907
11036
|
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);
|
|
11037
|
+
drawOutside(stroke, ui, canvas);
|
|
10919
11038
|
break;
|
|
10920
11039
|
}
|
|
10921
11040
|
}
|
|
10922
11041
|
}
|
|
10923
11042
|
function strokes(strokes, ui, canvas) {
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
|
|
10929
|
-
|
|
11043
|
+
stroke(strokes, ui, canvas);
|
|
11044
|
+
}
|
|
11045
|
+
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
11046
|
+
const data = ui.__;
|
|
11047
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
11048
|
+
data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
|
|
11049
|
+
if (data.__useArrow)
|
|
11050
|
+
Paint.strokeArrow(stroke, ui, canvas);
|
|
11051
|
+
}
|
|
11052
|
+
function drawInside(stroke, ui, canvas) {
|
|
11053
|
+
canvas.save();
|
|
11054
|
+
canvas.clipUI(ui);
|
|
11055
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
11056
|
+
canvas.restore();
|
|
11057
|
+
}
|
|
11058
|
+
function drawOutside(stroke, ui, canvas) {
|
|
11059
|
+
const data = ui.__;
|
|
11060
|
+
if (data.__fillAfterStroke) {
|
|
11061
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
10930
11062
|
}
|
|
10931
11063
|
else {
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
|
|
10938
|
-
|
|
10939
|
-
|
|
10940
|
-
canvas.save();
|
|
10941
|
-
canvas.setStroke(undefined, __strokeWidth * 2, options);
|
|
10942
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
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();
|
|
11064
|
+
const { renderBounds } = ui.__layout;
|
|
11065
|
+
const out = canvas.getSameCanvas(true, true);
|
|
11066
|
+
ui.__drawRenderPath(out);
|
|
11067
|
+
drawCenter(stroke, 2, ui, out);
|
|
11068
|
+
out.clipUI(data);
|
|
11069
|
+
out.clearWorld(renderBounds);
|
|
11070
|
+
copyWorld(canvas, out, ui);
|
|
11071
|
+
out.recycle(ui.__nowWorld);
|
|
10969
11072
|
}
|
|
10970
11073
|
}
|
|
10971
11074
|
|
|
@@ -11012,41 +11115,66 @@ var LeaferUI = (function (exports) {
|
|
|
11012
11115
|
}
|
|
11013
11116
|
|
|
11014
11117
|
let recycleMap;
|
|
11118
|
+
const { stintSet } = DataHelper, { hasTransparent: hasTransparent$1 } = ColorConvert;
|
|
11015
11119
|
function compute(attrName, ui) {
|
|
11016
11120
|
const data = ui.__, leafPaints = [];
|
|
11017
|
-
let paints = data.__input[attrName],
|
|
11121
|
+
let paints = data.__input[attrName], isAlphaPixel, isTransparent;
|
|
11018
11122
|
if (!(paints instanceof Array))
|
|
11019
11123
|
paints = [paints];
|
|
11020
11124
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
11021
11125
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
11022
|
-
item = getLeafPaint(attrName, paints[i], ui);
|
|
11023
|
-
if (item)
|
|
11024
|
-
leafPaints.push(item);
|
|
11126
|
+
(item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
|
|
11025
11127
|
}
|
|
11026
11128
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
11027
|
-
if (leafPaints.length
|
|
11028
|
-
|
|
11029
|
-
|
|
11129
|
+
if (leafPaints.length) {
|
|
11130
|
+
if (leafPaints.every(item => item.isTransparent)) {
|
|
11131
|
+
if (leafPaints.some(item => item.image))
|
|
11132
|
+
isAlphaPixel = true;
|
|
11133
|
+
isTransparent = true;
|
|
11134
|
+
}
|
|
11135
|
+
}
|
|
11136
|
+
if (attrName === 'fill') {
|
|
11137
|
+
stintSet(data, '__isAlphaPixelFill', isAlphaPixel);
|
|
11138
|
+
stintSet(data, '__isTransparentFill', isTransparent);
|
|
11139
|
+
}
|
|
11140
|
+
else {
|
|
11141
|
+
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
11142
|
+
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
11143
|
+
}
|
|
11030
11144
|
}
|
|
11031
11145
|
function getLeafPaint(attrName, paint, ui) {
|
|
11032
11146
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
|
11033
11147
|
return undefined;
|
|
11148
|
+
let data;
|
|
11034
11149
|
const { boxBounds } = ui.__layout;
|
|
11035
11150
|
switch (paint.type) {
|
|
11036
|
-
case 'solid':
|
|
11037
|
-
let { type, blendMode, color, opacity } = paint;
|
|
11038
|
-
return { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
11039
11151
|
case 'image':
|
|
11040
|
-
|
|
11152
|
+
data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
11153
|
+
break;
|
|
11041
11154
|
case 'linear':
|
|
11042
|
-
|
|
11155
|
+
data = PaintGradient.linearGradient(paint, boxBounds);
|
|
11156
|
+
break;
|
|
11043
11157
|
case 'radial':
|
|
11044
|
-
|
|
11158
|
+
data = PaintGradient.radialGradient(paint, boxBounds);
|
|
11159
|
+
break;
|
|
11045
11160
|
case 'angular':
|
|
11046
|
-
|
|
11161
|
+
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
11162
|
+
break;
|
|
11163
|
+
case 'solid':
|
|
11164
|
+
const { type, color, opacity } = paint;
|
|
11165
|
+
data = { type, style: ColorConvert.string(color, opacity) };
|
|
11166
|
+
break;
|
|
11047
11167
|
default:
|
|
11048
|
-
|
|
11168
|
+
if (paint.r !== undefined)
|
|
11169
|
+
data = { type: 'solid', style: ColorConvert.string(paint) };
|
|
11170
|
+
}
|
|
11171
|
+
if (data) {
|
|
11172
|
+
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
11173
|
+
data.isTransparent = true;
|
|
11174
|
+
if (paint.blendMode)
|
|
11175
|
+
data.blendMode = paint.blendMode;
|
|
11049
11176
|
}
|
|
11177
|
+
return data;
|
|
11050
11178
|
}
|
|
11051
11179
|
|
|
11052
11180
|
const PaintModule = {
|
|
@@ -11112,12 +11240,10 @@ var LeaferUI = (function (exports) {
|
|
|
11112
11240
|
|
|
11113
11241
|
const { get: get$2, translate } = MatrixHelper;
|
|
11114
11242
|
const tempBox = new Bounds();
|
|
11115
|
-
const tempPoint = {};
|
|
11116
11243
|
const tempScaleData = {};
|
|
11244
|
+
const tempImage = {};
|
|
11117
11245
|
function createData(leafPaint, image, paint, box) {
|
|
11118
|
-
const {
|
|
11119
|
-
if (blendMode)
|
|
11120
|
-
leafPaint.blendMode = blendMode;
|
|
11246
|
+
const { changeful, sync } = paint;
|
|
11121
11247
|
if (changeful)
|
|
11122
11248
|
leafPaint.changeful = changeful;
|
|
11123
11249
|
if (sync)
|
|
@@ -11125,38 +11251,38 @@ var LeaferUI = (function (exports) {
|
|
|
11125
11251
|
leafPaint.data = getPatternData(paint, box, image);
|
|
11126
11252
|
}
|
|
11127
11253
|
function getPatternData(paint, box, image) {
|
|
11128
|
-
let { width, height } = image;
|
|
11129
11254
|
if (paint.padding)
|
|
11130
11255
|
box = tempBox.set(box).shrink(paint.padding);
|
|
11131
11256
|
if (paint.mode === 'strench')
|
|
11132
11257
|
paint.mode = 'stretch';
|
|
11258
|
+
let { width, height } = image;
|
|
11133
11259
|
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
11134
11260
|
const sameBox = box.width === width && box.height === height;
|
|
11135
11261
|
const data = { mode };
|
|
11136
11262
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
11137
|
-
|
|
11138
|
-
let
|
|
11263
|
+
BoundsHelper.set(tempImage, 0, 0, swapSize ? height : width, swapSize ? width : height);
|
|
11264
|
+
let scaleX, scaleY;
|
|
11139
11265
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
11140
11266
|
if (!sameBox || rotation) {
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
|
|
11267
|
+
scaleX = scaleY = BoundsHelper.getFitScale(box, tempImage, mode !== 'fit');
|
|
11268
|
+
BoundsHelper.put(box, image, align, scaleX, false, tempImage);
|
|
11269
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
11144
11270
|
}
|
|
11145
11271
|
}
|
|
11146
|
-
else
|
|
11147
|
-
|
|
11148
|
-
|
|
11149
|
-
|
|
11150
|
-
|
|
11151
|
-
|
|
11152
|
-
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
|
|
11272
|
+
else {
|
|
11273
|
+
if (scale || size) {
|
|
11274
|
+
MathHelper.getScaleData(scale, size, image, tempScaleData);
|
|
11275
|
+
scaleX = tempScaleData.scaleX;
|
|
11276
|
+
scaleY = tempScaleData.scaleY;
|
|
11277
|
+
}
|
|
11278
|
+
if (align) {
|
|
11279
|
+
if (scaleX)
|
|
11280
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
11281
|
+
AlignHelper.toPoint(align, tempImage, box, tempImage, true, true);
|
|
11282
|
+
}
|
|
11157
11283
|
}
|
|
11158
11284
|
if (offset)
|
|
11159
|
-
|
|
11285
|
+
PointHelper.move(tempImage, offset);
|
|
11160
11286
|
switch (mode) {
|
|
11161
11287
|
case 'stretch':
|
|
11162
11288
|
if (!sameBox)
|
|
@@ -11164,12 +11290,12 @@ var LeaferUI = (function (exports) {
|
|
|
11164
11290
|
break;
|
|
11165
11291
|
case 'normal':
|
|
11166
11292
|
case 'clip':
|
|
11167
|
-
if (x || y || scaleX || rotation)
|
|
11168
|
-
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
11293
|
+
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
11294
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
11169
11295
|
break;
|
|
11170
11296
|
case 'repeat':
|
|
11171
11297
|
if (!sameBox || scaleX || rotation)
|
|
11172
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
11298
|
+
repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, align);
|
|
11173
11299
|
if (!repeat)
|
|
11174
11300
|
data.repeat = 'repeat';
|
|
11175
11301
|
break;
|
|
@@ -11177,7 +11303,7 @@ var LeaferUI = (function (exports) {
|
|
|
11177
11303
|
case 'cover':
|
|
11178
11304
|
default:
|
|
11179
11305
|
if (scaleX)
|
|
11180
|
-
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
11306
|
+
fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
11181
11307
|
}
|
|
11182
11308
|
if (!data.transform) {
|
|
11183
11309
|
if (box.x || box.y) {
|
|
@@ -11210,6 +11336,8 @@ var LeaferUI = (function (exports) {
|
|
|
11210
11336
|
}
|
|
11211
11337
|
else {
|
|
11212
11338
|
leafPaint = { type: paint.type, image };
|
|
11339
|
+
if (image.hasAlphaPixel)
|
|
11340
|
+
leafPaint.isTransparent = true;
|
|
11213
11341
|
cache = image.use > 1 ? { leafPaint, paint, boxBounds: box.set(boxBounds) } : null;
|
|
11214
11342
|
}
|
|
11215
11343
|
if (firstUse || image.loading)
|
|
@@ -11234,7 +11362,7 @@ var LeaferUI = (function (exports) {
|
|
|
11234
11362
|
ignoreRender(ui, false);
|
|
11235
11363
|
if (!ui.destroyed) {
|
|
11236
11364
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
11237
|
-
if (image.
|
|
11365
|
+
if (image.hasAlphaPixel)
|
|
11238
11366
|
ui.__layout.hitCanvasChanged = true;
|
|
11239
11367
|
ui.forceUpdate('surface');
|
|
11240
11368
|
}
|
|
@@ -11246,13 +11374,17 @@ var LeaferUI = (function (exports) {
|
|
|
11246
11374
|
onLoadError(ui, event, error);
|
|
11247
11375
|
leafPaint.loadId = null;
|
|
11248
11376
|
});
|
|
11249
|
-
if (ui.placeholderColor)
|
|
11250
|
-
|
|
11251
|
-
|
|
11252
|
-
|
|
11253
|
-
|
|
11254
|
-
|
|
11255
|
-
|
|
11377
|
+
if (ui.placeholderColor) {
|
|
11378
|
+
if (!ui.placeholderDelay)
|
|
11379
|
+
image.isPlacehold = true;
|
|
11380
|
+
else
|
|
11381
|
+
setTimeout(() => {
|
|
11382
|
+
if (!image.ready) {
|
|
11383
|
+
image.isPlacehold = true;
|
|
11384
|
+
ui.forceUpdate('surface');
|
|
11385
|
+
}
|
|
11386
|
+
}, ui.placeholderDelay);
|
|
11387
|
+
}
|
|
11256
11388
|
}
|
|
11257
11389
|
return leafPaint;
|
|
11258
11390
|
}
|
|
@@ -11407,7 +11539,7 @@ var LeaferUI = (function (exports) {
|
|
|
11407
11539
|
}
|
|
11408
11540
|
function drawImage(ui, canvas, paint, data) {
|
|
11409
11541
|
canvas.save();
|
|
11410
|
-
|
|
11542
|
+
canvas.clipUI(ui);
|
|
11411
11543
|
if (paint.blendMode)
|
|
11412
11544
|
canvas.blendMode = paint.blendMode;
|
|
11413
11545
|
if (data.opacity)
|
|
@@ -11458,32 +11590,33 @@ var LeaferUI = (function (exports) {
|
|
|
11458
11590
|
repeatMode
|
|
11459
11591
|
};
|
|
11460
11592
|
|
|
11461
|
-
const { toPoint: toPoint$2 } = AroundHelper;
|
|
11593
|
+
const { toPoint: toPoint$2 } = AroundHelper, { hasTransparent } = ColorConvert;
|
|
11462
11594
|
const realFrom$2 = {};
|
|
11463
11595
|
const realTo$2 = {};
|
|
11464
11596
|
function linearGradient(paint, box) {
|
|
11465
|
-
let { from, to, type,
|
|
11597
|
+
let { from, to, type, opacity } = paint;
|
|
11466
11598
|
toPoint$2(from || 'top', box, realFrom$2);
|
|
11467
11599
|
toPoint$2(to || 'bottom', box, realTo$2);
|
|
11468
11600
|
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
11469
|
-
applyStops(style, paint.stops, opacity);
|
|
11470
11601
|
const data = { type, style };
|
|
11471
|
-
|
|
11472
|
-
data.blendMode = blendMode;
|
|
11602
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11473
11603
|
return data;
|
|
11474
11604
|
}
|
|
11475
|
-
function applyStops(gradient, stops, opacity) {
|
|
11605
|
+
function applyStops(data, gradient, stops, opacity) {
|
|
11476
11606
|
if (stops) {
|
|
11477
|
-
let stop;
|
|
11607
|
+
let stop, color, offset, isTransparent;
|
|
11478
11608
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
11479
11609
|
stop = stops[i];
|
|
11480
|
-
if (typeof stop === 'string')
|
|
11481
|
-
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11610
|
+
if (typeof stop === 'string')
|
|
11611
|
+
offset = i / (len - 1), color = ColorConvert.string(stop, opacity);
|
|
11612
|
+
else
|
|
11613
|
+
offset = stop.offset, color = ColorConvert.string(stop.color, opacity);
|
|
11614
|
+
gradient.addColorStop(offset, color);
|
|
11615
|
+
if (!isTransparent && hasTransparent(color))
|
|
11616
|
+
isTransparent = true;
|
|
11486
11617
|
}
|
|
11618
|
+
if (isTransparent)
|
|
11619
|
+
data.isTransparent = true;
|
|
11487
11620
|
}
|
|
11488
11621
|
}
|
|
11489
11622
|
|
|
@@ -11493,17 +11626,15 @@ var LeaferUI = (function (exports) {
|
|
|
11493
11626
|
const realFrom$1 = {};
|
|
11494
11627
|
const realTo$1 = {};
|
|
11495
11628
|
function radialGradient(paint, box) {
|
|
11496
|
-
let { from, to, type, opacity,
|
|
11629
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
11497
11630
|
toPoint$1(from || 'center', box, realFrom$1);
|
|
11498
11631
|
toPoint$1(to || 'bottom', box, realTo$1);
|
|
11499
11632
|
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
11633
|
const data = { type, style };
|
|
11634
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11502
11635
|
const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
|
|
11503
11636
|
if (transform)
|
|
11504
11637
|
data.transform = transform;
|
|
11505
|
-
if (blendMode)
|
|
11506
|
-
data.blendMode = blendMode;
|
|
11507
11638
|
return data;
|
|
11508
11639
|
}
|
|
11509
11640
|
function getTransform(box, from, to, stretch, rotate90) {
|
|
@@ -11529,17 +11660,15 @@ var LeaferUI = (function (exports) {
|
|
|
11529
11660
|
const realFrom = {};
|
|
11530
11661
|
const realTo = {};
|
|
11531
11662
|
function conicGradient(paint, box) {
|
|
11532
|
-
let { from, to, type, opacity,
|
|
11663
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
11533
11664
|
toPoint(from || 'center', box, realFrom);
|
|
11534
11665
|
toPoint(to || 'bottom', box, realTo);
|
|
11535
11666
|
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
11667
|
const data = { type, style };
|
|
11668
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11538
11669
|
const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
|
|
11539
11670
|
if (transform)
|
|
11540
11671
|
data.transform = transform;
|
|
11541
|
-
if (blendMode)
|
|
11542
|
-
data.blendMode = blendMode;
|
|
11543
11672
|
return data;
|
|
11544
11673
|
}
|
|
11545
11674
|
|
|
@@ -11575,12 +11704,10 @@ var LeaferUI = (function (exports) {
|
|
|
11575
11704
|
}
|
|
11576
11705
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
11577
11706
|
}
|
|
11578
|
-
if (ui.__worldFlipped)
|
|
11707
|
+
if (ui.__worldFlipped)
|
|
11579
11708
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
11580
|
-
|
|
11581
|
-
else {
|
|
11709
|
+
else
|
|
11582
11710
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
11583
|
-
}
|
|
11584
11711
|
if (end && index < end)
|
|
11585
11712
|
other.clearWorld(copyBounds, true);
|
|
11586
11713
|
});
|
|
@@ -11639,12 +11766,10 @@ var LeaferUI = (function (exports) {
|
|
|
11639
11766
|
copyBounds = bounds;
|
|
11640
11767
|
}
|
|
11641
11768
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
11642
|
-
if (ui.__worldFlipped)
|
|
11769
|
+
if (ui.__worldFlipped)
|
|
11643
11770
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
11644
|
-
|
|
11645
|
-
else {
|
|
11771
|
+
else
|
|
11646
11772
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
11647
|
-
}
|
|
11648
11773
|
if (end && index < end)
|
|
11649
11774
|
other.clearWorld(copyBounds, true);
|
|
11650
11775
|
});
|
|
@@ -11872,6 +11997,8 @@ var LeaferUI = (function (exports) {
|
|
|
11872
11997
|
lastCharType = null;
|
|
11873
11998
|
startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
|
|
11874
11999
|
word = { data: [] }, row = { words: [] };
|
|
12000
|
+
if (__letterSpacing)
|
|
12001
|
+
content = [...content];
|
|
11875
12002
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
11876
12003
|
char = content[i];
|
|
11877
12004
|
if (char === '\n') {
|
|
@@ -12295,6 +12422,7 @@ var LeaferUI = (function (exports) {
|
|
|
12295
12422
|
exports.AutoBounds = AutoBounds;
|
|
12296
12423
|
exports.BezierHelper = BezierHelper;
|
|
12297
12424
|
exports.Bounds = Bounds;
|
|
12425
|
+
exports.BoundsEvent = BoundsEvent;
|
|
12298
12426
|
exports.BoundsHelper = BoundsHelper;
|
|
12299
12427
|
exports.BoxData = BoxData;
|
|
12300
12428
|
exports.BranchHelper = BranchHelper;
|
|
@@ -12454,7 +12582,7 @@ var LeaferUI = (function (exports) {
|
|
|
12454
12582
|
exports.surfaceType = surfaceType;
|
|
12455
12583
|
exports.tempBounds = tempBounds$1;
|
|
12456
12584
|
exports.tempMatrix = tempMatrix;
|
|
12457
|
-
exports.tempPoint = tempPoint$
|
|
12585
|
+
exports.tempPoint = tempPoint$2;
|
|
12458
12586
|
exports.useCanvas = useCanvas;
|
|
12459
12587
|
exports.useModule = useModule;
|
|
12460
12588
|
exports.version = version;
|