@leafer-draw/worker 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/worker.cjs +38 -19
- package/dist/worker.esm.js +39 -20
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +214 -209
- 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 +231 -225
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +9 -9
package/dist/worker.js
CHANGED
|
@@ -119,6 +119,9 @@ var LeaferUI = function(exports) {
|
|
|
119
119
|
const {path: path} = this;
|
|
120
120
|
return path && path.length === 6 && path[0] === 1;
|
|
121
121
|
}
|
|
122
|
+
get __usePathBox() {
|
|
123
|
+
return this.__pathInputed;
|
|
124
|
+
}
|
|
122
125
|
get __blendMode() {
|
|
123
126
|
if (this.eraser && this.eraser !== "path") return "destination-out";
|
|
124
127
|
const {blendMode: blendMode} = this;
|
|
@@ -341,7 +344,7 @@ var LeaferUI = function(exports) {
|
|
|
341
344
|
};
|
|
342
345
|
}
|
|
343
346
|
const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
|
|
344
|
-
const {float: float$
|
|
347
|
+
const {float: float$2} = MathHelper;
|
|
345
348
|
const tempPoint$3 = {};
|
|
346
349
|
function getWorld() {
|
|
347
350
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
|
|
@@ -580,12 +583,12 @@ var LeaferUI = function(exports) {
|
|
|
580
583
|
const cosR = c / scaleY;
|
|
581
584
|
rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
|
|
582
585
|
}
|
|
583
|
-
const cosR = float$
|
|
586
|
+
const cosR = float$2(cos$5(rotation));
|
|
584
587
|
const sinR = sin$5(rotation);
|
|
585
|
-
scaleX = float$
|
|
586
|
-
skewX = cosR ? float$
|
|
587
|
-
skewY = cosR ? float$
|
|
588
|
-
rotation = float$
|
|
588
|
+
scaleX = float$2(scaleX), scaleY = float$2(scaleY);
|
|
589
|
+
skewX = cosR ? float$2((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
590
|
+
skewY = cosR ? float$2((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
591
|
+
rotation = float$2(rotation / OneRadian);
|
|
589
592
|
} else {
|
|
590
593
|
scaleX = a;
|
|
591
594
|
scaleY = d;
|
|
@@ -1080,10 +1083,10 @@ var LeaferUI = function(exports) {
|
|
|
1080
1083
|
toPoint$5(align, box, to, onlyBoxSize, content, onlyContentSize);
|
|
1081
1084
|
}
|
|
1082
1085
|
};
|
|
1083
|
-
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$
|
|
1086
|
+
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
1084
1087
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1085
|
-
const {float: float, fourNumber: fourNumber} = MathHelper;
|
|
1086
|
-
const {floor: floor$2, ceil: ceil$
|
|
1088
|
+
const {float: float$1, fourNumber: fourNumber} = MathHelper;
|
|
1089
|
+
const {floor: floor$2, ceil: ceil$2} = Math;
|
|
1087
1090
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
1088
1091
|
const point = {};
|
|
1089
1092
|
const toPoint$4 = {};
|
|
@@ -1207,7 +1210,7 @@ var LeaferUI = function(exports) {
|
|
|
1207
1210
|
point.x = t.x;
|
|
1208
1211
|
toOuterPoint$2(matrix, point, toPoint$4);
|
|
1209
1212
|
addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
|
|
1210
|
-
toBounds$
|
|
1213
|
+
toBounds$2(tempPointBounds$1, to);
|
|
1211
1214
|
}
|
|
1212
1215
|
},
|
|
1213
1216
|
toInnerOf(t, matrix, to) {
|
|
@@ -1245,8 +1248,8 @@ var LeaferUI = function(exports) {
|
|
|
1245
1248
|
const {x: x, y: y} = t;
|
|
1246
1249
|
t.x = floor$2(t.x);
|
|
1247
1250
|
t.y = floor$2(t.y);
|
|
1248
|
-
t.width = x > t.x ? ceil$
|
|
1249
|
-
t.height = y > t.y ? ceil$
|
|
1251
|
+
t.width = x > t.x ? ceil$2(t.width + x - t.x) : ceil$2(t.width);
|
|
1252
|
+
t.height = y > t.y ? ceil$2(t.height + y - t.y) : ceil$2(t.height);
|
|
1250
1253
|
},
|
|
1251
1254
|
unsign(t) {
|
|
1252
1255
|
if (t.width < 0) {
|
|
@@ -1259,10 +1262,10 @@ var LeaferUI = function(exports) {
|
|
|
1259
1262
|
}
|
|
1260
1263
|
},
|
|
1261
1264
|
float(t, maxLength) {
|
|
1262
|
-
t.x = float(t.x, maxLength);
|
|
1263
|
-
t.y = float(t.y, maxLength);
|
|
1264
|
-
t.width = float(t.width, maxLength);
|
|
1265
|
-
t.height = float(t.height, maxLength);
|
|
1265
|
+
t.x = float$1(t.x, maxLength);
|
|
1266
|
+
t.y = float$1(t.y, maxLength);
|
|
1267
|
+
t.width = float$1(t.width, maxLength);
|
|
1268
|
+
t.height = float$1(t.height, maxLength);
|
|
1266
1269
|
},
|
|
1267
1270
|
add(t, bounds, isPoint) {
|
|
1268
1271
|
right$1 = t.x + t.width;
|
|
@@ -1306,7 +1309,7 @@ var LeaferUI = function(exports) {
|
|
|
1306
1309
|
},
|
|
1307
1310
|
setPoints(t, points) {
|
|
1308
1311
|
points.forEach((point, index) => index === 0 ? setPoint$2(tempPointBounds$1, point.x, point.y) : addPoint$2(tempPointBounds$1, point.x, point.y));
|
|
1309
|
-
toBounds$
|
|
1312
|
+
toBounds$2(tempPointBounds$1, t);
|
|
1310
1313
|
},
|
|
1311
1314
|
setPoint(t, point) {
|
|
1312
1315
|
B.set(t, point.x, point.y);
|
|
@@ -2063,15 +2066,15 @@ var LeaferUI = function(exports) {
|
|
|
2063
2066
|
DataHelper.copyAttrs(s, size, canvasSizeAttrs);
|
|
2064
2067
|
canvasSizeAttrs.forEach(key => s[key] || (s[key] = 1));
|
|
2065
2068
|
this.bounds = new Bounds(0, 0, this.width, this.height);
|
|
2066
|
-
|
|
2067
|
-
this.updateViewSize();
|
|
2068
|
-
this.smooth = this.config.smooth;
|
|
2069
|
-
}
|
|
2069
|
+
this.updateViewSize();
|
|
2070
2070
|
this.updateClientBounds();
|
|
2071
|
-
if (this.context
|
|
2072
|
-
this.
|
|
2073
|
-
this.
|
|
2074
|
-
|
|
2071
|
+
if (this.context) {
|
|
2072
|
+
this.smooth = this.config.smooth;
|
|
2073
|
+
if (!this.unreal && takeCanvas) {
|
|
2074
|
+
this.clearWorld(takeCanvas.bounds);
|
|
2075
|
+
this.copyWorld(takeCanvas);
|
|
2076
|
+
takeCanvas.recycle();
|
|
2077
|
+
}
|
|
2075
2078
|
}
|
|
2076
2079
|
}
|
|
2077
2080
|
updateViewSize() {}
|
|
@@ -2372,7 +2375,7 @@ var LeaferUI = function(exports) {
|
|
|
2372
2375
|
data[0] ? drawer.arcTo(x, y, right, y, data[0]) : drawer.lineTo(x, y);
|
|
2373
2376
|
}
|
|
2374
2377
|
};
|
|
2375
|
-
const {sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil, abs: abs$2, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
|
|
2378
|
+
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;
|
|
2376
2379
|
const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
|
|
2377
2380
|
const {set: set, toNumberPoints: toNumberPoints} = PointHelper;
|
|
2378
2381
|
const {M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5} = PathCommandMap;
|
|
@@ -2438,9 +2441,11 @@ var LeaferUI = function(exports) {
|
|
|
2438
2441
|
const CBy = toY - y1;
|
|
2439
2442
|
let startRadian = atan2$1(BAy, BAx);
|
|
2440
2443
|
let endRadian = atan2$1(CBy, CBx);
|
|
2444
|
+
const lenBA = hypot(BAx, BAy);
|
|
2445
|
+
const lenCB = hypot(CBx, CBy);
|
|
2441
2446
|
let totalRadian = endRadian - startRadian;
|
|
2442
2447
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2443
|
-
if (
|
|
2448
|
+
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$2(totalRadian - PI$2) < 1e-12) {
|
|
2444
2449
|
if (data) data.push(L$6, x1, y1);
|
|
2445
2450
|
if (setPointBounds) {
|
|
2446
2451
|
setPoint$1(setPointBounds, fromX, fromY);
|
|
@@ -2473,7 +2478,7 @@ var LeaferUI = function(exports) {
|
|
|
2473
2478
|
let totalRadian = endRadian - startRadian;
|
|
2474
2479
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2475
2480
|
if (anticlockwise) totalRadian -= PI2;
|
|
2476
|
-
const parts = ceil(abs$2(totalRadian / PI_2));
|
|
2481
|
+
const parts = ceil$1(abs$2(totalRadian / PI_2));
|
|
2477
2482
|
const partRadian = totalRadian / parts;
|
|
2478
2483
|
const partRadian4Sin = sin$3(partRadian / 4);
|
|
2479
2484
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
|
|
@@ -3013,11 +3018,7 @@ var LeaferUI = function(exports) {
|
|
|
3013
3018
|
this.set(path);
|
|
3014
3019
|
}
|
|
3015
3020
|
set(path) {
|
|
3016
|
-
|
|
3017
|
-
this.__path = isString(path) ? PathHelper.parse(path) : path;
|
|
3018
|
-
} else {
|
|
3019
|
-
this.__path = [];
|
|
3020
|
-
}
|
|
3021
|
+
this.__path = path ? isString(path) ? PathHelper.parse(path) : path : [];
|
|
3021
3022
|
return this;
|
|
3022
3023
|
}
|
|
3023
3024
|
beginPath() {
|
|
@@ -3179,7 +3180,7 @@ var LeaferUI = function(exports) {
|
|
|
3179
3180
|
};
|
|
3180
3181
|
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: O, P: P, U: U} = PathCommandMap;
|
|
3181
3182
|
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
|
|
3182
|
-
const {addPointBounds: addPointBounds, copy: copy$6, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$
|
|
3183
|
+
const {addPointBounds: addPointBounds, copy: copy$6, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$1} = TwoPointBoundsHelper;
|
|
3183
3184
|
const debug$9 = Debug.get("PathBounds");
|
|
3184
3185
|
let radius, radiusX, radiusY;
|
|
3185
3186
|
const tempPointBounds = {};
|
|
@@ -3188,7 +3189,7 @@ var LeaferUI = function(exports) {
|
|
|
3188
3189
|
const PathBounds = {
|
|
3189
3190
|
toBounds(data, setBounds) {
|
|
3190
3191
|
PathBounds.toTwoPointBounds(data, setPointBounds);
|
|
3191
|
-
toBounds$
|
|
3192
|
+
toBounds$1(setPointBounds, setBounds);
|
|
3192
3193
|
},
|
|
3193
3194
|
toTwoPointBounds(data, setPointBounds) {
|
|
3194
3195
|
if (!data || !data.length) return setPoint(setPointBounds, 0, 0);
|
|
@@ -3370,10 +3371,13 @@ var LeaferUI = function(exports) {
|
|
|
3370
3371
|
return smooth;
|
|
3371
3372
|
}
|
|
3372
3373
|
};
|
|
3373
|
-
|
|
3374
|
+
function path(path) {
|
|
3375
|
+
return new PathCreator(path);
|
|
3376
|
+
}
|
|
3377
|
+
const pen = path();
|
|
3378
|
+
PathHelper.creator = path();
|
|
3374
3379
|
PathHelper.parse = PathConvert.parse;
|
|
3375
3380
|
PathHelper.convertToCanvasData = PathConvert.toCanvasData;
|
|
3376
|
-
const pen = new PathCreator;
|
|
3377
3381
|
const {drawRoundRect: drawRoundRect} = RectHelper;
|
|
3378
3382
|
function roundRect(drawer) {
|
|
3379
3383
|
if (drawer && !drawer.roundRect) {
|
|
@@ -3726,7 +3730,7 @@ var LeaferUI = function(exports) {
|
|
|
3726
3730
|
return FileHelper.alphaPixelTypes.some(item => I.isFormat(item, config));
|
|
3727
3731
|
},
|
|
3728
3732
|
isFormat(format, config) {
|
|
3729
|
-
if (config.format
|
|
3733
|
+
if (config.format) return config.format === format;
|
|
3730
3734
|
const {url: url} = config;
|
|
3731
3735
|
if (url.startsWith("data:")) {
|
|
3732
3736
|
if (url.startsWith("data:" + FileHelper.mineType(format))) return true;
|
|
@@ -3816,7 +3820,7 @@ var LeaferUI = function(exports) {
|
|
|
3816
3820
|
getFull(_filters) {
|
|
3817
3821
|
return this.view;
|
|
3818
3822
|
}
|
|
3819
|
-
getCanvas(width, height, opacity, _filters, xGap, yGap) {
|
|
3823
|
+
getCanvas(width, height, opacity, _filters, xGap, yGap, smooth) {
|
|
3820
3824
|
width || (width = this.width);
|
|
3821
3825
|
height || (height = this.height);
|
|
3822
3826
|
if (this.cache) {
|
|
@@ -3832,6 +3836,7 @@ var LeaferUI = function(exports) {
|
|
|
3832
3836
|
const canvas = Platform.origin.createCanvas(max$1(floor$1(width + (xGap || 0)), 1), max$1(floor$1(height + (yGap || 0)), 1));
|
|
3833
3837
|
const ctx = canvas.getContext("2d");
|
|
3834
3838
|
if (opacity) ctx.globalAlpha = opacity;
|
|
3839
|
+
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
3835
3840
|
ctx.drawImage(this.view, 0, 0, width, height);
|
|
3836
3841
|
this.cache = this.use > 1 ? {
|
|
3837
3842
|
data: canvas,
|
|
@@ -4431,8 +4436,9 @@ var LeaferUI = function(exports) {
|
|
|
4431
4436
|
};
|
|
4432
4437
|
const L = LeafHelper;
|
|
4433
4438
|
const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L;
|
|
4434
|
-
function getTempLocal(t,
|
|
4435
|
-
|
|
4439
|
+
function getTempLocal(t, worldPoint) {
|
|
4440
|
+
t.updateLayout();
|
|
4441
|
+
return t.parent ? PointHelper.tempToInnerOf(worldPoint, t.parent.scrollWorldTransform) : worldPoint;
|
|
4436
4442
|
}
|
|
4437
4443
|
const LeafBoundsHelper = {
|
|
4438
4444
|
worldBounds(target) {
|
|
@@ -5099,6 +5105,7 @@ var LeaferUI = function(exports) {
|
|
|
5099
5105
|
LeaferEvent.STOP = "leafer.stop";
|
|
5100
5106
|
LeaferEvent.RESTART = "leafer.restart";
|
|
5101
5107
|
LeaferEvent.END = "leafer.end";
|
|
5108
|
+
LeaferEvent.UPDATE_MODE = "leafer.update_mode";
|
|
5102
5109
|
LeaferEvent.TRANSFORM = "leafer.transform";
|
|
5103
5110
|
LeaferEvent.MOVE = "leafer.move";
|
|
5104
5111
|
LeaferEvent.SCALE = "leafer.scale";
|
|
@@ -5357,7 +5364,7 @@ var LeaferUI = function(exports) {
|
|
|
5357
5364
|
const {updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2} = LeafHelper;
|
|
5358
5365
|
const {updateBounds: updateBounds$1} = BranchHelper;
|
|
5359
5366
|
const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$3} = BoundsHelper;
|
|
5360
|
-
const {toBounds: toBounds
|
|
5367
|
+
const {toBounds: toBounds} = PathBounds;
|
|
5361
5368
|
const LeafBounds = {
|
|
5362
5369
|
__updateWorldBounds() {
|
|
5363
5370
|
const layout = this.__layout;
|
|
@@ -5428,8 +5435,8 @@ var LeaferUI = function(exports) {
|
|
|
5428
5435
|
__updateBoxBounds(_secondLayout, _bounds) {
|
|
5429
5436
|
const b = this.__layout.boxBounds;
|
|
5430
5437
|
const data = this.__;
|
|
5431
|
-
if (data.
|
|
5432
|
-
toBounds
|
|
5438
|
+
if (data.__usePathBox) {
|
|
5439
|
+
toBounds(data.path, b);
|
|
5433
5440
|
} else {
|
|
5434
5441
|
b.x = 0;
|
|
5435
5442
|
b.y = 0;
|
|
@@ -6344,7 +6351,7 @@ var LeaferUI = function(exports) {
|
|
|
6344
6351
|
this.levelMap = null;
|
|
6345
6352
|
}
|
|
6346
6353
|
}
|
|
6347
|
-
const version = "1.9.
|
|
6354
|
+
const version = "1.9.6";
|
|
6348
6355
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6349
6356
|
get allowBackgroundColor() {
|
|
6350
6357
|
return true;
|
|
@@ -6740,7 +6747,7 @@ var LeaferUI = function(exports) {
|
|
|
6740
6747
|
this.times = 0;
|
|
6741
6748
|
this.config = {
|
|
6742
6749
|
usePartRender: true,
|
|
6743
|
-
maxFPS:
|
|
6750
|
+
maxFPS: 120
|
|
6744
6751
|
};
|
|
6745
6752
|
this.target = target;
|
|
6746
6753
|
this.canvas = canvas;
|
|
@@ -6895,11 +6902,15 @@ var LeaferUI = function(exports) {
|
|
|
6895
6902
|
if (this.requestTime || !target) return;
|
|
6896
6903
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
6897
6904
|
const requestTime = this.requestTime = Date.now();
|
|
6898
|
-
|
|
6899
|
-
|
|
6905
|
+
const render = () => {
|
|
6906
|
+
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
6907
|
+
const {maxFPS: maxFPS} = this.config;
|
|
6908
|
+
if (maxFPS && nowFPS > maxFPS - .5) return Platform.requestRender(render);
|
|
6909
|
+
this.FPS = Math.min(120, Math.ceil(nowFPS));
|
|
6900
6910
|
this.requestTime = 0;
|
|
6901
6911
|
this.checkRender();
|
|
6902
|
-
}
|
|
6912
|
+
};
|
|
6913
|
+
Platform.requestRender(render);
|
|
6903
6914
|
}
|
|
6904
6915
|
__onResize(e) {
|
|
6905
6916
|
if (this.canvas.unreal) return;
|
|
@@ -6942,7 +6953,8 @@ var LeaferUI = function(exports) {
|
|
|
6942
6953
|
if (this.target) {
|
|
6943
6954
|
this.stop();
|
|
6944
6955
|
this.__removeListenEvents();
|
|
6945
|
-
this.
|
|
6956
|
+
this.config = {};
|
|
6957
|
+
this.target = this.canvas = null;
|
|
6946
6958
|
}
|
|
6947
6959
|
}
|
|
6948
6960
|
}
|
|
@@ -7219,7 +7231,11 @@ var LeaferUI = function(exports) {
|
|
|
7219
7231
|
}
|
|
7220
7232
|
}
|
|
7221
7233
|
class FrameData extends BoxData {}
|
|
7222
|
-
class LineData extends UIData {
|
|
7234
|
+
class LineData extends UIData {
|
|
7235
|
+
get __usePathBox() {
|
|
7236
|
+
return this.points || this.__pathInputed;
|
|
7237
|
+
}
|
|
7238
|
+
}
|
|
7223
7239
|
class RectData extends UIData {
|
|
7224
7240
|
get __boxStroke() {
|
|
7225
7241
|
return !this.__pathInputed;
|
|
@@ -7230,7 +7246,7 @@ var LeaferUI = function(exports) {
|
|
|
7230
7246
|
return !this.__pathInputed;
|
|
7231
7247
|
}
|
|
7232
7248
|
}
|
|
7233
|
-
class PolygonData extends
|
|
7249
|
+
class PolygonData extends LineData {}
|
|
7234
7250
|
class StarData extends UIData {}
|
|
7235
7251
|
class PathData extends UIData {
|
|
7236
7252
|
get __pathInputed() {
|
|
@@ -7269,8 +7285,6 @@ var LeaferUI = function(exports) {
|
|
|
7269
7285
|
if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
|
|
7270
7286
|
box.set(value);
|
|
7271
7287
|
if (boxLayout.strokeChanged) layout.strokeChange();
|
|
7272
|
-
if (boxLayout.renderChanged) layout.renderChange();
|
|
7273
|
-
box.__updateChange();
|
|
7274
7288
|
} else if (box) {
|
|
7275
7289
|
t.__box = box.parent = null;
|
|
7276
7290
|
box.destroy();
|
|
@@ -7337,7 +7351,7 @@ var LeaferUI = function(exports) {
|
|
|
7337
7351
|
__updateRenderSpread() {
|
|
7338
7352
|
let width = 0;
|
|
7339
7353
|
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
|
|
7340
|
-
if (shadow)
|
|
7354
|
+
if (shadow) width = Effect.getShadowSpread(this, shadow);
|
|
7341
7355
|
if (blur) width = Math.max(width, blur);
|
|
7342
7356
|
if (filter) width += Filter.getSpread(filter);
|
|
7343
7357
|
if (renderSpread) width += renderSpread;
|
|
@@ -7349,36 +7363,67 @@ var LeaferUI = function(exports) {
|
|
|
7349
7363
|
return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width;
|
|
7350
7364
|
}
|
|
7351
7365
|
};
|
|
7366
|
+
const {float: float} = MathHelper;
|
|
7367
|
+
const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
|
|
7352
7368
|
const DragBoundsHelper = {
|
|
7369
|
+
limitMove(leaf, move) {
|
|
7370
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7371
|
+
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
|
|
7372
|
+
D.axisMove(leaf, move);
|
|
7373
|
+
},
|
|
7374
|
+
limitScaleOf(leaf, origin, scale) {
|
|
7375
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7376
|
+
if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
|
|
7377
|
+
},
|
|
7378
|
+
axisMove(leaf, move) {
|
|
7379
|
+
const {draggable: draggable} = leaf;
|
|
7380
|
+
if (draggable === "x") move.y = 0;
|
|
7381
|
+
if (draggable === "y") move.x = 0;
|
|
7382
|
+
},
|
|
7383
|
+
getDragBounds(leaf) {
|
|
7384
|
+
const {dragBounds: dragBounds} = leaf;
|
|
7385
|
+
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
7386
|
+
},
|
|
7387
|
+
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
7388
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
7389
|
+
},
|
|
7353
7390
|
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
7354
7391
|
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
7355
7392
|
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
7356
7393
|
if (!change) move = Object.assign({}, move);
|
|
7357
|
-
|
|
7358
|
-
const isBiggerHeight = content.height > dragBounds.height;
|
|
7359
|
-
if (isBiggerWidth && dragBoundsType !== "outer") {
|
|
7394
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7360
7395
|
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
7361
7396
|
} else {
|
|
7362
7397
|
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
7363
7398
|
}
|
|
7364
|
-
if (
|
|
7399
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7365
7400
|
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
7366
7401
|
} else {
|
|
7367
7402
|
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
7368
7403
|
}
|
|
7369
|
-
move.x =
|
|
7370
|
-
move.y =
|
|
7404
|
+
move.x = float(move.x);
|
|
7405
|
+
move.y = float(move.y);
|
|
7371
7406
|
return move;
|
|
7372
7407
|
},
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7408
|
+
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
|
|
7409
|
+
if (!change) scale = Object.assign({}, scale);
|
|
7410
|
+
let fitScaleX, fitScaleY;
|
|
7411
|
+
tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
|
|
7412
|
+
tempMerge.set(tempContent).add(dragBounds);
|
|
7413
|
+
tempIntersect.set(tempContent).intersect(dragBounds);
|
|
7414
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7415
|
+
fitScaleX = tempMerge.width / tempContent.width;
|
|
7416
|
+
} else {
|
|
7417
|
+
fitScaleX = tempIntersect.width / tempContent.width;
|
|
7418
|
+
}
|
|
7419
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7420
|
+
fitScaleY = tempMerge.height / tempContent.height;
|
|
7421
|
+
} else {
|
|
7422
|
+
fitScaleY = tempIntersect.height / tempContent.height;
|
|
7423
|
+
}
|
|
7424
|
+
scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
7425
|
+
scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
7426
|
+
return scale;
|
|
7382
7427
|
}
|
|
7383
7428
|
};
|
|
7384
7429
|
const D = DragBoundsHelper;
|
|
@@ -7393,7 +7438,7 @@ var LeaferUI = function(exports) {
|
|
|
7393
7438
|
}
|
|
7394
7439
|
if (data.__useEffect) {
|
|
7395
7440
|
const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7396
|
-
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"));
|
|
7441
|
+
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"));
|
|
7397
7442
|
data.__useEffect = !!(shadow || otherEffect);
|
|
7398
7443
|
}
|
|
7399
7444
|
data.__checkSingle();
|
|
@@ -7524,20 +7569,9 @@ var LeaferUI = function(exports) {
|
|
|
7524
7569
|
if (!path) this.__drawPathByBox(pen);
|
|
7525
7570
|
return pen;
|
|
7526
7571
|
}
|
|
7527
|
-
constructor(data) {
|
|
7528
|
-
super(data);
|
|
7529
|
-
}
|
|
7530
7572
|
reset(_data) {}
|
|
7531
|
-
set(data,
|
|
7532
|
-
if (data)
|
|
7533
|
-
if (transition) {
|
|
7534
|
-
if (transition === "temp") {
|
|
7535
|
-
this.lockNormalStyle = true;
|
|
7536
|
-
Object.assign(this, data);
|
|
7537
|
-
this.lockNormalStyle = false;
|
|
7538
|
-
} else this.animate(data, transition);
|
|
7539
|
-
} else Object.assign(this, data);
|
|
7540
|
-
}
|
|
7573
|
+
set(data, _transition) {
|
|
7574
|
+
if (data) Object.assign(this, data);
|
|
7541
7575
|
}
|
|
7542
7576
|
get(name) {
|
|
7543
7577
|
return isString(name) ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
@@ -7583,7 +7617,7 @@ var LeaferUI = function(exports) {
|
|
|
7583
7617
|
const data = this.__;
|
|
7584
7618
|
if (data.path) {
|
|
7585
7619
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
7586
|
-
if (data.__useArrow) PathArrow.addArrows(this
|
|
7620
|
+
if (data.__useArrow) PathArrow.addArrows(this);
|
|
7587
7621
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
7588
7622
|
}
|
|
7589
7623
|
__drawRenderPath(canvas) {
|
|
@@ -7607,7 +7641,8 @@ var LeaferUI = function(exports) {
|
|
|
7607
7641
|
drawImagePlaceholder(canvas, _image) {
|
|
7608
7642
|
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7609
7643
|
}
|
|
7610
|
-
animate(
|
|
7644
|
+
animate(keyframe, _options, _type, _isTemp) {
|
|
7645
|
+
this.set(keyframe);
|
|
7611
7646
|
return Plugin.need("animate");
|
|
7612
7647
|
}
|
|
7613
7648
|
killAnimate(_type, _nextStyle) {}
|
|
@@ -7721,9 +7756,6 @@ var LeaferUI = function(exports) {
|
|
|
7721
7756
|
get isBranch() {
|
|
7722
7757
|
return true;
|
|
7723
7758
|
}
|
|
7724
|
-
constructor(data) {
|
|
7725
|
-
super(data);
|
|
7726
|
-
}
|
|
7727
7759
|
reset(data) {
|
|
7728
7760
|
this.__setBranch();
|
|
7729
7761
|
super.reset(data);
|
|
@@ -7841,7 +7873,7 @@ var LeaferUI = function(exports) {
|
|
|
7841
7873
|
const canvas = this.canvas = Creator.canvas(config);
|
|
7842
7874
|
this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
|
|
7843
7875
|
if (this.isApp) this.__setApp();
|
|
7844
|
-
this.__checkAutoLayout(
|
|
7876
|
+
this.__checkAutoLayout();
|
|
7845
7877
|
this.view = canvas.view;
|
|
7846
7878
|
if (!parentApp) {
|
|
7847
7879
|
this.selector = Creator.selector(this);
|
|
@@ -7940,7 +7972,8 @@ var LeaferUI = function(exports) {
|
|
|
7940
7972
|
this.leafer = leafer;
|
|
7941
7973
|
this.__level = 1;
|
|
7942
7974
|
}
|
|
7943
|
-
__checkAutoLayout(
|
|
7975
|
+
__checkAutoLayout() {
|
|
7976
|
+
const {config: config, parentApp: parentApp} = this;
|
|
7944
7977
|
if (!parentApp) {
|
|
7945
7978
|
if (!config.width || !config.height) this.autoLayout = new AutoBounds(config);
|
|
7946
7979
|
this.canvas.startAutoLayout(this.autoLayout, this.__onResize.bind(this));
|
|
@@ -7957,7 +7990,9 @@ var LeaferUI = function(exports) {
|
|
|
7957
7990
|
} else if (attrName === "zIndex") {
|
|
7958
7991
|
this.canvas.zIndex = newValue;
|
|
7959
7992
|
setTimeout(() => this.parent && this.parent.__updateSortChildren());
|
|
7960
|
-
}
|
|
7993
|
+
} else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
|
|
7994
|
+
mode: newValue
|
|
7995
|
+
});
|
|
7961
7996
|
}
|
|
7962
7997
|
return super.__setAttr(attrName, newValue);
|
|
7963
7998
|
}
|
|
@@ -7966,9 +8001,10 @@ var LeaferUI = function(exports) {
|
|
|
7966
8001
|
return super.__getAttr(attrName);
|
|
7967
8002
|
}
|
|
7968
8003
|
__changeCanvasSize(attrName, newValue) {
|
|
7969
|
-
const
|
|
7970
|
-
data
|
|
7971
|
-
|
|
8004
|
+
const {config: config, canvas: canvas} = this;
|
|
8005
|
+
const data = DataHelper.copyAttrs({}, canvas, canvasSizeAttrs);
|
|
8006
|
+
data[attrName] = config[attrName] = newValue;
|
|
8007
|
+
config.width && config.height ? canvas.stopAutoLayout() : this.__checkAutoLayout();
|
|
7972
8008
|
this.__doResize(data);
|
|
7973
8009
|
}
|
|
7974
8010
|
__changeFill(newValue) {
|
|
@@ -8115,9 +8151,9 @@ var LeaferUI = function(exports) {
|
|
|
8115
8151
|
if (!this.parent) {
|
|
8116
8152
|
if (this.selector) this.selector.destroy();
|
|
8117
8153
|
if (this.hitCanvasManager) this.hitCanvasManager.destroy();
|
|
8118
|
-
this.canvasManager.destroy();
|
|
8154
|
+
if (this.canvasManager) this.canvasManager.destroy();
|
|
8119
8155
|
}
|
|
8120
|
-
this.canvas.destroy();
|
|
8156
|
+
if (this.canvas) this.canvas.destroy();
|
|
8121
8157
|
this.config.view = this.view = this.parentApp = null;
|
|
8122
8158
|
if (this.userConfig) this.userConfig.view = null;
|
|
8123
8159
|
super.destroy();
|
|
@@ -8135,14 +8171,12 @@ var LeaferUI = function(exports) {
|
|
|
8135
8171
|
exports.Leafer.list = new LeafList;
|
|
8136
8172
|
__decorate([ dataProcessor(LeaferData) ], exports.Leafer.prototype, "__", void 0);
|
|
8137
8173
|
__decorate([ boundsType() ], exports.Leafer.prototype, "pixelRatio", void 0);
|
|
8174
|
+
__decorate([ dataType("normal") ], exports.Leafer.prototype, "mode", void 0);
|
|
8138
8175
|
exports.Leafer = Leafer_1 = __decorate([ registerUI() ], exports.Leafer);
|
|
8139
8176
|
exports.Rect = class Rect extends exports.UI {
|
|
8140
8177
|
get __tag() {
|
|
8141
8178
|
return "Rect";
|
|
8142
8179
|
}
|
|
8143
|
-
constructor(data) {
|
|
8144
|
-
super(data);
|
|
8145
|
-
}
|
|
8146
8180
|
};
|
|
8147
8181
|
__decorate([ dataProcessor(RectData) ], exports.Rect.prototype, "__", void 0);
|
|
8148
8182
|
exports.Rect = __decorate([ useModule(RectRender), rewriteAble(), registerUI() ], exports.Rect);
|
|
@@ -8254,9 +8288,6 @@ var LeaferUI = function(exports) {
|
|
|
8254
8288
|
get isFrame() {
|
|
8255
8289
|
return true;
|
|
8256
8290
|
}
|
|
8257
|
-
constructor(data) {
|
|
8258
|
-
super(data);
|
|
8259
|
-
}
|
|
8260
8291
|
};
|
|
8261
8292
|
__decorate([ dataProcessor(FrameData) ], exports.Frame.prototype, "__", void 0);
|
|
8262
8293
|
__decorate([ surfaceType("#FFFFFF") ], exports.Frame.prototype, "fill", void 0);
|
|
@@ -8267,9 +8298,6 @@ var LeaferUI = function(exports) {
|
|
|
8267
8298
|
get __tag() {
|
|
8268
8299
|
return "Ellipse";
|
|
8269
8300
|
}
|
|
8270
|
-
constructor(data) {
|
|
8271
|
-
super(data);
|
|
8272
|
-
}
|
|
8273
8301
|
__updatePath() {
|
|
8274
8302
|
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
|
|
8275
8303
|
const rx = width / 2, ry = height / 2;
|
|
@@ -8303,108 +8331,46 @@ var LeaferUI = function(exports) {
|
|
|
8303
8331
|
__decorate([ pathType(0) ], exports.Ellipse.prototype, "startAngle", void 0);
|
|
8304
8332
|
__decorate([ pathType(0) ], exports.Ellipse.prototype, "endAngle", void 0);
|
|
8305
8333
|
exports.Ellipse = __decorate([ registerUI() ], exports.Ellipse);
|
|
8306
|
-
const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
8307
|
-
const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
|
|
8308
|
-
const {toBounds: toBounds} = PathBounds;
|
|
8309
|
-
exports.Line = class Line extends exports.UI {
|
|
8310
|
-
get __tag() {
|
|
8311
|
-
return "Line";
|
|
8312
|
-
}
|
|
8313
|
-
get toPoint() {
|
|
8314
|
-
const {width: width, rotation: rotation} = this.__;
|
|
8315
|
-
const to = getPointData();
|
|
8316
|
-
if (width) to.x = width;
|
|
8317
|
-
if (rotation) rotate$1(to, rotation);
|
|
8318
|
-
return to;
|
|
8319
|
-
}
|
|
8320
|
-
set toPoint(value) {
|
|
8321
|
-
this.width = getDistance$2(defaultPoint, value);
|
|
8322
|
-
this.rotation = getAngle$1(defaultPoint, value);
|
|
8323
|
-
if (this.height) this.height = 0;
|
|
8324
|
-
}
|
|
8325
|
-
constructor(data) {
|
|
8326
|
-
super(data);
|
|
8327
|
-
}
|
|
8328
|
-
__updatePath() {
|
|
8329
|
-
const data = this.__;
|
|
8330
|
-
const path = data.path = [];
|
|
8331
|
-
if (data.points) {
|
|
8332
|
-
drawPoints$1(path, data.points, false, data.closed);
|
|
8333
|
-
} else {
|
|
8334
|
-
moveTo$2(path, 0, 0);
|
|
8335
|
-
lineTo$2(path, this.width, 0);
|
|
8336
|
-
}
|
|
8337
|
-
}
|
|
8338
|
-
__updateRenderPath() {
|
|
8339
|
-
const data = this.__;
|
|
8340
|
-
if (!this.pathInputed && data.points && data.curve) {
|
|
8341
|
-
drawPoints$1(data.__pathForRender = [], data.points, data.curve, data.closed);
|
|
8342
|
-
if (data.__useArrow) PathArrow.addArrows(this, false);
|
|
8343
|
-
} else super.__updateRenderPath();
|
|
8344
|
-
}
|
|
8345
|
-
__updateBoxBounds() {
|
|
8346
|
-
if (this.points) {
|
|
8347
|
-
toBounds(this.__.__pathForRender, this.__layout.boxBounds);
|
|
8348
|
-
} else super.__updateBoxBounds();
|
|
8349
|
-
}
|
|
8350
|
-
};
|
|
8351
|
-
__decorate([ dataProcessor(LineData) ], exports.Line.prototype, "__", void 0);
|
|
8352
|
-
__decorate([ affectStrokeBoundsType("center") ], exports.Line.prototype, "strokeAlign", void 0);
|
|
8353
|
-
__decorate([ boundsType(0) ], exports.Line.prototype, "height", void 0);
|
|
8354
|
-
__decorate([ pathType() ], exports.Line.prototype, "points", void 0);
|
|
8355
|
-
__decorate([ pathType(0) ], exports.Line.prototype, "curve", void 0);
|
|
8356
|
-
__decorate([ pathType(false) ], exports.Line.prototype, "closed", void 0);
|
|
8357
|
-
exports.Line = __decorate([ registerUI() ], exports.Line);
|
|
8358
8334
|
const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
|
|
8359
|
-
const {moveTo: moveTo$
|
|
8360
|
-
const line = exports.Line.prototype;
|
|
8335
|
+
const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
8361
8336
|
exports.Polygon = class Polygon extends exports.UI {
|
|
8362
8337
|
get __tag() {
|
|
8363
8338
|
return "Polygon";
|
|
8364
8339
|
}
|
|
8365
|
-
constructor(data) {
|
|
8366
|
-
super(data);
|
|
8367
|
-
}
|
|
8368
8340
|
__updatePath() {
|
|
8369
|
-
const
|
|
8370
|
-
|
|
8371
|
-
|
|
8341
|
+
const data = this.__;
|
|
8342
|
+
const path = data.path = [];
|
|
8343
|
+
if (data.points) {
|
|
8344
|
+
drawPoints$1(path, data.points, data.curve, true);
|
|
8372
8345
|
} else {
|
|
8373
|
-
const {width: width, height: height, sides: sides} =
|
|
8346
|
+
const {width: width, height: height, sides: sides} = data;
|
|
8374
8347
|
const rx = width / 2, ry = height / 2;
|
|
8375
|
-
moveTo$
|
|
8348
|
+
moveTo$2(path, rx, 0);
|
|
8376
8349
|
for (let i = 1; i < sides; i++) {
|
|
8377
|
-
lineTo$
|
|
8350
|
+
lineTo$2(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
|
|
8378
8351
|
}
|
|
8379
8352
|
closePath$1(path);
|
|
8380
8353
|
}
|
|
8381
8354
|
}
|
|
8382
|
-
__updateRenderPath() {}
|
|
8383
|
-
__updateBoxBounds() {}
|
|
8384
8355
|
};
|
|
8385
8356
|
__decorate([ dataProcessor(PolygonData) ], exports.Polygon.prototype, "__", void 0);
|
|
8386
8357
|
__decorate([ pathType(3) ], exports.Polygon.prototype, "sides", void 0);
|
|
8387
8358
|
__decorate([ pathType() ], exports.Polygon.prototype, "points", void 0);
|
|
8388
8359
|
__decorate([ pathType(0) ], exports.Polygon.prototype, "curve", void 0);
|
|
8389
|
-
__decorate([ rewrite(line.__updateRenderPath) ], exports.Polygon.prototype, "__updateRenderPath", null);
|
|
8390
|
-
__decorate([ rewrite(line.__updateBoxBounds) ], exports.Polygon.prototype, "__updateBoxBounds", null);
|
|
8391
8360
|
exports.Polygon = __decorate([ rewriteAble(), registerUI() ], exports.Polygon);
|
|
8392
8361
|
const {sin: sin, cos: cos, PI: PI} = Math;
|
|
8393
|
-
const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
|
|
8362
|
+
const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
|
|
8394
8363
|
exports.Star = class Star extends exports.UI {
|
|
8395
8364
|
get __tag() {
|
|
8396
8365
|
return "Star";
|
|
8397
8366
|
}
|
|
8398
|
-
constructor(data) {
|
|
8399
|
-
super(data);
|
|
8400
|
-
}
|
|
8401
8367
|
__updatePath() {
|
|
8402
8368
|
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
8403
8369
|
const rx = width / 2, ry = height / 2;
|
|
8404
8370
|
const path = this.__.path = [];
|
|
8405
|
-
moveTo(path, rx, 0);
|
|
8371
|
+
moveTo$1(path, rx, 0);
|
|
8406
8372
|
for (let i = 1; i < corners * 2; i++) {
|
|
8407
|
-
lineTo(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
|
|
8373
|
+
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));
|
|
8408
8374
|
}
|
|
8409
8375
|
closePath(path);
|
|
8410
8376
|
}
|
|
@@ -8413,6 +8379,42 @@ var LeaferUI = function(exports) {
|
|
|
8413
8379
|
__decorate([ pathType(5) ], exports.Star.prototype, "corners", void 0);
|
|
8414
8380
|
__decorate([ pathType(.382) ], exports.Star.prototype, "innerRadius", void 0);
|
|
8415
8381
|
exports.Star = __decorate([ registerUI() ], exports.Star);
|
|
8382
|
+
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
8383
|
+
const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
|
|
8384
|
+
exports.Line = class Line extends exports.UI {
|
|
8385
|
+
get __tag() {
|
|
8386
|
+
return "Line";
|
|
8387
|
+
}
|
|
8388
|
+
get toPoint() {
|
|
8389
|
+
const {width: width, rotation: rotation} = this.__;
|
|
8390
|
+
const to = getPointData();
|
|
8391
|
+
if (width) to.x = width;
|
|
8392
|
+
if (rotation) rotate$1(to, rotation);
|
|
8393
|
+
return to;
|
|
8394
|
+
}
|
|
8395
|
+
set toPoint(value) {
|
|
8396
|
+
this.width = getDistance$2(defaultPoint, value);
|
|
8397
|
+
this.rotation = getAngle$1(defaultPoint, value);
|
|
8398
|
+
if (this.height) this.height = 0;
|
|
8399
|
+
}
|
|
8400
|
+
__updatePath() {
|
|
8401
|
+
const data = this.__;
|
|
8402
|
+
const path = data.path = [];
|
|
8403
|
+
if (data.points) {
|
|
8404
|
+
drawPoints(path, data.points, data.curve, data.closed);
|
|
8405
|
+
} else {
|
|
8406
|
+
moveTo(path, 0, 0);
|
|
8407
|
+
lineTo(path, this.width, 0);
|
|
8408
|
+
}
|
|
8409
|
+
}
|
|
8410
|
+
};
|
|
8411
|
+
__decorate([ dataProcessor(LineData) ], exports.Line.prototype, "__", void 0);
|
|
8412
|
+
__decorate([ affectStrokeBoundsType("center") ], exports.Line.prototype, "strokeAlign", void 0);
|
|
8413
|
+
__decorate([ boundsType(0) ], exports.Line.prototype, "height", void 0);
|
|
8414
|
+
__decorate([ pathType() ], exports.Line.prototype, "points", void 0);
|
|
8415
|
+
__decorate([ pathType(0) ], exports.Line.prototype, "curve", void 0);
|
|
8416
|
+
__decorate([ pathType(false) ], exports.Line.prototype, "closed", void 0);
|
|
8417
|
+
exports.Line = __decorate([ registerUI() ], exports.Line);
|
|
8416
8418
|
exports.Image = class Image extends exports.Rect {
|
|
8417
8419
|
get __tag() {
|
|
8418
8420
|
return "Image";
|
|
@@ -8425,9 +8427,6 @@ var LeaferUI = function(exports) {
|
|
|
8425
8427
|
const {fill: fill} = this.__;
|
|
8426
8428
|
return isArray(fill) && fill[0].image;
|
|
8427
8429
|
}
|
|
8428
|
-
constructor(data) {
|
|
8429
|
-
super(data);
|
|
8430
|
-
}
|
|
8431
8430
|
};
|
|
8432
8431
|
__decorate([ dataProcessor(ImageData) ], exports.Image.prototype, "__", void 0);
|
|
8433
8432
|
__decorate([ boundsType("") ], exports.Image.prototype, "url", void 0);
|
|
@@ -8512,9 +8511,6 @@ var LeaferUI = function(exports) {
|
|
|
8512
8511
|
this.updateLayout();
|
|
8513
8512
|
return this.__.__textDrawData;
|
|
8514
8513
|
}
|
|
8515
|
-
constructor(data) {
|
|
8516
|
-
super(data);
|
|
8517
|
-
}
|
|
8518
8514
|
__updateTextDrawData() {
|
|
8519
8515
|
const data = this.__;
|
|
8520
8516
|
const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding} = data;
|
|
@@ -8551,10 +8547,6 @@ var LeaferUI = function(exports) {
|
|
|
8551
8547
|
DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
|
|
8552
8548
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
8553
8549
|
}
|
|
8554
|
-
__onUpdateSize() {
|
|
8555
|
-
if (this.__box) this.__box.__onUpdateSize();
|
|
8556
|
-
super.__onUpdateSize();
|
|
8557
|
-
}
|
|
8558
8550
|
__updateRenderSpread() {
|
|
8559
8551
|
let width = super.__updateRenderSpread();
|
|
8560
8552
|
if (!width) width = this.isOverflow ? 1 : 0;
|
|
@@ -8565,6 +8557,11 @@ var LeaferUI = function(exports) {
|
|
|
8565
8557
|
copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
8566
8558
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
8567
8559
|
}
|
|
8560
|
+
__updateChange() {
|
|
8561
|
+
super.__updateChange();
|
|
8562
|
+
const box = this.__box;
|
|
8563
|
+
if (box) box.__onUpdateSize(), box.__updateChange();
|
|
8564
|
+
}
|
|
8568
8565
|
__drawRenderPath(canvas) {
|
|
8569
8566
|
canvas.font = this.__.__font;
|
|
8570
8567
|
}
|
|
@@ -8618,9 +8615,6 @@ var LeaferUI = function(exports) {
|
|
|
8618
8615
|
get __tag() {
|
|
8619
8616
|
return "Path";
|
|
8620
8617
|
}
|
|
8621
|
-
constructor(data) {
|
|
8622
|
-
super(data);
|
|
8623
|
-
}
|
|
8624
8618
|
};
|
|
8625
8619
|
__decorate([ dataProcessor(PathData) ], exports.Path.prototype, "__", void 0);
|
|
8626
8620
|
__decorate([ affectStrokeBoundsType("center") ], exports.Path.prototype, "strokeAlign", void 0);
|
|
@@ -8629,9 +8623,6 @@ var LeaferUI = function(exports) {
|
|
|
8629
8623
|
get __tag() {
|
|
8630
8624
|
return "Pen";
|
|
8631
8625
|
}
|
|
8632
|
-
constructor(data) {
|
|
8633
|
-
super(data);
|
|
8634
|
-
}
|
|
8635
8626
|
setStyle(data) {
|
|
8636
8627
|
const path = this.pathElement = new exports.Path(data);
|
|
8637
8628
|
this.pathStyle = data;
|
|
@@ -9277,7 +9268,7 @@ var LeaferUI = function(exports) {
|
|
|
9277
9268
|
if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
|
|
9278
9269
|
}
|
|
9279
9270
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
9280
|
-
const {floor: floor, max: max, abs: abs} = Math;
|
|
9271
|
+
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
9281
9272
|
function createPattern(ui, paint, pixelRatio) {
|
|
9282
9273
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
9283
9274
|
const id = scaleX + "-" + scaleY + "-" + pixelRatio;
|
|
@@ -9286,8 +9277,6 @@ var LeaferUI = function(exports) {
|
|
|
9286
9277
|
let imageScale, imageMatrix, {width: width, height: height, scaleX: sx, scaleY: sy, transform: transform, repeat: repeat, gap: gap} = data;
|
|
9287
9278
|
scaleX *= pixelRatio;
|
|
9288
9279
|
scaleY *= pixelRatio;
|
|
9289
|
-
const xGap = gap && gap.x * scaleX;
|
|
9290
|
-
const yGap = gap && gap.y * scaleY;
|
|
9291
9280
|
if (sx) {
|
|
9292
9281
|
sx = abs(sx);
|
|
9293
9282
|
sy = abs(sy);
|
|
@@ -9304,7 +9293,10 @@ var LeaferUI = function(exports) {
|
|
|
9304
9293
|
if (size > Platform.image.maxCacheSize) return false;
|
|
9305
9294
|
}
|
|
9306
9295
|
let maxSize = Platform.image.maxPatternSize;
|
|
9307
|
-
if (
|
|
9296
|
+
if (image.isSVG) {
|
|
9297
|
+
const ws = width / image.width;
|
|
9298
|
+
if (ws > 1) imageScale = ws / ceil(ws);
|
|
9299
|
+
} else {
|
|
9308
9300
|
const imageSize = image.width * image.height;
|
|
9309
9301
|
if (maxSize > imageSize) maxSize = imageSize;
|
|
9310
9302
|
}
|
|
@@ -9319,18 +9311,20 @@ var LeaferUI = function(exports) {
|
|
|
9319
9311
|
scaleX /= sx;
|
|
9320
9312
|
scaleY /= sy;
|
|
9321
9313
|
}
|
|
9314
|
+
const xGap = gap && gap.x * scaleX;
|
|
9315
|
+
const yGap = gap && gap.y * scaleY;
|
|
9322
9316
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
9317
|
+
const canvasWidth = width + (xGap || 0);
|
|
9318
|
+
const canvasHeight = height + (yGap || 0);
|
|
9319
|
+
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
9320
|
+
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
9323
9321
|
if (!imageMatrix) {
|
|
9324
9322
|
imageMatrix = get$1();
|
|
9325
9323
|
if (transform) copy$1(imageMatrix, transform);
|
|
9326
9324
|
}
|
|
9327
9325
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
9328
9326
|
}
|
|
9329
|
-
|
|
9330
|
-
const canvasWidth = width + (xGap || 0), canvasHeight = height + (yGap || 0);
|
|
9331
|
-
scale(imageMatrix, canvasWidth / max(floor(canvasWidth), 1), canvasHeight / max(floor(canvasHeight), 1));
|
|
9332
|
-
}
|
|
9333
|
-
const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap);
|
|
9327
|
+
const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
|
|
9334
9328
|
const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
9335
9329
|
paint.style = pattern;
|
|
9336
9330
|
paint.patternId = id;
|
|
@@ -9546,11 +9540,16 @@ var LeaferUI = function(exports) {
|
|
|
9546
9540
|
}
|
|
9547
9541
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
9548
9542
|
}
|
|
9549
|
-
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
9543
|
+
if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
9550
9544
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
9551
9545
|
});
|
|
9552
9546
|
other.recycle(copyBounds);
|
|
9553
9547
|
}
|
|
9548
|
+
function getShadowSpread(_ui, shadow) {
|
|
9549
|
+
let width = 0;
|
|
9550
|
+
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));
|
|
9551
|
+
return width;
|
|
9552
|
+
}
|
|
9554
9553
|
function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
|
|
9555
9554
|
const {bounds: bounds, shapeBounds: shapeBounds} = shape;
|
|
9556
9555
|
if (Platform.fullImageShadow) {
|
|
@@ -9622,7 +9621,11 @@ var LeaferUI = function(exports) {
|
|
|
9622
9621
|
shadow: shadow,
|
|
9623
9622
|
innerShadow: innerShadow,
|
|
9624
9623
|
blur: blur,
|
|
9625
|
-
backgroundBlur: backgroundBlur
|
|
9624
|
+
backgroundBlur: backgroundBlur,
|
|
9625
|
+
getShadowSpread: getShadowSpread,
|
|
9626
|
+
isTransformShadow(_shadow) {
|
|
9627
|
+
return undefined;
|
|
9628
|
+
}
|
|
9626
9629
|
};
|
|
9627
9630
|
const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
|
|
9628
9631
|
let usedGrayscaleAlpha;
|
|
@@ -10078,16 +10081,17 @@ var LeaferUI = function(exports) {
|
|
|
10078
10081
|
row.data = null;
|
|
10079
10082
|
}
|
|
10080
10083
|
function decorationText(drawData, style) {
|
|
10081
|
-
let type;
|
|
10084
|
+
let type, offset = 0;
|
|
10082
10085
|
const {fontSize: fontSize, textDecoration: textDecoration} = style;
|
|
10083
10086
|
drawData.decorationHeight = fontSize / 11;
|
|
10084
10087
|
if (isObject(textDecoration)) {
|
|
10085
10088
|
type = textDecoration.type;
|
|
10086
10089
|
if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
|
|
10090
|
+
if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
|
|
10087
10091
|
} else type = textDecoration;
|
|
10088
10092
|
switch (type) {
|
|
10089
10093
|
case "under":
|
|
10090
|
-
drawData.decorationY = [ fontSize * .15 ];
|
|
10094
|
+
drawData.decorationY = [ fontSize * .15 + offset ];
|
|
10091
10095
|
break;
|
|
10092
10096
|
|
|
10093
10097
|
case "delete":
|
|
@@ -10095,7 +10099,7 @@ var LeaferUI = function(exports) {
|
|
|
10095
10099
|
break;
|
|
10096
10100
|
|
|
10097
10101
|
case "under-delete":
|
|
10098
|
-
drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
|
|
10102
|
+
drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
|
|
10099
10103
|
}
|
|
10100
10104
|
}
|
|
10101
10105
|
const {top: top, right: right, bottom: bottom, left: left} = exports.Direction4;
|
|
@@ -10326,6 +10330,7 @@ var LeaferUI = function(exports) {
|
|
|
10326
10330
|
exports.maskType = maskType;
|
|
10327
10331
|
exports.naturalBoundsType = naturalBoundsType;
|
|
10328
10332
|
exports.opacityType = opacityType;
|
|
10333
|
+
exports.path = path;
|
|
10329
10334
|
exports.pathInputType = pathInputType;
|
|
10330
10335
|
exports.pathType = pathType;
|
|
10331
10336
|
exports.pen = pen;
|