@leafer/worker 1.9.3 → 1.9.5
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 +187 -185
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +191 -188
- 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
|
@@ -49,7 +49,7 @@ var LeaferUI = function(exports) {
|
|
|
49
49
|
return value === undefined;
|
|
50
50
|
}
|
|
51
51
|
function isNull(value) {
|
|
52
|
-
return value
|
|
52
|
+
return value == null;
|
|
53
53
|
}
|
|
54
54
|
function isString(value) {
|
|
55
55
|
return typeof value === "string";
|
|
@@ -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;
|
|
@@ -285,6 +288,9 @@ var LeaferUI = function(exports) {
|
|
|
285
288
|
num = round$6(num * a) / a;
|
|
286
289
|
return num === -0 ? 0 : num;
|
|
287
290
|
},
|
|
291
|
+
sign(num) {
|
|
292
|
+
return num < 0 ? -1 : 1;
|
|
293
|
+
},
|
|
288
294
|
getScaleData(scale, size, originSize, scaleData) {
|
|
289
295
|
if (!scaleData) scaleData = {};
|
|
290
296
|
if (size) {
|
|
@@ -625,7 +631,7 @@ var LeaferUI = function(exports) {
|
|
|
625
631
|
};
|
|
626
632
|
const M$a = MatrixHelper;
|
|
627
633
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
628
|
-
const {sin: sin$5, cos: cos$5, abs: abs$
|
|
634
|
+
const {sin: sin$5, cos: cos$5, abs: abs$7, sqrt: sqrt$4, atan2: atan2$2, min: min$1, round: round$5} = Math;
|
|
629
635
|
const PointHelper = {
|
|
630
636
|
defaultPoint: getPointData(),
|
|
631
637
|
tempPoint: {},
|
|
@@ -717,8 +723,8 @@ var LeaferUI = function(exports) {
|
|
|
717
723
|
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
718
724
|
},
|
|
719
725
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
720
|
-
const x = abs$
|
|
721
|
-
const y = abs$
|
|
726
|
+
const x = abs$7(x2 - x1);
|
|
727
|
+
const y = abs$7(y2 - y1);
|
|
722
728
|
return sqrt$4(x * x + y * y);
|
|
723
729
|
},
|
|
724
730
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
@@ -1077,10 +1083,10 @@ var LeaferUI = function(exports) {
|
|
|
1077
1083
|
toPoint$6(align, box, to, onlyBoxSize, content, onlyContentSize);
|
|
1078
1084
|
}
|
|
1079
1085
|
};
|
|
1080
|
-
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;
|
|
1081
1087
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1082
1088
|
const {float: float$1, fourNumber: fourNumber$1} = MathHelper;
|
|
1083
|
-
const {floor: floor$3, ceil: ceil$
|
|
1089
|
+
const {floor: floor$3, ceil: ceil$3} = Math;
|
|
1084
1090
|
let right$4, bottom$3, boundsRight, boundsBottom;
|
|
1085
1091
|
const point$2 = {};
|
|
1086
1092
|
const toPoint$5 = {};
|
|
@@ -1204,7 +1210,7 @@ var LeaferUI = function(exports) {
|
|
|
1204
1210
|
point$2.x = t.x;
|
|
1205
1211
|
toOuterPoint$2(matrix, point$2, toPoint$5);
|
|
1206
1212
|
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
1207
|
-
toBounds$
|
|
1213
|
+
toBounds$3(tempPointBounds$1, to);
|
|
1208
1214
|
}
|
|
1209
1215
|
},
|
|
1210
1216
|
toInnerOf(t, matrix, to) {
|
|
@@ -1242,8 +1248,8 @@ var LeaferUI = function(exports) {
|
|
|
1242
1248
|
const {x: x, y: y} = t;
|
|
1243
1249
|
t.x = floor$3(t.x);
|
|
1244
1250
|
t.y = floor$3(t.y);
|
|
1245
|
-
t.width = x > t.x ? ceil$
|
|
1246
|
-
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);
|
|
1247
1253
|
},
|
|
1248
1254
|
unsign(t) {
|
|
1249
1255
|
if (t.width < 0) {
|
|
@@ -1303,7 +1309,7 @@ var LeaferUI = function(exports) {
|
|
|
1303
1309
|
},
|
|
1304
1310
|
setPoints(t, points) {
|
|
1305
1311
|
points.forEach((point, index) => index === 0 ? setPoint$5(tempPointBounds$1, point.x, point.y) : addPoint$3(tempPointBounds$1, point.x, point.y));
|
|
1306
|
-
toBounds$
|
|
1312
|
+
toBounds$3(tempPointBounds$1, t);
|
|
1307
1313
|
},
|
|
1308
1314
|
setPoint(t, point) {
|
|
1309
1315
|
B.set(t, point.x, point.y);
|
|
@@ -2060,15 +2066,15 @@ var LeaferUI = function(exports) {
|
|
|
2060
2066
|
DataHelper.copyAttrs(s, size, canvasSizeAttrs);
|
|
2061
2067
|
canvasSizeAttrs.forEach(key => s[key] || (s[key] = 1));
|
|
2062
2068
|
this.bounds = new Bounds(0, 0, this.width, this.height);
|
|
2063
|
-
|
|
2064
|
-
this.updateViewSize();
|
|
2065
|
-
this.smooth = this.config.smooth;
|
|
2066
|
-
}
|
|
2069
|
+
this.updateViewSize();
|
|
2067
2070
|
this.updateClientBounds();
|
|
2068
|
-
if (this.context
|
|
2069
|
-
this.
|
|
2070
|
-
this.
|
|
2071
|
-
|
|
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
|
+
}
|
|
2072
2078
|
}
|
|
2073
2079
|
}
|
|
2074
2080
|
updateViewSize() {}
|
|
@@ -2369,7 +2375,7 @@ var LeaferUI = function(exports) {
|
|
|
2369
2375
|
data[0] ? drawer.arcTo(x, y, right, y, data[0]) : drawer.lineTo(x, y);
|
|
2370
2376
|
}
|
|
2371
2377
|
};
|
|
2372
|
-
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;
|
|
2373
2379
|
const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
|
|
2374
2380
|
const {set: set, toNumberPoints: toNumberPoints$1} = PointHelper;
|
|
2375
2381
|
const {M: M$9, L: L$a, C: C$8, Q: Q$7, Z: Z$8} = PathCommandMap;
|
|
@@ -2435,9 +2441,11 @@ var LeaferUI = function(exports) {
|
|
|
2435
2441
|
const CBy = toY - y1;
|
|
2436
2442
|
let startRadian = atan2$1(BAy, BAx);
|
|
2437
2443
|
let endRadian = atan2$1(CBy, CBx);
|
|
2444
|
+
const lenBA = hypot(BAx, BAy);
|
|
2445
|
+
const lenCB = hypot(CBx, CBy);
|
|
2438
2446
|
let totalRadian = endRadian - startRadian;
|
|
2439
2447
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2440
|
-
if (
|
|
2448
|
+
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$6(totalRadian - PI$3) < 1e-12) {
|
|
2441
2449
|
if (data) data.push(L$a, x1, y1);
|
|
2442
2450
|
if (setPointBounds) {
|
|
2443
2451
|
setPoint$4(setPointBounds, fromX, fromY);
|
|
@@ -2470,7 +2478,7 @@ var LeaferUI = function(exports) {
|
|
|
2470
2478
|
let totalRadian = endRadian - startRadian;
|
|
2471
2479
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2472
2480
|
if (anticlockwise) totalRadian -= PI2;
|
|
2473
|
-
const parts = ceil$
|
|
2481
|
+
const parts = ceil$2(abs$6(totalRadian / PI_2));
|
|
2474
2482
|
const partRadian = totalRadian / parts;
|
|
2475
2483
|
const partRadian4Sin = sin$4(partRadian / 4);
|
|
2476
2484
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$4(partRadian / 2);
|
|
@@ -2923,7 +2931,7 @@ var LeaferUI = function(exports) {
|
|
|
2923
2931
|
const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
|
|
2924
2932
|
const {M: M$7, L: L$8, C: C$6, Q: Q$5, Z: Z$6, N: N$4, D: D$5, X: X$4, G: G$4, F: F$5, O: O$5, P: P$4, U: U$4} = PathCommandMap;
|
|
2925
2933
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
2926
|
-
const {tan: tan, min: min, abs: abs$
|
|
2934
|
+
const {tan: tan, min: min, abs: abs$5} = Math;
|
|
2927
2935
|
const startPoint = {};
|
|
2928
2936
|
const PathCommandDataHelper = {
|
|
2929
2937
|
beginPath(data) {
|
|
@@ -2979,7 +2987,7 @@ var LeaferUI = function(exports) {
|
|
|
2979
2987
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
2980
2988
|
if (!isUndefined(lastX)) {
|
|
2981
2989
|
const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
|
|
2982
|
-
radius = min(radius, min(d / 2, d / 2 * abs$
|
|
2990
|
+
radius = min(radius, min(d / 2, d / 2 * abs$5(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
2983
2991
|
}
|
|
2984
2992
|
data.push(U$4, x1, y1, x2, y2, radius);
|
|
2985
2993
|
},
|
|
@@ -3010,11 +3018,7 @@ var LeaferUI = function(exports) {
|
|
|
3010
3018
|
this.set(path);
|
|
3011
3019
|
}
|
|
3012
3020
|
set(path) {
|
|
3013
|
-
|
|
3014
|
-
this.__path = isString(path) ? PathHelper.parse(path) : path;
|
|
3015
|
-
} else {
|
|
3016
|
-
this.__path = [];
|
|
3017
|
-
}
|
|
3021
|
+
this.__path = path ? isString(path) ? PathHelper.parse(path) : path : [];
|
|
3018
3022
|
return this;
|
|
3019
3023
|
}
|
|
3020
3024
|
beginPath() {
|
|
@@ -3176,7 +3180,7 @@ var LeaferUI = function(exports) {
|
|
|
3176
3180
|
};
|
|
3177
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;
|
|
3178
3182
|
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
|
|
3179
|
-
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;
|
|
3180
3184
|
const debug$d = Debug.get("PathBounds");
|
|
3181
3185
|
let radius, radiusX, radiusY;
|
|
3182
3186
|
const tempPointBounds = {};
|
|
@@ -3185,7 +3189,7 @@ var LeaferUI = function(exports) {
|
|
|
3185
3189
|
const PathBounds = {
|
|
3186
3190
|
toBounds(data, setBounds) {
|
|
3187
3191
|
PathBounds.toTwoPointBounds(data, setPointBounds);
|
|
3188
|
-
toBounds$
|
|
3192
|
+
toBounds$2(setPointBounds, setBounds);
|
|
3189
3193
|
},
|
|
3190
3194
|
toTwoPointBounds(data, setPointBounds) {
|
|
3191
3195
|
if (!data || !data.length) return setPoint$3(setPointBounds, 0, 0);
|
|
@@ -3367,10 +3371,13 @@ var LeaferUI = function(exports) {
|
|
|
3367
3371
|
return smooth;
|
|
3368
3372
|
}
|
|
3369
3373
|
};
|
|
3370
|
-
|
|
3374
|
+
function path(path) {
|
|
3375
|
+
return new PathCreator(path);
|
|
3376
|
+
}
|
|
3377
|
+
const pen = path();
|
|
3378
|
+
PathHelper.creator = path();
|
|
3371
3379
|
PathHelper.parse = PathConvert.parse;
|
|
3372
3380
|
PathHelper.convertToCanvasData = PathConvert.toCanvasData;
|
|
3373
|
-
const pen = new PathCreator;
|
|
3374
3381
|
const {drawRoundRect: drawRoundRect} = RectHelper;
|
|
3375
3382
|
function roundRect(drawer) {
|
|
3376
3383
|
if (drawer && !drawer.roundRect) {
|
|
@@ -3723,7 +3730,7 @@ var LeaferUI = function(exports) {
|
|
|
3723
3730
|
return FileHelper.alphaPixelTypes.some(item => I$1.isFormat(item, config));
|
|
3724
3731
|
},
|
|
3725
3732
|
isFormat(format, config) {
|
|
3726
|
-
if (config.format
|
|
3733
|
+
if (config.format) return config.format === format;
|
|
3727
3734
|
const {url: url} = config;
|
|
3728
3735
|
if (url.startsWith("data:")) {
|
|
3729
3736
|
if (url.startsWith("data:" + FileHelper.mineType(format))) return true;
|
|
@@ -3738,7 +3745,7 @@ var LeaferUI = function(exports) {
|
|
|
3738
3745
|
};
|
|
3739
3746
|
const I$1 = ImageManager;
|
|
3740
3747
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
3741
|
-
const {floor: floor$2, max: max$
|
|
3748
|
+
const {floor: floor$2, max: max$2} = Math;
|
|
3742
3749
|
class LeaferImage {
|
|
3743
3750
|
get url() {
|
|
3744
3751
|
return this.config.url;
|
|
@@ -3813,7 +3820,7 @@ var LeaferUI = function(exports) {
|
|
|
3813
3820
|
getFull(_filters) {
|
|
3814
3821
|
return this.view;
|
|
3815
3822
|
}
|
|
3816
|
-
getCanvas(width, height, opacity, _filters, xGap, yGap) {
|
|
3823
|
+
getCanvas(width, height, opacity, _filters, xGap, yGap, smooth) {
|
|
3817
3824
|
width || (width = this.width);
|
|
3818
3825
|
height || (height = this.height);
|
|
3819
3826
|
if (this.cache) {
|
|
@@ -3826,9 +3833,10 @@ var LeaferUI = function(exports) {
|
|
|
3826
3833
|
}
|
|
3827
3834
|
if (data) return data;
|
|
3828
3835
|
}
|
|
3829
|
-
const canvas = Platform.origin.createCanvas(max$
|
|
3836
|
+
const canvas = Platform.origin.createCanvas(max$2(floor$2(width + (xGap || 0)), 1), max$2(floor$2(height + (yGap || 0)), 1));
|
|
3830
3837
|
const ctx = canvas.getContext("2d");
|
|
3831
3838
|
if (opacity) ctx.globalAlpha = opacity;
|
|
3839
|
+
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
3832
3840
|
ctx.drawImage(this.view, 0, 0, width, height);
|
|
3833
3841
|
this.cache = this.use > 1 ? {
|
|
3834
3842
|
data: canvas,
|
|
@@ -3867,7 +3875,7 @@ var LeaferUI = function(exports) {
|
|
|
3867
3875
|
return {
|
|
3868
3876
|
get() {
|
|
3869
3877
|
const v = this[privateKey];
|
|
3870
|
-
return
|
|
3878
|
+
return v == null ? defaultValue : v;
|
|
3871
3879
|
},
|
|
3872
3880
|
set(value) {
|
|
3873
3881
|
this[privateKey] = value;
|
|
@@ -4120,21 +4128,21 @@ var LeaferUI = function(exports) {
|
|
|
4120
4128
|
};
|
|
4121
4129
|
} else if (typeof defaultValue === "function") {
|
|
4122
4130
|
property.get = function() {
|
|
4123
|
-
|
|
4124
|
-
return v
|
|
4131
|
+
const v = this[computedKey];
|
|
4132
|
+
return v == null ? defaultValue(this.__leaf) : v;
|
|
4125
4133
|
};
|
|
4126
4134
|
} else if (isObject(defaultValue)) {
|
|
4127
4135
|
const isEmpty = isEmptyData(defaultValue);
|
|
4128
4136
|
property.get = function() {
|
|
4129
|
-
|
|
4130
|
-
return v
|
|
4137
|
+
const v = this[computedKey];
|
|
4138
|
+
return v == null ? this[computedKey] = isEmpty ? {} : DataHelper.clone(defaultValue) : v;
|
|
4131
4139
|
};
|
|
4132
4140
|
}
|
|
4133
4141
|
const isBox = target.isBranchLeaf;
|
|
4134
4142
|
if (key === "width") {
|
|
4135
4143
|
property.get = function() {
|
|
4136
4144
|
const v = this[computedKey];
|
|
4137
|
-
if (v
|
|
4145
|
+
if (v == null) {
|
|
4138
4146
|
const t = this, naturalWidth = t.__naturalWidth, leaf = t.__leaf;
|
|
4139
4147
|
if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.width;
|
|
4140
4148
|
if (naturalWidth) return t._height && t.__useNaturalRatio ? t._height * naturalWidth / t.__naturalHeight : naturalWidth;
|
|
@@ -4144,7 +4152,7 @@ var LeaferUI = function(exports) {
|
|
|
4144
4152
|
} else if (key === "height") {
|
|
4145
4153
|
property.get = function() {
|
|
4146
4154
|
const v = this[computedKey];
|
|
4147
|
-
if (v
|
|
4155
|
+
if (v == null) {
|
|
4148
4156
|
const t = this, naturalHeight = t.__naturalHeight, leaf = t.__leaf;
|
|
4149
4157
|
if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.height;
|
|
4150
4158
|
if (naturalHeight) return t._width && t.__useNaturalRatio ? t._width * naturalHeight / t.__naturalWidth : naturalHeight;
|
|
@@ -4428,8 +4436,9 @@ var LeaferUI = function(exports) {
|
|
|
4428
4436
|
};
|
|
4429
4437
|
const L$4 = LeafHelper;
|
|
4430
4438
|
const {updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$4, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L$4;
|
|
4431
|
-
function getTempLocal(t,
|
|
4432
|
-
|
|
4439
|
+
function getTempLocal(t, worldPoint) {
|
|
4440
|
+
t.updateLayout();
|
|
4441
|
+
return t.parent ? PointHelper.tempToInnerOf(worldPoint, t.parent.scrollWorldTransform) : worldPoint;
|
|
4433
4442
|
}
|
|
4434
4443
|
const LeafBoundsHelper = {
|
|
4435
4444
|
worldBounds(target) {
|
|
@@ -4876,7 +4885,7 @@ var LeaferUI = function(exports) {
|
|
|
4876
4885
|
}
|
|
4877
4886
|
boxChange() {
|
|
4878
4887
|
this.boxChanged = true;
|
|
4879
|
-
this.localBoxChanged || this.localBoxChange();
|
|
4888
|
+
this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
|
|
4880
4889
|
this.hitCanvasChanged = true;
|
|
4881
4890
|
}
|
|
4882
4891
|
localBoxChange() {
|
|
@@ -4910,7 +4919,7 @@ var LeaferUI = function(exports) {
|
|
|
4910
4919
|
}
|
|
4911
4920
|
matrixChange() {
|
|
4912
4921
|
this.matrixChanged = true;
|
|
4913
|
-
this.localBoxChanged || this.localBoxChange();
|
|
4922
|
+
this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
|
|
4914
4923
|
}
|
|
4915
4924
|
surfaceChange() {
|
|
4916
4925
|
this.surfaceChanged = true;
|
|
@@ -5354,7 +5363,7 @@ var LeaferUI = function(exports) {
|
|
|
5354
5363
|
const {updateMatrix: updateMatrix$3, updateAllMatrix: updateAllMatrix$3} = LeafHelper;
|
|
5355
5364
|
const {updateBounds: updateBounds$2} = BranchHelper;
|
|
5356
5365
|
const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$2, copy: copy$7} = BoundsHelper;
|
|
5357
|
-
const {toBounds: toBounds$
|
|
5366
|
+
const {toBounds: toBounds$1} = PathBounds;
|
|
5358
5367
|
const LeafBounds = {
|
|
5359
5368
|
__updateWorldBounds() {
|
|
5360
5369
|
const layout = this.__layout;
|
|
@@ -5425,8 +5434,8 @@ var LeaferUI = function(exports) {
|
|
|
5425
5434
|
__updateBoxBounds(_secondLayout, _bounds) {
|
|
5426
5435
|
const b = this.__layout.boxBounds;
|
|
5427
5436
|
const data = this.__;
|
|
5428
|
-
if (data.
|
|
5429
|
-
toBounds$
|
|
5437
|
+
if (data.__usePathBox) {
|
|
5438
|
+
toBounds$1(data.path, b);
|
|
5430
5439
|
} else {
|
|
5431
5440
|
b.x = 0;
|
|
5432
5441
|
b.y = 0;
|
|
@@ -5884,10 +5893,10 @@ var LeaferUI = function(exports) {
|
|
|
5884
5893
|
relative.innerToWorld(world, to, distance);
|
|
5885
5894
|
world = to ? to : world;
|
|
5886
5895
|
}
|
|
5887
|
-
toInnerPoint(this.
|
|
5896
|
+
toInnerPoint(this.scrollWorldTransform, world, to, distance);
|
|
5888
5897
|
}
|
|
5889
5898
|
innerToWorld(inner, to, distance, relative) {
|
|
5890
|
-
toOuterPoint(this.
|
|
5899
|
+
toOuterPoint(this.scrollWorldTransform, inner, to, distance);
|
|
5891
5900
|
if (relative) relative.worldToInner(to ? to : inner, null, distance);
|
|
5892
5901
|
}
|
|
5893
5902
|
getBoxPoint(world, relative, distance, change) {
|
|
@@ -6341,7 +6350,7 @@ var LeaferUI = function(exports) {
|
|
|
6341
6350
|
this.levelMap = null;
|
|
6342
6351
|
}
|
|
6343
6352
|
}
|
|
6344
|
-
const version = "1.9.
|
|
6353
|
+
const version = "1.9.5";
|
|
6345
6354
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6346
6355
|
get allowBackgroundColor() {
|
|
6347
6356
|
return true;
|
|
@@ -6737,7 +6746,7 @@ var LeaferUI = function(exports) {
|
|
|
6737
6746
|
this.times = 0;
|
|
6738
6747
|
this.config = {
|
|
6739
6748
|
usePartRender: true,
|
|
6740
|
-
maxFPS:
|
|
6749
|
+
maxFPS: 120
|
|
6741
6750
|
};
|
|
6742
6751
|
this.target = target;
|
|
6743
6752
|
this.canvas = canvas;
|
|
@@ -6892,11 +6901,15 @@ var LeaferUI = function(exports) {
|
|
|
6892
6901
|
if (this.requestTime || !target) return;
|
|
6893
6902
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
6894
6903
|
const requestTime = this.requestTime = Date.now();
|
|
6895
|
-
|
|
6896
|
-
|
|
6904
|
+
const render = () => {
|
|
6905
|
+
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
6906
|
+
const {maxFPS: maxFPS} = this.config;
|
|
6907
|
+
if (maxFPS && nowFPS > maxFPS - .5) return Platform.requestRender(render);
|
|
6908
|
+
this.FPS = Math.min(120, Math.ceil(nowFPS));
|
|
6897
6909
|
this.requestTime = 0;
|
|
6898
6910
|
this.checkRender();
|
|
6899
|
-
}
|
|
6911
|
+
};
|
|
6912
|
+
Platform.requestRender(render);
|
|
6900
6913
|
}
|
|
6901
6914
|
__onResize(e) {
|
|
6902
6915
|
if (this.canvas.unreal) return;
|
|
@@ -6939,7 +6952,8 @@ var LeaferUI = function(exports) {
|
|
|
6939
6952
|
if (this.target) {
|
|
6940
6953
|
this.stop();
|
|
6941
6954
|
this.__removeListenEvents();
|
|
6942
|
-
this.
|
|
6955
|
+
this.config = {};
|
|
6956
|
+
this.target = this.canvas = null;
|
|
6943
6957
|
}
|
|
6944
6958
|
}
|
|
6945
6959
|
}
|
|
@@ -7396,7 +7410,11 @@ var LeaferUI = function(exports) {
|
|
|
7396
7410
|
}
|
|
7397
7411
|
}
|
|
7398
7412
|
class FrameData extends BoxData {}
|
|
7399
|
-
class LineData extends UIData {
|
|
7413
|
+
class LineData extends UIData {
|
|
7414
|
+
get __usePathBox() {
|
|
7415
|
+
return this.points || this.__pathInputed;
|
|
7416
|
+
}
|
|
7417
|
+
}
|
|
7400
7418
|
class RectData extends UIData {
|
|
7401
7419
|
get __boxStroke() {
|
|
7402
7420
|
return !this.__pathInputed;
|
|
@@ -7407,7 +7425,7 @@ var LeaferUI = function(exports) {
|
|
|
7407
7425
|
return !this.__pathInputed;
|
|
7408
7426
|
}
|
|
7409
7427
|
}
|
|
7410
|
-
class PolygonData extends
|
|
7428
|
+
class PolygonData extends LineData {}
|
|
7411
7429
|
class StarData extends UIData {}
|
|
7412
7430
|
class PathData extends UIData {
|
|
7413
7431
|
get __pathInputed() {
|
|
@@ -7701,20 +7719,9 @@ var LeaferUI = function(exports) {
|
|
|
7701
7719
|
if (!path) this.__drawPathByBox(pen);
|
|
7702
7720
|
return pen;
|
|
7703
7721
|
}
|
|
7704
|
-
constructor(data) {
|
|
7705
|
-
super(data);
|
|
7706
|
-
}
|
|
7707
7722
|
reset(_data) {}
|
|
7708
|
-
set(data,
|
|
7709
|
-
if (data)
|
|
7710
|
-
if (transition) {
|
|
7711
|
-
if (transition === "temp") {
|
|
7712
|
-
this.lockNormalStyle = true;
|
|
7713
|
-
Object.assign(this, data);
|
|
7714
|
-
this.lockNormalStyle = false;
|
|
7715
|
-
} else this.animate(data, transition);
|
|
7716
|
-
} else Object.assign(this, data);
|
|
7717
|
-
}
|
|
7723
|
+
set(data, _transition) {
|
|
7724
|
+
if (data) Object.assign(this, data);
|
|
7718
7725
|
}
|
|
7719
7726
|
get(name) {
|
|
7720
7727
|
return isString(name) ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
@@ -7760,7 +7767,7 @@ var LeaferUI = function(exports) {
|
|
|
7760
7767
|
const data = this.__;
|
|
7761
7768
|
if (data.path) {
|
|
7762
7769
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
7763
|
-
if (data.__useArrow) PathArrow.addArrows(this
|
|
7770
|
+
if (data.__useArrow) PathArrow.addArrows(this);
|
|
7764
7771
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
7765
7772
|
}
|
|
7766
7773
|
__drawRenderPath(canvas) {
|
|
@@ -7784,7 +7791,8 @@ var LeaferUI = function(exports) {
|
|
|
7784
7791
|
drawImagePlaceholder(canvas, _image) {
|
|
7785
7792
|
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7786
7793
|
}
|
|
7787
|
-
animate(
|
|
7794
|
+
animate(keyframe, _options, _type, _isTemp) {
|
|
7795
|
+
this.set(keyframe);
|
|
7788
7796
|
return Plugin.need("animate");
|
|
7789
7797
|
}
|
|
7790
7798
|
killAnimate(_type, _nextStyle) {}
|
|
@@ -7898,9 +7906,6 @@ var LeaferUI = function(exports) {
|
|
|
7898
7906
|
get isBranch() {
|
|
7899
7907
|
return true;
|
|
7900
7908
|
}
|
|
7901
|
-
constructor(data) {
|
|
7902
|
-
super(data);
|
|
7903
|
-
}
|
|
7904
7909
|
reset(data) {
|
|
7905
7910
|
this.__setBranch();
|
|
7906
7911
|
super.reset(data);
|
|
@@ -8018,7 +8023,7 @@ var LeaferUI = function(exports) {
|
|
|
8018
8023
|
const canvas = this.canvas = Creator.canvas(config);
|
|
8019
8024
|
this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
|
|
8020
8025
|
if (this.isApp) this.__setApp();
|
|
8021
|
-
this.__checkAutoLayout(
|
|
8026
|
+
this.__checkAutoLayout();
|
|
8022
8027
|
this.view = canvas.view;
|
|
8023
8028
|
if (!parentApp) {
|
|
8024
8029
|
this.selector = Creator.selector(this);
|
|
@@ -8117,7 +8122,8 @@ var LeaferUI = function(exports) {
|
|
|
8117
8122
|
this.leafer = leafer;
|
|
8118
8123
|
this.__level = 1;
|
|
8119
8124
|
}
|
|
8120
|
-
__checkAutoLayout(
|
|
8125
|
+
__checkAutoLayout() {
|
|
8126
|
+
const {config: config, parentApp: parentApp} = this;
|
|
8121
8127
|
if (!parentApp) {
|
|
8122
8128
|
if (!config.width || !config.height) this.autoLayout = new AutoBounds(config);
|
|
8123
8129
|
this.canvas.startAutoLayout(this.autoLayout, this.__onResize.bind(this));
|
|
@@ -8143,9 +8149,10 @@ var LeaferUI = function(exports) {
|
|
|
8143
8149
|
return super.__getAttr(attrName);
|
|
8144
8150
|
}
|
|
8145
8151
|
__changeCanvasSize(attrName, newValue) {
|
|
8146
|
-
const
|
|
8147
|
-
data
|
|
8148
|
-
|
|
8152
|
+
const {config: config, canvas: canvas} = this;
|
|
8153
|
+
const data = DataHelper.copyAttrs({}, canvas, canvasSizeAttrs);
|
|
8154
|
+
data[attrName] = config[attrName] = newValue;
|
|
8155
|
+
config.width && config.height ? canvas.stopAutoLayout() : this.__checkAutoLayout();
|
|
8149
8156
|
this.__doResize(data);
|
|
8150
8157
|
}
|
|
8151
8158
|
__changeFill(newValue) {
|
|
@@ -8292,9 +8299,9 @@ var LeaferUI = function(exports) {
|
|
|
8292
8299
|
if (!this.parent) {
|
|
8293
8300
|
if (this.selector) this.selector.destroy();
|
|
8294
8301
|
if (this.hitCanvasManager) this.hitCanvasManager.destroy();
|
|
8295
|
-
this.canvasManager.destroy();
|
|
8302
|
+
if (this.canvasManager) this.canvasManager.destroy();
|
|
8296
8303
|
}
|
|
8297
|
-
this.canvas.destroy();
|
|
8304
|
+
if (this.canvas) this.canvas.destroy();
|
|
8298
8305
|
this.config.view = this.view = this.parentApp = null;
|
|
8299
8306
|
if (this.userConfig) this.userConfig.view = null;
|
|
8300
8307
|
super.destroy();
|
|
@@ -8317,9 +8324,6 @@ var LeaferUI = function(exports) {
|
|
|
8317
8324
|
get __tag() {
|
|
8318
8325
|
return "Rect";
|
|
8319
8326
|
}
|
|
8320
|
-
constructor(data) {
|
|
8321
|
-
super(data);
|
|
8322
|
-
}
|
|
8323
8327
|
};
|
|
8324
8328
|
__decorate([ dataProcessor(RectData) ], exports.Rect.prototype, "__", void 0);
|
|
8325
8329
|
exports.Rect = __decorate([ useModule(RectRender), rewriteAble(), registerUI() ], exports.Rect);
|
|
@@ -8368,29 +8372,24 @@ var LeaferUI = function(exports) {
|
|
|
8368
8372
|
}
|
|
8369
8373
|
__updateStrokeBounds() {}
|
|
8370
8374
|
__updateRenderBounds() {
|
|
8371
|
-
let isOverflow;
|
|
8375
|
+
let isOverflow, isScrollMode;
|
|
8372
8376
|
if (this.children.length) {
|
|
8373
|
-
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
|
|
8377
|
+
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout, {overflow: overflow} = data;
|
|
8374
8378
|
const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
|
|
8375
8379
|
super.__updateRenderBounds(childrenRenderBounds);
|
|
8376
|
-
if (
|
|
8380
|
+
if (isScrollMode = overflow.includes("scroll")) {
|
|
8377
8381
|
add(childrenRenderBounds, boxBounds);
|
|
8378
8382
|
scroll(childrenRenderBounds, data);
|
|
8379
8383
|
}
|
|
8380
8384
|
this.__updateRectRenderBounds();
|
|
8381
8385
|
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
8382
|
-
if (isOverflow &&
|
|
8386
|
+
if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
|
|
8383
8387
|
} else this.__updateRectRenderBounds();
|
|
8384
8388
|
DataHelper.stintSet(this, "isOverflow", isOverflow);
|
|
8385
|
-
this.__checkScroll();
|
|
8389
|
+
this.__checkScroll(isScrollMode);
|
|
8386
8390
|
}
|
|
8387
8391
|
__updateRectRenderBounds() {}
|
|
8388
|
-
|
|
8389
|
-
if (this.hasScroller) this.__updateScroll();
|
|
8390
|
-
super.__updateWorldBounds();
|
|
8391
|
-
}
|
|
8392
|
-
__checkScroll() {}
|
|
8393
|
-
__updateScroll() {}
|
|
8392
|
+
__checkScroll(_isScrollMode) {}
|
|
8394
8393
|
__updateRectChange() {}
|
|
8395
8394
|
__updateChange() {
|
|
8396
8395
|
super.__updateChange();
|
|
@@ -8436,9 +8435,6 @@ var LeaferUI = function(exports) {
|
|
|
8436
8435
|
get isFrame() {
|
|
8437
8436
|
return true;
|
|
8438
8437
|
}
|
|
8439
|
-
constructor(data) {
|
|
8440
|
-
super(data);
|
|
8441
|
-
}
|
|
8442
8438
|
};
|
|
8443
8439
|
__decorate([ dataProcessor(FrameData) ], exports.Frame.prototype, "__", void 0);
|
|
8444
8440
|
__decorate([ surfaceType("#FFFFFF") ], exports.Frame.prototype, "fill", void 0);
|
|
@@ -8449,9 +8445,6 @@ var LeaferUI = function(exports) {
|
|
|
8449
8445
|
get __tag() {
|
|
8450
8446
|
return "Ellipse";
|
|
8451
8447
|
}
|
|
8452
|
-
constructor(data) {
|
|
8453
|
-
super(data);
|
|
8454
|
-
}
|
|
8455
8448
|
__updatePath() {
|
|
8456
8449
|
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
|
|
8457
8450
|
const rx = width / 2, ry = height / 2;
|
|
@@ -8487,7 +8480,6 @@ var LeaferUI = function(exports) {
|
|
|
8487
8480
|
exports.Ellipse = __decorate([ registerUI() ], exports.Ellipse);
|
|
8488
8481
|
const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
8489
8482
|
const {rotate: rotate$3, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
|
|
8490
|
-
const {toBounds: toBounds$1} = PathBounds;
|
|
8491
8483
|
exports.Line = class Line extends exports.UI {
|
|
8492
8484
|
get __tag() {
|
|
8493
8485
|
return "Line";
|
|
@@ -8504,31 +8496,16 @@ var LeaferUI = function(exports) {
|
|
|
8504
8496
|
this.rotation = getAngle$2(defaultPoint, value);
|
|
8505
8497
|
if (this.height) this.height = 0;
|
|
8506
8498
|
}
|
|
8507
|
-
constructor(data) {
|
|
8508
|
-
super(data);
|
|
8509
|
-
}
|
|
8510
8499
|
__updatePath() {
|
|
8511
8500
|
const data = this.__;
|
|
8512
8501
|
const path = data.path = [];
|
|
8513
8502
|
if (data.points) {
|
|
8514
|
-
drawPoints$1(path, data.points,
|
|
8503
|
+
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
8515
8504
|
} else {
|
|
8516
8505
|
moveTo$2(path, 0, 0);
|
|
8517
8506
|
lineTo$2(path, this.width, 0);
|
|
8518
8507
|
}
|
|
8519
8508
|
}
|
|
8520
|
-
__updateRenderPath() {
|
|
8521
|
-
const data = this.__;
|
|
8522
|
-
if (!this.pathInputed && data.points && data.curve) {
|
|
8523
|
-
drawPoints$1(data.__pathForRender = [], data.points, data.curve, data.closed);
|
|
8524
|
-
if (data.__useArrow) PathArrow.addArrows(this, false);
|
|
8525
|
-
} else super.__updateRenderPath();
|
|
8526
|
-
}
|
|
8527
|
-
__updateBoxBounds() {
|
|
8528
|
-
if (this.points) {
|
|
8529
|
-
toBounds$1(this.__.__pathForRender, this.__layout.boxBounds);
|
|
8530
|
-
} else super.__updateBoxBounds();
|
|
8531
|
-
}
|
|
8532
8509
|
};
|
|
8533
8510
|
__decorate([ dataProcessor(LineData) ], exports.Line.prototype, "__", void 0);
|
|
8534
8511
|
__decorate([ affectStrokeBoundsType("center") ], exports.Line.prototype, "strokeAlign", void 0);
|
|
@@ -8544,15 +8521,13 @@ var LeaferUI = function(exports) {
|
|
|
8544
8521
|
get __tag() {
|
|
8545
8522
|
return "Polygon";
|
|
8546
8523
|
}
|
|
8547
|
-
constructor(data) {
|
|
8548
|
-
super(data);
|
|
8549
|
-
}
|
|
8550
8524
|
__updatePath() {
|
|
8551
|
-
const
|
|
8552
|
-
|
|
8553
|
-
|
|
8525
|
+
const data = this.__;
|
|
8526
|
+
const path = data.path = [];
|
|
8527
|
+
if (data.points) {
|
|
8528
|
+
drawPoints(path, data.points, data.curve, true);
|
|
8554
8529
|
} else {
|
|
8555
|
-
const {width: width, height: height, sides: sides} =
|
|
8530
|
+
const {width: width, height: height, sides: sides} = data;
|
|
8556
8531
|
const rx = width / 2, ry = height / 2;
|
|
8557
8532
|
moveTo$1(path, rx, 0);
|
|
8558
8533
|
for (let i = 1; i < sides; i++) {
|
|
@@ -8577,9 +8552,6 @@ var LeaferUI = function(exports) {
|
|
|
8577
8552
|
get __tag() {
|
|
8578
8553
|
return "Star";
|
|
8579
8554
|
}
|
|
8580
|
-
constructor(data) {
|
|
8581
|
-
super(data);
|
|
8582
|
-
}
|
|
8583
8555
|
__updatePath() {
|
|
8584
8556
|
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
8585
8557
|
const rx = width / 2, ry = height / 2;
|
|
@@ -8607,9 +8579,6 @@ var LeaferUI = function(exports) {
|
|
|
8607
8579
|
const {fill: fill} = this.__;
|
|
8608
8580
|
return isArray(fill) && fill[0].image;
|
|
8609
8581
|
}
|
|
8610
|
-
constructor(data) {
|
|
8611
|
-
super(data);
|
|
8612
|
-
}
|
|
8613
8582
|
};
|
|
8614
8583
|
__decorate([ dataProcessor(ImageData) ], exports.Image.prototype, "__", void 0);
|
|
8615
8584
|
__decorate([ boundsType("") ], exports.Image.prototype, "url", void 0);
|
|
@@ -8694,9 +8663,6 @@ var LeaferUI = function(exports) {
|
|
|
8694
8663
|
this.updateLayout();
|
|
8695
8664
|
return this.__.__textDrawData;
|
|
8696
8665
|
}
|
|
8697
|
-
constructor(data) {
|
|
8698
|
-
super(data);
|
|
8699
|
-
}
|
|
8700
8666
|
__updateTextDrawData() {
|
|
8701
8667
|
const data = this.__;
|
|
8702
8668
|
const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding} = data;
|
|
@@ -8800,9 +8766,6 @@ var LeaferUI = function(exports) {
|
|
|
8800
8766
|
get __tag() {
|
|
8801
8767
|
return "Path";
|
|
8802
8768
|
}
|
|
8803
|
-
constructor(data) {
|
|
8804
|
-
super(data);
|
|
8805
|
-
}
|
|
8806
8769
|
};
|
|
8807
8770
|
__decorate([ dataProcessor(PathData) ], exports.Path.prototype, "__", void 0);
|
|
8808
8771
|
__decorate([ affectStrokeBoundsType("center") ], exports.Path.prototype, "strokeAlign", void 0);
|
|
@@ -8811,9 +8774,6 @@ var LeaferUI = function(exports) {
|
|
|
8811
8774
|
get __tag() {
|
|
8812
8775
|
return "Pen";
|
|
8813
8776
|
}
|
|
8814
|
-
constructor(data) {
|
|
8815
|
-
super(data);
|
|
8816
|
-
}
|
|
8817
8777
|
setStyle(data) {
|
|
8818
8778
|
const path = this.pathElement = new exports.Path(data);
|
|
8819
8779
|
this.pathStyle = data;
|
|
@@ -10732,7 +10692,7 @@ var LeaferUI = function(exports) {
|
|
|
10732
10692
|
if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
|
|
10733
10693
|
}
|
|
10734
10694
|
const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
|
|
10735
|
-
const {floor: floor$1, max: max, abs: abs$
|
|
10695
|
+
const {floor: floor$1, ceil: ceil$1, max: max$1, abs: abs$4} = Math;
|
|
10736
10696
|
function createPattern(ui, paint, pixelRatio) {
|
|
10737
10697
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
10738
10698
|
const id = scaleX + "-" + scaleY + "-" + pixelRatio;
|
|
@@ -10741,11 +10701,9 @@ var LeaferUI = function(exports) {
|
|
|
10741
10701
|
let imageScale, imageMatrix, {width: width, height: height, scaleX: sx, scaleY: sy, transform: transform, repeat: repeat, gap: gap} = data;
|
|
10742
10702
|
scaleX *= pixelRatio;
|
|
10743
10703
|
scaleY *= pixelRatio;
|
|
10744
|
-
const xGap = gap && gap.x * scaleX;
|
|
10745
|
-
const yGap = gap && gap.y * scaleY;
|
|
10746
10704
|
if (sx) {
|
|
10747
|
-
sx = abs$
|
|
10748
|
-
sy = abs$
|
|
10705
|
+
sx = abs$4(sx);
|
|
10706
|
+
sy = abs$4(sy);
|
|
10749
10707
|
imageMatrix = get$1();
|
|
10750
10708
|
copy$4(imageMatrix, transform);
|
|
10751
10709
|
scale$2(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -10759,7 +10717,10 @@ var LeaferUI = function(exports) {
|
|
|
10759
10717
|
if (size > Platform.image.maxCacheSize) return false;
|
|
10760
10718
|
}
|
|
10761
10719
|
let maxSize = Platform.image.maxPatternSize;
|
|
10762
|
-
if (
|
|
10720
|
+
if (image.isSVG) {
|
|
10721
|
+
const ws = width / image.width;
|
|
10722
|
+
if (ws > 1) imageScale = ws / ceil$1(ws);
|
|
10723
|
+
} else {
|
|
10763
10724
|
const imageSize = image.width * image.height;
|
|
10764
10725
|
if (maxSize > imageSize) maxSize = imageSize;
|
|
10765
10726
|
}
|
|
@@ -10774,18 +10735,20 @@ var LeaferUI = function(exports) {
|
|
|
10774
10735
|
scaleX /= sx;
|
|
10775
10736
|
scaleY /= sy;
|
|
10776
10737
|
}
|
|
10738
|
+
const xGap = gap && gap.x * scaleX;
|
|
10739
|
+
const yGap = gap && gap.y * scaleY;
|
|
10777
10740
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
10741
|
+
const canvasWidth = width + (xGap || 0);
|
|
10742
|
+
const canvasHeight = height + (yGap || 0);
|
|
10743
|
+
scaleX /= canvasWidth / max$1(floor$1(canvasWidth), 1);
|
|
10744
|
+
scaleY /= canvasHeight / max$1(floor$1(canvasHeight), 1);
|
|
10778
10745
|
if (!imageMatrix) {
|
|
10779
10746
|
imageMatrix = get$1();
|
|
10780
10747
|
if (transform) copy$4(imageMatrix, transform);
|
|
10781
10748
|
}
|
|
10782
10749
|
scale$2(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
10783
10750
|
}
|
|
10784
|
-
|
|
10785
|
-
const canvasWidth = width + (xGap || 0), canvasHeight = height + (yGap || 0);
|
|
10786
|
-
scale$2(imageMatrix, canvasWidth / max(floor$1(canvasWidth), 1), canvasHeight / max(floor$1(canvasHeight), 1));
|
|
10787
|
-
}
|
|
10788
|
-
const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap);
|
|
10751
|
+
const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
|
|
10789
10752
|
const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
10790
10753
|
paint.style = pattern;
|
|
10791
10754
|
paint.patternId = id;
|
|
@@ -11698,7 +11661,7 @@ var LeaferUI = function(exports) {
|
|
|
11698
11661
|
return (target, key) => {
|
|
11699
11662
|
defineKey(target, key, {
|
|
11700
11663
|
get() {
|
|
11701
|
-
const {config: config, element: element, dragPoint: dragPoint, editBox: editBox} = this, mergeConfig = Object.assign({}, config);
|
|
11664
|
+
const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, app: app} = this, mergeConfig = Object.assign({}, config);
|
|
11702
11665
|
if (element && element.editConfig) Object.assign(mergeConfig, element.editConfig);
|
|
11703
11666
|
if (editBox.config) Object.assign(mergeConfig, editBox.config);
|
|
11704
11667
|
if (dragPoint) {
|
|
@@ -11709,12 +11672,13 @@ var LeaferUI = function(exports) {
|
|
|
11709
11672
|
isNull(mergeConfig.lockRatio) && (mergeConfig.lockRatio = true);
|
|
11710
11673
|
}
|
|
11711
11674
|
}
|
|
11675
|
+
if (isUndefined(mergeConfig.dragLimitAnimate)) mergeConfig.dragLimitAnimate = app && app.config.pointer.dragLimitAnimate;
|
|
11712
11676
|
return this.mergedConfig = mergeConfig;
|
|
11713
11677
|
}
|
|
11714
11678
|
});
|
|
11715
11679
|
};
|
|
11716
11680
|
}
|
|
11717
|
-
const {abs: abs$
|
|
11681
|
+
const {abs: abs$3} = Math;
|
|
11718
11682
|
const {copy: copy$2, scale: scale$1} = MatrixHelper;
|
|
11719
11683
|
const {setListWithFn: setListWithFn} = BoundsHelper;
|
|
11720
11684
|
const {worldBounds: worldBounds} = LeafBoundsHelper;
|
|
@@ -11751,7 +11715,7 @@ var LeaferUI = function(exports) {
|
|
|
11751
11715
|
leaf = list[i];
|
|
11752
11716
|
const {worldTransform: worldTransform, worldRenderBounds: worldRenderBounds} = leaf;
|
|
11753
11717
|
if (worldRenderBounds.width && worldRenderBounds.height && (!bounds || bounds.hit(worldRenderBounds, options.matrix))) {
|
|
11754
|
-
const aScaleX = abs$
|
|
11718
|
+
const aScaleX = abs$3(worldTransform.scaleX), aScaleY = abs$3(worldTransform.scaleY);
|
|
11755
11719
|
copy$2(matrix$1, worldTransform);
|
|
11756
11720
|
matrix$1.half = strokeWidth % 2;
|
|
11757
11721
|
if (aScaleX !== aScaleY) {
|
|
@@ -11765,7 +11729,7 @@ var LeaferUI = function(exports) {
|
|
|
11765
11729
|
canvas.setWorld(matrix$1, options.matrix);
|
|
11766
11730
|
canvas.beginPath();
|
|
11767
11731
|
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
11768
|
-
data.strokeWidth = strokeWidth / abs$
|
|
11732
|
+
data.strokeWidth = strokeWidth / abs$3(worldTransform.scaleX);
|
|
11769
11733
|
}
|
|
11770
11734
|
if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas) : Paint.strokes(stroke, this, canvas);
|
|
11771
11735
|
if (fill) isString(fill) ? Paint.fill(fill, this, canvas) : Paint.fills(fill, this, canvas);
|
|
@@ -12049,7 +12013,7 @@ var LeaferUI = function(exports) {
|
|
|
12049
12013
|
}
|
|
12050
12014
|
const {topLeft: topLeft$1, top: top$1, topRight: topRight$1, right: right$2, bottomRight: bottomRight, bottom: bottom$1, bottomLeft: bottomLeft, left: left$2} = exports.Direction9;
|
|
12051
12015
|
const {toPoint: toPoint} = AroundHelper;
|
|
12052
|
-
const {within: within$
|
|
12016
|
+
const {within: within$3, sign: sign$1} = MathHelper;
|
|
12053
12017
|
const EditDataHelper = {
|
|
12054
12018
|
getScaleData(target, startBounds, direction, totalMove, lockRatio, around, flipable, scaleMode) {
|
|
12055
12019
|
let align, origin = {}, scaleX = 1, scaleY = 1;
|
|
@@ -12061,8 +12025,8 @@ var LeaferUI = function(exports) {
|
|
|
12061
12025
|
}
|
|
12062
12026
|
const originChangedScaleX = target.scaleX / startBounds.scaleX;
|
|
12063
12027
|
const originChangedScaleY = target.scaleY / startBounds.scaleY;
|
|
12064
|
-
const signX = originChangedScaleX
|
|
12065
|
-
const signY = originChangedScaleY
|
|
12028
|
+
const signX = sign$1(originChangedScaleX);
|
|
12029
|
+
const signY = sign$1(originChangedScaleY);
|
|
12066
12030
|
const changedScaleX = scaleMode ? originChangedScaleX : signX * boxBounds.width / width;
|
|
12067
12031
|
const changedScaleY = scaleMode ? originChangedScaleY : signY * boxBounds.height / height;
|
|
12068
12032
|
totalMove.x *= scaleMode ? originChangedScaleX : signX;
|
|
@@ -12162,14 +12126,14 @@ var LeaferUI = function(exports) {
|
|
|
12162
12126
|
}
|
|
12163
12127
|
if (useScaleX && widthRange) {
|
|
12164
12128
|
const nowWidth = boxBounds.width * target.scaleX;
|
|
12165
|
-
scaleX = within$
|
|
12129
|
+
scaleX = within$3(nowWidth * scaleX, widthRange) / nowWidth;
|
|
12166
12130
|
}
|
|
12167
12131
|
if (useScaleY && heightRange) {
|
|
12168
12132
|
const nowHeight = boxBounds.height * target.scaleY;
|
|
12169
|
-
scaleY = within$
|
|
12133
|
+
scaleY = within$3(nowHeight * scaleY, heightRange) / nowHeight;
|
|
12170
12134
|
}
|
|
12171
|
-
if (useScaleX && Math.abs(scaleX * worldBoxBounds.width) < 1) scaleX = (scaleX
|
|
12172
|
-
if (useScaleY && Math.abs(scaleY * worldBoxBounds.height) < 1) scaleY = (scaleY
|
|
12135
|
+
if (useScaleX && Math.abs(scaleX * worldBoxBounds.width) < 1) scaleX = sign$1(scaleX) / worldBoxBounds.width;
|
|
12136
|
+
if (useScaleY && Math.abs(scaleY * worldBoxBounds.height) < 1) scaleY = sign$1(scaleY) / worldBoxBounds.height;
|
|
12173
12137
|
if (lockRatio && scaleX !== scaleY) scaleY = scaleX = Math.min(scaleX, scaleY);
|
|
12174
12138
|
return {
|
|
12175
12139
|
origin: origin,
|
|
@@ -12664,7 +12628,7 @@ var LeaferUI = function(exports) {
|
|
|
12664
12628
|
if (pointType && pointType.includes("resize")) ResizeEvent.resizingKeys = editor.leafList.keys;
|
|
12665
12629
|
}
|
|
12666
12630
|
onDragEnd(e) {
|
|
12667
|
-
if (this.moving) this.transformTool.onMove(e);
|
|
12631
|
+
if (this.moving && this.mergeConfig.dragLimitAnimate && this.target.dragBounds) this.transformTool.onMove(e);
|
|
12668
12632
|
this.dragPoint = null;
|
|
12669
12633
|
this.resetDoing();
|
|
12670
12634
|
const {name: name, pointType: pointType} = e.current;
|
|
@@ -13135,9 +13099,8 @@ var LeaferUI = function(exports) {
|
|
|
13135
13099
|
EditorSkewEvent.SKEW = "editor.skew";
|
|
13136
13100
|
class TransformTool {
|
|
13137
13101
|
onMove(e) {
|
|
13138
|
-
const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData
|
|
13102
|
+
const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData} = this.editBox;
|
|
13139
13103
|
let move, {dragLimitAnimate: dragLimitAnimate} = mergeConfig;
|
|
13140
|
-
if (isUndefined(dragLimitAnimate)) dragLimitAnimate = app && app.config.pointer.dragLimitAnimate;
|
|
13141
13104
|
const isMoveEnd = e.type === exports.MoveEvent.END || e.type === exports.DragEvent.END;
|
|
13142
13105
|
const axisDrag = isString(target.draggable);
|
|
13143
13106
|
const checkLimitMove = !dragLimitAnimate || isMoveEnd || axisDrag;
|
|
@@ -14479,6 +14442,7 @@ var LeaferUI = function(exports) {
|
|
|
14479
14442
|
};
|
|
14480
14443
|
}
|
|
14481
14444
|
};
|
|
14445
|
+
const {abs: abs$2, max: max} = Math, {sign: sign, within: within$2} = MathHelper;
|
|
14482
14446
|
const WheelEventHelper = {
|
|
14483
14447
|
getMove(event, config) {
|
|
14484
14448
|
let {moveSpeed: moveSpeed} = config;
|
|
@@ -14487,8 +14451,9 @@ var LeaferUI = function(exports) {
|
|
|
14487
14451
|
deltaX = deltaY;
|
|
14488
14452
|
deltaY = 0;
|
|
14489
14453
|
}
|
|
14490
|
-
|
|
14491
|
-
if (
|
|
14454
|
+
const absX = abs$2(deltaX), absY = abs$2(deltaY);
|
|
14455
|
+
if (absX > 50) deltaX = max(50, absX / 3) * sign(deltaX);
|
|
14456
|
+
if (absY > 50) deltaY = max(50, absY / 3) * sign(deltaY);
|
|
14492
14457
|
return {
|
|
14493
14458
|
x: -deltaX * moveSpeed * 2,
|
|
14494
14459
|
y: -deltaY * moveSpeed * 2
|
|
@@ -14506,11 +14471,10 @@ var LeaferUI = function(exports) {
|
|
|
14506
14471
|
zoom = !event.shiftKey && (event.metaKey || event.ctrlKey);
|
|
14507
14472
|
}
|
|
14508
14473
|
if (zoom) {
|
|
14509
|
-
zoomSpeed =
|
|
14474
|
+
zoomSpeed = within$2(zoomSpeed, 0, 1);
|
|
14510
14475
|
const min = event.deltaY ? config.delta.y : config.delta.x;
|
|
14511
|
-
|
|
14512
|
-
|
|
14513
|
-
if (scale >= 1.5) scale = 1.5;
|
|
14476
|
+
const absScale = within$2(1 - abs$2(delta) / (min * 4) * zoomSpeed, .5, 2);
|
|
14477
|
+
scale = delta > 0 ? absScale : 1 / absScale;
|
|
14514
14478
|
}
|
|
14515
14479
|
return scale;
|
|
14516
14480
|
}
|
|
@@ -15023,6 +14987,9 @@ var LeaferUI = function(exports) {
|
|
|
15023
14987
|
super(data);
|
|
15024
14988
|
this.__.__useArrow = true;
|
|
15025
14989
|
}
|
|
14990
|
+
static registerArrow(name, data) {
|
|
14991
|
+
PathArrow.register(name, data);
|
|
14992
|
+
}
|
|
15026
14993
|
};
|
|
15027
14994
|
__decorate([ dataProcessor(ArrowData) ], exports.Arrow.prototype, "__", void 0);
|
|
15028
14995
|
__decorate([ arrowType("angle") ], exports.Arrow.prototype, "endArrow", void 0);
|
|
@@ -15174,9 +15141,18 @@ var LeaferUI = function(exports) {
|
|
|
15174
15141
|
"diamond-line": diamondLine,
|
|
15175
15142
|
mark: mark
|
|
15176
15143
|
};
|
|
15177
|
-
function getArrowPath(ui, arrow, from, to,
|
|
15144
|
+
function getArrowPath(ui, arrow, from, to, size, connectOffset, hasDashPattern) {
|
|
15145
|
+
let pathData, scale;
|
|
15178
15146
|
const {strokeCap: strokeCap, strokeJoin: strokeJoin} = ui.__;
|
|
15179
|
-
|
|
15147
|
+
if (isObject(arrow)) {
|
|
15148
|
+
if (arrow.type) {
|
|
15149
|
+
scale = arrow.scale;
|
|
15150
|
+
pathData = arrows[arrow.type];
|
|
15151
|
+
} else pathData = arrow;
|
|
15152
|
+
} else {
|
|
15153
|
+
pathData = arrows[arrow];
|
|
15154
|
+
}
|
|
15155
|
+
const {offset: offset, connect: connect, path: path, dashPath: dashPath} = pathData;
|
|
15180
15156
|
let connectX = connect ? connect.x : 0;
|
|
15181
15157
|
let offsetX = offset ? offset.x : 0;
|
|
15182
15158
|
const data = [ ...path ];
|
|
@@ -15185,9 +15161,10 @@ var LeaferUI = function(exports) {
|
|
|
15185
15161
|
if (offset) {
|
|
15186
15162
|
if (strokeJoin === "round" && offset.roundJoin) offsetX += offset.roundJoin; else if (strokeJoin === "bevel" && offset.bevelJoin) offsetX += offset.bevelJoin;
|
|
15187
15163
|
}
|
|
15164
|
+
if (scale) layout$2(data, 0, 0, scale, scale);
|
|
15188
15165
|
if (offsetX) layout$2(data, offsetX, 0);
|
|
15189
|
-
layout$2(data, to.x, to.y,
|
|
15190
|
-
connectOffset.x = (connectX + offsetX) *
|
|
15166
|
+
layout$2(data, to.x, to.y, size, size, getAngle(from, to));
|
|
15167
|
+
connectOffset.x = (connectX + offsetX) * size;
|
|
15191
15168
|
return data;
|
|
15192
15169
|
}
|
|
15193
15170
|
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;
|
|
@@ -15197,8 +15174,9 @@ var LeaferUI = function(exports) {
|
|
|
15197
15174
|
const last = {}, now = {};
|
|
15198
15175
|
const PathArrowModule = {
|
|
15199
15176
|
list: arrows,
|
|
15200
|
-
addArrows(ui
|
|
15201
|
-
const {startArrow: startArrow, endArrow: endArrow, strokeWidth: strokeWidth, dashPattern: dashPattern, __pathForRender: data} = ui.__;
|
|
15177
|
+
addArrows(ui) {
|
|
15178
|
+
const {startArrow: startArrow, endArrow: endArrow, strokeWidth: strokeWidth, dashPattern: dashPattern, __pathForRender: data, cornerRadius: cornerRadius} = ui.__;
|
|
15179
|
+
const clonePathForArrow = !cornerRadius;
|
|
15202
15180
|
let command, i = 0, len = data.length, count = 0, useStartArrow = startArrow && startArrow !== "none";
|
|
15203
15181
|
while (i < len) {
|
|
15204
15182
|
command = data[i];
|
|
@@ -15213,12 +15191,12 @@ var LeaferUI = function(exports) {
|
|
|
15213
15191
|
break;
|
|
15214
15192
|
|
|
15215
15193
|
case C$1:
|
|
15216
|
-
if (count === 1 || i + 7
|
|
15194
|
+
if (count === 1 || i + 7 >= len - 3) copyPoints(data, last, now, i + 3);
|
|
15217
15195
|
i += 7;
|
|
15218
15196
|
break;
|
|
15219
15197
|
|
|
15220
15198
|
case Q:
|
|
15221
|
-
if (count === 1 || i + 5
|
|
15199
|
+
if (count === 1 || i + 5 >= len - 3) copyPoints(data, last, now, i + 1);
|
|
15222
15200
|
i += 5;
|
|
15223
15201
|
break;
|
|
15224
15202
|
|
|
@@ -15254,7 +15232,13 @@ var LeaferUI = function(exports) {
|
|
|
15254
15232
|
break;
|
|
15255
15233
|
|
|
15256
15234
|
case U:
|
|
15257
|
-
if (count === 1 || i + 6
|
|
15235
|
+
if (count === 1 || i + 6 >= len - 3) {
|
|
15236
|
+
copyPoints(data, last, now, i + 1);
|
|
15237
|
+
if (i + 6 !== len) {
|
|
15238
|
+
now.x -= (now.x - last.x) / 10;
|
|
15239
|
+
now.y -= (now.y - last.y) / 10;
|
|
15240
|
+
}
|
|
15241
|
+
}
|
|
15258
15242
|
i += 6;
|
|
15259
15243
|
break;
|
|
15260
15244
|
}
|
|
@@ -15262,7 +15246,7 @@ var LeaferUI = function(exports) {
|
|
|
15262
15246
|
if (count === 1 && command !== M$1) return;
|
|
15263
15247
|
if (count === 2 && useStartArrow) copy(second, command === L$1 ? now : last);
|
|
15264
15248
|
if (i === len) {
|
|
15265
|
-
const path = ui.__.__pathForRender =
|
|
15249
|
+
const path = ui.__.__pathForRender = clonePathForArrow ? [ ...data ] : data;
|
|
15266
15250
|
const pathForArrow = ui.__.__pathForArrow = [];
|
|
15267
15251
|
if (useStartArrow) {
|
|
15268
15252
|
const startArrowPath = getArrowPath(ui, startArrow, second, first, strokeWidth, connectPoint, !!dashPattern);
|
|
@@ -15303,6 +15287,12 @@ var LeaferUI = function(exports) {
|
|
|
15303
15287
|
copy(last, now);
|
|
15304
15288
|
}
|
|
15305
15289
|
}
|
|
15290
|
+
},
|
|
15291
|
+
register(name, data) {
|
|
15292
|
+
this.list[name] = data;
|
|
15293
|
+
},
|
|
15294
|
+
get(name) {
|
|
15295
|
+
return this.list[name];
|
|
15306
15296
|
}
|
|
15307
15297
|
};
|
|
15308
15298
|
function copyPoints(data, from, to, startIndex) {
|
|
@@ -16729,6 +16719,17 @@ var LeaferUI = function(exports) {
|
|
|
16729
16719
|
exports.UI.addAttr("animationOut", undefined, dataType);
|
|
16730
16720
|
exports.UI.addAttr("transition", true, dataType);
|
|
16731
16721
|
exports.UI.addAttr("transitionOut", undefined, dataType);
|
|
16722
|
+
ui$3.set = function(data, transition) {
|
|
16723
|
+
if (data) {
|
|
16724
|
+
if (transition) {
|
|
16725
|
+
if (transition === "temp") {
|
|
16726
|
+
this.lockNormalStyle = true;
|
|
16727
|
+
Object.assign(this, data);
|
|
16728
|
+
this.lockNormalStyle = false;
|
|
16729
|
+
} else this.animate(data, transition);
|
|
16730
|
+
} else Object.assign(this, data);
|
|
16731
|
+
}
|
|
16732
|
+
};
|
|
16732
16733
|
ui$3.animate = function(keyframe, options, kill, isTemp) {
|
|
16733
16734
|
if (isUndefined(keyframe)) return this.__animate;
|
|
16734
16735
|
const isAnimationList = isArray(keyframe) && !options && kill;
|
|
@@ -18120,6 +18121,7 @@ var LeaferUI = function(exports) {
|
|
|
18120
18121
|
exports.motionPathType = motionPathType;
|
|
18121
18122
|
exports.naturalBoundsType = naturalBoundsType;
|
|
18122
18123
|
exports.opacityType = opacityType;
|
|
18124
|
+
exports.path = path;
|
|
18123
18125
|
exports.pathInputType = pathInputType;
|
|
18124
18126
|
exports.pathType = pathType;
|
|
18125
18127
|
exports.pen = pen;
|