@leafer/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.js +277 -234
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +295 -250
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +22 -22
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$6, cos: cos$6, acos: acos, sqrt: sqrt$5} = Math;
|
|
344
|
-
const {float: float$
|
|
347
|
+
const {float: float$3} = MathHelper;
|
|
345
348
|
const tempPoint$4 = {};
|
|
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$3(cos$6(rotation));
|
|
584
587
|
const sinR = sin$6(rotation);
|
|
585
|
-
scaleX = float$
|
|
586
|
-
skewX = cosR ? float$
|
|
587
|
-
skewY = cosR ? float$
|
|
588
|
-
rotation = float$
|
|
588
|
+
scaleX = float$3(scaleX), scaleY = float$3(scaleY);
|
|
589
|
+
skewX = cosR ? float$3((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
590
|
+
skewY = cosR ? float$3((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
591
|
+
rotation = float$3(rotation / OneRadian);
|
|
589
592
|
} else {
|
|
590
593
|
scaleX = a;
|
|
591
594
|
scaleY = d;
|
|
@@ -1080,10 +1083,10 @@ var LeaferUI = function(exports) {
|
|
|
1080
1083
|
toPoint$6(align, box, to, onlyBoxSize, content, onlyContentSize);
|
|
1081
1084
|
}
|
|
1082
1085
|
};
|
|
1083
|
-
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPoint$3, toBounds: toBounds$
|
|
1086
|
+
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPoint$3, toBounds: toBounds$3} = TwoPointBoundsHelper;
|
|
1084
1087
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1085
|
-
const {float: float$
|
|
1086
|
-
const {floor: floor$3, ceil: ceil$
|
|
1088
|
+
const {float: float$2, fourNumber: fourNumber$1} = MathHelper;
|
|
1089
|
+
const {floor: floor$3, ceil: ceil$3} = Math;
|
|
1087
1090
|
let right$4, bottom$3, boundsRight, boundsBottom;
|
|
1088
1091
|
const point$2 = {};
|
|
1089
1092
|
const toPoint$5 = {};
|
|
@@ -1207,7 +1210,7 @@ var LeaferUI = function(exports) {
|
|
|
1207
1210
|
point$2.x = t.x;
|
|
1208
1211
|
toOuterPoint$2(matrix, point$2, toPoint$5);
|
|
1209
1212
|
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
1210
|
-
toBounds$
|
|
1213
|
+
toBounds$3(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$3(t.x);
|
|
1247
1250
|
t.y = floor$3(t.y);
|
|
1248
|
-
t.width = x > t.x ? ceil$
|
|
1249
|
-
t.height = y > t.y ? ceil$
|
|
1251
|
+
t.width = x > t.x ? ceil$3(t.width + x - t.x) : ceil$3(t.width);
|
|
1252
|
+
t.height = y > t.y ? ceil$3(t.height + y - t.y) : ceil$3(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$
|
|
1263
|
-
t.y = float$
|
|
1264
|
-
t.width = float$
|
|
1265
|
-
t.height = float$
|
|
1265
|
+
t.x = float$2(t.x, maxLength);
|
|
1266
|
+
t.y = float$2(t.y, maxLength);
|
|
1267
|
+
t.width = float$2(t.width, maxLength);
|
|
1268
|
+
t.height = float$2(t.height, maxLength);
|
|
1266
1269
|
},
|
|
1267
1270
|
add(t, bounds, isPoint) {
|
|
1268
1271
|
right$4 = 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$5(tempPointBounds$1, point.x, point.y) : addPoint$3(tempPointBounds$1, point.x, point.y));
|
|
1309
|
-
toBounds$
|
|
1312
|
+
toBounds$3(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$4, cos: cos$4, atan2: atan2$1, ceil: ceil$
|
|
2378
|
+
const {sin: sin$4, cos: cos$4, hypot: hypot, atan2: atan2$1, ceil: ceil$2, abs: abs$6, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
|
|
2376
2379
|
const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
|
|
2377
2380
|
const {set: set, toNumberPoints: toNumberPoints$1} = PointHelper;
|
|
2378
2381
|
const {M: M$9, L: L$a, C: C$8, Q: Q$7, Z: Z$8} = 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$6(totalRadian - PI$3) < 1e-12) {
|
|
2444
2449
|
if (data) data.push(L$a, x1, y1);
|
|
2445
2450
|
if (setPointBounds) {
|
|
2446
2451
|
setPoint$4(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$
|
|
2481
|
+
const parts = ceil$2(abs$6(totalRadian / PI_2));
|
|
2477
2482
|
const partRadian = totalRadian / parts;
|
|
2478
2483
|
const partRadian4Sin = sin$4(partRadian / 4);
|
|
2479
2484
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$4(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$5, L: L$6, C: C$4, Q: Q$3, Z: Z$4, N: N$2, D: D$3, X: X$2, G: G$2, F: F$3, O: O$3, P: P$2, U: U$2} = PathCommandMap;
|
|
3181
3182
|
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
|
|
3182
|
-
const {addPointBounds: addPointBounds, copy: copy$a, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$
|
|
3183
|
+
const {addPointBounds: addPointBounds, copy: copy$a, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
3183
3184
|
const debug$d = 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$2(setPointBounds, setBounds);
|
|
3192
3193
|
},
|
|
3193
3194
|
toTwoPointBounds(data, setPointBounds) {
|
|
3194
3195
|
if (!data || !data.length) return setPoint$3(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$1.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$2(floor$2(width + (xGap || 0)), 1), max$2(floor$2(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$4 = LeafHelper;
|
|
4433
4438
|
const {updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$4, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L$4;
|
|
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$3, updateAllMatrix: updateAllMatrix$3} = LeafHelper;
|
|
5358
5365
|
const {updateBounds: updateBounds$2} = BranchHelper;
|
|
5359
5366
|
const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$2, copy: copy$7} = BoundsHelper;
|
|
5360
|
-
const {toBounds: toBounds$
|
|
5367
|
+
const {toBounds: toBounds$1} = 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$1(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
|
}
|
|
@@ -7035,7 +7047,7 @@ var LeaferUI = function(exports) {
|
|
|
7035
7047
|
item = path.list[i];
|
|
7036
7048
|
if (!item.__.hittable) break;
|
|
7037
7049
|
hittablePath.addAt(item, 0);
|
|
7038
|
-
if (!item.__.hitChildren) break;
|
|
7050
|
+
if (!item.__.hitChildren || item.isLeafer && item.mode === "draw") break;
|
|
7039
7051
|
}
|
|
7040
7052
|
return hittablePath;
|
|
7041
7053
|
}
|
|
@@ -7399,7 +7411,11 @@ var LeaferUI = function(exports) {
|
|
|
7399
7411
|
}
|
|
7400
7412
|
}
|
|
7401
7413
|
class FrameData extends BoxData {}
|
|
7402
|
-
class LineData extends UIData {
|
|
7414
|
+
class LineData extends UIData {
|
|
7415
|
+
get __usePathBox() {
|
|
7416
|
+
return this.points || this.__pathInputed;
|
|
7417
|
+
}
|
|
7418
|
+
}
|
|
7403
7419
|
class RectData extends UIData {
|
|
7404
7420
|
get __boxStroke() {
|
|
7405
7421
|
return !this.__pathInputed;
|
|
@@ -7410,7 +7426,7 @@ var LeaferUI = function(exports) {
|
|
|
7410
7426
|
return !this.__pathInputed;
|
|
7411
7427
|
}
|
|
7412
7428
|
}
|
|
7413
|
-
class PolygonData extends
|
|
7429
|
+
class PolygonData extends LineData {}
|
|
7414
7430
|
class StarData extends UIData {}
|
|
7415
7431
|
class PathData extends UIData {
|
|
7416
7432
|
get __pathInputed() {
|
|
@@ -7449,8 +7465,6 @@ var LeaferUI = function(exports) {
|
|
|
7449
7465
|
if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
|
|
7450
7466
|
box.set(value);
|
|
7451
7467
|
if (boxLayout.strokeChanged) layout.strokeChange();
|
|
7452
|
-
if (boxLayout.renderChanged) layout.renderChange();
|
|
7453
|
-
box.__updateChange();
|
|
7454
7468
|
} else if (box) {
|
|
7455
7469
|
t.__box = box.parent = null;
|
|
7456
7470
|
box.destroy();
|
|
@@ -7517,7 +7531,7 @@ var LeaferUI = function(exports) {
|
|
|
7517
7531
|
__updateRenderSpread() {
|
|
7518
7532
|
let width = 0;
|
|
7519
7533
|
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
|
|
7520
|
-
if (shadow)
|
|
7534
|
+
if (shadow) width = Effect.getShadowSpread(this, shadow);
|
|
7521
7535
|
if (blur) width = Math.max(width, blur);
|
|
7522
7536
|
if (filter) width += Filter.getSpread(filter);
|
|
7523
7537
|
if (renderSpread) width += renderSpread;
|
|
@@ -7529,36 +7543,67 @@ var LeaferUI = function(exports) {
|
|
|
7529
7543
|
return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width;
|
|
7530
7544
|
}
|
|
7531
7545
|
};
|
|
7546
|
+
const {float: float$1} = MathHelper;
|
|
7547
|
+
const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
|
|
7532
7548
|
const DragBoundsHelper = {
|
|
7549
|
+
limitMove(leaf, move) {
|
|
7550
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7551
|
+
if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, move, true);
|
|
7552
|
+
D$2.axisMove(leaf, move);
|
|
7553
|
+
},
|
|
7554
|
+
limitScaleOf(leaf, origin, scale) {
|
|
7555
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7556
|
+
if (dragBounds) D$2.getValidScaleOf(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
|
|
7557
|
+
},
|
|
7558
|
+
axisMove(leaf, move) {
|
|
7559
|
+
const {draggable: draggable} = leaf;
|
|
7560
|
+
if (draggable === "x") move.y = 0;
|
|
7561
|
+
if (draggable === "y") move.x = 0;
|
|
7562
|
+
},
|
|
7563
|
+
getDragBounds(leaf) {
|
|
7564
|
+
const {dragBounds: dragBounds} = leaf;
|
|
7565
|
+
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
7566
|
+
},
|
|
7567
|
+
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
7568
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
7569
|
+
},
|
|
7533
7570
|
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
7534
7571
|
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
7535
7572
|
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
7536
7573
|
if (!change) move = Object.assign({}, move);
|
|
7537
|
-
|
|
7538
|
-
const isBiggerHeight = content.height > dragBounds.height;
|
|
7539
|
-
if (isBiggerWidth && dragBoundsType !== "outer") {
|
|
7574
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7540
7575
|
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
7541
7576
|
} else {
|
|
7542
7577
|
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
7543
7578
|
}
|
|
7544
|
-
if (
|
|
7579
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7545
7580
|
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
7546
7581
|
} else {
|
|
7547
7582
|
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
7548
7583
|
}
|
|
7549
|
-
move.x =
|
|
7550
|
-
move.y =
|
|
7584
|
+
move.x = float$1(move.x);
|
|
7585
|
+
move.y = float$1(move.y);
|
|
7551
7586
|
return move;
|
|
7552
7587
|
},
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7588
|
+
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
|
|
7589
|
+
if (!change) scale = Object.assign({}, scale);
|
|
7590
|
+
let fitScaleX, fitScaleY;
|
|
7591
|
+
tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
|
|
7592
|
+
tempMerge.set(tempContent).add(dragBounds);
|
|
7593
|
+
tempIntersect.set(tempContent).intersect(dragBounds);
|
|
7594
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7595
|
+
fitScaleX = tempMerge.width / tempContent.width;
|
|
7596
|
+
} else {
|
|
7597
|
+
fitScaleX = tempIntersect.width / tempContent.width;
|
|
7598
|
+
}
|
|
7599
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7600
|
+
fitScaleY = tempMerge.height / tempContent.height;
|
|
7601
|
+
} else {
|
|
7602
|
+
fitScaleY = tempIntersect.height / tempContent.height;
|
|
7603
|
+
}
|
|
7604
|
+
scale.x = float$1(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
7605
|
+
scale.y = float$1(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
7606
|
+
return scale;
|
|
7562
7607
|
}
|
|
7563
7608
|
};
|
|
7564
7609
|
const D$2 = DragBoundsHelper;
|
|
@@ -7573,7 +7618,7 @@ var LeaferUI = function(exports) {
|
|
|
7573
7618
|
}
|
|
7574
7619
|
if (data.__useEffect) {
|
|
7575
7620
|
const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7576
|
-
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"));
|
|
7621
|
+
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"));
|
|
7577
7622
|
data.__useEffect = !!(shadow || otherEffect);
|
|
7578
7623
|
}
|
|
7579
7624
|
data.__checkSingle();
|
|
@@ -7704,20 +7749,9 @@ var LeaferUI = function(exports) {
|
|
|
7704
7749
|
if (!path) this.__drawPathByBox(pen);
|
|
7705
7750
|
return pen;
|
|
7706
7751
|
}
|
|
7707
|
-
constructor(data) {
|
|
7708
|
-
super(data);
|
|
7709
|
-
}
|
|
7710
7752
|
reset(_data) {}
|
|
7711
|
-
set(data,
|
|
7712
|
-
if (data)
|
|
7713
|
-
if (transition) {
|
|
7714
|
-
if (transition === "temp") {
|
|
7715
|
-
this.lockNormalStyle = true;
|
|
7716
|
-
Object.assign(this, data);
|
|
7717
|
-
this.lockNormalStyle = false;
|
|
7718
|
-
} else this.animate(data, transition);
|
|
7719
|
-
} else Object.assign(this, data);
|
|
7720
|
-
}
|
|
7753
|
+
set(data, _transition) {
|
|
7754
|
+
if (data) Object.assign(this, data);
|
|
7721
7755
|
}
|
|
7722
7756
|
get(name) {
|
|
7723
7757
|
return isString(name) ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
@@ -7763,7 +7797,7 @@ var LeaferUI = function(exports) {
|
|
|
7763
7797
|
const data = this.__;
|
|
7764
7798
|
if (data.path) {
|
|
7765
7799
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
7766
|
-
if (data.__useArrow) PathArrow.addArrows(this
|
|
7800
|
+
if (data.__useArrow) PathArrow.addArrows(this);
|
|
7767
7801
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
7768
7802
|
}
|
|
7769
7803
|
__drawRenderPath(canvas) {
|
|
@@ -7787,7 +7821,8 @@ var LeaferUI = function(exports) {
|
|
|
7787
7821
|
drawImagePlaceholder(canvas, _image) {
|
|
7788
7822
|
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7789
7823
|
}
|
|
7790
|
-
animate(
|
|
7824
|
+
animate(keyframe, _options, _type, _isTemp) {
|
|
7825
|
+
this.set(keyframe);
|
|
7791
7826
|
return Plugin.need("animate");
|
|
7792
7827
|
}
|
|
7793
7828
|
killAnimate(_type, _nextStyle) {}
|
|
@@ -7901,9 +7936,6 @@ var LeaferUI = function(exports) {
|
|
|
7901
7936
|
get isBranch() {
|
|
7902
7937
|
return true;
|
|
7903
7938
|
}
|
|
7904
|
-
constructor(data) {
|
|
7905
|
-
super(data);
|
|
7906
|
-
}
|
|
7907
7939
|
reset(data) {
|
|
7908
7940
|
this.__setBranch();
|
|
7909
7941
|
super.reset(data);
|
|
@@ -8021,7 +8053,7 @@ var LeaferUI = function(exports) {
|
|
|
8021
8053
|
const canvas = this.canvas = Creator.canvas(config);
|
|
8022
8054
|
this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
|
|
8023
8055
|
if (this.isApp) this.__setApp();
|
|
8024
|
-
this.__checkAutoLayout(
|
|
8056
|
+
this.__checkAutoLayout();
|
|
8025
8057
|
this.view = canvas.view;
|
|
8026
8058
|
if (!parentApp) {
|
|
8027
8059
|
this.selector = Creator.selector(this);
|
|
@@ -8120,7 +8152,8 @@ var LeaferUI = function(exports) {
|
|
|
8120
8152
|
this.leafer = leafer;
|
|
8121
8153
|
this.__level = 1;
|
|
8122
8154
|
}
|
|
8123
|
-
__checkAutoLayout(
|
|
8155
|
+
__checkAutoLayout() {
|
|
8156
|
+
const {config: config, parentApp: parentApp} = this;
|
|
8124
8157
|
if (!parentApp) {
|
|
8125
8158
|
if (!config.width || !config.height) this.autoLayout = new AutoBounds(config);
|
|
8126
8159
|
this.canvas.startAutoLayout(this.autoLayout, this.__onResize.bind(this));
|
|
@@ -8137,7 +8170,9 @@ var LeaferUI = function(exports) {
|
|
|
8137
8170
|
} else if (attrName === "zIndex") {
|
|
8138
8171
|
this.canvas.zIndex = newValue;
|
|
8139
8172
|
setTimeout(() => this.parent && this.parent.__updateSortChildren());
|
|
8140
|
-
}
|
|
8173
|
+
} else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
|
|
8174
|
+
mode: newValue
|
|
8175
|
+
});
|
|
8141
8176
|
}
|
|
8142
8177
|
return super.__setAttr(attrName, newValue);
|
|
8143
8178
|
}
|
|
@@ -8146,9 +8181,10 @@ var LeaferUI = function(exports) {
|
|
|
8146
8181
|
return super.__getAttr(attrName);
|
|
8147
8182
|
}
|
|
8148
8183
|
__changeCanvasSize(attrName, newValue) {
|
|
8149
|
-
const
|
|
8150
|
-
data
|
|
8151
|
-
|
|
8184
|
+
const {config: config, canvas: canvas} = this;
|
|
8185
|
+
const data = DataHelper.copyAttrs({}, canvas, canvasSizeAttrs);
|
|
8186
|
+
data[attrName] = config[attrName] = newValue;
|
|
8187
|
+
config.width && config.height ? canvas.stopAutoLayout() : this.__checkAutoLayout();
|
|
8152
8188
|
this.__doResize(data);
|
|
8153
8189
|
}
|
|
8154
8190
|
__changeFill(newValue) {
|
|
@@ -8295,9 +8331,9 @@ var LeaferUI = function(exports) {
|
|
|
8295
8331
|
if (!this.parent) {
|
|
8296
8332
|
if (this.selector) this.selector.destroy();
|
|
8297
8333
|
if (this.hitCanvasManager) this.hitCanvasManager.destroy();
|
|
8298
|
-
this.canvasManager.destroy();
|
|
8334
|
+
if (this.canvasManager) this.canvasManager.destroy();
|
|
8299
8335
|
}
|
|
8300
|
-
this.canvas.destroy();
|
|
8336
|
+
if (this.canvas) this.canvas.destroy();
|
|
8301
8337
|
this.config.view = this.view = this.parentApp = null;
|
|
8302
8338
|
if (this.userConfig) this.userConfig.view = null;
|
|
8303
8339
|
super.destroy();
|
|
@@ -8315,14 +8351,12 @@ var LeaferUI = function(exports) {
|
|
|
8315
8351
|
exports.Leafer.list = new LeafList;
|
|
8316
8352
|
__decorate([ dataProcessor(LeaferData) ], exports.Leafer.prototype, "__", void 0);
|
|
8317
8353
|
__decorate([ boundsType() ], exports.Leafer.prototype, "pixelRatio", void 0);
|
|
8354
|
+
__decorate([ dataType("normal") ], exports.Leafer.prototype, "mode", void 0);
|
|
8318
8355
|
exports.Leafer = Leafer_1 = __decorate([ registerUI() ], exports.Leafer);
|
|
8319
8356
|
exports.Rect = class Rect extends exports.UI {
|
|
8320
8357
|
get __tag() {
|
|
8321
8358
|
return "Rect";
|
|
8322
8359
|
}
|
|
8323
|
-
constructor(data) {
|
|
8324
|
-
super(data);
|
|
8325
|
-
}
|
|
8326
8360
|
};
|
|
8327
8361
|
__decorate([ dataProcessor(RectData) ], exports.Rect.prototype, "__", void 0);
|
|
8328
8362
|
exports.Rect = __decorate([ useModule(RectRender), rewriteAble(), registerUI() ], exports.Rect);
|
|
@@ -8434,9 +8468,6 @@ var LeaferUI = function(exports) {
|
|
|
8434
8468
|
get isFrame() {
|
|
8435
8469
|
return true;
|
|
8436
8470
|
}
|
|
8437
|
-
constructor(data) {
|
|
8438
|
-
super(data);
|
|
8439
|
-
}
|
|
8440
8471
|
};
|
|
8441
8472
|
__decorate([ dataProcessor(FrameData) ], exports.Frame.prototype, "__", void 0);
|
|
8442
8473
|
__decorate([ surfaceType("#FFFFFF") ], exports.Frame.prototype, "fill", void 0);
|
|
@@ -8447,9 +8478,6 @@ var LeaferUI = function(exports) {
|
|
|
8447
8478
|
get __tag() {
|
|
8448
8479
|
return "Ellipse";
|
|
8449
8480
|
}
|
|
8450
|
-
constructor(data) {
|
|
8451
|
-
super(data);
|
|
8452
|
-
}
|
|
8453
8481
|
__updatePath() {
|
|
8454
8482
|
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
|
|
8455
8483
|
const rx = width / 2, ry = height / 2;
|
|
@@ -8483,108 +8511,46 @@ var LeaferUI = function(exports) {
|
|
|
8483
8511
|
__decorate([ pathType(0) ], exports.Ellipse.prototype, "startAngle", void 0);
|
|
8484
8512
|
__decorate([ pathType(0) ], exports.Ellipse.prototype, "endAngle", void 0);
|
|
8485
8513
|
exports.Ellipse = __decorate([ registerUI() ], exports.Ellipse);
|
|
8486
|
-
const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
8487
|
-
const {rotate: rotate$3, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
|
|
8488
|
-
const {toBounds: toBounds$1} = PathBounds;
|
|
8489
|
-
exports.Line = class Line extends exports.UI {
|
|
8490
|
-
get __tag() {
|
|
8491
|
-
return "Line";
|
|
8492
|
-
}
|
|
8493
|
-
get toPoint() {
|
|
8494
|
-
const {width: width, rotation: rotation} = this.__;
|
|
8495
|
-
const to = getPointData();
|
|
8496
|
-
if (width) to.x = width;
|
|
8497
|
-
if (rotation) rotate$3(to, rotation);
|
|
8498
|
-
return to;
|
|
8499
|
-
}
|
|
8500
|
-
set toPoint(value) {
|
|
8501
|
-
this.width = getDistance$3(defaultPoint, value);
|
|
8502
|
-
this.rotation = getAngle$2(defaultPoint, value);
|
|
8503
|
-
if (this.height) this.height = 0;
|
|
8504
|
-
}
|
|
8505
|
-
constructor(data) {
|
|
8506
|
-
super(data);
|
|
8507
|
-
}
|
|
8508
|
-
__updatePath() {
|
|
8509
|
-
const data = this.__;
|
|
8510
|
-
const path = data.path = [];
|
|
8511
|
-
if (data.points) {
|
|
8512
|
-
drawPoints$1(path, data.points, false, data.closed);
|
|
8513
|
-
} else {
|
|
8514
|
-
moveTo$2(path, 0, 0);
|
|
8515
|
-
lineTo$2(path, this.width, 0);
|
|
8516
|
-
}
|
|
8517
|
-
}
|
|
8518
|
-
__updateRenderPath() {
|
|
8519
|
-
const data = this.__;
|
|
8520
|
-
if (!this.pathInputed && data.points && data.curve) {
|
|
8521
|
-
drawPoints$1(data.__pathForRender = [], data.points, data.curve, data.closed);
|
|
8522
|
-
if (data.__useArrow) PathArrow.addArrows(this, false);
|
|
8523
|
-
} else super.__updateRenderPath();
|
|
8524
|
-
}
|
|
8525
|
-
__updateBoxBounds() {
|
|
8526
|
-
if (this.points) {
|
|
8527
|
-
toBounds$1(this.__.__pathForRender, this.__layout.boxBounds);
|
|
8528
|
-
} else super.__updateBoxBounds();
|
|
8529
|
-
}
|
|
8530
|
-
};
|
|
8531
|
-
__decorate([ dataProcessor(LineData) ], exports.Line.prototype, "__", void 0);
|
|
8532
|
-
__decorate([ affectStrokeBoundsType("center") ], exports.Line.prototype, "strokeAlign", void 0);
|
|
8533
|
-
__decorate([ boundsType(0) ], exports.Line.prototype, "height", void 0);
|
|
8534
|
-
__decorate([ pathType() ], exports.Line.prototype, "points", void 0);
|
|
8535
|
-
__decorate([ pathType(0) ], exports.Line.prototype, "curve", void 0);
|
|
8536
|
-
__decorate([ pathType(false) ], exports.Line.prototype, "closed", void 0);
|
|
8537
|
-
exports.Line = __decorate([ registerUI() ], exports.Line);
|
|
8538
8514
|
const {sin: sin$2, cos: cos$2, PI: PI$2} = Math;
|
|
8539
|
-
const {moveTo: moveTo$
|
|
8540
|
-
const line = exports.Line.prototype;
|
|
8515
|
+
const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
8541
8516
|
exports.Polygon = class Polygon extends exports.UI {
|
|
8542
8517
|
get __tag() {
|
|
8543
8518
|
return "Polygon";
|
|
8544
8519
|
}
|
|
8545
|
-
constructor(data) {
|
|
8546
|
-
super(data);
|
|
8547
|
-
}
|
|
8548
8520
|
__updatePath() {
|
|
8549
|
-
const
|
|
8550
|
-
|
|
8551
|
-
|
|
8521
|
+
const data = this.__;
|
|
8522
|
+
const path = data.path = [];
|
|
8523
|
+
if (data.points) {
|
|
8524
|
+
drawPoints$1(path, data.points, data.curve, true);
|
|
8552
8525
|
} else {
|
|
8553
|
-
const {width: width, height: height, sides: sides} =
|
|
8526
|
+
const {width: width, height: height, sides: sides} = data;
|
|
8554
8527
|
const rx = width / 2, ry = height / 2;
|
|
8555
|
-
moveTo$
|
|
8528
|
+
moveTo$2(path, rx, 0);
|
|
8556
8529
|
for (let i = 1; i < sides; i++) {
|
|
8557
|
-
lineTo$
|
|
8530
|
+
lineTo$2(path, rx + rx * sin$2(i * 2 * PI$2 / sides), ry - ry * cos$2(i * 2 * PI$2 / sides));
|
|
8558
8531
|
}
|
|
8559
8532
|
closePath$1(path);
|
|
8560
8533
|
}
|
|
8561
8534
|
}
|
|
8562
|
-
__updateRenderPath() {}
|
|
8563
|
-
__updateBoxBounds() {}
|
|
8564
8535
|
};
|
|
8565
8536
|
__decorate([ dataProcessor(PolygonData) ], exports.Polygon.prototype, "__", void 0);
|
|
8566
8537
|
__decorate([ pathType(3) ], exports.Polygon.prototype, "sides", void 0);
|
|
8567
8538
|
__decorate([ pathType() ], exports.Polygon.prototype, "points", void 0);
|
|
8568
8539
|
__decorate([ pathType(0) ], exports.Polygon.prototype, "curve", void 0);
|
|
8569
|
-
__decorate([ rewrite(line.__updateRenderPath) ], exports.Polygon.prototype, "__updateRenderPath", null);
|
|
8570
|
-
__decorate([ rewrite(line.__updateBoxBounds) ], exports.Polygon.prototype, "__updateBoxBounds", null);
|
|
8571
8540
|
exports.Polygon = __decorate([ rewriteAble(), registerUI() ], exports.Polygon);
|
|
8572
8541
|
const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
|
|
8573
|
-
const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
|
|
8542
|
+
const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
|
|
8574
8543
|
exports.Star = class Star extends exports.UI {
|
|
8575
8544
|
get __tag() {
|
|
8576
8545
|
return "Star";
|
|
8577
8546
|
}
|
|
8578
|
-
constructor(data) {
|
|
8579
|
-
super(data);
|
|
8580
|
-
}
|
|
8581
8547
|
__updatePath() {
|
|
8582
8548
|
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
8583
8549
|
const rx = width / 2, ry = height / 2;
|
|
8584
8550
|
const path = this.__.path = [];
|
|
8585
|
-
moveTo(path, rx, 0);
|
|
8551
|
+
moveTo$1(path, rx, 0);
|
|
8586
8552
|
for (let i = 1; i < corners * 2; i++) {
|
|
8587
|
-
lineTo(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin$1(i * PI$1 / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos$1(i * PI$1 / corners));
|
|
8553
|
+
lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin$1(i * PI$1 / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos$1(i * PI$1 / corners));
|
|
8588
8554
|
}
|
|
8589
8555
|
closePath(path);
|
|
8590
8556
|
}
|
|
@@ -8593,6 +8559,42 @@ var LeaferUI = function(exports) {
|
|
|
8593
8559
|
__decorate([ pathType(5) ], exports.Star.prototype, "corners", void 0);
|
|
8594
8560
|
__decorate([ pathType(.382) ], exports.Star.prototype, "innerRadius", void 0);
|
|
8595
8561
|
exports.Star = __decorate([ registerUI() ], exports.Star);
|
|
8562
|
+
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
8563
|
+
const {rotate: rotate$3, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
|
|
8564
|
+
exports.Line = class Line extends exports.UI {
|
|
8565
|
+
get __tag() {
|
|
8566
|
+
return "Line";
|
|
8567
|
+
}
|
|
8568
|
+
get toPoint() {
|
|
8569
|
+
const {width: width, rotation: rotation} = this.__;
|
|
8570
|
+
const to = getPointData();
|
|
8571
|
+
if (width) to.x = width;
|
|
8572
|
+
if (rotation) rotate$3(to, rotation);
|
|
8573
|
+
return to;
|
|
8574
|
+
}
|
|
8575
|
+
set toPoint(value) {
|
|
8576
|
+
this.width = getDistance$3(defaultPoint, value);
|
|
8577
|
+
this.rotation = getAngle$2(defaultPoint, value);
|
|
8578
|
+
if (this.height) this.height = 0;
|
|
8579
|
+
}
|
|
8580
|
+
__updatePath() {
|
|
8581
|
+
const data = this.__;
|
|
8582
|
+
const path = data.path = [];
|
|
8583
|
+
if (data.points) {
|
|
8584
|
+
drawPoints(path, data.points, data.curve, data.closed);
|
|
8585
|
+
} else {
|
|
8586
|
+
moveTo(path, 0, 0);
|
|
8587
|
+
lineTo(path, this.width, 0);
|
|
8588
|
+
}
|
|
8589
|
+
}
|
|
8590
|
+
};
|
|
8591
|
+
__decorate([ dataProcessor(LineData) ], exports.Line.prototype, "__", void 0);
|
|
8592
|
+
__decorate([ affectStrokeBoundsType("center") ], exports.Line.prototype, "strokeAlign", void 0);
|
|
8593
|
+
__decorate([ boundsType(0) ], exports.Line.prototype, "height", void 0);
|
|
8594
|
+
__decorate([ pathType() ], exports.Line.prototype, "points", void 0);
|
|
8595
|
+
__decorate([ pathType(0) ], exports.Line.prototype, "curve", void 0);
|
|
8596
|
+
__decorate([ pathType(false) ], exports.Line.prototype, "closed", void 0);
|
|
8597
|
+
exports.Line = __decorate([ registerUI() ], exports.Line);
|
|
8596
8598
|
exports.Image = class Image extends exports.Rect {
|
|
8597
8599
|
get __tag() {
|
|
8598
8600
|
return "Image";
|
|
@@ -8605,9 +8607,6 @@ var LeaferUI = function(exports) {
|
|
|
8605
8607
|
const {fill: fill} = this.__;
|
|
8606
8608
|
return isArray(fill) && fill[0].image;
|
|
8607
8609
|
}
|
|
8608
|
-
constructor(data) {
|
|
8609
|
-
super(data);
|
|
8610
|
-
}
|
|
8611
8610
|
};
|
|
8612
8611
|
__decorate([ dataProcessor(ImageData) ], exports.Image.prototype, "__", void 0);
|
|
8613
8612
|
__decorate([ boundsType("") ], exports.Image.prototype, "url", void 0);
|
|
@@ -8692,9 +8691,6 @@ var LeaferUI = function(exports) {
|
|
|
8692
8691
|
this.updateLayout();
|
|
8693
8692
|
return this.__.__textDrawData;
|
|
8694
8693
|
}
|
|
8695
|
-
constructor(data) {
|
|
8696
|
-
super(data);
|
|
8697
|
-
}
|
|
8698
8694
|
__updateTextDrawData() {
|
|
8699
8695
|
const data = this.__;
|
|
8700
8696
|
const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding} = data;
|
|
@@ -8731,10 +8727,6 @@ var LeaferUI = function(exports) {
|
|
|
8731
8727
|
DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
|
|
8732
8728
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
8733
8729
|
}
|
|
8734
|
-
__onUpdateSize() {
|
|
8735
|
-
if (this.__box) this.__box.__onUpdateSize();
|
|
8736
|
-
super.__onUpdateSize();
|
|
8737
|
-
}
|
|
8738
8730
|
__updateRenderSpread() {
|
|
8739
8731
|
let width = super.__updateRenderSpread();
|
|
8740
8732
|
if (!width) width = this.isOverflow ? 1 : 0;
|
|
@@ -8745,6 +8737,11 @@ var LeaferUI = function(exports) {
|
|
|
8745
8737
|
copyAndSpread$1(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
8746
8738
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
8747
8739
|
}
|
|
8740
|
+
__updateChange() {
|
|
8741
|
+
super.__updateChange();
|
|
8742
|
+
const box = this.__box;
|
|
8743
|
+
if (box) box.__onUpdateSize(), box.__updateChange();
|
|
8744
|
+
}
|
|
8748
8745
|
__drawRenderPath(canvas) {
|
|
8749
8746
|
canvas.font = this.__.__font;
|
|
8750
8747
|
}
|
|
@@ -8798,9 +8795,6 @@ var LeaferUI = function(exports) {
|
|
|
8798
8795
|
get __tag() {
|
|
8799
8796
|
return "Path";
|
|
8800
8797
|
}
|
|
8801
|
-
constructor(data) {
|
|
8802
|
-
super(data);
|
|
8803
|
-
}
|
|
8804
8798
|
};
|
|
8805
8799
|
__decorate([ dataProcessor(PathData) ], exports.Path.prototype, "__", void 0);
|
|
8806
8800
|
__decorate([ affectStrokeBoundsType("center") ], exports.Path.prototype, "strokeAlign", void 0);
|
|
@@ -8809,9 +8803,6 @@ var LeaferUI = function(exports) {
|
|
|
8809
8803
|
get __tag() {
|
|
8810
8804
|
return "Pen";
|
|
8811
8805
|
}
|
|
8812
|
-
constructor(data) {
|
|
8813
|
-
super(data);
|
|
8814
|
-
}
|
|
8815
8806
|
setStyle(data) {
|
|
8816
8807
|
const path = this.pathElement = new exports.Path(data);
|
|
8817
8808
|
this.pathStyle = data;
|
|
@@ -10730,7 +10721,7 @@ var LeaferUI = function(exports) {
|
|
|
10730
10721
|
if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
|
|
10731
10722
|
}
|
|
10732
10723
|
const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
|
|
10733
|
-
const {floor: floor$1, max: max$1, abs: abs$4} = Math;
|
|
10724
|
+
const {floor: floor$1, ceil: ceil$1, max: max$1, abs: abs$4} = Math;
|
|
10734
10725
|
function createPattern(ui, paint, pixelRatio) {
|
|
10735
10726
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
10736
10727
|
const id = scaleX + "-" + scaleY + "-" + pixelRatio;
|
|
@@ -10739,8 +10730,6 @@ var LeaferUI = function(exports) {
|
|
|
10739
10730
|
let imageScale, imageMatrix, {width: width, height: height, scaleX: sx, scaleY: sy, transform: transform, repeat: repeat, gap: gap} = data;
|
|
10740
10731
|
scaleX *= pixelRatio;
|
|
10741
10732
|
scaleY *= pixelRatio;
|
|
10742
|
-
const xGap = gap && gap.x * scaleX;
|
|
10743
|
-
const yGap = gap && gap.y * scaleY;
|
|
10744
10733
|
if (sx) {
|
|
10745
10734
|
sx = abs$4(sx);
|
|
10746
10735
|
sy = abs$4(sy);
|
|
@@ -10757,7 +10746,10 @@ var LeaferUI = function(exports) {
|
|
|
10757
10746
|
if (size > Platform.image.maxCacheSize) return false;
|
|
10758
10747
|
}
|
|
10759
10748
|
let maxSize = Platform.image.maxPatternSize;
|
|
10760
|
-
if (
|
|
10749
|
+
if (image.isSVG) {
|
|
10750
|
+
const ws = width / image.width;
|
|
10751
|
+
if (ws > 1) imageScale = ws / ceil$1(ws);
|
|
10752
|
+
} else {
|
|
10761
10753
|
const imageSize = image.width * image.height;
|
|
10762
10754
|
if (maxSize > imageSize) maxSize = imageSize;
|
|
10763
10755
|
}
|
|
@@ -10772,18 +10764,20 @@ var LeaferUI = function(exports) {
|
|
|
10772
10764
|
scaleX /= sx;
|
|
10773
10765
|
scaleY /= sy;
|
|
10774
10766
|
}
|
|
10767
|
+
const xGap = gap && gap.x * scaleX;
|
|
10768
|
+
const yGap = gap && gap.y * scaleY;
|
|
10775
10769
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
10770
|
+
const canvasWidth = width + (xGap || 0);
|
|
10771
|
+
const canvasHeight = height + (yGap || 0);
|
|
10772
|
+
scaleX /= canvasWidth / max$1(floor$1(canvasWidth), 1);
|
|
10773
|
+
scaleY /= canvasHeight / max$1(floor$1(canvasHeight), 1);
|
|
10776
10774
|
if (!imageMatrix) {
|
|
10777
10775
|
imageMatrix = get$1();
|
|
10778
10776
|
if (transform) copy$4(imageMatrix, transform);
|
|
10779
10777
|
}
|
|
10780
10778
|
scale$2(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
10781
10779
|
}
|
|
10782
|
-
|
|
10783
|
-
const canvasWidth = width + (xGap || 0), canvasHeight = height + (yGap || 0);
|
|
10784
|
-
scale$2(imageMatrix, canvasWidth / max$1(floor$1(canvasWidth), 1), canvasHeight / max$1(floor$1(canvasHeight), 1));
|
|
10785
|
-
}
|
|
10786
|
-
const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap);
|
|
10780
|
+
const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
|
|
10787
10781
|
const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
10788
10782
|
paint.style = pattern;
|
|
10789
10783
|
paint.patternId = id;
|
|
@@ -10999,11 +10993,16 @@ var LeaferUI = function(exports) {
|
|
|
10999
10993
|
}
|
|
11000
10994
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
11001
10995
|
}
|
|
11002
|
-
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
10996
|
+
if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
11003
10997
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
11004
10998
|
});
|
|
11005
10999
|
other.recycle(copyBounds);
|
|
11006
11000
|
}
|
|
11001
|
+
function getShadowSpread(_ui, shadow) {
|
|
11002
|
+
let width = 0;
|
|
11003
|
+
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));
|
|
11004
|
+
return width;
|
|
11005
|
+
}
|
|
11007
11006
|
function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
|
|
11008
11007
|
const {bounds: bounds, shapeBounds: shapeBounds} = shape;
|
|
11009
11008
|
if (Platform.fullImageShadow) {
|
|
@@ -11075,7 +11074,11 @@ var LeaferUI = function(exports) {
|
|
|
11075
11074
|
shadow: shadow$1,
|
|
11076
11075
|
innerShadow: innerShadow,
|
|
11077
11076
|
blur: blur,
|
|
11078
|
-
backgroundBlur: backgroundBlur
|
|
11077
|
+
backgroundBlur: backgroundBlur,
|
|
11078
|
+
getShadowSpread: getShadowSpread,
|
|
11079
|
+
isTransformShadow(_shadow) {
|
|
11080
|
+
return undefined;
|
|
11081
|
+
}
|
|
11079
11082
|
};
|
|
11080
11083
|
const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
|
|
11081
11084
|
let usedGrayscaleAlpha;
|
|
@@ -11531,16 +11534,17 @@ var LeaferUI = function(exports) {
|
|
|
11531
11534
|
row.data = null;
|
|
11532
11535
|
}
|
|
11533
11536
|
function decorationText(drawData, style) {
|
|
11534
|
-
let type;
|
|
11537
|
+
let type, offset = 0;
|
|
11535
11538
|
const {fontSize: fontSize, textDecoration: textDecoration} = style;
|
|
11536
11539
|
drawData.decorationHeight = fontSize / 11;
|
|
11537
11540
|
if (isObject(textDecoration)) {
|
|
11538
11541
|
type = textDecoration.type;
|
|
11539
11542
|
if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
|
|
11543
|
+
if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
|
|
11540
11544
|
} else type = textDecoration;
|
|
11541
11545
|
switch (type) {
|
|
11542
11546
|
case "under":
|
|
11543
|
-
drawData.decorationY = [ fontSize * .15 ];
|
|
11547
|
+
drawData.decorationY = [ fontSize * .15 + offset ];
|
|
11544
11548
|
break;
|
|
11545
11549
|
|
|
11546
11550
|
case "delete":
|
|
@@ -11548,7 +11552,7 @@ var LeaferUI = function(exports) {
|
|
|
11548
11552
|
break;
|
|
11549
11553
|
|
|
11550
11554
|
case "under-delete":
|
|
11551
|
-
drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
|
|
11555
|
+
drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
|
|
11552
11556
|
}
|
|
11553
11557
|
}
|
|
11554
11558
|
const {top: top$2, right: right$3, bottom: bottom$2, left: left$3} = exports.Direction4;
|
|
@@ -11849,7 +11853,7 @@ var LeaferUI = function(exports) {
|
|
|
11849
11853
|
}
|
|
11850
11854
|
get running() {
|
|
11851
11855
|
const {editor: editor} = this;
|
|
11852
|
-
return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector;
|
|
11856
|
+
return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector && this.app.mode === "normal";
|
|
11853
11857
|
}
|
|
11854
11858
|
get isMoveMode() {
|
|
11855
11859
|
return this.app && this.app.interaction.moveMode;
|
|
@@ -12147,17 +12151,13 @@ var LeaferUI = function(exports) {
|
|
|
12147
12151
|
}
|
|
12148
12152
|
toPoint(around || align, boxBounds, origin, true);
|
|
12149
12153
|
if (dragBounds) {
|
|
12150
|
-
const
|
|
12151
|
-
|
|
12152
|
-
|
|
12153
|
-
|
|
12154
|
-
|
|
12155
|
-
|
|
12156
|
-
|
|
12157
|
-
if (useScaleX) scaleX *= fitScaleX;
|
|
12158
|
-
if (useScaleY) scaleY *= fitScaleY;
|
|
12159
|
-
}
|
|
12160
|
-
}
|
|
12154
|
+
const scaleData = {
|
|
12155
|
+
x: scaleX,
|
|
12156
|
+
y: scaleY
|
|
12157
|
+
};
|
|
12158
|
+
DragBoundsHelper.limitScaleOf(target, origin, scaleData);
|
|
12159
|
+
scaleX = scaleData.x;
|
|
12160
|
+
scaleY = scaleData.y;
|
|
12161
12161
|
}
|
|
12162
12162
|
if (useScaleX && widthRange) {
|
|
12163
12163
|
const nowWidth = boxBounds.width * target.scaleX;
|
|
@@ -13661,7 +13661,9 @@ var LeaferUI = function(exports) {
|
|
|
13661
13661
|
listenTargetEvents() {
|
|
13662
13662
|
if (!this.targetEventIds.length) {
|
|
13663
13663
|
const {app: app, leafer: leafer, targetLeafer: targetLeafer, editMask: editMask} = this;
|
|
13664
|
-
this.targetEventIds = [ leafer.on_(RenderEvent.START, this.onRenderStart, this), targetLeafer && targetLeafer.on_(PropertyEvent.SCROLL, this.onChildScroll, this), app.on_(RenderEvent.CHILD_START, this.onAppRenderStart, this)
|
|
13664
|
+
this.targetEventIds = [ leafer.on_(RenderEvent.START, this.onRenderStart, this), targetLeafer && targetLeafer.on_(PropertyEvent.SCROLL, this.onChildScroll, this), app.on_(RenderEvent.CHILD_START, this.onAppRenderStart, this), app.on_(LeaferEvent.UPDATE_MODE, data => {
|
|
13665
|
+
if (data.mode && data.mode !== "normal") this.cancel();
|
|
13666
|
+
}) ];
|
|
13665
13667
|
if (editMask.visible) editMask.forceRender();
|
|
13666
13668
|
}
|
|
13667
13669
|
}
|
|
@@ -14508,7 +14510,8 @@ var LeaferUI = function(exports) {
|
|
|
14508
14510
|
if (zoom) {
|
|
14509
14511
|
zoomSpeed = within$2(zoomSpeed, 0, 1);
|
|
14510
14512
|
const min = event.deltaY ? config.delta.y : config.delta.x;
|
|
14511
|
-
|
|
14513
|
+
const absScale = within$2(1 - abs$2(delta) / (min * 4) * zoomSpeed, .5, 2);
|
|
14514
|
+
scale = delta > 0 ? absScale : 1 / absScale;
|
|
14512
14515
|
}
|
|
14513
14516
|
return scale;
|
|
14514
14517
|
}
|
|
@@ -15021,6 +15024,9 @@ var LeaferUI = function(exports) {
|
|
|
15021
15024
|
super(data);
|
|
15022
15025
|
this.__.__useArrow = true;
|
|
15023
15026
|
}
|
|
15027
|
+
static registerArrow(name, data) {
|
|
15028
|
+
PathArrow.register(name, data);
|
|
15029
|
+
}
|
|
15024
15030
|
};
|
|
15025
15031
|
__decorate([ dataProcessor(ArrowData) ], exports.Arrow.prototype, "__", void 0);
|
|
15026
15032
|
__decorate([ arrowType("angle") ], exports.Arrow.prototype, "endArrow", void 0);
|
|
@@ -15172,9 +15178,18 @@ var LeaferUI = function(exports) {
|
|
|
15172
15178
|
"diamond-line": diamondLine,
|
|
15173
15179
|
mark: mark
|
|
15174
15180
|
};
|
|
15175
|
-
function getArrowPath(ui, arrow, from, to,
|
|
15181
|
+
function getArrowPath(ui, arrow, from, to, size, connectOffset, hasDashPattern) {
|
|
15182
|
+
let pathData, scale;
|
|
15176
15183
|
const {strokeCap: strokeCap, strokeJoin: strokeJoin} = ui.__;
|
|
15177
|
-
|
|
15184
|
+
if (isObject(arrow)) {
|
|
15185
|
+
if (arrow.type) {
|
|
15186
|
+
scale = arrow.scale;
|
|
15187
|
+
pathData = arrows[arrow.type];
|
|
15188
|
+
} else pathData = arrow;
|
|
15189
|
+
} else {
|
|
15190
|
+
pathData = arrows[arrow];
|
|
15191
|
+
}
|
|
15192
|
+
const {offset: offset, connect: connect, path: path, dashPath: dashPath} = pathData;
|
|
15178
15193
|
let connectX = connect ? connect.x : 0;
|
|
15179
15194
|
let offsetX = offset ? offset.x : 0;
|
|
15180
15195
|
const data = [ ...path ];
|
|
@@ -15183,9 +15198,10 @@ var LeaferUI = function(exports) {
|
|
|
15183
15198
|
if (offset) {
|
|
15184
15199
|
if (strokeJoin === "round" && offset.roundJoin) offsetX += offset.roundJoin; else if (strokeJoin === "bevel" && offset.bevelJoin) offsetX += offset.bevelJoin;
|
|
15185
15200
|
}
|
|
15201
|
+
if (scale) layout$2(data, 0, 0, scale, scale);
|
|
15186
15202
|
if (offsetX) layout$2(data, offsetX, 0);
|
|
15187
|
-
layout$2(data, to.x, to.y,
|
|
15188
|
-
connectOffset.x = (connectX + offsetX) *
|
|
15203
|
+
layout$2(data, to.x, to.y, size, size, getAngle(from, to));
|
|
15204
|
+
connectOffset.x = (connectX + offsetX) * size;
|
|
15189
15205
|
return data;
|
|
15190
15206
|
}
|
|
15191
15207
|
const {M: M$1, L: L$1, C: C$1, Q: Q, Z: Z$1, N: N, D: D, X: X, G: G, F: F, O: O, P: P, U: U} = PathCommandMap;
|
|
@@ -15195,8 +15211,9 @@ var LeaferUI = function(exports) {
|
|
|
15195
15211
|
const last = {}, now = {};
|
|
15196
15212
|
const PathArrowModule = {
|
|
15197
15213
|
list: arrows,
|
|
15198
|
-
addArrows(ui
|
|
15199
|
-
const {startArrow: startArrow, endArrow: endArrow, strokeWidth: strokeWidth, dashPattern: dashPattern, __pathForRender: data} = ui.__;
|
|
15214
|
+
addArrows(ui) {
|
|
15215
|
+
const {startArrow: startArrow, endArrow: endArrow, strokeWidth: strokeWidth, dashPattern: dashPattern, __pathForRender: data, cornerRadius: cornerRadius} = ui.__;
|
|
15216
|
+
const clonePathForArrow = !cornerRadius;
|
|
15200
15217
|
let command, i = 0, len = data.length, count = 0, useStartArrow = startArrow && startArrow !== "none";
|
|
15201
15218
|
while (i < len) {
|
|
15202
15219
|
command = data[i];
|
|
@@ -15211,12 +15228,12 @@ var LeaferUI = function(exports) {
|
|
|
15211
15228
|
break;
|
|
15212
15229
|
|
|
15213
15230
|
case C$1:
|
|
15214
|
-
if (count === 1 || i + 7
|
|
15231
|
+
if (count === 1 || i + 7 >= len - 3) copyPoints(data, last, now, i + 3);
|
|
15215
15232
|
i += 7;
|
|
15216
15233
|
break;
|
|
15217
15234
|
|
|
15218
15235
|
case Q:
|
|
15219
|
-
if (count === 1 || i + 5
|
|
15236
|
+
if (count === 1 || i + 5 >= len - 3) copyPoints(data, last, now, i + 1);
|
|
15220
15237
|
i += 5;
|
|
15221
15238
|
break;
|
|
15222
15239
|
|
|
@@ -15252,7 +15269,13 @@ var LeaferUI = function(exports) {
|
|
|
15252
15269
|
break;
|
|
15253
15270
|
|
|
15254
15271
|
case U:
|
|
15255
|
-
if (count === 1 || i + 6
|
|
15272
|
+
if (count === 1 || i + 6 >= len - 3) {
|
|
15273
|
+
copyPoints(data, last, now, i + 1);
|
|
15274
|
+
if (i + 6 !== len) {
|
|
15275
|
+
now.x -= (now.x - last.x) / 10;
|
|
15276
|
+
now.y -= (now.y - last.y) / 10;
|
|
15277
|
+
}
|
|
15278
|
+
}
|
|
15256
15279
|
i += 6;
|
|
15257
15280
|
break;
|
|
15258
15281
|
}
|
|
@@ -15260,7 +15283,7 @@ var LeaferUI = function(exports) {
|
|
|
15260
15283
|
if (count === 1 && command !== M$1) return;
|
|
15261
15284
|
if (count === 2 && useStartArrow) copy(second, command === L$1 ? now : last);
|
|
15262
15285
|
if (i === len) {
|
|
15263
|
-
const path = ui.__.__pathForRender =
|
|
15286
|
+
const path = ui.__.__pathForRender = clonePathForArrow ? [ ...data ] : data;
|
|
15264
15287
|
const pathForArrow = ui.__.__pathForArrow = [];
|
|
15265
15288
|
if (useStartArrow) {
|
|
15266
15289
|
const startArrowPath = getArrowPath(ui, startArrow, second, first, strokeWidth, connectPoint, !!dashPattern);
|
|
@@ -15301,6 +15324,12 @@ var LeaferUI = function(exports) {
|
|
|
15301
15324
|
copy(last, now);
|
|
15302
15325
|
}
|
|
15303
15326
|
}
|
|
15327
|
+
},
|
|
15328
|
+
register(name, data) {
|
|
15329
|
+
this.list[name] = data;
|
|
15330
|
+
},
|
|
15331
|
+
get(name) {
|
|
15332
|
+
return this.list[name];
|
|
15304
15333
|
}
|
|
15305
15334
|
};
|
|
15306
15335
|
function copyPoints(data, from, to, startIndex) {
|
|
@@ -16727,6 +16756,17 @@ var LeaferUI = function(exports) {
|
|
|
16727
16756
|
exports.UI.addAttr("animationOut", undefined, dataType);
|
|
16728
16757
|
exports.UI.addAttr("transition", true, dataType);
|
|
16729
16758
|
exports.UI.addAttr("transitionOut", undefined, dataType);
|
|
16759
|
+
ui$3.set = function(data, transition) {
|
|
16760
|
+
if (data) {
|
|
16761
|
+
if (transition) {
|
|
16762
|
+
if (transition === "temp") {
|
|
16763
|
+
this.lockNormalStyle = true;
|
|
16764
|
+
Object.assign(this, data);
|
|
16765
|
+
this.lockNormalStyle = false;
|
|
16766
|
+
} else this.animate(data, transition);
|
|
16767
|
+
} else Object.assign(this, data);
|
|
16768
|
+
}
|
|
16769
|
+
};
|
|
16730
16770
|
ui$3.animate = function(keyframe, options, kill, isTemp) {
|
|
16731
16771
|
if (isUndefined(keyframe)) return this.__animate;
|
|
16732
16772
|
const isAnimationList = isArray(keyframe) && !options && kill;
|
|
@@ -17819,6 +17859,8 @@ var LeaferUI = function(exports) {
|
|
|
17819
17859
|
renderBounds: renderBounds,
|
|
17820
17860
|
trimBounds: trimBounds
|
|
17821
17861
|
};
|
|
17862
|
+
const app = leafer && leafer.app;
|
|
17863
|
+
if (app && app.canvasManager) app.canvasManager.clearRecycled();
|
|
17822
17864
|
}
|
|
17823
17865
|
} catch (error) {
|
|
17824
17866
|
result = {
|
|
@@ -18118,6 +18160,7 @@ var LeaferUI = function(exports) {
|
|
|
18118
18160
|
exports.motionPathType = motionPathType;
|
|
18119
18161
|
exports.naturalBoundsType = naturalBoundsType;
|
|
18120
18162
|
exports.opacityType = opacityType;
|
|
18163
|
+
exports.path = path;
|
|
18121
18164
|
exports.pathInputType = pathInputType;
|
|
18122
18165
|
exports.pathType = pathType;
|
|
18123
18166
|
exports.pen = pen;
|