@leafer-draw/worker 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/worker.cjs +208 -201
- package/dist/worker.esm.js +211 -204
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +1178 -490
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +1173 -490
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +9 -9
- package/dist/worker.cjs.map +0 -1
- package/dist/worker.esm.js.map +0 -1
- package/dist/worker.js.map +0 -1
- package/dist/worker.module.js.map +0 -1
package/dist/worker.js
CHANGED
|
@@ -26,8 +26,6 @@ var LeaferUI = (function (exports) {
|
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
const Creator = {};
|
|
30
|
-
|
|
31
29
|
const IncrementId = {
|
|
32
30
|
RUNTIME: 'runtime',
|
|
33
31
|
LEAF: 'leaf',
|
|
@@ -153,7 +151,7 @@ var LeaferUI = (function (exports) {
|
|
|
153
151
|
|
|
154
152
|
const { sin: sin$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$d = 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$b = 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$9 = 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$8 = 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
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6134
6239
|
get allowBackgroundColor() { return true; }
|
|
@@ -6287,17 +6392,15 @@ var LeaferUI = (function (exports) {
|
|
|
6287
6392
|
this.target.emitEvent(new WatchEvent(WatchEvent.DATA, { updatedList: this.updatedList }));
|
|
6288
6393
|
this.__updatedList = new LeafList();
|
|
6289
6394
|
this.totalTimes++;
|
|
6290
|
-
this.changed = false;
|
|
6291
|
-
this.hasVisible = false;
|
|
6292
|
-
this.hasRemove = false;
|
|
6293
|
-
this.hasAdd = false;
|
|
6395
|
+
this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
6294
6396
|
}
|
|
6295
6397
|
__listenEvents() {
|
|
6296
|
-
const { target } = this;
|
|
6297
6398
|
this.__eventIds = [
|
|
6298
|
-
target.on_(
|
|
6299
|
-
|
|
6300
|
-
|
|
6399
|
+
this.target.on_([
|
|
6400
|
+
[PropertyEvent.CHANGE, this.__onAttrChange, this],
|
|
6401
|
+
[[ChildEvent.ADD, ChildEvent.REMOVE], this.__onChildEvent, this],
|
|
6402
|
+
[WatchEvent.REQUEST, this.__onRquestData, this]
|
|
6403
|
+
])
|
|
6301
6404
|
];
|
|
6302
6405
|
}
|
|
6303
6406
|
__removeListenEvents() {
|
|
@@ -6307,13 +6410,12 @@ var LeaferUI = (function (exports) {
|
|
|
6307
6410
|
if (this.target) {
|
|
6308
6411
|
this.stop();
|
|
6309
6412
|
this.__removeListenEvents();
|
|
6310
|
-
this.target = null;
|
|
6311
|
-
this.__updatedList = null;
|
|
6413
|
+
this.target = this.__updatedList = null;
|
|
6312
6414
|
}
|
|
6313
6415
|
}
|
|
6314
6416
|
}
|
|
6315
6417
|
|
|
6316
|
-
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds,
|
|
6418
|
+
const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds, updateChange: updateOneChange } = LeafHelper;
|
|
6317
6419
|
const { pushAllChildBranch, pushAllParent } = BranchHelper;
|
|
6318
6420
|
function updateMatrix(updateList, levelList) {
|
|
6319
6421
|
let layout;
|
|
@@ -6356,15 +6458,7 @@ var LeaferUI = (function (exports) {
|
|
|
6356
6458
|
});
|
|
6357
6459
|
}
|
|
6358
6460
|
function updateChange(updateList) {
|
|
6359
|
-
|
|
6360
|
-
updateList.list.forEach(leaf => {
|
|
6361
|
-
layout = leaf.__layout;
|
|
6362
|
-
if (layout.opacityChanged)
|
|
6363
|
-
updateAllWorldOpacity(leaf);
|
|
6364
|
-
if (layout.stateStyleChanged)
|
|
6365
|
-
setTimeout(() => layout.stateStyleChanged && leaf.updateState());
|
|
6366
|
-
leaf.__updateChange();
|
|
6367
|
-
});
|
|
6461
|
+
updateList.list.forEach(updateOneChange);
|
|
6368
6462
|
}
|
|
6369
6463
|
|
|
6370
6464
|
const { worldBounds } = LeafBoundsHelper;
|
|
@@ -6421,7 +6515,7 @@ var LeaferUI = (function (exports) {
|
|
|
6421
6515
|
this.disabled = true;
|
|
6422
6516
|
}
|
|
6423
6517
|
layout() {
|
|
6424
|
-
if (!this.running)
|
|
6518
|
+
if (this.layouting || !this.running)
|
|
6425
6519
|
return;
|
|
6426
6520
|
const { target } = this;
|
|
6427
6521
|
this.times = 0;
|
|
@@ -6504,12 +6598,10 @@ var LeaferUI = (function (exports) {
|
|
|
6504
6598
|
}
|
|
6505
6599
|
static fullLayout(target) {
|
|
6506
6600
|
updateAllMatrix(target, true);
|
|
6507
|
-
if (target.isBranch)
|
|
6601
|
+
if (target.isBranch)
|
|
6508
6602
|
BranchHelper.updateBounds(target);
|
|
6509
|
-
|
|
6510
|
-
else {
|
|
6603
|
+
else
|
|
6511
6604
|
LeafHelper.updateBounds(target);
|
|
6512
|
-
}
|
|
6513
6605
|
updateAllChange(target);
|
|
6514
6606
|
}
|
|
6515
6607
|
addExtra(leaf) {
|
|
@@ -6532,11 +6624,12 @@ var LeaferUI = (function (exports) {
|
|
|
6532
6624
|
this.__updatedList = event.data.updatedList;
|
|
6533
6625
|
}
|
|
6534
6626
|
__listenEvents() {
|
|
6535
|
-
const { target } = this;
|
|
6536
6627
|
this.__eventIds = [
|
|
6537
|
-
target.on_(
|
|
6538
|
-
|
|
6539
|
-
|
|
6628
|
+
this.target.on_([
|
|
6629
|
+
[LayoutEvent.REQUEST, this.layout, this],
|
|
6630
|
+
[LayoutEvent.AGAIN, this.layoutAgain, this],
|
|
6631
|
+
[WatchEvent.DATA, this.__onReceiveWatchData, this]
|
|
6632
|
+
])
|
|
6540
6633
|
];
|
|
6541
6634
|
}
|
|
6542
6635
|
__removeListenEvents() {
|
|
@@ -6767,12 +6860,13 @@ var LeaferUI = (function (exports) {
|
|
|
6767
6860
|
this.target.emitEvent(new RenderEvent(type, this.times, bounds, options));
|
|
6768
6861
|
}
|
|
6769
6862
|
__listenEvents() {
|
|
6770
|
-
const { target } = this;
|
|
6771
6863
|
this.__eventIds = [
|
|
6772
|
-
target.on_(
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6864
|
+
this.target.on_([
|
|
6865
|
+
[RenderEvent.REQUEST, this.update, this],
|
|
6866
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
6867
|
+
[RenderEvent.AGAIN, this.renderAgain, this],
|
|
6868
|
+
[ResizeEvent.RESIZE, this.__onResize, this]
|
|
6869
|
+
])
|
|
6776
6870
|
];
|
|
6777
6871
|
}
|
|
6778
6872
|
__removeListenEvents() {
|
|
@@ -6831,8 +6925,32 @@ var LeaferUI = (function (exports) {
|
|
|
6831
6925
|
};
|
|
6832
6926
|
}
|
|
6833
6927
|
|
|
6928
|
+
function hasTransparent$3(color) {
|
|
6929
|
+
if (!color || color.length === 7 || color.length === 4)
|
|
6930
|
+
return false;
|
|
6931
|
+
if (color === 'transparent')
|
|
6932
|
+
return true;
|
|
6933
|
+
const first = color[0];
|
|
6934
|
+
if (first === '#') {
|
|
6935
|
+
switch (color.length) {
|
|
6936
|
+
case 5: return color[4] !== 'f' && color[4] !== 'F';
|
|
6937
|
+
case 9: return (color[7] !== 'f' && color[7] !== 'F') || (color[8] !== 'f' && color[8] !== 'F');
|
|
6938
|
+
}
|
|
6939
|
+
}
|
|
6940
|
+
else if (first === 'r' || first === 'h') {
|
|
6941
|
+
if (color[3] === 'a') {
|
|
6942
|
+
const i = color.lastIndexOf(',');
|
|
6943
|
+
if (i > -1)
|
|
6944
|
+
return parseFloat(color.slice(i + 1)) < 1;
|
|
6945
|
+
}
|
|
6946
|
+
}
|
|
6947
|
+
return false;
|
|
6948
|
+
}
|
|
6949
|
+
|
|
6834
6950
|
const TextConvert = {};
|
|
6835
|
-
const ColorConvert = {
|
|
6951
|
+
const ColorConvert = {
|
|
6952
|
+
hasTransparent: hasTransparent$3
|
|
6953
|
+
};
|
|
6836
6954
|
const UnitConvert = {
|
|
6837
6955
|
number(value, percentRefer) {
|
|
6838
6956
|
return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
|
|
@@ -6858,6 +6976,7 @@ var LeaferUI = (function (exports) {
|
|
|
6858
6976
|
};
|
|
6859
6977
|
|
|
6860
6978
|
const { parse, objectToCanvasData } = PathConvert;
|
|
6979
|
+
const { stintSet: stintSet$2 } = DataHelper, { hasTransparent: hasTransparent$2 } = ColorConvert;
|
|
6861
6980
|
const emptyPaint = {};
|
|
6862
6981
|
const debug$1 = Debug.get('UIData');
|
|
6863
6982
|
class UIData extends LeafData {
|
|
@@ -6916,38 +7035,22 @@ var LeaferUI = (function (exports) {
|
|
|
6916
7035
|
if (this.__naturalWidth)
|
|
6917
7036
|
this.__removeNaturalSize();
|
|
6918
7037
|
if (typeof value === 'string' || !value) {
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
PaintImage.recycleImage('fill', this);
|
|
6922
|
-
this.__isFills = false;
|
|
6923
|
-
this.__pixelFill && (this.__pixelFill = false);
|
|
6924
|
-
}
|
|
7038
|
+
stintSet$2(this, '__isTransparentFill', hasTransparent$2(value));
|
|
7039
|
+
this.__isFills && this.__removePaint('fill', true);
|
|
6925
7040
|
this._fill = value;
|
|
6926
7041
|
}
|
|
6927
7042
|
else if (typeof value === 'object') {
|
|
6928
|
-
this.
|
|
6929
|
-
const layout = this.__leaf.__layout;
|
|
6930
|
-
layout.boxChanged || layout.boxChange();
|
|
6931
|
-
this.__isFills = true;
|
|
6932
|
-
this._fill || (this._fill = emptyPaint);
|
|
7043
|
+
this.__setPaint('fill', value);
|
|
6933
7044
|
}
|
|
6934
7045
|
}
|
|
6935
7046
|
setStroke(value) {
|
|
6936
7047
|
if (typeof value === 'string' || !value) {
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
PaintImage.recycleImage('stroke', this);
|
|
6940
|
-
this.__isStrokes = false;
|
|
6941
|
-
this.__pixelStroke && (this.__pixelStroke = false);
|
|
6942
|
-
}
|
|
7048
|
+
stintSet$2(this, '__isTransparentStroke', hasTransparent$2(value));
|
|
7049
|
+
this.__isStrokes && this.__removePaint('stroke', true);
|
|
6943
7050
|
this._stroke = value;
|
|
6944
7051
|
}
|
|
6945
7052
|
else if (typeof value === 'object') {
|
|
6946
|
-
this.
|
|
6947
|
-
const layout = this.__leaf.__layout;
|
|
6948
|
-
layout.boxChanged || layout.boxChange();
|
|
6949
|
-
this.__isStrokes = true;
|
|
6950
|
-
this._stroke || (this._stroke = emptyPaint);
|
|
7053
|
+
this.__setPaint('stroke', value);
|
|
6951
7054
|
}
|
|
6952
7055
|
}
|
|
6953
7056
|
setPath(value) {
|
|
@@ -6977,7 +7080,34 @@ var LeaferUI = (function (exports) {
|
|
|
6977
7080
|
Paint.compute('fill', this.__leaf);
|
|
6978
7081
|
if (stroke)
|
|
6979
7082
|
Paint.compute('stroke', this.__leaf);
|
|
6980
|
-
this.__needComputePaint =
|
|
7083
|
+
this.__needComputePaint = undefined;
|
|
7084
|
+
}
|
|
7085
|
+
__setPaint(attrName, value) {
|
|
7086
|
+
this.__setInput(attrName, value);
|
|
7087
|
+
const layout = this.__leaf.__layout;
|
|
7088
|
+
layout.boxChanged || layout.boxChange();
|
|
7089
|
+
if (value instanceof Array && !value.length) {
|
|
7090
|
+
this.__removePaint(attrName);
|
|
7091
|
+
}
|
|
7092
|
+
else {
|
|
7093
|
+
if (attrName === 'fill')
|
|
7094
|
+
this.__isFills = true, this._fill || (this._fill = emptyPaint);
|
|
7095
|
+
else
|
|
7096
|
+
this.__isStrokes = true, this._stroke || (this._stroke = emptyPaint);
|
|
7097
|
+
}
|
|
7098
|
+
}
|
|
7099
|
+
__removePaint(attrName, removeInput) {
|
|
7100
|
+
if (removeInput)
|
|
7101
|
+
this.__removeInput(attrName);
|
|
7102
|
+
PaintImage.recycleImage(attrName, this);
|
|
7103
|
+
if (attrName === 'fill') {
|
|
7104
|
+
stintSet$2(this, '__isAlphaPixelFill', undefined);
|
|
7105
|
+
this._fill = this.__isFills = undefined;
|
|
7106
|
+
}
|
|
7107
|
+
else {
|
|
7108
|
+
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7109
|
+
this._stroke = this.__isStrokes = undefined;
|
|
7110
|
+
}
|
|
6981
7111
|
}
|
|
6982
7112
|
}
|
|
6983
7113
|
function setArray(data, key, value) {
|
|
@@ -6985,10 +7115,10 @@ var LeaferUI = (function (exports) {
|
|
|
6985
7115
|
if (value instanceof Array) {
|
|
6986
7116
|
if (value.some((item) => item.visible === false))
|
|
6987
7117
|
value = value.filter((item) => item.visible !== false);
|
|
6988
|
-
value.length || (value =
|
|
7118
|
+
value.length || (value = undefined);
|
|
6989
7119
|
}
|
|
6990
7120
|
else
|
|
6991
|
-
value = value && value.visible !== false ? [value] :
|
|
7121
|
+
value = value && value.visible !== false ? [value] : undefined;
|
|
6992
7122
|
data['_' + key] = value;
|
|
6993
7123
|
}
|
|
6994
7124
|
|
|
@@ -7052,13 +7182,11 @@ var LeaferUI = (function (exports) {
|
|
|
7052
7182
|
setFontWeight(value) {
|
|
7053
7183
|
if (typeof value === 'string') {
|
|
7054
7184
|
this.__setInput('fontWeight', value);
|
|
7055
|
-
|
|
7056
|
-
}
|
|
7057
|
-
else {
|
|
7058
|
-
if (this.__input)
|
|
7059
|
-
this.__removeInput('fontWeight');
|
|
7060
|
-
this._fontWeight = value;
|
|
7185
|
+
value = fontWeightMap[value] || 400;
|
|
7061
7186
|
}
|
|
7187
|
+
else if (this.__input)
|
|
7188
|
+
this.__removeInput('fontWeight');
|
|
7189
|
+
this._fontWeight = value;
|
|
7062
7190
|
}
|
|
7063
7191
|
setBoxStyle(value) {
|
|
7064
7192
|
let t = this.__leaf, box = t.__box;
|
|
@@ -7093,8 +7221,6 @@ var LeaferUI = (function (exports) {
|
|
|
7093
7221
|
this._url = value;
|
|
7094
7222
|
}
|
|
7095
7223
|
__setImageFill(value) {
|
|
7096
|
-
if (this.__leaf.image)
|
|
7097
|
-
this.__leaf.image = null;
|
|
7098
7224
|
this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
|
|
7099
7225
|
}
|
|
7100
7226
|
__getData() {
|
|
@@ -7160,21 +7286,19 @@ var LeaferUI = (function (exports) {
|
|
|
7160
7286
|
}
|
|
7161
7287
|
};
|
|
7162
7288
|
|
|
7289
|
+
const { stintSet: stintSet$1 } = DataHelper;
|
|
7163
7290
|
const UIRender = {
|
|
7164
7291
|
__updateChange() {
|
|
7165
|
-
const data = this.__
|
|
7292
|
+
const data = this.__;
|
|
7166
7293
|
if (data.__useEffect) {
|
|
7167
|
-
const { shadow,
|
|
7168
|
-
data.
|
|
7294
|
+
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7295
|
+
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')));
|
|
7296
|
+
data.__useEffect = !!(shadow || otherEffect);
|
|
7169
7297
|
}
|
|
7170
|
-
|
|
7171
|
-
|
|
7298
|
+
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7299
|
+
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7172
7300
|
data.__checkSingle();
|
|
7173
|
-
|
|
7174
|
-
if (complex)
|
|
7175
|
-
data.__complex = true;
|
|
7176
|
-
else
|
|
7177
|
-
data.__complex && (data.__complex = false);
|
|
7301
|
+
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7178
7302
|
},
|
|
7179
7303
|
__drawFast(canvas, options) {
|
|
7180
7304
|
drawFast(this, canvas, options);
|
|
@@ -7184,21 +7308,23 @@ var LeaferUI = (function (exports) {
|
|
|
7184
7308
|
if (data.__complex) {
|
|
7185
7309
|
if (data.__needComputePaint)
|
|
7186
7310
|
data.__computePaint();
|
|
7187
|
-
const { fill, stroke, __drawAfterFill } = data;
|
|
7311
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke, __isFastShadow } = data;
|
|
7188
7312
|
this.__drawRenderPath(canvas);
|
|
7189
|
-
if (data.__useEffect) {
|
|
7313
|
+
if (data.__useEffect && !__isFastShadow) {
|
|
7190
7314
|
const shape = Paint.shape(this, canvas, options);
|
|
7191
7315
|
this.__nowWorld = this.__getNowWorld(options);
|
|
7192
7316
|
const { shadow, innerShadow, filter } = data;
|
|
7193
7317
|
if (shadow)
|
|
7194
7318
|
Effect.shadow(this, canvas, shape);
|
|
7319
|
+
if (__fillAfterStroke)
|
|
7320
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7195
7321
|
if (fill)
|
|
7196
7322
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7197
7323
|
if (__drawAfterFill)
|
|
7198
7324
|
this.__drawAfterFill(canvas, options);
|
|
7199
7325
|
if (innerShadow)
|
|
7200
7326
|
Effect.innerShadow(this, canvas, shape);
|
|
7201
|
-
if (stroke)
|
|
7327
|
+
if (stroke && !__fillAfterStroke)
|
|
7202
7328
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7203
7329
|
if (filter)
|
|
7204
7330
|
Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
|
|
@@ -7207,21 +7333,27 @@ var LeaferUI = (function (exports) {
|
|
|
7207
7333
|
shape.canvas.recycle();
|
|
7208
7334
|
}
|
|
7209
7335
|
else {
|
|
7336
|
+
if (__fillAfterStroke)
|
|
7337
|
+
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7338
|
+
if (__isFastShadow) {
|
|
7339
|
+
const shadow = data.shadow[0], { scaleX, scaleY } = this.__nowWorld;
|
|
7340
|
+
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
7341
|
+
}
|
|
7210
7342
|
if (fill)
|
|
7211
7343
|
data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
|
|
7344
|
+
if (__isFastShadow)
|
|
7345
|
+
canvas.restore();
|
|
7212
7346
|
if (__drawAfterFill)
|
|
7213
7347
|
this.__drawAfterFill(canvas, options);
|
|
7214
|
-
if (stroke)
|
|
7348
|
+
if (stroke && !__fillAfterStroke)
|
|
7215
7349
|
data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
|
|
7216
7350
|
}
|
|
7217
7351
|
}
|
|
7218
7352
|
else {
|
|
7219
|
-
if (data.__pathInputed)
|
|
7353
|
+
if (data.__pathInputed)
|
|
7220
7354
|
drawFast(this, canvas, options);
|
|
7221
|
-
|
|
7222
|
-
else {
|
|
7355
|
+
else
|
|
7223
7356
|
this.__drawFast(canvas, options);
|
|
7224
|
-
}
|
|
7225
7357
|
}
|
|
7226
7358
|
},
|
|
7227
7359
|
__renderShape(canvas, options, ignoreFill, ignoreStroke) {
|
|
@@ -7230,11 +7362,11 @@ var LeaferUI = (function (exports) {
|
|
|
7230
7362
|
const { fill, stroke } = this.__;
|
|
7231
7363
|
this.__drawRenderPath(canvas);
|
|
7232
7364
|
if (fill && !ignoreFill)
|
|
7233
|
-
this.__.
|
|
7365
|
+
this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7234
7366
|
if (this.__.__isCanvas)
|
|
7235
7367
|
this.__drawAfterFill(canvas, options);
|
|
7236
7368
|
if (stroke && !ignoreStroke)
|
|
7237
|
-
this.__.
|
|
7369
|
+
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7238
7370
|
}
|
|
7239
7371
|
},
|
|
7240
7372
|
__drawAfterFill(canvas, options) {
|
|
@@ -7249,13 +7381,15 @@ var LeaferUI = (function (exports) {
|
|
|
7249
7381
|
}
|
|
7250
7382
|
};
|
|
7251
7383
|
function drawFast(ui, canvas, options) {
|
|
7252
|
-
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
7384
|
+
const { fill, stroke, __drawAfterFill, __fillAfterStroke } = ui.__;
|
|
7253
7385
|
ui.__drawRenderPath(canvas);
|
|
7386
|
+
if (__fillAfterStroke)
|
|
7387
|
+
Paint.stroke(stroke, ui, canvas);
|
|
7254
7388
|
if (fill)
|
|
7255
7389
|
Paint.fill(fill, ui, canvas);
|
|
7256
7390
|
if (__drawAfterFill)
|
|
7257
7391
|
ui.__drawAfterFill(canvas, options);
|
|
7258
|
-
if (stroke)
|
|
7392
|
+
if (stroke && !__fillAfterStroke)
|
|
7259
7393
|
Paint.stroke(stroke, ui, canvas);
|
|
7260
7394
|
}
|
|
7261
7395
|
|
|
@@ -7385,6 +7519,9 @@ var LeaferUI = (function (exports) {
|
|
|
7385
7519
|
else
|
|
7386
7520
|
drawer.rect(x, y, width, height);
|
|
7387
7521
|
}
|
|
7522
|
+
drawImagePlaceholder(canvas, _image) {
|
|
7523
|
+
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7524
|
+
}
|
|
7388
7525
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7389
7526
|
return Plugin.need('animate');
|
|
7390
7527
|
}
|
|
@@ -7621,6 +7758,12 @@ var LeaferUI = (function (exports) {
|
|
|
7621
7758
|
__decorate([
|
|
7622
7759
|
effectType()
|
|
7623
7760
|
], exports.UI.prototype, "filter", void 0);
|
|
7761
|
+
__decorate([
|
|
7762
|
+
surfaceType()
|
|
7763
|
+
], exports.UI.prototype, "placeholderColor", void 0);
|
|
7764
|
+
__decorate([
|
|
7765
|
+
dataType(100)
|
|
7766
|
+
], exports.UI.prototype, "placeholderDelay", void 0);
|
|
7624
7767
|
__decorate([
|
|
7625
7768
|
dataType({})
|
|
7626
7769
|
], exports.UI.prototype, "data", void 0);
|
|
@@ -8022,15 +8165,20 @@ var LeaferUI = (function (exports) {
|
|
|
8022
8165
|
}
|
|
8023
8166
|
__listenEvents() {
|
|
8024
8167
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8025
|
-
this.once(
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8168
|
+
this.once([
|
|
8169
|
+
[LeaferEvent.START, () => Run.end(runId)],
|
|
8170
|
+
[LayoutEvent.START, this.updateLazyBounds, this],
|
|
8171
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
8172
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
8173
|
+
]);
|
|
8174
|
+
this.__eventIds.push(this.on_([
|
|
8175
|
+
[WatchEvent.DATA, this.__onWatchData, this],
|
|
8176
|
+
[LayoutEvent.END, this.__onLayoutEnd, this],
|
|
8177
|
+
[RenderEvent.NEXT, this.__onNextRender, this]
|
|
8178
|
+
]));
|
|
8030
8179
|
}
|
|
8031
8180
|
__removeListenEvents() {
|
|
8032
8181
|
this.off_(this.__eventIds);
|
|
8033
|
-
this.__eventIds.length = 0;
|
|
8034
8182
|
}
|
|
8035
8183
|
destroy(sync) {
|
|
8036
8184
|
const doDestory = () => {
|
|
@@ -8090,8 +8238,8 @@ var LeaferUI = (function (exports) {
|
|
|
8090
8238
|
registerUI()
|
|
8091
8239
|
], exports.Rect);
|
|
8092
8240
|
|
|
8093
|
-
const { copy: copy$
|
|
8094
|
-
const rect = exports.Rect.prototype, group = exports.Group.prototype;
|
|
8241
|
+
const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
|
|
8242
|
+
const rect$1 = exports.Rect.prototype, group = exports.Group.prototype;
|
|
8095
8243
|
const childrenRenderBounds = {};
|
|
8096
8244
|
exports.Box = class Box extends exports.Group {
|
|
8097
8245
|
get __tag() { return 'Box'; }
|
|
@@ -8136,15 +8284,15 @@ var LeaferUI = (function (exports) {
|
|
|
8136
8284
|
const { renderBounds } = this.__layout;
|
|
8137
8285
|
if (this.children.length) {
|
|
8138
8286
|
super.__updateRenderBounds();
|
|
8139
|
-
copy$
|
|
8287
|
+
copy$3(childrenRenderBounds, renderBounds);
|
|
8140
8288
|
this.__updateRectRenderBounds();
|
|
8141
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8289
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8142
8290
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
8143
8291
|
add(renderBounds, childrenRenderBounds);
|
|
8144
8292
|
}
|
|
8145
8293
|
else
|
|
8146
8294
|
this.__updateRectRenderBounds();
|
|
8147
|
-
|
|
8295
|
+
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8148
8296
|
}
|
|
8149
8297
|
__updateRectRenderBounds() { }
|
|
8150
8298
|
__updateRectChange() { }
|
|
@@ -8188,25 +8336,25 @@ var LeaferUI = (function (exports) {
|
|
|
8188
8336
|
affectRenderBoundsType('show')
|
|
8189
8337
|
], exports.Box.prototype, "overflow", void 0);
|
|
8190
8338
|
__decorate([
|
|
8191
|
-
rewrite(rect.__updateStrokeSpread)
|
|
8339
|
+
rewrite(rect$1.__updateStrokeSpread)
|
|
8192
8340
|
], exports.Box.prototype, "__updateStrokeSpread", null);
|
|
8193
8341
|
__decorate([
|
|
8194
|
-
rewrite(rect.__updateRenderSpread)
|
|
8342
|
+
rewrite(rect$1.__updateRenderSpread)
|
|
8195
8343
|
], exports.Box.prototype, "__updateRectRenderSpread", null);
|
|
8196
8344
|
__decorate([
|
|
8197
|
-
rewrite(rect.__updateBoxBounds)
|
|
8345
|
+
rewrite(rect$1.__updateBoxBounds)
|
|
8198
8346
|
], exports.Box.prototype, "__updateRectBoxBounds", null);
|
|
8199
8347
|
__decorate([
|
|
8200
|
-
rewrite(rect.__updateStrokeBounds)
|
|
8348
|
+
rewrite(rect$1.__updateStrokeBounds)
|
|
8201
8349
|
], exports.Box.prototype, "__updateStrokeBounds", null);
|
|
8202
8350
|
__decorate([
|
|
8203
|
-
rewrite(rect.__updateRenderBounds)
|
|
8351
|
+
rewrite(rect$1.__updateRenderBounds)
|
|
8204
8352
|
], exports.Box.prototype, "__updateRectRenderBounds", null);
|
|
8205
8353
|
__decorate([
|
|
8206
|
-
rewrite(rect.__updateChange)
|
|
8354
|
+
rewrite(rect$1.__updateChange)
|
|
8207
8355
|
], exports.Box.prototype, "__updateRectChange", null);
|
|
8208
8356
|
__decorate([
|
|
8209
|
-
rewrite(rect.__render)
|
|
8357
|
+
rewrite(rect$1.__render)
|
|
8210
8358
|
], exports.Box.prototype, "__renderRect", null);
|
|
8211
8359
|
__decorate([
|
|
8212
8360
|
rewrite(group.__render)
|
|
@@ -8448,17 +8596,10 @@ var LeaferUI = (function (exports) {
|
|
|
8448
8596
|
|
|
8449
8597
|
exports.Image = class Image extends exports.Rect {
|
|
8450
8598
|
get __tag() { return 'Image'; }
|
|
8451
|
-
get ready() {
|
|
8599
|
+
get ready() { const { image } = this; return image && image.ready; }
|
|
8600
|
+
get image() { const { fill } = this.__; return fill instanceof Array && fill[0].image; }
|
|
8452
8601
|
constructor(data) {
|
|
8453
8602
|
super(data);
|
|
8454
|
-
this.on(ImageEvent.LOADED, (e) => {
|
|
8455
|
-
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8456
|
-
this.image = e.image;
|
|
8457
|
-
});
|
|
8458
|
-
}
|
|
8459
|
-
destroy() {
|
|
8460
|
-
this.image = null;
|
|
8461
|
-
super.destroy();
|
|
8462
8603
|
}
|
|
8463
8604
|
};
|
|
8464
8605
|
__decorate([
|
|
@@ -8474,11 +8615,11 @@ var LeaferUI = (function (exports) {
|
|
|
8474
8615
|
|
|
8475
8616
|
exports.Canvas = class Canvas extends exports.Rect {
|
|
8476
8617
|
get __tag() { return 'Canvas'; }
|
|
8618
|
+
get context() { return this.canvas.context; }
|
|
8477
8619
|
get ready() { return !this.url; }
|
|
8478
8620
|
constructor(data) {
|
|
8479
8621
|
super(data);
|
|
8480
8622
|
this.canvas = Creator.canvas(this.__);
|
|
8481
|
-
this.context = this.canvas.context;
|
|
8482
8623
|
if (data && data.url)
|
|
8483
8624
|
this.drawImage(data.url);
|
|
8484
8625
|
}
|
|
@@ -8522,7 +8663,7 @@ var LeaferUI = (function (exports) {
|
|
|
8522
8663
|
destroy() {
|
|
8523
8664
|
if (this.canvas) {
|
|
8524
8665
|
this.canvas.destroy();
|
|
8525
|
-
this.canvas =
|
|
8666
|
+
this.canvas = null;
|
|
8526
8667
|
}
|
|
8527
8668
|
super.destroy();
|
|
8528
8669
|
}
|
|
@@ -8568,7 +8709,7 @@ var LeaferUI = (function (exports) {
|
|
|
8568
8709
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8569
8710
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8570
8711
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8571
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8712
|
+
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__);
|
|
8572
8713
|
}
|
|
8573
8714
|
__updateBoxBounds() {
|
|
8574
8715
|
const data = this.__;
|
|
@@ -8598,12 +8739,11 @@ var LeaferUI = (function (exports) {
|
|
|
8598
8739
|
super.__updateBoxBounds();
|
|
8599
8740
|
if (italic)
|
|
8600
8741
|
b.width += fontSize * 0.16;
|
|
8601
|
-
|
|
8602
|
-
if (isOverflow)
|
|
8742
|
+
DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds));
|
|
8743
|
+
if (this.isOverflow)
|
|
8603
8744
|
setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
|
|
8604
8745
|
else
|
|
8605
8746
|
data.__textBoxBounds = b;
|
|
8606
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8607
8747
|
}
|
|
8608
8748
|
__onUpdateSize() {
|
|
8609
8749
|
if (this.__box)
|
|
@@ -8666,6 +8806,9 @@ var LeaferUI = (function (exports) {
|
|
|
8666
8806
|
__decorate([
|
|
8667
8807
|
boundsType('')
|
|
8668
8808
|
], exports.Text.prototype, "text", void 0);
|
|
8809
|
+
__decorate([
|
|
8810
|
+
boundsType('')
|
|
8811
|
+
], exports.Text.prototype, "placeholder", void 0);
|
|
8669
8812
|
__decorate([
|
|
8670
8813
|
boundsType('caption')
|
|
8671
8814
|
], exports.Text.prototype, "fontFamily", void 0);
|
|
@@ -8785,8 +8928,10 @@ var LeaferUI = (function (exports) {
|
|
|
8785
8928
|
}
|
|
8786
8929
|
|
|
8787
8930
|
function fillText(ui, canvas) {
|
|
8788
|
-
|
|
8789
|
-
|
|
8931
|
+
const data = ui.__, { rows, decorationY } = data.__textDrawData;
|
|
8932
|
+
if (data.__isPlacehold && data.placeholderColor)
|
|
8933
|
+
canvas.fillStyle = data.placeholderColor;
|
|
8934
|
+
let row;
|
|
8790
8935
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
8791
8936
|
row = rows[i];
|
|
8792
8937
|
if (row.text)
|
|
@@ -8795,7 +8940,7 @@ var LeaferUI = (function (exports) {
|
|
|
8795
8940
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
8796
8941
|
}
|
|
8797
8942
|
if (decorationY) {
|
|
8798
|
-
const { decorationColor, decorationHeight } = data;
|
|
8943
|
+
const { decorationColor, decorationHeight } = data.__textDrawData;
|
|
8799
8944
|
if (decorationColor)
|
|
8800
8945
|
canvas.fillStyle = decorationColor;
|
|
8801
8946
|
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
@@ -8804,65 +8949,596 @@ var LeaferUI = (function (exports) {
|
|
|
8804
8949
|
|
|
8805
8950
|
function fill(fill, ui, canvas) {
|
|
8806
8951
|
canvas.fillStyle = fill;
|
|
8807
|
-
|
|
8952
|
+
fillPathOrText(ui, canvas);
|
|
8808
8953
|
}
|
|
8809
8954
|
function fills(fills, ui, canvas) {
|
|
8810
8955
|
let item;
|
|
8811
|
-
const { windingRule, __font } = ui.__;
|
|
8812
8956
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
8813
8957
|
item = fills[i];
|
|
8814
|
-
if (item.image
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
if (item.blendMode)
|
|
8822
|
-
canvas.blendMode = item.blendMode;
|
|
8823
|
-
__font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
|
|
8824
|
-
canvas.restore();
|
|
8958
|
+
if (item.image) {
|
|
8959
|
+
if (PaintImage.checkImage(ui, canvas, item, !ui.__.__font))
|
|
8960
|
+
continue;
|
|
8961
|
+
if (!item.style) {
|
|
8962
|
+
if (!i && item.image.isPlacehold)
|
|
8963
|
+
ui.drawImagePlaceholder(canvas, item.image);
|
|
8964
|
+
continue;
|
|
8825
8965
|
}
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8966
|
+
}
|
|
8967
|
+
canvas.fillStyle = item.style;
|
|
8968
|
+
if (item.transform) {
|
|
8969
|
+
canvas.save();
|
|
8970
|
+
canvas.transform(item.transform);
|
|
8971
|
+
if (item.blendMode)
|
|
8972
|
+
canvas.blendMode = item.blendMode;
|
|
8973
|
+
fillPathOrText(ui, canvas);
|
|
8974
|
+
canvas.restore();
|
|
8975
|
+
}
|
|
8976
|
+
else {
|
|
8977
|
+
if (item.blendMode) {
|
|
8978
|
+
canvas.saveBlendMode(item.blendMode);
|
|
8979
|
+
fillPathOrText(ui, canvas);
|
|
8980
|
+
canvas.restoreBlendMode();
|
|
8835
8981
|
}
|
|
8982
|
+
else
|
|
8983
|
+
fillPathOrText(ui, canvas);
|
|
8836
8984
|
}
|
|
8837
8985
|
}
|
|
8838
8986
|
}
|
|
8987
|
+
function fillPathOrText(ui, canvas) {
|
|
8988
|
+
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
8989
|
+
}
|
|
8990
|
+
|
|
8991
|
+
let App = class App extends exports.Leafer {
|
|
8992
|
+
get __tag() { return 'App'; }
|
|
8993
|
+
get isApp() { return true; }
|
|
8994
|
+
constructor(userConfig, data) {
|
|
8995
|
+
super(userConfig, data);
|
|
8996
|
+
}
|
|
8997
|
+
init(userConfig, parentApp) {
|
|
8998
|
+
super.init(userConfig, parentApp);
|
|
8999
|
+
if (userConfig) {
|
|
9000
|
+
const { ground, tree, sky, editor } = userConfig;
|
|
9001
|
+
if (ground)
|
|
9002
|
+
this.ground = this.addLeafer(ground);
|
|
9003
|
+
if (tree || editor)
|
|
9004
|
+
this.tree = this.addLeafer(tree || { type: userConfig.type || 'design' });
|
|
9005
|
+
if (sky || editor)
|
|
9006
|
+
this.sky = this.addLeafer(sky);
|
|
9007
|
+
if (editor)
|
|
9008
|
+
Creator.editor(editor, this);
|
|
9009
|
+
}
|
|
9010
|
+
}
|
|
9011
|
+
__setApp() {
|
|
9012
|
+
const { canvas } = this;
|
|
9013
|
+
const { realCanvas, view } = this.config;
|
|
9014
|
+
if (realCanvas || view === this.canvas.view || !canvas.parentView)
|
|
9015
|
+
this.realCanvas = true;
|
|
9016
|
+
else
|
|
9017
|
+
canvas.unrealCanvas();
|
|
9018
|
+
this.leafer = this;
|
|
9019
|
+
this.watcher.disable();
|
|
9020
|
+
this.layouter.disable();
|
|
9021
|
+
}
|
|
9022
|
+
__updateLocalBounds() {
|
|
9023
|
+
this.forEach(leafer => leafer.updateLayout());
|
|
9024
|
+
super.__updateLocalBounds();
|
|
9025
|
+
}
|
|
9026
|
+
start() {
|
|
9027
|
+
super.start();
|
|
9028
|
+
this.forEach(leafer => leafer.start());
|
|
9029
|
+
}
|
|
9030
|
+
stop() {
|
|
9031
|
+
this.forEach(leafer => leafer.stop());
|
|
9032
|
+
super.stop();
|
|
9033
|
+
}
|
|
9034
|
+
unlockLayout() {
|
|
9035
|
+
super.unlockLayout();
|
|
9036
|
+
this.forEach(leafer => leafer.unlockLayout());
|
|
9037
|
+
}
|
|
9038
|
+
lockLayout() {
|
|
9039
|
+
super.lockLayout();
|
|
9040
|
+
this.forEach(leafer => leafer.lockLayout());
|
|
9041
|
+
}
|
|
9042
|
+
forceRender(bounds, sync) {
|
|
9043
|
+
this.forEach(leafer => leafer.forceRender(bounds, sync));
|
|
9044
|
+
}
|
|
9045
|
+
addLeafer(merge) {
|
|
9046
|
+
const leafer = new exports.Leafer(merge);
|
|
9047
|
+
this.add(leafer);
|
|
9048
|
+
return leafer;
|
|
9049
|
+
}
|
|
9050
|
+
add(leafer, index) {
|
|
9051
|
+
if (!leafer.view) {
|
|
9052
|
+
if (this.realCanvas && !this.canvas.bounds) {
|
|
9053
|
+
setTimeout(() => this.add(leafer, index), 10);
|
|
9054
|
+
return;
|
|
9055
|
+
}
|
|
9056
|
+
leafer.init(this.__getChildConfig(leafer.userConfig), this);
|
|
9057
|
+
}
|
|
9058
|
+
super.add(leafer, index);
|
|
9059
|
+
if (index !== undefined)
|
|
9060
|
+
leafer.canvas.childIndex = index;
|
|
9061
|
+
this.__listenChildEvents(leafer);
|
|
9062
|
+
}
|
|
9063
|
+
forEach(fn) {
|
|
9064
|
+
this.children.forEach(fn);
|
|
9065
|
+
}
|
|
9066
|
+
__onCreated() {
|
|
9067
|
+
this.created = this.children.every(child => child.created);
|
|
9068
|
+
}
|
|
9069
|
+
__onReady() {
|
|
9070
|
+
if (this.children.every(child => child.ready))
|
|
9071
|
+
super.__onReady();
|
|
9072
|
+
}
|
|
9073
|
+
__onViewReady() {
|
|
9074
|
+
if (this.children.every(child => child.viewReady))
|
|
9075
|
+
super.__onViewReady();
|
|
9076
|
+
}
|
|
9077
|
+
__onChildRenderEnd(e) {
|
|
9078
|
+
this.renderer.addBlock(e.renderBounds);
|
|
9079
|
+
if (this.viewReady)
|
|
9080
|
+
this.renderer.update();
|
|
9081
|
+
}
|
|
9082
|
+
__render(canvas, options) {
|
|
9083
|
+
if (canvas.context)
|
|
9084
|
+
this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
|
|
9085
|
+
}
|
|
9086
|
+
__onResize(event) {
|
|
9087
|
+
this.forEach(leafer => leafer.resize(event));
|
|
9088
|
+
super.__onResize(event);
|
|
9089
|
+
}
|
|
9090
|
+
updateLayout() {
|
|
9091
|
+
this.forEach(leafer => leafer.updateLayout());
|
|
9092
|
+
}
|
|
9093
|
+
__getChildConfig(userConfig) {
|
|
9094
|
+
const config = Object.assign({}, this.config);
|
|
9095
|
+
config.hittable = config.realCanvas = undefined;
|
|
9096
|
+
if (userConfig)
|
|
9097
|
+
DataHelper.assign(config, userConfig);
|
|
9098
|
+
if (this.autoLayout)
|
|
9099
|
+
DataHelper.copyAttrs(config, this, canvasSizeAttrs);
|
|
9100
|
+
config.view = this.realCanvas ? undefined : this.view;
|
|
9101
|
+
config.fill = undefined;
|
|
9102
|
+
return config;
|
|
9103
|
+
}
|
|
9104
|
+
__listenChildEvents(leafer) {
|
|
9105
|
+
leafer.once([
|
|
9106
|
+
[LayoutEvent.END, this.__onReady, this],
|
|
9107
|
+
[RenderEvent.START, this.__onCreated, this],
|
|
9108
|
+
[RenderEvent.END, this.__onViewReady, this]
|
|
9109
|
+
]);
|
|
9110
|
+
if (this.realCanvas)
|
|
9111
|
+
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9112
|
+
}
|
|
9113
|
+
};
|
|
9114
|
+
App = __decorate([
|
|
9115
|
+
registerUI()
|
|
9116
|
+
], App);
|
|
9117
|
+
|
|
9118
|
+
const downKeyMap = {};
|
|
9119
|
+
const Keyboard = {
|
|
9120
|
+
isHoldSpaceKey() {
|
|
9121
|
+
return Keyboard.isHold('Space');
|
|
9122
|
+
},
|
|
9123
|
+
isHold(code) {
|
|
9124
|
+
return downKeyMap[code];
|
|
9125
|
+
},
|
|
9126
|
+
setDownCode(code) {
|
|
9127
|
+
if (!downKeyMap[code])
|
|
9128
|
+
downKeyMap[code] = true;
|
|
9129
|
+
},
|
|
9130
|
+
setUpCode(code) {
|
|
9131
|
+
downKeyMap[code] = false;
|
|
9132
|
+
}
|
|
9133
|
+
};
|
|
9134
|
+
|
|
9135
|
+
const PointerButton = {
|
|
9136
|
+
LEFT: 1,
|
|
9137
|
+
RIGHT: 2,
|
|
9138
|
+
MIDDLE: 4,
|
|
9139
|
+
defaultLeft(event) { if (!event.buttons)
|
|
9140
|
+
event.buttons = 1; },
|
|
9141
|
+
left(event) { return event.buttons === 1; },
|
|
9142
|
+
right(event) { return event.buttons === 2; },
|
|
9143
|
+
middle(event) { return event.buttons === 4; }
|
|
9144
|
+
};
|
|
9145
|
+
|
|
9146
|
+
class UIEvent extends Event {
|
|
9147
|
+
get spaceKey() { return Keyboard.isHoldSpaceKey(); }
|
|
9148
|
+
get left() { return PointerButton.left(this); }
|
|
9149
|
+
get right() { return PointerButton.right(this); }
|
|
9150
|
+
get middle() { return PointerButton.middle(this); }
|
|
9151
|
+
constructor(params) {
|
|
9152
|
+
super(params.type);
|
|
9153
|
+
this.bubbles = true;
|
|
9154
|
+
Object.assign(this, params);
|
|
9155
|
+
}
|
|
9156
|
+
getBoxPoint(relative) {
|
|
9157
|
+
return (relative || this.current).getBoxPoint(this);
|
|
9158
|
+
}
|
|
9159
|
+
getInnerPoint(relative) {
|
|
9160
|
+
return (relative || this.current).getInnerPoint(this);
|
|
9161
|
+
}
|
|
9162
|
+
getLocalPoint(relative) {
|
|
9163
|
+
return (relative || this.current).getLocalPoint(this);
|
|
9164
|
+
}
|
|
9165
|
+
getPagePoint() {
|
|
9166
|
+
return this.current.getPagePoint(this);
|
|
9167
|
+
}
|
|
9168
|
+
getInner(relative) { return this.getInnerPoint(relative); }
|
|
9169
|
+
getLocal(relative) { return this.getLocalPoint(relative); }
|
|
9170
|
+
getPage() { return this.getPagePoint(); }
|
|
9171
|
+
static changeName(oldName, newName) {
|
|
9172
|
+
EventCreator.changeName(oldName, newName);
|
|
9173
|
+
}
|
|
9174
|
+
}
|
|
9175
|
+
|
|
9176
|
+
let PointerEvent = class PointerEvent extends UIEvent {
|
|
9177
|
+
};
|
|
9178
|
+
PointerEvent.POINTER = 'pointer';
|
|
9179
|
+
PointerEvent.BEFORE_DOWN = 'pointer.before_down';
|
|
9180
|
+
PointerEvent.BEFORE_MOVE = 'pointer.before_move';
|
|
9181
|
+
PointerEvent.BEFORE_UP = 'pointer.before_up';
|
|
9182
|
+
PointerEvent.DOWN = 'pointer.down';
|
|
9183
|
+
PointerEvent.MOVE = 'pointer.move';
|
|
9184
|
+
PointerEvent.UP = 'pointer.up';
|
|
9185
|
+
PointerEvent.OVER = 'pointer.over';
|
|
9186
|
+
PointerEvent.OUT = 'pointer.out';
|
|
9187
|
+
PointerEvent.ENTER = 'pointer.enter';
|
|
9188
|
+
PointerEvent.LEAVE = 'pointer.leave';
|
|
9189
|
+
PointerEvent.TAP = 'tap';
|
|
9190
|
+
PointerEvent.DOUBLE_TAP = 'double_tap';
|
|
9191
|
+
PointerEvent.CLICK = 'click';
|
|
9192
|
+
PointerEvent.DOUBLE_CLICK = 'double_click';
|
|
9193
|
+
PointerEvent.LONG_PRESS = 'long_press';
|
|
9194
|
+
PointerEvent.LONG_TAP = 'long_tap';
|
|
9195
|
+
PointerEvent.MENU = 'pointer.menu';
|
|
9196
|
+
PointerEvent.MENU_TAP = 'pointer.menu_tap';
|
|
9197
|
+
PointerEvent = __decorate([
|
|
9198
|
+
registerUIEvent()
|
|
9199
|
+
], PointerEvent);
|
|
9200
|
+
|
|
9201
|
+
const tempMove = {};
|
|
9202
|
+
let DragEvent = class DragEvent extends PointerEvent {
|
|
9203
|
+
static setList(data) {
|
|
9204
|
+
this.list = data instanceof LeafList ? data : new LeafList(data);
|
|
9205
|
+
}
|
|
9206
|
+
static setData(data) {
|
|
9207
|
+
this.data = data;
|
|
9208
|
+
}
|
|
9209
|
+
static getValidMove(leaf, start, total) {
|
|
9210
|
+
const { draggable, dragBounds } = leaf, move = leaf.getLocalPoint(total, null, true);
|
|
9211
|
+
PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
|
|
9212
|
+
if (dragBounds)
|
|
9213
|
+
this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
|
|
9214
|
+
if (draggable === 'x')
|
|
9215
|
+
move.y = 0;
|
|
9216
|
+
if (draggable === 'y')
|
|
9217
|
+
move.x = 0;
|
|
9218
|
+
return move;
|
|
9219
|
+
}
|
|
9220
|
+
static getMoveInDragBounds(childBox, dragBounds, move, change) {
|
|
9221
|
+
const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
|
|
9222
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9223
|
+
if (!change)
|
|
9224
|
+
move = Object.assign({}, move);
|
|
9225
|
+
if (BoundsHelper.includes(childBox, dragBounds)) {
|
|
9226
|
+
if (x > dragBounds.x)
|
|
9227
|
+
move.x += dragBounds.x - x;
|
|
9228
|
+
else if (right < boundsRight)
|
|
9229
|
+
move.x += boundsRight - right;
|
|
9230
|
+
if (y > dragBounds.y)
|
|
9231
|
+
move.y += dragBounds.y - y;
|
|
9232
|
+
else if (bottom < boundsBottom)
|
|
9233
|
+
move.y += boundsBottom - bottom;
|
|
9234
|
+
}
|
|
9235
|
+
else {
|
|
9236
|
+
if (x < dragBounds.x)
|
|
9237
|
+
move.x += dragBounds.x - x;
|
|
9238
|
+
else if (right > boundsRight)
|
|
9239
|
+
move.x += boundsRight - right;
|
|
9240
|
+
if (y < dragBounds.y)
|
|
9241
|
+
move.y += dragBounds.y - y;
|
|
9242
|
+
else if (bottom > boundsBottom)
|
|
9243
|
+
move.y += boundsBottom - bottom;
|
|
9244
|
+
}
|
|
9245
|
+
return move;
|
|
9246
|
+
}
|
|
9247
|
+
getPageMove(total) {
|
|
9248
|
+
this.assignMove(total);
|
|
9249
|
+
return this.current.getPagePoint(tempMove, null, true);
|
|
9250
|
+
}
|
|
9251
|
+
getInnerMove(relative, total) {
|
|
9252
|
+
if (!relative)
|
|
9253
|
+
relative = this.current;
|
|
9254
|
+
this.assignMove(total);
|
|
9255
|
+
return relative.getInnerPoint(tempMove, null, true);
|
|
9256
|
+
}
|
|
9257
|
+
getLocalMove(relative, total) {
|
|
9258
|
+
if (!relative)
|
|
9259
|
+
relative = this.current;
|
|
9260
|
+
this.assignMove(total);
|
|
9261
|
+
return relative.getLocalPoint(tempMove, null, true);
|
|
9262
|
+
}
|
|
9263
|
+
getPageTotal() {
|
|
9264
|
+
return this.getPageMove(true);
|
|
9265
|
+
}
|
|
9266
|
+
getInnerTotal(relative) {
|
|
9267
|
+
return this.getInnerMove(relative, true);
|
|
9268
|
+
}
|
|
9269
|
+
getLocalTotal(relative) {
|
|
9270
|
+
return this.getLocalMove(relative, true);
|
|
9271
|
+
}
|
|
9272
|
+
getPageBounds() {
|
|
9273
|
+
const total = this.getPageTotal(), start = this.getPagePoint(), bounds = {};
|
|
9274
|
+
BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
|
|
9275
|
+
BoundsHelper.unsign(bounds);
|
|
9276
|
+
return bounds;
|
|
9277
|
+
}
|
|
9278
|
+
assignMove(total) {
|
|
9279
|
+
tempMove.x = total ? this.totalX : this.moveX;
|
|
9280
|
+
tempMove.y = total ? this.totalY : this.moveY;
|
|
9281
|
+
}
|
|
9282
|
+
};
|
|
9283
|
+
DragEvent.BEFORE_DRAG = 'drag.before_drag';
|
|
9284
|
+
DragEvent.START = 'drag.start';
|
|
9285
|
+
DragEvent.DRAG = 'drag';
|
|
9286
|
+
DragEvent.END = 'drag.end';
|
|
9287
|
+
DragEvent.OVER = 'drag.over';
|
|
9288
|
+
DragEvent.OUT = 'drag.out';
|
|
9289
|
+
DragEvent.ENTER = 'drag.enter';
|
|
9290
|
+
DragEvent.LEAVE = 'drag.leave';
|
|
9291
|
+
DragEvent = __decorate([
|
|
9292
|
+
registerUIEvent()
|
|
9293
|
+
], DragEvent);
|
|
9294
|
+
|
|
9295
|
+
let DropEvent = class DropEvent extends PointerEvent {
|
|
9296
|
+
static setList(data) {
|
|
9297
|
+
DragEvent.setList(data);
|
|
9298
|
+
}
|
|
9299
|
+
static setData(data) {
|
|
9300
|
+
DragEvent.setData(data);
|
|
9301
|
+
}
|
|
9302
|
+
};
|
|
9303
|
+
DropEvent.DROP = 'drop';
|
|
9304
|
+
DropEvent = __decorate([
|
|
9305
|
+
registerUIEvent()
|
|
9306
|
+
], DropEvent);
|
|
9307
|
+
|
|
9308
|
+
let MoveEvent = class MoveEvent extends DragEvent {
|
|
9309
|
+
};
|
|
9310
|
+
MoveEvent.BEFORE_MOVE = 'move.before_move';
|
|
9311
|
+
MoveEvent.START = 'move.start';
|
|
9312
|
+
MoveEvent.MOVE = 'move';
|
|
9313
|
+
MoveEvent.END = 'move.end';
|
|
9314
|
+
MoveEvent = __decorate([
|
|
9315
|
+
registerUIEvent()
|
|
9316
|
+
], MoveEvent);
|
|
9317
|
+
|
|
9318
|
+
let RotateEvent = class RotateEvent extends PointerEvent {
|
|
9319
|
+
};
|
|
9320
|
+
RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
|
|
9321
|
+
RotateEvent.START = 'rotate.start';
|
|
9322
|
+
RotateEvent.ROTATE = 'rotate';
|
|
9323
|
+
RotateEvent.END = 'rotate.end';
|
|
9324
|
+
RotateEvent = __decorate([
|
|
9325
|
+
registerUIEvent()
|
|
9326
|
+
], RotateEvent);
|
|
9327
|
+
|
|
9328
|
+
let SwipeEvent = class SwipeEvent extends DragEvent {
|
|
9329
|
+
};
|
|
9330
|
+
SwipeEvent.SWIPE = 'swipe';
|
|
9331
|
+
SwipeEvent.LEFT = 'swipe.left';
|
|
9332
|
+
SwipeEvent.RIGHT = 'swipe.right';
|
|
9333
|
+
SwipeEvent.UP = 'swipe.up';
|
|
9334
|
+
SwipeEvent.DOWN = 'swipe.down';
|
|
9335
|
+
SwipeEvent = __decorate([
|
|
9336
|
+
registerUIEvent()
|
|
9337
|
+
], SwipeEvent);
|
|
9338
|
+
|
|
9339
|
+
let ZoomEvent = class ZoomEvent extends PointerEvent {
|
|
9340
|
+
};
|
|
9341
|
+
ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
|
|
9342
|
+
ZoomEvent.START = 'zoom.start';
|
|
9343
|
+
ZoomEvent.ZOOM = 'zoom';
|
|
9344
|
+
ZoomEvent.END = 'zoom.end';
|
|
9345
|
+
ZoomEvent = __decorate([
|
|
9346
|
+
registerUIEvent()
|
|
9347
|
+
], ZoomEvent);
|
|
9348
|
+
|
|
9349
|
+
let KeyEvent = class KeyEvent extends UIEvent {
|
|
9350
|
+
};
|
|
9351
|
+
KeyEvent.DOWN = 'key.down';
|
|
9352
|
+
KeyEvent.HOLD = 'key.hold';
|
|
9353
|
+
KeyEvent.UP = 'key.up';
|
|
9354
|
+
KeyEvent = __decorate([
|
|
9355
|
+
registerUIEvent()
|
|
9356
|
+
], KeyEvent);
|
|
9357
|
+
|
|
9358
|
+
new LeafList();
|
|
9359
|
+
|
|
9360
|
+
Debug.get('emit');
|
|
9361
|
+
|
|
9362
|
+
const { toInnerRadiusPointOf, copy: copy$2, setRadius } = PointHelper;
|
|
9363
|
+
const inner = {};
|
|
9364
|
+
const leaf = exports.Leaf.prototype;
|
|
9365
|
+
leaf.__hitWorld = function (point) {
|
|
9366
|
+
const data = this.__;
|
|
9367
|
+
if (!data.hitSelf)
|
|
9368
|
+
return false;
|
|
9369
|
+
const world = this.__world, layout = this.__layout;
|
|
9370
|
+
const isSmall = world.width < 10 && world.height < 10;
|
|
9371
|
+
if (data.hitRadius) {
|
|
9372
|
+
copy$2(inner, point), point = inner;
|
|
9373
|
+
setRadius(point, data.hitRadius);
|
|
9374
|
+
}
|
|
9375
|
+
toInnerRadiusPointOf(point, world, inner);
|
|
9376
|
+
if (data.hitBox || isSmall) {
|
|
9377
|
+
if (BoundsHelper.hitRadiusPoint(layout.boxBounds, inner))
|
|
9378
|
+
return true;
|
|
9379
|
+
if (isSmall)
|
|
9380
|
+
return false;
|
|
9381
|
+
}
|
|
9382
|
+
if (layout.hitCanvasChanged || !this.__hitCanvas) {
|
|
9383
|
+
this.__updateHitCanvas();
|
|
9384
|
+
if (!layout.boundsChanged)
|
|
9385
|
+
layout.hitCanvasChanged = false;
|
|
9386
|
+
}
|
|
9387
|
+
return this.__hit(inner);
|
|
9388
|
+
};
|
|
9389
|
+
leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
|
|
9390
|
+
leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
|
|
9391
|
+
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); };
|
|
9392
|
+
leaf.__drawHitPath = function (canvas) { if (canvas)
|
|
9393
|
+
this.__drawRenderPath(canvas); };
|
|
9394
|
+
|
|
9395
|
+
const matrix = new Matrix();
|
|
9396
|
+
const ui$1 = exports.UI.prototype;
|
|
9397
|
+
ui$1.__updateHitCanvas = function () {
|
|
9398
|
+
if (this.__box)
|
|
9399
|
+
this.__box.__updateHitCanvas();
|
|
9400
|
+
const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
|
|
9401
|
+
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
9402
|
+
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
9403
|
+
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
9404
|
+
if (!this.__hitCanvas)
|
|
9405
|
+
this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
|
|
9406
|
+
const h = this.__hitCanvas;
|
|
9407
|
+
if (isHitPixel) {
|
|
9408
|
+
const { renderBounds } = this.__layout;
|
|
9409
|
+
const size = Platform.image.hitCanvasSize;
|
|
9410
|
+
const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds).a;
|
|
9411
|
+
const { x, y, width, height } = tempBounds$1.set(renderBounds).scale(scale);
|
|
9412
|
+
h.resize({ width, height, pixelRatio: 1 });
|
|
9413
|
+
h.clear();
|
|
9414
|
+
ImageManager.patternLocked = true;
|
|
9415
|
+
this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y) }, !isHitPixelFill, !isHitPixelStroke);
|
|
9416
|
+
ImageManager.patternLocked = false;
|
|
9417
|
+
h.resetTransform();
|
|
9418
|
+
data.__isHitPixel = true;
|
|
9419
|
+
}
|
|
9420
|
+
else {
|
|
9421
|
+
data.__isHitPixel && (data.__isHitPixel = false);
|
|
9422
|
+
}
|
|
9423
|
+
this.__drawHitPath(h);
|
|
9424
|
+
h.setStrokeOptions(data);
|
|
9425
|
+
};
|
|
9426
|
+
ui$1.__hit = function (inner) {
|
|
9427
|
+
if (this.__box && this.__box.__hit(inner))
|
|
9428
|
+
return true;
|
|
9429
|
+
const data = this.__;
|
|
9430
|
+
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
9431
|
+
return true;
|
|
9432
|
+
const { hitFill } = data;
|
|
9433
|
+
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
9434
|
+
if (needHitFillPath && this.__hitFill(inner))
|
|
9435
|
+
return true;
|
|
9436
|
+
const { hitStroke, __strokeWidth } = data;
|
|
9437
|
+
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
9438
|
+
if (!needHitFillPath && !needHitStrokePath)
|
|
9439
|
+
return false;
|
|
9440
|
+
const radiusWidth = inner.radiusX * 2;
|
|
9441
|
+
let hitWidth = radiusWidth;
|
|
9442
|
+
if (needHitStrokePath) {
|
|
9443
|
+
switch (data.strokeAlign) {
|
|
9444
|
+
case 'inside':
|
|
9445
|
+
hitWidth += __strokeWidth * 2;
|
|
9446
|
+
if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
9447
|
+
return true;
|
|
9448
|
+
hitWidth = radiusWidth;
|
|
9449
|
+
break;
|
|
9450
|
+
case 'center':
|
|
9451
|
+
hitWidth += __strokeWidth;
|
|
9452
|
+
break;
|
|
9453
|
+
case 'outside':
|
|
9454
|
+
hitWidth += __strokeWidth * 2;
|
|
9455
|
+
if (!needHitFillPath) {
|
|
9456
|
+
if (!this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
9457
|
+
return true;
|
|
9458
|
+
hitWidth = radiusWidth;
|
|
9459
|
+
}
|
|
9460
|
+
break;
|
|
9461
|
+
}
|
|
9462
|
+
}
|
|
9463
|
+
return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
|
|
9464
|
+
};
|
|
9465
|
+
|
|
9466
|
+
const ui = exports.UI.prototype, rect = exports.Rect.prototype, box$1 = exports.Box.prototype;
|
|
9467
|
+
rect.__updateHitCanvas = box$1.__updateHitCanvas = function () {
|
|
9468
|
+
if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
|
|
9469
|
+
ui.__updateHitCanvas.call(this);
|
|
9470
|
+
else if (this.__hitCanvas)
|
|
9471
|
+
this.__hitCanvas = null;
|
|
9472
|
+
};
|
|
9473
|
+
rect.__hitFill = box$1.__hitFill = function (inner) {
|
|
9474
|
+
return this.__hitCanvas ? ui.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
|
|
9475
|
+
};
|
|
9476
|
+
|
|
9477
|
+
exports.Text.prototype.__drawHitPath = function (canvas) {
|
|
9478
|
+
const { __lineHeight, fontSize, __baseLine, __letterSpacing, __textDrawData: data } = this.__;
|
|
9479
|
+
canvas.beginPath();
|
|
9480
|
+
if (__letterSpacing < 0)
|
|
9481
|
+
this.__drawPathByBox(canvas);
|
|
9482
|
+
else
|
|
9483
|
+
data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
|
|
9484
|
+
};
|
|
9485
|
+
|
|
9486
|
+
function getSelector(ui) {
|
|
9487
|
+
return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
|
|
9488
|
+
}
|
|
9489
|
+
exports.Group.prototype.pick = function (hitPoint, options) {
|
|
9490
|
+
options || (options = emptyData);
|
|
9491
|
+
this.updateLayout();
|
|
9492
|
+
return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
|
|
9493
|
+
};
|
|
9494
|
+
|
|
9495
|
+
const canvas = LeaferCanvasBase.prototype;
|
|
9496
|
+
canvas.hitFill = function (point, fillRule) {
|
|
9497
|
+
return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
|
|
9498
|
+
};
|
|
9499
|
+
canvas.hitStroke = function (point, strokeWidth) {
|
|
9500
|
+
this.strokeWidth = strokeWidth;
|
|
9501
|
+
return this.context.isPointInStroke(point.x, point.y);
|
|
9502
|
+
};
|
|
9503
|
+
canvas.hitPixel = function (radiusPoint, offset, scale = 1) {
|
|
9504
|
+
let { x, y, radiusX, radiusY } = radiusPoint;
|
|
9505
|
+
if (offset)
|
|
9506
|
+
x -= offset.x, y -= offset.y;
|
|
9507
|
+
tempBounds$1.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
|
|
9508
|
+
const { data } = this.context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width || 1, tempBounds$1.height || 1);
|
|
9509
|
+
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
9510
|
+
if (data[i + 3] > 0)
|
|
9511
|
+
return true;
|
|
9512
|
+
}
|
|
9513
|
+
return data[3] > 0;
|
|
9514
|
+
};
|
|
8839
9515
|
|
|
8840
9516
|
function strokeText(stroke, ui, canvas) {
|
|
8841
|
-
|
|
8842
|
-
const isStrokes = typeof stroke !== 'string';
|
|
8843
|
-
switch (strokeAlign) {
|
|
9517
|
+
switch (ui.__.strokeAlign) {
|
|
8844
9518
|
case 'center':
|
|
8845
|
-
|
|
8846
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
9519
|
+
drawCenter$1(stroke, 1, ui, canvas);
|
|
8847
9520
|
break;
|
|
8848
9521
|
case 'inside':
|
|
8849
|
-
|
|
9522
|
+
drawAlign(stroke, 'inside', ui, canvas);
|
|
8850
9523
|
break;
|
|
8851
9524
|
case 'outside':
|
|
8852
|
-
|
|
9525
|
+
ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, 'outside', ui, canvas);
|
|
8853
9526
|
break;
|
|
8854
9527
|
}
|
|
8855
9528
|
}
|
|
8856
|
-
function
|
|
8857
|
-
const
|
|
9529
|
+
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
9530
|
+
const data = ui.__;
|
|
9531
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
|
|
9532
|
+
data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
|
|
9533
|
+
}
|
|
9534
|
+
function drawAlign(stroke, align, ui, canvas) {
|
|
8858
9535
|
const out = canvas.getSameCanvas(true, true);
|
|
8859
|
-
out.
|
|
8860
|
-
|
|
8861
|
-
isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
|
|
9536
|
+
out.font = ui.__.__font;
|
|
9537
|
+
drawCenter$1(stroke, 2, ui, out);
|
|
8862
9538
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
8863
9539
|
fillText(ui, out);
|
|
8864
9540
|
out.blendMode = 'normal';
|
|
8865
|
-
if (ui.__worldFlipped)
|
|
9541
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
8866
9542
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
8867
9543
|
else
|
|
8868
9544
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
@@ -8904,90 +9580,60 @@ var LeaferUI = (function (exports) {
|
|
|
8904
9580
|
}
|
|
8905
9581
|
|
|
8906
9582
|
function stroke(stroke, ui, canvas) {
|
|
8907
|
-
const
|
|
8908
|
-
|
|
8909
|
-
if (!__strokeWidth)
|
|
9583
|
+
const data = ui.__;
|
|
9584
|
+
if (!data.__strokeWidth)
|
|
8910
9585
|
return;
|
|
8911
|
-
if (__font) {
|
|
9586
|
+
if (data.__font) {
|
|
8912
9587
|
strokeText(stroke, ui, canvas);
|
|
8913
9588
|
}
|
|
8914
9589
|
else {
|
|
8915
|
-
switch (strokeAlign) {
|
|
9590
|
+
switch (data.strokeAlign) {
|
|
8916
9591
|
case 'center':
|
|
8917
|
-
|
|
8918
|
-
canvas.stroke();
|
|
8919
|
-
if (options.__useArrow)
|
|
8920
|
-
strokeArrow(ui, canvas);
|
|
9592
|
+
drawCenter(stroke, 1, ui, canvas);
|
|
8921
9593
|
break;
|
|
8922
9594
|
case 'inside':
|
|
8923
|
-
canvas
|
|
8924
|
-
canvas.setStroke(stroke, __strokeWidth * 2, options);
|
|
8925
|
-
options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
|
|
8926
|
-
canvas.stroke();
|
|
8927
|
-
canvas.restore();
|
|
9595
|
+
drawInside(stroke, ui, canvas);
|
|
8928
9596
|
break;
|
|
8929
9597
|
case 'outside':
|
|
8930
|
-
|
|
8931
|
-
out.setStroke(stroke, __strokeWidth * 2, options);
|
|
8932
|
-
ui.__drawRenderPath(out);
|
|
8933
|
-
out.stroke();
|
|
8934
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
8935
|
-
out.clearWorld(ui.__layout.renderBounds);
|
|
8936
|
-
if (ui.__worldFlipped)
|
|
8937
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
8938
|
-
else
|
|
8939
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
8940
|
-
out.recycle(ui.__nowWorld);
|
|
9598
|
+
drawOutside(stroke, ui, canvas);
|
|
8941
9599
|
break;
|
|
8942
9600
|
}
|
|
8943
9601
|
}
|
|
8944
9602
|
}
|
|
8945
9603
|
function strokes(strokes, ui, canvas) {
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
9604
|
+
stroke(strokes, ui, canvas);
|
|
9605
|
+
}
|
|
9606
|
+
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
9607
|
+
const data = ui.__;
|
|
9608
|
+
canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
9609
|
+
data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
|
|
9610
|
+
if (data.__useArrow)
|
|
9611
|
+
Paint.strokeArrow(stroke, ui, canvas);
|
|
9612
|
+
}
|
|
9613
|
+
function drawInside(stroke, ui, canvas) {
|
|
9614
|
+
const data = ui.__;
|
|
9615
|
+
canvas.save();
|
|
9616
|
+
data.windingRule ? canvas.clip(data.windingRule) : canvas.clip();
|
|
9617
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
9618
|
+
canvas.restore();
|
|
9619
|
+
}
|
|
9620
|
+
function drawOutside(stroke, ui, canvas) {
|
|
9621
|
+
const data = ui.__;
|
|
9622
|
+
if (data.__fillAfterStroke) {
|
|
9623
|
+
drawCenter(stroke, 2, ui, canvas);
|
|
8952
9624
|
}
|
|
8953
9625
|
else {
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
drawStrokesStyle(strokes, false, ui, canvas);
|
|
8966
|
-
canvas.restore();
|
|
8967
|
-
break;
|
|
8968
|
-
case 'outside':
|
|
8969
|
-
const { renderBounds } = ui.__layout;
|
|
8970
|
-
const out = canvas.getSameCanvas(true, true);
|
|
8971
|
-
ui.__drawRenderPath(out);
|
|
8972
|
-
out.setStroke(undefined, __strokeWidth * 2, options);
|
|
8973
|
-
drawStrokesStyle(strokes, false, ui, out);
|
|
8974
|
-
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
8975
|
-
out.clearWorld(renderBounds);
|
|
8976
|
-
if (ui.__worldFlipped)
|
|
8977
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
8978
|
-
else
|
|
8979
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
8980
|
-
out.recycle(ui.__nowWorld);
|
|
8981
|
-
break;
|
|
8982
|
-
}
|
|
8983
|
-
}
|
|
8984
|
-
}
|
|
8985
|
-
function strokeArrow(ui, canvas) {
|
|
8986
|
-
if (ui.__.dashPattern) {
|
|
8987
|
-
canvas.beginPath();
|
|
8988
|
-
ui.__drawPathByData(canvas, ui.__.__pathForArrow);
|
|
8989
|
-
canvas.dashPattern = null;
|
|
8990
|
-
canvas.stroke();
|
|
9626
|
+
const { renderBounds } = ui.__layout;
|
|
9627
|
+
const out = canvas.getSameCanvas(true, true);
|
|
9628
|
+
ui.__drawRenderPath(out);
|
|
9629
|
+
drawCenter(stroke, 2, ui, out);
|
|
9630
|
+
data.windingRule ? out.clip(data.windingRule) : out.clip();
|
|
9631
|
+
out.clearWorld(renderBounds);
|
|
9632
|
+
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
9633
|
+
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9634
|
+
else
|
|
9635
|
+
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
9636
|
+
out.recycle(ui.__nowWorld);
|
|
8991
9637
|
}
|
|
8992
9638
|
}
|
|
8993
9639
|
|
|
@@ -9034,9 +9680,10 @@ var LeaferUI = (function (exports) {
|
|
|
9034
9680
|
}
|
|
9035
9681
|
|
|
9036
9682
|
let recycleMap;
|
|
9683
|
+
const { stintSet } = DataHelper, { hasTransparent: hasTransparent$1 } = ColorConvert;
|
|
9037
9684
|
function compute(attrName, ui) {
|
|
9038
9685
|
const data = ui.__, leafPaints = [];
|
|
9039
|
-
let paints = data.__input[attrName],
|
|
9686
|
+
let paints = data.__input[attrName], isAlphaPixel, isTransparent;
|
|
9040
9687
|
if (!(paints instanceof Array))
|
|
9041
9688
|
paints = [paints];
|
|
9042
9689
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
@@ -9046,35 +9693,62 @@ var LeaferUI = (function (exports) {
|
|
|
9046
9693
|
leafPaints.push(item);
|
|
9047
9694
|
}
|
|
9048
9695
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
9049
|
-
if (leafPaints.length
|
|
9050
|
-
|
|
9051
|
-
|
|
9696
|
+
if (leafPaints.length) {
|
|
9697
|
+
if (leafPaints.every(item => item.isTransparent)) {
|
|
9698
|
+
if (leafPaints.some(item => item.image))
|
|
9699
|
+
isAlphaPixel = true;
|
|
9700
|
+
isTransparent = true;
|
|
9701
|
+
}
|
|
9702
|
+
}
|
|
9703
|
+
if (attrName === 'fill') {
|
|
9704
|
+
stintSet(data, '__isAlphaPixelFill', isAlphaPixel);
|
|
9705
|
+
stintSet(data, '__isTransparentFill', isTransparent);
|
|
9706
|
+
}
|
|
9707
|
+
else {
|
|
9708
|
+
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
9709
|
+
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
9710
|
+
}
|
|
9052
9711
|
}
|
|
9053
9712
|
function getLeafPaint(attrName, paint, ui) {
|
|
9054
9713
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
|
9055
9714
|
return undefined;
|
|
9715
|
+
let data;
|
|
9056
9716
|
const { boxBounds } = ui.__layout;
|
|
9057
9717
|
switch (paint.type) {
|
|
9058
|
-
case 'solid':
|
|
9059
|
-
let { type, blendMode, color, opacity } = paint;
|
|
9060
|
-
return { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
9061
9718
|
case 'image':
|
|
9062
|
-
|
|
9719
|
+
data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
9720
|
+
break;
|
|
9063
9721
|
case 'linear':
|
|
9064
|
-
|
|
9722
|
+
data = PaintGradient.linearGradient(paint, boxBounds);
|
|
9723
|
+
break;
|
|
9065
9724
|
case 'radial':
|
|
9066
|
-
|
|
9725
|
+
data = PaintGradient.radialGradient(paint, boxBounds);
|
|
9726
|
+
break;
|
|
9067
9727
|
case 'angular':
|
|
9068
|
-
|
|
9728
|
+
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
9729
|
+
break;
|
|
9730
|
+
case 'solid':
|
|
9731
|
+
const { type, blendMode, color, opacity } = paint;
|
|
9732
|
+
data = { type, blendMode, style: ColorConvert.string(color, opacity) };
|
|
9733
|
+
break;
|
|
9069
9734
|
default:
|
|
9070
|
-
|
|
9735
|
+
if (paint.r !== undefined)
|
|
9736
|
+
data = { type: 'solid', style: ColorConvert.string(paint) };
|
|
9071
9737
|
}
|
|
9738
|
+
if (data) {
|
|
9739
|
+
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
9740
|
+
data.isTransparent = true;
|
|
9741
|
+
if (paint.blendMode)
|
|
9742
|
+
data.blendMode = paint.blendMode;
|
|
9743
|
+
}
|
|
9744
|
+
return data;
|
|
9072
9745
|
}
|
|
9073
9746
|
|
|
9074
9747
|
const PaintModule = {
|
|
9075
9748
|
compute,
|
|
9076
9749
|
fill,
|
|
9077
9750
|
fills,
|
|
9751
|
+
fillPathOrText,
|
|
9078
9752
|
fillText,
|
|
9079
9753
|
stroke,
|
|
9080
9754
|
strokes,
|
|
@@ -9133,12 +9807,10 @@ var LeaferUI = (function (exports) {
|
|
|
9133
9807
|
|
|
9134
9808
|
const { get: get$2, translate } = MatrixHelper;
|
|
9135
9809
|
const tempBox = new Bounds();
|
|
9136
|
-
const tempPoint = {};
|
|
9137
9810
|
const tempScaleData = {};
|
|
9811
|
+
const tempImage = {};
|
|
9138
9812
|
function createData(leafPaint, image, paint, box) {
|
|
9139
|
-
const {
|
|
9140
|
-
if (blendMode)
|
|
9141
|
-
leafPaint.blendMode = blendMode;
|
|
9813
|
+
const { changeful, sync } = paint;
|
|
9142
9814
|
if (changeful)
|
|
9143
9815
|
leafPaint.changeful = changeful;
|
|
9144
9816
|
if (sync)
|
|
@@ -9146,38 +9818,38 @@ var LeaferUI = (function (exports) {
|
|
|
9146
9818
|
leafPaint.data = getPatternData(paint, box, image);
|
|
9147
9819
|
}
|
|
9148
9820
|
function getPatternData(paint, box, image) {
|
|
9149
|
-
let { width, height } = image;
|
|
9150
9821
|
if (paint.padding)
|
|
9151
9822
|
box = tempBox.set(box).shrink(paint.padding);
|
|
9152
9823
|
if (paint.mode === 'strench')
|
|
9153
9824
|
paint.mode = 'stretch';
|
|
9825
|
+
let { width, height } = image;
|
|
9154
9826
|
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
9155
9827
|
const sameBox = box.width === width && box.height === height;
|
|
9156
9828
|
const data = { mode };
|
|
9157
9829
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
9158
|
-
|
|
9159
|
-
let
|
|
9830
|
+
BoundsHelper.set(tempImage, 0, 0, swapSize ? height : width, swapSize ? width : height);
|
|
9831
|
+
let scaleX, scaleY;
|
|
9160
9832
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
9161
9833
|
if (!sameBox || rotation) {
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
|
|
9834
|
+
scaleX = scaleY = BoundsHelper.getFitScale(box, tempImage, mode !== 'fit');
|
|
9835
|
+
BoundsHelper.put(box, image, align, scaleX, false, tempImage);
|
|
9836
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
9165
9837
|
}
|
|
9166
9838
|
}
|
|
9167
|
-
else
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9839
|
+
else {
|
|
9840
|
+
if (scale || size) {
|
|
9841
|
+
MathHelper.getScaleData(scale, size, image, tempScaleData);
|
|
9842
|
+
scaleX = tempScaleData.scaleX;
|
|
9843
|
+
scaleY = tempScaleData.scaleY;
|
|
9844
|
+
}
|
|
9845
|
+
if (align) {
|
|
9846
|
+
if (scaleX)
|
|
9847
|
+
BoundsHelper.scale(tempImage, scaleX, scaleY, true);
|
|
9848
|
+
AlignHelper.toPoint(align, tempImage, box, tempImage, true, true);
|
|
9849
|
+
}
|
|
9178
9850
|
}
|
|
9179
9851
|
if (offset)
|
|
9180
|
-
|
|
9852
|
+
PointHelper.move(tempImage, offset);
|
|
9181
9853
|
switch (mode) {
|
|
9182
9854
|
case 'stretch':
|
|
9183
9855
|
if (!sameBox)
|
|
@@ -9185,12 +9857,12 @@ var LeaferUI = (function (exports) {
|
|
|
9185
9857
|
break;
|
|
9186
9858
|
case 'normal':
|
|
9187
9859
|
case 'clip':
|
|
9188
|
-
if (x || y || scaleX || rotation)
|
|
9189
|
-
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
9860
|
+
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
9861
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9190
9862
|
break;
|
|
9191
9863
|
case 'repeat':
|
|
9192
9864
|
if (!sameBox || scaleX || rotation)
|
|
9193
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
9865
|
+
repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, align);
|
|
9194
9866
|
if (!repeat)
|
|
9195
9867
|
data.repeat = 'repeat';
|
|
9196
9868
|
break;
|
|
@@ -9198,7 +9870,7 @@ var LeaferUI = (function (exports) {
|
|
|
9198
9870
|
case 'cover':
|
|
9199
9871
|
default:
|
|
9200
9872
|
if (scaleX)
|
|
9201
|
-
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
9873
|
+
fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9202
9874
|
}
|
|
9203
9875
|
if (!data.transform) {
|
|
9204
9876
|
if (box.x || box.y) {
|
|
@@ -9231,6 +9903,8 @@ var LeaferUI = (function (exports) {
|
|
|
9231
9903
|
}
|
|
9232
9904
|
else {
|
|
9233
9905
|
leafPaint = { type: paint.type, image };
|
|
9906
|
+
if (image.hasAlphaPixel)
|
|
9907
|
+
leafPaint.isTransparent = true;
|
|
9234
9908
|
cache = image.use > 1 ? { leafPaint, paint, boxBounds: box.set(boxBounds) } : null;
|
|
9235
9909
|
}
|
|
9236
9910
|
if (firstUse || image.loading)
|
|
@@ -9255,7 +9929,7 @@ var LeaferUI = (function (exports) {
|
|
|
9255
9929
|
ignoreRender(ui, false);
|
|
9256
9930
|
if (!ui.destroyed) {
|
|
9257
9931
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
|
|
9258
|
-
if (image.
|
|
9932
|
+
if (image.hasAlphaPixel)
|
|
9259
9933
|
ui.__layout.hitCanvasChanged = true;
|
|
9260
9934
|
ui.forceUpdate('surface');
|
|
9261
9935
|
}
|
|
@@ -9267,6 +9941,17 @@ var LeaferUI = (function (exports) {
|
|
|
9267
9941
|
onLoadError(ui, event, error);
|
|
9268
9942
|
leafPaint.loadId = null;
|
|
9269
9943
|
});
|
|
9944
|
+
if (ui.placeholderColor) {
|
|
9945
|
+
if (!ui.placeholderDelay)
|
|
9946
|
+
image.isPlacehold = true;
|
|
9947
|
+
else
|
|
9948
|
+
setTimeout(() => {
|
|
9949
|
+
if (!image.ready) {
|
|
9950
|
+
image.isPlacehold = true;
|
|
9951
|
+
ui.forceUpdate('surface');
|
|
9952
|
+
}
|
|
9953
|
+
}, ui.placeholderDelay);
|
|
9954
|
+
}
|
|
9270
9955
|
}
|
|
9271
9956
|
return leafPaint;
|
|
9272
9957
|
}
|
|
@@ -9472,32 +10157,33 @@ var LeaferUI = (function (exports) {
|
|
|
9472
10157
|
repeatMode
|
|
9473
10158
|
};
|
|
9474
10159
|
|
|
9475
|
-
const { toPoint: toPoint$2 } = AroundHelper;
|
|
10160
|
+
const { toPoint: toPoint$2 } = AroundHelper, { hasTransparent } = ColorConvert;
|
|
9476
10161
|
const realFrom$2 = {};
|
|
9477
10162
|
const realTo$2 = {};
|
|
9478
10163
|
function linearGradient(paint, box) {
|
|
9479
|
-
let { from, to, type,
|
|
10164
|
+
let { from, to, type, opacity } = paint;
|
|
9480
10165
|
toPoint$2(from || 'top', box, realFrom$2);
|
|
9481
10166
|
toPoint$2(to || 'bottom', box, realTo$2);
|
|
9482
10167
|
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
9483
|
-
applyStops(style, paint.stops, opacity);
|
|
9484
10168
|
const data = { type, style };
|
|
9485
|
-
|
|
9486
|
-
data.blendMode = blendMode;
|
|
10169
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9487
10170
|
return data;
|
|
9488
10171
|
}
|
|
9489
|
-
function applyStops(gradient, stops, opacity) {
|
|
10172
|
+
function applyStops(data, gradient, stops, opacity) {
|
|
9490
10173
|
if (stops) {
|
|
9491
|
-
let stop;
|
|
10174
|
+
let stop, color, offset, isTransparent;
|
|
9492
10175
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
9493
10176
|
stop = stops[i];
|
|
9494
|
-
if (typeof stop === 'string')
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
|
|
9498
|
-
|
|
9499
|
-
|
|
10177
|
+
if (typeof stop === 'string')
|
|
10178
|
+
offset = i / (len - 1), color = ColorConvert.string(stop, opacity);
|
|
10179
|
+
else
|
|
10180
|
+
offset = stop.offset, color = ColorConvert.string(stop.color, opacity);
|
|
10181
|
+
gradient.addColorStop(offset, color);
|
|
10182
|
+
if (!isTransparent && hasTransparent(color))
|
|
10183
|
+
isTransparent = true;
|
|
9500
10184
|
}
|
|
10185
|
+
if (isTransparent)
|
|
10186
|
+
data.isTransparent = true;
|
|
9501
10187
|
}
|
|
9502
10188
|
}
|
|
9503
10189
|
|
|
@@ -9507,17 +10193,15 @@ var LeaferUI = (function (exports) {
|
|
|
9507
10193
|
const realFrom$1 = {};
|
|
9508
10194
|
const realTo$1 = {};
|
|
9509
10195
|
function radialGradient(paint, box) {
|
|
9510
|
-
let { from, to, type, opacity,
|
|
10196
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
9511
10197
|
toPoint$1(from || 'center', box, realFrom$1);
|
|
9512
10198
|
toPoint$1(to || 'bottom', box, realTo$1);
|
|
9513
10199
|
const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$1(realFrom$1, realTo$1));
|
|
9514
|
-
applyStops(style, paint.stops, opacity);
|
|
9515
10200
|
const data = { type, style };
|
|
10201
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9516
10202
|
const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
|
|
9517
10203
|
if (transform)
|
|
9518
10204
|
data.transform = transform;
|
|
9519
|
-
if (blendMode)
|
|
9520
|
-
data.blendMode = blendMode;
|
|
9521
10205
|
return data;
|
|
9522
10206
|
}
|
|
9523
10207
|
function getTransform(box, from, to, stretch, rotate90) {
|
|
@@ -9543,17 +10227,15 @@ var LeaferUI = (function (exports) {
|
|
|
9543
10227
|
const realFrom = {};
|
|
9544
10228
|
const realTo = {};
|
|
9545
10229
|
function conicGradient(paint, box) {
|
|
9546
|
-
let { from, to, type, opacity,
|
|
10230
|
+
let { from, to, type, opacity, stretch } = paint;
|
|
9547
10231
|
toPoint(from || 'center', box, realFrom);
|
|
9548
10232
|
toPoint(to || 'bottom', box, realTo);
|
|
9549
10233
|
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));
|
|
9550
|
-
applyStops(style, paint.stops, opacity);
|
|
9551
10234
|
const data = { type, style };
|
|
10235
|
+
applyStops(data, style, paint.stops, opacity);
|
|
9552
10236
|
const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
|
|
9553
10237
|
if (transform)
|
|
9554
10238
|
data.transform = transform;
|
|
9555
|
-
if (blendMode)
|
|
9556
|
-
data.blendMode = blendMode;
|
|
9557
10239
|
return data;
|
|
9558
10240
|
}
|
|
9559
10241
|
|
|
@@ -9886,6 +10568,8 @@ var LeaferUI = (function (exports) {
|
|
|
9886
10568
|
lastCharType = null;
|
|
9887
10569
|
startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
|
|
9888
10570
|
word = { data: [] }, row = { words: [] };
|
|
10571
|
+
if (__letterSpacing)
|
|
10572
|
+
content = [...content];
|
|
9889
10573
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
9890
10574
|
char = content[i];
|
|
9891
10575
|
if (char === '\n') {
|
|
@@ -10304,6 +10988,7 @@ var LeaferUI = (function (exports) {
|
|
|
10304
10988
|
exports.AutoBounds = AutoBounds;
|
|
10305
10989
|
exports.BezierHelper = BezierHelper;
|
|
10306
10990
|
exports.Bounds = Bounds;
|
|
10991
|
+
exports.BoundsEvent = BoundsEvent;
|
|
10307
10992
|
exports.BoundsHelper = BoundsHelper;
|
|
10308
10993
|
exports.BoxData = BoxData;
|
|
10309
10994
|
exports.BranchHelper = BranchHelper;
|
|
@@ -10450,7 +11135,7 @@ var LeaferUI = (function (exports) {
|
|
|
10450
11135
|
exports.surfaceType = surfaceType;
|
|
10451
11136
|
exports.tempBounds = tempBounds$1;
|
|
10452
11137
|
exports.tempMatrix = tempMatrix;
|
|
10453
|
-
exports.tempPoint = tempPoint$
|
|
11138
|
+
exports.tempPoint = tempPoint$2;
|
|
10454
11139
|
exports.useCanvas = useCanvas;
|
|
10455
11140
|
exports.useModule = useModule;
|
|
10456
11141
|
exports.version = version;
|
|
@@ -10460,4 +11145,7 @@ var LeaferUI = (function (exports) {
|
|
|
10460
11145
|
return exports;
|
|
10461
11146
|
|
|
10462
11147
|
})({});
|
|
10463
|
-
|
|
11148
|
+
|
|
11149
|
+
function Leafer(opt) { return new LeaferUI.Leafer(opt); }
|
|
11150
|
+
Object.setPrototypeOf(Leafer, LeaferUI);
|
|
11151
|
+
Leafer.prototype = LeaferUI.Leafer.prototype;
|