@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.js
CHANGED
|
@@ -7,6 +7,42 @@ var LeaferUI = function(exports) {
|
|
|
7
7
|
PathNodeHandleType[PathNodeHandleType["mirrorAngle"] = 3] = "mirrorAngle";
|
|
8
8
|
PathNodeHandleType[PathNodeHandleType["mirror"] = 4] = "mirror";
|
|
9
9
|
})(exports.PathNodeHandleType || (exports.PathNodeHandleType = {}));
|
|
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
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
16
|
+
function adopt(value) {
|
|
17
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
18
|
+
resolve(value);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
22
|
+
function fulfilled(value) {
|
|
23
|
+
try {
|
|
24
|
+
step(generator.next(value));
|
|
25
|
+
} catch (e) {
|
|
26
|
+
reject(e);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function rejected(value) {
|
|
30
|
+
try {
|
|
31
|
+
step(generator["throw"](value));
|
|
32
|
+
} catch (e) {
|
|
33
|
+
reject(e);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function step(result) {
|
|
37
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
38
|
+
}
|
|
39
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
43
|
+
var e = new Error(message);
|
|
44
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
45
|
+
};
|
|
10
46
|
exports.Answer = void 0;
|
|
11
47
|
(function(Answer) {
|
|
12
48
|
Answer[Answer["No"] = 0] = "No";
|
|
@@ -44,8 +80,8 @@ var LeaferUI = function(exports) {
|
|
|
44
80
|
}
|
|
45
81
|
const DataHelper = {
|
|
46
82
|
default(t, defaultData) {
|
|
47
|
-
assign$
|
|
48
|
-
assign$
|
|
83
|
+
assign$2(defaultData, t);
|
|
84
|
+
assign$2(t, defaultData);
|
|
49
85
|
return t;
|
|
50
86
|
},
|
|
51
87
|
assign(t, merge, exclude) {
|
|
@@ -53,9 +89,9 @@ var LeaferUI = function(exports) {
|
|
|
53
89
|
Object.keys(merge).forEach(key => {
|
|
54
90
|
var _a, _b;
|
|
55
91
|
value = merge[key];
|
|
56
|
-
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$
|
|
92
|
+
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]);
|
|
57
93
|
if (exclude && key in exclude) {
|
|
58
|
-
if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object) assign$
|
|
94
|
+
if (((_b = exclude[key]) === null || _b === void 0 ? void 0 : _b.constructor) === Object) assign$2(t[key] = {}, merge[key], exclude[key]);
|
|
59
95
|
return;
|
|
60
96
|
}
|
|
61
97
|
t[key] = merge[key];
|
|
@@ -80,7 +116,7 @@ var LeaferUI = function(exports) {
|
|
|
80
116
|
data[attrName] !== value && (data[attrName] = value);
|
|
81
117
|
}
|
|
82
118
|
};
|
|
83
|
-
const {assign: assign$
|
|
119
|
+
const {assign: assign$2} = DataHelper;
|
|
84
120
|
class LeafData {
|
|
85
121
|
get __useNaturalRatio() {
|
|
86
122
|
return true;
|
|
@@ -377,7 +413,7 @@ var LeaferUI = function(exports) {
|
|
|
377
413
|
};
|
|
378
414
|
}
|
|
379
415
|
const {sin: sin$6, cos: cos$6, acos: acos, sqrt: sqrt$5} = Math;
|
|
380
|
-
const {float: float$
|
|
416
|
+
const {float: float$6} = MathHelper;
|
|
381
417
|
const tempPoint$5 = {};
|
|
382
418
|
function getWorld() {
|
|
383
419
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
|
|
@@ -625,12 +661,12 @@ var LeaferUI = function(exports) {
|
|
|
625
661
|
const cosR = c / scaleY;
|
|
626
662
|
rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
|
|
627
663
|
}
|
|
628
|
-
const cosR = float$
|
|
664
|
+
const cosR = float$6(cos$6(rotation));
|
|
629
665
|
const sinR = sin$6(rotation);
|
|
630
|
-
scaleX = float$
|
|
631
|
-
skewX = cosR ? float$
|
|
632
|
-
skewY = cosR ? float$
|
|
633
|
-
rotation = float$
|
|
666
|
+
scaleX = float$6(scaleX), scaleY = float$6(scaleY);
|
|
667
|
+
skewX = cosR ? float$6((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
668
|
+
skewY = cosR ? float$6((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
669
|
+
rotation = float$6(rotation / OneRadian);
|
|
634
670
|
} else {
|
|
635
671
|
scaleX = a;
|
|
636
672
|
scaleY = d;
|
|
@@ -672,7 +708,7 @@ var LeaferUI = function(exports) {
|
|
|
672
708
|
}
|
|
673
709
|
};
|
|
674
710
|
const M$b = MatrixHelper;
|
|
675
|
-
const {float: float$
|
|
711
|
+
const {float: float$5} = MathHelper;
|
|
676
712
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
677
713
|
const {sin: sin$5, cos: cos$5, abs: abs$a, sqrt: sqrt$4, atan2: atan2$2, min: min$3, round: round$5} = Math;
|
|
678
714
|
const PointHelper = {
|
|
@@ -810,7 +846,7 @@ var LeaferUI = function(exports) {
|
|
|
810
846
|
return points;
|
|
811
847
|
},
|
|
812
848
|
isSame(t, point) {
|
|
813
|
-
return float$
|
|
849
|
+
return float$5(t.x) === float$5(point.x) && float$5(t.y) === float$5(point.y);
|
|
814
850
|
},
|
|
815
851
|
reset(t) {
|
|
816
852
|
P$7.reset(t);
|
|
@@ -1144,14 +1180,14 @@ var LeaferUI = function(exports) {
|
|
|
1144
1180
|
};
|
|
1145
1181
|
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPoint$3, toBounds: toBounds$3} = TwoPointBoundsHelper;
|
|
1146
1182
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1147
|
-
const {float: float$
|
|
1183
|
+
const {float: float$4, fourNumber: fourNumber$1} = MathHelper;
|
|
1148
1184
|
const {floor: floor$2, ceil: ceil$2} = Math;
|
|
1149
1185
|
let right$4, bottom$3, boundsRight, boundsBottom;
|
|
1150
1186
|
const point$2 = {};
|
|
1151
1187
|
const toPoint$5 = {};
|
|
1152
|
-
const tempBounds$
|
|
1188
|
+
const tempBounds$4 = {};
|
|
1153
1189
|
const BoundsHelper = {
|
|
1154
|
-
tempBounds: tempBounds$
|
|
1190
|
+
tempBounds: tempBounds$4,
|
|
1155
1191
|
set(t, x = 0, y = 0, width = 0, height = 0) {
|
|
1156
1192
|
t.x = x;
|
|
1157
1193
|
t.y = y;
|
|
@@ -1220,9 +1256,9 @@ var LeaferUI = function(exports) {
|
|
|
1220
1256
|
t.height *= scaleY;
|
|
1221
1257
|
},
|
|
1222
1258
|
tempToOuterOf(t, matrix) {
|
|
1223
|
-
B.copy(tempBounds$
|
|
1224
|
-
B.toOuterOf(tempBounds$
|
|
1225
|
-
return tempBounds$
|
|
1259
|
+
B.copy(tempBounds$4, t);
|
|
1260
|
+
B.toOuterOf(tempBounds$4, matrix);
|
|
1261
|
+
return tempBounds$4;
|
|
1226
1262
|
},
|
|
1227
1263
|
getOuterOf(t, matrix) {
|
|
1228
1264
|
t = Object.assign({}, t);
|
|
@@ -1280,9 +1316,9 @@ var LeaferUI = function(exports) {
|
|
|
1280
1316
|
put(t, put, align = "center", putScale = 1, changeSize = true, to) {
|
|
1281
1317
|
to || (to = put);
|
|
1282
1318
|
if (isString(putScale)) putScale = B.getFitScale(t, put, putScale === "cover");
|
|
1283
|
-
tempBounds$
|
|
1284
|
-
tempBounds$
|
|
1285
|
-
AlignHelper.toPoint(align, tempBounds$
|
|
1319
|
+
tempBounds$4.width = changeSize ? put.width *= putScale : put.width * putScale;
|
|
1320
|
+
tempBounds$4.height = changeSize ? put.height *= putScale : put.height * putScale;
|
|
1321
|
+
AlignHelper.toPoint(align, tempBounds$4, t, to, true, true);
|
|
1286
1322
|
},
|
|
1287
1323
|
getSpread(t, spread, side) {
|
|
1288
1324
|
const n = {};
|
|
@@ -1313,10 +1349,10 @@ var LeaferUI = function(exports) {
|
|
|
1313
1349
|
}
|
|
1314
1350
|
},
|
|
1315
1351
|
float(t, maxLength) {
|
|
1316
|
-
t.x = float$
|
|
1317
|
-
t.y = float$
|
|
1318
|
-
t.width = float$
|
|
1319
|
-
t.height = float$
|
|
1352
|
+
t.x = float$4(t.x, maxLength);
|
|
1353
|
+
t.y = float$4(t.y, maxLength);
|
|
1354
|
+
t.width = float$4(t.width, maxLength);
|
|
1355
|
+
t.height = float$4(t.height, maxLength);
|
|
1320
1356
|
},
|
|
1321
1357
|
add(t, bounds, isPoint) {
|
|
1322
1358
|
right$4 = t.x + t.width;
|
|
@@ -1581,7 +1617,7 @@ var LeaferUI = function(exports) {
|
|
|
1581
1617
|
BoundsHelper.reset(this);
|
|
1582
1618
|
}
|
|
1583
1619
|
}
|
|
1584
|
-
const tempBounds$
|
|
1620
|
+
const tempBounds$3 = new Bounds;
|
|
1585
1621
|
class AutoBounds {
|
|
1586
1622
|
constructor(top, right, bottom, left, width, height) {
|
|
1587
1623
|
isObject(top) ? this.copy(top) : this.set(top, right, bottom, left, width, height);
|
|
@@ -1650,7 +1686,7 @@ var LeaferUI = function(exports) {
|
|
|
1650
1686
|
resize(view, width, height, xGap, yGap, clip, smooth, opacity, _filters, interlace) {
|
|
1651
1687
|
const realWidth = max$5(floor$1(width + (xGap || 0)), 1), realHeight = max$5(floor$1(height + (yGap || 0)), 1);
|
|
1652
1688
|
let interlaceX, interlaceY, interlaceOffset;
|
|
1653
|
-
if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset,
|
|
1689
|
+
if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, interlace.type === "x" ? width : height))) interlace.type === "x" ? interlaceX = true : interlaceY = true;
|
|
1654
1690
|
const canvas = Platform.origin.createCanvas(interlaceY ? realWidth * 2 : realWidth, interlaceX ? realHeight * 2 : realHeight);
|
|
1655
1691
|
const ctx = canvas.getContext("2d");
|
|
1656
1692
|
if (opacity) ctx.globalAlpha = opacity;
|
|
@@ -1803,7 +1839,10 @@ var LeaferUI = function(exports) {
|
|
|
1803
1839
|
list$3[tag] = UI;
|
|
1804
1840
|
},
|
|
1805
1841
|
get(tag, data, x, y, width, height) {
|
|
1806
|
-
if (!list$3[tag])
|
|
1842
|
+
if (!list$3[tag]) {
|
|
1843
|
+
debug$h.warn("not register " + tag);
|
|
1844
|
+
return undefined;
|
|
1845
|
+
}
|
|
1807
1846
|
const ui = new list$3[tag](data);
|
|
1808
1847
|
if (!isUndefined(x)) {
|
|
1809
1848
|
ui.x = x;
|
|
@@ -1888,42 +1927,6 @@ var LeaferUI = function(exports) {
|
|
|
1888
1927
|
this.clear();
|
|
1889
1928
|
}
|
|
1890
1929
|
}
|
|
1891
|
-
function __decorate(decorators, target, key, desc) {
|
|
1892
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1893
|
-
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;
|
|
1894
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1895
|
-
}
|
|
1896
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
1897
|
-
function adopt(value) {
|
|
1898
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
1899
|
-
resolve(value);
|
|
1900
|
-
});
|
|
1901
|
-
}
|
|
1902
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
1903
|
-
function fulfilled(value) {
|
|
1904
|
-
try {
|
|
1905
|
-
step(generator.next(value));
|
|
1906
|
-
} catch (e) {
|
|
1907
|
-
reject(e);
|
|
1908
|
-
}
|
|
1909
|
-
}
|
|
1910
|
-
function rejected(value) {
|
|
1911
|
-
try {
|
|
1912
|
-
step(generator["throw"](value));
|
|
1913
|
-
} catch (e) {
|
|
1914
|
-
reject(e);
|
|
1915
|
-
}
|
|
1916
|
-
}
|
|
1917
|
-
function step(result) {
|
|
1918
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
1919
|
-
}
|
|
1920
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1921
|
-
});
|
|
1922
|
-
}
|
|
1923
|
-
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
1924
|
-
var e = new Error(message);
|
|
1925
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1926
|
-
};
|
|
1927
1930
|
function contextAttr(realName) {
|
|
1928
1931
|
return (target, key) => {
|
|
1929
1932
|
if (!realName) realName = key;
|
|
@@ -2739,7 +2742,7 @@ var LeaferUI = function(exports) {
|
|
|
2739
2742
|
return [];
|
|
2740
2743
|
}
|
|
2741
2744
|
};
|
|
2742
|
-
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;
|
|
2745
|
+
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;
|
|
2743
2746
|
const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
|
|
2744
2747
|
const {ellipticalArc: ellipticalArc} = EllipseHelper;
|
|
2745
2748
|
const debug$f = Debug.get("PathConvert");
|
|
@@ -2867,10 +2870,10 @@ var LeaferUI = function(exports) {
|
|
|
2867
2870
|
old[i + 2] += y;
|
|
2868
2871
|
old[i + 3] += x;
|
|
2869
2872
|
old[i + 4] += y;
|
|
2870
|
-
command = S;
|
|
2873
|
+
command = S$1;
|
|
2871
2874
|
|
|
2872
|
-
case S:
|
|
2873
|
-
smooth = lastCommand === C$7 || lastCommand === S;
|
|
2875
|
+
case S$1:
|
|
2876
|
+
smooth = lastCommand === C$7 || lastCommand === S$1;
|
|
2874
2877
|
x1 = smooth ? x * 2 - controlX : old[i + 1];
|
|
2875
2878
|
y1 = smooth ? y * 2 - controlY : old[i + 2];
|
|
2876
2879
|
controlX = old[i + 1];
|
|
@@ -3114,10 +3117,10 @@ var LeaferUI = function(exports) {
|
|
|
3114
3117
|
data.push(O$5, x, y, radius, startAngle, endAngle, anticlockwise ? 1 : 0);
|
|
3115
3118
|
}
|
|
3116
3119
|
},
|
|
3117
|
-
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3120
|
+
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
|
|
3118
3121
|
if (!isUndefined(lastX)) {
|
|
3119
|
-
const
|
|
3120
|
-
radius = min$2(radius, min$2(
|
|
3122
|
+
const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
|
|
3123
|
+
radius = min$2(radius, min$2(r, r * abs$8(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3121
3124
|
}
|
|
3122
3125
|
data.push(U$4, x1, y1, x2, y2, radius);
|
|
3123
3126
|
},
|
|
@@ -3442,7 +3445,7 @@ var LeaferUI = function(exports) {
|
|
|
3442
3445
|
let command, lastCommand, commandLen;
|
|
3443
3446
|
let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
|
|
3444
3447
|
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
3445
|
-
const len = data.length;
|
|
3448
|
+
const len = data.length, three = len === 9;
|
|
3446
3449
|
const smooth = [];
|
|
3447
3450
|
while (i < len) {
|
|
3448
3451
|
command = data[i];
|
|
@@ -3454,7 +3457,7 @@ var LeaferUI = function(exports) {
|
|
|
3454
3457
|
if (data[i] === L$5) {
|
|
3455
3458
|
secondX = data[i + 1];
|
|
3456
3459
|
secondY = data[i + 2];
|
|
3457
|
-
smooth.push(M$5, getCenterX(startX, secondX), getCenterY(startY, secondY));
|
|
3460
|
+
three ? smooth.push(M$5, startX, startY) : smooth.push(M$5, getCenterX(startX, secondX), getCenterY(startY, secondY));
|
|
3458
3461
|
} else {
|
|
3459
3462
|
smooth.push(M$5, startX, startY);
|
|
3460
3463
|
}
|
|
@@ -3466,11 +3469,11 @@ var LeaferUI = function(exports) {
|
|
|
3466
3469
|
i += 3;
|
|
3467
3470
|
switch (data[i]) {
|
|
3468
3471
|
case L$5:
|
|
3469
|
-
arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY);
|
|
3472
|
+
arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY, three);
|
|
3470
3473
|
break;
|
|
3471
3474
|
|
|
3472
3475
|
case Z$3:
|
|
3473
|
-
arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY);
|
|
3476
|
+
arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
|
|
3474
3477
|
break;
|
|
3475
3478
|
|
|
3476
3479
|
default:
|
|
@@ -3482,7 +3485,7 @@ var LeaferUI = function(exports) {
|
|
|
3482
3485
|
|
|
3483
3486
|
case Z$3:
|
|
3484
3487
|
if (lastCommand !== Z$3) {
|
|
3485
|
-
arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
|
|
3488
|
+
arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY, three);
|
|
3486
3489
|
smooth.push(Z$3);
|
|
3487
3490
|
}
|
|
3488
3491
|
i += 1;
|
|
@@ -3523,10 +3526,10 @@ var LeaferUI = function(exports) {
|
|
|
3523
3526
|
const FileHelper = {
|
|
3524
3527
|
alphaPixelTypes: [ "png", "webp", "svg" ],
|
|
3525
3528
|
upperCaseTypeMap: {},
|
|
3526
|
-
|
|
3527
|
-
if (!type || type.startsWith(
|
|
3529
|
+
mimeType(type, base = "image") {
|
|
3530
|
+
if (!type || type.startsWith(base)) return type;
|
|
3528
3531
|
if (type === "jpg") type = "jpeg";
|
|
3529
|
-
return "
|
|
3532
|
+
return base + "/" + type;
|
|
3530
3533
|
},
|
|
3531
3534
|
fileType(filename) {
|
|
3532
3535
|
const l = filename.split(".");
|
|
@@ -3557,6 +3560,7 @@ var LeaferUI = function(exports) {
|
|
|
3557
3560
|
}
|
|
3558
3561
|
};
|
|
3559
3562
|
const F$2 = FileHelper;
|
|
3563
|
+
F$2.mineType = F$2.mimeType;
|
|
3560
3564
|
F$2.alphaPixelTypes.forEach(type => F$2.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3561
3565
|
const debug$c = Debug.get("TaskProcessor");
|
|
3562
3566
|
class TaskItem {
|
|
@@ -3796,6 +3800,9 @@ var LeaferUI = function(exports) {
|
|
|
3796
3800
|
const debug$b = Debug.get("Resource");
|
|
3797
3801
|
const Resource = {
|
|
3798
3802
|
tasker: new TaskProcessor,
|
|
3803
|
+
queue: new TaskProcessor({
|
|
3804
|
+
parallel: 1
|
|
3805
|
+
}),
|
|
3799
3806
|
map: {},
|
|
3800
3807
|
get isComplete() {
|
|
3801
3808
|
return R.tasker.isComplete;
|
|
@@ -3832,6 +3839,12 @@ var LeaferUI = function(exports) {
|
|
|
3832
3839
|
R.set(key, value);
|
|
3833
3840
|
return value;
|
|
3834
3841
|
},
|
|
3842
|
+
loadFilm(_key, _format) {
|
|
3843
|
+
return undefined;
|
|
3844
|
+
},
|
|
3845
|
+
loadVideo(_key, _format) {
|
|
3846
|
+
return undefined;
|
|
3847
|
+
},
|
|
3835
3848
|
destroy() {
|
|
3836
3849
|
R.map = {};
|
|
3837
3850
|
}
|
|
@@ -3840,12 +3853,10 @@ var LeaferUI = function(exports) {
|
|
|
3840
3853
|
const ImageManager = {
|
|
3841
3854
|
maxRecycled: 10,
|
|
3842
3855
|
recycledList: [],
|
|
3843
|
-
patternTasker:
|
|
3844
|
-
|
|
3845
|
-
}),
|
|
3846
|
-
get(config) {
|
|
3856
|
+
patternTasker: Resource.queue,
|
|
3857
|
+
get(config, type) {
|
|
3847
3858
|
let image = Resource.get(config.url);
|
|
3848
|
-
if (!image) Resource.set(config.url, image = Creator.image(config));
|
|
3859
|
+
if (!image) Resource.set(config.url, image = type === "film" ? Creator.film(config) : Creator.image(config));
|
|
3849
3860
|
image.use++;
|
|
3850
3861
|
return image;
|
|
3851
3862
|
},
|
|
@@ -3880,7 +3891,7 @@ var LeaferUI = function(exports) {
|
|
|
3880
3891
|
if (config.format) return config.format === format;
|
|
3881
3892
|
const {url: url} = config;
|
|
3882
3893
|
if (url.startsWith("data:")) {
|
|
3883
|
-
if (url.startsWith("data:" + FileHelper.
|
|
3894
|
+
if (url.startsWith("data:" + FileHelper.mimeType(format))) return true;
|
|
3884
3895
|
} else {
|
|
3885
3896
|
if (url.includes("." + format) || url.includes("." + FileHelper.upperCaseTypeMap[format])) return true; else if (format === "png" && !url.includes(".")) return true;
|
|
3886
3897
|
}
|
|
@@ -3893,6 +3904,9 @@ var LeaferUI = function(exports) {
|
|
|
3893
3904
|
const I$1 = ImageManager;
|
|
3894
3905
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
3895
3906
|
class LeaferImage {
|
|
3907
|
+
get tag() {
|
|
3908
|
+
return "Image";
|
|
3909
|
+
}
|
|
3896
3910
|
get url() {
|
|
3897
3911
|
return this.config.url;
|
|
3898
3912
|
}
|
|
@@ -3921,7 +3935,7 @@ var LeaferUI = function(exports) {
|
|
|
3921
3935
|
if (!this.loading) {
|
|
3922
3936
|
this.loading = true;
|
|
3923
3937
|
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
3924
|
-
return yield Platform.origin.
|
|
3938
|
+
return yield Platform.origin["load" + this.tag](this.getLoadUrl(thumbSize), this.crossOrigin, this).then(img => {
|
|
3925
3939
|
if (thumbSize) this.setThumbView(img);
|
|
3926
3940
|
this.setView(img);
|
|
3927
3941
|
}).catch(e => {
|
|
@@ -3995,6 +4009,9 @@ var LeaferUI = function(exports) {
|
|
|
3995
4009
|
Platform.image.setPatternTransform(pattern, transform, paint);
|
|
3996
4010
|
return pattern;
|
|
3997
4011
|
}
|
|
4012
|
+
render(canvas, x, y, width, height, _leaf, _paint, _imageScaleX, _imageScaleY) {
|
|
4013
|
+
canvas.drawImage(this.view, x, y, width, height);
|
|
4014
|
+
}
|
|
3998
4015
|
getLoadUrl(_thumbSize) {
|
|
3999
4016
|
return this.url;
|
|
4000
4017
|
}
|
|
@@ -4020,6 +4037,16 @@ var LeaferUI = function(exports) {
|
|
|
4020
4037
|
this.waitComplete.length = 0;
|
|
4021
4038
|
}
|
|
4022
4039
|
}
|
|
4040
|
+
class LeaferFilm extends LeaferImage {
|
|
4041
|
+
get tag() {
|
|
4042
|
+
return "Film";
|
|
4043
|
+
}
|
|
4044
|
+
}
|
|
4045
|
+
class LeaferVideo extends LeaferImage {
|
|
4046
|
+
get tag() {
|
|
4047
|
+
return "Video";
|
|
4048
|
+
}
|
|
4049
|
+
}
|
|
4023
4050
|
function defineKey(target, key, descriptor, noConfigurable) {
|
|
4024
4051
|
if (!noConfigurable) descriptor.configurable = descriptor.enumerable = true;
|
|
4025
4052
|
Object.defineProperty(target, key, descriptor);
|
|
@@ -5758,9 +5785,11 @@ var LeaferUI = function(exports) {
|
|
|
5758
5785
|
if (this.__hasMask) {
|
|
5759
5786
|
this.__renderMask(canvas, options);
|
|
5760
5787
|
} else {
|
|
5788
|
+
let child;
|
|
5761
5789
|
const {children: children} = this;
|
|
5762
5790
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5763
|
-
|
|
5791
|
+
child = children[i];
|
|
5792
|
+
excludeRenderBounds$1(child, options) || (child.__.complex ? child.__renderComplex(canvas, options) : child.__render(canvas, options));
|
|
5764
5793
|
}
|
|
5765
5794
|
}
|
|
5766
5795
|
},
|
|
@@ -6233,6 +6262,7 @@ var LeaferUI = function(exports) {
|
|
|
6233
6262
|
__drawHitPath(_canvas) {}
|
|
6234
6263
|
__updateHitCanvas() {}
|
|
6235
6264
|
__render(_canvas, _options) {}
|
|
6265
|
+
__renderComplex(_canvas, _options) {}
|
|
6236
6266
|
__drawFast(_canvas, _options) {}
|
|
6237
6267
|
__draw(_canvas, _options, _originCanvas) {}
|
|
6238
6268
|
__clip(_canvas, _options) {}
|
|
@@ -6346,6 +6376,7 @@ var LeaferUI = function(exports) {
|
|
|
6346
6376
|
this.add(item, index);
|
|
6347
6377
|
noIndex || index++;
|
|
6348
6378
|
}); else child = UICreator.get(child.tag, child);
|
|
6379
|
+
if (!child) return;
|
|
6349
6380
|
}
|
|
6350
6381
|
if (child.parent) child.parent.remove(child);
|
|
6351
6382
|
child.parent = this;
|
|
@@ -6567,7 +6598,7 @@ var LeaferUI = function(exports) {
|
|
|
6567
6598
|
this.levelMap = null;
|
|
6568
6599
|
}
|
|
6569
6600
|
}
|
|
6570
|
-
const version = "2.0.
|
|
6601
|
+
const version = "2.0.2";
|
|
6571
6602
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6572
6603
|
get allowBackgroundColor() {
|
|
6573
6604
|
return true;
|
|
@@ -6589,7 +6620,6 @@ var LeaferUI = function(exports) {
|
|
|
6589
6620
|
}
|
|
6590
6621
|
canvasPatch(OffscreenCanvasRenderingContext2D.prototype);
|
|
6591
6622
|
canvasPatch(Path2D.prototype);
|
|
6592
|
-
const {mineType: mineType} = FileHelper;
|
|
6593
6623
|
Object.assign(Creator, {
|
|
6594
6624
|
canvas: (options, manager) => new LeaferCanvas(options, manager),
|
|
6595
6625
|
image: options => new LeaferImage(options)
|
|
@@ -6599,7 +6629,7 @@ var LeaferUI = function(exports) {
|
|
|
6599
6629
|
createCanvas: (width, height) => new OffscreenCanvas(width, height),
|
|
6600
6630
|
canvasToDataURL: (canvas, type, quality) => new Promise((resolve, reject) => {
|
|
6601
6631
|
canvas.convertToBlob({
|
|
6602
|
-
type:
|
|
6632
|
+
type: FileHelper.mimeType(type),
|
|
6603
6633
|
quality: quality
|
|
6604
6634
|
}).then(blob => {
|
|
6605
6635
|
var reader = new FileReader;
|
|
@@ -6611,14 +6641,14 @@ var LeaferUI = function(exports) {
|
|
|
6611
6641
|
});
|
|
6612
6642
|
}),
|
|
6613
6643
|
canvasToBolb: (canvas, type, quality) => canvas.convertToBlob({
|
|
6614
|
-
type:
|
|
6644
|
+
type: FileHelper.mimeType(type),
|
|
6615
6645
|
quality: quality
|
|
6616
6646
|
}),
|
|
6617
6647
|
canvasSaveAs: (_canvas, _filename, _quality) => new Promise(resolve => resolve()),
|
|
6618
6648
|
download(_url, _filename) {
|
|
6619
6649
|
return undefined;
|
|
6620
6650
|
},
|
|
6621
|
-
loadImage(src) {
|
|
6651
|
+
loadImage(src, _crossOrigin, _leaferImage) {
|
|
6622
6652
|
return new Promise((resolve, reject) => {
|
|
6623
6653
|
let req = new XMLHttpRequest;
|
|
6624
6654
|
req.open("GET", Platform.image.getRealURL(src), true);
|
|
@@ -6633,6 +6663,13 @@ var LeaferUI = function(exports) {
|
|
|
6633
6663
|
req.onerror = e => reject(e);
|
|
6634
6664
|
req.send();
|
|
6635
6665
|
});
|
|
6666
|
+
},
|
|
6667
|
+
loadContent(url_1) {
|
|
6668
|
+
return __awaiter(this, arguments, void 0, function*(url, responseType = "text") {
|
|
6669
|
+
const response = yield fetch(url);
|
|
6670
|
+
if (!response.ok) throw new Error(`${response.status}`);
|
|
6671
|
+
return yield response[responseType]();
|
|
6672
|
+
});
|
|
6636
6673
|
}
|
|
6637
6674
|
};
|
|
6638
6675
|
Platform.canvas = Creator.canvas();
|
|
@@ -7111,7 +7148,7 @@ var LeaferUI = function(exports) {
|
|
|
7111
7148
|
getCellList() {
|
|
7112
7149
|
return undefined;
|
|
7113
7150
|
}
|
|
7114
|
-
addBlock(block) {
|
|
7151
|
+
addBlock(block, _leafList) {
|
|
7115
7152
|
if (!this.updateBlocks) this.updateBlocks = [];
|
|
7116
7153
|
this.updateBlocks.push(block);
|
|
7117
7154
|
}
|
|
@@ -7159,7 +7196,8 @@ var LeaferUI = function(exports) {
|
|
|
7159
7196
|
__onLayoutEnd(event) {
|
|
7160
7197
|
if (event.data) event.data.map(item => {
|
|
7161
7198
|
let empty;
|
|
7162
|
-
|
|
7199
|
+
const {updatedList: updatedList} = item;
|
|
7200
|
+
if (updatedList) updatedList.list.some(leaf => {
|
|
7163
7201
|
empty = !leaf.__world.width || !leaf.__world.height;
|
|
7164
7202
|
if (empty) {
|
|
7165
7203
|
if (!leaf.isLeafer) debug$6.tip(leaf.innerName, ": empty");
|
|
@@ -7167,7 +7205,7 @@ var LeaferUI = function(exports) {
|
|
|
7167
7205
|
}
|
|
7168
7206
|
return empty;
|
|
7169
7207
|
});
|
|
7170
|
-
this.addBlock(empty ? this.canvas.bounds : item.updatedBounds);
|
|
7208
|
+
this.addBlock(empty ? this.canvas.bounds : item.updatedBounds, updatedList);
|
|
7171
7209
|
});
|
|
7172
7210
|
}
|
|
7173
7211
|
emitRender(type, bounds, options) {
|
|
@@ -7523,16 +7561,16 @@ var LeaferUI = function(exports) {
|
|
|
7523
7561
|
return t.fill || t.stroke;
|
|
7524
7562
|
}
|
|
7525
7563
|
get __autoWidth() {
|
|
7526
|
-
return
|
|
7564
|
+
return this._width == null;
|
|
7527
7565
|
}
|
|
7528
7566
|
get __autoHeight() {
|
|
7529
|
-
return
|
|
7567
|
+
return this._height == null;
|
|
7530
7568
|
}
|
|
7531
7569
|
get __autoSide() {
|
|
7532
|
-
return
|
|
7570
|
+
return this._width == null || this._height == null;
|
|
7533
7571
|
}
|
|
7534
7572
|
get __autoSize() {
|
|
7535
|
-
return
|
|
7573
|
+
return this._width == null && this._height == null;
|
|
7536
7574
|
}
|
|
7537
7575
|
setVisible(value) {
|
|
7538
7576
|
this._visible = value;
|
|
@@ -7729,13 +7767,16 @@ var LeaferUI = function(exports) {
|
|
|
7729
7767
|
}
|
|
7730
7768
|
}
|
|
7731
7769
|
class ImageData extends RectData {
|
|
7770
|
+
get __urlType() {
|
|
7771
|
+
return "image";
|
|
7772
|
+
}
|
|
7732
7773
|
setUrl(value) {
|
|
7733
7774
|
this.__setImageFill(value);
|
|
7734
7775
|
this._url = value;
|
|
7735
7776
|
}
|
|
7736
7777
|
__setImageFill(value) {
|
|
7737
7778
|
this.fill = value ? {
|
|
7738
|
-
type:
|
|
7779
|
+
type: this.__urlType,
|
|
7739
7780
|
mode: "stretch",
|
|
7740
7781
|
url: value
|
|
7741
7782
|
} : undefined;
|
|
@@ -8151,7 +8192,10 @@ var LeaferUI = function(exports) {
|
|
|
8151
8192
|
}
|
|
8152
8193
|
toJSON(options) {
|
|
8153
8194
|
const data = super.toJSON(options);
|
|
8154
|
-
if (!this.childlessJSON)
|
|
8195
|
+
if (!this.childlessJSON) {
|
|
8196
|
+
const children = data.children = [];
|
|
8197
|
+
this.children.forEach(child => child.skipJSON || children.push(child.toJSON(options)));
|
|
8198
|
+
}
|
|
8155
8199
|
return data;
|
|
8156
8200
|
}
|
|
8157
8201
|
pick(_hitPoint, _options) {
|
|
@@ -8293,12 +8337,12 @@ var LeaferUI = function(exports) {
|
|
|
8293
8337
|
this.emitLeafer(LeaferEvent.STOP);
|
|
8294
8338
|
}
|
|
8295
8339
|
}
|
|
8296
|
-
unlockLayout() {
|
|
8340
|
+
unlockLayout(updateLayout = true) {
|
|
8297
8341
|
this.layouter.start();
|
|
8298
|
-
this.updateLayout();
|
|
8342
|
+
if (updateLayout) this.updateLayout();
|
|
8299
8343
|
}
|
|
8300
|
-
lockLayout() {
|
|
8301
|
-
this.updateLayout();
|
|
8344
|
+
lockLayout(updateLayout = true) {
|
|
8345
|
+
if (updateLayout) this.updateLayout();
|
|
8302
8346
|
this.layouter.stop();
|
|
8303
8347
|
}
|
|
8304
8348
|
resize(size) {
|
|
@@ -9260,7 +9304,7 @@ var LeaferUI = function(exports) {
|
|
|
9260
9304
|
EventCreator.changeName(oldName, newName);
|
|
9261
9305
|
}
|
|
9262
9306
|
}
|
|
9263
|
-
const {min: min$1, max: max$3, abs: abs$7} = Math, {float: float$
|
|
9307
|
+
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;
|
|
9264
9308
|
const tempContent = new Bounds, tempDragBounds = new Bounds;
|
|
9265
9309
|
const DragBoundsHelper = {
|
|
9266
9310
|
limitMove(leaf, move) {
|
|
@@ -9298,8 +9342,8 @@ var LeaferUI = function(exports) {
|
|
|
9298
9342
|
} else {
|
|
9299
9343
|
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
9300
9344
|
}
|
|
9301
|
-
move.x = float$
|
|
9302
|
-
move.y = float$
|
|
9345
|
+
move.x = float$3(move.x);
|
|
9346
|
+
move.y = float$3(move.y);
|
|
9303
9347
|
return move;
|
|
9304
9348
|
},
|
|
9305
9349
|
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, lockRatio, change) {
|
|
@@ -9311,26 +9355,26 @@ var LeaferUI = function(exports) {
|
|
|
9311
9355
|
let correctScaleX = 1, correctScaleY = 1, aScale, bScale, aSize, bSize;
|
|
9312
9356
|
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
9313
9357
|
if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
|
|
9314
|
-
aSize = float$
|
|
9315
|
-
bSize = float$
|
|
9358
|
+
aSize = float$3(tempContent.minX - tempDragBounds.minX);
|
|
9359
|
+
bSize = float$3(tempDragBounds.maxX - tempContent.maxX);
|
|
9316
9360
|
aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
|
|
9317
9361
|
bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
|
|
9318
9362
|
correctScaleX *= max$3(aScale, bScale);
|
|
9319
9363
|
} else {
|
|
9320
9364
|
if (scale.x < 0) {
|
|
9321
|
-
if (float$
|
|
9365
|
+
if (float$3(minX(content) - minX(dragBounds)) <= 0 || float$3(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
|
|
9322
9366
|
tempContent.unsign();
|
|
9323
9367
|
}
|
|
9324
|
-
aSize = float$
|
|
9325
|
-
bSize = float$
|
|
9368
|
+
aSize = float$3(tempDragBounds.minX - tempContent.minX);
|
|
9369
|
+
bSize = float$3(tempContent.maxX - tempDragBounds.maxX);
|
|
9326
9370
|
aScale = originLeftScale && aSize > 0 ? 1 - aSize / (originLeftScale * tempContent.width) : 1;
|
|
9327
9371
|
bScale = originRightScale && bSize > 0 ? 1 - bSize / (originRightScale * tempContent.width) : 1;
|
|
9328
9372
|
correctScaleX *= min$1(aScale, bScale);
|
|
9329
9373
|
}
|
|
9330
9374
|
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
9331
9375
|
if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
|
|
9332
|
-
aSize = float$
|
|
9333
|
-
bSize = float$
|
|
9376
|
+
aSize = float$3(tempContent.minY - tempDragBounds.minY);
|
|
9377
|
+
bSize = float$3(tempDragBounds.maxY - tempContent.maxY);
|
|
9334
9378
|
aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
|
|
9335
9379
|
bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
|
|
9336
9380
|
correctScaleY *= max$3(aScale, bScale);
|
|
@@ -9341,11 +9385,11 @@ var LeaferUI = function(exports) {
|
|
|
9341
9385
|
}
|
|
9342
9386
|
} else {
|
|
9343
9387
|
if (scale.y < 0) {
|
|
9344
|
-
if (float$
|
|
9388
|
+
if (float$3(minY(content) - minY(dragBounds)) <= 0 || float$3(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
|
|
9345
9389
|
tempContent.unsign();
|
|
9346
9390
|
}
|
|
9347
|
-
aSize = float$
|
|
9348
|
-
bSize = float$
|
|
9391
|
+
aSize = float$3(tempDragBounds.minY - tempContent.minY);
|
|
9392
|
+
bSize = float$3(tempContent.maxY - tempDragBounds.maxY);
|
|
9349
9393
|
aScale = originTopScale && aSize > 0 ? 1 - aSize / (originTopScale * tempContent.height) : 1;
|
|
9350
9394
|
bScale = originBottomScale && bSize > 0 ? 1 - bSize / (originBottomScale * tempContent.height) : 1;
|
|
9351
9395
|
correctScaleY *= min$1(aScale, bScale);
|
|
@@ -9778,7 +9822,7 @@ var LeaferUI = function(exports) {
|
|
|
9778
9822
|
function exclude(leaf, excludePath) {
|
|
9779
9823
|
return excludePath && excludePath.has(leaf);
|
|
9780
9824
|
}
|
|
9781
|
-
const config$
|
|
9825
|
+
const config$2 = {
|
|
9782
9826
|
wheel: {
|
|
9783
9827
|
zoomSpeed: .5,
|
|
9784
9828
|
moveSpeed: .5,
|
|
@@ -9850,7 +9894,7 @@ var LeaferUI = function(exports) {
|
|
|
9850
9894
|
return this.p.hitRadius;
|
|
9851
9895
|
}
|
|
9852
9896
|
constructor(target, canvas, selector, userConfig) {
|
|
9853
|
-
this.config = DataHelper.clone(config$
|
|
9897
|
+
this.config = DataHelper.clone(config$2);
|
|
9854
9898
|
this.tapCount = 0;
|
|
9855
9899
|
this.downKeyMap = {};
|
|
9856
9900
|
this.target = target;
|
|
@@ -9877,6 +9921,7 @@ var LeaferUI = function(exports) {
|
|
|
9877
9921
|
this.checkPath(data, useDefaultPath);
|
|
9878
9922
|
this.downTime = Date.now();
|
|
9879
9923
|
this.emit(exports.PointerEvent.BEFORE_DOWN, data);
|
|
9924
|
+
if (data.path.needUpdate) this.updateDownData(data);
|
|
9880
9925
|
this.emit(exports.PointerEvent.DOWN, data);
|
|
9881
9926
|
if (PointerButton.left(data)) {
|
|
9882
9927
|
this.tapWait();
|
|
@@ -10353,8 +10398,8 @@ var LeaferUI = function(exports) {
|
|
|
10353
10398
|
if (isHitPixel) {
|
|
10354
10399
|
const {renderBounds: renderBounds} = this.__layout;
|
|
10355
10400
|
const size = Platform.image.hitCanvasSize;
|
|
10356
|
-
const scale = h.hitScale = tempBounds$
|
|
10357
|
-
const {x: x, y: y, width: width, height: height} = tempBounds$
|
|
10401
|
+
const scale = h.hitScale = tempBounds$3.set(0, 0, size, size).getFitMatrix(renderBounds).a;
|
|
10402
|
+
const {x: x, y: y, width: width, height: height} = tempBounds$3.set(renderBounds).scale(scale);
|
|
10358
10403
|
h.resize({
|
|
10359
10404
|
width: width,
|
|
10360
10405
|
height: height,
|
|
@@ -10412,11 +10457,11 @@ var LeaferUI = function(exports) {
|
|
|
10412
10457
|
}
|
|
10413
10458
|
return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
|
|
10414
10459
|
};
|
|
10415
|
-
const ui$4 = exports.UI.prototype, rect = exports.Rect.prototype, box$
|
|
10416
|
-
rect.__updateHitCanvas = box$
|
|
10460
|
+
const ui$4 = exports.UI.prototype, rect = exports.Rect.prototype, box$3 = exports.Box.prototype;
|
|
10461
|
+
rect.__updateHitCanvas = box$3.__updateHitCanvas = function() {
|
|
10417
10462
|
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;
|
|
10418
10463
|
};
|
|
10419
|
-
rect.__hitFill = box$
|
|
10464
|
+
rect.__hitFill = box$3.__hitFill = function(inner) {
|
|
10420
10465
|
return this.__hitCanvas ? ui$4.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
|
|
10421
10466
|
};
|
|
10422
10467
|
exports.Text.prototype.__drawHitPath = function(canvas) {
|
|
@@ -10442,8 +10487,8 @@ var LeaferUI = function(exports) {
|
|
|
10442
10487
|
canvas$1.hitPixel = function(radiusPoint, offset, scale = 1) {
|
|
10443
10488
|
let {x: x, y: y, radiusX: radiusX, radiusY: radiusY} = radiusPoint;
|
|
10444
10489
|
if (offset) x -= offset.x, y -= offset.y;
|
|
10445
|
-
tempBounds$
|
|
10446
|
-
const {data: data} = this.context.getImageData(tempBounds$
|
|
10490
|
+
tempBounds$3.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
|
|
10491
|
+
const {data: data} = this.context.getImageData(tempBounds$3.x, tempBounds$3.y, tempBounds$3.width || 1, tempBounds$3.height || 1);
|
|
10447
10492
|
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
10448
10493
|
if (data[i + 3] > 0) return true;
|
|
10449
10494
|
}
|
|
@@ -10630,13 +10675,13 @@ var LeaferUI = function(exports) {
|
|
|
10630
10675
|
}
|
|
10631
10676
|
}
|
|
10632
10677
|
const {getSpread: getSpread, copyAndSpread: copyAndSpread$1, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$7, getIntersectData: getIntersectData} = BoundsHelper;
|
|
10633
|
-
const tempBounds$
|
|
10678
|
+
const tempBounds$2 = {};
|
|
10634
10679
|
function shape(ui, current, options) {
|
|
10635
10680
|
const canvas = current.getSameCanvas();
|
|
10636
10681
|
const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
|
|
10637
10682
|
const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
|
|
10638
|
-
toOuterOf(layout.strokeSpread ? (copyAndSpread$1(tempBounds$
|
|
10639
|
-
tempBounds$
|
|
10683
|
+
toOuterOf(layout.strokeSpread ? (copyAndSpread$1(tempBounds$2, layout.boxBounds, layout.strokeSpread),
|
|
10684
|
+
tempBounds$2) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
|
|
10640
10685
|
let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
10641
10686
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
10642
10687
|
if (currentBounds.includes(nowWorldShapeBounds)) {
|
|
@@ -10726,11 +10771,14 @@ var LeaferUI = function(exports) {
|
|
|
10726
10771
|
function getLeafPaint(attrName, paint, ui) {
|
|
10727
10772
|
if (!isObject(paint) || paint.visible === false || paint.opacity === 0) return undefined;
|
|
10728
10773
|
let leafPaint;
|
|
10729
|
-
const {boxBounds: boxBounds} = ui.__layout;
|
|
10730
|
-
switch (
|
|
10774
|
+
const {boxBounds: boxBounds} = ui.__layout, {type: type} = paint;
|
|
10775
|
+
switch (type) {
|
|
10731
10776
|
case "image":
|
|
10777
|
+
case "film":
|
|
10778
|
+
case "video":
|
|
10732
10779
|
if (!paint.url) return undefined;
|
|
10733
10780
|
leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
10781
|
+
if (type !== "image") PaintImage[type](leafPaint);
|
|
10734
10782
|
break;
|
|
10735
10783
|
|
|
10736
10784
|
case "linear":
|
|
@@ -10746,7 +10794,7 @@ var LeaferUI = function(exports) {
|
|
|
10746
10794
|
break;
|
|
10747
10795
|
|
|
10748
10796
|
case "solid":
|
|
10749
|
-
const {
|
|
10797
|
+
const {color: color, opacity: opacity} = paint;
|
|
10750
10798
|
leafPaint = {
|
|
10751
10799
|
type: type,
|
|
10752
10800
|
style: ColorConvert.string(color, opacity)
|
|
@@ -10782,11 +10830,11 @@ var LeaferUI = function(exports) {
|
|
|
10782
10830
|
drawStrokesStyle: drawStrokesStyle,
|
|
10783
10831
|
shape: shape
|
|
10784
10832
|
};
|
|
10785
|
-
let cache$1, box$
|
|
10833
|
+
let cache$1, box$2 = new Bounds;
|
|
10786
10834
|
const {isSame: isSame} = BoundsHelper;
|
|
10787
10835
|
function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
10788
10836
|
let leafPaint, event;
|
|
10789
|
-
const image = ImageManager.get(paint);
|
|
10837
|
+
const image = ImageManager.get(paint, paint.type);
|
|
10790
10838
|
if (cache$1 && paint === cache$1.paint && isSame(boxBounds, cache$1.boxBounds)) {
|
|
10791
10839
|
leafPaint = cache$1.leafPaint;
|
|
10792
10840
|
} else {
|
|
@@ -10798,7 +10846,7 @@ var LeaferUI = function(exports) {
|
|
|
10798
10846
|
cache$1 = image.use > 1 ? {
|
|
10799
10847
|
leafPaint: leafPaint,
|
|
10800
10848
|
paint: paint,
|
|
10801
|
-
boxBounds: box$
|
|
10849
|
+
boxBounds: box$2.set(boxBounds)
|
|
10802
10850
|
} : null;
|
|
10803
10851
|
}
|
|
10804
10852
|
if (firstUse || image.loading) event = {
|
|
@@ -10846,8 +10894,8 @@ var LeaferUI = function(exports) {
|
|
|
10846
10894
|
return leafPaint;
|
|
10847
10895
|
}
|
|
10848
10896
|
function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
|
|
10849
|
-
|
|
10850
|
-
|
|
10897
|
+
const data = ui.__;
|
|
10898
|
+
if (attrName === "fill" && !data.__naturalWidth) {
|
|
10851
10899
|
data.__naturalWidth = image.width / data.pixelRatio;
|
|
10852
10900
|
data.__naturalHeight = image.height / data.pixelRatio;
|
|
10853
10901
|
if (data.__autoSide) {
|
|
@@ -10859,7 +10907,12 @@ var LeaferUI = function(exports) {
|
|
|
10859
10907
|
return false;
|
|
10860
10908
|
}
|
|
10861
10909
|
}
|
|
10862
|
-
if (!leafPaint.data)
|
|
10910
|
+
if (!leafPaint.data) {
|
|
10911
|
+
PaintImage.createData(leafPaint, image, paint, boxBounds);
|
|
10912
|
+
const {transform: transform} = leafPaint.data, {opacity: opacity, blendMode: blendMode} = paint;
|
|
10913
|
+
const clip = transform && !transform.onlyScale || data.path || data.cornerRadius;
|
|
10914
|
+
if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
|
|
10915
|
+
}
|
|
10863
10916
|
return true;
|
|
10864
10917
|
}
|
|
10865
10918
|
function onLoad(ui, event) {
|
|
@@ -10891,7 +10944,7 @@ var LeaferUI = function(exports) {
|
|
|
10891
10944
|
if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
|
|
10892
10945
|
if (paint.mode === "strench") paint.mode = "stretch";
|
|
10893
10946
|
const {width: width, height: height} = image;
|
|
10894
|
-
const {
|
|
10947
|
+
const {mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, interlace: interlace} = paint;
|
|
10895
10948
|
const sameBox = box.width === width && box.height === height;
|
|
10896
10949
|
const data = {
|
|
10897
10950
|
mode: mode
|
|
@@ -10954,8 +11007,6 @@ var LeaferUI = function(exports) {
|
|
|
10954
11007
|
data.scaleX = scaleX;
|
|
10955
11008
|
data.scaleY = scaleY;
|
|
10956
11009
|
}
|
|
10957
|
-
if (opacity && opacity < 1) data.opacity = opacity;
|
|
10958
|
-
if (filters) data.filters = filters;
|
|
10959
11010
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
10960
11011
|
if (interlace) data.interlace = isNumber(interlace) || interlace.type === "percent" ? {
|
|
10961
11012
|
type: "x",
|
|
@@ -10981,7 +11032,7 @@ var LeaferUI = function(exports) {
|
|
|
10981
11032
|
const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate$2, skew: skewHelper} = MatrixHelper;
|
|
10982
11033
|
function stretchMode(data, box, scaleX, scaleY) {
|
|
10983
11034
|
const transform = get$2(), {x: x, y: y} = box;
|
|
10984
|
-
if (x || y) translate(transform, x, y); else transform.onlyScale = true;
|
|
11035
|
+
if (x || y) translate(transform, x, y); else if (scaleX > 0 && scaleY > 0) transform.onlyScale = true;
|
|
10985
11036
|
scaleHelper(transform, scaleX, scaleY);
|
|
10986
11037
|
data.transform = transform;
|
|
10987
11038
|
}
|
|
@@ -11062,10 +11113,10 @@ var LeaferUI = function(exports) {
|
|
|
11062
11113
|
}
|
|
11063
11114
|
}
|
|
11064
11115
|
function createPattern(paint, ui, canvas, renderOptions) {
|
|
11065
|
-
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = scaleX + "-" + scaleY;
|
|
11116
|
+
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
11066
11117
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
11067
11118
|
if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
|
|
11068
|
-
const {image: image, data: data} = paint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
11119
|
+
const {image: image, data: data} = paint, {opacity: opacity, filters: filters} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
11069
11120
|
let imageMatrix, xGap, yGap, {width: width, height: height} = image;
|
|
11070
11121
|
if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
|
|
11071
11122
|
width *= scaleX;
|
|
@@ -11081,7 +11132,7 @@ var LeaferUI = function(exports) {
|
|
|
11081
11132
|
if (transform) copy$4(imageMatrix, transform);
|
|
11082
11133
|
scale$1(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
11083
11134
|
}
|
|
11084
|
-
const imageCanvas = image.getCanvas(width, height,
|
|
11135
|
+
const imageCanvas = image.getCanvas(width, height, opacity, filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
11085
11136
|
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
11086
11137
|
paint.style = pattern;
|
|
11087
11138
|
paint.patternId = id;
|
|
@@ -11100,15 +11151,15 @@ var LeaferUI = function(exports) {
|
|
|
11100
11151
|
return fixScale;
|
|
11101
11152
|
}
|
|
11102
11153
|
function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
11103
|
-
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
|
|
11154
|
+
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
11104
11155
|
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting, snapshot: snapshot} = renderOptions;
|
|
11105
|
-
if (!data || paint.patternId ===
|
|
11156
|
+
if (!data || paint.patternId === id && !exporting || snapshot) {
|
|
11106
11157
|
return false;
|
|
11107
11158
|
} else {
|
|
11108
11159
|
if (drawImage) {
|
|
11109
11160
|
if (data.repeat) {
|
|
11110
11161
|
drawImage = false;
|
|
11111
|
-
} else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
11162
|
+
} else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
11112
11163
|
drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
|
|
11113
11164
|
}
|
|
11114
11165
|
}
|
|
@@ -11125,20 +11176,21 @@ var LeaferUI = function(exports) {
|
|
|
11125
11176
|
}
|
|
11126
11177
|
}
|
|
11127
11178
|
}
|
|
11128
|
-
function drawImage(paint,
|
|
11129
|
-
const {data: data, image: image
|
|
11130
|
-
let {width: width, height: height} = image
|
|
11131
|
-
if (
|
|
11179
|
+
function drawImage(paint, imageScaleX, imageScaleY, ui, canvas, _renderOptions) {
|
|
11180
|
+
const {data: data, image: image, complex: complex} = paint;
|
|
11181
|
+
let {width: width, height: height} = image;
|
|
11182
|
+
if (complex) {
|
|
11183
|
+
const {blendMode: blendMode, opacity: opacity} = paint.originPaint, {transform: transform} = data;
|
|
11132
11184
|
canvas.save();
|
|
11133
|
-
|
|
11185
|
+
complex === 2 && canvas.clipUI(ui);
|
|
11134
11186
|
blendMode && (canvas.blendMode = blendMode);
|
|
11135
11187
|
opacity && (canvas.opacity *= opacity);
|
|
11136
11188
|
transform && canvas.transform(transform);
|
|
11137
|
-
|
|
11189
|
+
image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
|
|
11138
11190
|
canvas.restore();
|
|
11139
11191
|
} else {
|
|
11140
11192
|
if (data.scaleX) width *= data.scaleX, height *= data.scaleY;
|
|
11141
|
-
|
|
11193
|
+
image.render(canvas, 0, 0, width, height, ui, paint, imageScaleX, imageScaleY);
|
|
11142
11194
|
}
|
|
11143
11195
|
}
|
|
11144
11196
|
function getImageRenderScaleData(paint, ui, canvas, _renderOptions) {
|
|
@@ -11283,7 +11335,7 @@ var LeaferUI = function(exports) {
|
|
|
11283
11335
|
getTransform: getTransform
|
|
11284
11336
|
};
|
|
11285
11337
|
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$5} = Math;
|
|
11286
|
-
const tempBounds = {}, tempMatrix = new Matrix;
|
|
11338
|
+
const tempBounds$1 = {}, tempMatrix = new Matrix;
|
|
11287
11339
|
const offsetOutBounds$1 = {};
|
|
11288
11340
|
function shadow$1(ui, current, shape) {
|
|
11289
11341
|
let copyBounds, transform;
|
|
@@ -11345,9 +11397,9 @@ var LeaferUI = function(exports) {
|
|
|
11345
11397
|
const {shapeBounds: shapeBounds} = shape;
|
|
11346
11398
|
let from, to;
|
|
11347
11399
|
if (Platform.fullImageShadow) {
|
|
11348
|
-
copy$3(tempBounds, canvas.bounds);
|
|
11349
|
-
move$6(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
11350
|
-
from = canvas.bounds, to = tempBounds;
|
|
11400
|
+
copy$3(tempBounds$1, canvas.bounds);
|
|
11401
|
+
move$6(tempBounds$1, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
11402
|
+
from = canvas.bounds, to = tempBounds$1;
|
|
11351
11403
|
} else {
|
|
11352
11404
|
from = shapeBounds, to = outBounds;
|
|
11353
11405
|
}
|
|
@@ -11774,7 +11826,7 @@ var LeaferUI = function(exports) {
|
|
|
11774
11826
|
let {x: x, y: y, width: width, height: height} = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
11775
11827
|
let starY = __baseLine;
|
|
11776
11828
|
if (__clipText && realHeight > height) {
|
|
11777
|
-
realHeight = Math.max(height, __lineHeight);
|
|
11829
|
+
realHeight = Math.max(style.__autoHeight ? realHeight : height, __lineHeight);
|
|
11778
11830
|
if (countRows > 1) drawData.overflow = countRows;
|
|
11779
11831
|
} else if (height || autoSizeAlign) {
|
|
11780
11832
|
switch (verticalAlign) {
|
|
@@ -11830,10 +11882,10 @@ var LeaferUI = function(exports) {
|
|
|
11830
11882
|
bounds.height = realHeight;
|
|
11831
11883
|
}
|
|
11832
11884
|
function clipText(drawData, style, x, width) {
|
|
11833
|
-
if (!width) return;
|
|
11834
11885
|
const {rows: rows, overflow: overflow} = drawData;
|
|
11835
11886
|
let {textOverflow: textOverflow} = style;
|
|
11836
|
-
rows.splice(overflow);
|
|
11887
|
+
if (overflow) rows.splice(overflow);
|
|
11888
|
+
if (!width) return;
|
|
11837
11889
|
if (textOverflow && textOverflow !== "show") {
|
|
11838
11890
|
if (textOverflow === "hide") textOverflow = ""; else if (textOverflow === "ellipsis") textOverflow = "...";
|
|
11839
11891
|
let char, charRight;
|
|
@@ -12119,8 +12171,13 @@ var LeaferUI = function(exports) {
|
|
|
12119
12171
|
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
12120
12172
|
}
|
|
12121
12173
|
data.strokeWidth = strokeWidth / Math.max(aScaleX, aScaleY);
|
|
12174
|
+
if (data.shadow) {
|
|
12175
|
+
const shadow = data.shadow[0], {scaleX: scaleX, scaleY: scaleY} = this.getRenderScaleData(true, shadow.scaleFixed);
|
|
12176
|
+
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
12177
|
+
}
|
|
12122
12178
|
if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas, options) : Paint.strokes(stroke, this, canvas, options);
|
|
12123
12179
|
if (fill) isString(fill) ? Paint.fill(fill, this, canvas, options) : Paint.fills(fill, this, canvas, options);
|
|
12180
|
+
if (data.shadow) canvas.restore();
|
|
12124
12181
|
}
|
|
12125
12182
|
}
|
|
12126
12183
|
data.strokeWidth = strokeWidth;
|
|
@@ -12292,6 +12349,7 @@ var LeaferUI = function(exports) {
|
|
|
12292
12349
|
} else {
|
|
12293
12350
|
editor.target = find;
|
|
12294
12351
|
}
|
|
12352
|
+
e.path.needUpdate = true;
|
|
12295
12353
|
} else if (this.allow(e.target)) {
|
|
12296
12354
|
if (!this.isHoldMultipleSelectKey(e) && !this.editor.mergedConfig.selectKeep) editor.target = null;
|
|
12297
12355
|
}
|
|
@@ -13259,7 +13317,7 @@ var LeaferUI = function(exports) {
|
|
|
13259
13317
|
const resizeSVG = `\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${filterStyle$1}\n</filter>\n</defs>\n</svg>\n`;
|
|
13260
13318
|
const rotateSVG = `\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(135,12,12),rotate({{rotation}},12,12)">\n<path d="M20.4 8H21.4L20.8 7.1L17.3 2.6L17 2.1L16.6 2.6L13.1 7.1L12.5 8H13.5H15.4C14.9 11.8 11.8 14.9 8 15.4V13.5V12.5L7.1 13.1L2.6 16.6L2.1 17L2.6 17.3L7.1 20.8L8 21.4V20.4V18.4C13.5 17.9 17.9 13.5 18.4 8H20.4Z" stroke="white"/>\n<path fill-rule="evenodd" d="M17 3L20.4 7.5H17.9C17.7 13.1 13.1 17.7 7.5 17.9V20.4L3 17L7.5 13.5V15.9C12.0 15.7 15.7 12.0 15.9 7.5H13.5L17 3Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="-0.6" width="27.1" height="27.1" filterUnits="userSpaceOnUse">\n${filterStyle$1}\n</filter>\n</defs>\n</svg>\n`;
|
|
13261
13319
|
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`;
|
|
13262
|
-
const config = {
|
|
13320
|
+
const config$1 = {
|
|
13263
13321
|
editSize: "size",
|
|
13264
13322
|
keyEvent: true,
|
|
13265
13323
|
stroke: "#836DFF",
|
|
@@ -13464,6 +13522,7 @@ var LeaferUI = function(exports) {
|
|
|
13464
13522
|
this.checkChange = true;
|
|
13465
13523
|
this.canChange = true;
|
|
13466
13524
|
this.visible = this.hittable = false;
|
|
13525
|
+
this.skipJSON = true;
|
|
13467
13526
|
this.on(PropertyEvent.CHANGE, event => {
|
|
13468
13527
|
if (this.checkChange && checkMap[event.attrName]) {
|
|
13469
13528
|
const {attrName: attrName, newValue: newValue, oldValue: oldValue} = event;
|
|
@@ -13861,7 +13920,7 @@ var LeaferUI = function(exports) {
|
|
|
13861
13920
|
this.selector = new EditSelect(this);
|
|
13862
13921
|
this.editMask = new EditMask(this);
|
|
13863
13922
|
this.targetEventIds = [];
|
|
13864
|
-
let mergedConfig = DataHelper.clone(config);
|
|
13923
|
+
let mergedConfig = DataHelper.clone(config$1);
|
|
13865
13924
|
if (userConfig) mergedConfig = DataHelper.default(userConfig, mergedConfig);
|
|
13866
13925
|
this.mergedConfig = this.config = mergedConfig;
|
|
13867
13926
|
this.addMany(this.editMask, this.selector, this.editBox);
|
|
@@ -14138,7 +14197,10 @@ var LeaferUI = function(exports) {
|
|
|
14138
14197
|
return "focus";
|
|
14139
14198
|
}
|
|
14140
14199
|
get editBox() {
|
|
14141
|
-
return this.editor.editBox;
|
|
14200
|
+
return this._editBox || this.editor.editBox;
|
|
14201
|
+
}
|
|
14202
|
+
set editBox(value) {
|
|
14203
|
+
this._editBox = value;
|
|
14142
14204
|
}
|
|
14143
14205
|
constructor(editor) {
|
|
14144
14206
|
this.eventIds = [];
|
|
@@ -14324,7 +14386,7 @@ var LeaferUI = function(exports) {
|
|
|
14324
14386
|
onSkew(_e) {}
|
|
14325
14387
|
onUpdate() {
|
|
14326
14388
|
const {editBox: editBox} = this, {rotatePoints: rotatePoints, resizeLines: resizeLines, resizePoints: resizePoints, rect: rect} = editBox;
|
|
14327
|
-
const line =
|
|
14389
|
+
const line = editBox.target;
|
|
14328
14390
|
let fromTo, leftOrRight;
|
|
14329
14391
|
if (line.pathInputed) fromTo = this.getFromToByPath(line.__.path); else if (line.points) fromTo = this.getFromToByPoints(line.__.points);
|
|
14330
14392
|
if (fromTo) {
|
|
@@ -14636,6 +14698,8 @@ var LeaferUI = function(exports) {
|
|
|
14636
14698
|
break;
|
|
14637
14699
|
|
|
14638
14700
|
case "image":
|
|
14701
|
+
case "film":
|
|
14702
|
+
case "video":
|
|
14639
14703
|
break;
|
|
14640
14704
|
|
|
14641
14705
|
case "linear":
|
|
@@ -14849,9 +14913,14 @@ var LeaferUI = function(exports) {
|
|
|
14849
14913
|
}), leafer.on_(exports.MoveEvent.END, e => {
|
|
14850
14914
|
LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
|
|
14851
14915
|
}), leafer.on_(exports.ZoomEvent.BEFORE_ZOOM, e => {
|
|
14852
|
-
const {zoomLayer: zoomLayer} = leafer;
|
|
14916
|
+
const {zoomLayer: zoomLayer, layouter: layouter} = leafer;
|
|
14853
14917
|
const changeScale = leafer.getValidScale(e.scale);
|
|
14854
|
-
if (changeScale !== 1)
|
|
14918
|
+
if (changeScale !== 1) {
|
|
14919
|
+
layouter.stop();
|
|
14920
|
+
LeafHelper.updateMatrix(leafer);
|
|
14921
|
+
zoomLayer.scaleOfWorld(e, changeScale);
|
|
14922
|
+
layouter.start();
|
|
14923
|
+
}
|
|
14855
14924
|
}));
|
|
14856
14925
|
}
|
|
14857
14926
|
function addViewportConfig(leafer, mergeConfig) {
|
|
@@ -16433,7 +16502,7 @@ var LeaferUI = function(exports) {
|
|
|
16433
16502
|
}));
|
|
16434
16503
|
}
|
|
16435
16504
|
Plugin.add("flow", "resize");
|
|
16436
|
-
const box = exports.Box.prototype, {__updateBoxBounds: __updateBoxBounds} = exports.Group.prototype;
|
|
16505
|
+
const box$1 = exports.Box.prototype, {__updateBoxBounds: __updateBoxBounds} = exports.Group.prototype;
|
|
16437
16506
|
exports.UI.addAttr("flow", false, autoLayoutType);
|
|
16438
16507
|
exports.UI.addAttr("gap", 0, boundsType);
|
|
16439
16508
|
exports.UI.addAttr("flowAlign", "top-left", boundsType);
|
|
@@ -16444,7 +16513,7 @@ var LeaferUI = function(exports) {
|
|
|
16444
16513
|
exports.UI.addAttr("autoHeight", undefined, autoBoundsType);
|
|
16445
16514
|
exports.UI.addAttr("autoBox", undefined, boundsType);
|
|
16446
16515
|
const {copyAndSpread: copyAndSpread} = BoundsHelper;
|
|
16447
|
-
box.__updateFlowLayout = function() {
|
|
16516
|
+
box$1.__updateFlowLayout = function() {
|
|
16448
16517
|
const {leaferIsCreated: leaferIsCreated, flow: flow} = this;
|
|
16449
16518
|
if (leaferIsCreated) this.leafer.created = false;
|
|
16450
16519
|
switch (flow) {
|
|
@@ -16467,7 +16536,7 @@ var LeaferUI = function(exports) {
|
|
|
16467
16536
|
}
|
|
16468
16537
|
if (leaferIsCreated) this.leafer.created = true;
|
|
16469
16538
|
};
|
|
16470
|
-
box.__updateContentBounds = function() {
|
|
16539
|
+
box$1.__updateContentBounds = function() {
|
|
16471
16540
|
const {padding: padding} = this.__;
|
|
16472
16541
|
const layout = this.__layout;
|
|
16473
16542
|
const same = layout.contentBounds === layout.boxBounds;
|
|
@@ -16478,7 +16547,7 @@ var LeaferUI = function(exports) {
|
|
|
16478
16547
|
if (!same) layout.shrinkContentCancel();
|
|
16479
16548
|
}
|
|
16480
16549
|
};
|
|
16481
|
-
box.__updateBoxBounds = function(secondLayout) {
|
|
16550
|
+
box$1.__updateBoxBounds = function(secondLayout) {
|
|
16482
16551
|
if (this.children.length && !this.pathInputed) {
|
|
16483
16552
|
const data = this.__, {flow: flow} = data;
|
|
16484
16553
|
if (data.__autoSide) {
|
|
@@ -17232,7 +17301,7 @@ var LeaferUI = function(exports) {
|
|
|
17232
17301
|
const rgbaMatch = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i;
|
|
17233
17302
|
const hslMatch = /^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i;
|
|
17234
17303
|
const hslaMatch = /^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i;
|
|
17235
|
-
const int = parseInt, float$
|
|
17304
|
+
const int = parseInt, float$2 = parseFloat, {round: round$1} = Math;
|
|
17236
17305
|
let cache = {}, totalCache = 0;
|
|
17237
17306
|
function colorToRGBA(color, opacity) {
|
|
17238
17307
|
let RGBA;
|
|
@@ -17340,16 +17409,16 @@ var LeaferUI = function(exports) {
|
|
|
17340
17409
|
r: int(match[1]),
|
|
17341
17410
|
g: int(match[2]),
|
|
17342
17411
|
b: int(match[3]),
|
|
17343
|
-
a: float$
|
|
17412
|
+
a: float$2(match[4])
|
|
17344
17413
|
};
|
|
17345
17414
|
}
|
|
17346
17415
|
function hslToRGBA(color) {
|
|
17347
17416
|
const match = hslMatch.exec(color);
|
|
17348
|
-
return hsla(float$
|
|
17417
|
+
return hsla(float$2(match[1]), float$2(match[2]), float$2(match[3]), 1);
|
|
17349
17418
|
}
|
|
17350
17419
|
function hslaToRGBA(color) {
|
|
17351
17420
|
const match = hslaMatch.exec(color);
|
|
17352
|
-
return hsla(float$
|
|
17421
|
+
return hsla(float$2(match[1]), float$2(match[2]), float$2(match[3]), float$2(match[4]));
|
|
17353
17422
|
}
|
|
17354
17423
|
const n1 = 1 / 6, n2 = .5, n3 = 2 / 3, n4 = 1 / 3;
|
|
17355
17424
|
function hue(p, q, t) {
|
|
@@ -17552,7 +17621,7 @@ var LeaferUI = function(exports) {
|
|
|
17552
17621
|
}
|
|
17553
17622
|
};
|
|
17554
17623
|
const {getDistance: getDistance} = HighBezierHelper;
|
|
17555
|
-
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper;
|
|
17624
|
+
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float$1} = MathHelper;
|
|
17556
17625
|
const tempPoint = {}, tempFrom = {};
|
|
17557
17626
|
const HighCurveHelper = {
|
|
17558
17627
|
transform(data, matrix) {
|
|
@@ -17705,7 +17774,7 @@ var LeaferUI = function(exports) {
|
|
|
17705
17774
|
tempFrom.y = y;
|
|
17706
17775
|
to.x = toX;
|
|
17707
17776
|
to.y = toY;
|
|
17708
|
-
cutDistance = float(motionDistance - total);
|
|
17777
|
+
cutDistance = float$1(motionDistance - total);
|
|
17709
17778
|
if (cutDistance) {
|
|
17710
17779
|
PointHelper.getDistancePoint(tempFrom, to, cutDistance, true);
|
|
17711
17780
|
path.push(command, to.x, to.y);
|
|
@@ -17724,7 +17793,7 @@ var LeaferUI = function(exports) {
|
|
|
17724
17793
|
toY = data[i + 6];
|
|
17725
17794
|
distance = segments[index];
|
|
17726
17795
|
if (total + distance > motionDistance) {
|
|
17727
|
-
cutDistance = float(motionDistance - total);
|
|
17796
|
+
cutDistance = float$1(motionDistance - total);
|
|
17728
17797
|
if (cutDistance) {
|
|
17729
17798
|
t = HighBezierHelper.getT(cutDistance, distance, x, y, x1, y1, x2, y2, toX, toY, motionPrecision);
|
|
17730
17799
|
HighBezierHelper.cut(path, t, x, y, x1, y1, x2, y2, toX, toY);
|
|
@@ -17917,21 +17986,21 @@ var LeaferUI = function(exports) {
|
|
|
17917
17986
|
const style = {}, button = findParentButton(leaf);
|
|
17918
17987
|
const state = button ? leaf.state || button.state : leaf.state;
|
|
17919
17988
|
const stateStyle = state && leaf.states[state];
|
|
17920
|
-
if (stateStyle && State.isState(state, leaf, button)) exist = assign(style, stateStyle);
|
|
17989
|
+
if (stateStyle && State.isState(state, leaf, button)) exist = assign$1(style, stateStyle);
|
|
17921
17990
|
const selectedStyle = style.selectedStyle || leaf.selectedStyle;
|
|
17922
|
-
if (selectedStyle && State.isSelected(leaf, button)) exist = assign(style, selectedStyle);
|
|
17991
|
+
if (selectedStyle && State.isSelected(leaf, button)) exist = assign$1(style, selectedStyle);
|
|
17923
17992
|
const placeholderStyle = style.placeholderStyle || leaf.placeholderStyle;
|
|
17924
|
-
if (placeholderStyle && State.isPlacehold(leaf, button)) exist = assign(style, placeholderStyle);
|
|
17993
|
+
if (placeholderStyle && State.isPlacehold(leaf, button)) exist = assign$1(style, placeholderStyle);
|
|
17925
17994
|
if (State.isDisabled(leaf, button)) {
|
|
17926
17995
|
const disabledStyle = style.disabledStyle || leaf.disabledStyle;
|
|
17927
|
-
if (disabledStyle) exist = assign(style, disabledStyle);
|
|
17996
|
+
if (disabledStyle) exist = assign$1(style, disabledStyle);
|
|
17928
17997
|
} else {
|
|
17929
17998
|
const focusStyle = style.focusStyle || leaf.focusStyle;
|
|
17930
|
-
if (focusStyle && State.isFocus(leaf, button)) exist = assign(style, focusStyle);
|
|
17999
|
+
if (focusStyle && State.isFocus(leaf, button)) exist = assign$1(style, focusStyle);
|
|
17931
18000
|
const hoverStyle = style.hoverStyle || leaf.hoverStyle;
|
|
17932
|
-
if (hoverStyle && State.isHover(leaf, button)) exist = assign(style, hoverStyle);
|
|
18001
|
+
if (hoverStyle && State.isHover(leaf, button)) exist = assign$1(style, hoverStyle);
|
|
17933
18002
|
const pressStyle = style.pressStyle || leaf.pressStyle;
|
|
17934
|
-
if (pressStyle && State.isPress(leaf, button)) exist = assign(style, pressStyle);
|
|
18003
|
+
if (pressStyle && State.isPress(leaf, button)) exist = assign$1(style, pressStyle);
|
|
17935
18004
|
}
|
|
17936
18005
|
return exist ? style : undefined;
|
|
17937
18006
|
}
|
|
@@ -17957,7 +18026,7 @@ var LeaferUI = function(exports) {
|
|
|
17957
18026
|
if (type === "out" && isNull(data[name]) && isNull(style[name])) name = "transition";
|
|
17958
18027
|
return isNull(style[name]) ? data[name] : style[name];
|
|
17959
18028
|
}
|
|
17960
|
-
function assign(style, stateStyle) {
|
|
18029
|
+
function assign$1(style, stateStyle) {
|
|
17961
18030
|
Object.assign(style, stateStyle);
|
|
17962
18031
|
return true;
|
|
17963
18032
|
}
|
|
@@ -18182,6 +18251,9 @@ var LeaferUI = function(exports) {
|
|
|
18182
18251
|
constructor(data) {
|
|
18183
18252
|
super(data);
|
|
18184
18253
|
}
|
|
18254
|
+
togglePlay() {
|
|
18255
|
+
this.running ? this.pause() : this.play();
|
|
18256
|
+
}
|
|
18185
18257
|
play() {
|
|
18186
18258
|
this.running = true;
|
|
18187
18259
|
}
|
|
@@ -18694,6 +18766,248 @@ var LeaferUI = function(exports) {
|
|
|
18694
18766
|
});
|
|
18695
18767
|
Plugin.add("bright");
|
|
18696
18768
|
exports.UI.addAttr("bright", false, dimType);
|
|
18769
|
+
const config = {
|
|
18770
|
+
theme: "light",
|
|
18771
|
+
style: {
|
|
18772
|
+
dragBoundsType: "outer",
|
|
18773
|
+
strokeAlign: "center",
|
|
18774
|
+
strokeWidthFixed: "zoom-in",
|
|
18775
|
+
width: 6,
|
|
18776
|
+
height: 6,
|
|
18777
|
+
opacity: .5,
|
|
18778
|
+
cornerRadius: 3,
|
|
18779
|
+
hoverStyle: {
|
|
18780
|
+
opacity: .6
|
|
18781
|
+
},
|
|
18782
|
+
pressStyle: {
|
|
18783
|
+
opacity: .66
|
|
18784
|
+
}
|
|
18785
|
+
},
|
|
18786
|
+
size: 6,
|
|
18787
|
+
endsMargin: 2,
|
|
18788
|
+
sideMargin: 2,
|
|
18789
|
+
minSize: 10,
|
|
18790
|
+
scaleFixed: "zoom-in",
|
|
18791
|
+
scrollType: "both",
|
|
18792
|
+
hideOnActionEnd: "hover"
|
|
18793
|
+
};
|
|
18794
|
+
const tempBounds = new Bounds, {float: float} = MathHelper, {clone: clone, assign: assign} = DataHelper;
|
|
18795
|
+
class Scroller extends exports.Group {
|
|
18796
|
+
get canUse() {
|
|
18797
|
+
return this.target.hasScroller;
|
|
18798
|
+
}
|
|
18799
|
+
constructor(target) {
|
|
18800
|
+
super();
|
|
18801
|
+
this.targetWorldBounds = new Bounds;
|
|
18802
|
+
this.viewportBounds = new Bounds;
|
|
18803
|
+
this.contentBounds = new Bounds;
|
|
18804
|
+
this.scrollXBounds = new Bounds;
|
|
18805
|
+
this.scrollYBounds = new Bounds;
|
|
18806
|
+
this.target = target;
|
|
18807
|
+
this.config = clone(config);
|
|
18808
|
+
this.updateConfig();
|
|
18809
|
+
this.__listenEvents();
|
|
18810
|
+
target.waitLeafer(() => {
|
|
18811
|
+
this.parent = target;
|
|
18812
|
+
this.__bindLeafer(target.leafer);
|
|
18813
|
+
});
|
|
18814
|
+
if (this.mergedConfig.hideOnActionEnd) this.opacity = 0;
|
|
18815
|
+
}
|
|
18816
|
+
static registerTheme(theme, themeConfig) {
|
|
18817
|
+
S.themeMap[theme] = themeConfig;
|
|
18818
|
+
}
|
|
18819
|
+
static getTheme(theme) {
|
|
18820
|
+
return theme && S.themeMap[theme];
|
|
18821
|
+
}
|
|
18822
|
+
static hasTheme(theme) {
|
|
18823
|
+
return theme && !!S.themeMap[theme];
|
|
18824
|
+
}
|
|
18825
|
+
updateConfig() {
|
|
18826
|
+
const {scrollConfig: scrollConfig} = this.target;
|
|
18827
|
+
const themeConfig = S.getTheme(scrollConfig && S.hasTheme(scrollConfig.theme) && scrollConfig.theme || this.config.theme);
|
|
18828
|
+
const mergedConfig = this.mergedConfig = clone(this.config);
|
|
18829
|
+
assign(mergedConfig, themeConfig);
|
|
18830
|
+
if (scrollConfig) assign(mergedConfig, scrollConfig);
|
|
18831
|
+
this.updateStyle(mergedConfig.style);
|
|
18832
|
+
}
|
|
18833
|
+
updateStyle(style) {
|
|
18834
|
+
if (!this.scrollXBar) this.addMany(this.scrollXBar = new exports.Box, this.scrollYBar = new exports.Box);
|
|
18835
|
+
const {scrollXBar: scrollXBar, scrollYBar: scrollYBar} = this;
|
|
18836
|
+
scrollXBar.set(style);
|
|
18837
|
+
scrollYBar.set(style);
|
|
18838
|
+
scrollXBar.draggable = "x";
|
|
18839
|
+
scrollYBar.draggable = "y";
|
|
18840
|
+
}
|
|
18841
|
+
update(check = true) {
|
|
18842
|
+
if (this.dragScrolling) return;
|
|
18843
|
+
const {target: target, targetOverflow: targetOverflow, targetWorldBounds: targetWorldBounds, viewportBounds: viewportBounds, contentBounds: contentBounds} = this, layout = target.__layout, {overflow: overflow} = target.__;
|
|
18844
|
+
const {childrenRenderBounds: childrenRenderBounds} = layout;
|
|
18845
|
+
const {boxBounds: boxBounds, worldBoxBounds: worldBoxBounds} = layout;
|
|
18846
|
+
const isSameWorldBounds = check && targetOverflow === overflow && targetWorldBounds.isSame(worldBoxBounds);
|
|
18847
|
+
const isSameConfig = layout.scrollConfigChanged ? (this.updateConfig(), layout.scrollConfigChanged = false) : true;
|
|
18848
|
+
const nowContentBounds = tempBounds.set(viewportBounds).add(childrenRenderBounds);
|
|
18849
|
+
if (isSameWorldBounds && isSameConfig && contentBounds.isSame(nowContentBounds)) return;
|
|
18850
|
+
this.targetOverflow = overflow;
|
|
18851
|
+
viewportBounds.set(boxBounds);
|
|
18852
|
+
targetWorldBounds.set(worldBoxBounds);
|
|
18853
|
+
contentBounds.set(nowContentBounds);
|
|
18854
|
+
const {scrollXBar: scrollXBar, scrollYBar: scrollYBar} = this, {size: size, endsMargin: endsMargin, minSize: minSize} = this.mergedConfig, {width: width, height: height} = viewportBounds;
|
|
18855
|
+
this.contentRealX = contentBounds.x - target.scrollX;
|
|
18856
|
+
this.contentRealY = contentBounds.y - target.scrollY;
|
|
18857
|
+
this.ratioX = viewportBounds.width / contentBounds.width;
|
|
18858
|
+
this.ratioY = viewportBounds.height / contentBounds.height;
|
|
18859
|
+
const min = size + endsMargin * 2 + minSize;
|
|
18860
|
+
scrollXBar.visible = float(contentBounds.width) > float(width) && overflow !== "y-scroll" && width > min;
|
|
18861
|
+
scrollYBar.visible = float(contentBounds.height) > float(height) && overflow !== "x-scroll" && height > min;
|
|
18862
|
+
this.updateScrollBar();
|
|
18863
|
+
}
|
|
18864
|
+
updateScrollBar() {
|
|
18865
|
+
const {target: target, viewportBounds: viewportBounds, contentBounds: contentBounds, ratioX: ratioX, ratioY: ratioY, scrollXBar: scrollXBar, scrollYBar: scrollYBar, scrollXBounds: scrollXBounds, scrollYBounds: scrollYBounds} = this;
|
|
18866
|
+
let {size: size, cornerRadius: cornerRadius, endsMargin: endsMargin, sideMargin: sideMargin, minSize: minSize, scaleFixed: scaleFixed, scrollType: scrollType} = this.mergedConfig;
|
|
18867
|
+
const scale = scaleFixed ? target.getClampRenderScale() : 1;
|
|
18868
|
+
endsMargin /= scale;
|
|
18869
|
+
sideMargin /= scale;
|
|
18870
|
+
size /= scale;
|
|
18871
|
+
if (isUndefined(cornerRadius)) cornerRadius = size / 2;
|
|
18872
|
+
if (scrollXBar.visible) {
|
|
18873
|
+
scrollXBounds.set(viewportBounds).shrink([ endsMargin, scrollYBar.visible ? size + sideMargin : endsMargin, sideMargin, endsMargin ]);
|
|
18874
|
+
const scrollRatioX = this.scrollRatioX = scrollXBounds.width / contentBounds.width;
|
|
18875
|
+
scrollXBar.set({
|
|
18876
|
+
x: scrollXBounds.x - contentBounds.x * scrollRatioX,
|
|
18877
|
+
y: scrollXBounds.maxY - size,
|
|
18878
|
+
width: Math.max(scrollXBounds.width * ratioX, minSize),
|
|
18879
|
+
height: size,
|
|
18880
|
+
cornerRadius: cornerRadius,
|
|
18881
|
+
dragBounds: scrollXBounds,
|
|
18882
|
+
hittable: scrollType !== "move"
|
|
18883
|
+
});
|
|
18884
|
+
}
|
|
18885
|
+
if (scrollYBar.visible) {
|
|
18886
|
+
scrollYBounds.set(viewportBounds).shrink([ endsMargin, sideMargin, scrollXBar.visible ? size + sideMargin : endsMargin, endsMargin ]);
|
|
18887
|
+
const scrollRatioY = this.scrollRatioY = scrollYBounds.height / contentBounds.height;
|
|
18888
|
+
scrollYBar.set({
|
|
18889
|
+
x: scrollYBounds.maxX - size,
|
|
18890
|
+
y: scrollYBounds.y - contentBounds.y * scrollRatioY,
|
|
18891
|
+
width: size,
|
|
18892
|
+
height: Math.max(scrollYBounds.height * ratioY, minSize),
|
|
18893
|
+
cornerRadius: cornerRadius,
|
|
18894
|
+
dragBounds: scrollYBounds,
|
|
18895
|
+
hittable: scrollType !== "move"
|
|
18896
|
+
});
|
|
18897
|
+
}
|
|
18898
|
+
this.x = -this.target.scrollX;
|
|
18899
|
+
this.y = -this.target.scrollY;
|
|
18900
|
+
LeafHelper.updateAllMatrix(this);
|
|
18901
|
+
BranchHelper.updateBounds(this);
|
|
18902
|
+
LeafHelper.updateAllChange(this);
|
|
18903
|
+
}
|
|
18904
|
+
onDrag(e) {
|
|
18905
|
+
if (this.mergedConfig.scrollType === "move") return;
|
|
18906
|
+
this.dragScrolling = true;
|
|
18907
|
+
const {scrollXBar: scrollXBar, scrollYBar: scrollYBar, target: target, scrollXBounds: scrollXBounds, scrollYBounds: scrollYBounds} = this;
|
|
18908
|
+
const scrollX = e.current === scrollXBar;
|
|
18909
|
+
if (scrollX) target.scrollX = -((scrollXBar.x - scrollXBounds.x) / this.scrollRatioX + this.contentRealX); else target.scrollY = -((scrollYBar.y - scrollYBounds.y) / this.scrollRatioY + this.contentRealY);
|
|
18910
|
+
}
|
|
18911
|
+
onDragEnd() {
|
|
18912
|
+
if (this.mergedConfig.scrollType === "move") return;
|
|
18913
|
+
this.dragScrolling = false;
|
|
18914
|
+
}
|
|
18915
|
+
onMove(e) {
|
|
18916
|
+
if (!this.canUse) return;
|
|
18917
|
+
this.onEnter();
|
|
18918
|
+
const {scrollType: scrollType, stopDefault: stopDefault} = this.mergedConfig;
|
|
18919
|
+
if (scrollType === "drag") return;
|
|
18920
|
+
const {viewportBounds: viewportBounds, contentBounds: contentBounds, scrollXBar: scrollXBar, scrollYBar: scrollYBar} = this;
|
|
18921
|
+
if (scrollXBar.visible || scrollYBar.visible) {
|
|
18922
|
+
const move = e.getInnerMove(this.target);
|
|
18923
|
+
DragBoundsHelper.getValidMove(contentBounds, viewportBounds, "inner", move, true);
|
|
18924
|
+
let needStop;
|
|
18925
|
+
if (move.x && scrollXBar.visible) this.target.scrollX += move.x, needStop = true;
|
|
18926
|
+
if (move.y && scrollYBar.visible) this.target.scrollY += move.y, needStop = true;
|
|
18927
|
+
if (needStop || stopDefault) e.stop();
|
|
18928
|
+
if (stopDefault) e.stopDefault();
|
|
18929
|
+
}
|
|
18930
|
+
}
|
|
18931
|
+
onMoveEnd(e) {
|
|
18932
|
+
if (!this.canUse) return;
|
|
18933
|
+
if (!this.target.hit(e)) this.onLeave();
|
|
18934
|
+
}
|
|
18935
|
+
onEnter() {
|
|
18936
|
+
if (!this.canUse) return;
|
|
18937
|
+
clearTimeout(this.hideTimer);
|
|
18938
|
+
this.killAnimate();
|
|
18939
|
+
this.opacity = 1;
|
|
18940
|
+
}
|
|
18941
|
+
onLeave() {
|
|
18942
|
+
if (!this.canUse) return;
|
|
18943
|
+
clearTimeout(this.hideTimer);
|
|
18944
|
+
if (this.mergedConfig.hideOnActionEnd) this.hideTimer = setTimeout(() => {
|
|
18945
|
+
this.set({
|
|
18946
|
+
opacity: 0
|
|
18947
|
+
}, Plugin.has("animate"));
|
|
18948
|
+
}, 600);
|
|
18949
|
+
}
|
|
18950
|
+
onResize() {
|
|
18951
|
+
if (this.canUse) this.update();
|
|
18952
|
+
}
|
|
18953
|
+
__listenEvents() {
|
|
18954
|
+
const {scrollXBar: scrollXBar, scrollYBar: scrollYBar, target: target} = this;
|
|
18955
|
+
this.__eventIds = [ scrollXBar.on_(exports.DragEvent.DRAG, this.onDrag, this), scrollXBar.on_(exports.DragEvent.END, this.onDragEnd, this), scrollYBar.on_(exports.DragEvent.DRAG, this.onDrag, this), scrollYBar.on_(exports.DragEvent.END, this.onDragEnd, this), target.on_(exports.PointerEvent.ENTER, this.onEnter, this), target.on_(exports.PointerEvent.LEAVE, this.onLeave, this), target.on_(exports.MoveEvent.BEFORE_MOVE, this.onMove, this), target.on_(exports.MoveEvent.END, this.onMoveEnd, this), target.on_(BoundsEvent.WORLD, this.onResize, this), target.on_(ChildEvent.DESTROY, this.destroy, this) ];
|
|
18956
|
+
}
|
|
18957
|
+
__removeListenEvents() {
|
|
18958
|
+
this.off_(this.__eventIds);
|
|
18959
|
+
}
|
|
18960
|
+
destroy() {
|
|
18961
|
+
if (!this.destroyed) {
|
|
18962
|
+
this.__removeListenEvents();
|
|
18963
|
+
const {target: target} = this;
|
|
18964
|
+
target.scroller = target.topChildren = target.hasScroller = undefined;
|
|
18965
|
+
this.target = this.config = null;
|
|
18966
|
+
super.destroy();
|
|
18967
|
+
}
|
|
18968
|
+
}
|
|
18969
|
+
}
|
|
18970
|
+
Scroller.themeMap = {};
|
|
18971
|
+
const S = Scroller;
|
|
18972
|
+
function scrollConfigType(defaultValue) {
|
|
18973
|
+
return decorateLeafAttr(defaultValue, key => attr({
|
|
18974
|
+
set(value) {
|
|
18975
|
+
if (this.__setAttr(key, value)) {
|
|
18976
|
+
const layout = this.__layout;
|
|
18977
|
+
layout.scrollConfigChanged = true;
|
|
18978
|
+
doBoundsType(this);
|
|
18979
|
+
}
|
|
18980
|
+
}
|
|
18981
|
+
}));
|
|
18982
|
+
}
|
|
18983
|
+
Plugin.add("scroller");
|
|
18984
|
+
const box = exports.Box.prototype;
|
|
18985
|
+
exports.Box.addAttr("scrollConfig", undefined, scrollConfigType);
|
|
18986
|
+
box.__checkScroll = function(isScrollMode) {
|
|
18987
|
+
if (isScrollMode && this.isOverflow) {
|
|
18988
|
+
if (!this.scroller) {
|
|
18989
|
+
this.scroller = new Scroller(this);
|
|
18990
|
+
if (!this.topChildren) this.topChildren = [];
|
|
18991
|
+
this.topChildren.push(this.scroller);
|
|
18992
|
+
}
|
|
18993
|
+
this.hasScroller = true;
|
|
18994
|
+
} else {
|
|
18995
|
+
if (this.hasScroller && !this.scroller.dragScrolling) {
|
|
18996
|
+
this.hasScroller = undefined;
|
|
18997
|
+
this.scroller.update();
|
|
18998
|
+
}
|
|
18999
|
+
}
|
|
19000
|
+
};
|
|
19001
|
+
Scroller.registerTheme("light", {
|
|
19002
|
+
style: {
|
|
19003
|
+
fill: "black"
|
|
19004
|
+
}
|
|
19005
|
+
});
|
|
19006
|
+
Scroller.registerTheme("dark", {
|
|
19007
|
+
style: {
|
|
19008
|
+
fill: "white"
|
|
19009
|
+
}
|
|
19010
|
+
});
|
|
18697
19011
|
exports.AlignHelper = AlignHelper;
|
|
18698
19012
|
exports.AnimateEasing = AnimateEasing;
|
|
18699
19013
|
exports.AnimateEvent = AnimateEvent;
|
|
@@ -18773,8 +19087,10 @@ var LeaferUI = function(exports) {
|
|
|
18773
19087
|
exports.LeaferCanvasBase = LeaferCanvasBase;
|
|
18774
19088
|
exports.LeaferData = LeaferData;
|
|
18775
19089
|
exports.LeaferEvent = LeaferEvent;
|
|
19090
|
+
exports.LeaferFilm = LeaferFilm;
|
|
18776
19091
|
exports.LeaferImage = LeaferImage;
|
|
18777
19092
|
exports.LeaferTypeCreator = LeaferTypeCreator;
|
|
19093
|
+
exports.LeaferVideo = LeaferVideo;
|
|
18778
19094
|
exports.LineData = LineData;
|
|
18779
19095
|
exports.MathHelper = MathHelper;
|
|
18780
19096
|
exports.Matrix = Matrix;
|
|
@@ -18826,6 +19142,7 @@ var LeaferUI = function(exports) {
|
|
|
18826
19142
|
exports.RobotData = RobotData;
|
|
18827
19143
|
exports.Run = Run;
|
|
18828
19144
|
exports.ScrollBar = ScrollBar;
|
|
19145
|
+
exports.Scroller = Scroller;
|
|
18829
19146
|
exports.SelectArea = SelectArea;
|
|
18830
19147
|
exports.Selector = Selector;
|
|
18831
19148
|
exports.StarData = StarData;
|
|
@@ -18922,7 +19239,7 @@ var LeaferUI = function(exports) {
|
|
|
18922
19239
|
exports.stateType = stateType;
|
|
18923
19240
|
exports.strokeType = strokeType;
|
|
18924
19241
|
exports.surfaceType = surfaceType;
|
|
18925
|
-
exports.tempBounds = tempBounds$
|
|
19242
|
+
exports.tempBounds = tempBounds$3;
|
|
18926
19243
|
exports.tempMatrix = tempMatrix$2;
|
|
18927
19244
|
exports.tempPoint = tempPoint$4;
|
|
18928
19245
|
exports.tryToNumber = tryToNumber;
|