@leafer-ui/miniapp 1.9.4 → 1.9.6
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/miniapp.cjs +41 -20
- package/dist/miniapp.esm.js +42 -21
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +234 -226
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +12 -12
package/dist/miniapp.module.js
CHANGED
|
@@ -136,6 +136,9 @@ class LeafData {
|
|
|
136
136
|
const {path: path} = this;
|
|
137
137
|
return path && path.length === 6 && path[0] === 1;
|
|
138
138
|
}
|
|
139
|
+
get __usePathBox() {
|
|
140
|
+
return this.__pathInputed;
|
|
141
|
+
}
|
|
139
142
|
get __blendMode() {
|
|
140
143
|
if (this.eraser && this.eraser !== "path") return "destination-out";
|
|
141
144
|
const {blendMode: blendMode} = this;
|
|
@@ -369,7 +372,7 @@ function getMatrixData() {
|
|
|
369
372
|
|
|
370
373
|
const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
|
|
371
374
|
|
|
372
|
-
const {float: float$
|
|
375
|
+
const {float: float$2} = MathHelper;
|
|
373
376
|
|
|
374
377
|
const tempPoint$3 = {};
|
|
375
378
|
|
|
@@ -611,12 +614,12 @@ const MatrixHelper = {
|
|
|
611
614
|
const cosR = c / scaleY;
|
|
612
615
|
rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
|
|
613
616
|
}
|
|
614
|
-
const cosR = float$
|
|
617
|
+
const cosR = float$2(cos$5(rotation));
|
|
615
618
|
const sinR = sin$5(rotation);
|
|
616
|
-
scaleX = float$
|
|
617
|
-
skewX = cosR ? float$
|
|
618
|
-
skewY = cosR ? float$
|
|
619
|
-
rotation = float$
|
|
619
|
+
scaleX = float$2(scaleX), scaleY = float$2(scaleY);
|
|
620
|
+
skewX = cosR ? float$2((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
621
|
+
skewY = cosR ? float$2((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
622
|
+
rotation = float$2(rotation / OneRadian);
|
|
620
623
|
} else {
|
|
621
624
|
scaleX = a;
|
|
622
625
|
scaleY = d;
|
|
@@ -1134,13 +1137,13 @@ const AlignHelper = {
|
|
|
1134
1137
|
}
|
|
1135
1138
|
};
|
|
1136
1139
|
|
|
1137
|
-
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$
|
|
1140
|
+
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
1138
1141
|
|
|
1139
1142
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1140
1143
|
|
|
1141
|
-
const {float: float, fourNumber: fourNumber} = MathHelper;
|
|
1144
|
+
const {float: float$1, fourNumber: fourNumber} = MathHelper;
|
|
1142
1145
|
|
|
1143
|
-
const {floor: floor$2, ceil: ceil$
|
|
1146
|
+
const {floor: floor$2, ceil: ceil$2} = Math;
|
|
1144
1147
|
|
|
1145
1148
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
1146
1149
|
|
|
@@ -1269,7 +1272,7 @@ const BoundsHelper = {
|
|
|
1269
1272
|
point.x = t.x;
|
|
1270
1273
|
toOuterPoint$2(matrix, point, toPoint$4);
|
|
1271
1274
|
addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
|
|
1272
|
-
toBounds$
|
|
1275
|
+
toBounds$2(tempPointBounds$1, to);
|
|
1273
1276
|
}
|
|
1274
1277
|
},
|
|
1275
1278
|
toInnerOf(t, matrix, to) {
|
|
@@ -1307,8 +1310,8 @@ const BoundsHelper = {
|
|
|
1307
1310
|
const {x: x, y: y} = t;
|
|
1308
1311
|
t.x = floor$2(t.x);
|
|
1309
1312
|
t.y = floor$2(t.y);
|
|
1310
|
-
t.width = x > t.x ? ceil$
|
|
1311
|
-
t.height = y > t.y ? ceil$
|
|
1313
|
+
t.width = x > t.x ? ceil$2(t.width + x - t.x) : ceil$2(t.width);
|
|
1314
|
+
t.height = y > t.y ? ceil$2(t.height + y - t.y) : ceil$2(t.height);
|
|
1312
1315
|
},
|
|
1313
1316
|
unsign(t) {
|
|
1314
1317
|
if (t.width < 0) {
|
|
@@ -1321,10 +1324,10 @@ const BoundsHelper = {
|
|
|
1321
1324
|
}
|
|
1322
1325
|
},
|
|
1323
1326
|
float(t, maxLength) {
|
|
1324
|
-
t.x = float(t.x, maxLength);
|
|
1325
|
-
t.y = float(t.y, maxLength);
|
|
1326
|
-
t.width = float(t.width, maxLength);
|
|
1327
|
-
t.height = float(t.height, maxLength);
|
|
1327
|
+
t.x = float$1(t.x, maxLength);
|
|
1328
|
+
t.y = float$1(t.y, maxLength);
|
|
1329
|
+
t.width = float$1(t.width, maxLength);
|
|
1330
|
+
t.height = float$1(t.height, maxLength);
|
|
1328
1331
|
},
|
|
1329
1332
|
add(t, bounds, isPoint) {
|
|
1330
1333
|
right$1 = t.x + t.width;
|
|
@@ -1368,7 +1371,7 @@ const BoundsHelper = {
|
|
|
1368
1371
|
},
|
|
1369
1372
|
setPoints(t, points) {
|
|
1370
1373
|
points.forEach((point, index) => index === 0 ? setPoint$2(tempPointBounds$1, point.x, point.y) : addPoint$2(tempPointBounds$1, point.x, point.y));
|
|
1371
|
-
toBounds$
|
|
1374
|
+
toBounds$2(tempPointBounds$1, t);
|
|
1372
1375
|
},
|
|
1373
1376
|
setPoint(t, point) {
|
|
1374
1377
|
B.set(t, point.x, point.y);
|
|
@@ -2221,15 +2224,15 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2221
2224
|
DataHelper.copyAttrs(s, size, canvasSizeAttrs);
|
|
2222
2225
|
canvasSizeAttrs.forEach(key => s[key] || (s[key] = 1));
|
|
2223
2226
|
this.bounds = new Bounds(0, 0, this.width, this.height);
|
|
2224
|
-
|
|
2225
|
-
this.updateViewSize();
|
|
2226
|
-
this.smooth = this.config.smooth;
|
|
2227
|
-
}
|
|
2227
|
+
this.updateViewSize();
|
|
2228
2228
|
this.updateClientBounds();
|
|
2229
|
-
if (this.context
|
|
2230
|
-
this.
|
|
2231
|
-
this.
|
|
2232
|
-
|
|
2229
|
+
if (this.context) {
|
|
2230
|
+
this.smooth = this.config.smooth;
|
|
2231
|
+
if (!this.unreal && takeCanvas) {
|
|
2232
|
+
this.clearWorld(takeCanvas.bounds);
|
|
2233
|
+
this.copyWorld(takeCanvas);
|
|
2234
|
+
takeCanvas.recycle();
|
|
2235
|
+
}
|
|
2233
2236
|
}
|
|
2234
2237
|
}
|
|
2235
2238
|
updateViewSize() {}
|
|
@@ -2543,7 +2546,7 @@ const RectHelper = {
|
|
|
2543
2546
|
}
|
|
2544
2547
|
};
|
|
2545
2548
|
|
|
2546
|
-
const {sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil, abs: abs$2, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
|
|
2549
|
+
const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs: abs$2, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
|
|
2547
2550
|
|
|
2548
2551
|
const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
|
|
2549
2552
|
|
|
@@ -2614,9 +2617,11 @@ const BezierHelper = {
|
|
|
2614
2617
|
const CBy = toY - y1;
|
|
2615
2618
|
let startRadian = atan2$1(BAy, BAx);
|
|
2616
2619
|
let endRadian = atan2$1(CBy, CBx);
|
|
2620
|
+
const lenBA = hypot(BAx, BAy);
|
|
2621
|
+
const lenCB = hypot(CBx, CBy);
|
|
2617
2622
|
let totalRadian = endRadian - startRadian;
|
|
2618
2623
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2619
|
-
if (
|
|
2624
|
+
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$2(totalRadian - PI$2) < 1e-12) {
|
|
2620
2625
|
if (data) data.push(L$6, x1, y1);
|
|
2621
2626
|
if (setPointBounds) {
|
|
2622
2627
|
setPoint$1(setPointBounds, fromX, fromY);
|
|
@@ -2649,7 +2654,7 @@ const BezierHelper = {
|
|
|
2649
2654
|
let totalRadian = endRadian - startRadian;
|
|
2650
2655
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2651
2656
|
if (anticlockwise) totalRadian -= PI2;
|
|
2652
|
-
const parts = ceil(abs$2(totalRadian / PI_2));
|
|
2657
|
+
const parts = ceil$1(abs$2(totalRadian / PI_2));
|
|
2653
2658
|
const partRadian = totalRadian / parts;
|
|
2654
2659
|
const partRadian4Sin = sin$3(partRadian / 4);
|
|
2655
2660
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
|
|
@@ -3208,11 +3213,7 @@ class PathCreator {
|
|
|
3208
3213
|
this.set(path);
|
|
3209
3214
|
}
|
|
3210
3215
|
set(path) {
|
|
3211
|
-
|
|
3212
|
-
this.__path = isString(path) ? PathHelper.parse(path) : path;
|
|
3213
|
-
} else {
|
|
3214
|
-
this.__path = [];
|
|
3215
|
-
}
|
|
3216
|
+
this.__path = path ? isString(path) ? PathHelper.parse(path) : path : [];
|
|
3216
3217
|
return this;
|
|
3217
3218
|
}
|
|
3218
3219
|
beginPath() {
|
|
@@ -3380,7 +3381,7 @@ const {M: M$1, L: L$2, C: C, Q: Q, Z: Z$1, N: N, D: D$1, X: X, G: G, F: F$1, O:
|
|
|
3380
3381
|
|
|
3381
3382
|
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
|
|
3382
3383
|
|
|
3383
|
-
const {addPointBounds: addPointBounds, copy: copy$7, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$
|
|
3384
|
+
const {addPointBounds: addPointBounds, copy: copy$7, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$1} = TwoPointBoundsHelper;
|
|
3384
3385
|
|
|
3385
3386
|
const debug$a = Debug.get("PathBounds");
|
|
3386
3387
|
|
|
@@ -3395,7 +3396,7 @@ const setEndPoint = {};
|
|
|
3395
3396
|
const PathBounds = {
|
|
3396
3397
|
toBounds(data, setBounds) {
|
|
3397
3398
|
PathBounds.toTwoPointBounds(data, setPointBounds);
|
|
3398
|
-
toBounds$
|
|
3399
|
+
toBounds$1(setPointBounds, setBounds);
|
|
3399
3400
|
},
|
|
3400
3401
|
toTwoPointBounds(data, setPointBounds) {
|
|
3401
3402
|
if (!data || !data.length) return setPoint(setPointBounds, 0, 0);
|
|
@@ -3582,14 +3583,18 @@ const PathCorner = {
|
|
|
3582
3583
|
}
|
|
3583
3584
|
};
|
|
3584
3585
|
|
|
3585
|
-
|
|
3586
|
+
function path(path) {
|
|
3587
|
+
return new PathCreator(path);
|
|
3588
|
+
}
|
|
3589
|
+
|
|
3590
|
+
const pen = path();
|
|
3591
|
+
|
|
3592
|
+
PathHelper.creator = path();
|
|
3586
3593
|
|
|
3587
3594
|
PathHelper.parse = PathConvert.parse;
|
|
3588
3595
|
|
|
3589
3596
|
PathHelper.convertToCanvasData = PathConvert.toCanvasData;
|
|
3590
3597
|
|
|
3591
|
-
const pen = new PathCreator;
|
|
3592
|
-
|
|
3593
3598
|
const {drawRoundRect: drawRoundRect} = RectHelper;
|
|
3594
3599
|
|
|
3595
3600
|
function roundRect(drawer) {
|
|
@@ -3954,7 +3959,7 @@ const ImageManager = {
|
|
|
3954
3959
|
return FileHelper.alphaPixelTypes.some(item => I$1.isFormat(item, config));
|
|
3955
3960
|
},
|
|
3956
3961
|
isFormat(format, config) {
|
|
3957
|
-
if (config.format
|
|
3962
|
+
if (config.format) return config.format === format;
|
|
3958
3963
|
const {url: url} = config;
|
|
3959
3964
|
if (url.startsWith("data:")) {
|
|
3960
3965
|
if (url.startsWith("data:" + FileHelper.mineType(format))) return true;
|
|
@@ -4048,7 +4053,7 @@ class LeaferImage {
|
|
|
4048
4053
|
getFull(_filters) {
|
|
4049
4054
|
return this.view;
|
|
4050
4055
|
}
|
|
4051
|
-
getCanvas(width, height, opacity, _filters, xGap, yGap) {
|
|
4056
|
+
getCanvas(width, height, opacity, _filters, xGap, yGap, smooth) {
|
|
4052
4057
|
width || (width = this.width);
|
|
4053
4058
|
height || (height = this.height);
|
|
4054
4059
|
if (this.cache) {
|
|
@@ -4064,6 +4069,7 @@ class LeaferImage {
|
|
|
4064
4069
|
const canvas = Platform.origin.createCanvas(max$1(floor$1(width + (xGap || 0)), 1), max$1(floor$1(height + (yGap || 0)), 1));
|
|
4065
4070
|
const ctx = canvas.getContext("2d");
|
|
4066
4071
|
if (opacity) ctx.globalAlpha = opacity;
|
|
4072
|
+
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
4067
4073
|
ctx.drawImage(this.view, 0, 0, width, height);
|
|
4068
4074
|
this.cache = this.use > 1 ? {
|
|
4069
4075
|
data: canvas,
|
|
@@ -4715,8 +4721,9 @@ const L = LeafHelper;
|
|
|
4715
4721
|
|
|
4716
4722
|
const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L;
|
|
4717
4723
|
|
|
4718
|
-
function getTempLocal(t,
|
|
4719
|
-
|
|
4724
|
+
function getTempLocal(t, worldPoint) {
|
|
4725
|
+
t.updateLayout();
|
|
4726
|
+
return t.parent ? PointHelper.tempToInnerOf(worldPoint, t.parent.scrollWorldTransform) : worldPoint;
|
|
4720
4727
|
}
|
|
4721
4728
|
|
|
4722
4729
|
const LeafBoundsHelper = {
|
|
@@ -5456,6 +5463,8 @@ LeaferEvent.RESTART = "leafer.restart";
|
|
|
5456
5463
|
|
|
5457
5464
|
LeaferEvent.END = "leafer.end";
|
|
5458
5465
|
|
|
5466
|
+
LeaferEvent.UPDATE_MODE = "leafer.update_mode";
|
|
5467
|
+
|
|
5459
5468
|
LeaferEvent.TRANSFORM = "leafer.transform";
|
|
5460
5469
|
|
|
5461
5470
|
LeaferEvent.MOVE = "leafer.move";
|
|
@@ -5734,7 +5743,7 @@ const {updateBounds: updateBounds$1} = BranchHelper;
|
|
|
5734
5743
|
|
|
5735
5744
|
const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4} = BoundsHelper;
|
|
5736
5745
|
|
|
5737
|
-
const {toBounds: toBounds
|
|
5746
|
+
const {toBounds: toBounds} = PathBounds;
|
|
5738
5747
|
|
|
5739
5748
|
const LeafBounds = {
|
|
5740
5749
|
__updateWorldBounds() {
|
|
@@ -5806,8 +5815,8 @@ const LeafBounds = {
|
|
|
5806
5815
|
__updateBoxBounds(_secondLayout, _bounds) {
|
|
5807
5816
|
const b = this.__layout.boxBounds;
|
|
5808
5817
|
const data = this.__;
|
|
5809
|
-
if (data.
|
|
5810
|
-
toBounds
|
|
5818
|
+
if (data.__usePathBox) {
|
|
5819
|
+
toBounds(data.path, b);
|
|
5811
5820
|
} else {
|
|
5812
5821
|
b.x = 0;
|
|
5813
5822
|
b.y = 0;
|
|
@@ -6742,7 +6751,7 @@ class LeafLevelList {
|
|
|
6742
6751
|
}
|
|
6743
6752
|
}
|
|
6744
6753
|
|
|
6745
|
-
const version = "1.9.
|
|
6754
|
+
const version = "1.9.6";
|
|
6746
6755
|
|
|
6747
6756
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6748
6757
|
get allowBackgroundColor() {
|
|
@@ -6796,6 +6805,7 @@ class LeaferCanvas extends LeaferCanvasBase {
|
|
|
6796
6805
|
this.view = Platform.origin.createCanvas(1, 1);
|
|
6797
6806
|
}
|
|
6798
6807
|
updateViewSize() {
|
|
6808
|
+
if (this.unreal) return;
|
|
6799
6809
|
const {width: width, height: height, pixelRatio: pixelRatio} = this;
|
|
6800
6810
|
this.view.width = Math.ceil(width * pixelRatio);
|
|
6801
6811
|
this.view.height = Math.ceil(height * pixelRatio);
|
|
@@ -6807,6 +6817,7 @@ class LeaferCanvas extends LeaferCanvasBase {
|
|
|
6807
6817
|
});
|
|
6808
6818
|
}
|
|
6809
6819
|
startAutoLayout(autoBounds, listener) {
|
|
6820
|
+
if (this.resizeListener) return;
|
|
6810
6821
|
this.resizeListener = listener;
|
|
6811
6822
|
if (autoBounds) {
|
|
6812
6823
|
this.checkSize = this.checkSize.bind(this);
|
|
@@ -7316,7 +7327,7 @@ class Renderer {
|
|
|
7316
7327
|
this.times = 0;
|
|
7317
7328
|
this.config = {
|
|
7318
7329
|
usePartRender: true,
|
|
7319
|
-
maxFPS:
|
|
7330
|
+
maxFPS: 120
|
|
7320
7331
|
};
|
|
7321
7332
|
this.target = target;
|
|
7322
7333
|
this.canvas = canvas;
|
|
@@ -7471,11 +7482,15 @@ class Renderer {
|
|
|
7471
7482
|
if (this.requestTime || !target) return;
|
|
7472
7483
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
7473
7484
|
const requestTime = this.requestTime = Date.now();
|
|
7474
|
-
|
|
7475
|
-
|
|
7485
|
+
const render = () => {
|
|
7486
|
+
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
7487
|
+
const {maxFPS: maxFPS} = this.config;
|
|
7488
|
+
if (maxFPS && nowFPS > maxFPS - .5) return Platform.requestRender(render);
|
|
7489
|
+
this.FPS = Math.min(120, Math.ceil(nowFPS));
|
|
7476
7490
|
this.requestTime = 0;
|
|
7477
7491
|
this.checkRender();
|
|
7478
|
-
}
|
|
7492
|
+
};
|
|
7493
|
+
Platform.requestRender(render);
|
|
7479
7494
|
}
|
|
7480
7495
|
__onResize(e) {
|
|
7481
7496
|
if (this.canvas.unreal) return;
|
|
@@ -7518,7 +7533,8 @@ class Renderer {
|
|
|
7518
7533
|
if (this.target) {
|
|
7519
7534
|
this.stop();
|
|
7520
7535
|
this.__removeListenEvents();
|
|
7521
|
-
this.
|
|
7536
|
+
this.config = {};
|
|
7537
|
+
this.target = this.canvas = null;
|
|
7522
7538
|
}
|
|
7523
7539
|
}
|
|
7524
7540
|
}
|
|
@@ -7614,7 +7630,7 @@ class Picker {
|
|
|
7614
7630
|
item = path.list[i];
|
|
7615
7631
|
if (!item.__.hittable) break;
|
|
7616
7632
|
hittablePath.addAt(item, 0);
|
|
7617
|
-
if (!item.__.hitChildren) break;
|
|
7633
|
+
if (!item.__.hitChildren || item.isLeafer && item.mode === "draw") break;
|
|
7618
7634
|
}
|
|
7619
7635
|
return hittablePath;
|
|
7620
7636
|
}
|
|
@@ -8009,7 +8025,11 @@ class LeaferData extends GroupData {
|
|
|
8009
8025
|
|
|
8010
8026
|
class FrameData extends BoxData {}
|
|
8011
8027
|
|
|
8012
|
-
class LineData extends UIData {
|
|
8028
|
+
class LineData extends UIData {
|
|
8029
|
+
get __usePathBox() {
|
|
8030
|
+
return this.points || this.__pathInputed;
|
|
8031
|
+
}
|
|
8032
|
+
}
|
|
8013
8033
|
|
|
8014
8034
|
class RectData extends UIData {
|
|
8015
8035
|
get __boxStroke() {
|
|
@@ -8023,7 +8043,7 @@ class EllipseData extends UIData {
|
|
|
8023
8043
|
}
|
|
8024
8044
|
}
|
|
8025
8045
|
|
|
8026
|
-
class PolygonData extends
|
|
8046
|
+
class PolygonData extends LineData {}
|
|
8027
8047
|
|
|
8028
8048
|
class StarData extends UIData {}
|
|
8029
8049
|
|
|
@@ -8067,8 +8087,6 @@ class TextData extends UIData {
|
|
|
8067
8087
|
if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
|
|
8068
8088
|
box.set(value);
|
|
8069
8089
|
if (boxLayout.strokeChanged) layout.strokeChange();
|
|
8070
|
-
if (boxLayout.renderChanged) layout.renderChange();
|
|
8071
|
-
box.__updateChange();
|
|
8072
8090
|
} else if (box) {
|
|
8073
8091
|
t.__box = box.parent = null;
|
|
8074
8092
|
box.destroy();
|
|
@@ -8138,7 +8156,7 @@ const UIBounds = {
|
|
|
8138
8156
|
__updateRenderSpread() {
|
|
8139
8157
|
let width = 0;
|
|
8140
8158
|
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
|
|
8141
|
-
if (shadow)
|
|
8159
|
+
if (shadow) width = Effect.getShadowSpread(this, shadow);
|
|
8142
8160
|
if (blur) width = Math.max(width, blur);
|
|
8143
8161
|
if (filter) width += Filter.getSpread(filter);
|
|
8144
8162
|
if (renderSpread) width += renderSpread;
|
|
@@ -8151,36 +8169,69 @@ const UIBounds = {
|
|
|
8151
8169
|
}
|
|
8152
8170
|
};
|
|
8153
8171
|
|
|
8172
|
+
const {float: float} = MathHelper;
|
|
8173
|
+
|
|
8174
|
+
const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
|
|
8175
|
+
|
|
8154
8176
|
const DragBoundsHelper = {
|
|
8177
|
+
limitMove(leaf, move) {
|
|
8178
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8179
|
+
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
|
|
8180
|
+
D.axisMove(leaf, move);
|
|
8181
|
+
},
|
|
8182
|
+
limitScaleOf(leaf, origin, scale) {
|
|
8183
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8184
|
+
if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
|
|
8185
|
+
},
|
|
8186
|
+
axisMove(leaf, move) {
|
|
8187
|
+
const {draggable: draggable} = leaf;
|
|
8188
|
+
if (draggable === "x") move.y = 0;
|
|
8189
|
+
if (draggable === "y") move.x = 0;
|
|
8190
|
+
},
|
|
8191
|
+
getDragBounds(leaf) {
|
|
8192
|
+
const {dragBounds: dragBounds} = leaf;
|
|
8193
|
+
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
8194
|
+
},
|
|
8195
|
+
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
8196
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
8197
|
+
},
|
|
8155
8198
|
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
8156
8199
|
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
8157
8200
|
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
8158
8201
|
if (!change) move = Object.assign({}, move);
|
|
8159
|
-
|
|
8160
|
-
const isBiggerHeight = content.height > dragBounds.height;
|
|
8161
|
-
if (isBiggerWidth && dragBoundsType !== "outer") {
|
|
8202
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
8162
8203
|
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
8163
8204
|
} else {
|
|
8164
8205
|
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
8165
8206
|
}
|
|
8166
|
-
if (
|
|
8207
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
8167
8208
|
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
8168
8209
|
} else {
|
|
8169
8210
|
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
8170
8211
|
}
|
|
8171
|
-
move.x =
|
|
8172
|
-
move.y =
|
|
8212
|
+
move.x = float(move.x);
|
|
8213
|
+
move.y = float(move.y);
|
|
8173
8214
|
return move;
|
|
8174
8215
|
},
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8216
|
+
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
|
|
8217
|
+
if (!change) scale = Object.assign({}, scale);
|
|
8218
|
+
let fitScaleX, fitScaleY;
|
|
8219
|
+
tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
|
|
8220
|
+
tempMerge.set(tempContent).add(dragBounds);
|
|
8221
|
+
tempIntersect.set(tempContent).intersect(dragBounds);
|
|
8222
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
8223
|
+
fitScaleX = tempMerge.width / tempContent.width;
|
|
8224
|
+
} else {
|
|
8225
|
+
fitScaleX = tempIntersect.width / tempContent.width;
|
|
8226
|
+
}
|
|
8227
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
8228
|
+
fitScaleY = tempMerge.height / tempContent.height;
|
|
8229
|
+
} else {
|
|
8230
|
+
fitScaleY = tempIntersect.height / tempContent.height;
|
|
8231
|
+
}
|
|
8232
|
+
scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
8233
|
+
scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
8234
|
+
return scale;
|
|
8184
8235
|
}
|
|
8185
8236
|
};
|
|
8186
8237
|
|
|
@@ -8198,7 +8249,7 @@ const UIRender = {
|
|
|
8198
8249
|
}
|
|
8199
8250
|
if (data.__useEffect) {
|
|
8200
8251
|
const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
8201
|
-
stintSet$1(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
|
|
8252
|
+
stintSet$1(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
|
|
8202
8253
|
data.__useEffect = !!(shadow || otherEffect);
|
|
8203
8254
|
}
|
|
8204
8255
|
data.__checkSingle();
|
|
@@ -8333,20 +8384,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8333
8384
|
if (!path) this.__drawPathByBox(pen);
|
|
8334
8385
|
return pen;
|
|
8335
8386
|
}
|
|
8336
|
-
constructor(data) {
|
|
8337
|
-
super(data);
|
|
8338
|
-
}
|
|
8339
8387
|
reset(_data) {}
|
|
8340
|
-
set(data,
|
|
8341
|
-
if (data)
|
|
8342
|
-
if (transition) {
|
|
8343
|
-
if (transition === "temp") {
|
|
8344
|
-
this.lockNormalStyle = true;
|
|
8345
|
-
Object.assign(this, data);
|
|
8346
|
-
this.lockNormalStyle = false;
|
|
8347
|
-
} else this.animate(data, transition);
|
|
8348
|
-
} else Object.assign(this, data);
|
|
8349
|
-
}
|
|
8388
|
+
set(data, _transition) {
|
|
8389
|
+
if (data) Object.assign(this, data);
|
|
8350
8390
|
}
|
|
8351
8391
|
get(name) {
|
|
8352
8392
|
return isString(name) ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
@@ -8392,7 +8432,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8392
8432
|
const data = this.__;
|
|
8393
8433
|
if (data.path) {
|
|
8394
8434
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
8395
|
-
if (data.__useArrow) PathArrow.addArrows(this
|
|
8435
|
+
if (data.__useArrow) PathArrow.addArrows(this);
|
|
8396
8436
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
8397
8437
|
}
|
|
8398
8438
|
__drawRenderPath(canvas) {
|
|
@@ -8416,7 +8456,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8416
8456
|
drawImagePlaceholder(canvas, _image) {
|
|
8417
8457
|
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
8418
8458
|
}
|
|
8419
|
-
animate(
|
|
8459
|
+
animate(keyframe, _options, _type, _isTemp) {
|
|
8460
|
+
this.set(keyframe);
|
|
8420
8461
|
return Plugin.need("animate");
|
|
8421
8462
|
}
|
|
8422
8463
|
killAnimate(_type, _nextStyle) {}
|
|
@@ -8605,9 +8646,6 @@ let Group = class Group extends UI {
|
|
|
8605
8646
|
get isBranch() {
|
|
8606
8647
|
return true;
|
|
8607
8648
|
}
|
|
8608
|
-
constructor(data) {
|
|
8609
|
-
super(data);
|
|
8610
|
-
}
|
|
8611
8649
|
reset(data) {
|
|
8612
8650
|
this.__setBranch();
|
|
8613
8651
|
super.reset(data);
|
|
@@ -8732,7 +8770,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8732
8770
|
const canvas = this.canvas = Creator.canvas(config);
|
|
8733
8771
|
this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
|
|
8734
8772
|
if (this.isApp) this.__setApp();
|
|
8735
|
-
this.__checkAutoLayout(
|
|
8773
|
+
this.__checkAutoLayout();
|
|
8736
8774
|
this.view = canvas.view;
|
|
8737
8775
|
if (!parentApp) {
|
|
8738
8776
|
this.selector = Creator.selector(this);
|
|
@@ -8831,7 +8869,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8831
8869
|
this.leafer = leafer;
|
|
8832
8870
|
this.__level = 1;
|
|
8833
8871
|
}
|
|
8834
|
-
__checkAutoLayout(
|
|
8872
|
+
__checkAutoLayout() {
|
|
8873
|
+
const {config: config, parentApp: parentApp} = this;
|
|
8835
8874
|
if (!parentApp) {
|
|
8836
8875
|
if (!config.width || !config.height) this.autoLayout = new AutoBounds(config);
|
|
8837
8876
|
this.canvas.startAutoLayout(this.autoLayout, this.__onResize.bind(this));
|
|
@@ -8848,7 +8887,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8848
8887
|
} else if (attrName === "zIndex") {
|
|
8849
8888
|
this.canvas.zIndex = newValue;
|
|
8850
8889
|
setTimeout(() => this.parent && this.parent.__updateSortChildren());
|
|
8851
|
-
}
|
|
8890
|
+
} else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
|
|
8891
|
+
mode: newValue
|
|
8892
|
+
});
|
|
8852
8893
|
}
|
|
8853
8894
|
return super.__setAttr(attrName, newValue);
|
|
8854
8895
|
}
|
|
@@ -8857,9 +8898,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8857
8898
|
return super.__getAttr(attrName);
|
|
8858
8899
|
}
|
|
8859
8900
|
__changeCanvasSize(attrName, newValue) {
|
|
8860
|
-
const
|
|
8861
|
-
data
|
|
8862
|
-
|
|
8901
|
+
const {config: config, canvas: canvas} = this;
|
|
8902
|
+
const data = DataHelper.copyAttrs({}, canvas, canvasSizeAttrs);
|
|
8903
|
+
data[attrName] = config[attrName] = newValue;
|
|
8904
|
+
config.width && config.height ? canvas.stopAutoLayout() : this.__checkAutoLayout();
|
|
8863
8905
|
this.__doResize(data);
|
|
8864
8906
|
}
|
|
8865
8907
|
__changeFill(newValue) {
|
|
@@ -9006,9 +9048,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
9006
9048
|
if (!this.parent) {
|
|
9007
9049
|
if (this.selector) this.selector.destroy();
|
|
9008
9050
|
if (this.hitCanvasManager) this.hitCanvasManager.destroy();
|
|
9009
|
-
this.canvasManager.destroy();
|
|
9051
|
+
if (this.canvasManager) this.canvasManager.destroy();
|
|
9010
9052
|
}
|
|
9011
|
-
this.canvas.destroy();
|
|
9053
|
+
if (this.canvas) this.canvas.destroy();
|
|
9012
9054
|
this.config.view = this.view = this.parentApp = null;
|
|
9013
9055
|
if (this.userConfig) this.userConfig.view = null;
|
|
9014
9056
|
super.destroy();
|
|
@@ -9030,15 +9072,14 @@ __decorate([ dataProcessor(LeaferData) ], Leafer.prototype, "__", void 0);
|
|
|
9030
9072
|
|
|
9031
9073
|
__decorate([ boundsType() ], Leafer.prototype, "pixelRatio", void 0);
|
|
9032
9074
|
|
|
9075
|
+
__decorate([ dataType("normal") ], Leafer.prototype, "mode", void 0);
|
|
9076
|
+
|
|
9033
9077
|
Leafer = Leafer_1 = __decorate([ registerUI() ], Leafer);
|
|
9034
9078
|
|
|
9035
9079
|
let Rect = class Rect extends UI {
|
|
9036
9080
|
get __tag() {
|
|
9037
9081
|
return "Rect";
|
|
9038
9082
|
}
|
|
9039
|
-
constructor(data) {
|
|
9040
|
-
super(data);
|
|
9041
|
-
}
|
|
9042
9083
|
};
|
|
9043
9084
|
|
|
9044
9085
|
__decorate([ dataProcessor(RectData) ], Rect.prototype, "__", void 0);
|
|
@@ -9170,9 +9211,6 @@ let Frame = class Frame extends Box {
|
|
|
9170
9211
|
get isFrame() {
|
|
9171
9212
|
return true;
|
|
9172
9213
|
}
|
|
9173
|
-
constructor(data) {
|
|
9174
|
-
super(data);
|
|
9175
|
-
}
|
|
9176
9214
|
};
|
|
9177
9215
|
|
|
9178
9216
|
__decorate([ dataProcessor(FrameData) ], Frame.prototype, "__", void 0);
|
|
@@ -9189,9 +9227,6 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9189
9227
|
get __tag() {
|
|
9190
9228
|
return "Ellipse";
|
|
9191
9229
|
}
|
|
9192
|
-
constructor(data) {
|
|
9193
|
-
super(data);
|
|
9194
|
-
}
|
|
9195
9230
|
__updatePath() {
|
|
9196
9231
|
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
|
|
9197
9232
|
const rx = width / 2, ry = height / 2;
|
|
@@ -9231,98 +9266,29 @@ __decorate([ pathType(0) ], Ellipse.prototype, "endAngle", void 0);
|
|
|
9231
9266
|
|
|
9232
9267
|
Ellipse = __decorate([ registerUI() ], Ellipse);
|
|
9233
9268
|
|
|
9234
|
-
const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
9235
|
-
|
|
9236
|
-
const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
|
|
9237
|
-
|
|
9238
|
-
const {toBounds: toBounds} = PathBounds;
|
|
9239
|
-
|
|
9240
|
-
let Line = class Line extends UI {
|
|
9241
|
-
get __tag() {
|
|
9242
|
-
return "Line";
|
|
9243
|
-
}
|
|
9244
|
-
get toPoint() {
|
|
9245
|
-
const {width: width, rotation: rotation} = this.__;
|
|
9246
|
-
const to = getPointData();
|
|
9247
|
-
if (width) to.x = width;
|
|
9248
|
-
if (rotation) rotate$1(to, rotation);
|
|
9249
|
-
return to;
|
|
9250
|
-
}
|
|
9251
|
-
set toPoint(value) {
|
|
9252
|
-
this.width = getDistance$2(defaultPoint, value);
|
|
9253
|
-
this.rotation = getAngle$1(defaultPoint, value);
|
|
9254
|
-
if (this.height) this.height = 0;
|
|
9255
|
-
}
|
|
9256
|
-
constructor(data) {
|
|
9257
|
-
super(data);
|
|
9258
|
-
}
|
|
9259
|
-
__updatePath() {
|
|
9260
|
-
const data = this.__;
|
|
9261
|
-
const path = data.path = [];
|
|
9262
|
-
if (data.points) {
|
|
9263
|
-
drawPoints$1(path, data.points, false, data.closed);
|
|
9264
|
-
} else {
|
|
9265
|
-
moveTo$2(path, 0, 0);
|
|
9266
|
-
lineTo$2(path, this.width, 0);
|
|
9267
|
-
}
|
|
9268
|
-
}
|
|
9269
|
-
__updateRenderPath() {
|
|
9270
|
-
const data = this.__;
|
|
9271
|
-
if (!this.pathInputed && data.points && data.curve) {
|
|
9272
|
-
drawPoints$1(data.__pathForRender = [], data.points, data.curve, data.closed);
|
|
9273
|
-
if (data.__useArrow) PathArrow.addArrows(this, false);
|
|
9274
|
-
} else super.__updateRenderPath();
|
|
9275
|
-
}
|
|
9276
|
-
__updateBoxBounds() {
|
|
9277
|
-
if (this.points) {
|
|
9278
|
-
toBounds(this.__.__pathForRender, this.__layout.boxBounds);
|
|
9279
|
-
} else super.__updateBoxBounds();
|
|
9280
|
-
}
|
|
9281
|
-
};
|
|
9282
|
-
|
|
9283
|
-
__decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
|
|
9284
|
-
|
|
9285
|
-
__decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
|
|
9286
|
-
|
|
9287
|
-
__decorate([ boundsType(0) ], Line.prototype, "height", void 0);
|
|
9288
|
-
|
|
9289
|
-
__decorate([ pathType() ], Line.prototype, "points", void 0);
|
|
9290
|
-
|
|
9291
|
-
__decorate([ pathType(0) ], Line.prototype, "curve", void 0);
|
|
9292
|
-
|
|
9293
|
-
__decorate([ pathType(false) ], Line.prototype, "closed", void 0);
|
|
9294
|
-
|
|
9295
|
-
Line = __decorate([ registerUI() ], Line);
|
|
9296
|
-
|
|
9297
9269
|
const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
|
|
9298
9270
|
|
|
9299
|
-
const {moveTo: moveTo$
|
|
9300
|
-
|
|
9301
|
-
const line = Line.prototype;
|
|
9271
|
+
const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
9302
9272
|
|
|
9303
9273
|
let Polygon = class Polygon extends UI {
|
|
9304
9274
|
get __tag() {
|
|
9305
9275
|
return "Polygon";
|
|
9306
9276
|
}
|
|
9307
|
-
constructor(data) {
|
|
9308
|
-
super(data);
|
|
9309
|
-
}
|
|
9310
9277
|
__updatePath() {
|
|
9311
|
-
const
|
|
9312
|
-
|
|
9313
|
-
|
|
9278
|
+
const data = this.__;
|
|
9279
|
+
const path = data.path = [];
|
|
9280
|
+
if (data.points) {
|
|
9281
|
+
drawPoints$1(path, data.points, data.curve, true);
|
|
9314
9282
|
} else {
|
|
9315
|
-
const {width: width, height: height, sides: sides} =
|
|
9283
|
+
const {width: width, height: height, sides: sides} = data;
|
|
9316
9284
|
const rx = width / 2, ry = height / 2;
|
|
9317
|
-
moveTo$
|
|
9285
|
+
moveTo$2(path, rx, 0);
|
|
9318
9286
|
for (let i = 1; i < sides; i++) {
|
|
9319
|
-
lineTo$
|
|
9287
|
+
lineTo$2(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
|
|
9320
9288
|
}
|
|
9321
9289
|
closePath$1(path);
|
|
9322
9290
|
}
|
|
9323
9291
|
}
|
|
9324
|
-
__updateRenderPath() {}
|
|
9325
|
-
__updateBoxBounds() {}
|
|
9326
9292
|
};
|
|
9327
9293
|
|
|
9328
9294
|
__decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
|
|
@@ -9333,30 +9299,23 @@ __decorate([ pathType() ], Polygon.prototype, "points", void 0);
|
|
|
9333
9299
|
|
|
9334
9300
|
__decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
|
|
9335
9301
|
|
|
9336
|
-
__decorate([ rewrite(line.__updateRenderPath) ], Polygon.prototype, "__updateRenderPath", null);
|
|
9337
|
-
|
|
9338
|
-
__decorate([ rewrite(line.__updateBoxBounds) ], Polygon.prototype, "__updateBoxBounds", null);
|
|
9339
|
-
|
|
9340
9302
|
Polygon = __decorate([ rewriteAble(), registerUI() ], Polygon);
|
|
9341
9303
|
|
|
9342
9304
|
const {sin: sin, cos: cos, PI: PI} = Math;
|
|
9343
9305
|
|
|
9344
|
-
const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
|
|
9306
|
+
const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
|
|
9345
9307
|
|
|
9346
9308
|
let Star = class Star extends UI {
|
|
9347
9309
|
get __tag() {
|
|
9348
9310
|
return "Star";
|
|
9349
9311
|
}
|
|
9350
|
-
constructor(data) {
|
|
9351
|
-
super(data);
|
|
9352
|
-
}
|
|
9353
9312
|
__updatePath() {
|
|
9354
9313
|
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
9355
9314
|
const rx = width / 2, ry = height / 2;
|
|
9356
9315
|
const path = this.__.path = [];
|
|
9357
|
-
moveTo(path, rx, 0);
|
|
9316
|
+
moveTo$1(path, rx, 0);
|
|
9358
9317
|
for (let i = 1; i < corners * 2; i++) {
|
|
9359
|
-
lineTo(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
|
|
9318
|
+
lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
|
|
9360
9319
|
}
|
|
9361
9320
|
closePath(path);
|
|
9362
9321
|
}
|
|
@@ -9370,6 +9329,52 @@ __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
|
|
|
9370
9329
|
|
|
9371
9330
|
Star = __decorate([ registerUI() ], Star);
|
|
9372
9331
|
|
|
9332
|
+
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
9333
|
+
|
|
9334
|
+
const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
|
|
9335
|
+
|
|
9336
|
+
let Line = class Line extends UI {
|
|
9337
|
+
get __tag() {
|
|
9338
|
+
return "Line";
|
|
9339
|
+
}
|
|
9340
|
+
get toPoint() {
|
|
9341
|
+
const {width: width, rotation: rotation} = this.__;
|
|
9342
|
+
const to = getPointData();
|
|
9343
|
+
if (width) to.x = width;
|
|
9344
|
+
if (rotation) rotate$1(to, rotation);
|
|
9345
|
+
return to;
|
|
9346
|
+
}
|
|
9347
|
+
set toPoint(value) {
|
|
9348
|
+
this.width = getDistance$2(defaultPoint, value);
|
|
9349
|
+
this.rotation = getAngle$1(defaultPoint, value);
|
|
9350
|
+
if (this.height) this.height = 0;
|
|
9351
|
+
}
|
|
9352
|
+
__updatePath() {
|
|
9353
|
+
const data = this.__;
|
|
9354
|
+
const path = data.path = [];
|
|
9355
|
+
if (data.points) {
|
|
9356
|
+
drawPoints(path, data.points, data.curve, data.closed);
|
|
9357
|
+
} else {
|
|
9358
|
+
moveTo(path, 0, 0);
|
|
9359
|
+
lineTo(path, this.width, 0);
|
|
9360
|
+
}
|
|
9361
|
+
}
|
|
9362
|
+
};
|
|
9363
|
+
|
|
9364
|
+
__decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
|
|
9365
|
+
|
|
9366
|
+
__decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
|
|
9367
|
+
|
|
9368
|
+
__decorate([ boundsType(0) ], Line.prototype, "height", void 0);
|
|
9369
|
+
|
|
9370
|
+
__decorate([ pathType() ], Line.prototype, "points", void 0);
|
|
9371
|
+
|
|
9372
|
+
__decorate([ pathType(0) ], Line.prototype, "curve", void 0);
|
|
9373
|
+
|
|
9374
|
+
__decorate([ pathType(false) ], Line.prototype, "closed", void 0);
|
|
9375
|
+
|
|
9376
|
+
Line = __decorate([ registerUI() ], Line);
|
|
9377
|
+
|
|
9373
9378
|
let Image = class Image extends Rect {
|
|
9374
9379
|
get __tag() {
|
|
9375
9380
|
return "Image";
|
|
@@ -9382,9 +9387,6 @@ let Image = class Image extends Rect {
|
|
|
9382
9387
|
const {fill: fill} = this.__;
|
|
9383
9388
|
return isArray(fill) && fill[0].image;
|
|
9384
9389
|
}
|
|
9385
|
-
constructor(data) {
|
|
9386
|
-
super(data);
|
|
9387
|
-
}
|
|
9388
9390
|
};
|
|
9389
9391
|
|
|
9390
9392
|
__decorate([ dataProcessor(ImageData) ], Image.prototype, "__", void 0);
|
|
@@ -9484,9 +9486,6 @@ let Text = class Text extends UI {
|
|
|
9484
9486
|
this.updateLayout();
|
|
9485
9487
|
return this.__.__textDrawData;
|
|
9486
9488
|
}
|
|
9487
|
-
constructor(data) {
|
|
9488
|
-
super(data);
|
|
9489
|
-
}
|
|
9490
9489
|
__updateTextDrawData() {
|
|
9491
9490
|
const data = this.__;
|
|
9492
9491
|
const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding} = data;
|
|
@@ -9523,10 +9522,6 @@ let Text = class Text extends UI {
|
|
|
9523
9522
|
DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
|
|
9524
9523
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
9525
9524
|
}
|
|
9526
|
-
__onUpdateSize() {
|
|
9527
|
-
if (this.__box) this.__box.__onUpdateSize();
|
|
9528
|
-
super.__onUpdateSize();
|
|
9529
|
-
}
|
|
9530
9525
|
__updateRenderSpread() {
|
|
9531
9526
|
let width = super.__updateRenderSpread();
|
|
9532
9527
|
if (!width) width = this.isOverflow ? 1 : 0;
|
|
@@ -9537,6 +9532,11 @@ let Text = class Text extends UI {
|
|
|
9537
9532
|
copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
9538
9533
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
9539
9534
|
}
|
|
9535
|
+
__updateChange() {
|
|
9536
|
+
super.__updateChange();
|
|
9537
|
+
const box = this.__box;
|
|
9538
|
+
if (box) box.__onUpdateSize(), box.__updateChange();
|
|
9539
|
+
}
|
|
9540
9540
|
__drawRenderPath(canvas) {
|
|
9541
9541
|
canvas.font = this.__.__font;
|
|
9542
9542
|
}
|
|
@@ -9619,9 +9619,6 @@ let Path = class Path extends UI {
|
|
|
9619
9619
|
get __tag() {
|
|
9620
9620
|
return "Path";
|
|
9621
9621
|
}
|
|
9622
|
-
constructor(data) {
|
|
9623
|
-
super(data);
|
|
9624
|
-
}
|
|
9625
9622
|
};
|
|
9626
9623
|
|
|
9627
9624
|
__decorate([ dataProcessor(PathData) ], Path.prototype, "__", void 0);
|
|
@@ -9634,9 +9631,6 @@ let Pen = class Pen extends Group {
|
|
|
9634
9631
|
get __tag() {
|
|
9635
9632
|
return "Pen";
|
|
9636
9633
|
}
|
|
9637
|
-
constructor(data) {
|
|
9638
|
-
super(data);
|
|
9639
|
-
}
|
|
9640
9634
|
setStyle(data) {
|
|
9641
9635
|
const path = this.pathElement = new Path(data);
|
|
9642
9636
|
this.pathStyle = data;
|
|
@@ -11833,7 +11827,7 @@ function ignoreRender(ui, value) {
|
|
|
11833
11827
|
|
|
11834
11828
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
11835
11829
|
|
|
11836
|
-
const {floor: floor, max: max, abs: abs} = Math;
|
|
11830
|
+
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
11837
11831
|
|
|
11838
11832
|
function createPattern(ui, paint, pixelRatio) {
|
|
11839
11833
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -11843,8 +11837,6 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
11843
11837
|
let imageScale, imageMatrix, {width: width, height: height, scaleX: sx, scaleY: sy, transform: transform, repeat: repeat, gap: gap} = data;
|
|
11844
11838
|
scaleX *= pixelRatio;
|
|
11845
11839
|
scaleY *= pixelRatio;
|
|
11846
|
-
const xGap = gap && gap.x * scaleX;
|
|
11847
|
-
const yGap = gap && gap.y * scaleY;
|
|
11848
11840
|
if (sx) {
|
|
11849
11841
|
sx = abs(sx);
|
|
11850
11842
|
sy = abs(sy);
|
|
@@ -11861,7 +11853,10 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
11861
11853
|
if (size > Platform.image.maxCacheSize) return false;
|
|
11862
11854
|
}
|
|
11863
11855
|
let maxSize = Platform.image.maxPatternSize;
|
|
11864
|
-
if (
|
|
11856
|
+
if (image.isSVG) {
|
|
11857
|
+
const ws = width / image.width;
|
|
11858
|
+
if (ws > 1) imageScale = ws / ceil(ws);
|
|
11859
|
+
} else {
|
|
11865
11860
|
const imageSize = image.width * image.height;
|
|
11866
11861
|
if (maxSize > imageSize) maxSize = imageSize;
|
|
11867
11862
|
}
|
|
@@ -11876,18 +11871,20 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
11876
11871
|
scaleX /= sx;
|
|
11877
11872
|
scaleY /= sy;
|
|
11878
11873
|
}
|
|
11874
|
+
const xGap = gap && gap.x * scaleX;
|
|
11875
|
+
const yGap = gap && gap.y * scaleY;
|
|
11879
11876
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
11877
|
+
const canvasWidth = width + (xGap || 0);
|
|
11878
|
+
const canvasHeight = height + (yGap || 0);
|
|
11879
|
+
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
11880
|
+
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
11880
11881
|
if (!imageMatrix) {
|
|
11881
11882
|
imageMatrix = get$1();
|
|
11882
11883
|
if (transform) copy$1(imageMatrix, transform);
|
|
11883
11884
|
}
|
|
11884
11885
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
11885
11886
|
}
|
|
11886
|
-
|
|
11887
|
-
const canvasWidth = width + (xGap || 0), canvasHeight = height + (yGap || 0);
|
|
11888
|
-
scale(imageMatrix, canvasWidth / max(floor(canvasWidth), 1), canvasHeight / max(floor(canvasHeight), 1));
|
|
11889
|
-
}
|
|
11890
|
-
const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap);
|
|
11887
|
+
const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
|
|
11891
11888
|
const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
11892
11889
|
paint.style = pattern;
|
|
11893
11890
|
paint.patternId = id;
|
|
@@ -12129,12 +12126,18 @@ function shadow(ui, current, shape) {
|
|
|
12129
12126
|
}
|
|
12130
12127
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
12131
12128
|
}
|
|
12132
|
-
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
12129
|
+
if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
12133
12130
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
12134
12131
|
});
|
|
12135
12132
|
other.recycle(copyBounds);
|
|
12136
12133
|
}
|
|
12137
12134
|
|
|
12135
|
+
function getShadowSpread(_ui, shadow) {
|
|
12136
|
+
let width = 0;
|
|
12137
|
+
shadow.forEach(item => width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5));
|
|
12138
|
+
return width;
|
|
12139
|
+
}
|
|
12140
|
+
|
|
12138
12141
|
function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
|
|
12139
12142
|
const {bounds: bounds, shapeBounds: shapeBounds} = shape;
|
|
12140
12143
|
if (Platform.fullImageShadow) {
|
|
@@ -12212,7 +12215,11 @@ const EffectModule = {
|
|
|
12212
12215
|
shadow: shadow,
|
|
12213
12216
|
innerShadow: innerShadow,
|
|
12214
12217
|
blur: blur,
|
|
12215
|
-
backgroundBlur: backgroundBlur
|
|
12218
|
+
backgroundBlur: backgroundBlur,
|
|
12219
|
+
getShadowSpread: getShadowSpread,
|
|
12220
|
+
isTransformShadow(_shadow) {
|
|
12221
|
+
return undefined;
|
|
12222
|
+
}
|
|
12216
12223
|
};
|
|
12217
12224
|
|
|
12218
12225
|
const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
|
|
@@ -12720,16 +12727,17 @@ function toTextChar(row) {
|
|
|
12720
12727
|
}
|
|
12721
12728
|
|
|
12722
12729
|
function decorationText(drawData, style) {
|
|
12723
|
-
let type;
|
|
12730
|
+
let type, offset = 0;
|
|
12724
12731
|
const {fontSize: fontSize, textDecoration: textDecoration} = style;
|
|
12725
12732
|
drawData.decorationHeight = fontSize / 11;
|
|
12726
12733
|
if (isObject(textDecoration)) {
|
|
12727
12734
|
type = textDecoration.type;
|
|
12728
12735
|
if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
|
|
12736
|
+
if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
|
|
12729
12737
|
} else type = textDecoration;
|
|
12730
12738
|
switch (type) {
|
|
12731
12739
|
case "under":
|
|
12732
|
-
drawData.decorationY = [ fontSize * .15 ];
|
|
12740
|
+
drawData.decorationY = [ fontSize * .15 + offset ];
|
|
12733
12741
|
break;
|
|
12734
12742
|
|
|
12735
12743
|
case "delete":
|
|
@@ -12737,7 +12745,7 @@ function decorationText(drawData, style) {
|
|
|
12737
12745
|
break;
|
|
12738
12746
|
|
|
12739
12747
|
case "under-delete":
|
|
12740
|
-
drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
|
|
12748
|
+
drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
|
|
12741
12749
|
}
|
|
12742
12750
|
}
|
|
12743
12751
|
|
|
@@ -12847,4 +12855,4 @@ try {
|
|
|
12847
12855
|
if (wx) useCanvas("miniapp", wx);
|
|
12848
12856
|
} catch (_a) {}
|
|
12849
12857
|
|
|
12850
|
-
export { AlignHelper, Answer, App, AroundHelper, 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, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|
|
12858
|
+
export { AlignHelper, Answer, App, AroundHelper, 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, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|