leafer-draw 1.6.1 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web.cjs +208 -201
- package/dist/web.esm.js +211 -204
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +1178 -490
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +1173 -490
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +2 -2
- package/dist/web.cjs.map +0 -1
- package/dist/web.esm.js.map +0 -1
- package/dist/web.js.map +0 -1
- package/dist/web.module.js.map +0 -1
package/dist/web.js
CHANGED
|
@@ -26,8 +26,6 @@ var LeaferUI = (function (exports) {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
const Creator = {};
|
|
30
|
-
|
|
31
29
|
const IncrementId = {
|
|
32
30
|
RUNTIME: 'runtime',
|
|
33
31
|
LEAF: 'leaf',
|
|
@@ -153,7 +151,7 @@ var LeaferUI = (function (exports) {
|
|
|
153
151
|
|
|
154
152
|
const { sin: sin$5, cos: cos$5, acos, sqrt: sqrt$3 } = Math;
|
|
155
153
|
const { float: float$1 } = MathHelper;
|
|
156
|
-
const tempPoint$
|
|
154
|
+
const tempPoint$3 = {};
|
|
157
155
|
function getWorld() {
|
|
158
156
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), { scaleX: 1, scaleY: 1, rotation: 0, skewX: 0, skewY: 0 });
|
|
159
157
|
}
|
|
@@ -196,8 +194,8 @@ var LeaferUI = (function (exports) {
|
|
|
196
194
|
t.d *= scaleY;
|
|
197
195
|
},
|
|
198
196
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
199
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
200
|
-
M$6.scaleOfInner(t, tempPoint$
|
|
197
|
+
M$6.toInnerPoint(t, origin, tempPoint$3);
|
|
198
|
+
M$6.scaleOfInner(t, tempPoint$3, scaleX, scaleY);
|
|
201
199
|
},
|
|
202
200
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
203
201
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -215,8 +213,8 @@ var LeaferUI = (function (exports) {
|
|
|
215
213
|
t.d = c * sinR + d * cosR;
|
|
216
214
|
},
|
|
217
215
|
rotateOfOuter(t, origin, rotation) {
|
|
218
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
219
|
-
M$6.rotateOfInner(t, tempPoint$
|
|
216
|
+
M$6.toInnerPoint(t, origin, tempPoint$3);
|
|
217
|
+
M$6.rotateOfInner(t, tempPoint$3, rotation);
|
|
220
218
|
},
|
|
221
219
|
rotateOfInner(t, origin, rotation) {
|
|
222
220
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -237,8 +235,8 @@ var LeaferUI = (function (exports) {
|
|
|
237
235
|
}
|
|
238
236
|
},
|
|
239
237
|
skewOfOuter(t, origin, skewX, skewY) {
|
|
240
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
241
|
-
M$6.skewOfInner(t, tempPoint$
|
|
238
|
+
M$6.toInnerPoint(t, origin, tempPoint$3);
|
|
239
|
+
M$6.skewOfInner(t, tempPoint$3, skewX, skewY);
|
|
242
240
|
},
|
|
243
241
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
244
242
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -467,8 +465,10 @@ var LeaferUI = (function (exports) {
|
|
|
467
465
|
t.y = halfPixel ? round$2(t.y - 0.5) + 0.5 : round$2(t.y);
|
|
468
466
|
},
|
|
469
467
|
move(t, x, y) {
|
|
470
|
-
|
|
471
|
-
|
|
468
|
+
if (typeof x === 'object')
|
|
469
|
+
t.x += x.x, t.y += x.y;
|
|
470
|
+
else
|
|
471
|
+
t.x += x, t.y += y;
|
|
472
472
|
},
|
|
473
473
|
scale(t, scaleX, scaleY = scaleX) {
|
|
474
474
|
if (t.x)
|
|
@@ -493,19 +493,19 @@ var LeaferUI = (function (exports) {
|
|
|
493
493
|
},
|
|
494
494
|
tempToInnerOf(t, matrix) {
|
|
495
495
|
const { tempPoint: temp } = P$5;
|
|
496
|
-
copy$
|
|
496
|
+
copy$b(temp, t);
|
|
497
497
|
toInnerPoint$2(matrix, temp, temp);
|
|
498
498
|
return temp;
|
|
499
499
|
},
|
|
500
500
|
tempToOuterOf(t, matrix) {
|
|
501
501
|
const { tempPoint: temp } = P$5;
|
|
502
|
-
copy$
|
|
502
|
+
copy$b(temp, t);
|
|
503
503
|
toOuterPoint$3(matrix, temp, temp);
|
|
504
504
|
return temp;
|
|
505
505
|
},
|
|
506
506
|
tempToInnerRadiusPointOf(t, matrix) {
|
|
507
507
|
const { tempRadiusPoint: temp } = P$5;
|
|
508
|
-
copy$
|
|
508
|
+
copy$b(temp, t);
|
|
509
509
|
P$5.toInnerRadiusPointOf(t, matrix, temp);
|
|
510
510
|
return temp;
|
|
511
511
|
},
|
|
@@ -578,7 +578,7 @@ var LeaferUI = (function (exports) {
|
|
|
578
578
|
}
|
|
579
579
|
};
|
|
580
580
|
const P$5 = PointHelper;
|
|
581
|
-
const { getDistanceFrom, copy: copy$
|
|
581
|
+
const { getDistanceFrom, copy: copy$b, getAtan2 } = P$5;
|
|
582
582
|
|
|
583
583
|
class Point {
|
|
584
584
|
constructor(x, y) {
|
|
@@ -646,7 +646,7 @@ var LeaferUI = (function (exports) {
|
|
|
646
646
|
return this;
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
|
-
const tempPoint$
|
|
649
|
+
const tempPoint$2 = new Point();
|
|
650
650
|
|
|
651
651
|
class Matrix {
|
|
652
652
|
constructor(a, b, c, d, e, f) {
|
|
@@ -804,15 +804,87 @@ var LeaferUI = (function (exports) {
|
|
|
804
804
|
};
|
|
805
805
|
const { addPoint: addPoint$3 } = TwoPointBoundsHelper;
|
|
806
806
|
|
|
807
|
+
exports.Direction4 = void 0;
|
|
808
|
+
(function (Direction4) {
|
|
809
|
+
Direction4[Direction4["top"] = 0] = "top";
|
|
810
|
+
Direction4[Direction4["right"] = 1] = "right";
|
|
811
|
+
Direction4[Direction4["bottom"] = 2] = "bottom";
|
|
812
|
+
Direction4[Direction4["left"] = 3] = "left";
|
|
813
|
+
})(exports.Direction4 || (exports.Direction4 = {}));
|
|
814
|
+
exports.Direction9 = void 0;
|
|
815
|
+
(function (Direction9) {
|
|
816
|
+
Direction9[Direction9["topLeft"] = 0] = "topLeft";
|
|
817
|
+
Direction9[Direction9["top"] = 1] = "top";
|
|
818
|
+
Direction9[Direction9["topRight"] = 2] = "topRight";
|
|
819
|
+
Direction9[Direction9["right"] = 3] = "right";
|
|
820
|
+
Direction9[Direction9["bottomRight"] = 4] = "bottomRight";
|
|
821
|
+
Direction9[Direction9["bottom"] = 5] = "bottom";
|
|
822
|
+
Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
|
|
823
|
+
Direction9[Direction9["left"] = 7] = "left";
|
|
824
|
+
Direction9[Direction9["center"] = 8] = "center";
|
|
825
|
+
Direction9[Direction9["top-left"] = 0] = "top-left";
|
|
826
|
+
Direction9[Direction9["top-right"] = 2] = "top-right";
|
|
827
|
+
Direction9[Direction9["bottom-right"] = 4] = "bottom-right";
|
|
828
|
+
Direction9[Direction9["bottom-left"] = 6] = "bottom-left";
|
|
829
|
+
})(exports.Direction9 || (exports.Direction9 = {}));
|
|
830
|
+
|
|
831
|
+
const directionData = [
|
|
832
|
+
{ x: 0, y: 0 },
|
|
833
|
+
{ x: 0.5, y: 0 },
|
|
834
|
+
{ x: 1, y: 0 },
|
|
835
|
+
{ x: 1, y: 0.5 },
|
|
836
|
+
{ x: 1, y: 1 },
|
|
837
|
+
{ x: 0.5, y: 1 },
|
|
838
|
+
{ x: 0, y: 1 },
|
|
839
|
+
{ x: 0, y: 0.5 },
|
|
840
|
+
{ x: 0.5, y: 0.5 }
|
|
841
|
+
];
|
|
842
|
+
directionData.forEach(item => item.type = 'percent');
|
|
843
|
+
const AroundHelper = {
|
|
844
|
+
directionData,
|
|
845
|
+
tempPoint: {},
|
|
846
|
+
get: get$4,
|
|
847
|
+
toPoint(around, box, to, onlyBoxSize, content, onlyContentSize) {
|
|
848
|
+
const point = get$4(around);
|
|
849
|
+
to.x = point.x;
|
|
850
|
+
to.y = point.y;
|
|
851
|
+
if (point.type === 'percent') {
|
|
852
|
+
to.x *= box.width;
|
|
853
|
+
to.y *= box.height;
|
|
854
|
+
if (content) {
|
|
855
|
+
if (!onlyContentSize)
|
|
856
|
+
to.x -= content.x, to.y -= content.y;
|
|
857
|
+
if (point.x)
|
|
858
|
+
to.x -= (point.x === 1) ? content.width : (point.x === 0.5 ? point.x * content.width : 0);
|
|
859
|
+
if (point.y)
|
|
860
|
+
to.y -= (point.y === 1) ? content.height : (point.y === 0.5 ? point.y * content.height : 0);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
if (!onlyBoxSize)
|
|
864
|
+
to.x += box.x, to.y += box.y;
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
function get$4(around) {
|
|
868
|
+
return typeof around === 'string' ? directionData[exports.Direction9[around]] : around;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
const { toPoint: toPoint$5 } = AroundHelper;
|
|
872
|
+
const AlignHelper = {
|
|
873
|
+
toPoint(align, content, box, to, onlyBoxSize, onlyContentSize) {
|
|
874
|
+
toPoint$5(align, box, to, onlyBoxSize, content, onlyContentSize);
|
|
875
|
+
}
|
|
876
|
+
};
|
|
877
|
+
|
|
807
878
|
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$3 } = TwoPointBoundsHelper;
|
|
808
879
|
const { toOuterPoint: toOuterPoint$2 } = MatrixHelper;
|
|
809
880
|
const { float, fourNumber } = MathHelper;
|
|
810
881
|
const { floor, ceil: ceil$2 } = Math;
|
|
811
882
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
812
883
|
const point = {};
|
|
813
|
-
const toPoint$
|
|
884
|
+
const toPoint$4 = {};
|
|
885
|
+
const tempBounds$2 = {};
|
|
814
886
|
const BoundsHelper = {
|
|
815
|
-
tempBounds:
|
|
887
|
+
tempBounds: tempBounds$2,
|
|
816
888
|
set(t, x = 0, y = 0, width = 0, height = 0) {
|
|
817
889
|
t.x = x;
|
|
818
890
|
t.y = y;
|
|
@@ -863,7 +935,7 @@ var LeaferUI = (function (exports) {
|
|
|
863
935
|
to = t;
|
|
864
936
|
}
|
|
865
937
|
else {
|
|
866
|
-
copy$
|
|
938
|
+
copy$a(to, t);
|
|
867
939
|
}
|
|
868
940
|
if (parent) {
|
|
869
941
|
to.offsetX = -(B.maxX(parent) - t.x);
|
|
@@ -875,8 +947,8 @@ var LeaferUI = (function (exports) {
|
|
|
875
947
|
}
|
|
876
948
|
B.move(to, -to.offsetX, -to.offsetY);
|
|
877
949
|
},
|
|
878
|
-
scale(t, scaleX, scaleY = scaleX) {
|
|
879
|
-
PointHelper.scale(t, scaleX, scaleY);
|
|
950
|
+
scale(t, scaleX, scaleY = scaleX, onlySize) {
|
|
951
|
+
onlySize || PointHelper.scale(t, scaleX, scaleY);
|
|
880
952
|
t.width *= scaleX;
|
|
881
953
|
t.height *= scaleY;
|
|
882
954
|
},
|
|
@@ -886,9 +958,9 @@ var LeaferUI = (function (exports) {
|
|
|
886
958
|
t.height *= scaleY;
|
|
887
959
|
},
|
|
888
960
|
tempToOuterOf(t, matrix) {
|
|
889
|
-
B.copy(
|
|
890
|
-
B.toOuterOf(
|
|
891
|
-
return
|
|
961
|
+
B.copy(tempBounds$2, t);
|
|
962
|
+
B.toOuterOf(tempBounds$2, matrix);
|
|
963
|
+
return tempBounds$2;
|
|
892
964
|
},
|
|
893
965
|
getOuterOf(t, matrix) {
|
|
894
966
|
t = Object.assign({}, t);
|
|
@@ -919,17 +991,17 @@ var LeaferUI = (function (exports) {
|
|
|
919
991
|
else {
|
|
920
992
|
point.x = t.x;
|
|
921
993
|
point.y = t.y;
|
|
922
|
-
toOuterPoint$2(matrix, point, toPoint$
|
|
923
|
-
setPoint$2(tempPointBounds$1, toPoint$
|
|
994
|
+
toOuterPoint$2(matrix, point, toPoint$4);
|
|
995
|
+
setPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
|
|
924
996
|
point.x = t.x + t.width;
|
|
925
|
-
toOuterPoint$2(matrix, point, toPoint$
|
|
926
|
-
addPoint$2(tempPointBounds$1, toPoint$
|
|
997
|
+
toOuterPoint$2(matrix, point, toPoint$4);
|
|
998
|
+
addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
|
|
927
999
|
point.y = t.y + t.height;
|
|
928
|
-
toOuterPoint$2(matrix, point, toPoint$
|
|
929
|
-
addPoint$2(tempPointBounds$1, toPoint$
|
|
1000
|
+
toOuterPoint$2(matrix, point, toPoint$4);
|
|
1001
|
+
addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
|
|
930
1002
|
point.x = t.x;
|
|
931
|
-
toOuterPoint$2(matrix, point, toPoint$
|
|
932
|
-
addPoint$2(tempPointBounds$1, toPoint$
|
|
1003
|
+
toOuterPoint$2(matrix, point, toPoint$4);
|
|
1004
|
+
addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
|
|
933
1005
|
toBounds$3(tempPointBounds$1, to);
|
|
934
1006
|
}
|
|
935
1007
|
},
|
|
@@ -939,9 +1011,21 @@ var LeaferUI = (function (exports) {
|
|
|
939
1011
|
B.scale(to, 1 / matrix.a, 1 / matrix.d);
|
|
940
1012
|
},
|
|
941
1013
|
getFitMatrix(t, put, baseScale = 1) {
|
|
942
|
-
const scale = Math.min(baseScale,
|
|
1014
|
+
const scale = Math.min(baseScale, B.getFitScale(t, put));
|
|
943
1015
|
return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
|
|
944
1016
|
},
|
|
1017
|
+
getFitScale(t, put, isCoverMode) {
|
|
1018
|
+
const sw = t.width / put.width, sh = t.height / put.height;
|
|
1019
|
+
return isCoverMode ? Math.max(sw, sh) : Math.min(sw, sh);
|
|
1020
|
+
},
|
|
1021
|
+
put(t, put, align = 'center', putScale = 1, changeSize = true, to) {
|
|
1022
|
+
to || (to = put);
|
|
1023
|
+
if (typeof putScale === 'string')
|
|
1024
|
+
putScale = B.getFitScale(t, put, putScale === 'cover');
|
|
1025
|
+
tempBounds$2.width = changeSize ? put.width *= putScale : put.width * putScale;
|
|
1026
|
+
tempBounds$2.height = changeSize ? put.height *= putScale : put.height * putScale;
|
|
1027
|
+
AlignHelper.toPoint(align, tempBounds$2, t, to, true, true);
|
|
1028
|
+
},
|
|
945
1029
|
getSpread(t, spread, side) {
|
|
946
1030
|
const n = {};
|
|
947
1031
|
B.copyAndSpread(n, t, spread, false, side);
|
|
@@ -1009,7 +1093,7 @@ var LeaferUI = (function (exports) {
|
|
|
1009
1093
|
if (first) {
|
|
1010
1094
|
first = false;
|
|
1011
1095
|
if (!addMode)
|
|
1012
|
-
copy$
|
|
1096
|
+
copy$a(t, bounds);
|
|
1013
1097
|
}
|
|
1014
1098
|
else {
|
|
1015
1099
|
add$1(t, bounds);
|
|
@@ -1090,7 +1174,7 @@ var LeaferUI = (function (exports) {
|
|
|
1090
1174
|
}
|
|
1091
1175
|
};
|
|
1092
1176
|
const B = BoundsHelper;
|
|
1093
|
-
const { add: add$1, copy: copy$
|
|
1177
|
+
const { add: add$1, copy: copy$a } = B;
|
|
1094
1178
|
|
|
1095
1179
|
class Bounds {
|
|
1096
1180
|
get minX() { return BoundsHelper.minX(this); }
|
|
@@ -1115,8 +1199,8 @@ var LeaferUI = (function (exports) {
|
|
|
1115
1199
|
BoundsHelper.move(this, x, y);
|
|
1116
1200
|
return this;
|
|
1117
1201
|
}
|
|
1118
|
-
scale(scaleX, scaleY) {
|
|
1119
|
-
BoundsHelper.scale(this, scaleX, scaleY);
|
|
1202
|
+
scale(scaleX, scaleY, onlySize) {
|
|
1203
|
+
BoundsHelper.scale(this, scaleX, scaleY, onlySize);
|
|
1120
1204
|
return this;
|
|
1121
1205
|
}
|
|
1122
1206
|
scaleOf(origin, scaleX, scaleY) {
|
|
@@ -1134,6 +1218,9 @@ var LeaferUI = (function (exports) {
|
|
|
1134
1218
|
getFitMatrix(put, baseScale) {
|
|
1135
1219
|
return BoundsHelper.getFitMatrix(this, put, baseScale);
|
|
1136
1220
|
}
|
|
1221
|
+
put(put, align, putScale) {
|
|
1222
|
+
BoundsHelper.put(this, put, align, putScale);
|
|
1223
|
+
}
|
|
1137
1224
|
spread(fourNumber, side) {
|
|
1138
1225
|
BoundsHelper.spread(this, fourNumber, side);
|
|
1139
1226
|
return this;
|
|
@@ -1242,79 +1329,6 @@ var LeaferUI = (function (exports) {
|
|
|
1242
1329
|
}
|
|
1243
1330
|
}
|
|
1244
1331
|
|
|
1245
|
-
exports.Direction4 = void 0;
|
|
1246
|
-
(function (Direction4) {
|
|
1247
|
-
Direction4[Direction4["top"] = 0] = "top";
|
|
1248
|
-
Direction4[Direction4["right"] = 1] = "right";
|
|
1249
|
-
Direction4[Direction4["bottom"] = 2] = "bottom";
|
|
1250
|
-
Direction4[Direction4["left"] = 3] = "left";
|
|
1251
|
-
})(exports.Direction4 || (exports.Direction4 = {}));
|
|
1252
|
-
exports.Direction9 = void 0;
|
|
1253
|
-
(function (Direction9) {
|
|
1254
|
-
Direction9[Direction9["topLeft"] = 0] = "topLeft";
|
|
1255
|
-
Direction9[Direction9["top"] = 1] = "top";
|
|
1256
|
-
Direction9[Direction9["topRight"] = 2] = "topRight";
|
|
1257
|
-
Direction9[Direction9["right"] = 3] = "right";
|
|
1258
|
-
Direction9[Direction9["bottomRight"] = 4] = "bottomRight";
|
|
1259
|
-
Direction9[Direction9["bottom"] = 5] = "bottom";
|
|
1260
|
-
Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
|
|
1261
|
-
Direction9[Direction9["left"] = 7] = "left";
|
|
1262
|
-
Direction9[Direction9["center"] = 8] = "center";
|
|
1263
|
-
Direction9[Direction9["top-left"] = 0] = "top-left";
|
|
1264
|
-
Direction9[Direction9["top-right"] = 2] = "top-right";
|
|
1265
|
-
Direction9[Direction9["bottom-right"] = 4] = "bottom-right";
|
|
1266
|
-
Direction9[Direction9["bottom-left"] = 6] = "bottom-left";
|
|
1267
|
-
})(exports.Direction9 || (exports.Direction9 = {}));
|
|
1268
|
-
|
|
1269
|
-
const directionData = [
|
|
1270
|
-
{ x: 0, y: 0 },
|
|
1271
|
-
{ x: 0.5, y: 0 },
|
|
1272
|
-
{ x: 1, y: 0 },
|
|
1273
|
-
{ x: 1, y: 0.5 },
|
|
1274
|
-
{ x: 1, y: 1 },
|
|
1275
|
-
{ x: 0.5, y: 1 },
|
|
1276
|
-
{ x: 0, y: 1 },
|
|
1277
|
-
{ x: 0, y: 0.5 },
|
|
1278
|
-
{ x: 0.5, y: 0.5 }
|
|
1279
|
-
];
|
|
1280
|
-
directionData.forEach(item => item.type = 'percent');
|
|
1281
|
-
const AroundHelper = {
|
|
1282
|
-
directionData,
|
|
1283
|
-
tempPoint: {},
|
|
1284
|
-
get: get$4,
|
|
1285
|
-
toPoint(around, bounds, to, onlySize, pointBounds) {
|
|
1286
|
-
const point = get$4(around);
|
|
1287
|
-
to.x = point.x;
|
|
1288
|
-
to.y = point.y;
|
|
1289
|
-
if (point.type === 'percent') {
|
|
1290
|
-
to.x *= bounds.width;
|
|
1291
|
-
to.y *= bounds.height;
|
|
1292
|
-
if (pointBounds) {
|
|
1293
|
-
to.x -= pointBounds.x;
|
|
1294
|
-
to.y -= pointBounds.y;
|
|
1295
|
-
if (point.x)
|
|
1296
|
-
to.x -= (point.x === 1) ? pointBounds.width : (point.x === 0.5 ? point.x * pointBounds.width : 0);
|
|
1297
|
-
if (point.y)
|
|
1298
|
-
to.y -= (point.y === 1) ? pointBounds.height : (point.y === 0.5 ? point.y * pointBounds.height : 0);
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1301
|
-
if (!onlySize) {
|
|
1302
|
-
to.x += bounds.x;
|
|
1303
|
-
to.y += bounds.y;
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
};
|
|
1307
|
-
function get$4(around) {
|
|
1308
|
-
return typeof around === 'string' ? directionData[exports.Direction9[around]] : around;
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
const { toPoint: toPoint$4 } = AroundHelper;
|
|
1312
|
-
const AlignHelper = {
|
|
1313
|
-
toPoint(align, contentBounds, bounds, to, onlySize) {
|
|
1314
|
-
toPoint$4(align, bounds, to, onlySize, contentBounds);
|
|
1315
|
-
}
|
|
1316
|
-
};
|
|
1317
|
-
|
|
1318
1332
|
const StringNumberMap = {
|
|
1319
1333
|
'0': 1,
|
|
1320
1334
|
'1': 1,
|
|
@@ -1445,11 +1459,17 @@ var LeaferUI = (function (exports) {
|
|
|
1445
1459
|
return rs;
|
|
1446
1460
|
},
|
|
1447
1461
|
need(name) {
|
|
1448
|
-
console.error('please install plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name);
|
|
1462
|
+
console.error('please install and import plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name);
|
|
1449
1463
|
}
|
|
1450
1464
|
};
|
|
1451
1465
|
setTimeout(() => check.forEach(name => Plugin.has(name, true)));
|
|
1452
1466
|
|
|
1467
|
+
const Creator = {
|
|
1468
|
+
editor(_options) {
|
|
1469
|
+
return Plugin.need('editor');
|
|
1470
|
+
}
|
|
1471
|
+
};
|
|
1472
|
+
|
|
1453
1473
|
const debug$e = Debug.get('UICreator');
|
|
1454
1474
|
const UICreator = {
|
|
1455
1475
|
list: {},
|
|
@@ -1587,6 +1607,10 @@ var LeaferUI = (function (exports) {
|
|
|
1587
1607
|
for (let i = 0, len = list.length; i < len; i++)
|
|
1588
1608
|
map[list[i]] = true;
|
|
1589
1609
|
return map;
|
|
1610
|
+
},
|
|
1611
|
+
stintSet(data, attrName, value) {
|
|
1612
|
+
value || (value = undefined);
|
|
1613
|
+
data[attrName] !== value && (data[attrName] = value);
|
|
1590
1614
|
}
|
|
1591
1615
|
};
|
|
1592
1616
|
const { assign } = DataHelper;
|
|
@@ -2045,7 +2069,7 @@ var LeaferUI = (function (exports) {
|
|
|
2045
2069
|
contextMethod()
|
|
2046
2070
|
], Canvas.prototype, "strokeText", null);
|
|
2047
2071
|
|
|
2048
|
-
const { copy: copy$
|
|
2072
|
+
const { copy: copy$9, multiplyParent: multiplyParent$3 } = MatrixHelper, { round: round$1 } = Math;
|
|
2049
2073
|
const minSize = { width: 1, height: 1, pixelRatio: 1 };
|
|
2050
2074
|
const canvasSizeAttrs = ['width', 'height', 'pixelRatio'];
|
|
2051
2075
|
class LeaferCanvasBase extends Canvas {
|
|
@@ -2277,7 +2301,7 @@ var LeaferUI = (function (exports) {
|
|
|
2277
2301
|
const { size, pixelSnap } = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
|
|
2278
2302
|
canvas.save();
|
|
2279
2303
|
if (useSameWorldTransform)
|
|
2280
|
-
copy$
|
|
2304
|
+
copy$9(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
|
|
2281
2305
|
if (useSameSmooth)
|
|
2282
2306
|
canvas.smooth = this.smooth;
|
|
2283
2307
|
canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
|
|
@@ -2388,7 +2412,7 @@ var LeaferUI = (function (exports) {
|
|
|
2388
2412
|
const { setPoint: setPoint$1, addPoint: addPoint$1 } = TwoPointBoundsHelper;
|
|
2389
2413
|
const { set, toNumberPoints } = PointHelper;
|
|
2390
2414
|
const { M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
2391
|
-
const tempPoint$
|
|
2415
|
+
const tempPoint$1 = {};
|
|
2392
2416
|
const BezierHelper = {
|
|
2393
2417
|
points(data, originPoints, curve, close) {
|
|
2394
2418
|
let points = toNumberPoints(originPoints);
|
|
@@ -2410,6 +2434,8 @@ var LeaferUI = (function (exports) {
|
|
|
2410
2434
|
cY = points[i + 3];
|
|
2411
2435
|
ba = sqrt$1(pow(bX - aX, 2) + pow(bY - aY, 2));
|
|
2412
2436
|
cb = sqrt$1(pow(cX - bX, 2) + pow(cY - bY, 2));
|
|
2437
|
+
if (!ba && !cb)
|
|
2438
|
+
continue;
|
|
2413
2439
|
d = ba + cb;
|
|
2414
2440
|
ba = (t * ba) / d;
|
|
2415
2441
|
cb = (t * cb) / d;
|
|
@@ -2579,8 +2605,8 @@ var LeaferUI = (function (exports) {
|
|
|
2579
2605
|
addMode ? addPoint$1(pointBounds, fromX, fromY) : setPoint$1(pointBounds, fromX, fromY);
|
|
2580
2606
|
addPoint$1(pointBounds, toX, toY);
|
|
2581
2607
|
for (let i = 0, len = tList.length; i < len; i++) {
|
|
2582
|
-
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$
|
|
2583
|
-
addPoint$1(pointBounds, tempPoint$
|
|
2608
|
+
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$1);
|
|
2609
|
+
addPoint$1(pointBounds, tempPoint$1.x, tempPoint$1.y);
|
|
2584
2610
|
}
|
|
2585
2611
|
},
|
|
2586
2612
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -2592,7 +2618,11 @@ var LeaferUI = (function (exports) {
|
|
|
2592
2618
|
const point = {};
|
|
2593
2619
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, point);
|
|
2594
2620
|
return point;
|
|
2595
|
-
}
|
|
2621
|
+
},
|
|
2622
|
+
getDerivative(t, fromV, v1, v2, toV) {
|
|
2623
|
+
const o = 1 - t;
|
|
2624
|
+
return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
|
|
2625
|
+
},
|
|
2596
2626
|
};
|
|
2597
2627
|
const { getPointAndSet, toTwoPointBounds: toTwoPointBounds$1, ellipse: ellipse$6 } = BezierHelper;
|
|
2598
2628
|
|
|
@@ -2650,7 +2680,7 @@ var LeaferUI = (function (exports) {
|
|
|
2650
2680
|
};
|
|
2651
2681
|
|
|
2652
2682
|
const { M: M$4, m, L: L$5, l, H, h, V, v, C: C$3, c, S, s, Q: Q$3, q, T, t, A, a, Z: Z$4, z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3 } = PathCommandMap;
|
|
2653
|
-
const { rect: rect$
|
|
2683
|
+
const { rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
|
|
2654
2684
|
const { ellipticalArc } = EllipseHelper;
|
|
2655
2685
|
const debug$c = Debug.get('PathConvert');
|
|
2656
2686
|
const setEndPoint$1 = {};
|
|
@@ -2847,7 +2877,7 @@ var LeaferUI = (function (exports) {
|
|
|
2847
2877
|
case N$3:
|
|
2848
2878
|
x = old[i + 1];
|
|
2849
2879
|
y = old[i + 2];
|
|
2850
|
-
curveMode ? rect$
|
|
2880
|
+
curveMode ? rect$3(data, x, y, old[i + 3], old[i + 4]) : copyData(data, old, i, 5);
|
|
2851
2881
|
i += 5;
|
|
2852
2882
|
break;
|
|
2853
2883
|
case D$3:
|
|
@@ -3023,7 +3053,7 @@ var LeaferUI = (function (exports) {
|
|
|
3023
3053
|
};
|
|
3024
3054
|
const { ellipse: ellipse$3, arc: arc$2 } = PathCommandDataHelper;
|
|
3025
3055
|
|
|
3026
|
-
const { moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo, bezierCurveTo, closePath: closePath$3, beginPath, rect: rect$
|
|
3056
|
+
const { moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo, bezierCurveTo, closePath: closePath$3, beginPath, rect: rect$2, roundRect: roundRect$1, ellipse: ellipse$2, arc: arc$1, arcTo: arcTo$2, drawEllipse, drawArc, drawPoints: drawPoints$2 } = PathCommandDataHelper;
|
|
3027
3057
|
class PathCreator {
|
|
3028
3058
|
set path(value) { this.__path = value; }
|
|
3029
3059
|
get path() { return this.__path; }
|
|
@@ -3070,7 +3100,7 @@ var LeaferUI = (function (exports) {
|
|
|
3070
3100
|
return this;
|
|
3071
3101
|
}
|
|
3072
3102
|
rect(x, y, width, height) {
|
|
3073
|
-
rect$
|
|
3103
|
+
rect$2(this.__path, x, y, width, height);
|
|
3074
3104
|
this.paint();
|
|
3075
3105
|
return this;
|
|
3076
3106
|
}
|
|
@@ -3188,7 +3218,7 @@ var LeaferUI = (function (exports) {
|
|
|
3188
3218
|
|
|
3189
3219
|
const { M: M$1, L: L$2, C, Q, Z: Z$1, N, D, X, G, F: F$1, O, P, U } = PathCommandMap;
|
|
3190
3220
|
const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse: ellipse$1 } = BezierHelper;
|
|
3191
|
-
const { addPointBounds, copy: copy$
|
|
3221
|
+
const { addPointBounds, copy: copy$8, addPoint, setPoint, addBounds, toBounds: toBounds$2 } = TwoPointBoundsHelper;
|
|
3192
3222
|
const debug$a = Debug.get('PathBounds');
|
|
3193
3223
|
let radius, radiusX, radiusY;
|
|
3194
3224
|
const tempPointBounds = {};
|
|
@@ -3260,7 +3290,7 @@ var LeaferUI = (function (exports) {
|
|
|
3260
3290
|
break;
|
|
3261
3291
|
case G:
|
|
3262
3292
|
ellipse$1(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], data[i + 7], data[i + 8], tempPointBounds, setEndPoint);
|
|
3263
|
-
i === 0 ? copy$
|
|
3293
|
+
i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3264
3294
|
x = setEndPoint.x;
|
|
3265
3295
|
y = setEndPoint.y;
|
|
3266
3296
|
i += 9;
|
|
@@ -3276,7 +3306,7 @@ var LeaferUI = (function (exports) {
|
|
|
3276
3306
|
break;
|
|
3277
3307
|
case O:
|
|
3278
3308
|
arc(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], tempPointBounds, setEndPoint);
|
|
3279
|
-
i === 0 ? copy$
|
|
3309
|
+
i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3280
3310
|
x = setEndPoint.x;
|
|
3281
3311
|
y = setEndPoint.y;
|
|
3282
3312
|
i += 7;
|
|
@@ -3291,7 +3321,7 @@ var LeaferUI = (function (exports) {
|
|
|
3291
3321
|
break;
|
|
3292
3322
|
case U:
|
|
3293
3323
|
arcTo$1(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
|
|
3294
|
-
i === 0 ? copy$
|
|
3324
|
+
i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3295
3325
|
x = setEndPoint.x;
|
|
3296
3326
|
y = setEndPoint.y;
|
|
3297
3327
|
i += 6;
|
|
@@ -3385,7 +3415,7 @@ var LeaferUI = (function (exports) {
|
|
|
3385
3415
|
}
|
|
3386
3416
|
|
|
3387
3417
|
const FileHelper = {
|
|
3388
|
-
|
|
3418
|
+
alphaPixelTypes: ['png', 'webp', 'svg'],
|
|
3389
3419
|
upperCaseTypeMap: {},
|
|
3390
3420
|
mineType(type) {
|
|
3391
3421
|
if (!type || type.startsWith('image'))
|
|
@@ -3412,7 +3442,7 @@ var LeaferUI = (function (exports) {
|
|
|
3412
3442
|
}
|
|
3413
3443
|
};
|
|
3414
3444
|
const F = FileHelper;
|
|
3415
|
-
F.
|
|
3445
|
+
F.alphaPixelTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3416
3446
|
|
|
3417
3447
|
const debug$9 = Debug.get('TaskProcessor');
|
|
3418
3448
|
class TaskItem {
|
|
@@ -3729,8 +3759,8 @@ var LeaferUI = (function (exports) {
|
|
|
3729
3759
|
list.length = 0;
|
|
3730
3760
|
}
|
|
3731
3761
|
},
|
|
3732
|
-
|
|
3733
|
-
return FileHelper.
|
|
3762
|
+
hasAlphaPixel(config) {
|
|
3763
|
+
return FileHelper.alphaPixelTypes.some(item => I.isFormat(item, config));
|
|
3734
3764
|
},
|
|
3735
3765
|
isFormat(format, config) {
|
|
3736
3766
|
if (config.format === format)
|
|
@@ -3768,13 +3798,16 @@ var LeaferUI = (function (exports) {
|
|
|
3768
3798
|
this.setView(view.config ? view.view : view);
|
|
3769
3799
|
}
|
|
3770
3800
|
ImageManager.isFormat('svg', config) && (this.isSVG = true);
|
|
3771
|
-
ImageManager.
|
|
3801
|
+
ImageManager.hasAlphaPixel(config) && (this.hasAlphaPixel = true);
|
|
3772
3802
|
}
|
|
3773
3803
|
load(onSuccess, onError) {
|
|
3774
3804
|
if (!this.loading) {
|
|
3775
3805
|
this.loading = true;
|
|
3806
|
+
let { loadImage, loadImageWithProgress } = Platform.origin, onProgress = this.config.showProgress && loadImageWithProgress && this.onProgress.bind(this);
|
|
3807
|
+
if (onProgress)
|
|
3808
|
+
loadImage = loadImageWithProgress;
|
|
3776
3809
|
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
3777
|
-
return yield
|
|
3810
|
+
return yield loadImage(this.url, onProgress).then(img => this.setView(img)).catch((e) => {
|
|
3778
3811
|
this.error = e;
|
|
3779
3812
|
this.onComplete(false);
|
|
3780
3813
|
});
|
|
@@ -3799,6 +3832,9 @@ var LeaferUI = (function (exports) {
|
|
|
3799
3832
|
this.view = img;
|
|
3800
3833
|
this.onComplete(true);
|
|
3801
3834
|
}
|
|
3835
|
+
onProgress(progress) {
|
|
3836
|
+
this.progress = progress;
|
|
3837
|
+
}
|
|
3802
3838
|
onComplete(isSuccess) {
|
|
3803
3839
|
let odd;
|
|
3804
3840
|
this.waitComplete.forEach((item, index) => {
|
|
@@ -4221,8 +4257,8 @@ var LeaferUI = (function (exports) {
|
|
|
4221
4257
|
};
|
|
4222
4258
|
}
|
|
4223
4259
|
|
|
4224
|
-
const { copy: copy$
|
|
4225
|
-
const matrix = {}, { round } = Math;
|
|
4260
|
+
const { copy: copy$7, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
|
|
4261
|
+
const matrix$1 = {}, { round } = Math;
|
|
4226
4262
|
const LeafHelper = {
|
|
4227
4263
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
4228
4264
|
if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
|
|
@@ -4264,13 +4300,20 @@ var LeaferUI = (function (exports) {
|
|
|
4264
4300
|
if (leaf.isBranch) {
|
|
4265
4301
|
const { children } = leaf;
|
|
4266
4302
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
4267
|
-
updateAllWorldOpacity
|
|
4303
|
+
updateAllWorldOpacity(children[i]);
|
|
4268
4304
|
}
|
|
4269
4305
|
}
|
|
4270
4306
|
},
|
|
4271
|
-
|
|
4272
|
-
|
|
4307
|
+
updateChange(leaf) {
|
|
4308
|
+
const layout = leaf.__layout;
|
|
4309
|
+
if (layout.stateStyleChanged)
|
|
4310
|
+
leaf.updateState();
|
|
4311
|
+
if (layout.opacityChanged)
|
|
4312
|
+
updateAllWorldOpacity(leaf);
|
|
4273
4313
|
leaf.__updateChange();
|
|
4314
|
+
},
|
|
4315
|
+
updateAllChange(leaf) {
|
|
4316
|
+
updateChange$1(leaf);
|
|
4274
4317
|
if (leaf.isBranch) {
|
|
4275
4318
|
const { children } = leaf;
|
|
4276
4319
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
@@ -4310,13 +4353,13 @@ var LeaferUI = (function (exports) {
|
|
|
4310
4353
|
transition = scaleY;
|
|
4311
4354
|
scaleY = scaleX;
|
|
4312
4355
|
}
|
|
4313
|
-
copy$
|
|
4314
|
-
scaleOfOuter$2(matrix, origin, scaleX, scaleY);
|
|
4356
|
+
copy$7(matrix$1, o);
|
|
4357
|
+
scaleOfOuter$2(matrix$1, origin, scaleX, scaleY);
|
|
4315
4358
|
if (t.origin || t.around) {
|
|
4316
|
-
L.setTransform(t, matrix, resize, transition);
|
|
4359
|
+
L.setTransform(t, matrix$1, resize, transition);
|
|
4317
4360
|
}
|
|
4318
4361
|
else {
|
|
4319
|
-
const x = t.x + matrix.e - o.e, y = t.y + matrix.f - o.f;
|
|
4362
|
+
const x = t.x + matrix$1.e - o.e, y = t.y + matrix$1.f - o.f;
|
|
4320
4363
|
if (transition && !resize)
|
|
4321
4364
|
t.animate({ x, y, scaleX: t.scaleX * scaleX, scaleY: t.scaleY * scaleY }, transition);
|
|
4322
4365
|
else
|
|
@@ -4328,32 +4371,32 @@ var LeaferUI = (function (exports) {
|
|
|
4328
4371
|
},
|
|
4329
4372
|
rotateOfLocal(t, origin, angle, transition) {
|
|
4330
4373
|
const o = t.__localMatrix;
|
|
4331
|
-
copy$
|
|
4332
|
-
rotateOfOuter$2(matrix, origin, angle);
|
|
4374
|
+
copy$7(matrix$1, o);
|
|
4375
|
+
rotateOfOuter$2(matrix$1, origin, angle);
|
|
4333
4376
|
if (t.origin || t.around)
|
|
4334
|
-
L.setTransform(t, matrix, false, transition);
|
|
4377
|
+
L.setTransform(t, matrix$1, false, transition);
|
|
4335
4378
|
else
|
|
4336
|
-
t.set({ x: t.x + matrix.e - o.e, y: t.y + matrix.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
|
|
4379
|
+
t.set({ x: t.x + matrix$1.e - o.e, y: t.y + matrix$1.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
|
|
4337
4380
|
},
|
|
4338
4381
|
skewOfWorld(t, origin, skewX, skewY, resize, transition) {
|
|
4339
4382
|
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
|
|
4340
4383
|
},
|
|
4341
4384
|
skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
|
|
4342
|
-
copy$
|
|
4343
|
-
skewOfOuter(matrix, origin, skewX, skewY);
|
|
4344
|
-
L.setTransform(t, matrix, resize, transition);
|
|
4385
|
+
copy$7(matrix$1, t.__localMatrix);
|
|
4386
|
+
skewOfOuter(matrix$1, origin, skewX, skewY);
|
|
4387
|
+
L.setTransform(t, matrix$1, resize, transition);
|
|
4345
4388
|
},
|
|
4346
4389
|
transformWorld(t, transform, resize, transition) {
|
|
4347
|
-
copy$
|
|
4348
|
-
multiplyParent$2(matrix, transform);
|
|
4390
|
+
copy$7(matrix$1, t.worldTransform);
|
|
4391
|
+
multiplyParent$2(matrix$1, transform);
|
|
4349
4392
|
if (t.parent)
|
|
4350
|
-
divideParent(matrix, t.parent.worldTransform);
|
|
4351
|
-
L.setTransform(t, matrix, resize, transition);
|
|
4393
|
+
divideParent(matrix$1, t.parent.worldTransform);
|
|
4394
|
+
L.setTransform(t, matrix$1, resize, transition);
|
|
4352
4395
|
},
|
|
4353
4396
|
transform(t, transform, resize, transition) {
|
|
4354
|
-
copy$
|
|
4355
|
-
multiplyParent$2(matrix, transform);
|
|
4356
|
-
L.setTransform(t, matrix, resize, transition);
|
|
4397
|
+
copy$7(matrix$1, t.localTransform);
|
|
4398
|
+
multiplyParent$2(matrix$1, transform);
|
|
4399
|
+
L.setTransform(t, matrix$1, resize, transition);
|
|
4357
4400
|
},
|
|
4358
4401
|
setTransform(t, transform, resize, transition) {
|
|
4359
4402
|
const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
|
|
@@ -4387,9 +4430,9 @@ var LeaferUI = (function (exports) {
|
|
|
4387
4430
|
return innerOrigin;
|
|
4388
4431
|
},
|
|
4389
4432
|
getRelativeWorld(t, relative, temp) {
|
|
4390
|
-
copy$
|
|
4391
|
-
divideParent(matrix, relative.worldTransform);
|
|
4392
|
-
return temp ? matrix : Object.assign({}, matrix);
|
|
4433
|
+
copy$7(matrix$1, t.worldTransform);
|
|
4434
|
+
divideParent(matrix$1, relative.worldTransform);
|
|
4435
|
+
return temp ? matrix$1 : Object.assign({}, matrix$1);
|
|
4393
4436
|
},
|
|
4394
4437
|
drop(t, parent, index, resize) {
|
|
4395
4438
|
t.setTransform(L.getRelativeWorld(t, parent, true), resize);
|
|
@@ -4406,7 +4449,7 @@ var LeaferUI = (function (exports) {
|
|
|
4406
4449
|
}
|
|
4407
4450
|
};
|
|
4408
4451
|
const L = LeafHelper;
|
|
4409
|
-
const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity:
|
|
4452
|
+
const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1 } = L;
|
|
4410
4453
|
function getTempLocal(t, world) {
|
|
4411
4454
|
t.__layout.update();
|
|
4412
4455
|
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
@@ -4443,7 +4486,7 @@ var LeaferUI = (function (exports) {
|
|
|
4443
4486
|
}
|
|
4444
4487
|
};
|
|
4445
4488
|
|
|
4446
|
-
const { updateBounds: updateBounds$
|
|
4489
|
+
const { updateBounds: updateBounds$3 } = LeafHelper;
|
|
4447
4490
|
const BranchHelper = {
|
|
4448
4491
|
sort(a, b) {
|
|
4449
4492
|
return (a.__.zIndex === b.__.zIndex) ? (a.__tempNumber - b.__tempNumber) : (a.__.zIndex - b.__.zIndex);
|
|
@@ -4505,11 +4548,11 @@ var LeaferUI = (function (exports) {
|
|
|
4505
4548
|
branch = branchStack[i];
|
|
4506
4549
|
children = branch.children;
|
|
4507
4550
|
for (let j = 0, len = children.length; j < len; j++) {
|
|
4508
|
-
updateBounds$
|
|
4551
|
+
updateBounds$3(children[j]);
|
|
4509
4552
|
}
|
|
4510
4553
|
if (exclude && exclude === branch)
|
|
4511
4554
|
continue;
|
|
4512
|
-
updateBounds$
|
|
4555
|
+
updateBounds$3(branch);
|
|
4513
4556
|
}
|
|
4514
4557
|
}
|
|
4515
4558
|
};
|
|
@@ -4527,8 +4570,8 @@ var LeaferUI = (function (exports) {
|
|
|
4527
4570
|
}
|
|
4528
4571
|
};
|
|
4529
4572
|
|
|
4530
|
-
const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
|
|
4531
|
-
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$
|
|
4573
|
+
const { getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2 } = LeafHelper;
|
|
4574
|
+
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$6 } = BoundsHelper;
|
|
4532
4575
|
const localContent = '_localContentBounds';
|
|
4533
4576
|
const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
|
|
4534
4577
|
class LeafLayout {
|
|
@@ -4571,7 +4614,9 @@ var LeaferUI = (function (exports) {
|
|
|
4571
4614
|
this._localRenderBounds = local;
|
|
4572
4615
|
}
|
|
4573
4616
|
update() {
|
|
4574
|
-
const { leafer } =
|
|
4617
|
+
const { leaf } = this, { leafer } = leaf;
|
|
4618
|
+
if (leaf.isApp)
|
|
4619
|
+
return updateBounds$2(leaf);
|
|
4575
4620
|
if (leafer) {
|
|
4576
4621
|
if (leafer.ready)
|
|
4577
4622
|
leafer.watcher.changed && leafer.layouter.layout();
|
|
@@ -4579,7 +4624,7 @@ var LeaferUI = (function (exports) {
|
|
|
4579
4624
|
leafer.start();
|
|
4580
4625
|
}
|
|
4581
4626
|
else {
|
|
4582
|
-
let root =
|
|
4627
|
+
let root = leaf;
|
|
4583
4628
|
while (root.parent && !root.parent.leafer) {
|
|
4584
4629
|
root = root.parent;
|
|
4585
4630
|
}
|
|
@@ -4686,7 +4731,7 @@ var LeaferUI = (function (exports) {
|
|
|
4686
4731
|
}
|
|
4687
4732
|
if (!layoutBounds)
|
|
4688
4733
|
layoutBounds = MatrixHelper.getLayout(matrix);
|
|
4689
|
-
copy$
|
|
4734
|
+
copy$6(layoutBounds, bounds);
|
|
4690
4735
|
PointHelper.copy(layoutBounds, point);
|
|
4691
4736
|
if (unscale) {
|
|
4692
4737
|
const { scaleX, scaleY } = layoutBounds;
|
|
@@ -4801,7 +4846,7 @@ var LeaferUI = (function (exports) {
|
|
|
4801
4846
|
}
|
|
4802
4847
|
childrenSortChange() {
|
|
4803
4848
|
if (!this.childrenSortChanged) {
|
|
4804
|
-
this.childrenSortChanged = true;
|
|
4849
|
+
this.childrenSortChanged = this.affectChildrenSort = true;
|
|
4805
4850
|
this.leaf.forceUpdate('surface');
|
|
4806
4851
|
}
|
|
4807
4852
|
}
|
|
@@ -4868,6 +4913,40 @@ var LeaferUI = (function (exports) {
|
|
|
4868
4913
|
ImageEvent.LOADED = 'image.loaded';
|
|
4869
4914
|
ImageEvent.ERROR = 'image.error';
|
|
4870
4915
|
|
|
4916
|
+
class BoundsEvent extends Event {
|
|
4917
|
+
static checkHas(leaf, type, mode) {
|
|
4918
|
+
if (mode === 'on') {
|
|
4919
|
+
type === WORLD ? leaf.__hasWorldEvent = true : leaf.__hasLocalEvent = true;
|
|
4920
|
+
}
|
|
4921
|
+
else {
|
|
4922
|
+
leaf.__hasLocalEvent = leaf.hasEvent(RESIZE) || leaf.hasEvent(INNER) || leaf.hasEvent(LOCAL);
|
|
4923
|
+
leaf.__hasWorldEvent = leaf.hasEvent(WORLD);
|
|
4924
|
+
}
|
|
4925
|
+
}
|
|
4926
|
+
static emitLocal(leaf) {
|
|
4927
|
+
if (leaf.leaferIsReady) {
|
|
4928
|
+
const { resized } = leaf.__layout;
|
|
4929
|
+
if (resized !== 'local') {
|
|
4930
|
+
leaf.emit(RESIZE, leaf);
|
|
4931
|
+
if (resized === 'inner')
|
|
4932
|
+
leaf.emit(INNER, leaf);
|
|
4933
|
+
}
|
|
4934
|
+
leaf.emit(LOCAL, leaf);
|
|
4935
|
+
}
|
|
4936
|
+
}
|
|
4937
|
+
static emitWorld(leaf) {
|
|
4938
|
+
if (leaf.leaferIsReady)
|
|
4939
|
+
leaf.emit(WORLD, this);
|
|
4940
|
+
}
|
|
4941
|
+
}
|
|
4942
|
+
BoundsEvent.RESIZE = 'bounds.resize';
|
|
4943
|
+
BoundsEvent.INNER = 'bounds.inner';
|
|
4944
|
+
BoundsEvent.LOCAL = 'bounds.local';
|
|
4945
|
+
BoundsEvent.WORLD = 'bounds.world';
|
|
4946
|
+
const { RESIZE, INNER, LOCAL, WORLD } = BoundsEvent;
|
|
4947
|
+
const boundsEventMap = {};
|
|
4948
|
+
[RESIZE, INNER, LOCAL, WORLD].forEach(key => boundsEventMap[key] = 1);
|
|
4949
|
+
|
|
4871
4950
|
class ResizeEvent extends Event {
|
|
4872
4951
|
get bigger() {
|
|
4873
4952
|
if (!this.old)
|
|
@@ -4964,9 +5043,12 @@ var LeaferUI = (function (exports) {
|
|
|
4964
5043
|
set event(map) { this.on(map); }
|
|
4965
5044
|
on(type, listener, options) {
|
|
4966
5045
|
if (!listener) {
|
|
4967
|
-
let event
|
|
4968
|
-
|
|
4969
|
-
|
|
5046
|
+
let event;
|
|
5047
|
+
if (type instanceof Array)
|
|
5048
|
+
type.forEach(item => this.on(item[0], item[1], item[2]));
|
|
5049
|
+
else
|
|
5050
|
+
for (let key in type)
|
|
5051
|
+
(event = type[key]) instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event);
|
|
4970
5052
|
return;
|
|
4971
5053
|
}
|
|
4972
5054
|
let capture, once;
|
|
@@ -4996,6 +5078,8 @@ var LeaferUI = (function (exports) {
|
|
|
4996
5078
|
else {
|
|
4997
5079
|
map[type] = [item];
|
|
4998
5080
|
}
|
|
5081
|
+
if (boundsEventMap[type])
|
|
5082
|
+
BoundsEvent.checkHas(this, type, 'on');
|
|
4999
5083
|
}
|
|
5000
5084
|
});
|
|
5001
5085
|
}
|
|
@@ -5017,6 +5101,8 @@ var LeaferUI = (function (exports) {
|
|
|
5017
5101
|
events.splice(index, 1);
|
|
5018
5102
|
if (!events.length)
|
|
5019
5103
|
delete map[type];
|
|
5104
|
+
if (boundsEventMap[type])
|
|
5105
|
+
BoundsEvent.checkHas(this, type, 'off');
|
|
5020
5106
|
}
|
|
5021
5107
|
}
|
|
5022
5108
|
});
|
|
@@ -5036,19 +5122,31 @@ var LeaferUI = (function (exports) {
|
|
|
5036
5122
|
}
|
|
5037
5123
|
}
|
|
5038
5124
|
on_(type, listener, bind, options) {
|
|
5039
|
-
if (
|
|
5040
|
-
|
|
5041
|
-
|
|
5125
|
+
if (!listener)
|
|
5126
|
+
(type instanceof Array) && type.forEach(item => this.on(item[0], item[2] ? item[1] = item[1].bind(item[2]) : item[1], item[3]));
|
|
5127
|
+
else
|
|
5128
|
+
this.on(type, bind ? listener = listener.bind(bind) : listener, options);
|
|
5042
5129
|
return { type, current: this, listener, options };
|
|
5043
5130
|
}
|
|
5044
5131
|
off_(id) {
|
|
5045
5132
|
if (!id)
|
|
5046
5133
|
return;
|
|
5047
5134
|
const list = id instanceof Array ? id : [id];
|
|
5048
|
-
list.forEach(item =>
|
|
5135
|
+
list.forEach(item => {
|
|
5136
|
+
if (!item.listener)
|
|
5137
|
+
(item.type instanceof Array) && item.type.forEach(v => item.current.off(v[0], v[1], v[3]));
|
|
5138
|
+
else
|
|
5139
|
+
item.current.off(item.type, item.listener, item.options);
|
|
5140
|
+
});
|
|
5049
5141
|
list.length = 0;
|
|
5050
5142
|
}
|
|
5051
|
-
once(type, listener, capture) {
|
|
5143
|
+
once(type, listener, captureOrBind, capture) {
|
|
5144
|
+
if (!listener)
|
|
5145
|
+
return (type instanceof Array) && type.forEach(item => this.once(item[0], item[1], item[2], item[3]));
|
|
5146
|
+
if (typeof captureOrBind === 'object')
|
|
5147
|
+
listener = listener.bind(captureOrBind);
|
|
5148
|
+
else
|
|
5149
|
+
capture = captureOrBind;
|
|
5052
5150
|
this.on(type, listener, { once: true, capture });
|
|
5053
5151
|
}
|
|
5054
5152
|
emit(type, event, capture) {
|
|
@@ -5160,7 +5258,7 @@ var LeaferUI = (function (exports) {
|
|
|
5160
5258
|
};
|
|
5161
5259
|
|
|
5162
5260
|
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
5163
|
-
const { toPoint: toPoint$3, tempPoint
|
|
5261
|
+
const { toPoint: toPoint$3, tempPoint } = AroundHelper;
|
|
5164
5262
|
const LeafMatrix = {
|
|
5165
5263
|
__updateWorldMatrix() {
|
|
5166
5264
|
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
|
|
@@ -5169,33 +5267,39 @@ var LeaferUI = (function (exports) {
|
|
|
5169
5267
|
if (this.__local) {
|
|
5170
5268
|
const layout = this.__layout, local = this.__local, data = this.__;
|
|
5171
5269
|
if (layout.affectScaleOrRotation) {
|
|
5172
|
-
if (layout.scaleChanged || layout.rotationChanged) {
|
|
5270
|
+
if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
|
|
5173
5271
|
setLayout(local, data, null, null, layout.affectRotation);
|
|
5174
|
-
layout.scaleChanged = layout.rotationChanged =
|
|
5272
|
+
layout.scaleChanged = layout.rotationChanged = undefined;
|
|
5175
5273
|
}
|
|
5176
5274
|
}
|
|
5177
5275
|
local.e = data.x + data.offsetX;
|
|
5178
5276
|
local.f = data.y + data.offsetY;
|
|
5179
5277
|
if (data.around || data.origin) {
|
|
5180
|
-
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint
|
|
5181
|
-
translateInner(local, -tempPoint
|
|
5278
|
+
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint);
|
|
5279
|
+
translateInner(local, -tempPoint.x, -tempPoint.y, !data.around);
|
|
5182
5280
|
}
|
|
5183
5281
|
}
|
|
5184
|
-
this.__layout.matrixChanged =
|
|
5282
|
+
this.__layout.matrixChanged = undefined;
|
|
5185
5283
|
}
|
|
5186
5284
|
};
|
|
5187
5285
|
|
|
5188
5286
|
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
|
|
5189
5287
|
const { updateBounds: updateBounds$1 } = BranchHelper;
|
|
5190
|
-
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$
|
|
5288
|
+
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5 } = BoundsHelper;
|
|
5191
5289
|
const { toBounds: toBounds$1 } = PathBounds;
|
|
5192
5290
|
const LeafBounds = {
|
|
5193
5291
|
__updateWorldBounds() {
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5292
|
+
const layout = this.__layout;
|
|
5293
|
+
toOuterOf$1(layout.renderBounds, this.__world, this.__world);
|
|
5294
|
+
if (layout.resized) {
|
|
5295
|
+
if (layout.resized === 'inner')
|
|
5296
|
+
this.__onUpdateSize();
|
|
5297
|
+
if (this.__hasLocalEvent)
|
|
5298
|
+
BoundsEvent.emitLocal(this);
|
|
5299
|
+
layout.resized = undefined;
|
|
5198
5300
|
}
|
|
5301
|
+
if (this.__hasWorldEvent)
|
|
5302
|
+
BoundsEvent.emitWorld(this);
|
|
5199
5303
|
},
|
|
5200
5304
|
__updateLocalBounds() {
|
|
5201
5305
|
const layout = this.__layout;
|
|
@@ -5204,12 +5308,12 @@ var LeaferUI = (function (exports) {
|
|
|
5204
5308
|
this.__updatePath();
|
|
5205
5309
|
this.__updateRenderPath();
|
|
5206
5310
|
this.__updateBoxBounds();
|
|
5207
|
-
layout.resized =
|
|
5311
|
+
layout.resized = 'inner';
|
|
5208
5312
|
}
|
|
5209
5313
|
if (layout.localBoxChanged) {
|
|
5210
5314
|
if (this.__local)
|
|
5211
5315
|
this.__updateLocalBoxBounds();
|
|
5212
|
-
layout.localBoxChanged =
|
|
5316
|
+
layout.localBoxChanged = undefined;
|
|
5213
5317
|
if (layout.strokeSpread)
|
|
5214
5318
|
layout.strokeChanged = true;
|
|
5215
5319
|
if (layout.renderSpread)
|
|
@@ -5217,7 +5321,7 @@ var LeaferUI = (function (exports) {
|
|
|
5217
5321
|
if (this.parent)
|
|
5218
5322
|
this.parent.__layout.boxChange();
|
|
5219
5323
|
}
|
|
5220
|
-
layout.boxChanged =
|
|
5324
|
+
layout.boxChanged = undefined;
|
|
5221
5325
|
if (layout.strokeChanged) {
|
|
5222
5326
|
layout.strokeSpread = this.__updateStrokeSpread();
|
|
5223
5327
|
if (layout.strokeSpread) {
|
|
@@ -5229,12 +5333,12 @@ var LeaferUI = (function (exports) {
|
|
|
5229
5333
|
else {
|
|
5230
5334
|
layout.spreadStrokeCancel();
|
|
5231
5335
|
}
|
|
5232
|
-
layout.strokeChanged =
|
|
5336
|
+
layout.strokeChanged = undefined;
|
|
5233
5337
|
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
|
|
5234
5338
|
layout.renderChanged = true;
|
|
5235
5339
|
if (this.parent)
|
|
5236
5340
|
this.parent.__layout.strokeChange();
|
|
5237
|
-
layout.resized =
|
|
5341
|
+
layout.resized = 'inner';
|
|
5238
5342
|
}
|
|
5239
5343
|
if (layout.renderChanged) {
|
|
5240
5344
|
layout.renderSpread = this.__updateRenderSpread();
|
|
@@ -5247,11 +5351,12 @@ var LeaferUI = (function (exports) {
|
|
|
5247
5351
|
else {
|
|
5248
5352
|
layout.spreadRenderCancel();
|
|
5249
5353
|
}
|
|
5250
|
-
layout.renderChanged =
|
|
5354
|
+
layout.renderChanged = undefined;
|
|
5251
5355
|
if (this.parent)
|
|
5252
5356
|
this.parent.__layout.renderChange();
|
|
5253
5357
|
}
|
|
5254
|
-
layout.
|
|
5358
|
+
layout.resized || (layout.resized = 'local');
|
|
5359
|
+
layout.boundsChanged = undefined;
|
|
5255
5360
|
},
|
|
5256
5361
|
__updateLocalBoxBounds() {
|
|
5257
5362
|
if (this.__hasMotionPath)
|
|
@@ -5311,7 +5416,7 @@ var LeaferUI = (function (exports) {
|
|
|
5311
5416
|
},
|
|
5312
5417
|
__updateRenderBounds() {
|
|
5313
5418
|
const layout = this.__layout;
|
|
5314
|
-
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$
|
|
5419
|
+
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
|
|
5315
5420
|
}
|
|
5316
5421
|
};
|
|
5317
5422
|
|
|
@@ -5416,7 +5521,7 @@ var LeaferUI = (function (exports) {
|
|
|
5416
5521
|
const { LEAF, create } = IncrementId;
|
|
5417
5522
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5418
5523
|
const { toOuterOf } = BoundsHelper;
|
|
5419
|
-
const { copy: copy$
|
|
5524
|
+
const { copy: copy$4, move } = PointHelper;
|
|
5420
5525
|
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5421
5526
|
exports.Leaf = class Leaf {
|
|
5422
5527
|
get tag() { return this.__tag; }
|
|
@@ -5629,7 +5734,7 @@ var LeaferUI = (function (exports) {
|
|
|
5629
5734
|
}
|
|
5630
5735
|
else {
|
|
5631
5736
|
if (to)
|
|
5632
|
-
copy$
|
|
5737
|
+
copy$4(to, world);
|
|
5633
5738
|
}
|
|
5634
5739
|
}
|
|
5635
5740
|
localToWorld(local, to, distance, relative) {
|
|
@@ -5638,7 +5743,7 @@ var LeaferUI = (function (exports) {
|
|
|
5638
5743
|
}
|
|
5639
5744
|
else {
|
|
5640
5745
|
if (to)
|
|
5641
|
-
copy$
|
|
5746
|
+
copy$4(to, local);
|
|
5642
5747
|
}
|
|
5643
5748
|
}
|
|
5644
5749
|
worldToInner(world, to, distance, relative) {
|
|
@@ -5791,7 +5896,7 @@ var LeaferUI = (function (exports) {
|
|
|
5791
5896
|
off(_type, _listener, _options) { }
|
|
5792
5897
|
on_(_type, _listener, _bind, _options) { return undefined; }
|
|
5793
5898
|
off_(_id) { }
|
|
5794
|
-
once(_type, _listener, _capture) { }
|
|
5899
|
+
once(_type, _listener, _captureOrBind, _capture) { }
|
|
5795
5900
|
emit(_type, _event, _capture) { }
|
|
5796
5901
|
emitEvent(_event, _capture) { }
|
|
5797
5902
|
hasEvent(_type, _capture) { return false; }
|
|
@@ -6128,7 +6233,7 @@ var LeaferUI = (function (exports) {
|
|
|
6128
6233
|
}
|
|
6129
6234
|
}
|
|
6130
6235
|
|
|
6131
|
-
const version = "1.6.
|
|
6236
|
+
const version = "1.6.3";
|
|
6132
6237
|
|
|
6133
6238
|
const debug$4 = Debug.get('LeaferCanvas');
|
|
6134
6239
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6468,17 +6573,15 @@ var LeaferUI = (function (exports) {
|
|
|
6468
6573
|
this.target.emitEvent(new WatchEvent(WatchEvent.DATA, { updatedList: this.updatedList }));
|
|
6469
6574
|
this.__updatedList = new LeafList();
|
|
6470
6575
|
this.totalTimes++;
|
|
6471
|
-
this.changed = false;
|
|
6472
|
-
this.hasVisible = false;
|
|
6473
|
-
this.hasRemove = false;
|
|
6474
|
-
this.hasAdd = false;
|
|
6576
|
+
this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
6475
6577
|
}
|
|
6476
6578
|
__listenEvents() {
|
|
6477
|
-
const { target } = this;
|
|
6478
6579
|
this.__eventIds = [
|
|
6479
|
-
target.on_(
|
|
6480
|
-
|
|
6481
|
-
|
|
6580
|
+
this.target.on_([
|
|
6581
|
+
[PropertyEvent.CHANGE, this.__onAttrChange, this],
|
|
6582
|
+
[[ChildEvent.ADD, ChildEvent.REMOVE], this.__onChildEvent, this],
|
|
6583
|
+
[WatchEvent.REQUEST, this.__onRquestData, this]
|
|
6584
|
+
])
|
|
6482
6585
|
];
|
|
6483
6586
|
}
|
|
6484
6587
|
__removeListenEvents() {
|
|
@@ -6488,13 +6591,12 @@ var LeaferUI = (function (exports) {
|
|
|
6488
6591
|
if (this.target) {
|
|
6489
6592
|
this.stop();
|
|
6490
6593
|
this.__removeListenEvents();
|
|
6491
|
-
this.target = null;
|
|
6492
|
-
this.__updatedList = null;
|
|
6594
|
+
this.target = this.__updatedList = null;
|
|
6493
6595
|
}
|
|
6494
6596
|
}
|
|
6495
6597
|
}
|
|
6496
6598
|
|
|
6497
|
-
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds,
|
|
6599
|
+
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds, updateChange: updateOneChange } = LeafHelper;
|
|
6498
6600
|
const { pushAllChildBranch, pushAllParent } = BranchHelper;
|
|
6499
6601
|
function updateMatrix(updateList, levelList) {
|
|
6500
6602
|
let layout;
|
|
@@ -6537,15 +6639,7 @@ var LeaferUI = (function (exports) {
|
|
|
6537
6639
|
});
|
|
6538
6640
|
}
|
|
6539
6641
|
function updateChange(updateList) {
|
|
6540
|
-
|
|
6541
|
-
updateList.list.forEach(leaf => {
|
|
6542
|
-
layout = leaf.__layout;
|
|
6543
|
-
if (layout.opacityChanged)
|
|
6544
|
-
updateAllWorldOpacity(leaf);
|
|
6545
|
-
if (layout.stateStyleChanged)
|
|
6546
|
-
setTimeout(() => layout.stateStyleChanged && leaf.updateState());
|
|
6547
|
-
leaf.__updateChange();
|
|
6548
|
-
});
|
|
6642
|
+
updateList.list.forEach(updateOneChange);
|
|
6549
6643
|
}
|
|
6550
6644
|
|
|
6551
6645
|
const { worldBounds } = LeafBoundsHelper;
|
|
@@ -6602,7 +6696,7 @@ var LeaferUI = (function (exports) {
|
|
|
6602
6696
|
this.disabled = true;
|
|
6603
6697
|
}
|
|
6604
6698
|
layout() {
|
|
6605
|
-
if (!this.running)
|
|
6699
|
+
if (this.layouting || !this.running)
|
|
6606
6700
|
return;
|
|
6607
6701
|
const { target } = this;
|
|
6608
6702
|
this.times = 0;
|
|
@@ -6685,12 +6779,10 @@ var LeaferUI = (function (exports) {
|
|
|
6685
6779
|
}
|
|
6686
6780
|
static fullLayout(target) {
|
|
6687
6781
|
updateAllMatrix(target, true);
|
|
6688
|
-
if (target.isBranch)
|
|
6782
|
+
if (target.isBranch)
|
|
6689
6783
|
BranchHelper.updateBounds(target);
|
|
6690
|
-
|
|
6691
|
-
else {
|
|
6784
|
+
else
|
|
6692
6785
|
LeafHelper.updateBounds(target);
|
|
6693
|
-
}
|
|
6694
6786
|
updateAllChange(target);
|
|
6695
6787
|
}
|
|
6696
6788
|
addExtra(leaf) {
|
|
@@ -6713,11 +6805,12 @@ var LeaferUI = (function (exports) {
|
|
|
6713
6805
|
this.__updatedList = event.data.updatedList;
|
|
6714
6806
|
}
|
|
6715
6807
|
__listenEvents() {
|
|
6716
|
-
const { target } = this;
|
|
6717
6808
|
this.__eventIds = [
|
|
6718
|
-
target.on_(
|
|
6719
|
-
|
|
6720
|
-
|
|
6809
|
+
this.target.on_([
|
|
6810
|
+
[LayoutEvent.REQUEST, this.layout, this],
|
|
6811
|
+
[LayoutEvent.AGAIN, this.layoutAgain, this],
|
|
6812
|
+
[WatchEvent.DATA, this.__onReceiveWatchData, this]
|
|
6813
|
+
])
|
|
6721
6814
|
];
|
|
6722
6815
|
}
|
|
6723
6816
|
__removeListenEvents() {
|
|
@@ -6948,12 +7041,13 @@ var LeaferUI = (function (exports) {
|
|
|
6948
7041
|
this.target.emitEvent(new RenderEvent(type, this.times, bounds, options));
|
|
6949
7042
|
}
|
|
6950
7043
|
__listenEvents() {
|
|
6951
|
-
const { target } = this;
|
|
6952
7044
|
this.__eventIds = [
|
|
6953
|
-
target.on_(
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
7045
|
+
this.target.on_([
|
|
7046
|
+
[RenderEvent.REQUEST, this.update, this],
|
|
7047
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
7048
|
+
[RenderEvent.AGAIN, this.renderAgain, this],
|
|
7049
|
+
[ResizeEvent.RESIZE, this.__onResize, this]
|
|
7050
|
+
])
|
|
6957
7051
|
];
|
|
6958
7052
|
}
|
|
6959
7053
|
__removeListenEvents() {
|
|
@@ -7012,8 +7106,32 @@ var LeaferUI = (function (exports) {
|
|
|
7012
7106
|
};
|
|
7013
7107
|
}
|
|
7014
7108
|
|
|
7109
|
+
function hasTransparent$3(color) {
|
|
7110
|
+
if (!color || color.length === 7 || color.length === 4)
|
|
7111
|
+
return false;
|
|
7112
|
+
if (color === 'transparent')
|
|
7113
|
+
return true;
|
|
7114
|
+
const first = color[0];
|
|
7115
|
+
if (first === '#') {
|
|
7116
|
+
switch (color.length) {
|
|
7117
|
+
case 5: return color[4] !== 'f' && color[4] !== 'F';
|
|
7118
|
+
case 9: return (color[7] !== 'f' && color[7] !== 'F') || (color[8] !== 'f' && color[8] !== 'F');
|
|
7119
|
+
}
|
|
7120
|
+
}
|
|
7121
|
+
else if (first === 'r' || first === 'h') {
|
|
7122
|
+
if (color[3] === 'a') {
|
|
7123
|
+
const i = color.lastIndexOf(',');
|
|
7124
|
+
if (i > -1)
|
|
7125
|
+
return parseFloat(color.slice(i + 1)) < 1;
|
|
7126
|
+
}
|
|
7127
|
+
}
|
|
7128
|
+
return false;
|
|
7129
|
+
}
|
|
7130
|
+
|
|
7015
7131
|
const TextConvert = {};
|
|
7016
|
-
const ColorConvert = {
|
|
7132
|
+
const ColorConvert = {
|
|
7133
|
+
hasTransparent: hasTransparent$3
|
|
7134
|
+
};
|
|
7017
7135
|
const UnitConvert = {
|
|
7018
7136
|
number(value, percentRefer) {
|
|
7019
7137
|
return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
|
|
@@ -7039,6 +7157,7 @@ var LeaferUI = (function (exports) {
|
|
|
7039
7157
|
};
|
|
7040
7158
|
|
|
7041
7159
|
const { parse, objectToCanvasData } = PathConvert;
|
|
7160
|
+
const { stintSet: stintSet$2 } = DataHelper, { hasTransparent: hasTransparent$2 } = ColorConvert;
|
|
7042
7161
|
const emptyPaint = {};
|
|
7043
7162
|
const debug$1 = Debug.get('UIData');
|
|
7044
7163
|
class UIData extends LeafData {
|
|
@@ -7097,38 +7216,22 @@ var LeaferUI = (function (exports) {
|
|
|
7097
7216
|
if (this.__naturalWidth)
|
|
7098
7217
|
this.__removeNaturalSize();
|
|
7099
7218
|
if (typeof value === 'string' || !value) {
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
PaintImage.recycleImage('fill', this);
|
|
7103
|
-
this.__isFills = false;
|
|
7104
|
-
this.__pixelFill && (this.__pixelFill = false);
|
|
7105
|
-
}
|
|
7219
|
+
stintSet$2(this, '__isTransparentFill', hasTransparent$2(value));
|
|
7220
|
+
this.__isFills && this.__removePaint('fill', true);
|
|
7106
7221
|
this._fill = value;
|
|
7107
7222
|
}
|
|
7108
7223
|
else if (typeof value === 'object') {
|
|
7109
|
-
this.
|
|
7110
|
-
const layout = this.__leaf.__layout;
|
|
7111
|
-
layout.boxChanged || layout.boxChange();
|
|
7112
|
-
this.__isFills = true;
|
|
7113
|
-
this._fill || (this._fill = emptyPaint);
|
|
7224
|
+
this.__setPaint('fill', value);
|
|
7114
7225
|
}
|
|
7115
7226
|
}
|
|
7116
7227
|
setStroke(value) {
|
|
7117
7228
|
if (typeof value === 'string' || !value) {
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
PaintImage.recycleImage('stroke', this);
|
|
7121
|
-
this.__isStrokes = false;
|
|
7122
|
-
this.__pixelStroke && (this.__pixelStroke = false);
|
|
7123
|
-
}
|
|
7229
|
+
stintSet$2(this, '__isTransparentStroke', hasTransparent$2(value));
|
|
7230
|
+
this.__isStrokes && this.__removePaint('stroke', true);
|
|
7124
7231
|
this._stroke = value;
|
|
7125
7232
|
}
|
|
7126
7233
|
else if (typeof value === 'object') {
|
|
7127
|
-
this.
|
|
7128
|
-
const layout = this.__leaf.__layout;
|
|
7129
|
-
layout.boxChanged || layout.boxChange();
|
|
7130
|
-
this.__isStrokes = true;
|
|
7131
|
-
this._stroke || (this._stroke = emptyPaint);
|
|
7234
|
+
this.__setPaint('stroke', value);
|
|
7132
7235
|
}
|
|
7133
7236
|
}
|
|
7134
7237
|
setPath(value) {
|
|
@@ -7158,7 +7261,34 @@ var LeaferUI = (function (exports) {
|
|
|
7158
7261
|
Paint.compute('fill', this.__leaf);
|
|
7159
7262
|
if (stroke)
|
|
7160
7263
|
Paint.compute('stroke', this.__leaf);
|
|
7161
|
-
this.__needComputePaint =
|
|
7264
|
+
this.__needComputePaint = undefined;
|
|
7265
|
+
}
|
|
7266
|
+
__setPaint(attrName, value) {
|
|
7267
|
+
this.__setInput(attrName, value);
|
|
7268
|
+
const layout = this.__leaf.__layout;
|
|
7269
|
+
layout.boxChanged || layout.boxChange();
|
|
7270
|
+
if (value instanceof Array && !value.length) {
|
|
7271
|
+
this.__removePaint(attrName);
|
|
7272
|
+
}
|
|
7273
|
+
else {
|
|
7274
|
+
if (attrName === 'fill')
|
|
7275
|
+
this.__isFills = true, this._fill || (this._fill = emptyPaint);
|
|
7276
|
+
else
|
|
7277
|
+
this.__isStrokes = true, this._stroke || (this._stroke = emptyPaint);
|
|
7278
|
+
}
|
|
7279
|
+
}
|
|
7280
|
+
__removePaint(attrName, removeInput) {
|
|
7281
|
+
if (removeInput)
|
|
7282
|
+
this.__removeInput(attrName);
|
|
7283
|
+
PaintImage.recycleImage(attrName, this);
|
|
7284
|
+
if (attrName === 'fill') {
|
|
7285
|
+
stintSet$2(this, '__isAlphaPixelFill', undefined);
|
|
7286
|
+
this._fill = this.__isFills = undefined;
|
|
7287
|
+
}
|
|
7288
|
+
else {
|
|
7289
|
+
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7290
|
+
this._stroke = this.__isStrokes = undefined;
|
|
7291
|
+
}
|
|
7162
7292
|
}
|
|
7163
7293
|
}
|
|
7164
7294
|
function setArray(data, key, value) {
|
|
@@ -7166,10 +7296,10 @@ var LeaferUI = (function (exports) {
|
|
|
7166
7296
|
if (value instanceof Array) {
|
|
7167
7297
|
if (value.some((item) => item.visible === false))
|
|
7168
7298
|
value = value.filter((item) => item.visible !== false);
|
|
7169
|
-
value.length || (value =
|
|
7299
|
+
value.length || (value = undefined);
|
|
7170
7300
|
}
|
|
7171
7301
|
else
|
|
7172
|
-
value = value && value.visible !== false ? [value] :
|
|
7302
|
+
value = value && value.visible !== false ? [value] : undefined;
|
|
7173
7303
|
data['_' + key] = value;
|
|
7174
7304
|
}
|
|
7175
7305
|
|
|
@@ -7233,13 +7363,11 @@ var LeaferUI = (function (exports) {
|
|
|
7233
7363
|
setFontWeight(value) {
|
|
7234
7364
|
if (typeof value === 'string') {
|
|
7235
7365
|
this.__setInput('fontWeight', value);
|
|
7236
|
-
|
|
7237
|
-
}
|
|
7238
|
-
else {
|
|
7239
|
-
if (this.__input)
|
|
7240
|
-
this.__removeInput('fontWeight');
|
|
7241
|
-
this._fontWeight = value;
|
|
7366
|
+
value = fontWeightMap[value] || 400;
|
|
7242
7367
|
}
|
|
7368
|
+
else if (this.__input)
|
|
7369
|
+
this.__removeInput('fontWeight');
|
|
7370
|
+
this._fontWeight = value;
|
|
7243
7371
|
}
|
|
7244
7372
|
setBoxStyle(value) {
|
|
7245
7373
|
let t = this.__leaf, box = t.__box;
|
|
@@ -7274,8 +7402,6 @@ var LeaferUI = (function (exports) {
|
|
|
7274
7402
|
this._url = value;
|
|
7275
7403
|
}
|
|
7276
7404
|
__setImageFill(value) {
|
|
7277
|
-
if (this.__leaf.image)
|
|
7278
|
-
this.__leaf.image = null;
|
|
7279
7405
|
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
7280
7406
|
}
|
|
7281
7407
|
__getData() {
|
|
@@ -7341,21 +7467,19 @@ var LeaferUI = (function (exports) {
|
|
|
7341
7467
|
}
|
|
7342
7468
|
};
|
|
7343
7469
|
|
|
7470
|
+
const { stintSet: stintSet$1 } = DataHelper;
|
|
7344
7471
|
const UIRender = {
|
|
7345
7472
|
__updateChange() {
|
|
7346
|
-
const data = this.__
|
|
7473
|
+
const data = this.__;
|
|
7347
7474
|
if (data.__useEffect) {
|
|
7348
|
-
const { shadow,
|
|
7349
|
-
data.
|
|
7475
|
+
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7476
|
+
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')));
|
|
7477
|
+
data.__useEffect = !!(shadow || otherEffect);
|
|
7350
7478
|
}
|
|
7351
|
-
|
|
7352
|
-
|
|
7479
|
+
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7480
|
+
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7353
7481
|
data.__checkSingle();
|
|
7354
|
-
|
|
7355
|
-
if (complex)
|
|
7356
|
-
data.__complex = true;
|
|
7357
|
-
else
|
|
7358
|
-
data.__complex && (data.__complex = false);
|
|
7482
|
+
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7359
7483
|
},
|
|
7360
7484
|
__drawFast(canvas, options) {
|
|
7361
7485
|
drawFast(this, canvas, options);
|
|
@@ -7365,21 +7489,23 @@ var LeaferUI = (function (exports) {
|
|
|
7365
7489
|
if (data.__complex) {
|
|
7366
7490
|
if (data.__needComputePaint)
|
|
7367
7491
|
data.__computePaint();
|
|
7368
|
-
const { fill, stroke, __drawAfterFill } = data;
|
|
7492
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke, __isFastShadow } = data;
|
|
7369
7493
|
this.__drawRenderPath(canvas);
|
|
7370
|
-
if (data.__useEffect) {
|
|
7494
|
+
if (data.__useEffect && !__isFastShadow) {
|
|
7371
7495
|
const shape = Paint.shape(this, canvas, options);
|
|
7372
7496
|
this.__nowWorld = this.__getNowWorld(options);
|
|
7373
7497
|
const { shadow, innerShadow, filter } = data;
|
|
7374
7498
|
if (shadow)
|
|
7375
7499
|
Effect.shadow(this, canvas, shape);
|
|
7500
|
+
if (__fillAfterStroke)
|
|
7501
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7376
7502
|
if (fill)
|
|
7377
7503
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7378
7504
|
if (__drawAfterFill)
|
|
7379
7505
|
this.__drawAfterFill(canvas, options);
|
|
7380
7506
|
if (innerShadow)
|
|
7381
7507
|
Effect.innerShadow(this, canvas, shape);
|
|
7382
|
-
if (stroke)
|
|
7508
|
+
if (stroke && !__fillAfterStroke)
|
|
7383
7509
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7384
7510
|
if (filter)
|
|
7385
7511
|
Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
@@ -7388,21 +7514,27 @@ var LeaferUI = (function (exports) {
|
|
|
7388
7514
|
shape.canvas.recycle();
|
|
7389
7515
|
}
|
|
7390
7516
|
else {
|
|
7517
|
+
if (__fillAfterStroke)
|
|
7518
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7519
|
+
if (__isFastShadow) {
|
|
7520
|
+
const shadow = data.shadow[0], { scaleX, scaleY } = this.__nowWorld;
|
|
7521
|
+
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
7522
|
+
}
|
|
7391
7523
|
if (fill)
|
|
7392
7524
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7525
|
+
if (__isFastShadow)
|
|
7526
|
+
canvas.restore();
|
|
7393
7527
|
if (__drawAfterFill)
|
|
7394
7528
|
this.__drawAfterFill(canvas, options);
|
|
7395
|
-
if (stroke)
|
|
7529
|
+
if (stroke && !__fillAfterStroke)
|
|
7396
7530
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7397
7531
|
}
|
|
7398
7532
|
}
|
|
7399
7533
|
else {
|
|
7400
|
-
if (data.__pathInputed)
|
|
7534
|
+
if (data.__pathInputed)
|
|
7401
7535
|
drawFast(this, canvas, options);
|
|
7402
|
-
|
|
7403
|
-
else {
|
|
7536
|
+
else
|
|
7404
7537
|
this.__drawFast(canvas, options);
|
|
7405
|
-
}
|
|
7406
7538
|
}
|
|
7407
7539
|
},
|
|
7408
7540
|
__renderShape(canvas, options, ignoreFill, ignoreStroke) {
|
|
@@ -7411,11 +7543,11 @@ var LeaferUI = (function (exports) {
|
|
|
7411
7543
|
const { fill, stroke } = this.__;
|
|
7412
7544
|
this.__drawRenderPath(canvas);
|
|
7413
7545
|
if (fill && !ignoreFill)
|
|
7414
|
-
this.__.
|
|
7546
|
+
this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7415
7547
|
if (this.__.__isCanvas)
|
|
7416
7548
|
this.__drawAfterFill(canvas, options);
|
|
7417
7549
|
if (stroke && !ignoreStroke)
|
|
7418
|
-
this.__.
|
|
7550
|
+
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7419
7551
|
}
|
|
7420
7552
|
},
|
|
7421
7553
|
__drawAfterFill(canvas, options) {
|
|
@@ -7430,13 +7562,15 @@ var LeaferUI = (function (exports) {
|
|
|
7430
7562
|
}
|
|
7431
7563
|
};
|
|
7432
7564
|
function drawFast(ui, canvas, options) {
|
|
7433
|
-
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
7565
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke } = ui.__;
|
|
7434
7566
|
ui.__drawRenderPath(canvas);
|
|
7567
|
+
if (__fillAfterStroke)
|
|
7568
|
+
Paint.stroke(stroke, ui, canvas);
|
|
7435
7569
|
if (fill)
|
|
7436
7570
|
Paint.fill(fill, ui, canvas);
|
|
7437
7571
|
if (__drawAfterFill)
|
|
7438
7572
|
ui.__drawAfterFill(canvas, options);
|
|
7439
|
-
if (stroke)
|
|
7573
|
+
if (stroke && !__fillAfterStroke)
|
|
7440
7574
|
Paint.stroke(stroke, ui, canvas);
|
|
7441
7575
|
}
|
|
7442
7576
|
|
|
@@ -7566,6 +7700,9 @@ var LeaferUI = (function (exports) {
|
|
|
7566
7700
|
else
|
|
7567
7701
|
drawer.rect(x, y, width, height);
|
|
7568
7702
|
}
|
|
7703
|
+
drawImagePlaceholder(canvas, _image) {
|
|
7704
|
+
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7705
|
+
}
|
|
7569
7706
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7570
7707
|
return Plugin.need('animate');
|
|
7571
7708
|
}
|
|
@@ -7802,6 +7939,12 @@ var LeaferUI = (function (exports) {
|
|
|
7802
7939
|
__decorate([
|
|
7803
7940
|
effectType()
|
|
7804
7941
|
], exports.UI.prototype, "filter", void 0);
|
|
7942
|
+
__decorate([
|
|
7943
|
+
surfaceType()
|
|
7944
|
+
], exports.UI.prototype, "placeholderColor", void 0);
|
|
7945
|
+
__decorate([
|
|
7946
|
+
dataType(100)
|
|
7947
|
+
], exports.UI.prototype, "placeholderDelay", void 0);
|
|
7805
7948
|
__decorate([
|
|
7806
7949
|
dataType({})
|
|
7807
7950
|
], exports.UI.prototype, "data", void 0);
|
|
@@ -8203,15 +8346,20 @@ var LeaferUI = (function (exports) {
|
|
|
8203
8346
|
}
|
|
8204
8347
|
__listenEvents() {
|
|
8205
8348
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8206
|
-
this.once(
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8349
|
+
this.once([
|
|
8350
|
+
[LeaferEvent.START, () => Run.end(runId)],
|
|
8351
|
+
[LayoutEvent.START, this.updateLazyBounds, this],
|
|
8352
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
8353
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
8354
|
+
]);
|
|
8355
|
+
this.__eventIds.push(this.on_([
|
|
8356
|
+
[WatchEvent.DATA, this.__onWatchData, this],
|
|
8357
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
8358
|
+
[RenderEvent.NEXT, this.__onNextRender, this]
|
|
8359
|
+
]));
|
|
8211
8360
|
}
|
|
8212
8361
|
__removeListenEvents() {
|
|
8213
8362
|
this.off_(this.__eventIds);
|
|
8214
|
-
this.__eventIds.length = 0;
|
|
8215
8363
|
}
|
|
8216
8364
|
destroy(sync) {
|
|
8217
8365
|
const doDestory = () => {
|
|
@@ -8271,8 +8419,8 @@ var LeaferUI = (function (exports) {
|
|
|
8271
8419
|
registerUI()
|
|
8272
8420
|
], exports.Rect);
|
|
8273
8421
|
|
|
8274
|
-
const { copy: copy$
|
|
8275
|
-
const rect = exports.Rect.prototype, group = exports.Group.prototype;
|
|
8422
|
+
const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
|
|
8423
|
+
const rect$1 = exports.Rect.prototype, group = exports.Group.prototype;
|
|
8276
8424
|
const childrenRenderBounds = {};
|
|
8277
8425
|
exports.Box = class Box extends exports.Group {
|
|
8278
8426
|
get __tag() { return 'Box'; }
|
|
@@ -8317,15 +8465,15 @@ var LeaferUI = (function (exports) {
|
|
|
8317
8465
|
const { renderBounds } = this.__layout;
|
|
8318
8466
|
if (this.children.length) {
|
|
8319
8467
|
super.__updateRenderBounds();
|
|
8320
|
-
copy$
|
|
8468
|
+
copy$3(childrenRenderBounds, renderBounds);
|
|
8321
8469
|
this.__updateRectRenderBounds();
|
|
8322
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8470
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8323
8471
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8324
8472
|
add(renderBounds, childrenRenderBounds);
|
|
8325
8473
|
}
|
|
8326
8474
|
else
|
|
8327
8475
|
this.__updateRectRenderBounds();
|
|
8328
|
-
|
|
8476
|
+
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8329
8477
|
}
|
|
8330
8478
|
__updateRectRenderBounds() { }
|
|
8331
8479
|
__updateRectChange() { }
|
|
@@ -8369,25 +8517,25 @@ var LeaferUI = (function (exports) {
|
|
|
8369
8517
|
affectRenderBoundsType('show')
|
|
8370
8518
|
], exports.Box.prototype, "overflow", void 0);
|
|
8371
8519
|
__decorate([
|
|
8372
|
-
rewrite(rect.__updateStrokeSpread)
|
|
8520
|
+
rewrite(rect$1.__updateStrokeSpread)
|
|
8373
8521
|
], exports.Box.prototype, "__updateStrokeSpread", null);
|
|
8374
8522
|
__decorate([
|
|
8375
|
-
rewrite(rect.__updateRenderSpread)
|
|
8523
|
+
rewrite(rect$1.__updateRenderSpread)
|
|
8376
8524
|
], exports.Box.prototype, "__updateRectRenderSpread", null);
|
|
8377
8525
|
__decorate([
|
|
8378
|
-
rewrite(rect.__updateBoxBounds)
|
|
8526
|
+
rewrite(rect$1.__updateBoxBounds)
|
|
8379
8527
|
], exports.Box.prototype, "__updateRectBoxBounds", null);
|
|
8380
8528
|
__decorate([
|
|
8381
|
-
rewrite(rect.__updateStrokeBounds)
|
|
8529
|
+
rewrite(rect$1.__updateStrokeBounds)
|
|
8382
8530
|
], exports.Box.prototype, "__updateStrokeBounds", null);
|
|
8383
8531
|
__decorate([
|
|
8384
|
-
rewrite(rect.__updateRenderBounds)
|
|
8532
|
+
rewrite(rect$1.__updateRenderBounds)
|
|
8385
8533
|
], exports.Box.prototype, "__updateRectRenderBounds", null);
|
|
8386
8534
|
__decorate([
|
|
8387
|
-
rewrite(rect.__updateChange)
|
|
8535
|
+
rewrite(rect$1.__updateChange)
|
|
8388
8536
|
], exports.Box.prototype, "__updateRectChange", null);
|
|
8389
8537
|
__decorate([
|
|
8390
|
-
rewrite(rect.__render)
|
|
8538
|
+
rewrite(rect$1.__render)
|
|
8391
8539
|
], exports.Box.prototype, "__renderRect", null);
|
|
8392
8540
|
__decorate([
|
|
8393
8541
|
rewrite(group.__render)
|
|
@@ -8629,17 +8777,10 @@ var LeaferUI = (function (exports) {
|
|
|
8629
8777
|
|
|
8630
8778
|
exports.Image = class Image extends exports.Rect {
|
|
8631
8779
|
get __tag() { return 'Image'; }
|
|
8632
|
-
get ready() {
|
|
8780
|
+
get ready() { const { image } = this; return image && image.ready; }
|
|
8781
|
+
get image() { const { fill } = this.__; return fill instanceof Array && fill[0].image; }
|
|
8633
8782
|
constructor(data) {
|
|
8634
8783
|
super(data);
|
|
8635
|
-
this.on(ImageEvent.LOADED, (e) => {
|
|
8636
|
-
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8637
|
-
this.image = e.image;
|
|
8638
|
-
});
|
|
8639
|
-
}
|
|
8640
|
-
destroy() {
|
|
8641
|
-
this.image = null;
|
|
8642
|
-
super.destroy();
|
|
8643
8784
|
}
|
|
8644
8785
|
};
|
|
8645
8786
|
__decorate([
|
|
@@ -8655,11 +8796,11 @@ var LeaferUI = (function (exports) {
|
|
|
8655
8796
|
|
|
8656
8797
|
exports.Canvas = class Canvas extends exports.Rect {
|
|
8657
8798
|
get __tag() { return 'Canvas'; }
|
|
8799
|
+
get context() { return this.canvas.context; }
|
|
8658
8800
|
get ready() { return !this.url; }
|
|
8659
8801
|
constructor(data) {
|
|
8660
8802
|
super(data);
|
|
8661
8803
|
this.canvas = Creator.canvas(this.__);
|
|
8662
|
-
this.context = this.canvas.context;
|
|
8663
8804
|
if (data && data.url)
|
|
8664
8805
|
this.drawImage(data.url);
|
|
8665
8806
|
}
|
|
@@ -8703,7 +8844,7 @@ var LeaferUI = (function (exports) {
|
|
|
8703
8844
|
destroy() {
|
|
8704
8845
|
if (this.canvas) {
|
|
8705
8846
|
this.canvas.destroy();
|
|
8706
|
-
this.canvas =
|
|
8847
|
+
this.canvas = null;
|
|
8707
8848
|
}
|
|
8708
8849
|
super.destroy();
|
|
8709
8850
|
}
|
|
@@ -8749,7 +8890,7 @@ var LeaferUI = (function (exports) {
|
|
|
8749
8890
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8750
8891
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8751
8892
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8752
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8893
|
+
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__);
|
|
8753
8894
|
}
|
|
8754
8895
|
__updateBoxBounds() {
|
|
8755
8896
|
const data = this.__;
|
|
@@ -8779,12 +8920,11 @@ var LeaferUI = (function (exports) {
|
|
|
8779
8920
|
super.__updateBoxBounds();
|
|
8780
8921
|
if (italic)
|
|
8781
8922
|
b.width += fontSize * 0.16;
|
|
8782
|
-
|
|
8783
|
-
if (isOverflow)
|
|
8923
|
+
DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds));
|
|
8924
|
+
if (this.isOverflow)
|
|
8784
8925
|
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8785
8926
|
else
|
|
8786
8927
|
data.__textBoxBounds = b;
|
|
8787
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8788
8928
|
}
|
|
8789
8929
|
__onUpdateSize() {
|
|
8790
8930
|
if (this.__box)
|
|
@@ -8847,6 +8987,9 @@ var LeaferUI = (function (exports) {
|
|
|
8847
8987
|
__decorate([
|
|
8848
8988
|
boundsType('')
|
|
8849
8989
|
], exports.Text.prototype, "text", void 0);
|
|
8990
|
+
__decorate([
|
|
8991
|
+
boundsType('')
|
|
8992
|
+
], exports.Text.prototype, "placeholder", void 0);
|
|
8850
8993
|
__decorate([
|
|
8851
8994
|
boundsType('caption')
|
|
8852
8995
|
], exports.Text.prototype, "fontFamily", void 0);
|
|
@@ -8966,8 +9109,10 @@ var LeaferUI = (function (exports) {
|
|
|
8966
9109
|
}
|
|
8967
9110
|
|
|
8968
9111
|
function fillText(ui, canvas) {
|
|
8969
|
-
|
|
8970
|
-
|
|
9112
|
+
const data = ui.__, { rows, decorationY } = data.__textDrawData;
|
|
9113
|
+
if (data.__isPlacehold && data.placeholderColor)
|
|
9114
|
+
canvas.fillStyle = data.placeholderColor;
|
|
9115
|
+
let row;
|
|
8971
9116
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
8972
9117
|
row = rows[i];
|
|
8973
9118
|
if (row.text)
|
|
@@ -8976,7 +9121,7 @@ var LeaferUI = (function (exports) {
|
|
|
8976
9121
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
8977
9122
|
}
|
|
8978
9123
|
if (decorationY) {
|
|
8979
|
-
const { decorationColor, decorationHeight } = data;
|
|
9124
|
+
const { decorationColor, decorationHeight } = data.__textDrawData;
|
|
8980
9125
|
if (decorationColor)
|
|
8981
9126
|
canvas.fillStyle = decorationColor;
|
|
8982
9127
|
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
@@ -8985,65 +9130,596 @@ var LeaferUI = (function (exports) {
|
|
|
8985
9130
|
|
|
8986
9131
|
function fill(fill, ui, canvas) {
|
|
8987
9132
|
canvas.fillStyle = fill;
|
|
8988
|
-
|
|
9133
|
+
fillPathOrText(ui, canvas);
|
|
8989
9134
|
}
|
|
8990
9135
|
function fills(fills, ui, canvas) {
|
|
8991
9136
|
let item;
|
|
8992
|
-
const { windingRule, __font } = ui.__;
|
|
8993
9137
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
8994
9138
|
item = fills[i];
|
|
8995
|
-
if (item.image
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
|
|
9000
|
-
|
|
9001
|
-
|
|
9002
|
-
if (item.blendMode)
|
|
9003
|
-
canvas.blendMode = item.blendMode;
|
|
9004
|
-
__font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
|
|
9005
|
-
canvas.restore();
|
|
9139
|
+
if (item.image) {
|
|
9140
|
+
if (PaintImage.checkImage(ui, canvas, item, !ui.__.__font))
|
|
9141
|
+
continue;
|
|
9142
|
+
if (!item.style) {
|
|
9143
|
+
if (!i && item.image.isPlacehold)
|
|
9144
|
+
ui.drawImagePlaceholder(canvas, item.image);
|
|
9145
|
+
continue;
|
|
9006
9146
|
}
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9147
|
+
}
|
|
9148
|
+
canvas.fillStyle = item.style;
|
|
9149
|
+
if (item.transform) {
|
|
9150
|
+
canvas.save();
|
|
9151
|
+
canvas.transform(item.transform);
|
|
9152
|
+
if (item.blendMode)
|
|
9153
|
+
canvas.blendMode = item.blendMode;
|
|
9154
|
+
fillPathOrText(ui, canvas);
|
|
9155
|
+
canvas.restore();
|
|
9156
|
+
}
|
|
9157
|
+
else {
|
|
9158
|
+
if (item.blendMode) {
|
|
9159
|
+
canvas.saveBlendMode(item.blendMode);
|
|
9160
|
+
fillPathOrText(ui, canvas);
|
|
9161
|
+
canvas.restoreBlendMode();
|
|
9016
9162
|
}
|
|
9163
|
+
else
|
|
9164
|
+
fillPathOrText(ui, canvas);
|
|
9017
9165
|
}
|
|
9018
9166
|
}
|
|
9019
9167
|
}
|
|
9168
|
+
function fillPathOrText(ui, canvas) {
|
|
9169
|
+
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
9170
|
+
}
|
|
9171
|
+
|
|
9172
|
+
let App = class App extends exports.Leafer {
|
|
9173
|
+
get __tag() { return 'App'; }
|
|
9174
|
+
get isApp() { return true; }
|
|
9175
|
+
constructor(userConfig, data) {
|
|
9176
|
+
super(userConfig, data);
|
|
9177
|
+
}
|
|
9178
|
+
init(userConfig, parentApp) {
|
|
9179
|
+
super.init(userConfig, parentApp);
|
|
9180
|
+
if (userConfig) {
|
|
9181
|
+
const { ground, tree, sky, editor } = userConfig;
|
|
9182
|
+
if (ground)
|
|
9183
|
+
this.ground = this.addLeafer(ground);
|
|
9184
|
+
if (tree || editor)
|
|
9185
|
+
this.tree = this.addLeafer(tree || { type: userConfig.type || 'design' });
|
|
9186
|
+
if (sky || editor)
|
|
9187
|
+
this.sky = this.addLeafer(sky);
|
|
9188
|
+
if (editor)
|
|
9189
|
+
Creator.editor(editor, this);
|
|
9190
|
+
}
|
|
9191
|
+
}
|
|
9192
|
+
__setApp() {
|
|
9193
|
+
const { canvas } = this;
|
|
9194
|
+
const { realCanvas, view } = this.config;
|
|
9195
|
+
if (realCanvas || view === this.canvas.view || !canvas.parentView)
|
|
9196
|
+
this.realCanvas = true;
|
|
9197
|
+
else
|
|
9198
|
+
canvas.unrealCanvas();
|
|
9199
|
+
this.leafer = this;
|
|
9200
|
+
this.watcher.disable();
|
|
9201
|
+
this.layouter.disable();
|
|
9202
|
+
}
|
|
9203
|
+
__updateLocalBounds() {
|
|
9204
|
+
this.forEach(leafer => leafer.updateLayout());
|
|
9205
|
+
super.__updateLocalBounds();
|
|
9206
|
+
}
|
|
9207
|
+
start() {
|
|
9208
|
+
super.start();
|
|
9209
|
+
this.forEach(leafer => leafer.start());
|
|
9210
|
+
}
|
|
9211
|
+
stop() {
|
|
9212
|
+
this.forEach(leafer => leafer.stop());
|
|
9213
|
+
super.stop();
|
|
9214
|
+
}
|
|
9215
|
+
unlockLayout() {
|
|
9216
|
+
super.unlockLayout();
|
|
9217
|
+
this.forEach(leafer => leafer.unlockLayout());
|
|
9218
|
+
}
|
|
9219
|
+
lockLayout() {
|
|
9220
|
+
super.lockLayout();
|
|
9221
|
+
this.forEach(leafer => leafer.lockLayout());
|
|
9222
|
+
}
|
|
9223
|
+
forceRender(bounds, sync) {
|
|
9224
|
+
this.forEach(leafer => leafer.forceRender(bounds, sync));
|
|
9225
|
+
}
|
|
9226
|
+
addLeafer(merge) {
|
|
9227
|
+
const leafer = new exports.Leafer(merge);
|
|
9228
|
+
this.add(leafer);
|
|
9229
|
+
return leafer;
|
|
9230
|
+
}
|
|
9231
|
+
add(leafer, index) {
|
|
9232
|
+
if (!leafer.view) {
|
|
9233
|
+
if (this.realCanvas && !this.canvas.bounds) {
|
|
9234
|
+
setTimeout(() => this.add(leafer, index), 10);
|
|
9235
|
+
return;
|
|
9236
|
+
}
|
|
9237
|
+
leafer.init(this.__getChildConfig(leafer.userConfig), this);
|
|
9238
|
+
}
|
|
9239
|
+
super.add(leafer, index);
|
|
9240
|
+
if (index !== undefined)
|
|
9241
|
+
leafer.canvas.childIndex = index;
|
|
9242
|
+
this.__listenChildEvents(leafer);
|
|
9243
|
+
}
|
|
9244
|
+
forEach(fn) {
|
|
9245
|
+
this.children.forEach(fn);
|
|
9246
|
+
}
|
|
9247
|
+
__onCreated() {
|
|
9248
|
+
this.created = this.children.every(child => child.created);
|
|
9249
|
+
}
|
|
9250
|
+
__onReady() {
|
|
9251
|
+
if (this.children.every(child => child.ready))
|
|
9252
|
+
super.__onReady();
|
|
9253
|
+
}
|
|
9254
|
+
__onViewReady() {
|
|
9255
|
+
if (this.children.every(child => child.viewReady))
|
|
9256
|
+
super.__onViewReady();
|
|
9257
|
+
}
|
|
9258
|
+
__onChildRenderEnd(e) {
|
|
9259
|
+
this.renderer.addBlock(e.renderBounds);
|
|
9260
|
+
if (this.viewReady)
|
|
9261
|
+
this.renderer.update();
|
|
9262
|
+
}
|
|
9263
|
+
__render(canvas, options) {
|
|
9264
|
+
if (canvas.context)
|
|
9265
|
+
this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
|
|
9266
|
+
}
|
|
9267
|
+
__onResize(event) {
|
|
9268
|
+
this.forEach(leafer => leafer.resize(event));
|
|
9269
|
+
super.__onResize(event);
|
|
9270
|
+
}
|
|
9271
|
+
updateLayout() {
|
|
9272
|
+
this.forEach(leafer => leafer.updateLayout());
|
|
9273
|
+
}
|
|
9274
|
+
__getChildConfig(userConfig) {
|
|
9275
|
+
const config = Object.assign({}, this.config);
|
|
9276
|
+
config.hittable = config.realCanvas = undefined;
|
|
9277
|
+
if (userConfig)
|
|
9278
|
+
DataHelper.assign(config, userConfig);
|
|
9279
|
+
if (this.autoLayout)
|
|
9280
|
+
DataHelper.copyAttrs(config, this, canvasSizeAttrs);
|
|
9281
|
+
config.view = this.realCanvas ? undefined : this.view;
|
|
9282
|
+
config.fill = undefined;
|
|
9283
|
+
return config;
|
|
9284
|
+
}
|
|
9285
|
+
__listenChildEvents(leafer) {
|
|
9286
|
+
leafer.once([
|
|
9287
|
+
[LayoutEvent.END, this.__onReady, this],
|
|
9288
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
9289
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
9290
|
+
]);
|
|
9291
|
+
if (this.realCanvas)
|
|
9292
|
+
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9293
|
+
}
|
|
9294
|
+
};
|
|
9295
|
+
App = __decorate([
|
|
9296
|
+
registerUI()
|
|
9297
|
+
], App);
|
|
9298
|
+
|
|
9299
|
+
const downKeyMap = {};
|
|
9300
|
+
const Keyboard = {
|
|
9301
|
+
isHoldSpaceKey() {
|
|
9302
|
+
return Keyboard.isHold('Space');
|
|
9303
|
+
},
|
|
9304
|
+
isHold(code) {
|
|
9305
|
+
return downKeyMap[code];
|
|
9306
|
+
},
|
|
9307
|
+
setDownCode(code) {
|
|
9308
|
+
if (!downKeyMap[code])
|
|
9309
|
+
downKeyMap[code] = true;
|
|
9310
|
+
},
|
|
9311
|
+
setUpCode(code) {
|
|
9312
|
+
downKeyMap[code] = false;
|
|
9313
|
+
}
|
|
9314
|
+
};
|
|
9315
|
+
|
|
9316
|
+
const PointerButton = {
|
|
9317
|
+
LEFT: 1,
|
|
9318
|
+
RIGHT: 2,
|
|
9319
|
+
MIDDLE: 4,
|
|
9320
|
+
defaultLeft(event) { if (!event.buttons)
|
|
9321
|
+
event.buttons = 1; },
|
|
9322
|
+
left(event) { return event.buttons === 1; },
|
|
9323
|
+
right(event) { return event.buttons === 2; },
|
|
9324
|
+
middle(event) { return event.buttons === 4; }
|
|
9325
|
+
};
|
|
9326
|
+
|
|
9327
|
+
class UIEvent extends Event {
|
|
9328
|
+
get spaceKey() { return Keyboard.isHoldSpaceKey(); }
|
|
9329
|
+
get left() { return PointerButton.left(this); }
|
|
9330
|
+
get right() { return PointerButton.right(this); }
|
|
9331
|
+
get middle() { return PointerButton.middle(this); }
|
|
9332
|
+
constructor(params) {
|
|
9333
|
+
super(params.type);
|
|
9334
|
+
this.bubbles = true;
|
|
9335
|
+
Object.assign(this, params);
|
|
9336
|
+
}
|
|
9337
|
+
getBoxPoint(relative) {
|
|
9338
|
+
return (relative || this.current).getBoxPoint(this);
|
|
9339
|
+
}
|
|
9340
|
+
getInnerPoint(relative) {
|
|
9341
|
+
return (relative || this.current).getInnerPoint(this);
|
|
9342
|
+
}
|
|
9343
|
+
getLocalPoint(relative) {
|
|
9344
|
+
return (relative || this.current).getLocalPoint(this);
|
|
9345
|
+
}
|
|
9346
|
+
getPagePoint() {
|
|
9347
|
+
return this.current.getPagePoint(this);
|
|
9348
|
+
}
|
|
9349
|
+
getInner(relative) { return this.getInnerPoint(relative); }
|
|
9350
|
+
getLocal(relative) { return this.getLocalPoint(relative); }
|
|
9351
|
+
getPage() { return this.getPagePoint(); }
|
|
9352
|
+
static changeName(oldName, newName) {
|
|
9353
|
+
EventCreator.changeName(oldName, newName);
|
|
9354
|
+
}
|
|
9355
|
+
}
|
|
9356
|
+
|
|
9357
|
+
let PointerEvent$1 = class PointerEvent extends UIEvent {
|
|
9358
|
+
};
|
|
9359
|
+
PointerEvent$1.POINTER = 'pointer';
|
|
9360
|
+
PointerEvent$1.BEFORE_DOWN = 'pointer.before_down';
|
|
9361
|
+
PointerEvent$1.BEFORE_MOVE = 'pointer.before_move';
|
|
9362
|
+
PointerEvent$1.BEFORE_UP = 'pointer.before_up';
|
|
9363
|
+
PointerEvent$1.DOWN = 'pointer.down';
|
|
9364
|
+
PointerEvent$1.MOVE = 'pointer.move';
|
|
9365
|
+
PointerEvent$1.UP = 'pointer.up';
|
|
9366
|
+
PointerEvent$1.OVER = 'pointer.over';
|
|
9367
|
+
PointerEvent$1.OUT = 'pointer.out';
|
|
9368
|
+
PointerEvent$1.ENTER = 'pointer.enter';
|
|
9369
|
+
PointerEvent$1.LEAVE = 'pointer.leave';
|
|
9370
|
+
PointerEvent$1.TAP = 'tap';
|
|
9371
|
+
PointerEvent$1.DOUBLE_TAP = 'double_tap';
|
|
9372
|
+
PointerEvent$1.CLICK = 'click';
|
|
9373
|
+
PointerEvent$1.DOUBLE_CLICK = 'double_click';
|
|
9374
|
+
PointerEvent$1.LONG_PRESS = 'long_press';
|
|
9375
|
+
PointerEvent$1.LONG_TAP = 'long_tap';
|
|
9376
|
+
PointerEvent$1.MENU = 'pointer.menu';
|
|
9377
|
+
PointerEvent$1.MENU_TAP = 'pointer.menu_tap';
|
|
9378
|
+
PointerEvent$1 = __decorate([
|
|
9379
|
+
registerUIEvent()
|
|
9380
|
+
], PointerEvent$1);
|
|
9381
|
+
|
|
9382
|
+
const tempMove = {};
|
|
9383
|
+
let DragEvent$1 = class DragEvent extends PointerEvent$1 {
|
|
9384
|
+
static setList(data) {
|
|
9385
|
+
this.list = data instanceof LeafList ? data : new LeafList(data);
|
|
9386
|
+
}
|
|
9387
|
+
static setData(data) {
|
|
9388
|
+
this.data = data;
|
|
9389
|
+
}
|
|
9390
|
+
static getValidMove(leaf, start, total) {
|
|
9391
|
+
const { draggable, dragBounds } = leaf, move = leaf.getLocalPoint(total, null, true);
|
|
9392
|
+
PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
|
|
9393
|
+
if (dragBounds)
|
|
9394
|
+
this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
|
|
9395
|
+
if (draggable === 'x')
|
|
9396
|
+
move.y = 0;
|
|
9397
|
+
if (draggable === 'y')
|
|
9398
|
+
move.x = 0;
|
|
9399
|
+
return move;
|
|
9400
|
+
}
|
|
9401
|
+
static getMoveInDragBounds(childBox, dragBounds, move, change) {
|
|
9402
|
+
const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
|
|
9403
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9404
|
+
if (!change)
|
|
9405
|
+
move = Object.assign({}, move);
|
|
9406
|
+
if (BoundsHelper.includes(childBox, dragBounds)) {
|
|
9407
|
+
if (x > dragBounds.x)
|
|
9408
|
+
move.x += dragBounds.x - x;
|
|
9409
|
+
else if (right < boundsRight)
|
|
9410
|
+
move.x += boundsRight - right;
|
|
9411
|
+
if (y > dragBounds.y)
|
|
9412
|
+
move.y += dragBounds.y - y;
|
|
9413
|
+
else if (bottom < boundsBottom)
|
|
9414
|
+
move.y += boundsBottom - bottom;
|
|
9415
|
+
}
|
|
9416
|
+
else {
|
|
9417
|
+
if (x < dragBounds.x)
|
|
9418
|
+
move.x += dragBounds.x - x;
|
|
9419
|
+
else if (right > boundsRight)
|
|
9420
|
+
move.x += boundsRight - right;
|
|
9421
|
+
if (y < dragBounds.y)
|
|
9422
|
+
move.y += dragBounds.y - y;
|
|
9423
|
+
else if (bottom > boundsBottom)
|
|
9424
|
+
move.y += boundsBottom - bottom;
|
|
9425
|
+
}
|
|
9426
|
+
return move;
|
|
9427
|
+
}
|
|
9428
|
+
getPageMove(total) {
|
|
9429
|
+
this.assignMove(total);
|
|
9430
|
+
return this.current.getPagePoint(tempMove, null, true);
|
|
9431
|
+
}
|
|
9432
|
+
getInnerMove(relative, total) {
|
|
9433
|
+
if (!relative)
|
|
9434
|
+
relative = this.current;
|
|
9435
|
+
this.assignMove(total);
|
|
9436
|
+
return relative.getInnerPoint(tempMove, null, true);
|
|
9437
|
+
}
|
|
9438
|
+
getLocalMove(relative, total) {
|
|
9439
|
+
if (!relative)
|
|
9440
|
+
relative = this.current;
|
|
9441
|
+
this.assignMove(total);
|
|
9442
|
+
return relative.getLocalPoint(tempMove, null, true);
|
|
9443
|
+
}
|
|
9444
|
+
getPageTotal() {
|
|
9445
|
+
return this.getPageMove(true);
|
|
9446
|
+
}
|
|
9447
|
+
getInnerTotal(relative) {
|
|
9448
|
+
return this.getInnerMove(relative, true);
|
|
9449
|
+
}
|
|
9450
|
+
getLocalTotal(relative) {
|
|
9451
|
+
return this.getLocalMove(relative, true);
|
|
9452
|
+
}
|
|
9453
|
+
getPageBounds() {
|
|
9454
|
+
const total = this.getPageTotal(), start = this.getPagePoint(), bounds = {};
|
|
9455
|
+
BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
|
|
9456
|
+
BoundsHelper.unsign(bounds);
|
|
9457
|
+
return bounds;
|
|
9458
|
+
}
|
|
9459
|
+
assignMove(total) {
|
|
9460
|
+
tempMove.x = total ? this.totalX : this.moveX;
|
|
9461
|
+
tempMove.y = total ? this.totalY : this.moveY;
|
|
9462
|
+
}
|
|
9463
|
+
};
|
|
9464
|
+
DragEvent$1.BEFORE_DRAG = 'drag.before_drag';
|
|
9465
|
+
DragEvent$1.START = 'drag.start';
|
|
9466
|
+
DragEvent$1.DRAG = 'drag';
|
|
9467
|
+
DragEvent$1.END = 'drag.end';
|
|
9468
|
+
DragEvent$1.OVER = 'drag.over';
|
|
9469
|
+
DragEvent$1.OUT = 'drag.out';
|
|
9470
|
+
DragEvent$1.ENTER = 'drag.enter';
|
|
9471
|
+
DragEvent$1.LEAVE = 'drag.leave';
|
|
9472
|
+
DragEvent$1 = __decorate([
|
|
9473
|
+
registerUIEvent()
|
|
9474
|
+
], DragEvent$1);
|
|
9475
|
+
|
|
9476
|
+
let DropEvent = class DropEvent extends PointerEvent$1 {
|
|
9477
|
+
static setList(data) {
|
|
9478
|
+
DragEvent$1.setList(data);
|
|
9479
|
+
}
|
|
9480
|
+
static setData(data) {
|
|
9481
|
+
DragEvent$1.setData(data);
|
|
9482
|
+
}
|
|
9483
|
+
};
|
|
9484
|
+
DropEvent.DROP = 'drop';
|
|
9485
|
+
DropEvent = __decorate([
|
|
9486
|
+
registerUIEvent()
|
|
9487
|
+
], DropEvent);
|
|
9488
|
+
|
|
9489
|
+
let MoveEvent = class MoveEvent extends DragEvent$1 {
|
|
9490
|
+
};
|
|
9491
|
+
MoveEvent.BEFORE_MOVE = 'move.before_move';
|
|
9492
|
+
MoveEvent.START = 'move.start';
|
|
9493
|
+
MoveEvent.MOVE = 'move';
|
|
9494
|
+
MoveEvent.END = 'move.end';
|
|
9495
|
+
MoveEvent = __decorate([
|
|
9496
|
+
registerUIEvent()
|
|
9497
|
+
], MoveEvent);
|
|
9498
|
+
|
|
9499
|
+
let RotateEvent = class RotateEvent extends PointerEvent$1 {
|
|
9500
|
+
};
|
|
9501
|
+
RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
|
|
9502
|
+
RotateEvent.START = 'rotate.start';
|
|
9503
|
+
RotateEvent.ROTATE = 'rotate';
|
|
9504
|
+
RotateEvent.END = 'rotate.end';
|
|
9505
|
+
RotateEvent = __decorate([
|
|
9506
|
+
registerUIEvent()
|
|
9507
|
+
], RotateEvent);
|
|
9508
|
+
|
|
9509
|
+
let SwipeEvent = class SwipeEvent extends DragEvent$1 {
|
|
9510
|
+
};
|
|
9511
|
+
SwipeEvent.SWIPE = 'swipe';
|
|
9512
|
+
SwipeEvent.LEFT = 'swipe.left';
|
|
9513
|
+
SwipeEvent.RIGHT = 'swipe.right';
|
|
9514
|
+
SwipeEvent.UP = 'swipe.up';
|
|
9515
|
+
SwipeEvent.DOWN = 'swipe.down';
|
|
9516
|
+
SwipeEvent = __decorate([
|
|
9517
|
+
registerUIEvent()
|
|
9518
|
+
], SwipeEvent);
|
|
9519
|
+
|
|
9520
|
+
let ZoomEvent = class ZoomEvent extends PointerEvent$1 {
|
|
9521
|
+
};
|
|
9522
|
+
ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
|
|
9523
|
+
ZoomEvent.START = 'zoom.start';
|
|
9524
|
+
ZoomEvent.ZOOM = 'zoom';
|
|
9525
|
+
ZoomEvent.END = 'zoom.end';
|
|
9526
|
+
ZoomEvent = __decorate([
|
|
9527
|
+
registerUIEvent()
|
|
9528
|
+
], ZoomEvent);
|
|
9529
|
+
|
|
9530
|
+
let KeyEvent = class KeyEvent extends UIEvent {
|
|
9531
|
+
};
|
|
9532
|
+
KeyEvent.DOWN = 'key.down';
|
|
9533
|
+
KeyEvent.HOLD = 'key.hold';
|
|
9534
|
+
KeyEvent.UP = 'key.up';
|
|
9535
|
+
KeyEvent = __decorate([
|
|
9536
|
+
registerUIEvent()
|
|
9537
|
+
], KeyEvent);
|
|
9538
|
+
|
|
9539
|
+
new LeafList();
|
|
9540
|
+
|
|
9541
|
+
Debug.get('emit');
|
|
9542
|
+
|
|
9543
|
+
const { toInnerRadiusPointOf, copy: copy$2, setRadius } = PointHelper;
|
|
9544
|
+
const inner = {};
|
|
9545
|
+
const leaf = exports.Leaf.prototype;
|
|
9546
|
+
leaf.__hitWorld = function (point) {
|
|
9547
|
+
const data = this.__;
|
|
9548
|
+
if (!data.hitSelf)
|
|
9549
|
+
return false;
|
|
9550
|
+
const world = this.__world, layout = this.__layout;
|
|
9551
|
+
const isSmall = world.width < 10 && world.height < 10;
|
|
9552
|
+
if (data.hitRadius) {
|
|
9553
|
+
copy$2(inner, point), point = inner;
|
|
9554
|
+
setRadius(point, data.hitRadius);
|
|
9555
|
+
}
|
|
9556
|
+
toInnerRadiusPointOf(point, world, inner);
|
|
9557
|
+
if (data.hitBox || isSmall) {
|
|
9558
|
+
if (BoundsHelper.hitRadiusPoint(layout.boxBounds, inner))
|
|
9559
|
+
return true;
|
|
9560
|
+
if (isSmall)
|
|
9561
|
+
return false;
|
|
9562
|
+
}
|
|
9563
|
+
if (layout.hitCanvasChanged || !this.__hitCanvas) {
|
|
9564
|
+
this.__updateHitCanvas();
|
|
9565
|
+
if (!layout.boundsChanged)
|
|
9566
|
+
layout.hitCanvasChanged = false;
|
|
9567
|
+
}
|
|
9568
|
+
return this.__hit(inner);
|
|
9569
|
+
};
|
|
9570
|
+
leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
|
|
9571
|
+
leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
|
|
9572
|
+
leaf.__hitPixel = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitPixel(inner, this.__layout.renderBounds, this.__hitCanvas.hitScale); };
|
|
9573
|
+
leaf.__drawHitPath = function (canvas) { if (canvas)
|
|
9574
|
+
this.__drawRenderPath(canvas); };
|
|
9575
|
+
|
|
9576
|
+
const matrix = new Matrix();
|
|
9577
|
+
const ui$1 = exports.UI.prototype;
|
|
9578
|
+
ui$1.__updateHitCanvas = function () {
|
|
9579
|
+
if (this.__box)
|
|
9580
|
+
this.__box.__updateHitCanvas();
|
|
9581
|
+
const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
|
|
9582
|
+
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
9583
|
+
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
9584
|
+
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
9585
|
+
if (!this.__hitCanvas)
|
|
9586
|
+
this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
|
|
9587
|
+
const h = this.__hitCanvas;
|
|
9588
|
+
if (isHitPixel) {
|
|
9589
|
+
const { renderBounds } = this.__layout;
|
|
9590
|
+
const size = Platform.image.hitCanvasSize;
|
|
9591
|
+
const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds).a;
|
|
9592
|
+
const { x, y, width, height } = tempBounds$1.set(renderBounds).scale(scale);
|
|
9593
|
+
h.resize({ width, height, pixelRatio: 1 });
|
|
9594
|
+
h.clear();
|
|
9595
|
+
ImageManager.patternLocked = true;
|
|
9596
|
+
this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y) }, !isHitPixelFill, !isHitPixelStroke);
|
|
9597
|
+
ImageManager.patternLocked = false;
|
|
9598
|
+
h.resetTransform();
|
|
9599
|
+
data.__isHitPixel = true;
|
|
9600
|
+
}
|
|
9601
|
+
else {
|
|
9602
|
+
data.__isHitPixel && (data.__isHitPixel = false);
|
|
9603
|
+
}
|
|
9604
|
+
this.__drawHitPath(h);
|
|
9605
|
+
h.setStrokeOptions(data);
|
|
9606
|
+
};
|
|
9607
|
+
ui$1.__hit = function (inner) {
|
|
9608
|
+
if (this.__box && this.__box.__hit(inner))
|
|
9609
|
+
return true;
|
|
9610
|
+
const data = this.__;
|
|
9611
|
+
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
9612
|
+
return true;
|
|
9613
|
+
const { hitFill } = data;
|
|
9614
|
+
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
9615
|
+
if (needHitFillPath && this.__hitFill(inner))
|
|
9616
|
+
return true;
|
|
9617
|
+
const { hitStroke, __strokeWidth } = data;
|
|
9618
|
+
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
9619
|
+
if (!needHitFillPath && !needHitStrokePath)
|
|
9620
|
+
return false;
|
|
9621
|
+
const radiusWidth = inner.radiusX * 2;
|
|
9622
|
+
let hitWidth = radiusWidth;
|
|
9623
|
+
if (needHitStrokePath) {
|
|
9624
|
+
switch (data.strokeAlign) {
|
|
9625
|
+
case 'inside':
|
|
9626
|
+
hitWidth += __strokeWidth * 2;
|
|
9627
|
+
if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
9628
|
+
return true;
|
|
9629
|
+
hitWidth = radiusWidth;
|
|
9630
|
+
break;
|
|
9631
|
+
case 'center':
|
|
9632
|
+
hitWidth += __strokeWidth;
|
|
9633
|
+
break;
|
|
9634
|
+
case 'outside':
|
|
9635
|
+
hitWidth += __strokeWidth * 2;
|
|
9636
|
+
if (!needHitFillPath) {
|
|
9637
|
+
if (!this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
9638
|
+
return true;
|
|
9639
|
+
hitWidth = radiusWidth;
|
|
9640
|
+
}
|
|
9641
|
+
break;
|
|
9642
|
+
}
|
|
9643
|
+
}
|
|
9644
|
+
return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
|
|
9645
|
+
};
|
|
9646
|
+
|
|
9647
|
+
const ui = exports.UI.prototype, rect = exports.Rect.prototype, box$1 = exports.Box.prototype;
|
|
9648
|
+
rect.__updateHitCanvas = box$1.__updateHitCanvas = function () {
|
|
9649
|
+
if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
|
|
9650
|
+
ui.__updateHitCanvas.call(this);
|
|
9651
|
+
else if (this.__hitCanvas)
|
|
9652
|
+
this.__hitCanvas = null;
|
|
9653
|
+
};
|
|
9654
|
+
rect.__hitFill = box$1.__hitFill = function (inner) {
|
|
9655
|
+
return this.__hitCanvas ? ui.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
|
|
9656
|
+
};
|
|
9657
|
+
|
|
9658
|
+
exports.Text.prototype.__drawHitPath = function (canvas) {
|
|
9659
|
+
const { __lineHeight, fontSize, __baseLine, __letterSpacing, __textDrawData: data } = this.__;
|
|
9660
|
+
canvas.beginPath();
|
|
9661
|
+
if (__letterSpacing < 0)
|
|
9662
|
+
this.__drawPathByBox(canvas);
|
|
9663
|
+
else
|
|
9664
|
+
data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
|
|
9665
|
+
};
|
|
9666
|
+
|
|
9667
|
+
function getSelector(ui) {
|
|
9668
|
+
return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
|
|
9669
|
+
}
|
|
9670
|
+
exports.Group.prototype.pick = function (hitPoint, options) {
|
|
9671
|
+
options || (options = emptyData);
|
|
9672
|
+
this.updateLayout();
|
|
9673
|
+
return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
|
|
9674
|
+
};
|
|
9675
|
+
|
|
9676
|
+
const canvas = LeaferCanvasBase.prototype;
|
|
9677
|
+
canvas.hitFill = function (point, fillRule) {
|
|
9678
|
+
return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
|
|
9679
|
+
};
|
|
9680
|
+
canvas.hitStroke = function (point, strokeWidth) {
|
|
9681
|
+
this.strokeWidth = strokeWidth;
|
|
9682
|
+
return this.context.isPointInStroke(point.x, point.y);
|
|
9683
|
+
};
|
|
9684
|
+
canvas.hitPixel = function (radiusPoint, offset, scale = 1) {
|
|
9685
|
+
let { x, y, radiusX, radiusY } = radiusPoint;
|
|
9686
|
+
if (offset)
|
|
9687
|
+
x -= offset.x, y -= offset.y;
|
|
9688
|
+
tempBounds$1.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
|
|
9689
|
+
const { data } = this.context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width || 1, tempBounds$1.height || 1);
|
|
9690
|
+
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
9691
|
+
if (data[i + 3] > 0)
|
|
9692
|
+
return true;
|
|
9693
|
+
}
|
|
9694
|
+
return data[3] > 0;
|
|
9695
|
+
};
|
|
9020
9696
|
|
|
9021
9697
|
function strokeText(stroke, ui, canvas) {
|
|
9022
|
-
|
|
9023
|
-
const isStrokes = typeof stroke !== 'string';
|
|
9024
|
-
switch (strokeAlign) {
|
|
9698
|
+
switch (ui.__.strokeAlign) {
|
|
9025
9699
|
case 'center':
|
|
9026
|
-
|
|
9027
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
9700
|
+
drawCenter$1(stroke, 1, ui, canvas);
|
|
9028
9701
|
break;
|
|
9029
9702
|
case 'inside':
|
|
9030
|
-
|
|
9703
|
+
drawAlign(stroke, 'inside', ui, canvas);
|
|
9031
9704
|
break;
|
|
9032
9705
|
case 'outside':
|
|
9033
|
-
|
|
9706
|
+
ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, 'outside', ui, canvas);
|
|
9034
9707
|
break;
|
|
9035
9708
|
}
|
|
9036
9709
|
}
|
|
9037
|
-
function
|
|
9038
|
-
const
|
|
9710
|
+
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
9711
|
+
const data = ui.__;
|
|
9712
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
|
|
9713
|
+
data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
9714
|
+
}
|
|
9715
|
+
function drawAlign(stroke, align, ui, canvas) {
|
|
9039
9716
|
const out = canvas.getSameCanvas(true, true);
|
|
9040
|
-
out.
|
|
9041
|
-
|
|
9042
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
|
|
9717
|
+
out.font = ui.__.__font;
|
|
9718
|
+
drawCenter$1(stroke, 2, ui, out);
|
|
9043
9719
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
9044
9720
|
fillText(ui, out);
|
|
9045
9721
|
out.blendMode = 'normal';
|
|
9046
|
-
if (ui.__worldFlipped)
|
|
9722
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
9047
9723
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9048
9724
|
else
|
|
9049
9725
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
@@ -9085,90 +9761,60 @@ var LeaferUI = (function (exports) {
|
|
|
9085
9761
|
}
|
|
9086
9762
|
|
|
9087
9763
|
function stroke(stroke, ui, canvas) {
|
|
9088
|
-
const
|
|
9089
|
-
|
|
9090
|
-
if (!__strokeWidth)
|
|
9764
|
+
const data = ui.__;
|
|
9765
|
+
if (!data.__strokeWidth)
|
|
9091
9766
|
return;
|
|
9092
|
-
if (__font) {
|
|
9767
|
+
if (data.__font) {
|
|
9093
9768
|
strokeText(stroke, ui, canvas);
|
|
9094
9769
|
}
|
|
9095
9770
|
else {
|
|
9096
|
-
switch (strokeAlign) {
|
|
9771
|
+
switch (data.strokeAlign) {
|
|
9097
9772
|
case 'center':
|
|
9098
|
-
|
|
9099
|
-
canvas.stroke();
|
|
9100
|
-
if (options.__useArrow)
|
|
9101
|
-
strokeArrow(ui, canvas);
|
|
9773
|
+
drawCenter(stroke, 1, ui, canvas);
|
|
9102
9774
|
break;
|
|
9103
9775
|
case 'inside':
|
|
9104
|
-
canvas
|
|
9105
|
-
canvas.setStroke(stroke, __strokeWidth * 2, options);
|
|
9106
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
9107
|
-
canvas.stroke();
|
|
9108
|
-
canvas.restore();
|
|
9776
|
+
drawInside(stroke, ui, canvas);
|
|
9109
9777
|
break;
|
|
9110
9778
|
case 'outside':
|
|
9111
|
-
|
|
9112
|
-
out.setStroke(stroke, __strokeWidth * 2, options);
|
|
9113
|
-
ui.__drawRenderPath(out);
|
|
9114
|
-
out.stroke();
|
|
9115
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
9116
|
-
out.clearWorld(ui.__layout.renderBounds);
|
|
9117
|
-
if (ui.__worldFlipped)
|
|
9118
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9119
|
-
else
|
|
9120
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
9121
|
-
out.recycle(ui.__nowWorld);
|
|
9779
|
+
drawOutside(stroke, ui, canvas);
|
|
9122
9780
|
break;
|
|
9123
9781
|
}
|
|
9124
9782
|
}
|
|
9125
9783
|
}
|
|
9126
9784
|
function strokes(strokes, ui, canvas) {
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9785
|
+
stroke(strokes, ui, canvas);
|
|
9786
|
+
}
|
|
9787
|
+
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
9788
|
+
const data = ui.__;
|
|
9789
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
9790
|
+
data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
|
|
9791
|
+
if (data.__useArrow)
|
|
9792
|
+
Paint.strokeArrow(stroke, ui, canvas);
|
|
9793
|
+
}
|
|
9794
|
+
function drawInside(stroke, ui, canvas) {
|
|
9795
|
+
const data = ui.__;
|
|
9796
|
+
canvas.save();
|
|
9797
|
+
data.windingRule ? canvas.clip(data.windingRule) : canvas.clip();
|
|
9798
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
9799
|
+
canvas.restore();
|
|
9800
|
+
}
|
|
9801
|
+
function drawOutside(stroke, ui, canvas) {
|
|
9802
|
+
const data = ui.__;
|
|
9803
|
+
if (data.__fillAfterStroke) {
|
|
9804
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
9133
9805
|
}
|
|
9134
9806
|
else {
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
drawStrokesStyle(strokes, false, ui, canvas);
|
|
9147
|
-
canvas.restore();
|
|
9148
|
-
break;
|
|
9149
|
-
case 'outside':
|
|
9150
|
-
const { renderBounds } = ui.__layout;
|
|
9151
|
-
const out = canvas.getSameCanvas(true, true);
|
|
9152
|
-
ui.__drawRenderPath(out);
|
|
9153
|
-
out.setStroke(undefined, __strokeWidth * 2, options);
|
|
9154
|
-
drawStrokesStyle(strokes, false, ui, out);
|
|
9155
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
9156
|
-
out.clearWorld(renderBounds);
|
|
9157
|
-
if (ui.__worldFlipped)
|
|
9158
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9159
|
-
else
|
|
9160
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
9161
|
-
out.recycle(ui.__nowWorld);
|
|
9162
|
-
break;
|
|
9163
|
-
}
|
|
9164
|
-
}
|
|
9165
|
-
}
|
|
9166
|
-
function strokeArrow(ui, canvas) {
|
|
9167
|
-
if (ui.__.dashPattern) {
|
|
9168
|
-
canvas.beginPath();
|
|
9169
|
-
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
9170
|
-
canvas.dashPattern = null;
|
|
9171
|
-
canvas.stroke();
|
|
9807
|
+
const { renderBounds } = ui.__layout;
|
|
9808
|
+
const out = canvas.getSameCanvas(true, true);
|
|
9809
|
+
ui.__drawRenderPath(out);
|
|
9810
|
+
drawCenter(stroke, 2, ui, out);
|
|
9811
|
+
data.windingRule ? out.clip(data.windingRule) : out.clip();
|
|
9812
|
+
out.clearWorld(renderBounds);
|
|
9813
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
9814
|
+
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9815
|
+
else
|
|
9816
|
+
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
9817
|
+
out.recycle(ui.__nowWorld);
|
|
9172
9818
|
}
|
|
9173
9819
|
}
|
|
9174
9820
|
|
|
@@ -9215,9 +9861,10 @@ var LeaferUI = (function (exports) {
|
|
|
9215
9861
|
}
|
|
9216
9862
|
|
|
9217
9863
|
let recycleMap;
|
|
9864
|
+
const { stintSet } = DataHelper, { hasTransparent: hasTransparent$1 } = ColorConvert;
|
|
9218
9865
|
function compute(attrName, ui) {
|
|
9219
9866
|
const data = ui.__, leafPaints = [];
|
|
9220
|
-
let paints = data.__input[attrName],
|
|
9867
|
+
let paints = data.__input[attrName], isAlphaPixel, isTransparent;
|
|
9221
9868
|
if (!(paints instanceof Array))
|
|
9222
9869
|
paints = [paints];
|
|
9223
9870
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
@@ -9227,35 +9874,62 @@ var LeaferUI = (function (exports) {
|
|
|
9227
9874
|
leafPaints.push(item);
|
|
9228
9875
|
}
|
|
9229
9876
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
9230
|
-
if (leafPaints.length
|
|
9231
|
-
|
|
9232
|
-
|
|
9877
|
+
if (leafPaints.length) {
|
|
9878
|
+
if (leafPaints.every(item => item.isTransparent)) {
|
|
9879
|
+
if (leafPaints.some(item => item.image))
|
|
9880
|
+
isAlphaPixel = true;
|
|
9881
|
+
isTransparent = true;
|
|
9882
|
+
}
|
|
9883
|
+
}
|
|
9884
|
+
if (attrName === 'fill') {
|
|
9885
|
+
stintSet(data, '__isAlphaPixelFill', isAlphaPixel);
|
|
9886
|
+
stintSet(data, '__isTransparentFill', isTransparent);
|
|
9887
|
+
}
|
|
9888
|
+
else {
|
|
9889
|
+
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
9890
|
+
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
9891
|
+
}
|
|
9233
9892
|
}
|
|
9234
9893
|
function getLeafPaint(attrName, paint, ui) {
|
|
9235
9894
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
|
9236
9895
|
return undefined;
|
|
9896
|
+
let data;
|
|
9237
9897
|
const { boxBounds } = ui.__layout;
|
|
9238
9898
|
switch (paint.type) {
|
|
9239
|
-
case 'solid':
|
|
9240
|
-
let { type, blendMode, color, opacity } = paint;
|
|
9241
|
-
return { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
9242
9899
|
case 'image':
|
|
9243
|
-
|
|
9900
|
+
data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
9901
|
+
break;
|
|
9244
9902
|
case 'linear':
|
|
9245
|
-
|
|
9903
|
+
data = PaintGradient.linearGradient(paint, boxBounds);
|
|
9904
|
+
break;
|
|
9246
9905
|
case 'radial':
|
|
9247
|
-
|
|
9906
|
+
data = PaintGradient.radialGradient(paint, boxBounds);
|
|
9907
|
+
break;
|
|
9248
9908
|
case 'angular':
|
|
9249
|
-
|
|
9909
|
+
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
9910
|
+
break;
|
|
9911
|
+
case 'solid':
|
|
9912
|
+
const { type, blendMode, color, opacity } = paint;
|
|
9913
|
+
data = { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
9914
|
+
break;
|
|
9250
9915
|
default:
|
|
9251
|
-
|
|
9916
|
+
if (paint.r !== undefined)
|
|
9917
|
+
data = { type: 'solid', style: ColorConvert.string(paint) };
|
|
9252
9918
|
}
|
|
9919
|
+
if (data) {
|
|
9920
|
+
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
9921
|
+
data.isTransparent = true;
|
|
9922
|
+
if (paint.blendMode)
|
|
9923
|
+
data.blendMode = paint.blendMode;
|
|
9924
|
+
}
|
|
9925
|
+
return data;
|
|
9253
9926
|
}
|
|
9254
9927
|
|
|
9255
9928
|
const PaintModule = {
|
|
9256
9929
|
compute,
|
|
9257
9930
|
fill,
|
|
9258
9931
|
fills,
|
|
9932
|
+
fillPathOrText,
|
|
9259
9933
|
fillText,
|
|
9260
9934
|
stroke,
|
|
9261
9935
|
strokes,
|
|
@@ -9314,12 +9988,10 @@ var LeaferUI = (function (exports) {
|
|
|
9314
9988
|
|
|
9315
9989
|
const { get: get$2, translate } = MatrixHelper;
|
|
9316
9990
|
const tempBox = new Bounds();
|
|
9317
|
-
const tempPoint = {};
|
|
9318
9991
|
const tempScaleData = {};
|
|
9992
|
+
const tempImage = {};
|
|
9319
9993
|
function createData(leafPaint, image, paint, box) {
|
|
9320
|
-
const {
|
|
9321
|
-
if (blendMode)
|
|
9322
|
-
leafPaint.blendMode = blendMode;
|
|
9994
|
+
const { changeful, sync } = paint;
|
|
9323
9995
|
if (changeful)
|
|
9324
9996
|
leafPaint.changeful = changeful;
|
|
9325
9997
|
if (sync)
|
|
@@ -9327,38 +9999,38 @@ var LeaferUI = (function (exports) {
|
|
|
9327
9999
|
leafPaint.data = getPatternData(paint, box, image);
|
|
9328
10000
|
}
|
|
9329
10001
|
function getPatternData(paint, box, image) {
|
|
9330
|
-
let { width, height } = image;
|
|
9331
10002
|
if (paint.padding)
|
|
9332
10003
|
box = tempBox.set(box).shrink(paint.padding);
|
|
9333
10004
|
if (paint.mode === 'strench')
|
|
9334
10005
|
paint.mode = 'stretch';
|
|
10006
|
+
let { width, height } = image;
|
|
9335
10007
|
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
9336
10008
|
const sameBox = box.width === width && box.height === height;
|
|
9337
10009
|
const data = { mode };
|
|
9338
10010
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
9339
|
-
|
|
9340
|
-
let
|
|
10011
|
+
BoundsHelper.set(tempImage, 0, 0, swapSize ? height : width, swapSize ? width : height);
|
|
10012
|
+
let scaleX, scaleY;
|
|
9341
10013
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
9342
10014
|
if (!sameBox || rotation) {
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
10015
|
+
scaleX = scaleY = BoundsHelper.getFitScale(box, tempImage, mode !== 'fit');
|
|
10016
|
+
BoundsHelper.put(box, image, align, scaleX, false, tempImage);
|
|
10017
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
9346
10018
|
}
|
|
9347
10019
|
}
|
|
9348
|
-
else
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
10020
|
+
else {
|
|
10021
|
+
if (scale || size) {
|
|
10022
|
+
MathHelper.getScaleData(scale, size, image, tempScaleData);
|
|
10023
|
+
scaleX = tempScaleData.scaleX;
|
|
10024
|
+
scaleY = tempScaleData.scaleY;
|
|
10025
|
+
}
|
|
10026
|
+
if (align) {
|
|
10027
|
+
if (scaleX)
|
|
10028
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
10029
|
+
AlignHelper.toPoint(align, tempImage, box, tempImage, true, true);
|
|
10030
|
+
}
|
|
9359
10031
|
}
|
|
9360
10032
|
if (offset)
|
|
9361
|
-
|
|
10033
|
+
PointHelper.move(tempImage, offset);
|
|
9362
10034
|
switch (mode) {
|
|
9363
10035
|
case 'stretch':
|
|
9364
10036
|
if (!sameBox)
|
|
@@ -9366,12 +10038,12 @@ var LeaferUI = (function (exports) {
|
|
|
9366
10038
|
break;
|
|
9367
10039
|
case 'normal':
|
|
9368
10040
|
case 'clip':
|
|
9369
|
-
if (x || y || scaleX || rotation)
|
|
9370
|
-
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
10041
|
+
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
10042
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9371
10043
|
break;
|
|
9372
10044
|
case 'repeat':
|
|
9373
10045
|
if (!sameBox || scaleX || rotation)
|
|
9374
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
10046
|
+
repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, align);
|
|
9375
10047
|
if (!repeat)
|
|
9376
10048
|
data.repeat = 'repeat';
|
|
9377
10049
|
break;
|
|
@@ -9379,7 +10051,7 @@ var LeaferUI = (function (exports) {
|
|
|
9379
10051
|
case 'cover':
|
|
9380
10052
|
default:
|
|
9381
10053
|
if (scaleX)
|
|
9382
|
-
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
10054
|
+
fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9383
10055
|
}
|
|
9384
10056
|
if (!data.transform) {
|
|
9385
10057
|
if (box.x || box.y) {
|
|
@@ -9412,6 +10084,8 @@ var LeaferUI = (function (exports) {
|
|
|
9412
10084
|
}
|
|
9413
10085
|
else {
|
|
9414
10086
|
leafPaint = { type: paint.type, image };
|
|
10087
|
+
if (image.hasAlphaPixel)
|
|
10088
|
+
leafPaint.isTransparent = true;
|
|
9415
10089
|
cache = image.use > 1 ? { leafPaint, paint, boxBounds: box.set(boxBounds) } : null;
|
|
9416
10090
|
}
|
|
9417
10091
|
if (firstUse || image.loading)
|
|
@@ -9436,7 +10110,7 @@ var LeaferUI = (function (exports) {
|
|
|
9436
10110
|
ignoreRender(ui, false);
|
|
9437
10111
|
if (!ui.destroyed) {
|
|
9438
10112
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
9439
|
-
if (image.
|
|
10113
|
+
if (image.hasAlphaPixel)
|
|
9440
10114
|
ui.__layout.hitCanvasChanged = true;
|
|
9441
10115
|
ui.forceUpdate('surface');
|
|
9442
10116
|
}
|
|
@@ -9448,6 +10122,17 @@ var LeaferUI = (function (exports) {
|
|
|
9448
10122
|
onLoadError(ui, event, error);
|
|
9449
10123
|
leafPaint.loadId = null;
|
|
9450
10124
|
});
|
|
10125
|
+
if (ui.placeholderColor) {
|
|
10126
|
+
if (!ui.placeholderDelay)
|
|
10127
|
+
image.isPlacehold = true;
|
|
10128
|
+
else
|
|
10129
|
+
setTimeout(() => {
|
|
10130
|
+
if (!image.ready) {
|
|
10131
|
+
image.isPlacehold = true;
|
|
10132
|
+
ui.forceUpdate('surface');
|
|
10133
|
+
}
|
|
10134
|
+
}, ui.placeholderDelay);
|
|
10135
|
+
}
|
|
9451
10136
|
}
|
|
9452
10137
|
return leafPaint;
|
|
9453
10138
|
}
|
|
@@ -9653,32 +10338,33 @@ var LeaferUI = (function (exports) {
|
|
|
9653
10338
|
repeatMode
|
|
9654
10339
|
};
|
|
9655
10340
|
|
|
9656
|
-
const { toPoint: toPoint$2 } = AroundHelper;
|
|
10341
|
+
const { toPoint: toPoint$2 } = AroundHelper, { hasTransparent } = ColorConvert;
|
|
9657
10342
|
const realFrom$2 = {};
|
|
9658
10343
|
const realTo$2 = {};
|
|
9659
10344
|
function linearGradient(paint, box) {
|
|
9660
|
-
let { from, to, type,
|
|
10345
|
+
let { from, to, type, opacity } = paint;
|
|
9661
10346
|
toPoint$2(from || 'top', box, realFrom$2);
|
|
9662
10347
|
toPoint$2(to || 'bottom', box, realTo$2);
|
|
9663
10348
|
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
9664
|
-
applyStops(style, paint.stops, opacity);
|
|
9665
10349
|
const data = { type, style };
|
|
9666
|
-
|
|
9667
|
-
data.blendMode = blendMode;
|
|
10350
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9668
10351
|
return data;
|
|
9669
10352
|
}
|
|
9670
|
-
function applyStops(gradient, stops, opacity) {
|
|
10353
|
+
function applyStops(data, gradient, stops, opacity) {
|
|
9671
10354
|
if (stops) {
|
|
9672
|
-
let stop;
|
|
10355
|
+
let stop, color, offset, isTransparent;
|
|
9673
10356
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
9674
10357
|
stop = stops[i];
|
|
9675
|
-
if (typeof stop === 'string')
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
|
|
10358
|
+
if (typeof stop === 'string')
|
|
10359
|
+
offset = i / (len - 1), color = ColorConvert.string(stop, opacity);
|
|
10360
|
+
else
|
|
10361
|
+
offset = stop.offset, color = ColorConvert.string(stop.color, opacity);
|
|
10362
|
+
gradient.addColorStop(offset, color);
|
|
10363
|
+
if (!isTransparent && hasTransparent(color))
|
|
10364
|
+
isTransparent = true;
|
|
9681
10365
|
}
|
|
10366
|
+
if (isTransparent)
|
|
10367
|
+
data.isTransparent = true;
|
|
9682
10368
|
}
|
|
9683
10369
|
}
|
|
9684
10370
|
|
|
@@ -9688,17 +10374,15 @@ var LeaferUI = (function (exports) {
|
|
|
9688
10374
|
const realFrom$1 = {};
|
|
9689
10375
|
const realTo$1 = {};
|
|
9690
10376
|
function radialGradient(paint, box) {
|
|
9691
|
-
let { from, to, type, opacity,
|
|
10377
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
9692
10378
|
toPoint$1(from || 'center', box, realFrom$1);
|
|
9693
10379
|
toPoint$1(to || 'bottom', box, realTo$1);
|
|
9694
10380
|
const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$1(realFrom$1, realTo$1));
|
|
9695
|
-
applyStops(style, paint.stops, opacity);
|
|
9696
10381
|
const data = { type, style };
|
|
10382
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9697
10383
|
const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
|
|
9698
10384
|
if (transform)
|
|
9699
10385
|
data.transform = transform;
|
|
9700
|
-
if (blendMode)
|
|
9701
|
-
data.blendMode = blendMode;
|
|
9702
10386
|
return data;
|
|
9703
10387
|
}
|
|
9704
10388
|
function getTransform(box, from, to, stretch, rotate90) {
|
|
@@ -9724,17 +10408,15 @@ var LeaferUI = (function (exports) {
|
|
|
9724
10408
|
const realFrom = {};
|
|
9725
10409
|
const realTo = {};
|
|
9726
10410
|
function conicGradient(paint, box) {
|
|
9727
|
-
let { from, to, type, opacity,
|
|
10411
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
9728
10412
|
toPoint(from || 'center', box, realFrom);
|
|
9729
10413
|
toPoint(to || 'bottom', box, realTo);
|
|
9730
10414
|
const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance(realFrom, realTo));
|
|
9731
|
-
applyStops(style, paint.stops, opacity);
|
|
9732
10415
|
const data = { type, style };
|
|
10416
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9733
10417
|
const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
|
|
9734
10418
|
if (transform)
|
|
9735
10419
|
data.transform = transform;
|
|
9736
|
-
if (blendMode)
|
|
9737
|
-
data.blendMode = blendMode;
|
|
9738
10420
|
return data;
|
|
9739
10421
|
}
|
|
9740
10422
|
|
|
@@ -10067,6 +10749,8 @@ var LeaferUI = (function (exports) {
|
|
|
10067
10749
|
lastCharType = null;
|
|
10068
10750
|
startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
|
|
10069
10751
|
word = { data: [] }, row = { words: [] };
|
|
10752
|
+
if (__letterSpacing)
|
|
10753
|
+
content = [...content];
|
|
10070
10754
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
10071
10755
|
char = content[i];
|
|
10072
10756
|
if (char === '\n') {
|
|
@@ -10485,6 +11169,7 @@ var LeaferUI = (function (exports) {
|
|
|
10485
11169
|
exports.AutoBounds = AutoBounds;
|
|
10486
11170
|
exports.BezierHelper = BezierHelper;
|
|
10487
11171
|
exports.Bounds = Bounds;
|
|
11172
|
+
exports.BoundsEvent = BoundsEvent;
|
|
10488
11173
|
exports.BoundsHelper = BoundsHelper;
|
|
10489
11174
|
exports.BoxData = BoxData;
|
|
10490
11175
|
exports.BranchHelper = BranchHelper;
|
|
@@ -10631,7 +11316,7 @@ var LeaferUI = (function (exports) {
|
|
|
10631
11316
|
exports.surfaceType = surfaceType;
|
|
10632
11317
|
exports.tempBounds = tempBounds$1;
|
|
10633
11318
|
exports.tempMatrix = tempMatrix;
|
|
10634
|
-
exports.tempPoint = tempPoint$
|
|
11319
|
+
exports.tempPoint = tempPoint$2;
|
|
10635
11320
|
exports.useCanvas = useCanvas;
|
|
10636
11321
|
exports.useModule = useModule;
|
|
10637
11322
|
exports.version = version;
|
|
@@ -10641,4 +11326,7 @@ var LeaferUI = (function (exports) {
|
|
|
10641
11326
|
return exports;
|
|
10642
11327
|
|
|
10643
11328
|
})({});
|
|
10644
|
-
|
|
11329
|
+
|
|
11330
|
+
function Leafer(opt) { return new LeaferUI.Leafer(opt); }
|
|
11331
|
+
Object.setPrototypeOf(Leafer, LeaferUI);
|
|
11332
|
+
Leafer.prototype = LeaferUI.Leafer.prototype;
|