@leafer/worker 2.0.0 → 2.0.2
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 +11 -0
- package/dist/worker.esm.js +2 -0
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +507 -190
- 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 +522 -194
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +24 -23
- package/src/index.ts +1 -0
- package/types/index.d.ts +1 -0
package/dist/worker.module.js
CHANGED
|
@@ -7,6 +7,45 @@ var PathNodeHandleType;
|
|
|
7
7
|
PathNodeHandleType[PathNodeHandleType["mirror"] = 4] = "mirror";
|
|
8
8
|
})(PathNodeHandleType || (PathNodeHandleType = {}));
|
|
9
9
|
|
|
10
|
+
function __decorate(decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) {
|
|
18
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
19
|
+
resolve(value);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
23
|
+
function fulfilled(value) {
|
|
24
|
+
try {
|
|
25
|
+
step(generator.next(value));
|
|
26
|
+
} catch (e) {
|
|
27
|
+
reject(e);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function rejected(value) {
|
|
31
|
+
try {
|
|
32
|
+
step(generator["throw"](value));
|
|
33
|
+
} catch (e) {
|
|
34
|
+
reject(e);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function step(result) {
|
|
38
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
39
|
+
}
|
|
40
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
45
|
+
var e = new Error(message);
|
|
46
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
47
|
+
};
|
|
48
|
+
|
|
10
49
|
var Answer;
|
|
11
50
|
|
|
12
51
|
(function(Answer) {
|
|
@@ -58,8 +97,8 @@ function isEmptyData(value) {
|
|
|
58
97
|
|
|
59
98
|
const DataHelper = {
|
|
60
99
|
default(t, defaultData) {
|
|
61
|
-
assign$
|
|
62
|
-
assign$
|
|
100
|
+
assign$2(defaultData, t);
|
|
101
|
+
assign$2(t, defaultData);
|
|
63
102
|
return t;
|
|
64
103
|
},
|
|
65
104
|
assign(t, merge, exclude) {
|
|
@@ -67,9 +106,9 @@ const DataHelper = {
|
|
|
67
106
|
Object.keys(merge).forEach(key => {
|
|
68
107
|
var _a, _b;
|
|
69
108
|
value = merge[key];
|
|
70
|
-
if ((value === null || value === void 0 ? void 0 : value.constructor) === Object && ((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object) return assign$
|
|
109
|
+
if ((value === null || value === void 0 ? void 0 : value.constructor) === Object && ((_a = t[key]) === null || _a === void 0 ? void 0 : _a.constructor) === Object) return assign$2(t[key], merge[key], exclude && exclude[key]);
|
|
71
110
|
if (exclude && key in exclude) {
|
|
72
|
-
if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object) assign$
|
|
111
|
+
if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object) assign$2(t[key] = {}, merge[key], exclude[key]);
|
|
73
112
|
return;
|
|
74
113
|
}
|
|
75
114
|
t[key] = merge[key];
|
|
@@ -95,7 +134,7 @@ const DataHelper = {
|
|
|
95
134
|
}
|
|
96
135
|
};
|
|
97
136
|
|
|
98
|
-
const {assign: assign$
|
|
137
|
+
const {assign: assign$2} = DataHelper;
|
|
99
138
|
|
|
100
139
|
class LeafData {
|
|
101
140
|
get __useNaturalRatio() {
|
|
@@ -410,7 +449,7 @@ function getMatrixData() {
|
|
|
410
449
|
|
|
411
450
|
const {sin: sin$6, cos: cos$6, acos: acos, sqrt: sqrt$5} = Math;
|
|
412
451
|
|
|
413
|
-
const {float: float$
|
|
452
|
+
const {float: float$6} = MathHelper;
|
|
414
453
|
|
|
415
454
|
const tempPoint$5 = {};
|
|
416
455
|
|
|
@@ -661,12 +700,12 @@ const MatrixHelper = {
|
|
|
661
700
|
const cosR = c / scaleY;
|
|
662
701
|
rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
|
|
663
702
|
}
|
|
664
|
-
const cosR = float$
|
|
703
|
+
const cosR = float$6(cos$6(rotation));
|
|
665
704
|
const sinR = sin$6(rotation);
|
|
666
|
-
scaleX = float$
|
|
667
|
-
skewX = cosR ? float$
|
|
668
|
-
skewY = cosR ? float$
|
|
669
|
-
rotation = float$
|
|
705
|
+
scaleX = float$6(scaleX), scaleY = float$6(scaleY);
|
|
706
|
+
skewX = cosR ? float$6((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
707
|
+
skewY = cosR ? float$6((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
708
|
+
rotation = float$6(rotation / OneRadian);
|
|
670
709
|
} else {
|
|
671
710
|
scaleX = a;
|
|
672
711
|
scaleY = d;
|
|
@@ -710,7 +749,7 @@ const MatrixHelper = {
|
|
|
710
749
|
|
|
711
750
|
const M$b = MatrixHelper;
|
|
712
751
|
|
|
713
|
-
const {float: float$
|
|
752
|
+
const {float: float$5} = MathHelper;
|
|
714
753
|
|
|
715
754
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
716
755
|
|
|
@@ -851,7 +890,7 @@ const PointHelper = {
|
|
|
851
890
|
return points;
|
|
852
891
|
},
|
|
853
892
|
isSame(t, point) {
|
|
854
|
-
return float$
|
|
893
|
+
return float$5(t.x) === float$5(point.x) && float$5(t.y) === float$5(point.y);
|
|
855
894
|
},
|
|
856
895
|
reset(t) {
|
|
857
896
|
P$7.reset(t);
|
|
@@ -1206,7 +1245,7 @@ const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPo
|
|
|
1206
1245
|
|
|
1207
1246
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1208
1247
|
|
|
1209
|
-
const {float: float$
|
|
1248
|
+
const {float: float$4, fourNumber: fourNumber$1} = MathHelper;
|
|
1210
1249
|
|
|
1211
1250
|
const {floor: floor$2, ceil: ceil$2} = Math;
|
|
1212
1251
|
|
|
@@ -1216,10 +1255,10 @@ const point$2 = {};
|
|
|
1216
1255
|
|
|
1217
1256
|
const toPoint$5 = {};
|
|
1218
1257
|
|
|
1219
|
-
const tempBounds$
|
|
1258
|
+
const tempBounds$4 = {};
|
|
1220
1259
|
|
|
1221
1260
|
const BoundsHelper = {
|
|
1222
|
-
tempBounds: tempBounds$
|
|
1261
|
+
tempBounds: tempBounds$4,
|
|
1223
1262
|
set(t, x = 0, y = 0, width = 0, height = 0) {
|
|
1224
1263
|
t.x = x;
|
|
1225
1264
|
t.y = y;
|
|
@@ -1288,9 +1327,9 @@ const BoundsHelper = {
|
|
|
1288
1327
|
t.height *= scaleY;
|
|
1289
1328
|
},
|
|
1290
1329
|
tempToOuterOf(t, matrix) {
|
|
1291
|
-
B.copy(tempBounds$
|
|
1292
|
-
B.toOuterOf(tempBounds$
|
|
1293
|
-
return tempBounds$
|
|
1330
|
+
B.copy(tempBounds$4, t);
|
|
1331
|
+
B.toOuterOf(tempBounds$4, matrix);
|
|
1332
|
+
return tempBounds$4;
|
|
1294
1333
|
},
|
|
1295
1334
|
getOuterOf(t, matrix) {
|
|
1296
1335
|
t = Object.assign({}, t);
|
|
@@ -1348,9 +1387,9 @@ const BoundsHelper = {
|
|
|
1348
1387
|
put(t, put, align = "center", putScale = 1, changeSize = true, to) {
|
|
1349
1388
|
to || (to = put);
|
|
1350
1389
|
if (isString(putScale)) putScale = B.getFitScale(t, put, putScale === "cover");
|
|
1351
|
-
tempBounds$
|
|
1352
|
-
tempBounds$
|
|
1353
|
-
AlignHelper.toPoint(align, tempBounds$
|
|
1390
|
+
tempBounds$4.width = changeSize ? put.width *= putScale : put.width * putScale;
|
|
1391
|
+
tempBounds$4.height = changeSize ? put.height *= putScale : put.height * putScale;
|
|
1392
|
+
AlignHelper.toPoint(align, tempBounds$4, t, to, true, true);
|
|
1354
1393
|
},
|
|
1355
1394
|
getSpread(t, spread, side) {
|
|
1356
1395
|
const n = {};
|
|
@@ -1381,10 +1420,10 @@ const BoundsHelper = {
|
|
|
1381
1420
|
}
|
|
1382
1421
|
},
|
|
1383
1422
|
float(t, maxLength) {
|
|
1384
|
-
t.x = float$
|
|
1385
|
-
t.y = float$
|
|
1386
|
-
t.width = float$
|
|
1387
|
-
t.height = float$
|
|
1423
|
+
t.x = float$4(t.x, maxLength);
|
|
1424
|
+
t.y = float$4(t.y, maxLength);
|
|
1425
|
+
t.width = float$4(t.width, maxLength);
|
|
1426
|
+
t.height = float$4(t.height, maxLength);
|
|
1388
1427
|
},
|
|
1389
1428
|
add(t, bounds, isPoint) {
|
|
1390
1429
|
right$4 = t.x + t.width;
|
|
@@ -1653,7 +1692,7 @@ class Bounds {
|
|
|
1653
1692
|
}
|
|
1654
1693
|
}
|
|
1655
1694
|
|
|
1656
|
-
const tempBounds$
|
|
1695
|
+
const tempBounds$3 = new Bounds;
|
|
1657
1696
|
|
|
1658
1697
|
class AutoBounds {
|
|
1659
1698
|
constructor(top, right, bottom, left, width, height) {
|
|
@@ -1727,7 +1766,7 @@ const Platform = {
|
|
|
1727
1766
|
resize(view, width, height, xGap, yGap, clip, smooth, opacity, _filters, interlace) {
|
|
1728
1767
|
const realWidth = max$5(floor$1(width + (xGap || 0)), 1), realHeight = max$5(floor$1(height + (yGap || 0)), 1);
|
|
1729
1768
|
let interlaceX, interlaceY, interlaceOffset;
|
|
1730
|
-
if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset,
|
|
1769
|
+
if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, interlace.type === "x" ? width : height))) interlace.type === "x" ? interlaceX = true : interlaceY = true;
|
|
1731
1770
|
const canvas = Platform.origin.createCanvas(interlaceY ? realWidth * 2 : realWidth, interlaceX ? realHeight * 2 : realHeight);
|
|
1732
1771
|
const ctx = canvas.getContext("2d");
|
|
1733
1772
|
if (opacity) ctx.globalAlpha = opacity;
|
|
@@ -1897,7 +1936,10 @@ const UICreator = {
|
|
|
1897
1936
|
list$3[tag] = UI;
|
|
1898
1937
|
},
|
|
1899
1938
|
get(tag, data, x, y, width, height) {
|
|
1900
|
-
if (!list$3[tag])
|
|
1939
|
+
if (!list$3[tag]) {
|
|
1940
|
+
debug$h.warn("not register " + tag);
|
|
1941
|
+
return undefined;
|
|
1942
|
+
}
|
|
1901
1943
|
const ui = new list$3[tag](data);
|
|
1902
1944
|
if (!isUndefined(x)) {
|
|
1903
1945
|
ui.x = x;
|
|
@@ -1988,45 +2030,6 @@ class CanvasManager {
|
|
|
1988
2030
|
}
|
|
1989
2031
|
}
|
|
1990
2032
|
|
|
1991
|
-
function __decorate(decorators, target, key, desc) {
|
|
1992
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1993
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1994
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1995
|
-
}
|
|
1996
|
-
|
|
1997
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
1998
|
-
function adopt(value) {
|
|
1999
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
2000
|
-
resolve(value);
|
|
2001
|
-
});
|
|
2002
|
-
}
|
|
2003
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
2004
|
-
function fulfilled(value) {
|
|
2005
|
-
try {
|
|
2006
|
-
step(generator.next(value));
|
|
2007
|
-
} catch (e) {
|
|
2008
|
-
reject(e);
|
|
2009
|
-
}
|
|
2010
|
-
}
|
|
2011
|
-
function rejected(value) {
|
|
2012
|
-
try {
|
|
2013
|
-
step(generator["throw"](value));
|
|
2014
|
-
} catch (e) {
|
|
2015
|
-
reject(e);
|
|
2016
|
-
}
|
|
2017
|
-
}
|
|
2018
|
-
function step(result) {
|
|
2019
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
2020
|
-
}
|
|
2021
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2022
|
-
});
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
2026
|
-
var e = new Error(message);
|
|
2027
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2028
|
-
};
|
|
2029
|
-
|
|
2030
2033
|
function contextAttr(realName) {
|
|
2031
2034
|
return (target, key) => {
|
|
2032
2035
|
if (!realName) realName = key;
|
|
@@ -2931,7 +2934,7 @@ const PathCommandNodeHelper = {
|
|
|
2931
2934
|
}
|
|
2932
2935
|
};
|
|
2933
2936
|
|
|
2934
|
-
const {M: M$9, m: m, L: L$9, l: l, H: H, h: h, V: V, v: v, C: C$7, c: c, S: S, s: s, Q: Q$6, q: q, T: T, t: t, A: A, a: a, Z: Z$7, z: z, N: N$5, D: D$6, X: X$5, G: G$5, F: F$6, O: O$6, P: P$5, U: U$5} = PathCommandMap;
|
|
2937
|
+
const {M: M$9, m: m, L: L$9, l: l, H: H, h: h, V: V, v: v, C: C$7, c: c, S: S$1, s: s, Q: Q$6, q: q, T: T, t: t, A: A, a: a, Z: Z$7, z: z, N: N$5, D: D$6, X: X$5, G: G$5, F: F$6, O: O$6, P: P$5, U: U$5} = PathCommandMap;
|
|
2935
2938
|
|
|
2936
2939
|
const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
|
|
2937
2940
|
|
|
@@ -3064,10 +3067,10 @@ const PathConvert = {
|
|
|
3064
3067
|
old[i + 2] += y;
|
|
3065
3068
|
old[i + 3] += x;
|
|
3066
3069
|
old[i + 4] += y;
|
|
3067
|
-
command = S;
|
|
3070
|
+
command = S$1;
|
|
3068
3071
|
|
|
3069
|
-
case S:
|
|
3070
|
-
smooth = lastCommand === C$7 || lastCommand === S;
|
|
3072
|
+
case S$1:
|
|
3073
|
+
smooth = lastCommand === C$7 || lastCommand === S$1;
|
|
3071
3074
|
x1 = smooth ? x * 2 - controlX : old[i + 1];
|
|
3072
3075
|
y1 = smooth ? y * 2 - controlY : old[i + 2];
|
|
3073
3076
|
controlX = old[i + 1];
|
|
@@ -3317,10 +3320,10 @@ const PathCommandDataHelper = {
|
|
|
3317
3320
|
data.push(O$5, x, y, radius, startAngle, endAngle, anticlockwise ? 1 : 0);
|
|
3318
3321
|
}
|
|
3319
3322
|
},
|
|
3320
|
-
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3323
|
+
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
|
|
3321
3324
|
if (!isUndefined(lastX)) {
|
|
3322
|
-
const
|
|
3323
|
-
radius = min$2(radius, min$2(
|
|
3325
|
+
const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
|
|
3326
|
+
radius = min$2(radius, min$2(r, r * abs$8(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3324
3327
|
}
|
|
3325
3328
|
data.push(U$4, x1, y1, x2, y2, radius);
|
|
3326
3329
|
},
|
|
@@ -3664,7 +3667,7 @@ const PathCorner = {
|
|
|
3664
3667
|
let command, lastCommand, commandLen;
|
|
3665
3668
|
let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
|
|
3666
3669
|
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
3667
|
-
const len = data.length;
|
|
3670
|
+
const len = data.length, three = len === 9;
|
|
3668
3671
|
const smooth = [];
|
|
3669
3672
|
while (i < len) {
|
|
3670
3673
|
command = data[i];
|
|
@@ -3676,7 +3679,7 @@ const PathCorner = {
|
|
|
3676
3679
|
if (data[i] === L$5) {
|
|
3677
3680
|
secondX = data[i + 1];
|
|
3678
3681
|
secondY = data[i + 2];
|
|
3679
|
-
smooth.push(M$5, getCenterX(startX, secondX), getCenterY(startY, secondY));
|
|
3682
|
+
three ? smooth.push(M$5, startX, startY) : smooth.push(M$5, getCenterX(startX, secondX), getCenterY(startY, secondY));
|
|
3680
3683
|
} else {
|
|
3681
3684
|
smooth.push(M$5, startX, startY);
|
|
3682
3685
|
}
|
|
@@ -3688,11 +3691,11 @@ const PathCorner = {
|
|
|
3688
3691
|
i += 3;
|
|
3689
3692
|
switch (data[i]) {
|
|
3690
3693
|
case L$5:
|
|
3691
|
-
arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY);
|
|
3694
|
+
arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY, three);
|
|
3692
3695
|
break;
|
|
3693
3696
|
|
|
3694
3697
|
case Z$3:
|
|
3695
|
-
arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY);
|
|
3698
|
+
arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
|
|
3696
3699
|
break;
|
|
3697
3700
|
|
|
3698
3701
|
default:
|
|
@@ -3704,7 +3707,7 @@ const PathCorner = {
|
|
|
3704
3707
|
|
|
3705
3708
|
case Z$3:
|
|
3706
3709
|
if (lastCommand !== Z$3) {
|
|
3707
|
-
arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
|
|
3710
|
+
arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY, three);
|
|
3708
3711
|
smooth.push(Z$3);
|
|
3709
3712
|
}
|
|
3710
3713
|
i += 1;
|
|
@@ -3754,10 +3757,10 @@ function canvasPatch(drawer) {
|
|
|
3754
3757
|
const FileHelper = {
|
|
3755
3758
|
alphaPixelTypes: [ "png", "webp", "svg" ],
|
|
3756
3759
|
upperCaseTypeMap: {},
|
|
3757
|
-
|
|
3758
|
-
if (!type || type.startsWith(
|
|
3760
|
+
mimeType(type, base = "image") {
|
|
3761
|
+
if (!type || type.startsWith(base)) return type;
|
|
3759
3762
|
if (type === "jpg") type = "jpeg";
|
|
3760
|
-
return "
|
|
3763
|
+
return base + "/" + type;
|
|
3761
3764
|
},
|
|
3762
3765
|
fileType(filename) {
|
|
3763
3766
|
const l = filename.split(".");
|
|
@@ -3790,6 +3793,8 @@ const FileHelper = {
|
|
|
3790
3793
|
|
|
3791
3794
|
const F$2 = FileHelper;
|
|
3792
3795
|
|
|
3796
|
+
F$2.mineType = F$2.mimeType;
|
|
3797
|
+
|
|
3793
3798
|
F$2.alphaPixelTypes.forEach(type => F$2.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3794
3799
|
|
|
3795
3800
|
const debug$c = Debug.get("TaskProcessor");
|
|
@@ -4034,6 +4039,9 @@ const debug$b = Debug.get("Resource");
|
|
|
4034
4039
|
|
|
4035
4040
|
const Resource = {
|
|
4036
4041
|
tasker: new TaskProcessor,
|
|
4042
|
+
queue: new TaskProcessor({
|
|
4043
|
+
parallel: 1
|
|
4044
|
+
}),
|
|
4037
4045
|
map: {},
|
|
4038
4046
|
get isComplete() {
|
|
4039
4047
|
return R.tasker.isComplete;
|
|
@@ -4070,6 +4078,12 @@ const Resource = {
|
|
|
4070
4078
|
R.set(key, value);
|
|
4071
4079
|
return value;
|
|
4072
4080
|
},
|
|
4081
|
+
loadFilm(_key, _format) {
|
|
4082
|
+
return undefined;
|
|
4083
|
+
},
|
|
4084
|
+
loadVideo(_key, _format) {
|
|
4085
|
+
return undefined;
|
|
4086
|
+
},
|
|
4073
4087
|
destroy() {
|
|
4074
4088
|
R.map = {};
|
|
4075
4089
|
}
|
|
@@ -4080,12 +4094,10 @@ const R = Resource;
|
|
|
4080
4094
|
const ImageManager = {
|
|
4081
4095
|
maxRecycled: 10,
|
|
4082
4096
|
recycledList: [],
|
|
4083
|
-
patternTasker:
|
|
4084
|
-
|
|
4085
|
-
}),
|
|
4086
|
-
get(config) {
|
|
4097
|
+
patternTasker: Resource.queue,
|
|
4098
|
+
get(config, type) {
|
|
4087
4099
|
let image = Resource.get(config.url);
|
|
4088
|
-
if (!image) Resource.set(config.url, image = Creator.image(config));
|
|
4100
|
+
if (!image) Resource.set(config.url, image = type === "film" ? Creator.film(config) : Creator.image(config));
|
|
4089
4101
|
image.use++;
|
|
4090
4102
|
return image;
|
|
4091
4103
|
},
|
|
@@ -4120,7 +4132,7 @@ const ImageManager = {
|
|
|
4120
4132
|
if (config.format) return config.format === format;
|
|
4121
4133
|
const {url: url} = config;
|
|
4122
4134
|
if (url.startsWith("data:")) {
|
|
4123
|
-
if (url.startsWith("data:" + FileHelper.
|
|
4135
|
+
if (url.startsWith("data:" + FileHelper.mimeType(format))) return true;
|
|
4124
4136
|
} else {
|
|
4125
4137
|
if (url.includes("." + format) || url.includes("." + FileHelper.upperCaseTypeMap[format])) return true; else if (format === "png" && !url.includes(".")) return true;
|
|
4126
4138
|
}
|
|
@@ -4136,6 +4148,9 @@ const I$1 = ImageManager;
|
|
|
4136
4148
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
4137
4149
|
|
|
4138
4150
|
class LeaferImage {
|
|
4151
|
+
get tag() {
|
|
4152
|
+
return "Image";
|
|
4153
|
+
}
|
|
4139
4154
|
get url() {
|
|
4140
4155
|
return this.config.url;
|
|
4141
4156
|
}
|
|
@@ -4164,7 +4179,7 @@ class LeaferImage {
|
|
|
4164
4179
|
if (!this.loading) {
|
|
4165
4180
|
this.loading = true;
|
|
4166
4181
|
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
4167
|
-
return yield Platform.origin.
|
|
4182
|
+
return yield Platform.origin["load" + this.tag](this.getLoadUrl(thumbSize), this.crossOrigin, this).then(img => {
|
|
4168
4183
|
if (thumbSize) this.setThumbView(img);
|
|
4169
4184
|
this.setView(img);
|
|
4170
4185
|
}).catch(e => {
|
|
@@ -4238,6 +4253,9 @@ class LeaferImage {
|
|
|
4238
4253
|
Platform.image.setPatternTransform(pattern, transform, paint);
|
|
4239
4254
|
return pattern;
|
|
4240
4255
|
}
|
|
4256
|
+
render(canvas, x, y, width, height, _leaf, _paint, _imageScaleX, _imageScaleY) {
|
|
4257
|
+
canvas.drawImage(this.view, x, y, width, height);
|
|
4258
|
+
}
|
|
4241
4259
|
getLoadUrl(_thumbSize) {
|
|
4242
4260
|
return this.url;
|
|
4243
4261
|
}
|
|
@@ -4264,6 +4282,18 @@ class LeaferImage {
|
|
|
4264
4282
|
}
|
|
4265
4283
|
}
|
|
4266
4284
|
|
|
4285
|
+
class LeaferFilm extends LeaferImage {
|
|
4286
|
+
get tag() {
|
|
4287
|
+
return "Film";
|
|
4288
|
+
}
|
|
4289
|
+
}
|
|
4290
|
+
|
|
4291
|
+
class LeaferVideo extends LeaferImage {
|
|
4292
|
+
get tag() {
|
|
4293
|
+
return "Video";
|
|
4294
|
+
}
|
|
4295
|
+
}
|
|
4296
|
+
|
|
4267
4297
|
function defineKey(target, key, descriptor, noConfigurable) {
|
|
4268
4298
|
if (!noConfigurable) descriptor.configurable = descriptor.enumerable = true;
|
|
4269
4299
|
Object.defineProperty(target, key, descriptor);
|
|
@@ -6152,9 +6182,11 @@ const BranchRender = {
|
|
|
6152
6182
|
if (this.__hasMask) {
|
|
6153
6183
|
this.__renderMask(canvas, options);
|
|
6154
6184
|
} else {
|
|
6185
|
+
let child;
|
|
6155
6186
|
const {children: children} = this;
|
|
6156
6187
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
6157
|
-
|
|
6188
|
+
child = children[i];
|
|
6189
|
+
excludeRenderBounds$1(child, options) || (child.__.complex ? child.__renderComplex(canvas, options) : child.__render(canvas, options));
|
|
6158
6190
|
}
|
|
6159
6191
|
}
|
|
6160
6192
|
},
|
|
@@ -6635,6 +6667,7 @@ let Leaf = class Leaf {
|
|
|
6635
6667
|
__drawHitPath(_canvas) {}
|
|
6636
6668
|
__updateHitCanvas() {}
|
|
6637
6669
|
__render(_canvas, _options) {}
|
|
6670
|
+
__renderComplex(_canvas, _options) {}
|
|
6638
6671
|
__drawFast(_canvas, _options) {}
|
|
6639
6672
|
__draw(_canvas, _options, _originCanvas) {}
|
|
6640
6673
|
__clip(_canvas, _options) {}
|
|
@@ -6754,6 +6787,7 @@ let Branch = class Branch extends Leaf {
|
|
|
6754
6787
|
this.add(item, index);
|
|
6755
6788
|
noIndex || index++;
|
|
6756
6789
|
}); else child = UICreator.get(child.tag, child);
|
|
6790
|
+
if (!child) return;
|
|
6757
6791
|
}
|
|
6758
6792
|
if (child.parent) child.parent.remove(child);
|
|
6759
6793
|
child.parent = this;
|
|
@@ -6979,7 +7013,7 @@ class LeafLevelList {
|
|
|
6979
7013
|
}
|
|
6980
7014
|
}
|
|
6981
7015
|
|
|
6982
|
-
const version = "2.0.
|
|
7016
|
+
const version = "2.0.2";
|
|
6983
7017
|
|
|
6984
7018
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6985
7019
|
get allowBackgroundColor() {
|
|
@@ -7005,8 +7039,6 @@ canvasPatch(OffscreenCanvasRenderingContext2D.prototype);
|
|
|
7005
7039
|
|
|
7006
7040
|
canvasPatch(Path2D.prototype);
|
|
7007
7041
|
|
|
7008
|
-
const {mineType: mineType} = FileHelper;
|
|
7009
|
-
|
|
7010
7042
|
Object.assign(Creator, {
|
|
7011
7043
|
canvas: (options, manager) => new LeaferCanvas(options, manager),
|
|
7012
7044
|
image: options => new LeaferImage(options)
|
|
@@ -7017,7 +7049,7 @@ function useCanvas(_canvasType, _power) {
|
|
|
7017
7049
|
createCanvas: (width, height) => new OffscreenCanvas(width, height),
|
|
7018
7050
|
canvasToDataURL: (canvas, type, quality) => new Promise((resolve, reject) => {
|
|
7019
7051
|
canvas.convertToBlob({
|
|
7020
|
-
type:
|
|
7052
|
+
type: FileHelper.mimeType(type),
|
|
7021
7053
|
quality: quality
|
|
7022
7054
|
}).then(blob => {
|
|
7023
7055
|
var reader = new FileReader;
|
|
@@ -7029,14 +7061,14 @@ function useCanvas(_canvasType, _power) {
|
|
|
7029
7061
|
});
|
|
7030
7062
|
}),
|
|
7031
7063
|
canvasToBolb: (canvas, type, quality) => canvas.convertToBlob({
|
|
7032
|
-
type:
|
|
7064
|
+
type: FileHelper.mimeType(type),
|
|
7033
7065
|
quality: quality
|
|
7034
7066
|
}),
|
|
7035
7067
|
canvasSaveAs: (_canvas, _filename, _quality) => new Promise(resolve => resolve()),
|
|
7036
7068
|
download(_url, _filename) {
|
|
7037
7069
|
return undefined;
|
|
7038
7070
|
},
|
|
7039
|
-
loadImage(src) {
|
|
7071
|
+
loadImage(src, _crossOrigin, _leaferImage) {
|
|
7040
7072
|
return new Promise((resolve, reject) => {
|
|
7041
7073
|
let req = new XMLHttpRequest;
|
|
7042
7074
|
req.open("GET", Platform.image.getRealURL(src), true);
|
|
@@ -7051,6 +7083,13 @@ function useCanvas(_canvasType, _power) {
|
|
|
7051
7083
|
req.onerror = e => reject(e);
|
|
7052
7084
|
req.send();
|
|
7053
7085
|
});
|
|
7086
|
+
},
|
|
7087
|
+
loadContent(url_1) {
|
|
7088
|
+
return __awaiter(this, arguments, void 0, function*(url, responseType = "text") {
|
|
7089
|
+
const response = yield fetch(url);
|
|
7090
|
+
if (!response.ok) throw new Error(`${response.status}`);
|
|
7091
|
+
return yield response[responseType]();
|
|
7092
|
+
});
|
|
7054
7093
|
}
|
|
7055
7094
|
};
|
|
7056
7095
|
Platform.canvas = Creator.canvas();
|
|
@@ -7550,7 +7589,7 @@ class Renderer {
|
|
|
7550
7589
|
getCellList() {
|
|
7551
7590
|
return undefined;
|
|
7552
7591
|
}
|
|
7553
|
-
addBlock(block) {
|
|
7592
|
+
addBlock(block, _leafList) {
|
|
7554
7593
|
if (!this.updateBlocks) this.updateBlocks = [];
|
|
7555
7594
|
this.updateBlocks.push(block);
|
|
7556
7595
|
}
|
|
@@ -7598,7 +7637,8 @@ class Renderer {
|
|
|
7598
7637
|
__onLayoutEnd(event) {
|
|
7599
7638
|
if (event.data) event.data.map(item => {
|
|
7600
7639
|
let empty;
|
|
7601
|
-
|
|
7640
|
+
const {updatedList: updatedList} = item;
|
|
7641
|
+
if (updatedList) updatedList.list.some(leaf => {
|
|
7602
7642
|
empty = !leaf.__world.width || !leaf.__world.height;
|
|
7603
7643
|
if (empty) {
|
|
7604
7644
|
if (!leaf.isLeafer) debug$6.tip(leaf.innerName, ": empty");
|
|
@@ -7606,7 +7646,7 @@ class Renderer {
|
|
|
7606
7646
|
}
|
|
7607
7647
|
return empty;
|
|
7608
7648
|
});
|
|
7609
|
-
this.addBlock(empty ? this.canvas.bounds : item.updatedBounds);
|
|
7649
|
+
this.addBlock(empty ? this.canvas.bounds : item.updatedBounds, updatedList);
|
|
7610
7650
|
});
|
|
7611
7651
|
}
|
|
7612
7652
|
emitRender(type, bounds, options) {
|
|
@@ -7993,16 +8033,16 @@ class UIData extends LeafData {
|
|
|
7993
8033
|
return t.fill || t.stroke;
|
|
7994
8034
|
}
|
|
7995
8035
|
get __autoWidth() {
|
|
7996
|
-
return
|
|
8036
|
+
return this._width == null;
|
|
7997
8037
|
}
|
|
7998
8038
|
get __autoHeight() {
|
|
7999
|
-
return
|
|
8039
|
+
return this._height == null;
|
|
8000
8040
|
}
|
|
8001
8041
|
get __autoSide() {
|
|
8002
|
-
return
|
|
8042
|
+
return this._width == null || this._height == null;
|
|
8003
8043
|
}
|
|
8004
8044
|
get __autoSize() {
|
|
8005
|
-
return
|
|
8045
|
+
return this._width == null && this._height == null;
|
|
8006
8046
|
}
|
|
8007
8047
|
setVisible(value) {
|
|
8008
8048
|
this._visible = value;
|
|
@@ -8214,13 +8254,16 @@ class TextData extends UIData {
|
|
|
8214
8254
|
}
|
|
8215
8255
|
|
|
8216
8256
|
class ImageData extends RectData {
|
|
8257
|
+
get __urlType() {
|
|
8258
|
+
return "image";
|
|
8259
|
+
}
|
|
8217
8260
|
setUrl(value) {
|
|
8218
8261
|
this.__setImageFill(value);
|
|
8219
8262
|
this._url = value;
|
|
8220
8263
|
}
|
|
8221
8264
|
__setImageFill(value) {
|
|
8222
8265
|
this.fill = value ? {
|
|
8223
|
-
type:
|
|
8266
|
+
type: this.__urlType,
|
|
8224
8267
|
mode: "stretch",
|
|
8225
8268
|
url: value
|
|
8226
8269
|
} : undefined;
|
|
@@ -8720,7 +8763,10 @@ let Group = class Group extends UI {
|
|
|
8720
8763
|
}
|
|
8721
8764
|
toJSON(options) {
|
|
8722
8765
|
const data = super.toJSON(options);
|
|
8723
|
-
if (!this.childlessJSON)
|
|
8766
|
+
if (!this.childlessJSON) {
|
|
8767
|
+
const children = data.children = [];
|
|
8768
|
+
this.children.forEach(child => child.skipJSON || children.push(child.toJSON(options)));
|
|
8769
|
+
}
|
|
8724
8770
|
return data;
|
|
8725
8771
|
}
|
|
8726
8772
|
pick(_hitPoint, _options) {
|
|
@@ -8869,12 +8915,12 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8869
8915
|
this.emitLeafer(LeaferEvent.STOP);
|
|
8870
8916
|
}
|
|
8871
8917
|
}
|
|
8872
|
-
unlockLayout() {
|
|
8918
|
+
unlockLayout(updateLayout = true) {
|
|
8873
8919
|
this.layouter.start();
|
|
8874
|
-
this.updateLayout();
|
|
8920
|
+
if (updateLayout) this.updateLayout();
|
|
8875
8921
|
}
|
|
8876
|
-
lockLayout() {
|
|
8877
|
-
this.updateLayout();
|
|
8922
|
+
lockLayout(updateLayout = true) {
|
|
8923
|
+
if (updateLayout) this.updateLayout();
|
|
8878
8924
|
this.layouter.stop();
|
|
8879
8925
|
}
|
|
8880
8926
|
resize(size) {
|
|
@@ -9958,7 +10004,7 @@ class UIEvent extends Event {
|
|
|
9958
10004
|
}
|
|
9959
10005
|
}
|
|
9960
10006
|
|
|
9961
|
-
const {min: min$1, max: max$3, abs: abs$7} = Math, {float: float$
|
|
10007
|
+
const {min: min$1, max: max$3, abs: abs$7} = Math, {float: float$3, sign: sign$2} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
|
|
9962
10008
|
|
|
9963
10009
|
const tempContent = new Bounds, tempDragBounds = new Bounds;
|
|
9964
10010
|
|
|
@@ -9998,8 +10044,8 @@ const DragBoundsHelper = {
|
|
|
9998
10044
|
} else {
|
|
9999
10045
|
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
10000
10046
|
}
|
|
10001
|
-
move.x = float$
|
|
10002
|
-
move.y = float$
|
|
10047
|
+
move.x = float$3(move.x);
|
|
10048
|
+
move.y = float$3(move.y);
|
|
10003
10049
|
return move;
|
|
10004
10050
|
},
|
|
10005
10051
|
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, lockRatio, change) {
|
|
@@ -10011,26 +10057,26 @@ const DragBoundsHelper = {
|
|
|
10011
10057
|
let correctScaleX = 1, correctScaleY = 1, aScale, bScale, aSize, bSize;
|
|
10012
10058
|
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
10013
10059
|
if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
|
|
10014
|
-
aSize = float$
|
|
10015
|
-
bSize = float$
|
|
10060
|
+
aSize = float$3(tempContent.minX - tempDragBounds.minX);
|
|
10061
|
+
bSize = float$3(tempDragBounds.maxX - tempContent.maxX);
|
|
10016
10062
|
aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
|
|
10017
10063
|
bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
|
|
10018
10064
|
correctScaleX *= max$3(aScale, bScale);
|
|
10019
10065
|
} else {
|
|
10020
10066
|
if (scale.x < 0) {
|
|
10021
|
-
if (float$
|
|
10067
|
+
if (float$3(minX(content) - minX(dragBounds)) <= 0 || float$3(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
|
|
10022
10068
|
tempContent.unsign();
|
|
10023
10069
|
}
|
|
10024
|
-
aSize = float$
|
|
10025
|
-
bSize = float$
|
|
10070
|
+
aSize = float$3(tempDragBounds.minX - tempContent.minX);
|
|
10071
|
+
bSize = float$3(tempContent.maxX - tempDragBounds.maxX);
|
|
10026
10072
|
aScale = originLeftScale && aSize > 0 ? 1 - aSize / (originLeftScale * tempContent.width) : 1;
|
|
10027
10073
|
bScale = originRightScale && bSize > 0 ? 1 - bSize / (originRightScale * tempContent.width) : 1;
|
|
10028
10074
|
correctScaleX *= min$1(aScale, bScale);
|
|
10029
10075
|
}
|
|
10030
10076
|
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
10031
10077
|
if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
|
|
10032
|
-
aSize = float$
|
|
10033
|
-
bSize = float$
|
|
10078
|
+
aSize = float$3(tempContent.minY - tempDragBounds.minY);
|
|
10079
|
+
bSize = float$3(tempDragBounds.maxY - tempContent.maxY);
|
|
10034
10080
|
aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
|
|
10035
10081
|
bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
|
|
10036
10082
|
correctScaleY *= max$3(aScale, bScale);
|
|
@@ -10041,11 +10087,11 @@ const DragBoundsHelper = {
|
|
|
10041
10087
|
}
|
|
10042
10088
|
} else {
|
|
10043
10089
|
if (scale.y < 0) {
|
|
10044
|
-
if (float$
|
|
10090
|
+
if (float$3(minY(content) - minY(dragBounds)) <= 0 || float$3(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
|
|
10045
10091
|
tempContent.unsign();
|
|
10046
10092
|
}
|
|
10047
|
-
aSize = float$
|
|
10048
|
-
bSize = float$
|
|
10093
|
+
aSize = float$3(tempDragBounds.minY - tempContent.minY);
|
|
10094
|
+
bSize = float$3(tempContent.maxY - tempDragBounds.maxY);
|
|
10049
10095
|
aScale = originTopScale && aSize > 0 ? 1 - aSize / (originTopScale * tempContent.height) : 1;
|
|
10050
10096
|
bScale = originBottomScale && bSize > 0 ? 1 - bSize / (originBottomScale * tempContent.height) : 1;
|
|
10051
10097
|
correctScaleY *= min$1(aScale, bScale);
|
|
@@ -10566,7 +10612,7 @@ function exclude(leaf, excludePath) {
|
|
|
10566
10612
|
return excludePath && excludePath.has(leaf);
|
|
10567
10613
|
}
|
|
10568
10614
|
|
|
10569
|
-
const config$
|
|
10615
|
+
const config$2 = {
|
|
10570
10616
|
wheel: {
|
|
10571
10617
|
zoomSpeed: .5,
|
|
10572
10618
|
moveSpeed: .5,
|
|
@@ -10640,7 +10686,7 @@ class InteractionBase {
|
|
|
10640
10686
|
return this.p.hitRadius;
|
|
10641
10687
|
}
|
|
10642
10688
|
constructor(target, canvas, selector, userConfig) {
|
|
10643
|
-
this.config = DataHelper.clone(config$
|
|
10689
|
+
this.config = DataHelper.clone(config$2);
|
|
10644
10690
|
this.tapCount = 0;
|
|
10645
10691
|
this.downKeyMap = {};
|
|
10646
10692
|
this.target = target;
|
|
@@ -10667,6 +10713,7 @@ class InteractionBase {
|
|
|
10667
10713
|
this.checkPath(data, useDefaultPath);
|
|
10668
10714
|
this.downTime = Date.now();
|
|
10669
10715
|
this.emit(PointerEvent.BEFORE_DOWN, data);
|
|
10716
|
+
if (data.path.needUpdate) this.updateDownData(data);
|
|
10670
10717
|
this.emit(PointerEvent.DOWN, data);
|
|
10671
10718
|
if (PointerButton.left(data)) {
|
|
10672
10719
|
this.tapWait();
|
|
@@ -11160,8 +11207,8 @@ ui$5.__updateHitCanvas = function() {
|
|
|
11160
11207
|
if (isHitPixel) {
|
|
11161
11208
|
const {renderBounds: renderBounds} = this.__layout;
|
|
11162
11209
|
const size = Platform.image.hitCanvasSize;
|
|
11163
|
-
const scale = h.hitScale = tempBounds$
|
|
11164
|
-
const {x: x, y: y, width: width, height: height} = tempBounds$
|
|
11210
|
+
const scale = h.hitScale = tempBounds$3.set(0, 0, size, size).getFitMatrix(renderBounds).a;
|
|
11211
|
+
const {x: x, y: y, width: width, height: height} = tempBounds$3.set(renderBounds).scale(scale);
|
|
11165
11212
|
h.resize({
|
|
11166
11213
|
width: width,
|
|
11167
11214
|
height: height,
|
|
@@ -11221,13 +11268,13 @@ ui$5.__hit = function(inner, forceHitFill) {
|
|
|
11221
11268
|
return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
|
|
11222
11269
|
};
|
|
11223
11270
|
|
|
11224
|
-
const ui$4 = UI.prototype, rect = Rect.prototype, box$
|
|
11271
|
+
const ui$4 = UI.prototype, rect = Rect.prototype, box$3 = Box.prototype;
|
|
11225
11272
|
|
|
11226
|
-
rect.__updateHitCanvas = box$
|
|
11273
|
+
rect.__updateHitCanvas = box$3.__updateHitCanvas = function() {
|
|
11227
11274
|
if (this.stroke || this.cornerRadius || (this.fill || this.__.__isCanvas) && this.hitFill === "pixel" || this.hitStroke === "all") ui$4.__updateHitCanvas.call(this); else if (this.__hitCanvas) this.__hitCanvas = null;
|
|
11228
11275
|
};
|
|
11229
11276
|
|
|
11230
|
-
rect.__hitFill = box$
|
|
11277
|
+
rect.__hitFill = box$3.__hitFill = function(inner) {
|
|
11231
11278
|
return this.__hitCanvas ? ui$4.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
|
|
11232
11279
|
};
|
|
11233
11280
|
|
|
@@ -11259,8 +11306,8 @@ canvas$1.hitStroke = function(point, strokeWidth) {
|
|
|
11259
11306
|
canvas$1.hitPixel = function(radiusPoint, offset, scale = 1) {
|
|
11260
11307
|
let {x: x, y: y, radiusX: radiusX, radiusY: radiusY} = radiusPoint;
|
|
11261
11308
|
if (offset) x -= offset.x, y -= offset.y;
|
|
11262
|
-
tempBounds$
|
|
11263
|
-
const {data: data} = this.context.getImageData(tempBounds$
|
|
11309
|
+
tempBounds$3.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
|
|
11310
|
+
const {data: data} = this.context.getImageData(tempBounds$3.x, tempBounds$3.y, tempBounds$3.width || 1, tempBounds$3.height || 1);
|
|
11264
11311
|
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
11265
11312
|
if (data[i + 3] > 0) return true;
|
|
11266
11313
|
}
|
|
@@ -11463,14 +11510,14 @@ function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas, renderO
|
|
|
11463
11510
|
|
|
11464
11511
|
const {getSpread: getSpread, copyAndSpread: copyAndSpread$1, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$7, getIntersectData: getIntersectData} = BoundsHelper;
|
|
11465
11512
|
|
|
11466
|
-
const tempBounds$
|
|
11513
|
+
const tempBounds$2 = {};
|
|
11467
11514
|
|
|
11468
11515
|
function shape(ui, current, options) {
|
|
11469
11516
|
const canvas = current.getSameCanvas();
|
|
11470
11517
|
const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
|
|
11471
11518
|
const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
|
|
11472
|
-
toOuterOf(layout.strokeSpread ? (copyAndSpread$1(tempBounds$
|
|
11473
|
-
tempBounds$
|
|
11519
|
+
toOuterOf(layout.strokeSpread ? (copyAndSpread$1(tempBounds$2, layout.boxBounds, layout.strokeSpread),
|
|
11520
|
+
tempBounds$2) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
|
|
11474
11521
|
let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
11475
11522
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
11476
11523
|
if (currentBounds.includes(nowWorldShapeBounds)) {
|
|
@@ -11564,11 +11611,14 @@ function compute(attrName, ui) {
|
|
|
11564
11611
|
function getLeafPaint(attrName, paint, ui) {
|
|
11565
11612
|
if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
|
|
11566
11613
|
let leafPaint;
|
|
11567
|
-
const {boxBounds: boxBounds} = ui.__layout;
|
|
11568
|
-
switch (
|
|
11614
|
+
const {boxBounds: boxBounds} = ui.__layout, {type: type} = paint;
|
|
11615
|
+
switch (type) {
|
|
11569
11616
|
case "image":
|
|
11617
|
+
case "film":
|
|
11618
|
+
case "video":
|
|
11570
11619
|
if (!paint.url) return undefined;
|
|
11571
11620
|
leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
11621
|
+
if (type !== "image") PaintImage[type](leafPaint);
|
|
11572
11622
|
break;
|
|
11573
11623
|
|
|
11574
11624
|
case "linear":
|
|
@@ -11584,7 +11634,7 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
11584
11634
|
break;
|
|
11585
11635
|
|
|
11586
11636
|
case "solid":
|
|
11587
|
-
const {
|
|
11637
|
+
const {color: color, opacity: opacity} = paint;
|
|
11588
11638
|
leafPaint = {
|
|
11589
11639
|
type: type,
|
|
11590
11640
|
style: ColorConvert.string(color, opacity)
|
|
@@ -11622,13 +11672,13 @@ const PaintModule = {
|
|
|
11622
11672
|
shape: shape
|
|
11623
11673
|
};
|
|
11624
11674
|
|
|
11625
|
-
let cache$1, box$
|
|
11675
|
+
let cache$1, box$2 = new Bounds;
|
|
11626
11676
|
|
|
11627
11677
|
const {isSame: isSame} = BoundsHelper;
|
|
11628
11678
|
|
|
11629
11679
|
function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
11630
11680
|
let leafPaint, event;
|
|
11631
|
-
const image = ImageManager.get(paint);
|
|
11681
|
+
const image = ImageManager.get(paint, paint.type);
|
|
11632
11682
|
if (cache$1 && paint === cache$1.paint && isSame(boxBounds, cache$1.boxBounds)) {
|
|
11633
11683
|
leafPaint = cache$1.leafPaint;
|
|
11634
11684
|
} else {
|
|
@@ -11640,7 +11690,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
11640
11690
|
cache$1 = image.use > 1 ? {
|
|
11641
11691
|
leafPaint: leafPaint,
|
|
11642
11692
|
paint: paint,
|
|
11643
|
-
boxBounds: box$
|
|
11693
|
+
boxBounds: box$2.set(boxBounds)
|
|
11644
11694
|
} : null;
|
|
11645
11695
|
}
|
|
11646
11696
|
if (firstUse || image.loading) event = {
|
|
@@ -11689,8 +11739,8 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
11689
11739
|
}
|
|
11690
11740
|
|
|
11691
11741
|
function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
|
|
11692
|
-
|
|
11693
|
-
|
|
11742
|
+
const data = ui.__;
|
|
11743
|
+
if (attrName === "fill" && !data.__naturalWidth) {
|
|
11694
11744
|
data.__naturalWidth = image.width / data.pixelRatio;
|
|
11695
11745
|
data.__naturalHeight = image.height / data.pixelRatio;
|
|
11696
11746
|
if (data.__autoSide) {
|
|
@@ -11702,7 +11752,12 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
|
|
|
11702
11752
|
return false;
|
|
11703
11753
|
}
|
|
11704
11754
|
}
|
|
11705
|
-
if (!leafPaint.data)
|
|
11755
|
+
if (!leafPaint.data) {
|
|
11756
|
+
PaintImage.createData(leafPaint, image, paint, boxBounds);
|
|
11757
|
+
const {transform: transform} = leafPaint.data, {opacity: opacity, blendMode: blendMode} = paint;
|
|
11758
|
+
const clip = transform && !transform.onlyScale || data.path || data.cornerRadius;
|
|
11759
|
+
if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
|
|
11760
|
+
}
|
|
11706
11761
|
return true;
|
|
11707
11762
|
}
|
|
11708
11763
|
|
|
@@ -11745,7 +11800,7 @@ function getPatternData(paint, box, image) {
|
|
|
11745
11800
|
if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
|
|
11746
11801
|
if (paint.mode === "strench") paint.mode = "stretch";
|
|
11747
11802
|
const {width: width, height: height} = image;
|
|
11748
|
-
const {
|
|
11803
|
+
const {mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, interlace: interlace} = paint;
|
|
11749
11804
|
const sameBox = box.width === width && box.height === height;
|
|
11750
11805
|
const data = {
|
|
11751
11806
|
mode: mode
|
|
@@ -11808,8 +11863,6 @@ function getPatternData(paint, box, image) {
|
|
|
11808
11863
|
data.scaleX = scaleX;
|
|
11809
11864
|
data.scaleY = scaleY;
|
|
11810
11865
|
}
|
|
11811
|
-
if (opacity && opacity < 1) data.opacity = opacity;
|
|
11812
|
-
if (filters) data.filters = filters;
|
|
11813
11866
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
11814
11867
|
if (interlace) data.interlace = isNumber(interlace) || interlace.type === "percent" ? {
|
|
11815
11868
|
type: "x",
|
|
@@ -11840,7 +11893,7 @@ const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translat
|
|
|
11840
11893
|
|
|
11841
11894
|
function stretchMode(data, box, scaleX, scaleY) {
|
|
11842
11895
|
const transform = get$2(), {x: x, y: y} = box;
|
|
11843
|
-
if (x || y) translate(transform, x, y); else transform.onlyScale = true;
|
|
11896
|
+
if (x || y) translate(transform, x, y); else if (scaleX > 0 && scaleY > 0) transform.onlyScale = true;
|
|
11844
11897
|
scaleHelper(transform, scaleX, scaleY);
|
|
11845
11898
|
data.transform = transform;
|
|
11846
11899
|
}
|
|
@@ -11929,10 +11982,10 @@ function createPatternTask(paint, ui, canvas, renderOptions) {
|
|
|
11929
11982
|
}
|
|
11930
11983
|
|
|
11931
11984
|
function createPattern(paint, ui, canvas, renderOptions) {
|
|
11932
|
-
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = scaleX + "-" + scaleY;
|
|
11985
|
+
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
11933
11986
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
11934
11987
|
if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
|
|
11935
|
-
const {image: image, data: data} = paint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
11988
|
+
const {image: image, data: data} = paint, {opacity: opacity, filters: filters} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
11936
11989
|
let imageMatrix, xGap, yGap, {width: width, height: height} = image;
|
|
11937
11990
|
if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
|
|
11938
11991
|
width *= scaleX;
|
|
@@ -11948,7 +12001,7 @@ function createPattern(paint, ui, canvas, renderOptions) {
|
|
|
11948
12001
|
if (transform) copy$4(imageMatrix, transform);
|
|
11949
12002
|
scale$1(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
11950
12003
|
}
|
|
11951
|
-
const imageCanvas = image.getCanvas(width, height,
|
|
12004
|
+
const imageCanvas = image.getCanvas(width, height, opacity, filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
11952
12005
|
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
11953
12006
|
paint.style = pattern;
|
|
11954
12007
|
paint.patternId = id;
|
|
@@ -11969,15 +12022,15 @@ function getPatternFixScale(paint, imageScaleX, imageScaleY) {
|
|
|
11969
12022
|
}
|
|
11970
12023
|
|
|
11971
12024
|
function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
11972
|
-
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
|
|
12025
|
+
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
11973
12026
|
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting, snapshot: snapshot} = renderOptions;
|
|
11974
|
-
if (!data || paint.patternId ===
|
|
12027
|
+
if (!data || paint.patternId === id && !exporting || snapshot) {
|
|
11975
12028
|
return false;
|
|
11976
12029
|
} else {
|
|
11977
12030
|
if (drawImage) {
|
|
11978
12031
|
if (data.repeat) {
|
|
11979
12032
|
drawImage = false;
|
|
11980
|
-
} else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
12033
|
+
} else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
11981
12034
|
drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
|
|
11982
12035
|
}
|
|
11983
12036
|
}
|
|
@@ -11995,20 +12048,21 @@ function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
|
11995
12048
|
}
|
|
11996
12049
|
}
|
|
11997
12050
|
|
|
11998
|
-
function drawImage(paint,
|
|
11999
|
-
const {data: data, image: image
|
|
12000
|
-
let {width: width, height: height} = image
|
|
12001
|
-
if (
|
|
12051
|
+
function drawImage(paint, imageScaleX, imageScaleY, ui, canvas, _renderOptions) {
|
|
12052
|
+
const {data: data, image: image, complex: complex} = paint;
|
|
12053
|
+
let {width: width, height: height} = image;
|
|
12054
|
+
if (complex) {
|
|
12055
|
+
const {blendMode: blendMode, opacity: opacity} = paint.originPaint, {transform: transform} = data;
|
|
12002
12056
|
canvas.save();
|
|
12003
|
-
|
|
12057
|
+
complex === 2 && canvas.clipUI(ui);
|
|
12004
12058
|
blendMode && (canvas.blendMode = blendMode);
|
|
12005
12059
|
opacity && (canvas.opacity *= opacity);
|
|
12006
12060
|
transform && canvas.transform(transform);
|
|
12007
|
-
|
|
12061
|
+
image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
|
|
12008
12062
|
canvas.restore();
|
|
12009
12063
|
} else {
|
|
12010
12064
|
if (data.scaleX) width *= data.scaleX, height *= data.scaleY;
|
|
12011
|
-
|
|
12065
|
+
image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
|
|
12012
12066
|
}
|
|
12013
12067
|
}
|
|
12014
12068
|
|
|
@@ -12176,7 +12230,7 @@ const PaintGradientModule = {
|
|
|
12176
12230
|
|
|
12177
12231
|
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$5} = Math;
|
|
12178
12232
|
|
|
12179
|
-
const tempBounds = {}, tempMatrix = new Matrix;
|
|
12233
|
+
const tempBounds$1 = {}, tempMatrix = new Matrix;
|
|
12180
12234
|
|
|
12181
12235
|
const offsetOutBounds$1 = {};
|
|
12182
12236
|
|
|
@@ -12243,9 +12297,9 @@ function drawWorldShadow(canvas, outBounds, shape) {
|
|
|
12243
12297
|
const {shapeBounds: shapeBounds} = shape;
|
|
12244
12298
|
let from, to;
|
|
12245
12299
|
if (Platform.fullImageShadow) {
|
|
12246
|
-
copy$3(tempBounds, canvas.bounds);
|
|
12247
|
-
move$6(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
12248
|
-
from = canvas.bounds, to = tempBounds;
|
|
12300
|
+
copy$3(tempBounds$1, canvas.bounds);
|
|
12301
|
+
move$6(tempBounds$1, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
12302
|
+
from = canvas.bounds, to = tempBounds$1;
|
|
12249
12303
|
} else {
|
|
12250
12304
|
from = shapeBounds, to = outBounds;
|
|
12251
12305
|
}
|
|
@@ -12728,7 +12782,7 @@ function layoutText(drawData, style) {
|
|
|
12728
12782
|
let {x: x, y: y, width: width, height: height} = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
12729
12783
|
let starY = __baseLine;
|
|
12730
12784
|
if (__clipText && realHeight > height) {
|
|
12731
|
-
realHeight = Math.max(height, __lineHeight);
|
|
12785
|
+
realHeight = Math.max(style.__autoHeight ? realHeight : height, __lineHeight);
|
|
12732
12786
|
if (countRows > 1) drawData.overflow = countRows;
|
|
12733
12787
|
} else if (height || autoSizeAlign) {
|
|
12734
12788
|
switch (verticalAlign) {
|
|
@@ -12785,10 +12839,10 @@ function layoutText(drawData, style) {
|
|
|
12785
12839
|
}
|
|
12786
12840
|
|
|
12787
12841
|
function clipText(drawData, style, x, width) {
|
|
12788
|
-
if (!width) return;
|
|
12789
12842
|
const {rows: rows, overflow: overflow} = drawData;
|
|
12790
12843
|
let {textOverflow: textOverflow} = style;
|
|
12791
|
-
rows.splice(overflow);
|
|
12844
|
+
if (overflow) rows.splice(overflow);
|
|
12845
|
+
if (!width) return;
|
|
12792
12846
|
if (textOverflow && textOverflow !== "show") {
|
|
12793
12847
|
if (textOverflow === "hide") textOverflow = ""; else if (textOverflow === "ellipsis") textOverflow = "...";
|
|
12794
12848
|
let char, charRight;
|
|
@@ -13107,8 +13161,13 @@ class Stroker extends UI {
|
|
|
13107
13161
|
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
13108
13162
|
}
|
|
13109
13163
|
data.strokeWidth = strokeWidth / Math.max(aScaleX, aScaleY);
|
|
13164
|
+
if (data.shadow) {
|
|
13165
|
+
const shadow = data.shadow[0], {scaleX: scaleX, scaleY: scaleY} = this.getRenderScaleData(true, shadow.scaleFixed);
|
|
13166
|
+
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
13167
|
+
}
|
|
13110
13168
|
if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas, options) : Paint.strokes(stroke, this, canvas, options);
|
|
13111
13169
|
if (fill) isString(fill) ? Paint.fill(fill, this, canvas, options) : Paint.fills(fill, this, canvas, options);
|
|
13170
|
+
if (data.shadow) canvas.restore();
|
|
13112
13171
|
}
|
|
13113
13172
|
}
|
|
13114
13173
|
data.strokeWidth = strokeWidth;
|
|
@@ -13288,6 +13347,7 @@ class EditSelect extends Group {
|
|
|
13288
13347
|
} else {
|
|
13289
13348
|
editor.target = find;
|
|
13290
13349
|
}
|
|
13350
|
+
e.path.needUpdate = true;
|
|
13291
13351
|
} else if (this.allow(e.target)) {
|
|
13292
13352
|
if (!this.isHoldMultipleSelectKey(e) && !this.editor.mergedConfig.selectKeep) editor.target = null;
|
|
13293
13353
|
}
|
|
@@ -14272,7 +14332,7 @@ const rotateSVG = `\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/s
|
|
|
14272
14332
|
|
|
14273
14333
|
const skewSVG = `\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(90,12,12),rotate({{rotation}},12,12)">\n<path d="M21 10.4L21 11.4L23.8 11.4L21.6 9.6L21 10.4ZM17 10.4V11.4L17 11.4L17 10.4ZM15.5 6L16.1 5.2L14.5 3.9V6H15.5ZM15.5 8.4V9.4H16.5V8.4H15.5ZM6 8.4V7.4H5V8.4H6ZM6 10.4H5V11.4H6V10.4ZM7 14.4V13.4L7 13.4L7 14.4ZM3 14.4L3 13.4L0.1 13.4L2.3 15.2L3 14.4ZM8.5 18.9L7.8 19.7L9.5 21.0V18.9H8.5ZM8.5 16.4V15.4H7.5V16.4H8.5ZM19 16.4V17.4H20V16.4H19ZM19 14.4H20V13.4H19V14.4ZM21 9.4L17 9.4L17 11.4L21 11.4L21 9.4ZM14.8 6.7L20.3 11.2L21.6 9.6L16.1 5.2L14.8 6.7ZM16.5 8.4V6H14.5V8.4H16.5ZM6 9.4H15.5V7.4H6V9.4ZM7 10.4V8.4H5V10.4H7ZM15.5 9.4H6V11.4H15.5V9.4ZM17 9.4H15.5V11.4H17V9.4ZM7 15.4H8.5V13.4H7V15.4ZM3 15.4L7 15.4L7 13.4L3 13.4L3 15.4ZM9.1 18.1L3.6 13.6L2.3 15.2L7.8 19.7L9.1 18.1ZM7.5 16.4V18.9H9.5V16.4H7.5ZM19 15.4H8.5V17.4H19V15.4ZM18 14.4V16.4H20V14.4H18ZM8.5 15.4H19V13.4H8.5V15.4Z" fill="white"/>\n<path fill-rule="evenodd" d="M17 10.4L21 10.4L15.5 6V8.4H6V10.4H15.5H17ZM8.5 14.4H7L3 14.4L8.5 18.9V16.4H19V14.4H8.5Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter x="-2.8" y="1.9" width="29.6" height="23.1" filterUnits="userSpaceOnUse" >\n${filterStyle$1}\n</filter>\n</defs>\n</svg>\n`;
|
|
14274
14334
|
|
|
14275
|
-
const config = {
|
|
14335
|
+
const config$1 = {
|
|
14276
14336
|
editSize: "size",
|
|
14277
14337
|
keyEvent: true,
|
|
14278
14338
|
stroke: "#836DFF",
|
|
@@ -14506,6 +14566,7 @@ class SimulateElement extends Rect {
|
|
|
14506
14566
|
this.checkChange = true;
|
|
14507
14567
|
this.canChange = true;
|
|
14508
14568
|
this.visible = this.hittable = false;
|
|
14569
|
+
this.skipJSON = true;
|
|
14509
14570
|
this.on(PropertyEvent.CHANGE, event => {
|
|
14510
14571
|
if (this.checkChange && checkMap[event.attrName]) {
|
|
14511
14572
|
const {attrName: attrName, newValue: newValue, oldValue: oldValue} = event;
|
|
@@ -14917,7 +14978,7 @@ let Editor = class Editor extends Group {
|
|
|
14917
14978
|
this.selector = new EditSelect(this);
|
|
14918
14979
|
this.editMask = new EditMask(this);
|
|
14919
14980
|
this.targetEventIds = [];
|
|
14920
|
-
let mergedConfig = DataHelper.clone(config);
|
|
14981
|
+
let mergedConfig = DataHelper.clone(config$1);
|
|
14921
14982
|
if (userConfig) mergedConfig = DataHelper.default(userConfig, mergedConfig);
|
|
14922
14983
|
this.mergedConfig = this.config = mergedConfig;
|
|
14923
14984
|
this.addMany(this.editMask, this.selector, this.editBox);
|
|
@@ -15199,7 +15260,10 @@ class InnerEditor {
|
|
|
15199
15260
|
return "focus";
|
|
15200
15261
|
}
|
|
15201
15262
|
get editBox() {
|
|
15202
|
-
return this.editor.editBox;
|
|
15263
|
+
return this._editBox || this.editor.editBox;
|
|
15264
|
+
}
|
|
15265
|
+
set editBox(value) {
|
|
15266
|
+
this._editBox = value;
|
|
15203
15267
|
}
|
|
15204
15268
|
constructor(editor) {
|
|
15205
15269
|
this.eventIds = [];
|
|
@@ -15390,7 +15454,7 @@ let LineEditTool = class LineEditTool extends EditTool {
|
|
|
15390
15454
|
onSkew(_e) {}
|
|
15391
15455
|
onUpdate() {
|
|
15392
15456
|
const {editBox: editBox} = this, {rotatePoints: rotatePoints, resizeLines: resizeLines, resizePoints: resizePoints, rect: rect} = editBox;
|
|
15393
|
-
const line =
|
|
15457
|
+
const line = editBox.target;
|
|
15394
15458
|
let fromTo, leftOrRight;
|
|
15395
15459
|
if (line.pathInputed) fromTo = this.getFromToByPath(line.__.path); else if (line.points) fromTo = this.getFromToByPoints(line.__.points);
|
|
15396
15460
|
if (fromTo) {
|
|
@@ -15741,6 +15805,8 @@ function setFill(style, fill) {
|
|
|
15741
15805
|
break;
|
|
15742
15806
|
|
|
15743
15807
|
case "image":
|
|
15808
|
+
case "film":
|
|
15809
|
+
case "video":
|
|
15744
15810
|
break;
|
|
15745
15811
|
|
|
15746
15812
|
case "linear":
|
|
@@ -15959,9 +16025,14 @@ function addViewport(leafer, mergeConfig, custom) {
|
|
|
15959
16025
|
}), leafer.on_(MoveEvent.END, e => {
|
|
15960
16026
|
LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
|
|
15961
16027
|
}), leafer.on_(ZoomEvent.BEFORE_ZOOM, e => {
|
|
15962
|
-
const {zoomLayer: zoomLayer} = leafer;
|
|
16028
|
+
const {zoomLayer: zoomLayer, layouter: layouter} = leafer;
|
|
15963
16029
|
const changeScale = leafer.getValidScale(e.scale);
|
|
15964
|
-
if (changeScale !== 1)
|
|
16030
|
+
if (changeScale !== 1) {
|
|
16031
|
+
layouter.stop();
|
|
16032
|
+
LeafHelper.updateMatrix(leafer);
|
|
16033
|
+
zoomLayer.scaleOfWorld(e, changeScale);
|
|
16034
|
+
layouter.start();
|
|
16035
|
+
}
|
|
15965
16036
|
}));
|
|
15966
16037
|
}
|
|
15967
16038
|
|
|
@@ -17685,7 +17756,7 @@ function autoBoundsType(defaultValue) {
|
|
|
17685
17756
|
|
|
17686
17757
|
Plugin.add("flow", "resize");
|
|
17687
17758
|
|
|
17688
|
-
const box = Box.prototype, {__updateBoxBounds: __updateBoxBounds} = Group.prototype;
|
|
17759
|
+
const box$1 = Box.prototype, {__updateBoxBounds: __updateBoxBounds} = Group.prototype;
|
|
17689
17760
|
|
|
17690
17761
|
UI.addAttr("flow", false, autoLayoutType);
|
|
17691
17762
|
|
|
@@ -17707,7 +17778,7 @@ UI.addAttr("autoBox", undefined, boundsType);
|
|
|
17707
17778
|
|
|
17708
17779
|
const {copyAndSpread: copyAndSpread} = BoundsHelper;
|
|
17709
17780
|
|
|
17710
|
-
box.__updateFlowLayout = function() {
|
|
17781
|
+
box$1.__updateFlowLayout = function() {
|
|
17711
17782
|
const {leaferIsCreated: leaferIsCreated, flow: flow} = this;
|
|
17712
17783
|
if (leaferIsCreated) this.leafer.created = false;
|
|
17713
17784
|
switch (flow) {
|
|
@@ -17731,7 +17802,7 @@ box.__updateFlowLayout = function() {
|
|
|
17731
17802
|
if (leaferIsCreated) this.leafer.created = true;
|
|
17732
17803
|
};
|
|
17733
17804
|
|
|
17734
|
-
box.__updateContentBounds = function() {
|
|
17805
|
+
box$1.__updateContentBounds = function() {
|
|
17735
17806
|
const {padding: padding} = this.__;
|
|
17736
17807
|
const layout = this.__layout;
|
|
17737
17808
|
const same = layout.contentBounds === layout.boxBounds;
|
|
@@ -17743,7 +17814,7 @@ box.__updateContentBounds = function() {
|
|
|
17743
17814
|
}
|
|
17744
17815
|
};
|
|
17745
17816
|
|
|
17746
|
-
box.__updateBoxBounds = function(secondLayout) {
|
|
17817
|
+
box$1.__updateBoxBounds = function(secondLayout) {
|
|
17747
17818
|
if (this.children.length && !this.pathInputed) {
|
|
17748
17819
|
const data = this.__, {flow: flow} = data;
|
|
17749
17820
|
if (data.__autoSide) {
|
|
@@ -18545,7 +18616,7 @@ const hslMatch = /^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i;
|
|
|
18545
18616
|
|
|
18546
18617
|
const hslaMatch = /^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i;
|
|
18547
18618
|
|
|
18548
|
-
const int = parseInt, float$
|
|
18619
|
+
const int = parseInt, float$2 = parseFloat, {round: round$1} = Math;
|
|
18549
18620
|
|
|
18550
18621
|
let cache = {}, totalCache = 0;
|
|
18551
18622
|
|
|
@@ -18658,18 +18729,18 @@ function rgbaToRGBA(color) {
|
|
|
18658
18729
|
r: int(match[1]),
|
|
18659
18730
|
g: int(match[2]),
|
|
18660
18731
|
b: int(match[3]),
|
|
18661
|
-
a: float$
|
|
18732
|
+
a: float$2(match[4])
|
|
18662
18733
|
};
|
|
18663
18734
|
}
|
|
18664
18735
|
|
|
18665
18736
|
function hslToRGBA(color) {
|
|
18666
18737
|
const match = hslMatch.exec(color);
|
|
18667
|
-
return hsla(float$
|
|
18738
|
+
return hsla(float$2(match[1]), float$2(match[2]), float$2(match[3]), 1);
|
|
18668
18739
|
}
|
|
18669
18740
|
|
|
18670
18741
|
function hslaToRGBA(color) {
|
|
18671
18742
|
const match = hslaMatch.exec(color);
|
|
18672
|
-
return hsla(float$
|
|
18743
|
+
return hsla(float$2(match[1]), float$2(match[2]), float$2(match[3]), float$2(match[4]));
|
|
18673
18744
|
}
|
|
18674
18745
|
|
|
18675
18746
|
const n1 = 1 / 6, n2 = .5, n3 = 2 / 3, n4 = 1 / 3;
|
|
@@ -18908,7 +18979,7 @@ const HighBezierHelper = {
|
|
|
18908
18979
|
|
|
18909
18980
|
const {getDistance: getDistance} = HighBezierHelper;
|
|
18910
18981
|
|
|
18911
|
-
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper;
|
|
18982
|
+
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float$1} = MathHelper;
|
|
18912
18983
|
|
|
18913
18984
|
const tempPoint = {}, tempFrom = {};
|
|
18914
18985
|
|
|
@@ -19063,7 +19134,7 @@ const HighCurveHelper = {
|
|
|
19063
19134
|
tempFrom.y = y;
|
|
19064
19135
|
to.x = toX;
|
|
19065
19136
|
to.y = toY;
|
|
19066
|
-
cutDistance = float(motionDistance - total);
|
|
19137
|
+
cutDistance = float$1(motionDistance - total);
|
|
19067
19138
|
if (cutDistance) {
|
|
19068
19139
|
PointHelper.getDistancePoint(tempFrom, to, cutDistance, true);
|
|
19069
19140
|
path.push(command, to.x, to.y);
|
|
@@ -19082,7 +19153,7 @@ const HighCurveHelper = {
|
|
|
19082
19153
|
toY = data[i + 6];
|
|
19083
19154
|
distance = segments[index];
|
|
19084
19155
|
if (total + distance > motionDistance) {
|
|
19085
|
-
cutDistance = float(motionDistance - total);
|
|
19156
|
+
cutDistance = float$1(motionDistance - total);
|
|
19086
19157
|
if (cutDistance) {
|
|
19087
19158
|
t = HighBezierHelper.getT(cutDistance, distance, x, y, x1, y1, x2, y2, toX, toY, motionPrecision);
|
|
19088
19159
|
HighBezierHelper.cut(path, t, x, y, x1, y1, x2, y2, toX, toY);
|
|
@@ -19301,21 +19372,21 @@ function getStyle(leaf) {
|
|
|
19301
19372
|
const style = {}, button = findParentButton(leaf);
|
|
19302
19373
|
const state = button ? leaf.state || button.state : leaf.state;
|
|
19303
19374
|
const stateStyle = state && leaf.states[state];
|
|
19304
|
-
if (stateStyle && State.isState(state, leaf, button)) exist = assign(style, stateStyle);
|
|
19375
|
+
if (stateStyle && State.isState(state, leaf, button)) exist = assign$1(style, stateStyle);
|
|
19305
19376
|
const selectedStyle = style.selectedStyle || leaf.selectedStyle;
|
|
19306
|
-
if (selectedStyle && State.isSelected(leaf, button)) exist = assign(style, selectedStyle);
|
|
19377
|
+
if (selectedStyle && State.isSelected(leaf, button)) exist = assign$1(style, selectedStyle);
|
|
19307
19378
|
const placeholderStyle = style.placeholderStyle || leaf.placeholderStyle;
|
|
19308
|
-
if (placeholderStyle && State.isPlacehold(leaf, button)) exist = assign(style, placeholderStyle);
|
|
19379
|
+
if (placeholderStyle && State.isPlacehold(leaf, button)) exist = assign$1(style, placeholderStyle);
|
|
19309
19380
|
if (State.isDisabled(leaf, button)) {
|
|
19310
19381
|
const disabledStyle = style.disabledStyle || leaf.disabledStyle;
|
|
19311
|
-
if (disabledStyle) exist = assign(style, disabledStyle);
|
|
19382
|
+
if (disabledStyle) exist = assign$1(style, disabledStyle);
|
|
19312
19383
|
} else {
|
|
19313
19384
|
const focusStyle = style.focusStyle || leaf.focusStyle;
|
|
19314
|
-
if (focusStyle && State.isFocus(leaf, button)) exist = assign(style, focusStyle);
|
|
19385
|
+
if (focusStyle && State.isFocus(leaf, button)) exist = assign$1(style, focusStyle);
|
|
19315
19386
|
const hoverStyle = style.hoverStyle || leaf.hoverStyle;
|
|
19316
|
-
if (hoverStyle && State.isHover(leaf, button)) exist = assign(style, hoverStyle);
|
|
19387
|
+
if (hoverStyle && State.isHover(leaf, button)) exist = assign$1(style, hoverStyle);
|
|
19317
19388
|
const pressStyle = style.pressStyle || leaf.pressStyle;
|
|
19318
|
-
if (pressStyle && State.isPress(leaf, button)) exist = assign(style, pressStyle);
|
|
19389
|
+
if (pressStyle && State.isPress(leaf, button)) exist = assign$1(style, pressStyle);
|
|
19319
19390
|
}
|
|
19320
19391
|
return exist ? style : undefined;
|
|
19321
19392
|
}
|
|
@@ -19346,7 +19417,7 @@ function getTransition(type, style, data) {
|
|
|
19346
19417
|
return isNull(style[name]) ? data[name] : style[name];
|
|
19347
19418
|
}
|
|
19348
19419
|
|
|
19349
|
-
function assign(style, stateStyle) {
|
|
19420
|
+
function assign$1(style, stateStyle) {
|
|
19350
19421
|
Object.assign(style, stateStyle);
|
|
19351
19422
|
return true;
|
|
19352
19423
|
}
|
|
@@ -19616,6 +19687,9 @@ let Robot = class Robot extends UI {
|
|
|
19616
19687
|
constructor(data) {
|
|
19617
19688
|
super(data);
|
|
19618
19689
|
}
|
|
19690
|
+
togglePlay() {
|
|
19691
|
+
this.running ? this.pause() : this.play();
|
|
19692
|
+
}
|
|
19619
19693
|
play() {
|
|
19620
19694
|
this.running = true;
|
|
19621
19695
|
}
|
|
@@ -20167,4 +20241,258 @@ Plugin.add("bright");
|
|
|
20167
20241
|
|
|
20168
20242
|
UI.addAttr("bright", false, dimType);
|
|
20169
20243
|
|
|
20170
|
-
|
|
20244
|
+
const config = {
|
|
20245
|
+
theme: "light",
|
|
20246
|
+
style: {
|
|
20247
|
+
dragBoundsType: "outer",
|
|
20248
|
+
strokeAlign: "center",
|
|
20249
|
+
strokeWidthFixed: "zoom-in",
|
|
20250
|
+
width: 6,
|
|
20251
|
+
height: 6,
|
|
20252
|
+
opacity: .5,
|
|
20253
|
+
cornerRadius: 3,
|
|
20254
|
+
hoverStyle: {
|
|
20255
|
+
opacity: .6
|
|
20256
|
+
},
|
|
20257
|
+
pressStyle: {
|
|
20258
|
+
opacity: .66
|
|
20259
|
+
}
|
|
20260
|
+
},
|
|
20261
|
+
size: 6,
|
|
20262
|
+
endsMargin: 2,
|
|
20263
|
+
sideMargin: 2,
|
|
20264
|
+
minSize: 10,
|
|
20265
|
+
scaleFixed: "zoom-in",
|
|
20266
|
+
scrollType: "both",
|
|
20267
|
+
hideOnActionEnd: "hover"
|
|
20268
|
+
};
|
|
20269
|
+
|
|
20270
|
+
const tempBounds = new Bounds, {float: float} = MathHelper, {clone: clone, assign: assign} = DataHelper;
|
|
20271
|
+
|
|
20272
|
+
class Scroller extends Group {
|
|
20273
|
+
get canUse() {
|
|
20274
|
+
return this.target.hasScroller;
|
|
20275
|
+
}
|
|
20276
|
+
constructor(target) {
|
|
20277
|
+
super();
|
|
20278
|
+
this.targetWorldBounds = new Bounds;
|
|
20279
|
+
this.viewportBounds = new Bounds;
|
|
20280
|
+
this.contentBounds = new Bounds;
|
|
20281
|
+
this.scrollXBounds = new Bounds;
|
|
20282
|
+
this.scrollYBounds = new Bounds;
|
|
20283
|
+
this.target = target;
|
|
20284
|
+
this.config = clone(config);
|
|
20285
|
+
this.updateConfig();
|
|
20286
|
+
this.__listenEvents();
|
|
20287
|
+
target.waitLeafer(() => {
|
|
20288
|
+
this.parent = target;
|
|
20289
|
+
this.__bindLeafer(target.leafer);
|
|
20290
|
+
});
|
|
20291
|
+
if (this.mergedConfig.hideOnActionEnd) this.opacity = 0;
|
|
20292
|
+
}
|
|
20293
|
+
static registerTheme(theme, themeConfig) {
|
|
20294
|
+
S.themeMap[theme] = themeConfig;
|
|
20295
|
+
}
|
|
20296
|
+
static getTheme(theme) {
|
|
20297
|
+
return theme && S.themeMap[theme];
|
|
20298
|
+
}
|
|
20299
|
+
static hasTheme(theme) {
|
|
20300
|
+
return theme && !!S.themeMap[theme];
|
|
20301
|
+
}
|
|
20302
|
+
updateConfig() {
|
|
20303
|
+
const {scrollConfig: scrollConfig} = this.target;
|
|
20304
|
+
const themeConfig = S.getTheme(scrollConfig && S.hasTheme(scrollConfig.theme) && scrollConfig.theme || this.config.theme);
|
|
20305
|
+
const mergedConfig = this.mergedConfig = clone(this.config);
|
|
20306
|
+
assign(mergedConfig, themeConfig);
|
|
20307
|
+
if (scrollConfig) assign(mergedConfig, scrollConfig);
|
|
20308
|
+
this.updateStyle(mergedConfig.style);
|
|
20309
|
+
}
|
|
20310
|
+
updateStyle(style) {
|
|
20311
|
+
if (!this.scrollXBar) this.addMany(this.scrollXBar = new Box, this.scrollYBar = new Box);
|
|
20312
|
+
const {scrollXBar: scrollXBar, scrollYBar: scrollYBar} = this;
|
|
20313
|
+
scrollXBar.set(style);
|
|
20314
|
+
scrollYBar.set(style);
|
|
20315
|
+
scrollXBar.draggable = "x";
|
|
20316
|
+
scrollYBar.draggable = "y";
|
|
20317
|
+
}
|
|
20318
|
+
update(check = true) {
|
|
20319
|
+
if (this.dragScrolling) return;
|
|
20320
|
+
const {target: target, targetOverflow: targetOverflow, targetWorldBounds: targetWorldBounds, viewportBounds: viewportBounds, contentBounds: contentBounds} = this, layout = target.__layout, {overflow: overflow} = target.__;
|
|
20321
|
+
const {childrenRenderBounds: childrenRenderBounds} = layout;
|
|
20322
|
+
const {boxBounds: boxBounds, worldBoxBounds: worldBoxBounds} = layout;
|
|
20323
|
+
const isSameWorldBounds = check && targetOverflow === overflow && targetWorldBounds.isSame(worldBoxBounds);
|
|
20324
|
+
const isSameConfig = layout.scrollConfigChanged ? (this.updateConfig(), layout.scrollConfigChanged = false) : true;
|
|
20325
|
+
const nowContentBounds = tempBounds.set(viewportBounds).add(childrenRenderBounds);
|
|
20326
|
+
if (isSameWorldBounds && isSameConfig && contentBounds.isSame(nowContentBounds)) return;
|
|
20327
|
+
this.targetOverflow = overflow;
|
|
20328
|
+
viewportBounds.set(boxBounds);
|
|
20329
|
+
targetWorldBounds.set(worldBoxBounds);
|
|
20330
|
+
contentBounds.set(nowContentBounds);
|
|
20331
|
+
const {scrollXBar: scrollXBar, scrollYBar: scrollYBar} = this, {size: size, endsMargin: endsMargin, minSize: minSize} = this.mergedConfig, {width: width, height: height} = viewportBounds;
|
|
20332
|
+
this.contentRealX = contentBounds.x - target.scrollX;
|
|
20333
|
+
this.contentRealY = contentBounds.y - target.scrollY;
|
|
20334
|
+
this.ratioX = viewportBounds.width / contentBounds.width;
|
|
20335
|
+
this.ratioY = viewportBounds.height / contentBounds.height;
|
|
20336
|
+
const min = size + endsMargin * 2 + minSize;
|
|
20337
|
+
scrollXBar.visible = float(contentBounds.width) > float(width) && overflow !== "y-scroll" && width > min;
|
|
20338
|
+
scrollYBar.visible = float(contentBounds.height) > float(height) && overflow !== "x-scroll" && height > min;
|
|
20339
|
+
this.updateScrollBar();
|
|
20340
|
+
}
|
|
20341
|
+
updateScrollBar() {
|
|
20342
|
+
const {target: target, viewportBounds: viewportBounds, contentBounds: contentBounds, ratioX: ratioX, ratioY: ratioY, scrollXBar: scrollXBar, scrollYBar: scrollYBar, scrollXBounds: scrollXBounds, scrollYBounds: scrollYBounds} = this;
|
|
20343
|
+
let {size: size, cornerRadius: cornerRadius, endsMargin: endsMargin, sideMargin: sideMargin, minSize: minSize, scaleFixed: scaleFixed, scrollType: scrollType} = this.mergedConfig;
|
|
20344
|
+
const scale = scaleFixed ? target.getClampRenderScale() : 1;
|
|
20345
|
+
endsMargin /= scale;
|
|
20346
|
+
sideMargin /= scale;
|
|
20347
|
+
size /= scale;
|
|
20348
|
+
if (isUndefined(cornerRadius)) cornerRadius = size / 2;
|
|
20349
|
+
if (scrollXBar.visible) {
|
|
20350
|
+
scrollXBounds.set(viewportBounds).shrink([ endsMargin, scrollYBar.visible ? size + sideMargin : endsMargin, sideMargin, endsMargin ]);
|
|
20351
|
+
const scrollRatioX = this.scrollRatioX = scrollXBounds.width / contentBounds.width;
|
|
20352
|
+
scrollXBar.set({
|
|
20353
|
+
x: scrollXBounds.x - contentBounds.x * scrollRatioX,
|
|
20354
|
+
y: scrollXBounds.maxY - size,
|
|
20355
|
+
width: Math.max(scrollXBounds.width * ratioX, minSize),
|
|
20356
|
+
height: size,
|
|
20357
|
+
cornerRadius: cornerRadius,
|
|
20358
|
+
dragBounds: scrollXBounds,
|
|
20359
|
+
hittable: scrollType !== "move"
|
|
20360
|
+
});
|
|
20361
|
+
}
|
|
20362
|
+
if (scrollYBar.visible) {
|
|
20363
|
+
scrollYBounds.set(viewportBounds).shrink([ endsMargin, sideMargin, scrollXBar.visible ? size + sideMargin : endsMargin, endsMargin ]);
|
|
20364
|
+
const scrollRatioY = this.scrollRatioY = scrollYBounds.height / contentBounds.height;
|
|
20365
|
+
scrollYBar.set({
|
|
20366
|
+
x: scrollYBounds.maxX - size,
|
|
20367
|
+
y: scrollYBounds.y - contentBounds.y * scrollRatioY,
|
|
20368
|
+
width: size,
|
|
20369
|
+
height: Math.max(scrollYBounds.height * ratioY, minSize),
|
|
20370
|
+
cornerRadius: cornerRadius,
|
|
20371
|
+
dragBounds: scrollYBounds,
|
|
20372
|
+
hittable: scrollType !== "move"
|
|
20373
|
+
});
|
|
20374
|
+
}
|
|
20375
|
+
this.x = -this.target.scrollX;
|
|
20376
|
+
this.y = -this.target.scrollY;
|
|
20377
|
+
LeafHelper.updateAllMatrix(this);
|
|
20378
|
+
BranchHelper.updateBounds(this);
|
|
20379
|
+
LeafHelper.updateAllChange(this);
|
|
20380
|
+
}
|
|
20381
|
+
onDrag(e) {
|
|
20382
|
+
if (this.mergedConfig.scrollType === "move") return;
|
|
20383
|
+
this.dragScrolling = true;
|
|
20384
|
+
const {scrollXBar: scrollXBar, scrollYBar: scrollYBar, target: target, scrollXBounds: scrollXBounds, scrollYBounds: scrollYBounds} = this;
|
|
20385
|
+
const scrollX = e.current === scrollXBar;
|
|
20386
|
+
if (scrollX) target.scrollX = -((scrollXBar.x - scrollXBounds.x) / this.scrollRatioX + this.contentRealX); else target.scrollY = -((scrollYBar.y - scrollYBounds.y) / this.scrollRatioY + this.contentRealY);
|
|
20387
|
+
}
|
|
20388
|
+
onDragEnd() {
|
|
20389
|
+
if (this.mergedConfig.scrollType === "move") return;
|
|
20390
|
+
this.dragScrolling = false;
|
|
20391
|
+
}
|
|
20392
|
+
onMove(e) {
|
|
20393
|
+
if (!this.canUse) return;
|
|
20394
|
+
this.onEnter();
|
|
20395
|
+
const {scrollType: scrollType, stopDefault: stopDefault} = this.mergedConfig;
|
|
20396
|
+
if (scrollType === "drag") return;
|
|
20397
|
+
const {viewportBounds: viewportBounds, contentBounds: contentBounds, scrollXBar: scrollXBar, scrollYBar: scrollYBar} = this;
|
|
20398
|
+
if (scrollXBar.visible || scrollYBar.visible) {
|
|
20399
|
+
const move = e.getInnerMove(this.target);
|
|
20400
|
+
DragBoundsHelper.getValidMove(contentBounds, viewportBounds, "inner", move, true);
|
|
20401
|
+
let needStop;
|
|
20402
|
+
if (move.x && scrollXBar.visible) this.target.scrollX += move.x, needStop = true;
|
|
20403
|
+
if (move.y && scrollYBar.visible) this.target.scrollY += move.y, needStop = true;
|
|
20404
|
+
if (needStop || stopDefault) e.stop();
|
|
20405
|
+
if (stopDefault) e.stopDefault();
|
|
20406
|
+
}
|
|
20407
|
+
}
|
|
20408
|
+
onMoveEnd(e) {
|
|
20409
|
+
if (!this.canUse) return;
|
|
20410
|
+
if (!this.target.hit(e)) this.onLeave();
|
|
20411
|
+
}
|
|
20412
|
+
onEnter() {
|
|
20413
|
+
if (!this.canUse) return;
|
|
20414
|
+
clearTimeout(this.hideTimer);
|
|
20415
|
+
this.killAnimate();
|
|
20416
|
+
this.opacity = 1;
|
|
20417
|
+
}
|
|
20418
|
+
onLeave() {
|
|
20419
|
+
if (!this.canUse) return;
|
|
20420
|
+
clearTimeout(this.hideTimer);
|
|
20421
|
+
if (this.mergedConfig.hideOnActionEnd) this.hideTimer = setTimeout(() => {
|
|
20422
|
+
this.set({
|
|
20423
|
+
opacity: 0
|
|
20424
|
+
}, Plugin.has("animate"));
|
|
20425
|
+
}, 600);
|
|
20426
|
+
}
|
|
20427
|
+
onResize() {
|
|
20428
|
+
if (this.canUse) this.update();
|
|
20429
|
+
}
|
|
20430
|
+
__listenEvents() {
|
|
20431
|
+
const {scrollXBar: scrollXBar, scrollYBar: scrollYBar, target: target} = this;
|
|
20432
|
+
this.__eventIds = [ scrollXBar.on_(DragEvent.DRAG, this.onDrag, this), scrollXBar.on_(DragEvent.END, this.onDragEnd, this), scrollYBar.on_(DragEvent.DRAG, this.onDrag, this), scrollYBar.on_(DragEvent.END, this.onDragEnd, this), target.on_(PointerEvent.ENTER, this.onEnter, this), target.on_(PointerEvent.LEAVE, this.onLeave, this), target.on_(MoveEvent.BEFORE_MOVE, this.onMove, this), target.on_(MoveEvent.END, this.onMoveEnd, this), target.on_(BoundsEvent.WORLD, this.onResize, this), target.on_(ChildEvent.DESTROY, this.destroy, this) ];
|
|
20433
|
+
}
|
|
20434
|
+
__removeListenEvents() {
|
|
20435
|
+
this.off_(this.__eventIds);
|
|
20436
|
+
}
|
|
20437
|
+
destroy() {
|
|
20438
|
+
if (!this.destroyed) {
|
|
20439
|
+
this.__removeListenEvents();
|
|
20440
|
+
const {target: target} = this;
|
|
20441
|
+
target.scroller = target.topChildren = target.hasScroller = undefined;
|
|
20442
|
+
this.target = this.config = null;
|
|
20443
|
+
super.destroy();
|
|
20444
|
+
}
|
|
20445
|
+
}
|
|
20446
|
+
}
|
|
20447
|
+
|
|
20448
|
+
Scroller.themeMap = {};
|
|
20449
|
+
|
|
20450
|
+
const S = Scroller;
|
|
20451
|
+
|
|
20452
|
+
function scrollConfigType(defaultValue) {
|
|
20453
|
+
return decorateLeafAttr(defaultValue, key => attr({
|
|
20454
|
+
set(value) {
|
|
20455
|
+
if (this.__setAttr(key, value)) {
|
|
20456
|
+
const layout = this.__layout;
|
|
20457
|
+
layout.scrollConfigChanged = true;
|
|
20458
|
+
doBoundsType(this);
|
|
20459
|
+
}
|
|
20460
|
+
}
|
|
20461
|
+
}));
|
|
20462
|
+
}
|
|
20463
|
+
|
|
20464
|
+
Plugin.add("scroller");
|
|
20465
|
+
|
|
20466
|
+
const box = Box.prototype;
|
|
20467
|
+
|
|
20468
|
+
Box.addAttr("scrollConfig", undefined, scrollConfigType);
|
|
20469
|
+
|
|
20470
|
+
box.__checkScroll = function(isScrollMode) {
|
|
20471
|
+
if (isScrollMode && this.isOverflow) {
|
|
20472
|
+
if (!this.scroller) {
|
|
20473
|
+
this.scroller = new Scroller(this);
|
|
20474
|
+
if (!this.topChildren) this.topChildren = [];
|
|
20475
|
+
this.topChildren.push(this.scroller);
|
|
20476
|
+
}
|
|
20477
|
+
this.hasScroller = true;
|
|
20478
|
+
} else {
|
|
20479
|
+
if (this.hasScroller && !this.scroller.dragScrolling) {
|
|
20480
|
+
this.hasScroller = undefined;
|
|
20481
|
+
this.scroller.update();
|
|
20482
|
+
}
|
|
20483
|
+
}
|
|
20484
|
+
};
|
|
20485
|
+
|
|
20486
|
+
Scroller.registerTheme("light", {
|
|
20487
|
+
style: {
|
|
20488
|
+
fill: "black"
|
|
20489
|
+
}
|
|
20490
|
+
});
|
|
20491
|
+
|
|
20492
|
+
Scroller.registerTheme("dark", {
|
|
20493
|
+
style: {
|
|
20494
|
+
fill: "white"
|
|
20495
|
+
}
|
|
20496
|
+
});
|
|
20497
|
+
|
|
20498
|
+
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferTypeCreator, LeaferVideo, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TextEditor, TouchEvent, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$3 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$4 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|