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.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$3(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) {
|
|
@@ -1077,10 +1083,10 @@ var LeaferUI = function(exports) {
|
|
|
1077
1083
|
toPoint$5(align, box, to, onlyBoxSize, content, onlyContentSize);
|
|
1078
1084
|
}
|
|
1079
1085
|
};
|
|
1080
|
-
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$
|
|
1086
|
+
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
1081
1087
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1082
1088
|
const {float: float, fourNumber: fourNumber} = MathHelper;
|
|
1083
|
-
const {floor: floor$2, ceil: ceil$
|
|
1089
|
+
const {floor: floor$2, ceil: ceil$2} = Math;
|
|
1084
1090
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
1085
1091
|
const point = {};
|
|
1086
1092
|
const toPoint$4 = {};
|
|
@@ -1204,7 +1210,7 @@ var LeaferUI = function(exports) {
|
|
|
1204
1210
|
point.x = t.x;
|
|
1205
1211
|
toOuterPoint$2(matrix, point, toPoint$4);
|
|
1206
1212
|
addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
|
|
1207
|
-
toBounds$
|
|
1213
|
+
toBounds$2(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$2(t.x);
|
|
1244
1250
|
t.y = floor$2(t.y);
|
|
1245
|
-
t.width = x > t.x ? ceil$
|
|
1246
|
-
t.height = y > t.y ? ceil$
|
|
1251
|
+
t.width = x > t.x ? ceil$2(t.width + x - t.x) : ceil$2(t.width);
|
|
1252
|
+
t.height = y > t.y ? ceil$2(t.height + y - t.y) : ceil$2(t.height);
|
|
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$2(tempPointBounds$1, point.x, point.y) : addPoint$2(tempPointBounds$1, point.x, point.y));
|
|
1306
|
-
toBounds$
|
|
1312
|
+
toBounds$2(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$3, cos: cos$3, atan2: atan2$1, ceil: ceil, abs: abs$2, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
|
|
2378
|
+
const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs: abs$2, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
|
|
2373
2379
|
const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
|
|
2374
2380
|
const {set: set, toNumberPoints: toNumberPoints} = PointHelper;
|
|
2375
2381
|
const {M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5} = 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$2(totalRadian - PI$2) < 1e-12) {
|
|
2441
2449
|
if (data) data.push(L$6, x1, y1);
|
|
2442
2450
|
if (setPointBounds) {
|
|
2443
2451
|
setPoint$1(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(abs$2(totalRadian / PI_2));
|
|
2481
|
+
const parts = ceil$1(abs$2(totalRadian / PI_2));
|
|
2474
2482
|
const partRadian = totalRadian / parts;
|
|
2475
2483
|
const partRadian4Sin = sin$3(partRadian / 4);
|
|
2476
2484
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
|
|
@@ -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$1, L: L$2, C: C, Q: Q, Z: Z$1, N: N, D: D$1, X: X, G: G, F: F$1, O: O, P: P, U: U} = PathCommandMap;
|
|
3178
3182
|
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
|
|
3179
|
-
const {addPointBounds: addPointBounds, copy: copy$7, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$
|
|
3183
|
+
const {addPointBounds: addPointBounds, copy: copy$7, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$1} = TwoPointBoundsHelper;
|
|
3180
3184
|
const debug$b = 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$1(setPointBounds, setBounds);
|
|
3189
3193
|
},
|
|
3190
3194
|
toTwoPointBounds(data, setPointBounds) {
|
|
3191
3195
|
if (!data || !data.length) return setPoint(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;
|
|
@@ -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) {
|
|
@@ -3829,6 +3836,7 @@ var LeaferUI = function(exports) {
|
|
|
3829
3836
|
const canvas = Platform.origin.createCanvas(max$1(floor$1(width + (xGap || 0)), 1), max$1(floor$1(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 = LeafHelper;
|
|
4430
4438
|
const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L;
|
|
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$1, updateAllMatrix: updateAllMatrix$2} = LeafHelper;
|
|
5355
5364
|
const {updateBounds: updateBounds$1} = BranchHelper;
|
|
5356
5365
|
const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4} = BoundsHelper;
|
|
5357
|
-
const {toBounds: toBounds
|
|
5366
|
+
const {toBounds: toBounds} = 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(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
|
const debug$5 = Debug.get("LeaferCanvas");
|
|
6346
6355
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6347
6356
|
set zIndex(zIndex) {
|
|
@@ -6430,10 +6439,22 @@ var LeaferUI = function(exports) {
|
|
|
6430
6439
|
updateViewSize() {
|
|
6431
6440
|
const {width: width, height: height, pixelRatio: pixelRatio} = this;
|
|
6432
6441
|
const {style: style} = this.view;
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6442
|
+
if (this.unreal) {
|
|
6443
|
+
const {config: config, autoWidthStr: autoWidthStr, autoHeightStr: autoHeightStr} = this;
|
|
6444
|
+
if (config.width) {
|
|
6445
|
+
if (isUndefined(autoWidthStr)) this.autoWidthStr = style.width || "";
|
|
6446
|
+
style.width = config.width + "px";
|
|
6447
|
+
} else if (!isUndefined(autoWidthStr)) style.width = autoWidthStr;
|
|
6448
|
+
if (config.height) {
|
|
6449
|
+
if (isUndefined(autoHeightStr)) this.autoHeightStr = style.height || "";
|
|
6450
|
+
style.height = config.height + "px";
|
|
6451
|
+
} else if (!isUndefined(autoHeightStr)) style.height = autoHeightStr;
|
|
6452
|
+
} else {
|
|
6453
|
+
style.width = width + "px";
|
|
6454
|
+
style.height = height + "px";
|
|
6455
|
+
this.view.width = Math.ceil(width * pixelRatio);
|
|
6456
|
+
this.view.height = Math.ceil(height * pixelRatio);
|
|
6457
|
+
}
|
|
6437
6458
|
}
|
|
6438
6459
|
updateClientBounds() {
|
|
6439
6460
|
if (this.view.parentElement) this.clientBounds = this.view.getBoundingClientRect();
|
|
@@ -6442,6 +6463,7 @@ var LeaferUI = function(exports) {
|
|
|
6442
6463
|
this.resizeListener = listener;
|
|
6443
6464
|
if (autoBounds) {
|
|
6444
6465
|
this.autoBounds = autoBounds;
|
|
6466
|
+
if (this.resizeObserver) return;
|
|
6445
6467
|
try {
|
|
6446
6468
|
this.resizeObserver = new ResizeObserver(entries => {
|
|
6447
6469
|
this.updateClientBounds();
|
|
@@ -6458,18 +6480,10 @@ var LeaferUI = function(exports) {
|
|
|
6458
6480
|
} catch (_a) {
|
|
6459
6481
|
this.imitateResizeObserver();
|
|
6460
6482
|
}
|
|
6483
|
+
this.stopListenPixelRatio();
|
|
6461
6484
|
} else {
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
if (!this.config.pixelRatio && this.pixelRatio !== pixelRatio) {
|
|
6465
|
-
const {width: width, height: height} = this;
|
|
6466
|
-
this.emitResize({
|
|
6467
|
-
width: width,
|
|
6468
|
-
height: height,
|
|
6469
|
-
pixelRatio: pixelRatio
|
|
6470
|
-
});
|
|
6471
|
-
}
|
|
6472
|
-
});
|
|
6485
|
+
this.listenPixelRatio();
|
|
6486
|
+
if (this.unreal) this.updateViewSize();
|
|
6473
6487
|
}
|
|
6474
6488
|
}
|
|
6475
6489
|
imitateResizeObserver() {
|
|
@@ -6478,6 +6492,25 @@ var LeaferUI = function(exports) {
|
|
|
6478
6492
|
Platform.requestRender(this.imitateResizeObserver.bind(this));
|
|
6479
6493
|
}
|
|
6480
6494
|
}
|
|
6495
|
+
listenPixelRatio() {
|
|
6496
|
+
if (!this.windowListener) window.addEventListener("resize", this.windowListener = () => {
|
|
6497
|
+
const pixelRatio = Platform.devicePixelRatio;
|
|
6498
|
+
if (!this.config.pixelRatio && this.pixelRatio !== pixelRatio) {
|
|
6499
|
+
const {width: width, height: height} = this;
|
|
6500
|
+
this.emitResize({
|
|
6501
|
+
width: width,
|
|
6502
|
+
height: height,
|
|
6503
|
+
pixelRatio: pixelRatio
|
|
6504
|
+
});
|
|
6505
|
+
}
|
|
6506
|
+
});
|
|
6507
|
+
}
|
|
6508
|
+
stopListenPixelRatio() {
|
|
6509
|
+
if (this.windowListener) {
|
|
6510
|
+
window.removeEventListener("resize", this.windowListener);
|
|
6511
|
+
this.windowListener = null;
|
|
6512
|
+
}
|
|
6513
|
+
}
|
|
6481
6514
|
checkAutoBounds(parentSize) {
|
|
6482
6515
|
const view = this.view;
|
|
6483
6516
|
const {x: x, y: y, width: width, height: height} = this.autoBounds.getBoundsFrom(parentSize);
|
|
@@ -6515,10 +6548,7 @@ var LeaferUI = function(exports) {
|
|
|
6515
6548
|
destroy() {
|
|
6516
6549
|
if (this.view) {
|
|
6517
6550
|
this.stopAutoLayout();
|
|
6518
|
-
|
|
6519
|
-
window.removeEventListener("resize", this.windowListener);
|
|
6520
|
-
this.windowListener = null;
|
|
6521
|
-
}
|
|
6551
|
+
this.stopListenPixelRatio();
|
|
6522
6552
|
if (!this.unreal) {
|
|
6523
6553
|
const view = this.view;
|
|
6524
6554
|
if (view.parentElement) view.remove();
|
|
@@ -6922,7 +6952,7 @@ var LeaferUI = function(exports) {
|
|
|
6922
6952
|
this.times = 0;
|
|
6923
6953
|
this.config = {
|
|
6924
6954
|
usePartRender: true,
|
|
6925
|
-
maxFPS:
|
|
6955
|
+
maxFPS: 120
|
|
6926
6956
|
};
|
|
6927
6957
|
this.target = target;
|
|
6928
6958
|
this.canvas = canvas;
|
|
@@ -7077,11 +7107,15 @@ var LeaferUI = function(exports) {
|
|
|
7077
7107
|
if (this.requestTime || !target) return;
|
|
7078
7108
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
7079
7109
|
const requestTime = this.requestTime = Date.now();
|
|
7080
|
-
|
|
7081
|
-
|
|
7110
|
+
const render = () => {
|
|
7111
|
+
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
7112
|
+
const {maxFPS: maxFPS} = this.config;
|
|
7113
|
+
if (maxFPS && nowFPS > maxFPS - .5) return Platform.requestRender(render);
|
|
7114
|
+
this.FPS = Math.min(120, Math.ceil(nowFPS));
|
|
7082
7115
|
this.requestTime = 0;
|
|
7083
7116
|
this.checkRender();
|
|
7084
|
-
}
|
|
7117
|
+
};
|
|
7118
|
+
Platform.requestRender(render);
|
|
7085
7119
|
}
|
|
7086
7120
|
__onResize(e) {
|
|
7087
7121
|
if (this.canvas.unreal) return;
|
|
@@ -7124,7 +7158,8 @@ var LeaferUI = function(exports) {
|
|
|
7124
7158
|
if (this.target) {
|
|
7125
7159
|
this.stop();
|
|
7126
7160
|
this.__removeListenEvents();
|
|
7127
|
-
this.
|
|
7161
|
+
this.config = {};
|
|
7162
|
+
this.target = this.canvas = null;
|
|
7128
7163
|
}
|
|
7129
7164
|
}
|
|
7130
7165
|
}
|
|
@@ -7581,7 +7616,11 @@ var LeaferUI = function(exports) {
|
|
|
7581
7616
|
}
|
|
7582
7617
|
}
|
|
7583
7618
|
class FrameData extends BoxData {}
|
|
7584
|
-
class LineData extends UIData {
|
|
7619
|
+
class LineData extends UIData {
|
|
7620
|
+
get __usePathBox() {
|
|
7621
|
+
return this.points || this.__pathInputed;
|
|
7622
|
+
}
|
|
7623
|
+
}
|
|
7585
7624
|
class RectData extends UIData {
|
|
7586
7625
|
get __boxStroke() {
|
|
7587
7626
|
return !this.__pathInputed;
|
|
@@ -7592,7 +7631,7 @@ var LeaferUI = function(exports) {
|
|
|
7592
7631
|
return !this.__pathInputed;
|
|
7593
7632
|
}
|
|
7594
7633
|
}
|
|
7595
|
-
class PolygonData extends
|
|
7634
|
+
class PolygonData extends LineData {}
|
|
7596
7635
|
class StarData extends UIData {}
|
|
7597
7636
|
class PathData extends UIData {
|
|
7598
7637
|
get __pathInputed() {
|
|
@@ -7886,20 +7925,9 @@ var LeaferUI = function(exports) {
|
|
|
7886
7925
|
if (!path) this.__drawPathByBox(pen);
|
|
7887
7926
|
return pen;
|
|
7888
7927
|
}
|
|
7889
|
-
constructor(data) {
|
|
7890
|
-
super(data);
|
|
7891
|
-
}
|
|
7892
7928
|
reset(_data) {}
|
|
7893
|
-
set(data,
|
|
7894
|
-
if (data)
|
|
7895
|
-
if (transition) {
|
|
7896
|
-
if (transition === "temp") {
|
|
7897
|
-
this.lockNormalStyle = true;
|
|
7898
|
-
Object.assign(this, data);
|
|
7899
|
-
this.lockNormalStyle = false;
|
|
7900
|
-
} else this.animate(data, transition);
|
|
7901
|
-
} else Object.assign(this, data);
|
|
7902
|
-
}
|
|
7929
|
+
set(data, _transition) {
|
|
7930
|
+
if (data) Object.assign(this, data);
|
|
7903
7931
|
}
|
|
7904
7932
|
get(name) {
|
|
7905
7933
|
return isString(name) ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
@@ -7945,7 +7973,7 @@ var LeaferUI = function(exports) {
|
|
|
7945
7973
|
const data = this.__;
|
|
7946
7974
|
if (data.path) {
|
|
7947
7975
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
7948
|
-
if (data.__useArrow) PathArrow.addArrows(this
|
|
7976
|
+
if (data.__useArrow) PathArrow.addArrows(this);
|
|
7949
7977
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
7950
7978
|
}
|
|
7951
7979
|
__drawRenderPath(canvas) {
|
|
@@ -7969,7 +7997,8 @@ var LeaferUI = function(exports) {
|
|
|
7969
7997
|
drawImagePlaceholder(canvas, _image) {
|
|
7970
7998
|
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7971
7999
|
}
|
|
7972
|
-
animate(
|
|
8000
|
+
animate(keyframe, _options, _type, _isTemp) {
|
|
8001
|
+
this.set(keyframe);
|
|
7973
8002
|
return Plugin.need("animate");
|
|
7974
8003
|
}
|
|
7975
8004
|
killAnimate(_type, _nextStyle) {}
|
|
@@ -8083,9 +8112,6 @@ var LeaferUI = function(exports) {
|
|
|
8083
8112
|
get isBranch() {
|
|
8084
8113
|
return true;
|
|
8085
8114
|
}
|
|
8086
|
-
constructor(data) {
|
|
8087
|
-
super(data);
|
|
8088
|
-
}
|
|
8089
8115
|
reset(data) {
|
|
8090
8116
|
this.__setBranch();
|
|
8091
8117
|
super.reset(data);
|
|
@@ -8203,7 +8229,7 @@ var LeaferUI = function(exports) {
|
|
|
8203
8229
|
const canvas = this.canvas = Creator.canvas(config);
|
|
8204
8230
|
this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
|
|
8205
8231
|
if (this.isApp) this.__setApp();
|
|
8206
|
-
this.__checkAutoLayout(
|
|
8232
|
+
this.__checkAutoLayout();
|
|
8207
8233
|
this.view = canvas.view;
|
|
8208
8234
|
if (!parentApp) {
|
|
8209
8235
|
this.selector = Creator.selector(this);
|
|
@@ -8302,7 +8328,8 @@ var LeaferUI = function(exports) {
|
|
|
8302
8328
|
this.leafer = leafer;
|
|
8303
8329
|
this.__level = 1;
|
|
8304
8330
|
}
|
|
8305
|
-
__checkAutoLayout(
|
|
8331
|
+
__checkAutoLayout() {
|
|
8332
|
+
const {config: config, parentApp: parentApp} = this;
|
|
8306
8333
|
if (!parentApp) {
|
|
8307
8334
|
if (!config.width || !config.height) this.autoLayout = new AutoBounds(config);
|
|
8308
8335
|
this.canvas.startAutoLayout(this.autoLayout, this.__onResize.bind(this));
|
|
@@ -8328,9 +8355,10 @@ var LeaferUI = function(exports) {
|
|
|
8328
8355
|
return super.__getAttr(attrName);
|
|
8329
8356
|
}
|
|
8330
8357
|
__changeCanvasSize(attrName, newValue) {
|
|
8331
|
-
const
|
|
8332
|
-
data
|
|
8333
|
-
|
|
8358
|
+
const {config: config, canvas: canvas} = this;
|
|
8359
|
+
const data = DataHelper.copyAttrs({}, canvas, canvasSizeAttrs);
|
|
8360
|
+
data[attrName] = config[attrName] = newValue;
|
|
8361
|
+
config.width && config.height ? canvas.stopAutoLayout() : this.__checkAutoLayout();
|
|
8334
8362
|
this.__doResize(data);
|
|
8335
8363
|
}
|
|
8336
8364
|
__changeFill(newValue) {
|
|
@@ -8477,9 +8505,9 @@ var LeaferUI = function(exports) {
|
|
|
8477
8505
|
if (!this.parent) {
|
|
8478
8506
|
if (this.selector) this.selector.destroy();
|
|
8479
8507
|
if (this.hitCanvasManager) this.hitCanvasManager.destroy();
|
|
8480
|
-
this.canvasManager.destroy();
|
|
8508
|
+
if (this.canvasManager) this.canvasManager.destroy();
|
|
8481
8509
|
}
|
|
8482
|
-
this.canvas.destroy();
|
|
8510
|
+
if (this.canvas) this.canvas.destroy();
|
|
8483
8511
|
this.config.view = this.view = this.parentApp = null;
|
|
8484
8512
|
if (this.userConfig) this.userConfig.view = null;
|
|
8485
8513
|
super.destroy();
|
|
@@ -8502,9 +8530,6 @@ var LeaferUI = function(exports) {
|
|
|
8502
8530
|
get __tag() {
|
|
8503
8531
|
return "Rect";
|
|
8504
8532
|
}
|
|
8505
|
-
constructor(data) {
|
|
8506
|
-
super(data);
|
|
8507
|
-
}
|
|
8508
8533
|
};
|
|
8509
8534
|
__decorate([ dataProcessor(RectData) ], exports.Rect.prototype, "__", void 0);
|
|
8510
8535
|
exports.Rect = __decorate([ useModule(RectRender), rewriteAble(), registerUI() ], exports.Rect);
|
|
@@ -8553,29 +8578,24 @@ var LeaferUI = function(exports) {
|
|
|
8553
8578
|
}
|
|
8554
8579
|
__updateStrokeBounds() {}
|
|
8555
8580
|
__updateRenderBounds() {
|
|
8556
|
-
let isOverflow;
|
|
8581
|
+
let isOverflow, isScrollMode;
|
|
8557
8582
|
if (this.children.length) {
|
|
8558
|
-
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
|
|
8583
|
+
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout, {overflow: overflow} = data;
|
|
8559
8584
|
const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
|
|
8560
8585
|
super.__updateRenderBounds(childrenRenderBounds);
|
|
8561
|
-
if (
|
|
8586
|
+
if (isScrollMode = overflow.includes("scroll")) {
|
|
8562
8587
|
add(childrenRenderBounds, boxBounds);
|
|
8563
8588
|
scroll(childrenRenderBounds, data);
|
|
8564
8589
|
}
|
|
8565
8590
|
this.__updateRectRenderBounds();
|
|
8566
8591
|
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
8567
|
-
if (isOverflow &&
|
|
8592
|
+
if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
|
|
8568
8593
|
} else this.__updateRectRenderBounds();
|
|
8569
8594
|
DataHelper.stintSet(this, "isOverflow", isOverflow);
|
|
8570
|
-
this.__checkScroll();
|
|
8595
|
+
this.__checkScroll(isScrollMode);
|
|
8571
8596
|
}
|
|
8572
8597
|
__updateRectRenderBounds() {}
|
|
8573
|
-
|
|
8574
|
-
if (this.hasScroller) this.__updateScroll();
|
|
8575
|
-
super.__updateWorldBounds();
|
|
8576
|
-
}
|
|
8577
|
-
__checkScroll() {}
|
|
8578
|
-
__updateScroll() {}
|
|
8598
|
+
__checkScroll(_isScrollMode) {}
|
|
8579
8599
|
__updateRectChange() {}
|
|
8580
8600
|
__updateChange() {
|
|
8581
8601
|
super.__updateChange();
|
|
@@ -8621,9 +8641,6 @@ var LeaferUI = function(exports) {
|
|
|
8621
8641
|
get isFrame() {
|
|
8622
8642
|
return true;
|
|
8623
8643
|
}
|
|
8624
|
-
constructor(data) {
|
|
8625
|
-
super(data);
|
|
8626
|
-
}
|
|
8627
8644
|
};
|
|
8628
8645
|
__decorate([ dataProcessor(FrameData) ], exports.Frame.prototype, "__", void 0);
|
|
8629
8646
|
__decorate([ surfaceType("#FFFFFF") ], exports.Frame.prototype, "fill", void 0);
|
|
@@ -8634,9 +8651,6 @@ var LeaferUI = function(exports) {
|
|
|
8634
8651
|
get __tag() {
|
|
8635
8652
|
return "Ellipse";
|
|
8636
8653
|
}
|
|
8637
|
-
constructor(data) {
|
|
8638
|
-
super(data);
|
|
8639
|
-
}
|
|
8640
8654
|
__updatePath() {
|
|
8641
8655
|
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
|
|
8642
8656
|
const rx = width / 2, ry = height / 2;
|
|
@@ -8672,7 +8686,6 @@ var LeaferUI = function(exports) {
|
|
|
8672
8686
|
exports.Ellipse = __decorate([ registerUI() ], exports.Ellipse);
|
|
8673
8687
|
const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
8674
8688
|
const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
|
|
8675
|
-
const {toBounds: toBounds} = PathBounds;
|
|
8676
8689
|
exports.Line = class Line extends exports.UI {
|
|
8677
8690
|
get __tag() {
|
|
8678
8691
|
return "Line";
|
|
@@ -8689,31 +8702,16 @@ var LeaferUI = function(exports) {
|
|
|
8689
8702
|
this.rotation = getAngle$1(defaultPoint, value);
|
|
8690
8703
|
if (this.height) this.height = 0;
|
|
8691
8704
|
}
|
|
8692
|
-
constructor(data) {
|
|
8693
|
-
super(data);
|
|
8694
|
-
}
|
|
8695
8705
|
__updatePath() {
|
|
8696
8706
|
const data = this.__;
|
|
8697
8707
|
const path = data.path = [];
|
|
8698
8708
|
if (data.points) {
|
|
8699
|
-
drawPoints$1(path, data.points,
|
|
8709
|
+
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
8700
8710
|
} else {
|
|
8701
8711
|
moveTo$2(path, 0, 0);
|
|
8702
8712
|
lineTo$2(path, this.width, 0);
|
|
8703
8713
|
}
|
|
8704
8714
|
}
|
|
8705
|
-
__updateRenderPath() {
|
|
8706
|
-
const data = this.__;
|
|
8707
|
-
if (!this.pathInputed && data.points && data.curve) {
|
|
8708
|
-
drawPoints$1(data.__pathForRender = [], data.points, data.curve, data.closed);
|
|
8709
|
-
if (data.__useArrow) PathArrow.addArrows(this, false);
|
|
8710
|
-
} else super.__updateRenderPath();
|
|
8711
|
-
}
|
|
8712
|
-
__updateBoxBounds() {
|
|
8713
|
-
if (this.points) {
|
|
8714
|
-
toBounds(this.__.__pathForRender, this.__layout.boxBounds);
|
|
8715
|
-
} else super.__updateBoxBounds();
|
|
8716
|
-
}
|
|
8717
8715
|
};
|
|
8718
8716
|
__decorate([ dataProcessor(LineData) ], exports.Line.prototype, "__", void 0);
|
|
8719
8717
|
__decorate([ affectStrokeBoundsType("center") ], exports.Line.prototype, "strokeAlign", void 0);
|
|
@@ -8729,15 +8727,13 @@ var LeaferUI = function(exports) {
|
|
|
8729
8727
|
get __tag() {
|
|
8730
8728
|
return "Polygon";
|
|
8731
8729
|
}
|
|
8732
|
-
constructor(data) {
|
|
8733
|
-
super(data);
|
|
8734
|
-
}
|
|
8735
8730
|
__updatePath() {
|
|
8736
|
-
const
|
|
8737
|
-
|
|
8738
|
-
|
|
8731
|
+
const data = this.__;
|
|
8732
|
+
const path = data.path = [];
|
|
8733
|
+
if (data.points) {
|
|
8734
|
+
drawPoints(path, data.points, data.curve, true);
|
|
8739
8735
|
} else {
|
|
8740
|
-
const {width: width, height: height, sides: sides} =
|
|
8736
|
+
const {width: width, height: height, sides: sides} = data;
|
|
8741
8737
|
const rx = width / 2, ry = height / 2;
|
|
8742
8738
|
moveTo$1(path, rx, 0);
|
|
8743
8739
|
for (let i = 1; i < sides; i++) {
|
|
@@ -8762,9 +8758,6 @@ var LeaferUI = function(exports) {
|
|
|
8762
8758
|
get __tag() {
|
|
8763
8759
|
return "Star";
|
|
8764
8760
|
}
|
|
8765
|
-
constructor(data) {
|
|
8766
|
-
super(data);
|
|
8767
|
-
}
|
|
8768
8761
|
__updatePath() {
|
|
8769
8762
|
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
8770
8763
|
const rx = width / 2, ry = height / 2;
|
|
@@ -8792,9 +8785,6 @@ var LeaferUI = function(exports) {
|
|
|
8792
8785
|
const {fill: fill} = this.__;
|
|
8793
8786
|
return isArray(fill) && fill[0].image;
|
|
8794
8787
|
}
|
|
8795
|
-
constructor(data) {
|
|
8796
|
-
super(data);
|
|
8797
|
-
}
|
|
8798
8788
|
};
|
|
8799
8789
|
__decorate([ dataProcessor(ImageData) ], exports.Image.prototype, "__", void 0);
|
|
8800
8790
|
__decorate([ boundsType("") ], exports.Image.prototype, "url", void 0);
|
|
@@ -8879,9 +8869,6 @@ var LeaferUI = function(exports) {
|
|
|
8879
8869
|
this.updateLayout();
|
|
8880
8870
|
return this.__.__textDrawData;
|
|
8881
8871
|
}
|
|
8882
|
-
constructor(data) {
|
|
8883
|
-
super(data);
|
|
8884
|
-
}
|
|
8885
8872
|
__updateTextDrawData() {
|
|
8886
8873
|
const data = this.__;
|
|
8887
8874
|
const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding} = data;
|
|
@@ -8985,9 +8972,6 @@ var LeaferUI = function(exports) {
|
|
|
8985
8972
|
get __tag() {
|
|
8986
8973
|
return "Path";
|
|
8987
8974
|
}
|
|
8988
|
-
constructor(data) {
|
|
8989
|
-
super(data);
|
|
8990
|
-
}
|
|
8991
8975
|
};
|
|
8992
8976
|
__decorate([ dataProcessor(PathData) ], exports.Path.prototype, "__", void 0);
|
|
8993
8977
|
__decorate([ affectStrokeBoundsType("center") ], exports.Path.prototype, "strokeAlign", void 0);
|
|
@@ -8996,9 +8980,6 @@ var LeaferUI = function(exports) {
|
|
|
8996
8980
|
get __tag() {
|
|
8997
8981
|
return "Pen";
|
|
8998
8982
|
}
|
|
8999
|
-
constructor(data) {
|
|
9000
|
-
super(data);
|
|
9001
|
-
}
|
|
9002
8983
|
setStyle(data) {
|
|
9003
8984
|
const path = this.pathElement = new exports.Path(data);
|
|
9004
8985
|
this.pathStyle = data;
|
|
@@ -11241,7 +11222,7 @@ var LeaferUI = function(exports) {
|
|
|
11241
11222
|
if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
|
|
11242
11223
|
}
|
|
11243
11224
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
11244
|
-
const {floor: floor, max: max, abs: abs} = Math;
|
|
11225
|
+
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
11245
11226
|
function createPattern(ui, paint, pixelRatio) {
|
|
11246
11227
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
11247
11228
|
const id = scaleX + "-" + scaleY + "-" + pixelRatio;
|
|
@@ -11250,8 +11231,6 @@ var LeaferUI = function(exports) {
|
|
|
11250
11231
|
let imageScale, imageMatrix, {width: width, height: height, scaleX: sx, scaleY: sy, transform: transform, repeat: repeat, gap: gap} = data;
|
|
11251
11232
|
scaleX *= pixelRatio;
|
|
11252
11233
|
scaleY *= pixelRatio;
|
|
11253
|
-
const xGap = gap && gap.x * scaleX;
|
|
11254
|
-
const yGap = gap && gap.y * scaleY;
|
|
11255
11234
|
if (sx) {
|
|
11256
11235
|
sx = abs(sx);
|
|
11257
11236
|
sy = abs(sy);
|
|
@@ -11268,7 +11247,10 @@ var LeaferUI = function(exports) {
|
|
|
11268
11247
|
if (size > Platform.image.maxCacheSize) return false;
|
|
11269
11248
|
}
|
|
11270
11249
|
let maxSize = Platform.image.maxPatternSize;
|
|
11271
|
-
if (
|
|
11250
|
+
if (image.isSVG) {
|
|
11251
|
+
const ws = width / image.width;
|
|
11252
|
+
if (ws > 1) imageScale = ws / ceil(ws);
|
|
11253
|
+
} else {
|
|
11272
11254
|
const imageSize = image.width * image.height;
|
|
11273
11255
|
if (maxSize > imageSize) maxSize = imageSize;
|
|
11274
11256
|
}
|
|
@@ -11283,18 +11265,20 @@ var LeaferUI = function(exports) {
|
|
|
11283
11265
|
scaleX /= sx;
|
|
11284
11266
|
scaleY /= sy;
|
|
11285
11267
|
}
|
|
11268
|
+
const xGap = gap && gap.x * scaleX;
|
|
11269
|
+
const yGap = gap && gap.y * scaleY;
|
|
11286
11270
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
11271
|
+
const canvasWidth = width + (xGap || 0);
|
|
11272
|
+
const canvasHeight = height + (yGap || 0);
|
|
11273
|
+
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
11274
|
+
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
11287
11275
|
if (!imageMatrix) {
|
|
11288
11276
|
imageMatrix = get$1();
|
|
11289
11277
|
if (transform) copy$1(imageMatrix, transform);
|
|
11290
11278
|
}
|
|
11291
11279
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
11292
11280
|
}
|
|
11293
|
-
|
|
11294
|
-
const canvasWidth = width + (xGap || 0), canvasHeight = height + (yGap || 0);
|
|
11295
|
-
scale(imageMatrix, canvasWidth / max(floor(canvasWidth), 1), canvasHeight / max(floor(canvasHeight), 1));
|
|
11296
|
-
}
|
|
11297
|
-
const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap);
|
|
11281
|
+
const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
|
|
11298
11282
|
const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
11299
11283
|
paint.style = pattern;
|
|
11300
11284
|
paint.patternId = id;
|
|
@@ -12308,6 +12292,7 @@ var LeaferUI = function(exports) {
|
|
|
12308
12292
|
exports.maskType = maskType;
|
|
12309
12293
|
exports.naturalBoundsType = naturalBoundsType;
|
|
12310
12294
|
exports.opacityType = opacityType;
|
|
12295
|
+
exports.path = path;
|
|
12311
12296
|
exports.pathInputType = pathInputType;
|
|
12312
12297
|
exports.pathType = pathType;
|
|
12313
12298
|
exports.pen = pen;
|