@leafer/worker 1.6.2 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.js +622 -478
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +621 -478
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +20 -20
package/dist/worker.js
CHANGED
|
@@ -26,8 +26,6 @@ var LeaferUI = (function (exports) {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
const Creator = {};
|
|
30
|
-
|
|
31
29
|
const IncrementId = {
|
|
32
30
|
RUNTIME: 'runtime',
|
|
33
31
|
LEAF: 'leaf',
|
|
@@ -153,7 +151,7 @@ var LeaferUI = (function (exports) {
|
|
|
153
151
|
|
|
154
152
|
const { sin: sin$6, cos: cos$6, acos, sqrt: sqrt$5 } = Math;
|
|
155
153
|
const { float: float$2 } = MathHelper;
|
|
156
|
-
const tempPoint$
|
|
154
|
+
const tempPoint$4 = {};
|
|
157
155
|
function getWorld() {
|
|
158
156
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), { scaleX: 1, scaleY: 1, rotation: 0, skewX: 0, skewY: 0 });
|
|
159
157
|
}
|
|
@@ -196,8 +194,8 @@ var LeaferUI = (function (exports) {
|
|
|
196
194
|
t.d *= scaleY;
|
|
197
195
|
},
|
|
198
196
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
199
|
-
M$a.toInnerPoint(t, origin, tempPoint$
|
|
200
|
-
M$a.scaleOfInner(t, tempPoint$
|
|
197
|
+
M$a.toInnerPoint(t, origin, tempPoint$4);
|
|
198
|
+
M$a.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
|
|
201
199
|
},
|
|
202
200
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
203
201
|
M$a.translateInner(t, origin.x, origin.y);
|
|
@@ -215,8 +213,8 @@ var LeaferUI = (function (exports) {
|
|
|
215
213
|
t.d = c * sinR + d * cosR;
|
|
216
214
|
},
|
|
217
215
|
rotateOfOuter(t, origin, rotation) {
|
|
218
|
-
M$a.toInnerPoint(t, origin, tempPoint$
|
|
219
|
-
M$a.rotateOfInner(t, tempPoint$
|
|
216
|
+
M$a.toInnerPoint(t, origin, tempPoint$4);
|
|
217
|
+
M$a.rotateOfInner(t, tempPoint$4, rotation);
|
|
220
218
|
},
|
|
221
219
|
rotateOfInner(t, origin, rotation) {
|
|
222
220
|
M$a.translateInner(t, origin.x, origin.y);
|
|
@@ -237,8 +235,8 @@ var LeaferUI = (function (exports) {
|
|
|
237
235
|
}
|
|
238
236
|
},
|
|
239
237
|
skewOfOuter(t, origin, skewX, skewY) {
|
|
240
|
-
M$a.toInnerPoint(t, origin, tempPoint$
|
|
241
|
-
M$a.skewOfInner(t, tempPoint$
|
|
238
|
+
M$a.toInnerPoint(t, origin, tempPoint$4);
|
|
239
|
+
M$a.skewOfInner(t, tempPoint$4, skewX, skewY);
|
|
242
240
|
},
|
|
243
241
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
244
242
|
M$a.translateInner(t, origin.x, origin.y);
|
|
@@ -467,8 +465,10 @@ var LeaferUI = (function (exports) {
|
|
|
467
465
|
t.y = halfPixel ? round$5(t.y - 0.5) + 0.5 : round$5(t.y);
|
|
468
466
|
},
|
|
469
467
|
move(t, x, y) {
|
|
470
|
-
|
|
471
|
-
|
|
468
|
+
if (typeof x === 'object')
|
|
469
|
+
t.x += x.x, t.y += x.y;
|
|
470
|
+
else
|
|
471
|
+
t.x += x, t.y += y;
|
|
472
472
|
},
|
|
473
473
|
scale(t, scaleX, scaleY = scaleX) {
|
|
474
474
|
if (t.x)
|
|
@@ -646,7 +646,7 @@ var LeaferUI = (function (exports) {
|
|
|
646
646
|
return this;
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
|
-
const tempPoint$
|
|
649
|
+
const tempPoint$3 = new Point();
|
|
650
650
|
|
|
651
651
|
class Matrix {
|
|
652
652
|
constructor(a, b, c, d, e, f) {
|
|
@@ -804,15 +804,87 @@ var LeaferUI = (function (exports) {
|
|
|
804
804
|
};
|
|
805
805
|
const { addPoint: addPoint$4 } = TwoPointBoundsHelper;
|
|
806
806
|
|
|
807
|
+
exports.Direction4 = void 0;
|
|
808
|
+
(function (Direction4) {
|
|
809
|
+
Direction4[Direction4["top"] = 0] = "top";
|
|
810
|
+
Direction4[Direction4["right"] = 1] = "right";
|
|
811
|
+
Direction4[Direction4["bottom"] = 2] = "bottom";
|
|
812
|
+
Direction4[Direction4["left"] = 3] = "left";
|
|
813
|
+
})(exports.Direction4 || (exports.Direction4 = {}));
|
|
814
|
+
exports.Direction9 = void 0;
|
|
815
|
+
(function (Direction9) {
|
|
816
|
+
Direction9[Direction9["topLeft"] = 0] = "topLeft";
|
|
817
|
+
Direction9[Direction9["top"] = 1] = "top";
|
|
818
|
+
Direction9[Direction9["topRight"] = 2] = "topRight";
|
|
819
|
+
Direction9[Direction9["right"] = 3] = "right";
|
|
820
|
+
Direction9[Direction9["bottomRight"] = 4] = "bottomRight";
|
|
821
|
+
Direction9[Direction9["bottom"] = 5] = "bottom";
|
|
822
|
+
Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
|
|
823
|
+
Direction9[Direction9["left"] = 7] = "left";
|
|
824
|
+
Direction9[Direction9["center"] = 8] = "center";
|
|
825
|
+
Direction9[Direction9["top-left"] = 0] = "top-left";
|
|
826
|
+
Direction9[Direction9["top-right"] = 2] = "top-right";
|
|
827
|
+
Direction9[Direction9["bottom-right"] = 4] = "bottom-right";
|
|
828
|
+
Direction9[Direction9["bottom-left"] = 6] = "bottom-left";
|
|
829
|
+
})(exports.Direction9 || (exports.Direction9 = {}));
|
|
830
|
+
|
|
831
|
+
const directionData = [
|
|
832
|
+
{ x: 0, y: 0 },
|
|
833
|
+
{ x: 0.5, y: 0 },
|
|
834
|
+
{ x: 1, y: 0 },
|
|
835
|
+
{ x: 1, y: 0.5 },
|
|
836
|
+
{ x: 1, y: 1 },
|
|
837
|
+
{ x: 0.5, y: 1 },
|
|
838
|
+
{ x: 0, y: 1 },
|
|
839
|
+
{ x: 0, y: 0.5 },
|
|
840
|
+
{ x: 0.5, y: 0.5 }
|
|
841
|
+
];
|
|
842
|
+
directionData.forEach(item => item.type = 'percent');
|
|
843
|
+
const AroundHelper = {
|
|
844
|
+
directionData,
|
|
845
|
+
tempPoint: {},
|
|
846
|
+
get: get$4,
|
|
847
|
+
toPoint(around, box, to, onlyBoxSize, content, onlyContentSize) {
|
|
848
|
+
const point = get$4(around);
|
|
849
|
+
to.x = point.x;
|
|
850
|
+
to.y = point.y;
|
|
851
|
+
if (point.type === 'percent') {
|
|
852
|
+
to.x *= box.width;
|
|
853
|
+
to.y *= box.height;
|
|
854
|
+
if (content) {
|
|
855
|
+
if (!onlyContentSize)
|
|
856
|
+
to.x -= content.x, to.y -= content.y;
|
|
857
|
+
if (point.x)
|
|
858
|
+
to.x -= (point.x === 1) ? content.width : (point.x === 0.5 ? point.x * content.width : 0);
|
|
859
|
+
if (point.y)
|
|
860
|
+
to.y -= (point.y === 1) ? content.height : (point.y === 0.5 ? point.y * content.height : 0);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
if (!onlyBoxSize)
|
|
864
|
+
to.x += box.x, to.y += box.y;
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
function get$4(around) {
|
|
868
|
+
return typeof around === 'string' ? directionData[exports.Direction9[around]] : around;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
const { toPoint: toPoint$6 } = AroundHelper;
|
|
872
|
+
const AlignHelper = {
|
|
873
|
+
toPoint(align, content, box, to, onlyBoxSize, onlyContentSize) {
|
|
874
|
+
toPoint$6(align, box, to, onlyBoxSize, content, onlyContentSize);
|
|
875
|
+
}
|
|
876
|
+
};
|
|
877
|
+
|
|
807
878
|
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPoint$3, toBounds: toBounds$4 } = TwoPointBoundsHelper;
|
|
808
879
|
const { toOuterPoint: toOuterPoint$2 } = MatrixHelper;
|
|
809
880
|
const { float: float$1, fourNumber: fourNumber$1 } = MathHelper;
|
|
810
881
|
const { floor: floor$1, ceil: ceil$3 } = Math;
|
|
811
882
|
let right$4, bottom$3, boundsRight, boundsBottom;
|
|
812
883
|
const point$2 = {};
|
|
813
|
-
const toPoint$
|
|
884
|
+
const toPoint$5 = {};
|
|
885
|
+
const tempBounds$2 = {};
|
|
814
886
|
const BoundsHelper = {
|
|
815
|
-
tempBounds:
|
|
887
|
+
tempBounds: tempBounds$2,
|
|
816
888
|
set(t, x = 0, y = 0, width = 0, height = 0) {
|
|
817
889
|
t.x = x;
|
|
818
890
|
t.y = y;
|
|
@@ -875,8 +947,8 @@ var LeaferUI = (function (exports) {
|
|
|
875
947
|
}
|
|
876
948
|
B.move(to, -to.offsetX, -to.offsetY);
|
|
877
949
|
},
|
|
878
|
-
scale(t, scaleX, scaleY = scaleX) {
|
|
879
|
-
PointHelper.scale(t, scaleX, scaleY);
|
|
950
|
+
scale(t, scaleX, scaleY = scaleX, onlySize) {
|
|
951
|
+
onlySize || PointHelper.scale(t, scaleX, scaleY);
|
|
880
952
|
t.width *= scaleX;
|
|
881
953
|
t.height *= scaleY;
|
|
882
954
|
},
|
|
@@ -886,9 +958,9 @@ var LeaferUI = (function (exports) {
|
|
|
886
958
|
t.height *= scaleY;
|
|
887
959
|
},
|
|
888
960
|
tempToOuterOf(t, matrix) {
|
|
889
|
-
B.copy(
|
|
890
|
-
B.toOuterOf(
|
|
891
|
-
return
|
|
961
|
+
B.copy(tempBounds$2, t);
|
|
962
|
+
B.toOuterOf(tempBounds$2, matrix);
|
|
963
|
+
return tempBounds$2;
|
|
892
964
|
},
|
|
893
965
|
getOuterOf(t, matrix) {
|
|
894
966
|
t = Object.assign({}, t);
|
|
@@ -919,17 +991,17 @@ var LeaferUI = (function (exports) {
|
|
|
919
991
|
else {
|
|
920
992
|
point$2.x = t.x;
|
|
921
993
|
point$2.y = t.y;
|
|
922
|
-
toOuterPoint$2(matrix, point$2, toPoint$
|
|
923
|
-
setPoint$5(tempPointBounds$1, toPoint$
|
|
994
|
+
toOuterPoint$2(matrix, point$2, toPoint$5);
|
|
995
|
+
setPoint$5(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
924
996
|
point$2.x = t.x + t.width;
|
|
925
|
-
toOuterPoint$2(matrix, point$2, toPoint$
|
|
926
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
997
|
+
toOuterPoint$2(matrix, point$2, toPoint$5);
|
|
998
|
+
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
927
999
|
point$2.y = t.y + t.height;
|
|
928
|
-
toOuterPoint$2(matrix, point$2, toPoint$
|
|
929
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
1000
|
+
toOuterPoint$2(matrix, point$2, toPoint$5);
|
|
1001
|
+
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
930
1002
|
point$2.x = t.x;
|
|
931
|
-
toOuterPoint$2(matrix, point$2, toPoint$
|
|
932
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
1003
|
+
toOuterPoint$2(matrix, point$2, toPoint$5);
|
|
1004
|
+
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
933
1005
|
toBounds$4(tempPointBounds$1, to);
|
|
934
1006
|
}
|
|
935
1007
|
},
|
|
@@ -939,9 +1011,21 @@ var LeaferUI = (function (exports) {
|
|
|
939
1011
|
B.scale(to, 1 / matrix.a, 1 / matrix.d);
|
|
940
1012
|
},
|
|
941
1013
|
getFitMatrix(t, put, baseScale = 1) {
|
|
942
|
-
const scale = Math.min(baseScale,
|
|
1014
|
+
const scale = Math.min(baseScale, B.getFitScale(t, put));
|
|
943
1015
|
return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
|
|
944
1016
|
},
|
|
1017
|
+
getFitScale(t, put, isCoverMode) {
|
|
1018
|
+
const sw = t.width / put.width, sh = t.height / put.height;
|
|
1019
|
+
return isCoverMode ? Math.max(sw, sh) : Math.min(sw, sh);
|
|
1020
|
+
},
|
|
1021
|
+
put(t, put, align = 'center', putScale = 1, changeSize = true, to) {
|
|
1022
|
+
to || (to = put);
|
|
1023
|
+
if (typeof putScale === 'string')
|
|
1024
|
+
putScale = B.getFitScale(t, put, putScale === 'cover');
|
|
1025
|
+
tempBounds$2.width = changeSize ? put.width *= putScale : put.width * putScale;
|
|
1026
|
+
tempBounds$2.height = changeSize ? put.height *= putScale : put.height * putScale;
|
|
1027
|
+
AlignHelper.toPoint(align, tempBounds$2, t, to, true, true);
|
|
1028
|
+
},
|
|
945
1029
|
getSpread(t, spread, side) {
|
|
946
1030
|
const n = {};
|
|
947
1031
|
B.copyAndSpread(n, t, spread, false, side);
|
|
@@ -1115,8 +1199,8 @@ var LeaferUI = (function (exports) {
|
|
|
1115
1199
|
BoundsHelper.move(this, x, y);
|
|
1116
1200
|
return this;
|
|
1117
1201
|
}
|
|
1118
|
-
scale(scaleX, scaleY) {
|
|
1119
|
-
BoundsHelper.scale(this, scaleX, scaleY);
|
|
1202
|
+
scale(scaleX, scaleY, onlySize) {
|
|
1203
|
+
BoundsHelper.scale(this, scaleX, scaleY, onlySize);
|
|
1120
1204
|
return this;
|
|
1121
1205
|
}
|
|
1122
1206
|
scaleOf(origin, scaleX, scaleY) {
|
|
@@ -1134,6 +1218,9 @@ var LeaferUI = (function (exports) {
|
|
|
1134
1218
|
getFitMatrix(put, baseScale) {
|
|
1135
1219
|
return BoundsHelper.getFitMatrix(this, put, baseScale);
|
|
1136
1220
|
}
|
|
1221
|
+
put(put, align, putScale) {
|
|
1222
|
+
BoundsHelper.put(this, put, align, putScale);
|
|
1223
|
+
}
|
|
1137
1224
|
spread(fourNumber, side) {
|
|
1138
1225
|
BoundsHelper.spread(this, fourNumber, side);
|
|
1139
1226
|
return this;
|
|
@@ -1242,79 +1329,6 @@ var LeaferUI = (function (exports) {
|
|
|
1242
1329
|
}
|
|
1243
1330
|
}
|
|
1244
1331
|
|
|
1245
|
-
exports.Direction4 = void 0;
|
|
1246
|
-
(function (Direction4) {
|
|
1247
|
-
Direction4[Direction4["top"] = 0] = "top";
|
|
1248
|
-
Direction4[Direction4["right"] = 1] = "right";
|
|
1249
|
-
Direction4[Direction4["bottom"] = 2] = "bottom";
|
|
1250
|
-
Direction4[Direction4["left"] = 3] = "left";
|
|
1251
|
-
})(exports.Direction4 || (exports.Direction4 = {}));
|
|
1252
|
-
exports.Direction9 = void 0;
|
|
1253
|
-
(function (Direction9) {
|
|
1254
|
-
Direction9[Direction9["topLeft"] = 0] = "topLeft";
|
|
1255
|
-
Direction9[Direction9["top"] = 1] = "top";
|
|
1256
|
-
Direction9[Direction9["topRight"] = 2] = "topRight";
|
|
1257
|
-
Direction9[Direction9["right"] = 3] = "right";
|
|
1258
|
-
Direction9[Direction9["bottomRight"] = 4] = "bottomRight";
|
|
1259
|
-
Direction9[Direction9["bottom"] = 5] = "bottom";
|
|
1260
|
-
Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
|
|
1261
|
-
Direction9[Direction9["left"] = 7] = "left";
|
|
1262
|
-
Direction9[Direction9["center"] = 8] = "center";
|
|
1263
|
-
Direction9[Direction9["top-left"] = 0] = "top-left";
|
|
1264
|
-
Direction9[Direction9["top-right"] = 2] = "top-right";
|
|
1265
|
-
Direction9[Direction9["bottom-right"] = 4] = "bottom-right";
|
|
1266
|
-
Direction9[Direction9["bottom-left"] = 6] = "bottom-left";
|
|
1267
|
-
})(exports.Direction9 || (exports.Direction9 = {}));
|
|
1268
|
-
|
|
1269
|
-
const directionData = [
|
|
1270
|
-
{ x: 0, y: 0 },
|
|
1271
|
-
{ x: 0.5, y: 0 },
|
|
1272
|
-
{ x: 1, y: 0 },
|
|
1273
|
-
{ x: 1, y: 0.5 },
|
|
1274
|
-
{ x: 1, y: 1 },
|
|
1275
|
-
{ x: 0.5, y: 1 },
|
|
1276
|
-
{ x: 0, y: 1 },
|
|
1277
|
-
{ x: 0, y: 0.5 },
|
|
1278
|
-
{ x: 0.5, y: 0.5 }
|
|
1279
|
-
];
|
|
1280
|
-
directionData.forEach(item => item.type = 'percent');
|
|
1281
|
-
const AroundHelper = {
|
|
1282
|
-
directionData,
|
|
1283
|
-
tempPoint: {},
|
|
1284
|
-
get: get$4,
|
|
1285
|
-
toPoint(around, bounds, to, onlySize, pointBounds) {
|
|
1286
|
-
const point = get$4(around);
|
|
1287
|
-
to.x = point.x;
|
|
1288
|
-
to.y = point.y;
|
|
1289
|
-
if (point.type === 'percent') {
|
|
1290
|
-
to.x *= bounds.width;
|
|
1291
|
-
to.y *= bounds.height;
|
|
1292
|
-
if (pointBounds) {
|
|
1293
|
-
to.x -= pointBounds.x;
|
|
1294
|
-
to.y -= pointBounds.y;
|
|
1295
|
-
if (point.x)
|
|
1296
|
-
to.x -= (point.x === 1) ? pointBounds.width : (point.x === 0.5 ? point.x * pointBounds.width : 0);
|
|
1297
|
-
if (point.y)
|
|
1298
|
-
to.y -= (point.y === 1) ? pointBounds.height : (point.y === 0.5 ? point.y * pointBounds.height : 0);
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1301
|
-
if (!onlySize) {
|
|
1302
|
-
to.x += bounds.x;
|
|
1303
|
-
to.y += bounds.y;
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
};
|
|
1307
|
-
function get$4(around) {
|
|
1308
|
-
return typeof around === 'string' ? directionData[exports.Direction9[around]] : around;
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
const { toPoint: toPoint$5 } = AroundHelper;
|
|
1312
|
-
const AlignHelper = {
|
|
1313
|
-
toPoint(align, contentBounds, bounds, to, onlySize) {
|
|
1314
|
-
toPoint$5(align, bounds, to, onlySize, contentBounds);
|
|
1315
|
-
}
|
|
1316
|
-
};
|
|
1317
|
-
|
|
1318
1332
|
const StringNumberMap = {
|
|
1319
1333
|
'0': 1,
|
|
1320
1334
|
'1': 1,
|
|
@@ -1445,11 +1459,17 @@ var LeaferUI = (function (exports) {
|
|
|
1445
1459
|
return rs;
|
|
1446
1460
|
},
|
|
1447
1461
|
need(name) {
|
|
1448
|
-
console.error('please install plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name);
|
|
1462
|
+
console.error('please install and import plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name);
|
|
1449
1463
|
}
|
|
1450
1464
|
};
|
|
1451
1465
|
setTimeout(() => check.forEach(name => Plugin.has(name, true)));
|
|
1452
1466
|
|
|
1467
|
+
const Creator = {
|
|
1468
|
+
editor(_options) {
|
|
1469
|
+
return Plugin.need('editor');
|
|
1470
|
+
}
|
|
1471
|
+
};
|
|
1472
|
+
|
|
1453
1473
|
const debug$h = Debug.get('UICreator');
|
|
1454
1474
|
const UICreator = {
|
|
1455
1475
|
list: {},
|
|
@@ -1587,6 +1607,10 @@ var LeaferUI = (function (exports) {
|
|
|
1587
1607
|
for (let i = 0, len = list.length; i < len; i++)
|
|
1588
1608
|
map[list[i]] = true;
|
|
1589
1609
|
return map;
|
|
1610
|
+
},
|
|
1611
|
+
stintSet(data, attrName, value) {
|
|
1612
|
+
value || (value = undefined);
|
|
1613
|
+
data[attrName] !== value && (data[attrName] = value);
|
|
1590
1614
|
}
|
|
1591
1615
|
};
|
|
1592
1616
|
const { assign: assign$1 } = DataHelper;
|
|
@@ -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$4, addPoint: addPoint$2 } = TwoPointBoundsHelper;
|
|
2389
2416
|
const { set, toNumberPoints: toNumberPoints$1 } = PointHelper;
|
|
2390
2417
|
const { M: M$9, L: L$a, C: C$8, Q: Q$7, Z: Z$8 } = PathCommandMap;
|
|
2391
|
-
const tempPoint$
|
|
2418
|
+
const tempPoint$2 = {};
|
|
2392
2419
|
const BezierHelper = {
|
|
2393
2420
|
points(data, originPoints, curve, close) {
|
|
2394
2421
|
let points = toNumberPoints$1(originPoints);
|
|
@@ -2410,6 +2437,8 @@ var LeaferUI = (function (exports) {
|
|
|
2410
2437
|
cY = points[i + 3];
|
|
2411
2438
|
ba = sqrt$3(pow$1(bX - aX, 2) + pow$1(bY - aY, 2));
|
|
2412
2439
|
cb = sqrt$3(pow$1(cX - bX, 2) + pow$1(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$2(pointBounds, fromX, fromY) : setPoint$4(pointBounds, fromX, fromY);
|
|
2580
2609
|
addPoint$2(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$2(pointBounds, tempPoint$
|
|
2611
|
+
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$2);
|
|
2612
|
+
addPoint$2(pointBounds, tempPoint$2.x, tempPoint$2.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$2 = FileHelper;
|
|
3419
|
-
F$2.
|
|
3448
|
+
F$2.alphaPixelTypes.forEach(type => F$2.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3420
3449
|
|
|
3421
3450
|
const debug$c = 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$4 } = 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$4(children[j]);
|
|
4526
4555
|
}
|
|
4527
4556
|
if (exclude && exclude === branch)
|
|
4528
4557
|
continue;
|
|
4529
|
-
updateBounds$
|
|
4558
|
+
updateBounds$4(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$3 } = LeafHelper;
|
|
4548
4577
|
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$9 } = 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$3(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$4, tempPoint: tempPoint$
|
|
5264
|
+
const { toPoint: toPoint$4, tempPoint: tempPoint$1 } = 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$4(data.around || data.origin, layout.boxBounds, tempPoint$
|
|
5198
|
-
translateInner(local, -tempPoint$
|
|
5281
|
+
toPoint$4(data.around || data.origin, layout.boxBounds, tempPoint$1);
|
|
5282
|
+
translateInner(local, -tempPoint$1.x, -tempPoint$1.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$2 } = PathBounds;
|
|
5209
5293
|
const LeafBounds = {
|
|
5210
5294
|
__updateWorldBounds() {
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5295
|
+
const layout = this.__layout;
|
|
5296
|
+
toOuterOf$1(layout.renderBounds, this.__world, this.__world);
|
|
5297
|
+
if (layout.resized) {
|
|
5298
|
+
if (layout.resized === 'inner')
|
|
5299
|
+
this.__onUpdateSize();
|
|
5300
|
+
if (this.__hasLocalEvent)
|
|
5301
|
+
BoundsEvent.emitLocal(this);
|
|
5302
|
+
layout.resized = undefined;
|
|
5215
5303
|
}
|
|
5304
|
+
if (this.__hasWorldEvent)
|
|
5305
|
+
BoundsEvent.emitWorld(this);
|
|
5216
5306
|
},
|
|
5217
5307
|
__updateLocalBounds() {
|
|
5218
5308
|
const layout = this.__layout;
|
|
@@ -5221,12 +5311,12 @@ var LeaferUI = (function (exports) {
|
|
|
5221
5311
|
this.__updatePath();
|
|
5222
5312
|
this.__updateRenderPath();
|
|
5223
5313
|
this.__updateBoxBounds();
|
|
5224
|
-
layout.resized =
|
|
5314
|
+
layout.resized = 'inner';
|
|
5225
5315
|
}
|
|
5226
5316
|
if (layout.localBoxChanged) {
|
|
5227
5317
|
if (this.__local)
|
|
5228
5318
|
this.__updateLocalBoxBounds();
|
|
5229
|
-
layout.localBoxChanged =
|
|
5319
|
+
layout.localBoxChanged = undefined;
|
|
5230
5320
|
if (layout.strokeSpread)
|
|
5231
5321
|
layout.strokeChanged = true;
|
|
5232
5322
|
if (layout.renderSpread)
|
|
@@ -5234,7 +5324,7 @@ var LeaferUI = (function (exports) {
|
|
|
5234
5324
|
if (this.parent)
|
|
5235
5325
|
this.parent.__layout.boxChange();
|
|
5236
5326
|
}
|
|
5237
|
-
layout.boxChanged =
|
|
5327
|
+
layout.boxChanged = undefined;
|
|
5238
5328
|
if (layout.strokeChanged) {
|
|
5239
5329
|
layout.strokeSpread = this.__updateStrokeSpread();
|
|
5240
5330
|
if (layout.strokeSpread) {
|
|
@@ -5246,12 +5336,12 @@ var LeaferUI = (function (exports) {
|
|
|
5246
5336
|
else {
|
|
5247
5337
|
layout.spreadStrokeCancel();
|
|
5248
5338
|
}
|
|
5249
|
-
layout.strokeChanged =
|
|
5339
|
+
layout.strokeChanged = undefined;
|
|
5250
5340
|
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
|
|
5251
5341
|
layout.renderChanged = true;
|
|
5252
5342
|
if (this.parent)
|
|
5253
5343
|
this.parent.__layout.strokeChange();
|
|
5254
|
-
layout.resized =
|
|
5344
|
+
layout.resized = 'inner';
|
|
5255
5345
|
}
|
|
5256
5346
|
if (layout.renderChanged) {
|
|
5257
5347
|
layout.renderSpread = this.__updateRenderSpread();
|
|
@@ -5264,11 +5354,12 @@ var LeaferUI = (function (exports) {
|
|
|
5264
5354
|
else {
|
|
5265
5355
|
layout.spreadRenderCancel();
|
|
5266
5356
|
}
|
|
5267
|
-
layout.renderChanged =
|
|
5357
|
+
layout.renderChanged = undefined;
|
|
5268
5358
|
if (this.parent)
|
|
5269
5359
|
this.parent.__layout.renderChange();
|
|
5270
5360
|
}
|
|
5271
|
-
layout.
|
|
5361
|
+
layout.resized || (layout.resized = 'local');
|
|
5362
|
+
layout.boundsChanged = undefined;
|
|
5272
5363
|
},
|
|
5273
5364
|
__updateLocalBoxBounds() {
|
|
5274
5365
|
if (this.__hasMotionPath)
|
|
@@ -5362,7 +5453,7 @@ var LeaferUI = (function (exports) {
|
|
|
5362
5453
|
if (this.__worldOpacity) {
|
|
5363
5454
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5364
5455
|
this.__drawRenderPath(canvas);
|
|
5365
|
-
|
|
5456
|
+
canvas.clipUI(this);
|
|
5366
5457
|
}
|
|
5367
5458
|
},
|
|
5368
5459
|
__updateWorldOpacity() {
|
|
@@ -5808,7 +5899,7 @@ var LeaferUI = (function (exports) {
|
|
|
5808
5899
|
off(_type, _listener, _options) { }
|
|
5809
5900
|
on_(_type, _listener, _bind, _options) { return undefined; }
|
|
5810
5901
|
off_(_id) { }
|
|
5811
|
-
once(_type, _listener, _capture) { }
|
|
5902
|
+
once(_type, _listener, _captureOrBind, _capture) { }
|
|
5812
5903
|
emit(_type, _event, _capture) { }
|
|
5813
5904
|
emitEvent(_event, _capture) { }
|
|
5814
5905
|
hasEvent(_type, _capture) { return false; }
|
|
@@ -6145,7 +6236,7 @@ var LeaferUI = (function (exports) {
|
|
|
6145
6236
|
}
|
|
6146
6237
|
}
|
|
6147
6238
|
|
|
6148
|
-
const version = "1.6.
|
|
6239
|
+
const version = "1.6.4";
|
|
6149
6240
|
|
|
6150
6241
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6151
6242
|
get allowBackgroundColor() { return true; }
|
|
@@ -6304,17 +6395,15 @@ var LeaferUI = (function (exports) {
|
|
|
6304
6395
|
this.target.emitEvent(new WatchEvent(WatchEvent.DATA, { updatedList: this.updatedList }));
|
|
6305
6396
|
this.__updatedList = new LeafList();
|
|
6306
6397
|
this.totalTimes++;
|
|
6307
|
-
this.changed = false;
|
|
6308
|
-
this.hasVisible = false;
|
|
6309
|
-
this.hasRemove = false;
|
|
6310
|
-
this.hasAdd = false;
|
|
6398
|
+
this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
6311
6399
|
}
|
|
6312
6400
|
__listenEvents() {
|
|
6313
|
-
const { target } = this;
|
|
6314
6401
|
this.__eventIds = [
|
|
6315
|
-
target.on_(
|
|
6316
|
-
|
|
6317
|
-
|
|
6402
|
+
this.target.on_([
|
|
6403
|
+
[PropertyEvent.CHANGE, this.__onAttrChange, this],
|
|
6404
|
+
[[ChildEvent.ADD, ChildEvent.REMOVE], this.__onChildEvent, this],
|
|
6405
|
+
[WatchEvent.REQUEST, this.__onRquestData, this]
|
|
6406
|
+
])
|
|
6318
6407
|
];
|
|
6319
6408
|
}
|
|
6320
6409
|
__removeListenEvents() {
|
|
@@ -6324,8 +6413,7 @@ var LeaferUI = (function (exports) {
|
|
|
6324
6413
|
if (this.target) {
|
|
6325
6414
|
this.stop();
|
|
6326
6415
|
this.__removeListenEvents();
|
|
6327
|
-
this.target = null;
|
|
6328
|
-
this.__updatedList = null;
|
|
6416
|
+
this.target = this.__updatedList = null;
|
|
6329
6417
|
}
|
|
6330
6418
|
}
|
|
6331
6419
|
}
|
|
@@ -6430,7 +6518,7 @@ var LeaferUI = (function (exports) {
|
|
|
6430
6518
|
this.disabled = true;
|
|
6431
6519
|
}
|
|
6432
6520
|
layout() {
|
|
6433
|
-
if (!this.running)
|
|
6521
|
+
if (this.layouting || !this.running)
|
|
6434
6522
|
return;
|
|
6435
6523
|
const { target } = this;
|
|
6436
6524
|
this.times = 0;
|
|
@@ -6513,12 +6601,10 @@ var LeaferUI = (function (exports) {
|
|
|
6513
6601
|
}
|
|
6514
6602
|
static fullLayout(target) {
|
|
6515
6603
|
updateAllMatrix$1(target, true);
|
|
6516
|
-
if (target.isBranch)
|
|
6604
|
+
if (target.isBranch)
|
|
6517
6605
|
BranchHelper.updateBounds(target);
|
|
6518
|
-
|
|
6519
|
-
else {
|
|
6606
|
+
else
|
|
6520
6607
|
LeafHelper.updateBounds(target);
|
|
6521
|
-
}
|
|
6522
6608
|
updateAllChange(target);
|
|
6523
6609
|
}
|
|
6524
6610
|
addExtra(leaf) {
|
|
@@ -6541,11 +6627,12 @@ var LeaferUI = (function (exports) {
|
|
|
6541
6627
|
this.__updatedList = event.data.updatedList;
|
|
6542
6628
|
}
|
|
6543
6629
|
__listenEvents() {
|
|
6544
|
-
const { target } = this;
|
|
6545
6630
|
this.__eventIds = [
|
|
6546
|
-
target.on_(
|
|
6547
|
-
|
|
6548
|
-
|
|
6631
|
+
this.target.on_([
|
|
6632
|
+
[LayoutEvent.REQUEST, this.layout, this],
|
|
6633
|
+
[LayoutEvent.AGAIN, this.layoutAgain, this],
|
|
6634
|
+
[WatchEvent.DATA, this.__onReceiveWatchData, this]
|
|
6635
|
+
])
|
|
6549
6636
|
];
|
|
6550
6637
|
}
|
|
6551
6638
|
__removeListenEvents() {
|
|
@@ -6776,12 +6863,13 @@ var LeaferUI = (function (exports) {
|
|
|
6776
6863
|
this.target.emitEvent(new RenderEvent(type, this.times, bounds, options));
|
|
6777
6864
|
}
|
|
6778
6865
|
__listenEvents() {
|
|
6779
|
-
const { target } = this;
|
|
6780
6866
|
this.__eventIds = [
|
|
6781
|
-
target.on_(
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6867
|
+
this.target.on_([
|
|
6868
|
+
[RenderEvent.REQUEST, this.update, this],
|
|
6869
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
6870
|
+
[RenderEvent.AGAIN, this.renderAgain, this],
|
|
6871
|
+
[ResizeEvent.RESIZE, this.__onResize, this]
|
|
6872
|
+
])
|
|
6785
6873
|
];
|
|
6786
6874
|
}
|
|
6787
6875
|
__removeListenEvents() {
|
|
@@ -6997,8 +7085,32 @@ var LeaferUI = (function (exports) {
|
|
|
6997
7085
|
};
|
|
6998
7086
|
}
|
|
6999
7087
|
|
|
7088
|
+
function hasTransparent$3(color) {
|
|
7089
|
+
if (!color || color.length === 7 || color.length === 4)
|
|
7090
|
+
return false;
|
|
7091
|
+
if (color === 'transparent')
|
|
7092
|
+
return true;
|
|
7093
|
+
const first = color[0];
|
|
7094
|
+
if (first === '#') {
|
|
7095
|
+
switch (color.length) {
|
|
7096
|
+
case 5: return color[4] !== 'f' && color[4] !== 'F';
|
|
7097
|
+
case 9: return (color[7] !== 'f' && color[7] !== 'F') || (color[8] !== 'f' && color[8] !== 'F');
|
|
7098
|
+
}
|
|
7099
|
+
}
|
|
7100
|
+
else if (first === 'r' || first === 'h') {
|
|
7101
|
+
if (color[3] === 'a') {
|
|
7102
|
+
const i = color.lastIndexOf(',');
|
|
7103
|
+
if (i > -1)
|
|
7104
|
+
return parseFloat(color.slice(i + 1)) < 1;
|
|
7105
|
+
}
|
|
7106
|
+
}
|
|
7107
|
+
return false;
|
|
7108
|
+
}
|
|
7109
|
+
|
|
7000
7110
|
const TextConvert = {};
|
|
7001
|
-
const ColorConvert = {
|
|
7111
|
+
const ColorConvert = {
|
|
7112
|
+
hasTransparent: hasTransparent$3
|
|
7113
|
+
};
|
|
7002
7114
|
const UnitConvert = {
|
|
7003
7115
|
number(value, percentRefer) {
|
|
7004
7116
|
return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
|
|
@@ -7024,6 +7136,7 @@ var LeaferUI = (function (exports) {
|
|
|
7024
7136
|
};
|
|
7025
7137
|
|
|
7026
7138
|
const { parse, objectToCanvasData } = PathConvert;
|
|
7139
|
+
const { stintSet: stintSet$2 } = DataHelper, { hasTransparent: hasTransparent$2 } = ColorConvert;
|
|
7027
7140
|
const emptyPaint = {};
|
|
7028
7141
|
const debug$5 = Debug.get('UIData');
|
|
7029
7142
|
class UIData extends LeafData {
|
|
@@ -7082,38 +7195,22 @@ var LeaferUI = (function (exports) {
|
|
|
7082
7195
|
if (this.__naturalWidth)
|
|
7083
7196
|
this.__removeNaturalSize();
|
|
7084
7197
|
if (typeof value === 'string' || !value) {
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
PaintImage.recycleImage('fill', this);
|
|
7088
|
-
this.__isFills = false;
|
|
7089
|
-
this.__pixelFill && (this.__pixelFill = false);
|
|
7090
|
-
}
|
|
7198
|
+
stintSet$2(this, '__isTransparentFill', hasTransparent$2(value));
|
|
7199
|
+
this.__isFills && this.__removePaint('fill', true);
|
|
7091
7200
|
this._fill = value;
|
|
7092
7201
|
}
|
|
7093
7202
|
else if (typeof value === 'object') {
|
|
7094
|
-
this.
|
|
7095
|
-
const layout = this.__leaf.__layout;
|
|
7096
|
-
layout.boxChanged || layout.boxChange();
|
|
7097
|
-
this.__isFills = true;
|
|
7098
|
-
this._fill || (this._fill = emptyPaint);
|
|
7203
|
+
this.__setPaint('fill', value);
|
|
7099
7204
|
}
|
|
7100
7205
|
}
|
|
7101
7206
|
setStroke(value) {
|
|
7102
7207
|
if (typeof value === 'string' || !value) {
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
PaintImage.recycleImage('stroke', this);
|
|
7106
|
-
this.__isStrokes = false;
|
|
7107
|
-
this.__pixelStroke && (this.__pixelStroke = false);
|
|
7108
|
-
}
|
|
7208
|
+
stintSet$2(this, '__isTransparentStroke', hasTransparent$2(value));
|
|
7209
|
+
this.__isStrokes && this.__removePaint('stroke', true);
|
|
7109
7210
|
this._stroke = value;
|
|
7110
7211
|
}
|
|
7111
7212
|
else if (typeof value === 'object') {
|
|
7112
|
-
this.
|
|
7113
|
-
const layout = this.__leaf.__layout;
|
|
7114
|
-
layout.boxChanged || layout.boxChange();
|
|
7115
|
-
this.__isStrokes = true;
|
|
7116
|
-
this._stroke || (this._stroke = emptyPaint);
|
|
7213
|
+
this.__setPaint('stroke', value);
|
|
7117
7214
|
}
|
|
7118
7215
|
}
|
|
7119
7216
|
setPath(value) {
|
|
@@ -7143,7 +7240,34 @@ var LeaferUI = (function (exports) {
|
|
|
7143
7240
|
Paint.compute('fill', this.__leaf);
|
|
7144
7241
|
if (stroke)
|
|
7145
7242
|
Paint.compute('stroke', this.__leaf);
|
|
7146
|
-
this.__needComputePaint =
|
|
7243
|
+
this.__needComputePaint = undefined;
|
|
7244
|
+
}
|
|
7245
|
+
__setPaint(attrName, value) {
|
|
7246
|
+
this.__setInput(attrName, value);
|
|
7247
|
+
const layout = this.__leaf.__layout;
|
|
7248
|
+
layout.boxChanged || layout.boxChange();
|
|
7249
|
+
if (value instanceof Array && !value.length) {
|
|
7250
|
+
this.__removePaint(attrName);
|
|
7251
|
+
}
|
|
7252
|
+
else {
|
|
7253
|
+
if (attrName === 'fill')
|
|
7254
|
+
this.__isFills = true, this._fill || (this._fill = emptyPaint);
|
|
7255
|
+
else
|
|
7256
|
+
this.__isStrokes = true, this._stroke || (this._stroke = emptyPaint);
|
|
7257
|
+
}
|
|
7258
|
+
}
|
|
7259
|
+
__removePaint(attrName, removeInput) {
|
|
7260
|
+
if (removeInput)
|
|
7261
|
+
this.__removeInput(attrName);
|
|
7262
|
+
PaintImage.recycleImage(attrName, this);
|
|
7263
|
+
if (attrName === 'fill') {
|
|
7264
|
+
stintSet$2(this, '__isAlphaPixelFill', undefined);
|
|
7265
|
+
this._fill = this.__isFills = undefined;
|
|
7266
|
+
}
|
|
7267
|
+
else {
|
|
7268
|
+
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7269
|
+
this._stroke = this.__isStrokes = undefined;
|
|
7270
|
+
}
|
|
7147
7271
|
}
|
|
7148
7272
|
}
|
|
7149
7273
|
function setArray(data, key, value) {
|
|
@@ -7151,10 +7275,10 @@ var LeaferUI = (function (exports) {
|
|
|
7151
7275
|
if (value instanceof Array) {
|
|
7152
7276
|
if (value.some((item) => item.visible === false))
|
|
7153
7277
|
value = value.filter((item) => item.visible !== false);
|
|
7154
|
-
value.length || (value =
|
|
7278
|
+
value.length || (value = undefined);
|
|
7155
7279
|
}
|
|
7156
7280
|
else
|
|
7157
|
-
value = value && value.visible !== false ? [value] :
|
|
7281
|
+
value = value && value.visible !== false ? [value] : undefined;
|
|
7158
7282
|
data['_' + key] = value;
|
|
7159
7283
|
}
|
|
7160
7284
|
|
|
@@ -7257,8 +7381,6 @@ var LeaferUI = (function (exports) {
|
|
|
7257
7381
|
this._url = value;
|
|
7258
7382
|
}
|
|
7259
7383
|
__setImageFill(value) {
|
|
7260
|
-
if (this.__leaf.image)
|
|
7261
|
-
this.__leaf.image = null;
|
|
7262
7384
|
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
7263
7385
|
}
|
|
7264
7386
|
__getData() {
|
|
@@ -7324,21 +7446,19 @@ var LeaferUI = (function (exports) {
|
|
|
7324
7446
|
}
|
|
7325
7447
|
};
|
|
7326
7448
|
|
|
7449
|
+
const { stintSet: stintSet$1 } = DataHelper;
|
|
7327
7450
|
const UIRender = {
|
|
7328
7451
|
__updateChange() {
|
|
7329
|
-
const data = this.__
|
|
7452
|
+
const data = this.__;
|
|
7330
7453
|
if (data.__useEffect) {
|
|
7331
|
-
const { shadow,
|
|
7332
|
-
data.
|
|
7454
|
+
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7455
|
+
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')));
|
|
7456
|
+
data.__useEffect = !!(shadow || otherEffect);
|
|
7333
7457
|
}
|
|
7334
|
-
|
|
7335
|
-
|
|
7458
|
+
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7459
|
+
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7336
7460
|
data.__checkSingle();
|
|
7337
|
-
|
|
7338
|
-
if (complex)
|
|
7339
|
-
data.__complex = true;
|
|
7340
|
-
else
|
|
7341
|
-
data.__complex && (data.__complex = false);
|
|
7461
|
+
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7342
7462
|
},
|
|
7343
7463
|
__drawFast(canvas, options) {
|
|
7344
7464
|
drawFast(this, canvas, options);
|
|
@@ -7348,21 +7468,23 @@ var LeaferUI = (function (exports) {
|
|
|
7348
7468
|
if (data.__complex) {
|
|
7349
7469
|
if (data.__needComputePaint)
|
|
7350
7470
|
data.__computePaint();
|
|
7351
|
-
const { fill, stroke, __drawAfterFill } = data;
|
|
7471
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke, __isFastShadow } = data;
|
|
7352
7472
|
this.__drawRenderPath(canvas);
|
|
7353
|
-
if (data.__useEffect) {
|
|
7473
|
+
if (data.__useEffect && !__isFastShadow) {
|
|
7354
7474
|
const shape = Paint.shape(this, canvas, options);
|
|
7355
7475
|
this.__nowWorld = this.__getNowWorld(options);
|
|
7356
7476
|
const { shadow, innerShadow, filter } = data;
|
|
7357
7477
|
if (shadow)
|
|
7358
7478
|
Effect.shadow(this, canvas, shape);
|
|
7479
|
+
if (__fillAfterStroke)
|
|
7480
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7359
7481
|
if (fill)
|
|
7360
7482
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7361
7483
|
if (__drawAfterFill)
|
|
7362
7484
|
this.__drawAfterFill(canvas, options);
|
|
7363
7485
|
if (innerShadow)
|
|
7364
7486
|
Effect.innerShadow(this, canvas, shape);
|
|
7365
|
-
if (stroke)
|
|
7487
|
+
if (stroke && !__fillAfterStroke)
|
|
7366
7488
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7367
7489
|
if (filter)
|
|
7368
7490
|
Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
@@ -7371,21 +7493,27 @@ var LeaferUI = (function (exports) {
|
|
|
7371
7493
|
shape.canvas.recycle();
|
|
7372
7494
|
}
|
|
7373
7495
|
else {
|
|
7496
|
+
if (__fillAfterStroke)
|
|
7497
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7498
|
+
if (__isFastShadow) {
|
|
7499
|
+
const shadow = data.shadow[0], { scaleX, scaleY } = this.__nowWorld;
|
|
7500
|
+
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
7501
|
+
}
|
|
7374
7502
|
if (fill)
|
|
7375
7503
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7504
|
+
if (__isFastShadow)
|
|
7505
|
+
canvas.restore();
|
|
7376
7506
|
if (__drawAfterFill)
|
|
7377
7507
|
this.__drawAfterFill(canvas, options);
|
|
7378
|
-
if (stroke)
|
|
7508
|
+
if (stroke && !__fillAfterStroke)
|
|
7379
7509
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7380
7510
|
}
|
|
7381
7511
|
}
|
|
7382
7512
|
else {
|
|
7383
|
-
if (data.__pathInputed)
|
|
7513
|
+
if (data.__pathInputed)
|
|
7384
7514
|
drawFast(this, canvas, options);
|
|
7385
|
-
|
|
7386
|
-
else {
|
|
7515
|
+
else
|
|
7387
7516
|
this.__drawFast(canvas, options);
|
|
7388
|
-
}
|
|
7389
7517
|
}
|
|
7390
7518
|
},
|
|
7391
7519
|
__renderShape(canvas, options, ignoreFill, ignoreStroke) {
|
|
@@ -7394,17 +7522,17 @@ var LeaferUI = (function (exports) {
|
|
|
7394
7522
|
const { fill, stroke } = this.__;
|
|
7395
7523
|
this.__drawRenderPath(canvas);
|
|
7396
7524
|
if (fill && !ignoreFill)
|
|
7397
|
-
this.__.
|
|
7525
|
+
this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7398
7526
|
if (this.__.__isCanvas)
|
|
7399
7527
|
this.__drawAfterFill(canvas, options);
|
|
7400
7528
|
if (stroke && !ignoreStroke)
|
|
7401
|
-
this.__.
|
|
7529
|
+
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7402
7530
|
}
|
|
7403
7531
|
},
|
|
7404
7532
|
__drawAfterFill(canvas, options) {
|
|
7405
7533
|
if (this.__.__clipAfterFill) {
|
|
7406
7534
|
canvas.save();
|
|
7407
|
-
|
|
7535
|
+
canvas.clipUI();
|
|
7408
7536
|
this.__drawContent(canvas, options);
|
|
7409
7537
|
canvas.restore();
|
|
7410
7538
|
}
|
|
@@ -7413,13 +7541,15 @@ var LeaferUI = (function (exports) {
|
|
|
7413
7541
|
}
|
|
7414
7542
|
};
|
|
7415
7543
|
function drawFast(ui, canvas, options) {
|
|
7416
|
-
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
7544
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke } = ui.__;
|
|
7417
7545
|
ui.__drawRenderPath(canvas);
|
|
7546
|
+
if (__fillAfterStroke)
|
|
7547
|
+
Paint.stroke(stroke, ui, canvas);
|
|
7418
7548
|
if (fill)
|
|
7419
7549
|
Paint.fill(fill, ui, canvas);
|
|
7420
7550
|
if (__drawAfterFill)
|
|
7421
7551
|
ui.__drawAfterFill(canvas, options);
|
|
7422
|
-
if (stroke)
|
|
7552
|
+
if (stroke && !__fillAfterStroke)
|
|
7423
7553
|
Paint.stroke(stroke, ui, canvas);
|
|
7424
7554
|
}
|
|
7425
7555
|
|
|
@@ -7791,6 +7921,9 @@ var LeaferUI = (function (exports) {
|
|
|
7791
7921
|
__decorate([
|
|
7792
7922
|
surfaceType()
|
|
7793
7923
|
], exports.UI.prototype, "placeholderColor", void 0);
|
|
7924
|
+
__decorate([
|
|
7925
|
+
dataType(100)
|
|
7926
|
+
], exports.UI.prototype, "placeholderDelay", void 0);
|
|
7794
7927
|
__decorate([
|
|
7795
7928
|
dataType({})
|
|
7796
7929
|
], exports.UI.prototype, "data", void 0);
|
|
@@ -8192,15 +8325,20 @@ var LeaferUI = (function (exports) {
|
|
|
8192
8325
|
}
|
|
8193
8326
|
__listenEvents() {
|
|
8194
8327
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8195
|
-
this.once(
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8328
|
+
this.once([
|
|
8329
|
+
[LeaferEvent.START, () => Run.end(runId)],
|
|
8330
|
+
[LayoutEvent.START, this.updateLazyBounds, this],
|
|
8331
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
8332
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
8333
|
+
]);
|
|
8334
|
+
this.__eventIds.push(this.on_([
|
|
8335
|
+
[WatchEvent.DATA, this.__onWatchData, this],
|
|
8336
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
8337
|
+
[RenderEvent.NEXT, this.__onNextRender, this]
|
|
8338
|
+
]));
|
|
8200
8339
|
}
|
|
8201
8340
|
__removeListenEvents() {
|
|
8202
8341
|
this.off_(this.__eventIds);
|
|
8203
|
-
this.__eventIds.length = 0;
|
|
8204
8342
|
}
|
|
8205
8343
|
destroy(sync) {
|
|
8206
8344
|
const doDestory = () => {
|
|
@@ -8308,13 +8446,13 @@ var LeaferUI = (function (exports) {
|
|
|
8308
8446
|
super.__updateRenderBounds();
|
|
8309
8447
|
copy$6(childrenRenderBounds, renderBounds);
|
|
8310
8448
|
this.__updateRectRenderBounds();
|
|
8311
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8449
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8312
8450
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8313
8451
|
add(renderBounds, childrenRenderBounds);
|
|
8314
8452
|
}
|
|
8315
8453
|
else
|
|
8316
8454
|
this.__updateRectRenderBounds();
|
|
8317
|
-
|
|
8455
|
+
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8318
8456
|
}
|
|
8319
8457
|
__updateRectRenderBounds() { }
|
|
8320
8458
|
__updateRectChange() { }
|
|
@@ -8618,18 +8756,10 @@ var LeaferUI = (function (exports) {
|
|
|
8618
8756
|
|
|
8619
8757
|
exports.Image = class Image extends exports.Rect {
|
|
8620
8758
|
get __tag() { return 'Image'; }
|
|
8621
|
-
get ready() {
|
|
8759
|
+
get ready() { const { image } = this; return image && image.ready; }
|
|
8760
|
+
get image() { const { fill } = this.__; return fill instanceof Array && fill[0].image; }
|
|
8622
8761
|
constructor(data) {
|
|
8623
8762
|
super(data);
|
|
8624
|
-
this.on_(ImageEvent.LOADED, this.__onLoaded, this);
|
|
8625
|
-
}
|
|
8626
|
-
__onLoaded(e) {
|
|
8627
|
-
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8628
|
-
this.image = e.image;
|
|
8629
|
-
}
|
|
8630
|
-
destroy() {
|
|
8631
|
-
this.image = null;
|
|
8632
|
-
super.destroy();
|
|
8633
8763
|
}
|
|
8634
8764
|
};
|
|
8635
8765
|
__decorate([
|
|
@@ -8645,11 +8775,11 @@ var LeaferUI = (function (exports) {
|
|
|
8645
8775
|
|
|
8646
8776
|
exports.Canvas = class Canvas extends exports.Rect {
|
|
8647
8777
|
get __tag() { return 'Canvas'; }
|
|
8778
|
+
get context() { return this.canvas.context; }
|
|
8648
8779
|
get ready() { return !this.url; }
|
|
8649
8780
|
constructor(data) {
|
|
8650
8781
|
super(data);
|
|
8651
8782
|
this.canvas = Creator.canvas(this.__);
|
|
8652
|
-
this.context = this.canvas.context;
|
|
8653
8783
|
if (data && data.url)
|
|
8654
8784
|
this.drawImage(data.url);
|
|
8655
8785
|
}
|
|
@@ -8693,7 +8823,7 @@ var LeaferUI = (function (exports) {
|
|
|
8693
8823
|
destroy() {
|
|
8694
8824
|
if (this.canvas) {
|
|
8695
8825
|
this.canvas.destroy();
|
|
8696
|
-
this.canvas =
|
|
8826
|
+
this.canvas = null;
|
|
8697
8827
|
}
|
|
8698
8828
|
super.destroy();
|
|
8699
8829
|
}
|
|
@@ -8769,12 +8899,11 @@ var LeaferUI = (function (exports) {
|
|
|
8769
8899
|
super.__updateBoxBounds();
|
|
8770
8900
|
if (italic)
|
|
8771
8901
|
b.width += fontSize * 0.16;
|
|
8772
|
-
|
|
8773
|
-
if (isOverflow)
|
|
8902
|
+
DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds));
|
|
8903
|
+
if (this.isOverflow)
|
|
8774
8904
|
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8775
8905
|
else
|
|
8776
8906
|
data.__textBoxBounds = b;
|
|
8777
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8778
8907
|
}
|
|
8779
8908
|
__onUpdateSize() {
|
|
8780
8909
|
if (this.__box)
|
|
@@ -8888,6 +9017,9 @@ var LeaferUI = (function (exports) {
|
|
|
8888
9017
|
__decorate([
|
|
8889
9018
|
boundsType('show')
|
|
8890
9019
|
], exports.Text.prototype, "textOverflow", void 0);
|
|
9020
|
+
__decorate([
|
|
9021
|
+
surfaceType(false)
|
|
9022
|
+
], exports.Text.prototype, "textEditing", void 0);
|
|
8891
9023
|
exports.Text = __decorate([
|
|
8892
9024
|
registerUI()
|
|
8893
9025
|
], exports.Text);
|
|
@@ -8975,7 +9107,7 @@ var LeaferUI = (function (exports) {
|
|
|
8975
9107
|
if (sky || editor)
|
|
8976
9108
|
this.sky = this.addLeafer(sky);
|
|
8977
9109
|
if (editor)
|
|
8978
|
-
|
|
9110
|
+
Creator.editor(editor, this);
|
|
8979
9111
|
}
|
|
8980
9112
|
}
|
|
8981
9113
|
__setApp() {
|
|
@@ -8989,6 +9121,10 @@ var LeaferUI = (function (exports) {
|
|
|
8989
9121
|
this.watcher.disable();
|
|
8990
9122
|
this.layouter.disable();
|
|
8991
9123
|
}
|
|
9124
|
+
__updateLocalBounds() {
|
|
9125
|
+
this.forEach(leafer => leafer.updateLayout());
|
|
9126
|
+
super.__updateLocalBounds();
|
|
9127
|
+
}
|
|
8992
9128
|
start() {
|
|
8993
9129
|
super.start();
|
|
8994
9130
|
this.forEach(leafer => leafer.start());
|
|
@@ -9046,12 +9182,8 @@ var LeaferUI = (function (exports) {
|
|
|
9046
9182
|
this.renderer.update();
|
|
9047
9183
|
}
|
|
9048
9184
|
__render(canvas, options) {
|
|
9049
|
-
if (canvas.context)
|
|
9050
|
-
|
|
9051
|
-
if (m)
|
|
9052
|
-
canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
|
|
9053
|
-
this.forEach(leafer => canvas.copyWorld(leafer.canvas));
|
|
9054
|
-
}
|
|
9185
|
+
if (canvas.context)
|
|
9186
|
+
this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
|
|
9055
9187
|
}
|
|
9056
9188
|
__onResize(event) {
|
|
9057
9189
|
this.forEach(leafer => leafer.resize(event));
|
|
@@ -9072,9 +9204,11 @@ var LeaferUI = (function (exports) {
|
|
|
9072
9204
|
return config;
|
|
9073
9205
|
}
|
|
9074
9206
|
__listenChildEvents(leafer) {
|
|
9075
|
-
leafer.once(
|
|
9076
|
-
|
|
9077
|
-
|
|
9207
|
+
leafer.once([
|
|
9208
|
+
[LayoutEvent.END, this.__onReady, this],
|
|
9209
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
9210
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
9211
|
+
]);
|
|
9078
9212
|
if (this.realCanvas)
|
|
9079
9213
|
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9080
9214
|
}
|
|
@@ -9285,7 +9419,7 @@ var LeaferUI = (function (exports) {
|
|
|
9285
9419
|
registerUIEvent()
|
|
9286
9420
|
], exports.MoveEvent);
|
|
9287
9421
|
|
|
9288
|
-
exports.RotateEvent = class RotateEvent extends
|
|
9422
|
+
exports.RotateEvent = class RotateEvent extends exports.PointerEvent {
|
|
9289
9423
|
};
|
|
9290
9424
|
exports.RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
|
|
9291
9425
|
exports.RotateEvent.START = 'rotate.start';
|
|
@@ -9306,7 +9440,7 @@ var LeaferUI = (function (exports) {
|
|
|
9306
9440
|
registerUIEvent()
|
|
9307
9441
|
], exports.SwipeEvent);
|
|
9308
9442
|
|
|
9309
|
-
exports.ZoomEvent = class ZoomEvent extends
|
|
9443
|
+
exports.ZoomEvent = class ZoomEvent extends exports.PointerEvent {
|
|
9310
9444
|
};
|
|
9311
9445
|
exports.ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
|
|
9312
9446
|
exports.ZoomEvent.START = 'zoom.start';
|
|
@@ -10149,8 +10283,8 @@ var LeaferUI = (function (exports) {
|
|
|
10149
10283
|
if (this.__box)
|
|
10150
10284
|
this.__box.__updateHitCanvas();
|
|
10151
10285
|
const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
|
|
10152
|
-
const isHitPixelFill = (data.
|
|
10153
|
-
const isHitPixelStroke = data.
|
|
10286
|
+
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
10287
|
+
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
10154
10288
|
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
10155
10289
|
if (!this.__hitCanvas)
|
|
10156
10290
|
this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
|
|
@@ -10181,11 +10315,11 @@ var LeaferUI = (function (exports) {
|
|
|
10181
10315
|
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
10182
10316
|
return true;
|
|
10183
10317
|
const { hitFill } = data;
|
|
10184
|
-
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.
|
|
10318
|
+
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
10185
10319
|
if (needHitFillPath && this.__hitFill(inner))
|
|
10186
10320
|
return true;
|
|
10187
10321
|
const { hitStroke, __strokeWidth } = data;
|
|
10188
|
-
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.
|
|
10322
|
+
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
10189
10323
|
if (!needHitFillPath && !needHitStrokePath)
|
|
10190
10324
|
return false;
|
|
10191
10325
|
const radiusWidth = inner.radiusX * 2;
|
|
@@ -10326,35 +10460,38 @@ var LeaferUI = (function (exports) {
|
|
|
10326
10460
|
}
|
|
10327
10461
|
|
|
10328
10462
|
function strokeText(stroke, ui, canvas) {
|
|
10329
|
-
|
|
10330
|
-
const isStrokes = typeof stroke !== 'string';
|
|
10331
|
-
switch (strokeAlign) {
|
|
10463
|
+
switch (ui.__.strokeAlign) {
|
|
10332
10464
|
case 'center':
|
|
10333
|
-
|
|
10334
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
10465
|
+
drawCenter$1(stroke, 1, ui, canvas);
|
|
10335
10466
|
break;
|
|
10336
10467
|
case 'inside':
|
|
10337
|
-
|
|
10468
|
+
drawAlign(stroke, 'inside', ui, canvas);
|
|
10338
10469
|
break;
|
|
10339
10470
|
case 'outside':
|
|
10340
|
-
|
|
10471
|
+
ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, 'outside', ui, canvas);
|
|
10341
10472
|
break;
|
|
10342
10473
|
}
|
|
10343
10474
|
}
|
|
10344
|
-
function
|
|
10345
|
-
const
|
|
10475
|
+
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
10476
|
+
const data = ui.__;
|
|
10477
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
|
|
10478
|
+
data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
10479
|
+
}
|
|
10480
|
+
function drawAlign(stroke, align, ui, canvas) {
|
|
10346
10481
|
const out = canvas.getSameCanvas(true, true);
|
|
10347
|
-
out.
|
|
10348
|
-
|
|
10349
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
|
|
10482
|
+
out.font = ui.__.__font;
|
|
10483
|
+
drawCenter$1(stroke, 2, ui, out);
|
|
10350
10484
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10351
10485
|
fillText(ui, out);
|
|
10352
10486
|
out.blendMode = 'normal';
|
|
10353
|
-
|
|
10487
|
+
copyWorld(canvas, out, ui);
|
|
10488
|
+
out.recycle(ui.__nowWorld);
|
|
10489
|
+
}
|
|
10490
|
+
function copyWorld(canvas, out, ui) {
|
|
10491
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
10354
10492
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10355
10493
|
else
|
|
10356
10494
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10357
|
-
out.recycle(ui.__nowWorld);
|
|
10358
10495
|
}
|
|
10359
10496
|
function drawTextStroke(ui, canvas) {
|
|
10360
10497
|
let row, data = ui.__.__textDrawData;
|
|
@@ -10392,90 +10529,56 @@ var LeaferUI = (function (exports) {
|
|
|
10392
10529
|
}
|
|
10393
10530
|
|
|
10394
10531
|
function stroke(stroke, ui, canvas) {
|
|
10395
|
-
const
|
|
10396
|
-
|
|
10397
|
-
if (!__strokeWidth)
|
|
10532
|
+
const data = ui.__;
|
|
10533
|
+
if (!data.__strokeWidth)
|
|
10398
10534
|
return;
|
|
10399
|
-
if (__font) {
|
|
10535
|
+
if (data.__font) {
|
|
10400
10536
|
strokeText(stroke, ui, canvas);
|
|
10401
10537
|
}
|
|
10402
10538
|
else {
|
|
10403
|
-
switch (strokeAlign) {
|
|
10539
|
+
switch (data.strokeAlign) {
|
|
10404
10540
|
case 'center':
|
|
10405
|
-
|
|
10406
|
-
canvas.stroke();
|
|
10407
|
-
if (options.__useArrow)
|
|
10408
|
-
strokeArrow(ui, canvas);
|
|
10541
|
+
drawCenter(stroke, 1, ui, canvas);
|
|
10409
10542
|
break;
|
|
10410
10543
|
case 'inside':
|
|
10411
|
-
canvas
|
|
10412
|
-
canvas.setStroke(stroke, __strokeWidth * 2, options);
|
|
10413
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
10414
|
-
canvas.stroke();
|
|
10415
|
-
canvas.restore();
|
|
10544
|
+
drawInside(stroke, ui, canvas);
|
|
10416
10545
|
break;
|
|
10417
10546
|
case 'outside':
|
|
10418
|
-
|
|
10419
|
-
out.setStroke(stroke, __strokeWidth * 2, options);
|
|
10420
|
-
ui.__drawRenderPath(out);
|
|
10421
|
-
out.stroke();
|
|
10422
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10423
|
-
out.clearWorld(ui.__layout.renderBounds);
|
|
10424
|
-
if (ui.__worldFlipped)
|
|
10425
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10426
|
-
else
|
|
10427
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10428
|
-
out.recycle(ui.__nowWorld);
|
|
10547
|
+
drawOutside(stroke, ui, canvas);
|
|
10429
10548
|
break;
|
|
10430
10549
|
}
|
|
10431
10550
|
}
|
|
10432
10551
|
}
|
|
10433
10552
|
function strokes(strokes, ui, canvas) {
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
|
|
10439
|
-
|
|
10553
|
+
stroke(strokes, ui, canvas);
|
|
10554
|
+
}
|
|
10555
|
+
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
10556
|
+
const data = ui.__;
|
|
10557
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
10558
|
+
data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
|
|
10559
|
+
if (data.__useArrow)
|
|
10560
|
+
Paint.strokeArrow(stroke, ui, canvas);
|
|
10561
|
+
}
|
|
10562
|
+
function drawInside(stroke, ui, canvas) {
|
|
10563
|
+
canvas.save();
|
|
10564
|
+
canvas.clipUI(ui);
|
|
10565
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
10566
|
+
canvas.restore();
|
|
10567
|
+
}
|
|
10568
|
+
function drawOutside(stroke, ui, canvas) {
|
|
10569
|
+
const data = ui.__;
|
|
10570
|
+
if (data.__fillAfterStroke) {
|
|
10571
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
10440
10572
|
}
|
|
10441
10573
|
else {
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
canvas.save();
|
|
10451
|
-
canvas.setStroke(undefined, __strokeWidth * 2, options);
|
|
10452
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
10453
|
-
drawStrokesStyle(strokes, false, ui, canvas);
|
|
10454
|
-
canvas.restore();
|
|
10455
|
-
break;
|
|
10456
|
-
case 'outside':
|
|
10457
|
-
const { renderBounds } = ui.__layout;
|
|
10458
|
-
const out = canvas.getSameCanvas(true, true);
|
|
10459
|
-
ui.__drawRenderPath(out);
|
|
10460
|
-
out.setStroke(undefined, __strokeWidth * 2, options);
|
|
10461
|
-
drawStrokesStyle(strokes, false, ui, out);
|
|
10462
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
10463
|
-
out.clearWorld(renderBounds);
|
|
10464
|
-
if (ui.__worldFlipped)
|
|
10465
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10466
|
-
else
|
|
10467
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
10468
|
-
out.recycle(ui.__nowWorld);
|
|
10469
|
-
break;
|
|
10470
|
-
}
|
|
10471
|
-
}
|
|
10472
|
-
}
|
|
10473
|
-
function strokeArrow(ui, canvas) {
|
|
10474
|
-
if (ui.__.dashPattern) {
|
|
10475
|
-
canvas.beginPath();
|
|
10476
|
-
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
10477
|
-
canvas.dashPattern = null;
|
|
10478
|
-
canvas.stroke();
|
|
10574
|
+
const { renderBounds } = ui.__layout;
|
|
10575
|
+
const out = canvas.getSameCanvas(true, true);
|
|
10576
|
+
ui.__drawRenderPath(out);
|
|
10577
|
+
drawCenter(stroke, 2, ui, out);
|
|
10578
|
+
out.clipUI(data);
|
|
10579
|
+
out.clearWorld(renderBounds);
|
|
10580
|
+
copyWorld(canvas, out, ui);
|
|
10581
|
+
out.recycle(ui.__nowWorld);
|
|
10479
10582
|
}
|
|
10480
10583
|
}
|
|
10481
10584
|
|
|
@@ -10522,41 +10625,66 @@ var LeaferUI = (function (exports) {
|
|
|
10522
10625
|
}
|
|
10523
10626
|
|
|
10524
10627
|
let recycleMap;
|
|
10628
|
+
const { stintSet } = DataHelper, { hasTransparent: hasTransparent$1 } = ColorConvert;
|
|
10525
10629
|
function compute(attrName, ui) {
|
|
10526
10630
|
const data = ui.__, leafPaints = [];
|
|
10527
|
-
let paints = data.__input[attrName],
|
|
10631
|
+
let paints = data.__input[attrName], isAlphaPixel, isTransparent;
|
|
10528
10632
|
if (!(paints instanceof Array))
|
|
10529
10633
|
paints = [paints];
|
|
10530
10634
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
10531
10635
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
10532
|
-
item = getLeafPaint(attrName, paints[i], ui);
|
|
10533
|
-
if (item)
|
|
10534
|
-
leafPaints.push(item);
|
|
10636
|
+
(item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
|
|
10535
10637
|
}
|
|
10536
10638
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
10537
|
-
if (leafPaints.length
|
|
10538
|
-
|
|
10539
|
-
|
|
10639
|
+
if (leafPaints.length) {
|
|
10640
|
+
if (leafPaints.every(item => item.isTransparent)) {
|
|
10641
|
+
if (leafPaints.some(item => item.image))
|
|
10642
|
+
isAlphaPixel = true;
|
|
10643
|
+
isTransparent = true;
|
|
10644
|
+
}
|
|
10645
|
+
}
|
|
10646
|
+
if (attrName === 'fill') {
|
|
10647
|
+
stintSet(data, '__isAlphaPixelFill', isAlphaPixel);
|
|
10648
|
+
stintSet(data, '__isTransparentFill', isTransparent);
|
|
10649
|
+
}
|
|
10650
|
+
else {
|
|
10651
|
+
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
10652
|
+
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
10653
|
+
}
|
|
10540
10654
|
}
|
|
10541
10655
|
function getLeafPaint(attrName, paint, ui) {
|
|
10542
10656
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
|
10543
10657
|
return undefined;
|
|
10658
|
+
let data;
|
|
10544
10659
|
const { boxBounds } = ui.__layout;
|
|
10545
10660
|
switch (paint.type) {
|
|
10546
|
-
case 'solid':
|
|
10547
|
-
let { type, blendMode, color, opacity } = paint;
|
|
10548
|
-
return { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
10549
10661
|
case 'image':
|
|
10550
|
-
|
|
10662
|
+
data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
10663
|
+
break;
|
|
10551
10664
|
case 'linear':
|
|
10552
|
-
|
|
10665
|
+
data = PaintGradient.linearGradient(paint, boxBounds);
|
|
10666
|
+
break;
|
|
10553
10667
|
case 'radial':
|
|
10554
|
-
|
|
10668
|
+
data = PaintGradient.radialGradient(paint, boxBounds);
|
|
10669
|
+
break;
|
|
10555
10670
|
case 'angular':
|
|
10556
|
-
|
|
10671
|
+
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
10672
|
+
break;
|
|
10673
|
+
case 'solid':
|
|
10674
|
+
const { type, color, opacity } = paint;
|
|
10675
|
+
data = { type, style: ColorConvert.string(color, opacity) };
|
|
10676
|
+
break;
|
|
10557
10677
|
default:
|
|
10558
|
-
|
|
10678
|
+
if (paint.r !== undefined)
|
|
10679
|
+
data = { type: 'solid', style: ColorConvert.string(paint) };
|
|
10559
10680
|
}
|
|
10681
|
+
if (data) {
|
|
10682
|
+
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
10683
|
+
data.isTransparent = true;
|
|
10684
|
+
if (paint.blendMode)
|
|
10685
|
+
data.blendMode = paint.blendMode;
|
|
10686
|
+
}
|
|
10687
|
+
return data;
|
|
10560
10688
|
}
|
|
10561
10689
|
|
|
10562
10690
|
const PaintModule = {
|
|
@@ -10622,12 +10750,10 @@ var LeaferUI = (function (exports) {
|
|
|
10622
10750
|
|
|
10623
10751
|
const { get: get$2, translate } = MatrixHelper;
|
|
10624
10752
|
const tempBox = new Bounds();
|
|
10625
|
-
const tempPoint$1 = {};
|
|
10626
10753
|
const tempScaleData = {};
|
|
10754
|
+
const tempImage = {};
|
|
10627
10755
|
function createData(leafPaint, image, paint, box) {
|
|
10628
|
-
const {
|
|
10629
|
-
if (blendMode)
|
|
10630
|
-
leafPaint.blendMode = blendMode;
|
|
10756
|
+
const { changeful, sync } = paint;
|
|
10631
10757
|
if (changeful)
|
|
10632
10758
|
leafPaint.changeful = changeful;
|
|
10633
10759
|
if (sync)
|
|
@@ -10635,38 +10761,38 @@ var LeaferUI = (function (exports) {
|
|
|
10635
10761
|
leafPaint.data = getPatternData(paint, box, image);
|
|
10636
10762
|
}
|
|
10637
10763
|
function getPatternData(paint, box, image) {
|
|
10638
|
-
let { width, height } = image;
|
|
10639
10764
|
if (paint.padding)
|
|
10640
10765
|
box = tempBox.set(box).shrink(paint.padding);
|
|
10641
10766
|
if (paint.mode === 'strench')
|
|
10642
10767
|
paint.mode = 'stretch';
|
|
10768
|
+
let { width, height } = image;
|
|
10643
10769
|
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
10644
10770
|
const sameBox = box.width === width && box.height === height;
|
|
10645
10771
|
const data = { mode };
|
|
10646
10772
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
10647
|
-
|
|
10648
|
-
let
|
|
10773
|
+
BoundsHelper.set(tempImage, 0, 0, swapSize ? height : width, swapSize ? width : height);
|
|
10774
|
+
let scaleX, scaleY;
|
|
10649
10775
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
10650
10776
|
if (!sameBox || rotation) {
|
|
10651
|
-
|
|
10652
|
-
|
|
10653
|
-
|
|
10777
|
+
scaleX = scaleY = BoundsHelper.getFitScale(box, tempImage, mode !== 'fit');
|
|
10778
|
+
BoundsHelper.put(box, image, align, scaleX, false, tempImage);
|
|
10779
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
10654
10780
|
}
|
|
10655
10781
|
}
|
|
10656
|
-
else
|
|
10657
|
-
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10662
|
-
|
|
10663
|
-
|
|
10664
|
-
|
|
10665
|
-
|
|
10666
|
-
|
|
10782
|
+
else {
|
|
10783
|
+
if (scale || size) {
|
|
10784
|
+
MathHelper.getScaleData(scale, size, image, tempScaleData);
|
|
10785
|
+
scaleX = tempScaleData.scaleX;
|
|
10786
|
+
scaleY = tempScaleData.scaleY;
|
|
10787
|
+
}
|
|
10788
|
+
if (align) {
|
|
10789
|
+
if (scaleX)
|
|
10790
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
10791
|
+
AlignHelper.toPoint(align, tempImage, box, tempImage, true, true);
|
|
10792
|
+
}
|
|
10667
10793
|
}
|
|
10668
10794
|
if (offset)
|
|
10669
|
-
|
|
10795
|
+
PointHelper.move(tempImage, offset);
|
|
10670
10796
|
switch (mode) {
|
|
10671
10797
|
case 'stretch':
|
|
10672
10798
|
if (!sameBox)
|
|
@@ -10674,12 +10800,12 @@ var LeaferUI = (function (exports) {
|
|
|
10674
10800
|
break;
|
|
10675
10801
|
case 'normal':
|
|
10676
10802
|
case 'clip':
|
|
10677
|
-
if (x || y || scaleX || rotation)
|
|
10678
|
-
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
10803
|
+
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
10804
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
10679
10805
|
break;
|
|
10680
10806
|
case 'repeat':
|
|
10681
10807
|
if (!sameBox || scaleX || rotation)
|
|
10682
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
10808
|
+
repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, align);
|
|
10683
10809
|
if (!repeat)
|
|
10684
10810
|
data.repeat = 'repeat';
|
|
10685
10811
|
break;
|
|
@@ -10687,7 +10813,7 @@ var LeaferUI = (function (exports) {
|
|
|
10687
10813
|
case 'cover':
|
|
10688
10814
|
default:
|
|
10689
10815
|
if (scaleX)
|
|
10690
|
-
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
10816
|
+
fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
10691
10817
|
}
|
|
10692
10818
|
if (!data.transform) {
|
|
10693
10819
|
if (box.x || box.y) {
|
|
@@ -10720,6 +10846,8 @@ var LeaferUI = (function (exports) {
|
|
|
10720
10846
|
}
|
|
10721
10847
|
else {
|
|
10722
10848
|
leafPaint = { type: paint.type, image };
|
|
10849
|
+
if (image.hasAlphaPixel)
|
|
10850
|
+
leafPaint.isTransparent = true;
|
|
10723
10851
|
cache$1 = image.use > 1 ? { leafPaint, paint, boxBounds: box$1.set(boxBounds) } : null;
|
|
10724
10852
|
}
|
|
10725
10853
|
if (firstUse || image.loading)
|
|
@@ -10744,7 +10872,7 @@ var LeaferUI = (function (exports) {
|
|
|
10744
10872
|
ignoreRender(ui, false);
|
|
10745
10873
|
if (!ui.destroyed) {
|
|
10746
10874
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
10747
|
-
if (image.
|
|
10875
|
+
if (image.hasAlphaPixel)
|
|
10748
10876
|
ui.__layout.hitCanvasChanged = true;
|
|
10749
10877
|
ui.forceUpdate('surface');
|
|
10750
10878
|
}
|
|
@@ -10756,13 +10884,17 @@ var LeaferUI = (function (exports) {
|
|
|
10756
10884
|
onLoadError(ui, event, error);
|
|
10757
10885
|
leafPaint.loadId = null;
|
|
10758
10886
|
});
|
|
10759
|
-
if (ui.placeholderColor)
|
|
10760
|
-
|
|
10761
|
-
|
|
10762
|
-
|
|
10763
|
-
|
|
10764
|
-
|
|
10765
|
-
|
|
10887
|
+
if (ui.placeholderColor) {
|
|
10888
|
+
if (!ui.placeholderDelay)
|
|
10889
|
+
image.isPlacehold = true;
|
|
10890
|
+
else
|
|
10891
|
+
setTimeout(() => {
|
|
10892
|
+
if (!image.ready) {
|
|
10893
|
+
image.isPlacehold = true;
|
|
10894
|
+
ui.forceUpdate('surface');
|
|
10895
|
+
}
|
|
10896
|
+
}, ui.placeholderDelay);
|
|
10897
|
+
}
|
|
10766
10898
|
}
|
|
10767
10899
|
return leafPaint;
|
|
10768
10900
|
}
|
|
@@ -10917,7 +11049,7 @@ var LeaferUI = (function (exports) {
|
|
|
10917
11049
|
}
|
|
10918
11050
|
function drawImage(ui, canvas, paint, data) {
|
|
10919
11051
|
canvas.save();
|
|
10920
|
-
|
|
11052
|
+
canvas.clipUI(ui);
|
|
10921
11053
|
if (paint.blendMode)
|
|
10922
11054
|
canvas.blendMode = paint.blendMode;
|
|
10923
11055
|
if (data.opacity)
|
|
@@ -10968,32 +11100,33 @@ var LeaferUI = (function (exports) {
|
|
|
10968
11100
|
repeatMode
|
|
10969
11101
|
};
|
|
10970
11102
|
|
|
10971
|
-
const { toPoint: toPoint$3 } = AroundHelper;
|
|
11103
|
+
const { toPoint: toPoint$3 } = AroundHelper, { hasTransparent } = ColorConvert;
|
|
10972
11104
|
const realFrom$2 = {};
|
|
10973
11105
|
const realTo$2 = {};
|
|
10974
11106
|
function linearGradient(paint, box) {
|
|
10975
|
-
let { from, to, type,
|
|
11107
|
+
let { from, to, type, opacity } = paint;
|
|
10976
11108
|
toPoint$3(from || 'top', box, realFrom$2);
|
|
10977
11109
|
toPoint$3(to || 'bottom', box, realTo$2);
|
|
10978
11110
|
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
10979
|
-
applyStops(style, paint.stops, opacity);
|
|
10980
11111
|
const data = { type, style };
|
|
10981
|
-
|
|
10982
|
-
data.blendMode = blendMode;
|
|
11112
|
+
applyStops(data, style, paint.stops, opacity);
|
|
10983
11113
|
return data;
|
|
10984
11114
|
}
|
|
10985
|
-
function applyStops(gradient, stops, opacity) {
|
|
11115
|
+
function applyStops(data, gradient, stops, opacity) {
|
|
10986
11116
|
if (stops) {
|
|
10987
|
-
let stop;
|
|
11117
|
+
let stop, color, offset, isTransparent;
|
|
10988
11118
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
10989
11119
|
stop = stops[i];
|
|
10990
|
-
if (typeof stop === 'string')
|
|
10991
|
-
|
|
10992
|
-
|
|
10993
|
-
|
|
10994
|
-
|
|
10995
|
-
|
|
11120
|
+
if (typeof stop === 'string')
|
|
11121
|
+
offset = i / (len - 1), color = ColorConvert.string(stop, opacity);
|
|
11122
|
+
else
|
|
11123
|
+
offset = stop.offset, color = ColorConvert.string(stop.color, opacity);
|
|
11124
|
+
gradient.addColorStop(offset, color);
|
|
11125
|
+
if (!isTransparent && hasTransparent(color))
|
|
11126
|
+
isTransparent = true;
|
|
10996
11127
|
}
|
|
11128
|
+
if (isTransparent)
|
|
11129
|
+
data.isTransparent = true;
|
|
10997
11130
|
}
|
|
10998
11131
|
}
|
|
10999
11132
|
|
|
@@ -11003,17 +11136,15 @@ var LeaferUI = (function (exports) {
|
|
|
11003
11136
|
const realFrom$1 = {};
|
|
11004
11137
|
const realTo$1 = {};
|
|
11005
11138
|
function radialGradient(paint, box) {
|
|
11006
|
-
let { from, to, type, opacity,
|
|
11139
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
11007
11140
|
toPoint$2(from || 'center', box, realFrom$1);
|
|
11008
11141
|
toPoint$2(to || 'bottom', box, realTo$1);
|
|
11009
11142
|
const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$2(realFrom$1, realTo$1));
|
|
11010
|
-
applyStops(style, paint.stops, opacity);
|
|
11011
11143
|
const data = { type, style };
|
|
11144
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11012
11145
|
const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
|
|
11013
11146
|
if (transform)
|
|
11014
11147
|
data.transform = transform;
|
|
11015
|
-
if (blendMode)
|
|
11016
|
-
data.blendMode = blendMode;
|
|
11017
11148
|
return data;
|
|
11018
11149
|
}
|
|
11019
11150
|
function getTransform(box, from, to, stretch, rotate90) {
|
|
@@ -11039,17 +11170,15 @@ var LeaferUI = (function (exports) {
|
|
|
11039
11170
|
const realFrom = {};
|
|
11040
11171
|
const realTo = {};
|
|
11041
11172
|
function conicGradient(paint, box) {
|
|
11042
|
-
let { from, to, type, opacity,
|
|
11173
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
11043
11174
|
toPoint$1(from || 'center', box, realFrom);
|
|
11044
11175
|
toPoint$1(to || 'bottom', box, realTo);
|
|
11045
11176
|
const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance$1(realFrom, realTo));
|
|
11046
|
-
applyStops(style, paint.stops, opacity);
|
|
11047
11177
|
const data = { type, style };
|
|
11178
|
+
applyStops(data, style, paint.stops, opacity);
|
|
11048
11179
|
const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
|
|
11049
11180
|
if (transform)
|
|
11050
11181
|
data.transform = transform;
|
|
11051
|
-
if (blendMode)
|
|
11052
|
-
data.blendMode = blendMode;
|
|
11053
11182
|
return data;
|
|
11054
11183
|
}
|
|
11055
11184
|
|
|
@@ -11085,12 +11214,10 @@ var LeaferUI = (function (exports) {
|
|
|
11085
11214
|
}
|
|
11086
11215
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
11087
11216
|
}
|
|
11088
|
-
if (ui.__worldFlipped)
|
|
11217
|
+
if (ui.__worldFlipped)
|
|
11089
11218
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
11090
|
-
|
|
11091
|
-
else {
|
|
11219
|
+
else
|
|
11092
11220
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
11093
|
-
}
|
|
11094
11221
|
if (end && index < end)
|
|
11095
11222
|
other.clearWorld(copyBounds, true);
|
|
11096
11223
|
});
|
|
@@ -11149,12 +11276,10 @@ var LeaferUI = (function (exports) {
|
|
|
11149
11276
|
copyBounds = bounds;
|
|
11150
11277
|
}
|
|
11151
11278
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
11152
|
-
if (ui.__worldFlipped)
|
|
11279
|
+
if (ui.__worldFlipped)
|
|
11153
11280
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
11154
|
-
|
|
11155
|
-
else {
|
|
11281
|
+
else
|
|
11156
11282
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
11157
|
-
}
|
|
11158
11283
|
if (end && index < end)
|
|
11159
11284
|
other.clearWorld(copyBounds, true);
|
|
11160
11285
|
});
|
|
@@ -11382,6 +11507,8 @@ var LeaferUI = (function (exports) {
|
|
|
11382
11507
|
lastCharType = null;
|
|
11383
11508
|
startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
|
|
11384
11509
|
word = { data: [] }, row = { words: [] };
|
|
11510
|
+
if (__letterSpacing)
|
|
11511
|
+
content = [...content];
|
|
11385
11512
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
11386
11513
|
char = content[i];
|
|
11387
11514
|
if (char === '\n') {
|
|
@@ -12228,24 +12355,25 @@ var LeaferUI = (function (exports) {
|
|
|
12228
12355
|
const { app } = editor;
|
|
12229
12356
|
app.selector.proxy = editor;
|
|
12230
12357
|
this.__eventIds = [
|
|
12231
|
-
editor.on_(
|
|
12232
|
-
|
|
12233
|
-
|
|
12234
|
-
|
|
12235
|
-
app.on_(
|
|
12236
|
-
|
|
12237
|
-
|
|
12238
|
-
|
|
12239
|
-
|
|
12240
|
-
|
|
12358
|
+
editor.on_([
|
|
12359
|
+
[EditorEvent.HOVER, this.onHover, this],
|
|
12360
|
+
[EditorEvent.SELECT, this.onSelect, this]
|
|
12361
|
+
]),
|
|
12362
|
+
app.on_([
|
|
12363
|
+
[exports.PointerEvent.MOVE, this.onPointerMove, this],
|
|
12364
|
+
[exports.PointerEvent.BEFORE_DOWN, this.onBeforeDown, this],
|
|
12365
|
+
[exports.PointerEvent.TAP, this.onTap, this],
|
|
12366
|
+
[exports.DragEvent.START, this.onDragStart, this, true],
|
|
12367
|
+
[exports.DragEvent.DRAG, this.onDrag, this],
|
|
12368
|
+
[exports.DragEvent.END, this.onDragEnd, this],
|
|
12369
|
+
[exports.MoveEvent.MOVE, this.onAutoMove, this],
|
|
12370
|
+
[[exports.ZoomEvent.ZOOM, exports.MoveEvent.MOVE], () => { this.editor.hoverTarget = null; }],
|
|
12371
|
+
])
|
|
12241
12372
|
];
|
|
12242
12373
|
});
|
|
12243
12374
|
}
|
|
12244
12375
|
__removeListenEvents() {
|
|
12245
|
-
|
|
12246
|
-
this.off_(this.__eventIds);
|
|
12247
|
-
this.__eventIds.length = 0;
|
|
12248
|
-
}
|
|
12376
|
+
this.off_(this.__eventIds);
|
|
12249
12377
|
}
|
|
12250
12378
|
destroy() {
|
|
12251
12379
|
this.editor = this.originList = this.needRemoveItem = null;
|
|
@@ -12534,6 +12662,10 @@ var LeaferUI = (function (exports) {
|
|
|
12534
12662
|
}
|
|
12535
12663
|
|
|
12536
12664
|
class EditPoint extends exports.Box {
|
|
12665
|
+
constructor(data) {
|
|
12666
|
+
super(data);
|
|
12667
|
+
this.useFastShadow = true;
|
|
12668
|
+
}
|
|
12537
12669
|
}
|
|
12538
12670
|
|
|
12539
12671
|
const fourDirection = ['top', 'right', 'bottom', 'left'], editConfig = undefined;
|
|
@@ -12804,28 +12936,29 @@ var LeaferUI = (function (exports) {
|
|
|
12804
12936
|
const { editor } = this;
|
|
12805
12937
|
point.direction = direction;
|
|
12806
12938
|
point.pointType = type;
|
|
12807
|
-
|
|
12808
|
-
|
|
12809
|
-
|
|
12810
|
-
|
|
12939
|
+
const events = [
|
|
12940
|
+
[exports.DragEvent.START, this.onDragStart, this],
|
|
12941
|
+
[exports.DragEvent.DRAG, this.onDrag, this],
|
|
12942
|
+
[exports.DragEvent.END, this.onDragEnd, this],
|
|
12943
|
+
[exports.PointerEvent.LEAVE, () => { this.enterPoint = null; }],
|
|
12944
|
+
];
|
|
12811
12945
|
if (point.name !== 'circle')
|
|
12812
|
-
|
|
12946
|
+
events.push([exports.PointerEvent.ENTER, (e) => { this.enterPoint = point, updateCursor(editor, e); }]);
|
|
12947
|
+
this.__eventIds.push(point.on_(events));
|
|
12813
12948
|
}
|
|
12814
12949
|
__listenEvents() {
|
|
12815
12950
|
const { rect, editor } = this;
|
|
12816
|
-
this.__eventIds
|
|
12817
|
-
|
|
12818
|
-
|
|
12819
|
-
|
|
12820
|
-
|
|
12821
|
-
|
|
12822
|
-
|
|
12823
|
-
|
|
12824
|
-
];
|
|
12951
|
+
this.__eventIds.push(editor.on_(EditorEvent.SELECT, this.onSelect, this), rect.on_([
|
|
12952
|
+
[exports.DragEvent.START, this.onDragStart, this],
|
|
12953
|
+
[exports.DragEvent.DRAG, editor.onMove, editor],
|
|
12954
|
+
[exports.DragEvent.END, this.onDragEnd, this],
|
|
12955
|
+
[exports.PointerEvent.ENTER, () => updateMoveCursor(editor)],
|
|
12956
|
+
[exports.PointerEvent.DOUBLE_TAP, this.onDoubleTap, this],
|
|
12957
|
+
[exports.PointerEvent.LONG_PRESS, this.onLongPress, this]
|
|
12958
|
+
]));
|
|
12825
12959
|
}
|
|
12826
12960
|
__removeListenEvents() {
|
|
12827
12961
|
this.off_(this.__eventIds);
|
|
12828
|
-
this.__eventIds.length = 0;
|
|
12829
12962
|
}
|
|
12830
12963
|
destroy() {
|
|
12831
12964
|
this.editor = null;
|
|
@@ -13567,12 +13700,14 @@ ${filterStyle$1}
|
|
|
13567
13700
|
const { app, leafer, editBox, editMask } = this;
|
|
13568
13701
|
this.targetEventIds = [
|
|
13569
13702
|
leafer.on_(RenderEvent.START, this.onRenderStart, this),
|
|
13570
|
-
app.on_(
|
|
13571
|
-
|
|
13572
|
-
|
|
13573
|
-
|
|
13574
|
-
|
|
13575
|
-
|
|
13703
|
+
app.on_([
|
|
13704
|
+
[RenderEvent.CHILD_START, this.onAppRenderStart, this],
|
|
13705
|
+
[exports.MoveEvent.BEFORE_MOVE, this.onMove, this, true],
|
|
13706
|
+
[exports.ZoomEvent.BEFORE_ZOOM, this.onScale, this, true],
|
|
13707
|
+
[exports.RotateEvent.BEFORE_ROTATE, this.onRotate, this, true],
|
|
13708
|
+
[[exports.KeyEvent.HOLD, exports.KeyEvent.UP], this.onKey, this],
|
|
13709
|
+
[exports.KeyEvent.DOWN, editBox.onArrow, editBox]
|
|
13710
|
+
])
|
|
13576
13711
|
];
|
|
13577
13712
|
if (editMask.visible)
|
|
13578
13713
|
editMask.forceRender();
|
|
@@ -13582,7 +13717,6 @@ ${filterStyle$1}
|
|
|
13582
13717
|
const { targetEventIds, editMask } = this;
|
|
13583
13718
|
if (targetEventIds.length) {
|
|
13584
13719
|
this.off_(targetEventIds);
|
|
13585
|
-
targetEventIds.length = 0;
|
|
13586
13720
|
if (editMask.visible)
|
|
13587
13721
|
editMask.forceRender();
|
|
13588
13722
|
}
|
|
@@ -14051,7 +14185,12 @@ ${filterStyle$1}
|
|
|
14051
14185
|
Plugin.add('resize');
|
|
14052
14186
|
|
|
14053
14187
|
Plugin.add('editor', 'resize');
|
|
14054
|
-
Creator.editor = function (options) {
|
|
14188
|
+
Creator.editor = function (options, app) {
|
|
14189
|
+
const editor = new Editor(options);
|
|
14190
|
+
if (app)
|
|
14191
|
+
app.sky.add(app.editor = editor);
|
|
14192
|
+
return editor;
|
|
14193
|
+
};
|
|
14055
14194
|
exports.Box.addAttr('textBox', false, dataType);
|
|
14056
14195
|
exports.UI.addAttr('editConfig', undefined, dataType);
|
|
14057
14196
|
exports.UI.addAttr('editOuter', (ui) => ui.__.__isLinePath ? 'LineEditTool' : 'EditTool', dataType);
|
|
@@ -14236,31 +14375,31 @@ ${filterStyle$1}
|
|
|
14236
14375
|
textScale *= 12 / text.fontSize;
|
|
14237
14376
|
}
|
|
14238
14377
|
this.textScale = textScale;
|
|
14239
|
-
const { a, b, c, d, e, f } = new Matrix(text.worldTransform).scale(1 / textScale);
|
|
14240
14378
|
let { x, y } = this.inBody ? text.app.clientBounds : text.app.tree.clientBounds;
|
|
14241
14379
|
if (!this.inBody)
|
|
14242
14380
|
x -= window.scrollX, y -= window.scrollY;
|
|
14243
|
-
let { width, height } = text;
|
|
14381
|
+
let { width, height } = text, offsetX = 0, offsetY = 0;
|
|
14244
14382
|
width *= textScale, height *= textScale;
|
|
14245
14383
|
const data = text.__;
|
|
14246
14384
|
if (data.__autoWidth && data.autoSizeAlign) {
|
|
14247
14385
|
width += 20;
|
|
14248
14386
|
switch (data.textAlign) {
|
|
14249
14387
|
case 'center':
|
|
14250
|
-
|
|
14388
|
+
offsetX = -width / 2;
|
|
14251
14389
|
break;
|
|
14252
|
-
case 'right':
|
|
14390
|
+
case 'right': offsetX = -width;
|
|
14253
14391
|
}
|
|
14254
14392
|
}
|
|
14255
14393
|
if (data.__autoHeight && data.autoSizeAlign) {
|
|
14256
14394
|
height += 20;
|
|
14257
14395
|
switch (data.verticalAlign) {
|
|
14258
14396
|
case 'middle':
|
|
14259
|
-
|
|
14397
|
+
offsetY = -height / 2;
|
|
14260
14398
|
break;
|
|
14261
|
-
case 'bottom':
|
|
14399
|
+
case 'bottom': offsetY = -height;
|
|
14262
14400
|
}
|
|
14263
14401
|
}
|
|
14402
|
+
const { a, b, c, d, e, f } = new Matrix(text.worldTransform).scale(1 / textScale).translateInner(offsetX, offsetY);
|
|
14264
14403
|
const { style } = this.editDom;
|
|
14265
14404
|
style.transform = `matrix(${a},${b},${c},${d},${e},${f})`;
|
|
14266
14405
|
style.left = x + 'px';
|
|
@@ -14293,7 +14432,6 @@ ${filterStyle$1}
|
|
|
14293
14432
|
], exports.TextEditor);
|
|
14294
14433
|
|
|
14295
14434
|
Plugin.add('text-editor', 'editor');
|
|
14296
|
-
exports.Text.addAttr('textEditing', false, surfaceType);
|
|
14297
14435
|
|
|
14298
14436
|
function addViewport(leafer, mergeConfig, custom) {
|
|
14299
14437
|
addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);
|
|
@@ -14587,6 +14725,7 @@ ${filterStyle$1}
|
|
|
14587
14725
|
return;
|
|
14588
14726
|
const { move, rotation, scale, center } = MultiTouchHelper.getData(list);
|
|
14589
14727
|
Object.assign(data, center);
|
|
14728
|
+
data.multiTouch = true;
|
|
14590
14729
|
this.pointerWaitCancel();
|
|
14591
14730
|
this.rotate(getRotateEventData(rotation, data));
|
|
14592
14731
|
this.zoom(getZoomEventData(scale, data));
|
|
@@ -15188,6 +15327,16 @@ ${filterStyle$1}
|
|
|
15188
15327
|
exports.UI.addAttr('startArrow', 'none', arrowType);
|
|
15189
15328
|
exports.UI.addAttr('endArrow', 'none', arrowType);
|
|
15190
15329
|
Object.assign(PathArrow, PathArrowModule);
|
|
15330
|
+
Object.assign(Paint, {
|
|
15331
|
+
strokeArrow(_stroke, ui, canvas) {
|
|
15332
|
+
if (ui.__.dashPattern) {
|
|
15333
|
+
canvas.beginPath();
|
|
15334
|
+
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
15335
|
+
canvas.dashPattern = null;
|
|
15336
|
+
canvas.stroke();
|
|
15337
|
+
}
|
|
15338
|
+
}
|
|
15339
|
+
});
|
|
15191
15340
|
|
|
15192
15341
|
class FlowData extends BoxData {
|
|
15193
15342
|
}
|
|
@@ -17801,10 +17950,9 @@ ${filterStyle$1}
|
|
|
17801
17950
|
else {
|
|
17802
17951
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
17803
17952
|
const { worldTransform, isLeafer, leafer, isFrame } = leaf;
|
|
17804
|
-
const { slice, clip, trim, padding, onCanvas } = options;
|
|
17953
|
+
const { slice, clip, trim, screenshot, padding, onCanvas } = options;
|
|
17805
17954
|
const smooth = options.smooth === undefined ? (leafer ? leafer.config.smooth : true) : options.smooth;
|
|
17806
17955
|
const contextSettings = options.contextSettings || (leafer ? leafer.config.contextSettings : undefined);
|
|
17807
|
-
const screenshot = options.screenshot || leaf.isApp;
|
|
17808
17956
|
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
|
|
17809
17957
|
const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
|
|
17810
17958
|
if (screenshot) {
|
|
@@ -17840,11 +17988,6 @@ ${filterStyle$1}
|
|
|
17840
17988
|
const scaleData = { scaleX: 1, scaleY: 1 };
|
|
17841
17989
|
MathHelper.getScaleData(options.scale, options.size, renderBounds, scaleData);
|
|
17842
17990
|
let pixelRatio = options.pixelRatio || 1;
|
|
17843
|
-
if (leaf.isApp) {
|
|
17844
|
-
scaleData.scaleX *= pixelRatio;
|
|
17845
|
-
scaleData.scaleY *= pixelRatio;
|
|
17846
|
-
pixelRatio = leaf.app.pixelRatio;
|
|
17847
|
-
}
|
|
17848
17991
|
let { x, y, width, height } = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
|
|
17849
17992
|
if (clip)
|
|
17850
17993
|
x += clip.x, y += clip.y, width = clip.width, height = clip.height;
|
|
@@ -18007,6 +18150,7 @@ ${filterStyle$1}
|
|
|
18007
18150
|
exports.AutoBounds = AutoBounds;
|
|
18008
18151
|
exports.BezierHelper = BezierHelper;
|
|
18009
18152
|
exports.Bounds = Bounds;
|
|
18153
|
+
exports.BoundsEvent = BoundsEvent;
|
|
18010
18154
|
exports.BoundsHelper = BoundsHelper;
|
|
18011
18155
|
exports.BoxData = BoxData;
|
|
18012
18156
|
exports.BranchHelper = BranchHelper;
|
|
@@ -18209,7 +18353,7 @@ ${filterStyle$1}
|
|
|
18209
18353
|
exports.surfaceType = surfaceType;
|
|
18210
18354
|
exports.tempBounds = tempBounds$1;
|
|
18211
18355
|
exports.tempMatrix = tempMatrix;
|
|
18212
|
-
exports.tempPoint = tempPoint$
|
|
18356
|
+
exports.tempPoint = tempPoint$3;
|
|
18213
18357
|
exports.useCanvas = useCanvas;
|
|
18214
18358
|
exports.useModule = useModule;
|
|
18215
18359
|
exports.version = version;
|