leafer-ui 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/web.cjs +62 -33
- package/dist/web.esm.js +63 -34
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +150 -165
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +152 -168
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/web.module.js
CHANGED
|
@@ -54,7 +54,7 @@ function isUndefined(value) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
function isNull(value) {
|
|
57
|
-
return value
|
|
57
|
+
return value == null;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
function isString(value) {
|
|
@@ -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;
|
|
@@ -304,6 +307,9 @@ const MathHelper = {
|
|
|
304
307
|
num = round$3(num * a) / a;
|
|
305
308
|
return num === -0 ? 0 : num;
|
|
306
309
|
},
|
|
310
|
+
sign(num) {
|
|
311
|
+
return num < 0 ? -1 : 1;
|
|
312
|
+
},
|
|
307
313
|
getScaleData(scale, size, originSize, scaleData) {
|
|
308
314
|
if (!scaleData) scaleData = {};
|
|
309
315
|
if (size) {
|
|
@@ -1131,13 +1137,13 @@ const AlignHelper = {
|
|
|
1131
1137
|
}
|
|
1132
1138
|
};
|
|
1133
1139
|
|
|
1134
|
-
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;
|
|
1135
1141
|
|
|
1136
1142
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1137
1143
|
|
|
1138
1144
|
const {float: float, fourNumber: fourNumber} = MathHelper;
|
|
1139
1145
|
|
|
1140
|
-
const {floor: floor$2, ceil: ceil$
|
|
1146
|
+
const {floor: floor$2, ceil: ceil$2} = Math;
|
|
1141
1147
|
|
|
1142
1148
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
1143
1149
|
|
|
@@ -1266,7 +1272,7 @@ const BoundsHelper = {
|
|
|
1266
1272
|
point.x = t.x;
|
|
1267
1273
|
toOuterPoint$2(matrix, point, toPoint$4);
|
|
1268
1274
|
addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
|
|
1269
|
-
toBounds$
|
|
1275
|
+
toBounds$2(tempPointBounds$1, to);
|
|
1270
1276
|
}
|
|
1271
1277
|
},
|
|
1272
1278
|
toInnerOf(t, matrix, to) {
|
|
@@ -1304,8 +1310,8 @@ const BoundsHelper = {
|
|
|
1304
1310
|
const {x: x, y: y} = t;
|
|
1305
1311
|
t.x = floor$2(t.x);
|
|
1306
1312
|
t.y = floor$2(t.y);
|
|
1307
|
-
t.width = x > t.x ? ceil$
|
|
1308
|
-
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);
|
|
1309
1315
|
},
|
|
1310
1316
|
unsign(t) {
|
|
1311
1317
|
if (t.width < 0) {
|
|
@@ -1365,7 +1371,7 @@ const BoundsHelper = {
|
|
|
1365
1371
|
},
|
|
1366
1372
|
setPoints(t, points) {
|
|
1367
1373
|
points.forEach((point, index) => index === 0 ? setPoint$2(tempPointBounds$1, point.x, point.y) : addPoint$2(tempPointBounds$1, point.x, point.y));
|
|
1368
|
-
toBounds$
|
|
1374
|
+
toBounds$2(tempPointBounds$1, t);
|
|
1369
1375
|
},
|
|
1370
1376
|
setPoint(t, point) {
|
|
1371
1377
|
B.set(t, point.x, point.y);
|
|
@@ -2218,15 +2224,15 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2218
2224
|
DataHelper.copyAttrs(s, size, canvasSizeAttrs);
|
|
2219
2225
|
canvasSizeAttrs.forEach(key => s[key] || (s[key] = 1));
|
|
2220
2226
|
this.bounds = new Bounds(0, 0, this.width, this.height);
|
|
2221
|
-
|
|
2222
|
-
this.updateViewSize();
|
|
2223
|
-
this.smooth = this.config.smooth;
|
|
2224
|
-
}
|
|
2227
|
+
this.updateViewSize();
|
|
2225
2228
|
this.updateClientBounds();
|
|
2226
|
-
if (this.context
|
|
2227
|
-
this.
|
|
2228
|
-
this.
|
|
2229
|
-
|
|
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
|
+
}
|
|
2230
2236
|
}
|
|
2231
2237
|
}
|
|
2232
2238
|
updateViewSize() {}
|
|
@@ -2540,7 +2546,7 @@ const RectHelper = {
|
|
|
2540
2546
|
}
|
|
2541
2547
|
};
|
|
2542
2548
|
|
|
2543
|
-
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;
|
|
2544
2550
|
|
|
2545
2551
|
const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
|
|
2546
2552
|
|
|
@@ -2611,9 +2617,11 @@ const BezierHelper = {
|
|
|
2611
2617
|
const CBy = toY - y1;
|
|
2612
2618
|
let startRadian = atan2$1(BAy, BAx);
|
|
2613
2619
|
let endRadian = atan2$1(CBy, CBx);
|
|
2620
|
+
const lenBA = hypot(BAx, BAy);
|
|
2621
|
+
const lenCB = hypot(CBx, CBy);
|
|
2614
2622
|
let totalRadian = endRadian - startRadian;
|
|
2615
2623
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2616
|
-
if (
|
|
2624
|
+
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$2(totalRadian - PI$2) < 1e-12) {
|
|
2617
2625
|
if (data) data.push(L$6, x1, y1);
|
|
2618
2626
|
if (setPointBounds) {
|
|
2619
2627
|
setPoint$1(setPointBounds, fromX, fromY);
|
|
@@ -2646,7 +2654,7 @@ const BezierHelper = {
|
|
|
2646
2654
|
let totalRadian = endRadian - startRadian;
|
|
2647
2655
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2648
2656
|
if (anticlockwise) totalRadian -= PI2;
|
|
2649
|
-
const parts = ceil(abs$2(totalRadian / PI_2));
|
|
2657
|
+
const parts = ceil$1(abs$2(totalRadian / PI_2));
|
|
2650
2658
|
const partRadian = totalRadian / parts;
|
|
2651
2659
|
const partRadian4Sin = sin$3(partRadian / 4);
|
|
2652
2660
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
|
|
@@ -3205,11 +3213,7 @@ class PathCreator {
|
|
|
3205
3213
|
this.set(path);
|
|
3206
3214
|
}
|
|
3207
3215
|
set(path) {
|
|
3208
|
-
|
|
3209
|
-
this.__path = isString(path) ? PathHelper.parse(path) : path;
|
|
3210
|
-
} else {
|
|
3211
|
-
this.__path = [];
|
|
3212
|
-
}
|
|
3216
|
+
this.__path = path ? isString(path) ? PathHelper.parse(path) : path : [];
|
|
3213
3217
|
return this;
|
|
3214
3218
|
}
|
|
3215
3219
|
beginPath() {
|
|
@@ -3377,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:
|
|
|
3377
3381
|
|
|
3378
3382
|
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
|
|
3379
3383
|
|
|
3380
|
-
const {addPointBounds: addPointBounds, copy: copy$7, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$
|
|
3384
|
+
const {addPointBounds: addPointBounds, copy: copy$7, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$1} = TwoPointBoundsHelper;
|
|
3381
3385
|
|
|
3382
3386
|
const debug$b = Debug.get("PathBounds");
|
|
3383
3387
|
|
|
@@ -3392,7 +3396,7 @@ const setEndPoint = {};
|
|
|
3392
3396
|
const PathBounds = {
|
|
3393
3397
|
toBounds(data, setBounds) {
|
|
3394
3398
|
PathBounds.toTwoPointBounds(data, setPointBounds);
|
|
3395
|
-
toBounds$
|
|
3399
|
+
toBounds$1(setPointBounds, setBounds);
|
|
3396
3400
|
},
|
|
3397
3401
|
toTwoPointBounds(data, setPointBounds) {
|
|
3398
3402
|
if (!data || !data.length) return setPoint(setPointBounds, 0, 0);
|
|
@@ -3579,14 +3583,18 @@ const PathCorner = {
|
|
|
3579
3583
|
}
|
|
3580
3584
|
};
|
|
3581
3585
|
|
|
3582
|
-
|
|
3586
|
+
function path(path) {
|
|
3587
|
+
return new PathCreator(path);
|
|
3588
|
+
}
|
|
3589
|
+
|
|
3590
|
+
const pen = path();
|
|
3591
|
+
|
|
3592
|
+
PathHelper.creator = path();
|
|
3583
3593
|
|
|
3584
3594
|
PathHelper.parse = PathConvert.parse;
|
|
3585
3595
|
|
|
3586
3596
|
PathHelper.convertToCanvasData = PathConvert.toCanvasData;
|
|
3587
3597
|
|
|
3588
|
-
const pen = new PathCreator;
|
|
3589
|
-
|
|
3590
3598
|
const {drawRoundRect: drawRoundRect} = RectHelper;
|
|
3591
3599
|
|
|
3592
3600
|
function roundRect(drawer) {
|
|
@@ -3951,7 +3959,7 @@ const ImageManager = {
|
|
|
3951
3959
|
return FileHelper.alphaPixelTypes.some(item => I$1.isFormat(item, config));
|
|
3952
3960
|
},
|
|
3953
3961
|
isFormat(format, config) {
|
|
3954
|
-
if (config.format
|
|
3962
|
+
if (config.format) return config.format === format;
|
|
3955
3963
|
const {url: url} = config;
|
|
3956
3964
|
if (url.startsWith("data:")) {
|
|
3957
3965
|
if (url.startsWith("data:" + FileHelper.mineType(format))) return true;
|
|
@@ -4045,7 +4053,7 @@ class LeaferImage {
|
|
|
4045
4053
|
getFull(_filters) {
|
|
4046
4054
|
return this.view;
|
|
4047
4055
|
}
|
|
4048
|
-
getCanvas(width, height, opacity, _filters, xGap, yGap) {
|
|
4056
|
+
getCanvas(width, height, opacity, _filters, xGap, yGap, smooth) {
|
|
4049
4057
|
width || (width = this.width);
|
|
4050
4058
|
height || (height = this.height);
|
|
4051
4059
|
if (this.cache) {
|
|
@@ -4061,6 +4069,7 @@ class LeaferImage {
|
|
|
4061
4069
|
const canvas = Platform.origin.createCanvas(max$1(floor$1(width + (xGap || 0)), 1), max$1(floor$1(height + (yGap || 0)), 1));
|
|
4062
4070
|
const ctx = canvas.getContext("2d");
|
|
4063
4071
|
if (opacity) ctx.globalAlpha = opacity;
|
|
4072
|
+
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
4064
4073
|
ctx.drawImage(this.view, 0, 0, width, height);
|
|
4065
4074
|
this.cache = this.use > 1 ? {
|
|
4066
4075
|
data: canvas,
|
|
@@ -4102,7 +4111,7 @@ function createDescriptor(key, defaultValue) {
|
|
|
4102
4111
|
return {
|
|
4103
4112
|
get() {
|
|
4104
4113
|
const v = this[privateKey];
|
|
4105
|
-
return
|
|
4114
|
+
return v == null ? defaultValue : v;
|
|
4106
4115
|
},
|
|
4107
4116
|
set(value) {
|
|
4108
4117
|
this[privateKey] = value;
|
|
@@ -4388,21 +4397,21 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4388
4397
|
};
|
|
4389
4398
|
} else if (typeof defaultValue === "function") {
|
|
4390
4399
|
property.get = function() {
|
|
4391
|
-
|
|
4392
|
-
return v
|
|
4400
|
+
const v = this[computedKey];
|
|
4401
|
+
return v == null ? defaultValue(this.__leaf) : v;
|
|
4393
4402
|
};
|
|
4394
4403
|
} else if (isObject(defaultValue)) {
|
|
4395
4404
|
const isEmpty = isEmptyData(defaultValue);
|
|
4396
4405
|
property.get = function() {
|
|
4397
|
-
|
|
4398
|
-
return v
|
|
4406
|
+
const v = this[computedKey];
|
|
4407
|
+
return v == null ? this[computedKey] = isEmpty ? {} : DataHelper.clone(defaultValue) : v;
|
|
4399
4408
|
};
|
|
4400
4409
|
}
|
|
4401
4410
|
const isBox = target.isBranchLeaf;
|
|
4402
4411
|
if (key === "width") {
|
|
4403
4412
|
property.get = function() {
|
|
4404
4413
|
const v = this[computedKey];
|
|
4405
|
-
if (v
|
|
4414
|
+
if (v == null) {
|
|
4406
4415
|
const t = this, naturalWidth = t.__naturalWidth, leaf = t.__leaf;
|
|
4407
4416
|
if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.width;
|
|
4408
4417
|
if (naturalWidth) return t._height && t.__useNaturalRatio ? t._height * naturalWidth / t.__naturalHeight : naturalWidth;
|
|
@@ -4412,7 +4421,7 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4412
4421
|
} else if (key === "height") {
|
|
4413
4422
|
property.get = function() {
|
|
4414
4423
|
const v = this[computedKey];
|
|
4415
|
-
if (v
|
|
4424
|
+
if (v == null) {
|
|
4416
4425
|
const t = this, naturalHeight = t.__naturalHeight, leaf = t.__leaf;
|
|
4417
4426
|
if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.height;
|
|
4418
4427
|
if (naturalHeight) return t._width && t.__useNaturalRatio ? t._width * naturalHeight / t.__naturalWidth : naturalHeight;
|
|
@@ -4712,8 +4721,9 @@ const L = LeafHelper;
|
|
|
4712
4721
|
|
|
4713
4722
|
const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L;
|
|
4714
4723
|
|
|
4715
|
-
function getTempLocal(t,
|
|
4716
|
-
|
|
4724
|
+
function getTempLocal(t, worldPoint) {
|
|
4725
|
+
t.updateLayout();
|
|
4726
|
+
return t.parent ? PointHelper.tempToInnerOf(worldPoint, t.parent.scrollWorldTransform) : worldPoint;
|
|
4717
4727
|
}
|
|
4718
4728
|
|
|
4719
4729
|
const LeafBoundsHelper = {
|
|
@@ -5172,7 +5182,7 @@ class LeafLayout {
|
|
|
5172
5182
|
}
|
|
5173
5183
|
boxChange() {
|
|
5174
5184
|
this.boxChanged = true;
|
|
5175
|
-
this.localBoxChanged || this.localBoxChange();
|
|
5185
|
+
this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
|
|
5176
5186
|
this.hitCanvasChanged = true;
|
|
5177
5187
|
}
|
|
5178
5188
|
localBoxChange() {
|
|
@@ -5206,7 +5216,7 @@ class LeafLayout {
|
|
|
5206
5216
|
}
|
|
5207
5217
|
matrixChange() {
|
|
5208
5218
|
this.matrixChanged = true;
|
|
5209
|
-
this.localBoxChanged || this.localBoxChange();
|
|
5219
|
+
this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
|
|
5210
5220
|
}
|
|
5211
5221
|
surfaceChange() {
|
|
5212
5222
|
this.surfaceChanged = true;
|
|
@@ -5731,7 +5741,7 @@ const {updateBounds: updateBounds$1} = BranchHelper;
|
|
|
5731
5741
|
|
|
5732
5742
|
const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4} = BoundsHelper;
|
|
5733
5743
|
|
|
5734
|
-
const {toBounds: toBounds
|
|
5744
|
+
const {toBounds: toBounds} = PathBounds;
|
|
5735
5745
|
|
|
5736
5746
|
const LeafBounds = {
|
|
5737
5747
|
__updateWorldBounds() {
|
|
@@ -5803,8 +5813,8 @@ const LeafBounds = {
|
|
|
5803
5813
|
__updateBoxBounds(_secondLayout, _bounds) {
|
|
5804
5814
|
const b = this.__layout.boxBounds;
|
|
5805
5815
|
const data = this.__;
|
|
5806
|
-
if (data.
|
|
5807
|
-
toBounds
|
|
5816
|
+
if (data.__usePathBox) {
|
|
5817
|
+
toBounds(data.path, b);
|
|
5808
5818
|
} else {
|
|
5809
5819
|
b.x = 0;
|
|
5810
5820
|
b.y = 0;
|
|
@@ -6272,10 +6282,10 @@ let Leaf = class Leaf {
|
|
|
6272
6282
|
relative.innerToWorld(world, to, distance);
|
|
6273
6283
|
world = to ? to : world;
|
|
6274
6284
|
}
|
|
6275
|
-
toInnerPoint(this.
|
|
6285
|
+
toInnerPoint(this.scrollWorldTransform, world, to, distance);
|
|
6276
6286
|
}
|
|
6277
6287
|
innerToWorld(inner, to, distance, relative) {
|
|
6278
|
-
toOuterPoint(this.
|
|
6288
|
+
toOuterPoint(this.scrollWorldTransform, inner, to, distance);
|
|
6279
6289
|
if (relative) relative.worldToInner(to ? to : inner, null, distance);
|
|
6280
6290
|
}
|
|
6281
6291
|
getBoxPoint(world, relative, distance, change) {
|
|
@@ -6739,7 +6749,7 @@ class LeafLevelList {
|
|
|
6739
6749
|
}
|
|
6740
6750
|
}
|
|
6741
6751
|
|
|
6742
|
-
const version = "1.9.
|
|
6752
|
+
const version = "1.9.5";
|
|
6743
6753
|
|
|
6744
6754
|
const debug$5 = Debug.get("LeaferCanvas");
|
|
6745
6755
|
|
|
@@ -6830,10 +6840,22 @@ class LeaferCanvas extends LeaferCanvasBase {
|
|
|
6830
6840
|
updateViewSize() {
|
|
6831
6841
|
const {width: width, height: height, pixelRatio: pixelRatio} = this;
|
|
6832
6842
|
const {style: style} = this.view;
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6843
|
+
if (this.unreal) {
|
|
6844
|
+
const {config: config, autoWidthStr: autoWidthStr, autoHeightStr: autoHeightStr} = this;
|
|
6845
|
+
if (config.width) {
|
|
6846
|
+
if (isUndefined(autoWidthStr)) this.autoWidthStr = style.width || "";
|
|
6847
|
+
style.width = config.width + "px";
|
|
6848
|
+
} else if (!isUndefined(autoWidthStr)) style.width = autoWidthStr;
|
|
6849
|
+
if (config.height) {
|
|
6850
|
+
if (isUndefined(autoHeightStr)) this.autoHeightStr = style.height || "";
|
|
6851
|
+
style.height = config.height + "px";
|
|
6852
|
+
} else if (!isUndefined(autoHeightStr)) style.height = autoHeightStr;
|
|
6853
|
+
} else {
|
|
6854
|
+
style.width = width + "px";
|
|
6855
|
+
style.height = height + "px";
|
|
6856
|
+
this.view.width = Math.ceil(width * pixelRatio);
|
|
6857
|
+
this.view.height = Math.ceil(height * pixelRatio);
|
|
6858
|
+
}
|
|
6837
6859
|
}
|
|
6838
6860
|
updateClientBounds() {
|
|
6839
6861
|
if (this.view.parentElement) this.clientBounds = this.view.getBoundingClientRect();
|
|
@@ -6842,6 +6864,7 @@ class LeaferCanvas extends LeaferCanvasBase {
|
|
|
6842
6864
|
this.resizeListener = listener;
|
|
6843
6865
|
if (autoBounds) {
|
|
6844
6866
|
this.autoBounds = autoBounds;
|
|
6867
|
+
if (this.resizeObserver) return;
|
|
6845
6868
|
try {
|
|
6846
6869
|
this.resizeObserver = new ResizeObserver(entries => {
|
|
6847
6870
|
this.updateClientBounds();
|
|
@@ -6858,18 +6881,10 @@ class LeaferCanvas extends LeaferCanvasBase {
|
|
|
6858
6881
|
} catch (_a) {
|
|
6859
6882
|
this.imitateResizeObserver();
|
|
6860
6883
|
}
|
|
6884
|
+
this.stopListenPixelRatio();
|
|
6861
6885
|
} else {
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
if (!this.config.pixelRatio && this.pixelRatio !== pixelRatio) {
|
|
6865
|
-
const {width: width, height: height} = this;
|
|
6866
|
-
this.emitResize({
|
|
6867
|
-
width: width,
|
|
6868
|
-
height: height,
|
|
6869
|
-
pixelRatio: pixelRatio
|
|
6870
|
-
});
|
|
6871
|
-
}
|
|
6872
|
-
});
|
|
6886
|
+
this.listenPixelRatio();
|
|
6887
|
+
if (this.unreal) this.updateViewSize();
|
|
6873
6888
|
}
|
|
6874
6889
|
}
|
|
6875
6890
|
imitateResizeObserver() {
|
|
@@ -6878,6 +6893,25 @@ class LeaferCanvas extends LeaferCanvasBase {
|
|
|
6878
6893
|
Platform.requestRender(this.imitateResizeObserver.bind(this));
|
|
6879
6894
|
}
|
|
6880
6895
|
}
|
|
6896
|
+
listenPixelRatio() {
|
|
6897
|
+
if (!this.windowListener) window.addEventListener("resize", this.windowListener = () => {
|
|
6898
|
+
const pixelRatio = Platform.devicePixelRatio;
|
|
6899
|
+
if (!this.config.pixelRatio && this.pixelRatio !== pixelRatio) {
|
|
6900
|
+
const {width: width, height: height} = this;
|
|
6901
|
+
this.emitResize({
|
|
6902
|
+
width: width,
|
|
6903
|
+
height: height,
|
|
6904
|
+
pixelRatio: pixelRatio
|
|
6905
|
+
});
|
|
6906
|
+
}
|
|
6907
|
+
});
|
|
6908
|
+
}
|
|
6909
|
+
stopListenPixelRatio() {
|
|
6910
|
+
if (this.windowListener) {
|
|
6911
|
+
window.removeEventListener("resize", this.windowListener);
|
|
6912
|
+
this.windowListener = null;
|
|
6913
|
+
}
|
|
6914
|
+
}
|
|
6881
6915
|
checkAutoBounds(parentSize) {
|
|
6882
6916
|
const view = this.view;
|
|
6883
6917
|
const {x: x, y: y, width: width, height: height} = this.autoBounds.getBoundsFrom(parentSize);
|
|
@@ -6915,10 +6949,7 @@ class LeaferCanvas extends LeaferCanvasBase {
|
|
|
6915
6949
|
destroy() {
|
|
6916
6950
|
if (this.view) {
|
|
6917
6951
|
this.stopAutoLayout();
|
|
6918
|
-
|
|
6919
|
-
window.removeEventListener("resize", this.windowListener);
|
|
6920
|
-
this.windowListener = null;
|
|
6921
|
-
}
|
|
6952
|
+
this.stopListenPixelRatio();
|
|
6922
6953
|
if (!this.unreal) {
|
|
6923
6954
|
const view = this.view;
|
|
6924
6955
|
if (view.parentElement) view.remove();
|
|
@@ -7347,7 +7378,7 @@ class Renderer {
|
|
|
7347
7378
|
this.times = 0;
|
|
7348
7379
|
this.config = {
|
|
7349
7380
|
usePartRender: true,
|
|
7350
|
-
maxFPS:
|
|
7381
|
+
maxFPS: 120
|
|
7351
7382
|
};
|
|
7352
7383
|
this.target = target;
|
|
7353
7384
|
this.canvas = canvas;
|
|
@@ -7502,11 +7533,15 @@ class Renderer {
|
|
|
7502
7533
|
if (this.requestTime || !target) return;
|
|
7503
7534
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
7504
7535
|
const requestTime = this.requestTime = Date.now();
|
|
7505
|
-
|
|
7506
|
-
|
|
7536
|
+
const render = () => {
|
|
7537
|
+
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
7538
|
+
const {maxFPS: maxFPS} = this.config;
|
|
7539
|
+
if (maxFPS && nowFPS > maxFPS - .5) return Platform.requestRender(render);
|
|
7540
|
+
this.FPS = Math.min(120, Math.ceil(nowFPS));
|
|
7507
7541
|
this.requestTime = 0;
|
|
7508
7542
|
this.checkRender();
|
|
7509
|
-
}
|
|
7543
|
+
};
|
|
7544
|
+
Platform.requestRender(render);
|
|
7510
7545
|
}
|
|
7511
7546
|
__onResize(e) {
|
|
7512
7547
|
if (this.canvas.unreal) return;
|
|
@@ -7549,7 +7584,8 @@ class Renderer {
|
|
|
7549
7584
|
if (this.target) {
|
|
7550
7585
|
this.stop();
|
|
7551
7586
|
this.__removeListenEvents();
|
|
7552
|
-
this.
|
|
7587
|
+
this.config = {};
|
|
7588
|
+
this.target = this.canvas = null;
|
|
7553
7589
|
}
|
|
7554
7590
|
}
|
|
7555
7591
|
}
|
|
@@ -8040,7 +8076,11 @@ class LeaferData extends GroupData {
|
|
|
8040
8076
|
|
|
8041
8077
|
class FrameData extends BoxData {}
|
|
8042
8078
|
|
|
8043
|
-
class LineData extends UIData {
|
|
8079
|
+
class LineData extends UIData {
|
|
8080
|
+
get __usePathBox() {
|
|
8081
|
+
return this.points || this.__pathInputed;
|
|
8082
|
+
}
|
|
8083
|
+
}
|
|
8044
8084
|
|
|
8045
8085
|
class RectData extends UIData {
|
|
8046
8086
|
get __boxStroke() {
|
|
@@ -8054,7 +8094,7 @@ class EllipseData extends UIData {
|
|
|
8054
8094
|
}
|
|
8055
8095
|
}
|
|
8056
8096
|
|
|
8057
|
-
class PolygonData extends
|
|
8097
|
+
class PolygonData extends LineData {}
|
|
8058
8098
|
|
|
8059
8099
|
class StarData extends UIData {}
|
|
8060
8100
|
|
|
@@ -8364,20 +8404,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8364
8404
|
if (!path) this.__drawPathByBox(pen);
|
|
8365
8405
|
return pen;
|
|
8366
8406
|
}
|
|
8367
|
-
constructor(data) {
|
|
8368
|
-
super(data);
|
|
8369
|
-
}
|
|
8370
8407
|
reset(_data) {}
|
|
8371
|
-
set(data,
|
|
8372
|
-
if (data)
|
|
8373
|
-
if (transition) {
|
|
8374
|
-
if (transition === "temp") {
|
|
8375
|
-
this.lockNormalStyle = true;
|
|
8376
|
-
Object.assign(this, data);
|
|
8377
|
-
this.lockNormalStyle = false;
|
|
8378
|
-
} else this.animate(data, transition);
|
|
8379
|
-
} else Object.assign(this, data);
|
|
8380
|
-
}
|
|
8408
|
+
set(data, _transition) {
|
|
8409
|
+
if (data) Object.assign(this, data);
|
|
8381
8410
|
}
|
|
8382
8411
|
get(name) {
|
|
8383
8412
|
return isString(name) ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
@@ -8423,7 +8452,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8423
8452
|
const data = this.__;
|
|
8424
8453
|
if (data.path) {
|
|
8425
8454
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
8426
|
-
if (data.__useArrow) PathArrow.addArrows(this
|
|
8455
|
+
if (data.__useArrow) PathArrow.addArrows(this);
|
|
8427
8456
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
8428
8457
|
}
|
|
8429
8458
|
__drawRenderPath(canvas) {
|
|
@@ -8447,7 +8476,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8447
8476
|
drawImagePlaceholder(canvas, _image) {
|
|
8448
8477
|
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
8449
8478
|
}
|
|
8450
|
-
animate(
|
|
8479
|
+
animate(keyframe, _options, _type, _isTemp) {
|
|
8480
|
+
this.set(keyframe);
|
|
8451
8481
|
return Plugin.need("animate");
|
|
8452
8482
|
}
|
|
8453
8483
|
killAnimate(_type, _nextStyle) {}
|
|
@@ -8636,9 +8666,6 @@ let Group = class Group extends UI {
|
|
|
8636
8666
|
get isBranch() {
|
|
8637
8667
|
return true;
|
|
8638
8668
|
}
|
|
8639
|
-
constructor(data) {
|
|
8640
|
-
super(data);
|
|
8641
|
-
}
|
|
8642
8669
|
reset(data) {
|
|
8643
8670
|
this.__setBranch();
|
|
8644
8671
|
super.reset(data);
|
|
@@ -8763,7 +8790,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8763
8790
|
const canvas = this.canvas = Creator.canvas(config);
|
|
8764
8791
|
this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
|
|
8765
8792
|
if (this.isApp) this.__setApp();
|
|
8766
|
-
this.__checkAutoLayout(
|
|
8793
|
+
this.__checkAutoLayout();
|
|
8767
8794
|
this.view = canvas.view;
|
|
8768
8795
|
if (!parentApp) {
|
|
8769
8796
|
this.selector = Creator.selector(this);
|
|
@@ -8862,7 +8889,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8862
8889
|
this.leafer = leafer;
|
|
8863
8890
|
this.__level = 1;
|
|
8864
8891
|
}
|
|
8865
|
-
__checkAutoLayout(
|
|
8892
|
+
__checkAutoLayout() {
|
|
8893
|
+
const {config: config, parentApp: parentApp} = this;
|
|
8866
8894
|
if (!parentApp) {
|
|
8867
8895
|
if (!config.width || !config.height) this.autoLayout = new AutoBounds(config);
|
|
8868
8896
|
this.canvas.startAutoLayout(this.autoLayout, this.__onResize.bind(this));
|
|
@@ -8888,9 +8916,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8888
8916
|
return super.__getAttr(attrName);
|
|
8889
8917
|
}
|
|
8890
8918
|
__changeCanvasSize(attrName, newValue) {
|
|
8891
|
-
const
|
|
8892
|
-
data
|
|
8893
|
-
|
|
8919
|
+
const {config: config, canvas: canvas} = this;
|
|
8920
|
+
const data = DataHelper.copyAttrs({}, canvas, canvasSizeAttrs);
|
|
8921
|
+
data[attrName] = config[attrName] = newValue;
|
|
8922
|
+
config.width && config.height ? canvas.stopAutoLayout() : this.__checkAutoLayout();
|
|
8894
8923
|
this.__doResize(data);
|
|
8895
8924
|
}
|
|
8896
8925
|
__changeFill(newValue) {
|
|
@@ -9037,9 +9066,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
9037
9066
|
if (!this.parent) {
|
|
9038
9067
|
if (this.selector) this.selector.destroy();
|
|
9039
9068
|
if (this.hitCanvasManager) this.hitCanvasManager.destroy();
|
|
9040
|
-
this.canvasManager.destroy();
|
|
9069
|
+
if (this.canvasManager) this.canvasManager.destroy();
|
|
9041
9070
|
}
|
|
9042
|
-
this.canvas.destroy();
|
|
9071
|
+
if (this.canvas) this.canvas.destroy();
|
|
9043
9072
|
this.config.view = this.view = this.parentApp = null;
|
|
9044
9073
|
if (this.userConfig) this.userConfig.view = null;
|
|
9045
9074
|
super.destroy();
|
|
@@ -9067,9 +9096,6 @@ let Rect = class Rect extends UI {
|
|
|
9067
9096
|
get __tag() {
|
|
9068
9097
|
return "Rect";
|
|
9069
9098
|
}
|
|
9070
|
-
constructor(data) {
|
|
9071
|
-
super(data);
|
|
9072
|
-
}
|
|
9073
9099
|
};
|
|
9074
9100
|
|
|
9075
9101
|
__decorate([ dataProcessor(RectData) ], Rect.prototype, "__", void 0);
|
|
@@ -9123,29 +9149,24 @@ let Box = class Box extends Group {
|
|
|
9123
9149
|
}
|
|
9124
9150
|
__updateStrokeBounds() {}
|
|
9125
9151
|
__updateRenderBounds() {
|
|
9126
|
-
let isOverflow;
|
|
9152
|
+
let isOverflow, isScrollMode;
|
|
9127
9153
|
if (this.children.length) {
|
|
9128
|
-
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
|
|
9154
|
+
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout, {overflow: overflow} = data;
|
|
9129
9155
|
const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
|
|
9130
9156
|
super.__updateRenderBounds(childrenRenderBounds);
|
|
9131
|
-
if (
|
|
9157
|
+
if (isScrollMode = overflow.includes("scroll")) {
|
|
9132
9158
|
add(childrenRenderBounds, boxBounds);
|
|
9133
9159
|
scroll(childrenRenderBounds, data);
|
|
9134
9160
|
}
|
|
9135
9161
|
this.__updateRectRenderBounds();
|
|
9136
9162
|
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
9137
|
-
if (isOverflow &&
|
|
9163
|
+
if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
|
|
9138
9164
|
} else this.__updateRectRenderBounds();
|
|
9139
9165
|
DataHelper.stintSet(this, "isOverflow", isOverflow);
|
|
9140
|
-
this.__checkScroll();
|
|
9166
|
+
this.__checkScroll(isScrollMode);
|
|
9141
9167
|
}
|
|
9142
9168
|
__updateRectRenderBounds() {}
|
|
9143
|
-
|
|
9144
|
-
if (this.hasScroller) this.__updateScroll();
|
|
9145
|
-
super.__updateWorldBounds();
|
|
9146
|
-
}
|
|
9147
|
-
__checkScroll() {}
|
|
9148
|
-
__updateScroll() {}
|
|
9169
|
+
__checkScroll(_isScrollMode) {}
|
|
9149
9170
|
__updateRectChange() {}
|
|
9150
9171
|
__updateChange() {
|
|
9151
9172
|
super.__updateChange();
|
|
@@ -9206,9 +9227,6 @@ let Frame = class Frame extends Box {
|
|
|
9206
9227
|
get isFrame() {
|
|
9207
9228
|
return true;
|
|
9208
9229
|
}
|
|
9209
|
-
constructor(data) {
|
|
9210
|
-
super(data);
|
|
9211
|
-
}
|
|
9212
9230
|
};
|
|
9213
9231
|
|
|
9214
9232
|
__decorate([ dataProcessor(FrameData) ], Frame.prototype, "__", void 0);
|
|
@@ -9225,9 +9243,6 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9225
9243
|
get __tag() {
|
|
9226
9244
|
return "Ellipse";
|
|
9227
9245
|
}
|
|
9228
|
-
constructor(data) {
|
|
9229
|
-
super(data);
|
|
9230
|
-
}
|
|
9231
9246
|
__updatePath() {
|
|
9232
9247
|
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
|
|
9233
9248
|
const rx = width / 2, ry = height / 2;
|
|
@@ -9271,8 +9286,6 @@ const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathComma
|
|
|
9271
9286
|
|
|
9272
9287
|
const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
|
|
9273
9288
|
|
|
9274
|
-
const {toBounds: toBounds} = PathBounds;
|
|
9275
|
-
|
|
9276
9289
|
let Line = class Line extends UI {
|
|
9277
9290
|
get __tag() {
|
|
9278
9291
|
return "Line";
|
|
@@ -9289,31 +9302,16 @@ let Line = class Line extends UI {
|
|
|
9289
9302
|
this.rotation = getAngle$1(defaultPoint, value);
|
|
9290
9303
|
if (this.height) this.height = 0;
|
|
9291
9304
|
}
|
|
9292
|
-
constructor(data) {
|
|
9293
|
-
super(data);
|
|
9294
|
-
}
|
|
9295
9305
|
__updatePath() {
|
|
9296
9306
|
const data = this.__;
|
|
9297
9307
|
const path = data.path = [];
|
|
9298
9308
|
if (data.points) {
|
|
9299
|
-
drawPoints$1(path, data.points,
|
|
9309
|
+
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
9300
9310
|
} else {
|
|
9301
9311
|
moveTo$2(path, 0, 0);
|
|
9302
9312
|
lineTo$2(path, this.width, 0);
|
|
9303
9313
|
}
|
|
9304
9314
|
}
|
|
9305
|
-
__updateRenderPath() {
|
|
9306
|
-
const data = this.__;
|
|
9307
|
-
if (!this.pathInputed && data.points && data.curve) {
|
|
9308
|
-
drawPoints$1(data.__pathForRender = [], data.points, data.curve, data.closed);
|
|
9309
|
-
if (data.__useArrow) PathArrow.addArrows(this, false);
|
|
9310
|
-
} else super.__updateRenderPath();
|
|
9311
|
-
}
|
|
9312
|
-
__updateBoxBounds() {
|
|
9313
|
-
if (this.points) {
|
|
9314
|
-
toBounds(this.__.__pathForRender, this.__layout.boxBounds);
|
|
9315
|
-
} else super.__updateBoxBounds();
|
|
9316
|
-
}
|
|
9317
9315
|
};
|
|
9318
9316
|
|
|
9319
9317
|
__decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
|
|
@@ -9340,15 +9338,13 @@ let Polygon = class Polygon extends UI {
|
|
|
9340
9338
|
get __tag() {
|
|
9341
9339
|
return "Polygon";
|
|
9342
9340
|
}
|
|
9343
|
-
constructor(data) {
|
|
9344
|
-
super(data);
|
|
9345
|
-
}
|
|
9346
9341
|
__updatePath() {
|
|
9347
|
-
const
|
|
9348
|
-
|
|
9349
|
-
|
|
9342
|
+
const data = this.__;
|
|
9343
|
+
const path = data.path = [];
|
|
9344
|
+
if (data.points) {
|
|
9345
|
+
drawPoints(path, data.points, data.curve, true);
|
|
9350
9346
|
} else {
|
|
9351
|
-
const {width: width, height: height, sides: sides} =
|
|
9347
|
+
const {width: width, height: height, sides: sides} = data;
|
|
9352
9348
|
const rx = width / 2, ry = height / 2;
|
|
9353
9349
|
moveTo$1(path, rx, 0);
|
|
9354
9350
|
for (let i = 1; i < sides; i++) {
|
|
@@ -9383,9 +9379,6 @@ let Star = class Star extends UI {
|
|
|
9383
9379
|
get __tag() {
|
|
9384
9380
|
return "Star";
|
|
9385
9381
|
}
|
|
9386
|
-
constructor(data) {
|
|
9387
|
-
super(data);
|
|
9388
|
-
}
|
|
9389
9382
|
__updatePath() {
|
|
9390
9383
|
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
9391
9384
|
const rx = width / 2, ry = height / 2;
|
|
@@ -9418,9 +9411,6 @@ let Image$1 = class Image extends Rect {
|
|
|
9418
9411
|
const {fill: fill} = this.__;
|
|
9419
9412
|
return isArray(fill) && fill[0].image;
|
|
9420
9413
|
}
|
|
9421
|
-
constructor(data) {
|
|
9422
|
-
super(data);
|
|
9423
|
-
}
|
|
9424
9414
|
};
|
|
9425
9415
|
|
|
9426
9416
|
__decorate([ dataProcessor(ImageData) ], Image$1.prototype, "__", void 0);
|
|
@@ -9520,9 +9510,6 @@ let Text = class Text extends UI {
|
|
|
9520
9510
|
this.updateLayout();
|
|
9521
9511
|
return this.__.__textDrawData;
|
|
9522
9512
|
}
|
|
9523
|
-
constructor(data) {
|
|
9524
|
-
super(data);
|
|
9525
|
-
}
|
|
9526
9513
|
__updateTextDrawData() {
|
|
9527
9514
|
const data = this.__;
|
|
9528
9515
|
const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding} = data;
|
|
@@ -9655,9 +9642,6 @@ let Path = class Path extends UI {
|
|
|
9655
9642
|
get __tag() {
|
|
9656
9643
|
return "Path";
|
|
9657
9644
|
}
|
|
9658
|
-
constructor(data) {
|
|
9659
|
-
super(data);
|
|
9660
|
-
}
|
|
9661
9645
|
};
|
|
9662
9646
|
|
|
9663
9647
|
__decorate([ dataProcessor(PathData) ], Path.prototype, "__", void 0);
|
|
@@ -9670,9 +9654,6 @@ let Pen = class Pen extends Group {
|
|
|
9670
9654
|
get __tag() {
|
|
9671
9655
|
return "Pen";
|
|
9672
9656
|
}
|
|
9673
|
-
constructor(data) {
|
|
9674
|
-
super(data);
|
|
9675
|
-
}
|
|
9676
9657
|
setStyle(data) {
|
|
9677
9658
|
const path = this.pathElement = new Path(data);
|
|
9678
9659
|
this.pathStyle = data;
|
|
@@ -12085,7 +12066,7 @@ function ignoreRender(ui, value) {
|
|
|
12085
12066
|
|
|
12086
12067
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
12087
12068
|
|
|
12088
|
-
const {floor: floor, max: max, abs: abs} = Math;
|
|
12069
|
+
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
12089
12070
|
|
|
12090
12071
|
function createPattern(ui, paint, pixelRatio) {
|
|
12091
12072
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -12095,8 +12076,6 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
12095
12076
|
let imageScale, imageMatrix, {width: width, height: height, scaleX: sx, scaleY: sy, transform: transform, repeat: repeat, gap: gap} = data;
|
|
12096
12077
|
scaleX *= pixelRatio;
|
|
12097
12078
|
scaleY *= pixelRatio;
|
|
12098
|
-
const xGap = gap && gap.x * scaleX;
|
|
12099
|
-
const yGap = gap && gap.y * scaleY;
|
|
12100
12079
|
if (sx) {
|
|
12101
12080
|
sx = abs(sx);
|
|
12102
12081
|
sy = abs(sy);
|
|
@@ -12113,7 +12092,10 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
12113
12092
|
if (size > Platform.image.maxCacheSize) return false;
|
|
12114
12093
|
}
|
|
12115
12094
|
let maxSize = Platform.image.maxPatternSize;
|
|
12116
|
-
if (
|
|
12095
|
+
if (image.isSVG) {
|
|
12096
|
+
const ws = width / image.width;
|
|
12097
|
+
if (ws > 1) imageScale = ws / ceil(ws);
|
|
12098
|
+
} else {
|
|
12117
12099
|
const imageSize = image.width * image.height;
|
|
12118
12100
|
if (maxSize > imageSize) maxSize = imageSize;
|
|
12119
12101
|
}
|
|
@@ -12128,18 +12110,20 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
12128
12110
|
scaleX /= sx;
|
|
12129
12111
|
scaleY /= sy;
|
|
12130
12112
|
}
|
|
12113
|
+
const xGap = gap && gap.x * scaleX;
|
|
12114
|
+
const yGap = gap && gap.y * scaleY;
|
|
12131
12115
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
12116
|
+
const canvasWidth = width + (xGap || 0);
|
|
12117
|
+
const canvasHeight = height + (yGap || 0);
|
|
12118
|
+
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
12119
|
+
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
12132
12120
|
if (!imageMatrix) {
|
|
12133
12121
|
imageMatrix = get$1();
|
|
12134
12122
|
if (transform) copy$1(imageMatrix, transform);
|
|
12135
12123
|
}
|
|
12136
12124
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
12137
12125
|
}
|
|
12138
|
-
|
|
12139
|
-
const canvasWidth = width + (xGap || 0), canvasHeight = height + (yGap || 0);
|
|
12140
|
-
scale(imageMatrix, canvasWidth / max(floor(canvasWidth), 1), canvasHeight / max(floor(canvasHeight), 1));
|
|
12141
|
-
}
|
|
12142
|
-
const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap);
|
|
12126
|
+
const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
|
|
12143
12127
|
const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
12144
12128
|
paint.style = pattern;
|
|
12145
12129
|
paint.patternId = id;
|
|
@@ -13093,4 +13077,4 @@ Object.assign(Creator, {
|
|
|
13093
13077
|
|
|
13094
13078
|
useCanvas();
|
|
13095
13079
|
|
|
13096
|
-
export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|
|
13080
|
+
export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|