@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.module.js
CHANGED
|
@@ -136,6 +136,9 @@ class LeafData {
|
|
|
136
136
|
const {path: path} = this;
|
|
137
137
|
return path && path.length === 6 && path[0] === 1;
|
|
138
138
|
}
|
|
139
|
+
get __usePathBox() {
|
|
140
|
+
return this.__pathInputed;
|
|
141
|
+
}
|
|
139
142
|
get __blendMode() {
|
|
140
143
|
if (this.eraser && this.eraser !== "path") return "destination-out";
|
|
141
144
|
const {blendMode: blendMode} = this;
|
|
@@ -369,7 +372,7 @@ function getMatrixData() {
|
|
|
369
372
|
|
|
370
373
|
const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
|
|
371
374
|
|
|
372
|
-
const {float: float$
|
|
375
|
+
const {float: float$2} = MathHelper;
|
|
373
376
|
|
|
374
377
|
const tempPoint$3 = {};
|
|
375
378
|
|
|
@@ -611,12 +614,12 @@ const MatrixHelper = {
|
|
|
611
614
|
const cosR = c / scaleY;
|
|
612
615
|
rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
|
|
613
616
|
}
|
|
614
|
-
const cosR = float$
|
|
617
|
+
const cosR = float$2(cos$5(rotation));
|
|
615
618
|
const sinR = sin$5(rotation);
|
|
616
|
-
scaleX = float$
|
|
617
|
-
skewX = cosR ? float$
|
|
618
|
-
skewY = cosR ? float$
|
|
619
|
-
rotation = float$
|
|
619
|
+
scaleX = float$2(scaleX), scaleY = float$2(scaleY);
|
|
620
|
+
skewX = cosR ? float$2((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
621
|
+
skewY = cosR ? float$2((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
622
|
+
rotation = float$2(rotation / OneRadian);
|
|
620
623
|
} else {
|
|
621
624
|
scaleX = a;
|
|
622
625
|
scaleY = d;
|
|
@@ -1134,13 +1137,13 @@ const AlignHelper = {
|
|
|
1134
1137
|
}
|
|
1135
1138
|
};
|
|
1136
1139
|
|
|
1137
|
-
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$
|
|
1140
|
+
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
1138
1141
|
|
|
1139
1142
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1140
1143
|
|
|
1141
|
-
const {float: float, fourNumber: fourNumber} = MathHelper;
|
|
1144
|
+
const {float: float$1, fourNumber: fourNumber} = MathHelper;
|
|
1142
1145
|
|
|
1143
|
-
const {floor: floor$2, ceil: ceil$
|
|
1146
|
+
const {floor: floor$2, ceil: ceil$2} = Math;
|
|
1144
1147
|
|
|
1145
1148
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
1146
1149
|
|
|
@@ -1269,7 +1272,7 @@ const BoundsHelper = {
|
|
|
1269
1272
|
point.x = t.x;
|
|
1270
1273
|
toOuterPoint$2(matrix, point, toPoint$4);
|
|
1271
1274
|
addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
|
|
1272
|
-
toBounds$
|
|
1275
|
+
toBounds$2(tempPointBounds$1, to);
|
|
1273
1276
|
}
|
|
1274
1277
|
},
|
|
1275
1278
|
toInnerOf(t, matrix, to) {
|
|
@@ -1307,8 +1310,8 @@ const BoundsHelper = {
|
|
|
1307
1310
|
const {x: x, y: y} = t;
|
|
1308
1311
|
t.x = floor$2(t.x);
|
|
1309
1312
|
t.y = floor$2(t.y);
|
|
1310
|
-
t.width = x > t.x ? ceil$
|
|
1311
|
-
t.height = y > t.y ? ceil$
|
|
1313
|
+
t.width = x > t.x ? ceil$2(t.width + x - t.x) : ceil$2(t.width);
|
|
1314
|
+
t.height = y > t.y ? ceil$2(t.height + y - t.y) : ceil$2(t.height);
|
|
1312
1315
|
},
|
|
1313
1316
|
unsign(t) {
|
|
1314
1317
|
if (t.width < 0) {
|
|
@@ -1321,10 +1324,10 @@ const BoundsHelper = {
|
|
|
1321
1324
|
}
|
|
1322
1325
|
},
|
|
1323
1326
|
float(t, maxLength) {
|
|
1324
|
-
t.x = float(t.x, maxLength);
|
|
1325
|
-
t.y = float(t.y, maxLength);
|
|
1326
|
-
t.width = float(t.width, maxLength);
|
|
1327
|
-
t.height = float(t.height, maxLength);
|
|
1327
|
+
t.x = float$1(t.x, maxLength);
|
|
1328
|
+
t.y = float$1(t.y, maxLength);
|
|
1329
|
+
t.width = float$1(t.width, maxLength);
|
|
1330
|
+
t.height = float$1(t.height, maxLength);
|
|
1328
1331
|
},
|
|
1329
1332
|
add(t, bounds, isPoint) {
|
|
1330
1333
|
right$1 = t.x + t.width;
|
|
@@ -1368,7 +1371,7 @@ const BoundsHelper = {
|
|
|
1368
1371
|
},
|
|
1369
1372
|
setPoints(t, points) {
|
|
1370
1373
|
points.forEach((point, index) => index === 0 ? setPoint$2(tempPointBounds$1, point.x, point.y) : addPoint$2(tempPointBounds$1, point.x, point.y));
|
|
1371
|
-
toBounds$
|
|
1374
|
+
toBounds$2(tempPointBounds$1, t);
|
|
1372
1375
|
},
|
|
1373
1376
|
setPoint(t, point) {
|
|
1374
1377
|
B.set(t, point.x, point.y);
|
|
@@ -2221,15 +2224,15 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2221
2224
|
DataHelper.copyAttrs(s, size, canvasSizeAttrs);
|
|
2222
2225
|
canvasSizeAttrs.forEach(key => s[key] || (s[key] = 1));
|
|
2223
2226
|
this.bounds = new Bounds(0, 0, this.width, this.height);
|
|
2224
|
-
|
|
2225
|
-
this.updateViewSize();
|
|
2226
|
-
this.smooth = this.config.smooth;
|
|
2227
|
-
}
|
|
2227
|
+
this.updateViewSize();
|
|
2228
2228
|
this.updateClientBounds();
|
|
2229
|
-
if (this.context
|
|
2230
|
-
this.
|
|
2231
|
-
this.
|
|
2232
|
-
|
|
2229
|
+
if (this.context) {
|
|
2230
|
+
this.smooth = this.config.smooth;
|
|
2231
|
+
if (!this.unreal && takeCanvas) {
|
|
2232
|
+
this.clearWorld(takeCanvas.bounds);
|
|
2233
|
+
this.copyWorld(takeCanvas);
|
|
2234
|
+
takeCanvas.recycle();
|
|
2235
|
+
}
|
|
2233
2236
|
}
|
|
2234
2237
|
}
|
|
2235
2238
|
updateViewSize() {}
|
|
@@ -2543,7 +2546,7 @@ const RectHelper = {
|
|
|
2543
2546
|
}
|
|
2544
2547
|
};
|
|
2545
2548
|
|
|
2546
|
-
const {sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil, abs: abs$2, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
|
|
2549
|
+
const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs: abs$2, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
|
|
2547
2550
|
|
|
2548
2551
|
const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
|
|
2549
2552
|
|
|
@@ -2614,9 +2617,11 @@ const BezierHelper = {
|
|
|
2614
2617
|
const CBy = toY - y1;
|
|
2615
2618
|
let startRadian = atan2$1(BAy, BAx);
|
|
2616
2619
|
let endRadian = atan2$1(CBy, CBx);
|
|
2620
|
+
const lenBA = hypot(BAx, BAy);
|
|
2621
|
+
const lenCB = hypot(CBx, CBy);
|
|
2617
2622
|
let totalRadian = endRadian - startRadian;
|
|
2618
2623
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2619
|
-
if (
|
|
2624
|
+
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$2(totalRadian - PI$2) < 1e-12) {
|
|
2620
2625
|
if (data) data.push(L$6, x1, y1);
|
|
2621
2626
|
if (setPointBounds) {
|
|
2622
2627
|
setPoint$1(setPointBounds, fromX, fromY);
|
|
@@ -2649,7 +2654,7 @@ const BezierHelper = {
|
|
|
2649
2654
|
let totalRadian = endRadian - startRadian;
|
|
2650
2655
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2651
2656
|
if (anticlockwise) totalRadian -= PI2;
|
|
2652
|
-
const parts = ceil(abs$2(totalRadian / PI_2));
|
|
2657
|
+
const parts = ceil$1(abs$2(totalRadian / PI_2));
|
|
2653
2658
|
const partRadian = totalRadian / parts;
|
|
2654
2659
|
const partRadian4Sin = sin$3(partRadian / 4);
|
|
2655
2660
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
|
|
@@ -3208,11 +3213,7 @@ class PathCreator {
|
|
|
3208
3213
|
this.set(path);
|
|
3209
3214
|
}
|
|
3210
3215
|
set(path) {
|
|
3211
|
-
|
|
3212
|
-
this.__path = isString(path) ? PathHelper.parse(path) : path;
|
|
3213
|
-
} else {
|
|
3214
|
-
this.__path = [];
|
|
3215
|
-
}
|
|
3216
|
+
this.__path = path ? isString(path) ? PathHelper.parse(path) : path : [];
|
|
3216
3217
|
return this;
|
|
3217
3218
|
}
|
|
3218
3219
|
beginPath() {
|
|
@@ -3380,7 +3381,7 @@ const {M: M$1, L: L$2, C: C, Q: Q, Z: Z$1, N: N, D: D$1, X: X, G: G, F: F$1, O:
|
|
|
3380
3381
|
|
|
3381
3382
|
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
|
|
3382
3383
|
|
|
3383
|
-
const {addPointBounds: addPointBounds, copy: copy$6, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$
|
|
3384
|
+
const {addPointBounds: addPointBounds, copy: copy$6, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$1} = TwoPointBoundsHelper;
|
|
3384
3385
|
|
|
3385
3386
|
const debug$9 = Debug.get("PathBounds");
|
|
3386
3387
|
|
|
@@ -3395,7 +3396,7 @@ const setEndPoint = {};
|
|
|
3395
3396
|
const PathBounds = {
|
|
3396
3397
|
toBounds(data, setBounds) {
|
|
3397
3398
|
PathBounds.toTwoPointBounds(data, setPointBounds);
|
|
3398
|
-
toBounds$
|
|
3399
|
+
toBounds$1(setPointBounds, setBounds);
|
|
3399
3400
|
},
|
|
3400
3401
|
toTwoPointBounds(data, setPointBounds) {
|
|
3401
3402
|
if (!data || !data.length) return setPoint(setPointBounds, 0, 0);
|
|
@@ -3582,14 +3583,18 @@ const PathCorner = {
|
|
|
3582
3583
|
}
|
|
3583
3584
|
};
|
|
3584
3585
|
|
|
3585
|
-
|
|
3586
|
+
function path(path) {
|
|
3587
|
+
return new PathCreator(path);
|
|
3588
|
+
}
|
|
3589
|
+
|
|
3590
|
+
const pen = path();
|
|
3591
|
+
|
|
3592
|
+
PathHelper.creator = path();
|
|
3586
3593
|
|
|
3587
3594
|
PathHelper.parse = PathConvert.parse;
|
|
3588
3595
|
|
|
3589
3596
|
PathHelper.convertToCanvasData = PathConvert.toCanvasData;
|
|
3590
3597
|
|
|
3591
|
-
const pen = new PathCreator;
|
|
3592
|
-
|
|
3593
3598
|
const {drawRoundRect: drawRoundRect} = RectHelper;
|
|
3594
3599
|
|
|
3595
3600
|
function roundRect(drawer) {
|
|
@@ -3954,7 +3959,7 @@ const ImageManager = {
|
|
|
3954
3959
|
return FileHelper.alphaPixelTypes.some(item => I.isFormat(item, config));
|
|
3955
3960
|
},
|
|
3956
3961
|
isFormat(format, config) {
|
|
3957
|
-
if (config.format
|
|
3962
|
+
if (config.format) return config.format === format;
|
|
3958
3963
|
const {url: url} = config;
|
|
3959
3964
|
if (url.startsWith("data:")) {
|
|
3960
3965
|
if (url.startsWith("data:" + FileHelper.mineType(format))) return true;
|
|
@@ -4048,7 +4053,7 @@ class LeaferImage {
|
|
|
4048
4053
|
getFull(_filters) {
|
|
4049
4054
|
return this.view;
|
|
4050
4055
|
}
|
|
4051
|
-
getCanvas(width, height, opacity, _filters, xGap, yGap) {
|
|
4056
|
+
getCanvas(width, height, opacity, _filters, xGap, yGap, smooth) {
|
|
4052
4057
|
width || (width = this.width);
|
|
4053
4058
|
height || (height = this.height);
|
|
4054
4059
|
if (this.cache) {
|
|
@@ -4064,6 +4069,7 @@ class LeaferImage {
|
|
|
4064
4069
|
const canvas = Platform.origin.createCanvas(max$1(floor$1(width + (xGap || 0)), 1), max$1(floor$1(height + (yGap || 0)), 1));
|
|
4065
4070
|
const ctx = canvas.getContext("2d");
|
|
4066
4071
|
if (opacity) ctx.globalAlpha = opacity;
|
|
4072
|
+
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
4067
4073
|
ctx.drawImage(this.view, 0, 0, width, height);
|
|
4068
4074
|
this.cache = this.use > 1 ? {
|
|
4069
4075
|
data: canvas,
|
|
@@ -4715,8 +4721,9 @@ const L = LeafHelper;
|
|
|
4715
4721
|
|
|
4716
4722
|
const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L;
|
|
4717
4723
|
|
|
4718
|
-
function getTempLocal(t,
|
|
4719
|
-
|
|
4724
|
+
function getTempLocal(t, worldPoint) {
|
|
4725
|
+
t.updateLayout();
|
|
4726
|
+
return t.parent ? PointHelper.tempToInnerOf(worldPoint, t.parent.scrollWorldTransform) : worldPoint;
|
|
4720
4727
|
}
|
|
4721
4728
|
|
|
4722
4729
|
const LeafBoundsHelper = {
|
|
@@ -5456,6 +5463,8 @@ LeaferEvent.RESTART = "leafer.restart";
|
|
|
5456
5463
|
|
|
5457
5464
|
LeaferEvent.END = "leafer.end";
|
|
5458
5465
|
|
|
5466
|
+
LeaferEvent.UPDATE_MODE = "leafer.update_mode";
|
|
5467
|
+
|
|
5459
5468
|
LeaferEvent.TRANSFORM = "leafer.transform";
|
|
5460
5469
|
|
|
5461
5470
|
LeaferEvent.MOVE = "leafer.move";
|
|
@@ -5734,7 +5743,7 @@ const {updateBounds: updateBounds$1} = BranchHelper;
|
|
|
5734
5743
|
|
|
5735
5744
|
const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$3} = BoundsHelper;
|
|
5736
5745
|
|
|
5737
|
-
const {toBounds: toBounds
|
|
5746
|
+
const {toBounds: toBounds} = PathBounds;
|
|
5738
5747
|
|
|
5739
5748
|
const LeafBounds = {
|
|
5740
5749
|
__updateWorldBounds() {
|
|
@@ -5806,8 +5815,8 @@ const LeafBounds = {
|
|
|
5806
5815
|
__updateBoxBounds(_secondLayout, _bounds) {
|
|
5807
5816
|
const b = this.__layout.boxBounds;
|
|
5808
5817
|
const data = this.__;
|
|
5809
|
-
if (data.
|
|
5810
|
-
toBounds
|
|
5818
|
+
if (data.__usePathBox) {
|
|
5819
|
+
toBounds(data.path, b);
|
|
5811
5820
|
} else {
|
|
5812
5821
|
b.x = 0;
|
|
5813
5822
|
b.y = 0;
|
|
@@ -6742,7 +6751,7 @@ class LeafLevelList {
|
|
|
6742
6751
|
}
|
|
6743
6752
|
}
|
|
6744
6753
|
|
|
6745
|
-
const version = "1.9.
|
|
6754
|
+
const version = "1.9.6";
|
|
6746
6755
|
|
|
6747
6756
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6748
6757
|
get allowBackgroundColor() {
|
|
@@ -7165,7 +7174,7 @@ class Renderer {
|
|
|
7165
7174
|
this.times = 0;
|
|
7166
7175
|
this.config = {
|
|
7167
7176
|
usePartRender: true,
|
|
7168
|
-
maxFPS:
|
|
7177
|
+
maxFPS: 120
|
|
7169
7178
|
};
|
|
7170
7179
|
this.target = target;
|
|
7171
7180
|
this.canvas = canvas;
|
|
@@ -7320,11 +7329,15 @@ class Renderer {
|
|
|
7320
7329
|
if (this.requestTime || !target) return;
|
|
7321
7330
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
7322
7331
|
const requestTime = this.requestTime = Date.now();
|
|
7323
|
-
|
|
7324
|
-
|
|
7332
|
+
const render = () => {
|
|
7333
|
+
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
7334
|
+
const {maxFPS: maxFPS} = this.config;
|
|
7335
|
+
if (maxFPS && nowFPS > maxFPS - .5) return Platform.requestRender(render);
|
|
7336
|
+
this.FPS = Math.min(120, Math.ceil(nowFPS));
|
|
7325
7337
|
this.requestTime = 0;
|
|
7326
7338
|
this.checkRender();
|
|
7327
|
-
}
|
|
7339
|
+
};
|
|
7340
|
+
Platform.requestRender(render);
|
|
7328
7341
|
}
|
|
7329
7342
|
__onResize(e) {
|
|
7330
7343
|
if (this.canvas.unreal) return;
|
|
@@ -7367,7 +7380,8 @@ class Renderer {
|
|
|
7367
7380
|
if (this.target) {
|
|
7368
7381
|
this.stop();
|
|
7369
7382
|
this.__removeListenEvents();
|
|
7370
|
-
this.
|
|
7383
|
+
this.config = {};
|
|
7384
|
+
this.target = this.canvas = null;
|
|
7371
7385
|
}
|
|
7372
7386
|
}
|
|
7373
7387
|
}
|
|
@@ -7675,7 +7689,11 @@ class LeaferData extends GroupData {
|
|
|
7675
7689
|
|
|
7676
7690
|
class FrameData extends BoxData {}
|
|
7677
7691
|
|
|
7678
|
-
class LineData extends UIData {
|
|
7692
|
+
class LineData extends UIData {
|
|
7693
|
+
get __usePathBox() {
|
|
7694
|
+
return this.points || this.__pathInputed;
|
|
7695
|
+
}
|
|
7696
|
+
}
|
|
7679
7697
|
|
|
7680
7698
|
class RectData extends UIData {
|
|
7681
7699
|
get __boxStroke() {
|
|
@@ -7689,7 +7707,7 @@ class EllipseData extends UIData {
|
|
|
7689
7707
|
}
|
|
7690
7708
|
}
|
|
7691
7709
|
|
|
7692
|
-
class PolygonData extends
|
|
7710
|
+
class PolygonData extends LineData {}
|
|
7693
7711
|
|
|
7694
7712
|
class StarData extends UIData {}
|
|
7695
7713
|
|
|
@@ -7733,8 +7751,6 @@ class TextData extends UIData {
|
|
|
7733
7751
|
if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
|
|
7734
7752
|
box.set(value);
|
|
7735
7753
|
if (boxLayout.strokeChanged) layout.strokeChange();
|
|
7736
|
-
if (boxLayout.renderChanged) layout.renderChange();
|
|
7737
|
-
box.__updateChange();
|
|
7738
7754
|
} else if (box) {
|
|
7739
7755
|
t.__box = box.parent = null;
|
|
7740
7756
|
box.destroy();
|
|
@@ -7804,7 +7820,7 @@ const UIBounds = {
|
|
|
7804
7820
|
__updateRenderSpread() {
|
|
7805
7821
|
let width = 0;
|
|
7806
7822
|
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
|
|
7807
|
-
if (shadow)
|
|
7823
|
+
if (shadow) width = Effect.getShadowSpread(this, shadow);
|
|
7808
7824
|
if (blur) width = Math.max(width, blur);
|
|
7809
7825
|
if (filter) width += Filter.getSpread(filter);
|
|
7810
7826
|
if (renderSpread) width += renderSpread;
|
|
@@ -7817,36 +7833,69 @@ const UIBounds = {
|
|
|
7817
7833
|
}
|
|
7818
7834
|
};
|
|
7819
7835
|
|
|
7836
|
+
const {float: float} = MathHelper;
|
|
7837
|
+
|
|
7838
|
+
const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
|
|
7839
|
+
|
|
7820
7840
|
const DragBoundsHelper = {
|
|
7841
|
+
limitMove(leaf, move) {
|
|
7842
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7843
|
+
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
|
|
7844
|
+
D.axisMove(leaf, move);
|
|
7845
|
+
},
|
|
7846
|
+
limitScaleOf(leaf, origin, scale) {
|
|
7847
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7848
|
+
if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
|
|
7849
|
+
},
|
|
7850
|
+
axisMove(leaf, move) {
|
|
7851
|
+
const {draggable: draggable} = leaf;
|
|
7852
|
+
if (draggable === "x") move.y = 0;
|
|
7853
|
+
if (draggable === "y") move.x = 0;
|
|
7854
|
+
},
|
|
7855
|
+
getDragBounds(leaf) {
|
|
7856
|
+
const {dragBounds: dragBounds} = leaf;
|
|
7857
|
+
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
7858
|
+
},
|
|
7859
|
+
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
7860
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
7861
|
+
},
|
|
7821
7862
|
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
7822
7863
|
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
7823
7864
|
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
7824
7865
|
if (!change) move = Object.assign({}, move);
|
|
7825
|
-
|
|
7826
|
-
const isBiggerHeight = content.height > dragBounds.height;
|
|
7827
|
-
if (isBiggerWidth && dragBoundsType !== "outer") {
|
|
7866
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7828
7867
|
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
7829
7868
|
} else {
|
|
7830
7869
|
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
7831
7870
|
}
|
|
7832
|
-
if (
|
|
7871
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7833
7872
|
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
7834
7873
|
} else {
|
|
7835
7874
|
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
7836
7875
|
}
|
|
7837
|
-
move.x =
|
|
7838
|
-
move.y =
|
|
7876
|
+
move.x = float(move.x);
|
|
7877
|
+
move.y = float(move.y);
|
|
7839
7878
|
return move;
|
|
7840
7879
|
},
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7880
|
+
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
|
|
7881
|
+
if (!change) scale = Object.assign({}, scale);
|
|
7882
|
+
let fitScaleX, fitScaleY;
|
|
7883
|
+
tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
|
|
7884
|
+
tempMerge.set(tempContent).add(dragBounds);
|
|
7885
|
+
tempIntersect.set(tempContent).intersect(dragBounds);
|
|
7886
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7887
|
+
fitScaleX = tempMerge.width / tempContent.width;
|
|
7888
|
+
} else {
|
|
7889
|
+
fitScaleX = tempIntersect.width / tempContent.width;
|
|
7890
|
+
}
|
|
7891
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7892
|
+
fitScaleY = tempMerge.height / tempContent.height;
|
|
7893
|
+
} else {
|
|
7894
|
+
fitScaleY = tempIntersect.height / tempContent.height;
|
|
7895
|
+
}
|
|
7896
|
+
scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
7897
|
+
scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
7898
|
+
return scale;
|
|
7850
7899
|
}
|
|
7851
7900
|
};
|
|
7852
7901
|
|
|
@@ -7864,7 +7913,7 @@ const UIRender = {
|
|
|
7864
7913
|
}
|
|
7865
7914
|
if (data.__useEffect) {
|
|
7866
7915
|
const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7867
|
-
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"));
|
|
7916
|
+
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"));
|
|
7868
7917
|
data.__useEffect = !!(shadow || otherEffect);
|
|
7869
7918
|
}
|
|
7870
7919
|
data.__checkSingle();
|
|
@@ -7999,20 +8048,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7999
8048
|
if (!path) this.__drawPathByBox(pen);
|
|
8000
8049
|
return pen;
|
|
8001
8050
|
}
|
|
8002
|
-
constructor(data) {
|
|
8003
|
-
super(data);
|
|
8004
|
-
}
|
|
8005
8051
|
reset(_data) {}
|
|
8006
|
-
set(data,
|
|
8007
|
-
if (data)
|
|
8008
|
-
if (transition) {
|
|
8009
|
-
if (transition === "temp") {
|
|
8010
|
-
this.lockNormalStyle = true;
|
|
8011
|
-
Object.assign(this, data);
|
|
8012
|
-
this.lockNormalStyle = false;
|
|
8013
|
-
} else this.animate(data, transition);
|
|
8014
|
-
} else Object.assign(this, data);
|
|
8015
|
-
}
|
|
8052
|
+
set(data, _transition) {
|
|
8053
|
+
if (data) Object.assign(this, data);
|
|
8016
8054
|
}
|
|
8017
8055
|
get(name) {
|
|
8018
8056
|
return isString(name) ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
@@ -8058,7 +8096,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8058
8096
|
const data = this.__;
|
|
8059
8097
|
if (data.path) {
|
|
8060
8098
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
8061
|
-
if (data.__useArrow) PathArrow.addArrows(this
|
|
8099
|
+
if (data.__useArrow) PathArrow.addArrows(this);
|
|
8062
8100
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
8063
8101
|
}
|
|
8064
8102
|
__drawRenderPath(canvas) {
|
|
@@ -8082,7 +8120,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8082
8120
|
drawImagePlaceholder(canvas, _image) {
|
|
8083
8121
|
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
8084
8122
|
}
|
|
8085
|
-
animate(
|
|
8123
|
+
animate(keyframe, _options, _type, _isTemp) {
|
|
8124
|
+
this.set(keyframe);
|
|
8086
8125
|
return Plugin.need("animate");
|
|
8087
8126
|
}
|
|
8088
8127
|
killAnimate(_type, _nextStyle) {}
|
|
@@ -8271,9 +8310,6 @@ let Group = class Group extends UI {
|
|
|
8271
8310
|
get isBranch() {
|
|
8272
8311
|
return true;
|
|
8273
8312
|
}
|
|
8274
|
-
constructor(data) {
|
|
8275
|
-
super(data);
|
|
8276
|
-
}
|
|
8277
8313
|
reset(data) {
|
|
8278
8314
|
this.__setBranch();
|
|
8279
8315
|
super.reset(data);
|
|
@@ -8398,7 +8434,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8398
8434
|
const canvas = this.canvas = Creator.canvas(config);
|
|
8399
8435
|
this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
|
|
8400
8436
|
if (this.isApp) this.__setApp();
|
|
8401
|
-
this.__checkAutoLayout(
|
|
8437
|
+
this.__checkAutoLayout();
|
|
8402
8438
|
this.view = canvas.view;
|
|
8403
8439
|
if (!parentApp) {
|
|
8404
8440
|
this.selector = Creator.selector(this);
|
|
@@ -8497,7 +8533,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8497
8533
|
this.leafer = leafer;
|
|
8498
8534
|
this.__level = 1;
|
|
8499
8535
|
}
|
|
8500
|
-
__checkAutoLayout(
|
|
8536
|
+
__checkAutoLayout() {
|
|
8537
|
+
const {config: config, parentApp: parentApp} = this;
|
|
8501
8538
|
if (!parentApp) {
|
|
8502
8539
|
if (!config.width || !config.height) this.autoLayout = new AutoBounds(config);
|
|
8503
8540
|
this.canvas.startAutoLayout(this.autoLayout, this.__onResize.bind(this));
|
|
@@ -8514,7 +8551,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8514
8551
|
} else if (attrName === "zIndex") {
|
|
8515
8552
|
this.canvas.zIndex = newValue;
|
|
8516
8553
|
setTimeout(() => this.parent && this.parent.__updateSortChildren());
|
|
8517
|
-
}
|
|
8554
|
+
} else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
|
|
8555
|
+
mode: newValue
|
|
8556
|
+
});
|
|
8518
8557
|
}
|
|
8519
8558
|
return super.__setAttr(attrName, newValue);
|
|
8520
8559
|
}
|
|
@@ -8523,9 +8562,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8523
8562
|
return super.__getAttr(attrName);
|
|
8524
8563
|
}
|
|
8525
8564
|
__changeCanvasSize(attrName, newValue) {
|
|
8526
|
-
const
|
|
8527
|
-
data
|
|
8528
|
-
|
|
8565
|
+
const {config: config, canvas: canvas} = this;
|
|
8566
|
+
const data = DataHelper.copyAttrs({}, canvas, canvasSizeAttrs);
|
|
8567
|
+
data[attrName] = config[attrName] = newValue;
|
|
8568
|
+
config.width && config.height ? canvas.stopAutoLayout() : this.__checkAutoLayout();
|
|
8529
8569
|
this.__doResize(data);
|
|
8530
8570
|
}
|
|
8531
8571
|
__changeFill(newValue) {
|
|
@@ -8672,9 +8712,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8672
8712
|
if (!this.parent) {
|
|
8673
8713
|
if (this.selector) this.selector.destroy();
|
|
8674
8714
|
if (this.hitCanvasManager) this.hitCanvasManager.destroy();
|
|
8675
|
-
this.canvasManager.destroy();
|
|
8715
|
+
if (this.canvasManager) this.canvasManager.destroy();
|
|
8676
8716
|
}
|
|
8677
|
-
this.canvas.destroy();
|
|
8717
|
+
if (this.canvas) this.canvas.destroy();
|
|
8678
8718
|
this.config.view = this.view = this.parentApp = null;
|
|
8679
8719
|
if (this.userConfig) this.userConfig.view = null;
|
|
8680
8720
|
super.destroy();
|
|
@@ -8696,15 +8736,14 @@ __decorate([ dataProcessor(LeaferData) ], Leafer.prototype, "__", void 0);
|
|
|
8696
8736
|
|
|
8697
8737
|
__decorate([ boundsType() ], Leafer.prototype, "pixelRatio", void 0);
|
|
8698
8738
|
|
|
8739
|
+
__decorate([ dataType("normal") ], Leafer.prototype, "mode", void 0);
|
|
8740
|
+
|
|
8699
8741
|
Leafer = Leafer_1 = __decorate([ registerUI() ], Leafer);
|
|
8700
8742
|
|
|
8701
8743
|
let Rect = class Rect extends UI {
|
|
8702
8744
|
get __tag() {
|
|
8703
8745
|
return "Rect";
|
|
8704
8746
|
}
|
|
8705
|
-
constructor(data) {
|
|
8706
|
-
super(data);
|
|
8707
|
-
}
|
|
8708
8747
|
};
|
|
8709
8748
|
|
|
8710
8749
|
__decorate([ dataProcessor(RectData) ], Rect.prototype, "__", void 0);
|
|
@@ -8836,9 +8875,6 @@ let Frame = class Frame extends Box {
|
|
|
8836
8875
|
get isFrame() {
|
|
8837
8876
|
return true;
|
|
8838
8877
|
}
|
|
8839
|
-
constructor(data) {
|
|
8840
|
-
super(data);
|
|
8841
|
-
}
|
|
8842
8878
|
};
|
|
8843
8879
|
|
|
8844
8880
|
__decorate([ dataProcessor(FrameData) ], Frame.prototype, "__", void 0);
|
|
@@ -8855,9 +8891,6 @@ let Ellipse = class Ellipse extends UI {
|
|
|
8855
8891
|
get __tag() {
|
|
8856
8892
|
return "Ellipse";
|
|
8857
8893
|
}
|
|
8858
|
-
constructor(data) {
|
|
8859
|
-
super(data);
|
|
8860
|
-
}
|
|
8861
8894
|
__updatePath() {
|
|
8862
8895
|
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
|
|
8863
8896
|
const rx = width / 2, ry = height / 2;
|
|
@@ -8897,98 +8930,29 @@ __decorate([ pathType(0) ], Ellipse.prototype, "endAngle", void 0);
|
|
|
8897
8930
|
|
|
8898
8931
|
Ellipse = __decorate([ registerUI() ], Ellipse);
|
|
8899
8932
|
|
|
8900
|
-
const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
8901
|
-
|
|
8902
|
-
const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
|
|
8903
|
-
|
|
8904
|
-
const {toBounds: toBounds} = PathBounds;
|
|
8905
|
-
|
|
8906
|
-
let Line = class Line extends UI {
|
|
8907
|
-
get __tag() {
|
|
8908
|
-
return "Line";
|
|
8909
|
-
}
|
|
8910
|
-
get toPoint() {
|
|
8911
|
-
const {width: width, rotation: rotation} = this.__;
|
|
8912
|
-
const to = getPointData();
|
|
8913
|
-
if (width) to.x = width;
|
|
8914
|
-
if (rotation) rotate$1(to, rotation);
|
|
8915
|
-
return to;
|
|
8916
|
-
}
|
|
8917
|
-
set toPoint(value) {
|
|
8918
|
-
this.width = getDistance$2(defaultPoint, value);
|
|
8919
|
-
this.rotation = getAngle$1(defaultPoint, value);
|
|
8920
|
-
if (this.height) this.height = 0;
|
|
8921
|
-
}
|
|
8922
|
-
constructor(data) {
|
|
8923
|
-
super(data);
|
|
8924
|
-
}
|
|
8925
|
-
__updatePath() {
|
|
8926
|
-
const data = this.__;
|
|
8927
|
-
const path = data.path = [];
|
|
8928
|
-
if (data.points) {
|
|
8929
|
-
drawPoints$1(path, data.points, false, data.closed);
|
|
8930
|
-
} else {
|
|
8931
|
-
moveTo$2(path, 0, 0);
|
|
8932
|
-
lineTo$2(path, this.width, 0);
|
|
8933
|
-
}
|
|
8934
|
-
}
|
|
8935
|
-
__updateRenderPath() {
|
|
8936
|
-
const data = this.__;
|
|
8937
|
-
if (!this.pathInputed && data.points && data.curve) {
|
|
8938
|
-
drawPoints$1(data.__pathForRender = [], data.points, data.curve, data.closed);
|
|
8939
|
-
if (data.__useArrow) PathArrow.addArrows(this, false);
|
|
8940
|
-
} else super.__updateRenderPath();
|
|
8941
|
-
}
|
|
8942
|
-
__updateBoxBounds() {
|
|
8943
|
-
if (this.points) {
|
|
8944
|
-
toBounds(this.__.__pathForRender, this.__layout.boxBounds);
|
|
8945
|
-
} else super.__updateBoxBounds();
|
|
8946
|
-
}
|
|
8947
|
-
};
|
|
8948
|
-
|
|
8949
|
-
__decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
|
|
8950
|
-
|
|
8951
|
-
__decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
|
|
8952
|
-
|
|
8953
|
-
__decorate([ boundsType(0) ], Line.prototype, "height", void 0);
|
|
8954
|
-
|
|
8955
|
-
__decorate([ pathType() ], Line.prototype, "points", void 0);
|
|
8956
|
-
|
|
8957
|
-
__decorate([ pathType(0) ], Line.prototype, "curve", void 0);
|
|
8958
|
-
|
|
8959
|
-
__decorate([ pathType(false) ], Line.prototype, "closed", void 0);
|
|
8960
|
-
|
|
8961
|
-
Line = __decorate([ registerUI() ], Line);
|
|
8962
|
-
|
|
8963
8933
|
const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
|
|
8964
8934
|
|
|
8965
|
-
const {moveTo: moveTo$
|
|
8966
|
-
|
|
8967
|
-
const line = Line.prototype;
|
|
8935
|
+
const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
8968
8936
|
|
|
8969
8937
|
let Polygon = class Polygon extends UI {
|
|
8970
8938
|
get __tag() {
|
|
8971
8939
|
return "Polygon";
|
|
8972
8940
|
}
|
|
8973
|
-
constructor(data) {
|
|
8974
|
-
super(data);
|
|
8975
|
-
}
|
|
8976
8941
|
__updatePath() {
|
|
8977
|
-
const
|
|
8978
|
-
|
|
8979
|
-
|
|
8942
|
+
const data = this.__;
|
|
8943
|
+
const path = data.path = [];
|
|
8944
|
+
if (data.points) {
|
|
8945
|
+
drawPoints$1(path, data.points, data.curve, true);
|
|
8980
8946
|
} else {
|
|
8981
|
-
const {width: width, height: height, sides: sides} =
|
|
8947
|
+
const {width: width, height: height, sides: sides} = data;
|
|
8982
8948
|
const rx = width / 2, ry = height / 2;
|
|
8983
|
-
moveTo$
|
|
8949
|
+
moveTo$2(path, rx, 0);
|
|
8984
8950
|
for (let i = 1; i < sides; i++) {
|
|
8985
|
-
lineTo$
|
|
8951
|
+
lineTo$2(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
|
|
8986
8952
|
}
|
|
8987
8953
|
closePath$1(path);
|
|
8988
8954
|
}
|
|
8989
8955
|
}
|
|
8990
|
-
__updateRenderPath() {}
|
|
8991
|
-
__updateBoxBounds() {}
|
|
8992
8956
|
};
|
|
8993
8957
|
|
|
8994
8958
|
__decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
|
|
@@ -8999,30 +8963,23 @@ __decorate([ pathType() ], Polygon.prototype, "points", void 0);
|
|
|
8999
8963
|
|
|
9000
8964
|
__decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
|
|
9001
8965
|
|
|
9002
|
-
__decorate([ rewrite(line.__updateRenderPath) ], Polygon.prototype, "__updateRenderPath", null);
|
|
9003
|
-
|
|
9004
|
-
__decorate([ rewrite(line.__updateBoxBounds) ], Polygon.prototype, "__updateBoxBounds", null);
|
|
9005
|
-
|
|
9006
8966
|
Polygon = __decorate([ rewriteAble(), registerUI() ], Polygon);
|
|
9007
8967
|
|
|
9008
8968
|
const {sin: sin, cos: cos, PI: PI} = Math;
|
|
9009
8969
|
|
|
9010
|
-
const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
|
|
8970
|
+
const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
|
|
9011
8971
|
|
|
9012
8972
|
let Star = class Star extends UI {
|
|
9013
8973
|
get __tag() {
|
|
9014
8974
|
return "Star";
|
|
9015
8975
|
}
|
|
9016
|
-
constructor(data) {
|
|
9017
|
-
super(data);
|
|
9018
|
-
}
|
|
9019
8976
|
__updatePath() {
|
|
9020
8977
|
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
9021
8978
|
const rx = width / 2, ry = height / 2;
|
|
9022
8979
|
const path = this.__.path = [];
|
|
9023
|
-
moveTo(path, rx, 0);
|
|
8980
|
+
moveTo$1(path, rx, 0);
|
|
9024
8981
|
for (let i = 1; i < corners * 2; i++) {
|
|
9025
|
-
lineTo(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
|
|
8982
|
+
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));
|
|
9026
8983
|
}
|
|
9027
8984
|
closePath(path);
|
|
9028
8985
|
}
|
|
@@ -9036,6 +8993,52 @@ __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
|
|
|
9036
8993
|
|
|
9037
8994
|
Star = __decorate([ registerUI() ], Star);
|
|
9038
8995
|
|
|
8996
|
+
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
8997
|
+
|
|
8998
|
+
const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
|
|
8999
|
+
|
|
9000
|
+
let Line = class Line extends UI {
|
|
9001
|
+
get __tag() {
|
|
9002
|
+
return "Line";
|
|
9003
|
+
}
|
|
9004
|
+
get toPoint() {
|
|
9005
|
+
const {width: width, rotation: rotation} = this.__;
|
|
9006
|
+
const to = getPointData();
|
|
9007
|
+
if (width) to.x = width;
|
|
9008
|
+
if (rotation) rotate$1(to, rotation);
|
|
9009
|
+
return to;
|
|
9010
|
+
}
|
|
9011
|
+
set toPoint(value) {
|
|
9012
|
+
this.width = getDistance$2(defaultPoint, value);
|
|
9013
|
+
this.rotation = getAngle$1(defaultPoint, value);
|
|
9014
|
+
if (this.height) this.height = 0;
|
|
9015
|
+
}
|
|
9016
|
+
__updatePath() {
|
|
9017
|
+
const data = this.__;
|
|
9018
|
+
const path = data.path = [];
|
|
9019
|
+
if (data.points) {
|
|
9020
|
+
drawPoints(path, data.points, data.curve, data.closed);
|
|
9021
|
+
} else {
|
|
9022
|
+
moveTo(path, 0, 0);
|
|
9023
|
+
lineTo(path, this.width, 0);
|
|
9024
|
+
}
|
|
9025
|
+
}
|
|
9026
|
+
};
|
|
9027
|
+
|
|
9028
|
+
__decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
|
|
9029
|
+
|
|
9030
|
+
__decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
|
|
9031
|
+
|
|
9032
|
+
__decorate([ boundsType(0) ], Line.prototype, "height", void 0);
|
|
9033
|
+
|
|
9034
|
+
__decorate([ pathType() ], Line.prototype, "points", void 0);
|
|
9035
|
+
|
|
9036
|
+
__decorate([ pathType(0) ], Line.prototype, "curve", void 0);
|
|
9037
|
+
|
|
9038
|
+
__decorate([ pathType(false) ], Line.prototype, "closed", void 0);
|
|
9039
|
+
|
|
9040
|
+
Line = __decorate([ registerUI() ], Line);
|
|
9041
|
+
|
|
9039
9042
|
let Image = class Image extends Rect {
|
|
9040
9043
|
get __tag() {
|
|
9041
9044
|
return "Image";
|
|
@@ -9048,9 +9051,6 @@ let Image = class Image extends Rect {
|
|
|
9048
9051
|
const {fill: fill} = this.__;
|
|
9049
9052
|
return isArray(fill) && fill[0].image;
|
|
9050
9053
|
}
|
|
9051
|
-
constructor(data) {
|
|
9052
|
-
super(data);
|
|
9053
|
-
}
|
|
9054
9054
|
};
|
|
9055
9055
|
|
|
9056
9056
|
__decorate([ dataProcessor(ImageData) ], Image.prototype, "__", void 0);
|
|
@@ -9150,9 +9150,6 @@ let Text = class Text extends UI {
|
|
|
9150
9150
|
this.updateLayout();
|
|
9151
9151
|
return this.__.__textDrawData;
|
|
9152
9152
|
}
|
|
9153
|
-
constructor(data) {
|
|
9154
|
-
super(data);
|
|
9155
|
-
}
|
|
9156
9153
|
__updateTextDrawData() {
|
|
9157
9154
|
const data = this.__;
|
|
9158
9155
|
const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding} = data;
|
|
@@ -9189,10 +9186,6 @@ let Text = class Text extends UI {
|
|
|
9189
9186
|
DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
|
|
9190
9187
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
9191
9188
|
}
|
|
9192
|
-
__onUpdateSize() {
|
|
9193
|
-
if (this.__box) this.__box.__onUpdateSize();
|
|
9194
|
-
super.__onUpdateSize();
|
|
9195
|
-
}
|
|
9196
9189
|
__updateRenderSpread() {
|
|
9197
9190
|
let width = super.__updateRenderSpread();
|
|
9198
9191
|
if (!width) width = this.isOverflow ? 1 : 0;
|
|
@@ -9203,6 +9196,11 @@ let Text = class Text extends UI {
|
|
|
9203
9196
|
copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
9204
9197
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
9205
9198
|
}
|
|
9199
|
+
__updateChange() {
|
|
9200
|
+
super.__updateChange();
|
|
9201
|
+
const box = this.__box;
|
|
9202
|
+
if (box) box.__onUpdateSize(), box.__updateChange();
|
|
9203
|
+
}
|
|
9206
9204
|
__drawRenderPath(canvas) {
|
|
9207
9205
|
canvas.font = this.__.__font;
|
|
9208
9206
|
}
|
|
@@ -9285,9 +9283,6 @@ let Path = class Path extends UI {
|
|
|
9285
9283
|
get __tag() {
|
|
9286
9284
|
return "Path";
|
|
9287
9285
|
}
|
|
9288
|
-
constructor(data) {
|
|
9289
|
-
super(data);
|
|
9290
|
-
}
|
|
9291
9286
|
};
|
|
9292
9287
|
|
|
9293
9288
|
__decorate([ dataProcessor(PathData) ], Path.prototype, "__", void 0);
|
|
@@ -9300,9 +9295,6 @@ let Pen = class Pen extends Group {
|
|
|
9300
9295
|
get __tag() {
|
|
9301
9296
|
return "Pen";
|
|
9302
9297
|
}
|
|
9303
|
-
constructor(data) {
|
|
9304
|
-
super(data);
|
|
9305
|
-
}
|
|
9306
9298
|
setStyle(data) {
|
|
9307
9299
|
const path = this.pathElement = new Path(data);
|
|
9308
9300
|
this.pathStyle = data;
|
|
@@ -9998,7 +9990,7 @@ function ignoreRender(ui, value) {
|
|
|
9998
9990
|
|
|
9999
9991
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
10000
9992
|
|
|
10001
|
-
const {floor: floor, max: max, abs: abs} = Math;
|
|
9993
|
+
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
10002
9994
|
|
|
10003
9995
|
function createPattern(ui, paint, pixelRatio) {
|
|
10004
9996
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -10008,8 +10000,6 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
10008
10000
|
let imageScale, imageMatrix, {width: width, height: height, scaleX: sx, scaleY: sy, transform: transform, repeat: repeat, gap: gap} = data;
|
|
10009
10001
|
scaleX *= pixelRatio;
|
|
10010
10002
|
scaleY *= pixelRatio;
|
|
10011
|
-
const xGap = gap && gap.x * scaleX;
|
|
10012
|
-
const yGap = gap && gap.y * scaleY;
|
|
10013
10003
|
if (sx) {
|
|
10014
10004
|
sx = abs(sx);
|
|
10015
10005
|
sy = abs(sy);
|
|
@@ -10026,7 +10016,10 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
10026
10016
|
if (size > Platform.image.maxCacheSize) return false;
|
|
10027
10017
|
}
|
|
10028
10018
|
let maxSize = Platform.image.maxPatternSize;
|
|
10029
|
-
if (
|
|
10019
|
+
if (image.isSVG) {
|
|
10020
|
+
const ws = width / image.width;
|
|
10021
|
+
if (ws > 1) imageScale = ws / ceil(ws);
|
|
10022
|
+
} else {
|
|
10030
10023
|
const imageSize = image.width * image.height;
|
|
10031
10024
|
if (maxSize > imageSize) maxSize = imageSize;
|
|
10032
10025
|
}
|
|
@@ -10041,18 +10034,20 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
10041
10034
|
scaleX /= sx;
|
|
10042
10035
|
scaleY /= sy;
|
|
10043
10036
|
}
|
|
10037
|
+
const xGap = gap && gap.x * scaleX;
|
|
10038
|
+
const yGap = gap && gap.y * scaleY;
|
|
10044
10039
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
10040
|
+
const canvasWidth = width + (xGap || 0);
|
|
10041
|
+
const canvasHeight = height + (yGap || 0);
|
|
10042
|
+
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
10043
|
+
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
10045
10044
|
if (!imageMatrix) {
|
|
10046
10045
|
imageMatrix = get$1();
|
|
10047
10046
|
if (transform) copy$1(imageMatrix, transform);
|
|
10048
10047
|
}
|
|
10049
10048
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
10050
10049
|
}
|
|
10051
|
-
|
|
10052
|
-
const canvasWidth = width + (xGap || 0), canvasHeight = height + (yGap || 0);
|
|
10053
|
-
scale(imageMatrix, canvasWidth / max(floor(canvasWidth), 1), canvasHeight / max(floor(canvasHeight), 1));
|
|
10054
|
-
}
|
|
10055
|
-
const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap);
|
|
10050
|
+
const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
|
|
10056
10051
|
const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
10057
10052
|
paint.style = pattern;
|
|
10058
10053
|
paint.patternId = id;
|
|
@@ -10294,12 +10289,18 @@ function shadow(ui, current, shape) {
|
|
|
10294
10289
|
}
|
|
10295
10290
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
10296
10291
|
}
|
|
10297
|
-
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
10292
|
+
if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
10298
10293
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
10299
10294
|
});
|
|
10300
10295
|
other.recycle(copyBounds);
|
|
10301
10296
|
}
|
|
10302
10297
|
|
|
10298
|
+
function getShadowSpread(_ui, shadow) {
|
|
10299
|
+
let width = 0;
|
|
10300
|
+
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));
|
|
10301
|
+
return width;
|
|
10302
|
+
}
|
|
10303
|
+
|
|
10303
10304
|
function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
|
|
10304
10305
|
const {bounds: bounds, shapeBounds: shapeBounds} = shape;
|
|
10305
10306
|
if (Platform.fullImageShadow) {
|
|
@@ -10377,7 +10378,11 @@ const EffectModule = {
|
|
|
10377
10378
|
shadow: shadow,
|
|
10378
10379
|
innerShadow: innerShadow,
|
|
10379
10380
|
blur: blur,
|
|
10380
|
-
backgroundBlur: backgroundBlur
|
|
10381
|
+
backgroundBlur: backgroundBlur,
|
|
10382
|
+
getShadowSpread: getShadowSpread,
|
|
10383
|
+
isTransformShadow(_shadow) {
|
|
10384
|
+
return undefined;
|
|
10385
|
+
}
|
|
10381
10386
|
};
|
|
10382
10387
|
|
|
10383
10388
|
const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
|
|
@@ -10885,16 +10890,17 @@ function toTextChar(row) {
|
|
|
10885
10890
|
}
|
|
10886
10891
|
|
|
10887
10892
|
function decorationText(drawData, style) {
|
|
10888
|
-
let type;
|
|
10893
|
+
let type, offset = 0;
|
|
10889
10894
|
const {fontSize: fontSize, textDecoration: textDecoration} = style;
|
|
10890
10895
|
drawData.decorationHeight = fontSize / 11;
|
|
10891
10896
|
if (isObject(textDecoration)) {
|
|
10892
10897
|
type = textDecoration.type;
|
|
10893
10898
|
if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
|
|
10899
|
+
if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
|
|
10894
10900
|
} else type = textDecoration;
|
|
10895
10901
|
switch (type) {
|
|
10896
10902
|
case "under":
|
|
10897
|
-
drawData.decorationY = [ fontSize * .15 ];
|
|
10903
|
+
drawData.decorationY = [ fontSize * .15 + offset ];
|
|
10898
10904
|
break;
|
|
10899
10905
|
|
|
10900
10906
|
case "delete":
|
|
@@ -10902,7 +10908,7 @@ function decorationText(drawData, style) {
|
|
|
10902
10908
|
break;
|
|
10903
10909
|
|
|
10904
10910
|
case "under-delete":
|
|
10905
|
-
drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
|
|
10911
|
+
drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
|
|
10906
10912
|
}
|
|
10907
10913
|
}
|
|
10908
10914
|
|
|
@@ -11000,4 +11006,4 @@ Object.assign(Effect, EffectModule);
|
|
|
11000
11006
|
|
|
11001
11007
|
useCanvas();
|
|
11002
11008
|
|
|
11003
|
-
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|
|
11009
|
+
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|