@leafer-ui/worker 1.12.4 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.cjs +18 -12
- package/dist/worker.esm.js +19 -13
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +122 -99
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +126 -103
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/worker.js
CHANGED
|
@@ -199,56 +199,6 @@ var LeaferUI = function(exports) {
|
|
|
199
199
|
this.__input = this.__middle = null;
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
const {floor: floor$2, max: max$5} = Math;
|
|
203
|
-
const Platform = {
|
|
204
|
-
toURL(text, fileType) {
|
|
205
|
-
let url = encodeURIComponent(text);
|
|
206
|
-
if (fileType === "text") url = "data:text/plain;charset=utf-8," + url; else if (fileType === "svg") url = "data:image/svg+xml," + url;
|
|
207
|
-
return url;
|
|
208
|
-
},
|
|
209
|
-
image: {
|
|
210
|
-
hitCanvasSize: 100,
|
|
211
|
-
maxCacheSize: 2560 * 1600,
|
|
212
|
-
maxPatternSize: 4096 * 2160,
|
|
213
|
-
crossOrigin: "anonymous",
|
|
214
|
-
isLarge(size, scaleX, scaleY, largeSize) {
|
|
215
|
-
return size.width * size.height * (scaleX ? scaleX * scaleY : 1) > (largeSize || image$1.maxCacheSize);
|
|
216
|
-
},
|
|
217
|
-
isSuperLarge(size, scaleX, scaleY) {
|
|
218
|
-
return image$1.isLarge(size, scaleX, scaleY, image$1.maxPatternSize);
|
|
219
|
-
},
|
|
220
|
-
getRealURL(url) {
|
|
221
|
-
const {prefix: prefix, suffix: suffix} = Platform.image;
|
|
222
|
-
if (suffix && !url.startsWith("data:") && !url.startsWith("blob:")) url += (url.includes("?") ? "&" : "?") + suffix;
|
|
223
|
-
if (prefix && url[0] === "/") url = prefix + url;
|
|
224
|
-
return url;
|
|
225
|
-
},
|
|
226
|
-
resize(image, width, height, xGap, yGap, clip, smooth, opacity, _filters) {
|
|
227
|
-
const canvas = Platform.origin.createCanvas(max$5(floor$2(width + (xGap || 0)), 1), max$5(floor$2(height + (yGap || 0)), 1));
|
|
228
|
-
const ctx = canvas.getContext("2d");
|
|
229
|
-
if (opacity) ctx.globalAlpha = opacity;
|
|
230
|
-
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
231
|
-
if (image) {
|
|
232
|
-
if (clip) {
|
|
233
|
-
const scaleX = width / clip.width, scaleY = height / clip.height;
|
|
234
|
-
ctx.setTransform(scaleX, 0, 0, scaleY, -clip.x * scaleX, -clip.y * scaleY);
|
|
235
|
-
ctx.drawImage(image, 0, 0, image.width, image.height);
|
|
236
|
-
} else ctx.drawImage(image, 0, 0, width, height);
|
|
237
|
-
}
|
|
238
|
-
return canvas;
|
|
239
|
-
},
|
|
240
|
-
setPatternTransform(pattern, transform, paint) {
|
|
241
|
-
try {
|
|
242
|
-
if (transform && pattern.setTransform) {
|
|
243
|
-
pattern.setTransform(transform);
|
|
244
|
-
transform = undefined;
|
|
245
|
-
}
|
|
246
|
-
} catch (_a) {}
|
|
247
|
-
if (paint) DataHelper.stintSet(paint, "transform", transform);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
const {image: image$1} = Platform;
|
|
252
202
|
const IncrementId = {
|
|
253
203
|
RUNTIME: "runtime",
|
|
254
204
|
LEAF: "leaf",
|
|
@@ -268,7 +218,7 @@ var LeaferUI = function(exports) {
|
|
|
268
218
|
};
|
|
269
219
|
const I$2 = IncrementId;
|
|
270
220
|
let tempA, tempB, tempTo;
|
|
271
|
-
const {max: max$
|
|
221
|
+
const {max: max$5} = Math, tempFour = [ 0, 0, 0, 0 ];
|
|
272
222
|
const FourNumberHelper = {
|
|
273
223
|
zero: [ ...tempFour ],
|
|
274
224
|
tempFour: tempFour,
|
|
@@ -319,9 +269,9 @@ var LeaferUI = function(exports) {
|
|
|
319
269
|
return data;
|
|
320
270
|
},
|
|
321
271
|
max(t, other, change) {
|
|
322
|
-
if (isNumber(t) && isNumber(other)) return max$
|
|
272
|
+
if (isNumber(t) && isNumber(other)) return max$5(t, other);
|
|
323
273
|
toTempAB(t, other, change);
|
|
324
|
-
return set$2(tempTo, max$
|
|
274
|
+
return set$2(tempTo, max$5(tempA[0], tempB[0]), max$5(tempA[1], tempB[1]), max$5(tempA[2], tempB[2]), max$5(tempA[3], tempB[3]));
|
|
325
275
|
},
|
|
326
276
|
add(t, other, change) {
|
|
327
277
|
if (isNumber(t) && isNumber(other)) return t + other;
|
|
@@ -336,7 +286,7 @@ var LeaferUI = function(exports) {
|
|
|
336
286
|
}
|
|
337
287
|
};
|
|
338
288
|
const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
339
|
-
const {round: round$3, pow: pow$1, max: max$
|
|
289
|
+
const {round: round$3, pow: pow$1, max: max$4, floor: floor$2, PI: PI$3} = Math;
|
|
340
290
|
const MathHelper = {
|
|
341
291
|
within(value, min, max) {
|
|
342
292
|
if (isObject(min)) max = min.max, min = min.min;
|
|
@@ -389,7 +339,7 @@ var LeaferUI = function(exports) {
|
|
|
389
339
|
}
|
|
390
340
|
},
|
|
391
341
|
getFloorScale(num, min = 1) {
|
|
392
|
-
return max$
|
|
342
|
+
return max$4(floor$2(num), min) / num;
|
|
393
343
|
},
|
|
394
344
|
randInt: randInt,
|
|
395
345
|
randColor(opacity) {
|
|
@@ -1195,7 +1145,7 @@ var LeaferUI = function(exports) {
|
|
|
1195
1145
|
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
1196
1146
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1197
1147
|
const {float: float$1, fourNumber: fourNumber} = MathHelper;
|
|
1198
|
-
const {floor: floor, ceil: ceil$1} = Math;
|
|
1148
|
+
const {floor: floor$1, ceil: ceil$1} = Math;
|
|
1199
1149
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
1200
1150
|
const point = {};
|
|
1201
1151
|
const toPoint$4 = {};
|
|
@@ -1347,8 +1297,8 @@ var LeaferUI = function(exports) {
|
|
|
1347
1297
|
},
|
|
1348
1298
|
ceil(t) {
|
|
1349
1299
|
const {x: x, y: y} = t;
|
|
1350
|
-
t.x = floor(t.x);
|
|
1351
|
-
t.y = floor(t.y);
|
|
1300
|
+
t.x = floor$1(t.x);
|
|
1301
|
+
t.y = floor$1(t.y);
|
|
1352
1302
|
t.width = x > t.x ? ceil$1(t.width + x - t.x) : ceil$1(t.width);
|
|
1353
1303
|
t.height = y > t.y ? ceil$1(t.height + y - t.y) : ceil$1(t.height);
|
|
1354
1304
|
},
|
|
@@ -1480,6 +1430,9 @@ var LeaferUI = function(exports) {
|
|
|
1480
1430
|
isEmpty(t) {
|
|
1481
1431
|
return t.x === 0 && t.y === 0 && t.width === 0 && t.height === 0;
|
|
1482
1432
|
},
|
|
1433
|
+
hasSize(t) {
|
|
1434
|
+
return t.width && t.height;
|
|
1435
|
+
},
|
|
1483
1436
|
reset(t) {
|
|
1484
1437
|
B.set(t);
|
|
1485
1438
|
}
|
|
@@ -1650,6 +1603,11 @@ var LeaferUI = function(exports) {
|
|
|
1650
1603
|
return new Bounds(left, top, width ? width : parent.width - left - right, height ? height : parent.height - top - bottom);
|
|
1651
1604
|
}
|
|
1652
1605
|
}
|
|
1606
|
+
const UnitConvertHelper = {
|
|
1607
|
+
number(value, percentRefer) {
|
|
1608
|
+
return isObject(value) ? value.type === "percent" ? value.value * percentRefer : value.value : value;
|
|
1609
|
+
}
|
|
1610
|
+
};
|
|
1653
1611
|
const StringNumberMap = {
|
|
1654
1612
|
0: 1,
|
|
1655
1613
|
1: 1,
|
|
@@ -1665,6 +1623,66 @@ var LeaferUI = function(exports) {
|
|
|
1665
1623
|
e: 1,
|
|
1666
1624
|
E: 1
|
|
1667
1625
|
};
|
|
1626
|
+
const {floor: floor, max: max$3} = Math;
|
|
1627
|
+
const Platform = {
|
|
1628
|
+
toURL(text, fileType) {
|
|
1629
|
+
let url = encodeURIComponent(text);
|
|
1630
|
+
if (fileType === "text") url = "data:text/plain;charset=utf-8," + url; else if (fileType === "svg") url = "data:image/svg+xml," + url;
|
|
1631
|
+
return url;
|
|
1632
|
+
},
|
|
1633
|
+
image: {
|
|
1634
|
+
hitCanvasSize: 100,
|
|
1635
|
+
maxCacheSize: 2560 * 1600,
|
|
1636
|
+
maxPatternSize: 4096 * 2160,
|
|
1637
|
+
crossOrigin: "anonymous",
|
|
1638
|
+
isLarge(size, scaleX, scaleY, largeSize) {
|
|
1639
|
+
return size.width * size.height * (scaleX ? scaleX * scaleY : 1) > (largeSize || image$1.maxCacheSize);
|
|
1640
|
+
},
|
|
1641
|
+
isSuperLarge(size, scaleX, scaleY) {
|
|
1642
|
+
return image$1.isLarge(size, scaleX, scaleY, image$1.maxPatternSize);
|
|
1643
|
+
},
|
|
1644
|
+
getRealURL(url) {
|
|
1645
|
+
const {prefix: prefix, suffix: suffix} = image$1;
|
|
1646
|
+
if (suffix && !url.startsWith("data:") && !url.startsWith("blob:")) url += (url.includes("?") ? "&" : "?") + suffix;
|
|
1647
|
+
if (prefix && url[0] === "/") url = prefix + url;
|
|
1648
|
+
return url;
|
|
1649
|
+
},
|
|
1650
|
+
resize(view, width, height, xGap, yGap, clip, smooth, opacity, _filters, interlace) {
|
|
1651
|
+
const realWidth = max$3(floor(width + (xGap || 0)), 1), realHeight = max$3(floor(height + (yGap || 0)), 1);
|
|
1652
|
+
let interlaceX, interlaceY, interlaceOffset;
|
|
1653
|
+
if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, interlace.type === "x" ? width : height))) interlace.type === "x" ? interlaceX = true : interlaceY = true;
|
|
1654
|
+
const canvas = Platform.origin.createCanvas(interlaceY ? realWidth * 2 : realWidth, interlaceX ? realHeight * 2 : realHeight);
|
|
1655
|
+
const ctx = canvas.getContext("2d");
|
|
1656
|
+
if (opacity) ctx.globalAlpha = opacity;
|
|
1657
|
+
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
1658
|
+
if (image$1.canUse(view)) {
|
|
1659
|
+
if (clip) {
|
|
1660
|
+
const scaleX = width / clip.width, scaleY = height / clip.height;
|
|
1661
|
+
ctx.setTransform(scaleX, 0, 0, scaleY, -clip.x * scaleX, -clip.y * scaleY);
|
|
1662
|
+
ctx.drawImage(view, 0, 0, view.width, view.height);
|
|
1663
|
+
} else ctx.drawImage(view, 0, 0, width, height);
|
|
1664
|
+
if (interlaceOffset) {
|
|
1665
|
+
ctx.drawImage(canvas, 0, 0, realWidth, realHeight, interlaceX ? interlaceOffset - realWidth : realWidth, interlaceX ? realHeight : interlaceOffset - realHeight, realWidth, realHeight);
|
|
1666
|
+
ctx.drawImage(canvas, 0, 0, realWidth, realHeight, interlaceX ? interlaceOffset : realWidth, interlaceX ? realHeight : interlaceOffset, realWidth, realHeight);
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
return canvas;
|
|
1670
|
+
},
|
|
1671
|
+
canUse(view) {
|
|
1672
|
+
return view && view.width && !view.__closed;
|
|
1673
|
+
},
|
|
1674
|
+
setPatternTransform(pattern, transform, paint) {
|
|
1675
|
+
try {
|
|
1676
|
+
if (transform && pattern.setTransform) {
|
|
1677
|
+
pattern.setTransform(transform);
|
|
1678
|
+
transform = undefined;
|
|
1679
|
+
}
|
|
1680
|
+
} catch (_a) {}
|
|
1681
|
+
if (paint) DataHelper.stintSet(paint, "transform", transform);
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
};
|
|
1685
|
+
const {image: image$1} = Platform;
|
|
1668
1686
|
const {randColor: randColor} = MathHelper;
|
|
1669
1687
|
class Debug {
|
|
1670
1688
|
constructor(name) {
|
|
@@ -3096,10 +3114,10 @@ var LeaferUI = function(exports) {
|
|
|
3096
3114
|
data.push(O$2, x, y, radius, startAngle, endAngle, anticlockwise ? 1 : 0);
|
|
3097
3115
|
}
|
|
3098
3116
|
},
|
|
3099
|
-
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3117
|
+
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
|
|
3100
3118
|
if (!isUndefined(lastX)) {
|
|
3101
|
-
const
|
|
3102
|
-
radius = min$1(radius, min$1(
|
|
3119
|
+
const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
|
|
3120
|
+
radius = min$1(radius, min$1(r, r * abs$3(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3103
3121
|
}
|
|
3104
3122
|
data.push(U$2, x1, y1, x2, y2, radius);
|
|
3105
3123
|
},
|
|
@@ -3424,7 +3442,7 @@ var LeaferUI = function(exports) {
|
|
|
3424
3442
|
let command, lastCommand, commandLen;
|
|
3425
3443
|
let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
|
|
3426
3444
|
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
3427
|
-
const len = data.length;
|
|
3445
|
+
const len = data.length, three = len === 9;
|
|
3428
3446
|
const smooth = [];
|
|
3429
3447
|
while (i < len) {
|
|
3430
3448
|
command = data[i];
|
|
@@ -3436,7 +3454,7 @@ var LeaferUI = function(exports) {
|
|
|
3436
3454
|
if (data[i] === L$1) {
|
|
3437
3455
|
secondX = data[i + 1];
|
|
3438
3456
|
secondY = data[i + 2];
|
|
3439
|
-
smooth.push(M, getCenterX(startX, secondX), getCenterY(startY, secondY));
|
|
3457
|
+
three ? smooth.push(M, startX, startY) : smooth.push(M, getCenterX(startX, secondX), getCenterY(startY, secondY));
|
|
3440
3458
|
} else {
|
|
3441
3459
|
smooth.push(M, startX, startY);
|
|
3442
3460
|
}
|
|
@@ -3448,11 +3466,11 @@ var LeaferUI = function(exports) {
|
|
|
3448
3466
|
i += 3;
|
|
3449
3467
|
switch (data[i]) {
|
|
3450
3468
|
case L$1:
|
|
3451
|
-
arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY);
|
|
3469
|
+
arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY, three);
|
|
3452
3470
|
break;
|
|
3453
3471
|
|
|
3454
3472
|
case Z:
|
|
3455
|
-
arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY);
|
|
3473
|
+
arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
|
|
3456
3474
|
break;
|
|
3457
3475
|
|
|
3458
3476
|
default:
|
|
@@ -3464,7 +3482,7 @@ var LeaferUI = function(exports) {
|
|
|
3464
3482
|
|
|
3465
3483
|
case Z:
|
|
3466
3484
|
if (lastCommand !== Z) {
|
|
3467
|
-
arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
|
|
3485
|
+
arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY, three);
|
|
3468
3486
|
smooth.push(Z);
|
|
3469
3487
|
}
|
|
3470
3488
|
i += 1;
|
|
@@ -3551,9 +3569,10 @@ var LeaferUI = function(exports) {
|
|
|
3551
3569
|
run() {
|
|
3552
3570
|
return __awaiter(this, void 0, void 0, function*() {
|
|
3553
3571
|
try {
|
|
3554
|
-
if (this.isComplete) return;
|
|
3572
|
+
if (this.isComplete || this.runing) return;
|
|
3573
|
+
this.runing = true;
|
|
3555
3574
|
if (this.canUse && !this.canUse()) return this.cancel();
|
|
3556
|
-
if (this.task
|
|
3575
|
+
if (this.task) yield this.task();
|
|
3557
3576
|
} catch (error) {
|
|
3558
3577
|
debug$9.error(error);
|
|
3559
3578
|
}
|
|
@@ -3668,7 +3687,7 @@ var LeaferUI = function(exports) {
|
|
|
3668
3687
|
stop() {
|
|
3669
3688
|
this.isComplete = true;
|
|
3670
3689
|
this.list.forEach(task => {
|
|
3671
|
-
if (!task.isComplete) task.
|
|
3690
|
+
if (!task.isComplete) task.run();
|
|
3672
3691
|
});
|
|
3673
3692
|
this.pause();
|
|
3674
3693
|
this.empty();
|
|
@@ -3951,7 +3970,7 @@ var LeaferUI = function(exports) {
|
|
|
3951
3970
|
getFull(_filters) {
|
|
3952
3971
|
return this.view;
|
|
3953
3972
|
}
|
|
3954
|
-
getCanvas(width, height, opacity, filters, xGap, yGap, smooth) {
|
|
3973
|
+
getCanvas(width, height, opacity, filters, xGap, yGap, smooth, interlace) {
|
|
3955
3974
|
width || (width = this.width);
|
|
3956
3975
|
height || (height = this.height);
|
|
3957
3976
|
if (this.cache) {
|
|
@@ -3964,7 +3983,7 @@ var LeaferUI = function(exports) {
|
|
|
3964
3983
|
}
|
|
3965
3984
|
if (data) return data;
|
|
3966
3985
|
}
|
|
3967
|
-
const canvas = Platform.image.resize(this.view, width, height, xGap, yGap, undefined, smooth, opacity, filters);
|
|
3986
|
+
const canvas = Platform.image.resize(this.view, width, height, xGap, yGap, undefined, smooth, opacity, filters, interlace);
|
|
3968
3987
|
this.cache = this.use > 1 ? {
|
|
3969
3988
|
data: canvas,
|
|
3970
3989
|
params: arguments
|
|
@@ -5706,7 +5725,7 @@ var LeaferUI = function(exports) {
|
|
|
5706
5725
|
if (this.__layout.opacityChanged) this.__layout.opacityChanged = false;
|
|
5707
5726
|
}
|
|
5708
5727
|
};
|
|
5709
|
-
const {excludeRenderBounds: excludeRenderBounds$1} = LeafBoundsHelper;
|
|
5728
|
+
const {excludeRenderBounds: excludeRenderBounds$1} = LeafBoundsHelper, {hasSize: hasSize} = BoundsHelper;
|
|
5710
5729
|
const BranchRender = {
|
|
5711
5730
|
__updateChange() {
|
|
5712
5731
|
const {__layout: layout} = this;
|
|
@@ -5717,8 +5736,8 @@ var LeaferUI = function(exports) {
|
|
|
5717
5736
|
this.__.__checkSingle();
|
|
5718
5737
|
},
|
|
5719
5738
|
__render(canvas, options) {
|
|
5720
|
-
this.__nowWorld = this.__getNowWorld(options);
|
|
5721
|
-
if (this.__worldOpacity) {
|
|
5739
|
+
const nowWorld = this.__nowWorld = this.__getNowWorld(options);
|
|
5740
|
+
if (this.__worldOpacity && hasSize(nowWorld)) {
|
|
5722
5741
|
const data = this.__;
|
|
5723
5742
|
if (data.__useDim) {
|
|
5724
5743
|
if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.bright && !options.topRendering) return options.topList.add(this); else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
|
|
@@ -5727,7 +5746,6 @@ var LeaferUI = function(exports) {
|
|
|
5727
5746
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
5728
5747
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
5729
5748
|
this.__renderBranch(tempCanvas, options);
|
|
5730
|
-
const nowWorld = this.__nowWorld;
|
|
5731
5749
|
canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
5732
5750
|
canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true);
|
|
5733
5751
|
tempCanvas.recycle(nowWorld);
|
|
@@ -6549,7 +6567,7 @@ var LeaferUI = function(exports) {
|
|
|
6549
6567
|
this.levelMap = null;
|
|
6550
6568
|
}
|
|
6551
6569
|
}
|
|
6552
|
-
const version = "
|
|
6570
|
+
const version = "2.0.1";
|
|
6553
6571
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6554
6572
|
get allowBackgroundColor() {
|
|
6555
6573
|
return true;
|
|
@@ -6949,6 +6967,7 @@ var LeaferUI = function(exports) {
|
|
|
6949
6967
|
this.times = 0;
|
|
6950
6968
|
this.config = {
|
|
6951
6969
|
usePartRender: true,
|
|
6970
|
+
ceilPartPixel: true,
|
|
6952
6971
|
maxFPS: 120
|
|
6953
6972
|
};
|
|
6954
6973
|
this.frames = [];
|
|
@@ -7057,8 +7076,9 @@ var LeaferUI = function(exports) {
|
|
|
7057
7076
|
const {canvas: canvas} = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
|
|
7058
7077
|
canvas.save();
|
|
7059
7078
|
bounds.spread(Renderer.clipSpread).ceil();
|
|
7060
|
-
|
|
7061
|
-
canvas.clipWorld(bounds);
|
|
7079
|
+
const {ceilPartPixel: ceilPartPixel} = this.config;
|
|
7080
|
+
canvas.clipWorld(bounds, ceilPartPixel);
|
|
7081
|
+
canvas.clearWorld(bounds, ceilPartPixel);
|
|
7062
7082
|
this.__render(bounds, realBounds);
|
|
7063
7083
|
canvas.restore();
|
|
7064
7084
|
Run.end(t);
|
|
@@ -7440,11 +7460,7 @@ var LeaferUI = function(exports) {
|
|
|
7440
7460
|
const ColorConvert = {
|
|
7441
7461
|
hasTransparent: hasTransparent$3
|
|
7442
7462
|
};
|
|
7443
|
-
const UnitConvert =
|
|
7444
|
-
number(value, percentRefer) {
|
|
7445
|
-
return isObject(value) ? value.type === "percent" ? value.value * percentRefer : value.value : value;
|
|
7446
|
-
}
|
|
7447
|
-
};
|
|
7463
|
+
const UnitConvert = UnitConvertHelper;
|
|
7448
7464
|
const PathArrow = {};
|
|
7449
7465
|
const Paint = {};
|
|
7450
7466
|
const PaintImage = {};
|
|
@@ -7507,16 +7523,16 @@ var LeaferUI = function(exports) {
|
|
|
7507
7523
|
return t.fill || t.stroke;
|
|
7508
7524
|
}
|
|
7509
7525
|
get __autoWidth() {
|
|
7510
|
-
return
|
|
7526
|
+
return this._width == null;
|
|
7511
7527
|
}
|
|
7512
7528
|
get __autoHeight() {
|
|
7513
|
-
return
|
|
7529
|
+
return this._height == null;
|
|
7514
7530
|
}
|
|
7515
7531
|
get __autoSide() {
|
|
7516
|
-
return
|
|
7532
|
+
return this._width == null || this._height == null;
|
|
7517
7533
|
}
|
|
7518
7534
|
get __autoSize() {
|
|
7519
|
-
return
|
|
7535
|
+
return this._width == null && this._height == null;
|
|
7520
7536
|
}
|
|
7521
7537
|
setVisible(value) {
|
|
7522
7538
|
this._visible = value;
|
|
@@ -8662,9 +8678,10 @@ var LeaferUI = function(exports) {
|
|
|
8662
8678
|
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
|
|
8663
8679
|
const rx = width / 2, ry = height / 2;
|
|
8664
8680
|
const path = this.__.path = [];
|
|
8681
|
+
let open;
|
|
8665
8682
|
if (innerRadius) {
|
|
8666
8683
|
if (startAngle || endAngle) {
|
|
8667
|
-
if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false);
|
|
8684
|
+
if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false); else open = true;
|
|
8668
8685
|
ellipse(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
|
|
8669
8686
|
} else {
|
|
8670
8687
|
if (innerRadius < 1) {
|
|
@@ -8681,7 +8698,7 @@ var LeaferUI = function(exports) {
|
|
|
8681
8698
|
ellipse(path, rx, ry, rx, ry);
|
|
8682
8699
|
}
|
|
8683
8700
|
}
|
|
8684
|
-
closePath$2(path);
|
|
8701
|
+
if (!open) closePath$2(path);
|
|
8685
8702
|
if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
|
|
8686
8703
|
}
|
|
8687
8704
|
};
|
|
@@ -10347,6 +10364,7 @@ var LeaferUI = function(exports) {
|
|
|
10347
10364
|
ImageManager.patternLocked = true;
|
|
10348
10365
|
this.__renderShape(h, {
|
|
10349
10366
|
matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y),
|
|
10367
|
+
snapshot: true,
|
|
10350
10368
|
ignoreFill: !isHitPixelFill,
|
|
10351
10369
|
ignoreStroke: !isHitPixelStroke
|
|
10352
10370
|
});
|
|
@@ -10873,7 +10891,7 @@ var LeaferUI = function(exports) {
|
|
|
10873
10891
|
if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
|
|
10874
10892
|
if (paint.mode === "strench") paint.mode = "stretch";
|
|
10875
10893
|
const {width: width, height: height} = image;
|
|
10876
|
-
const {opacity: opacity, mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, filters: filters} = paint;
|
|
10894
|
+
const {opacity: opacity, mode: mode, align: align, offset: offset, scale: scale, size: size, rotation: rotation, skew: skew, clipSize: clipSize, repeat: repeat, gap: gap, filters: filters, interlace: interlace} = paint;
|
|
10877
10895
|
const sameBox = box.width === width && box.height === height;
|
|
10878
10896
|
const data = {
|
|
10879
10897
|
mode: mode
|
|
@@ -10939,6 +10957,10 @@ var LeaferUI = function(exports) {
|
|
|
10939
10957
|
if (opacity && opacity < 1) data.opacity = opacity;
|
|
10940
10958
|
if (filters) data.filters = filters;
|
|
10941
10959
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
10960
|
+
if (interlace) data.interlace = isNumber(interlace) || interlace.type === "percent" ? {
|
|
10961
|
+
type: "x",
|
|
10962
|
+
offset: interlace
|
|
10963
|
+
} : interlace;
|
|
10942
10964
|
return data;
|
|
10943
10965
|
}
|
|
10944
10966
|
function getGapData(gap, repeat, width, height, box) {
|
|
@@ -11059,7 +11081,7 @@ var LeaferUI = function(exports) {
|
|
|
11059
11081
|
if (transform) copy$1(imageMatrix, transform);
|
|
11060
11082
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
11061
11083
|
}
|
|
11062
|
-
const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
|
|
11084
|
+
const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
11063
11085
|
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
11064
11086
|
paint.style = pattern;
|
|
11065
11087
|
paint.patternId = id;
|
|
@@ -11079,8 +11101,8 @@ var LeaferUI = function(exports) {
|
|
|
11079
11101
|
}
|
|
11080
11102
|
function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
11081
11103
|
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
|
|
11082
|
-
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting} = renderOptions;
|
|
11083
|
-
if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting) {
|
|
11104
|
+
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting, snapshot: snapshot} = renderOptions;
|
|
11105
|
+
if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting || snapshot) {
|
|
11084
11106
|
return false;
|
|
11085
11107
|
} else {
|
|
11086
11108
|
if (drawImage) {
|
|
@@ -11673,7 +11695,7 @@ var LeaferUI = function(exports) {
|
|
|
11673
11695
|
const TextMode = 2;
|
|
11674
11696
|
function layoutChar(drawData, style, width, _height) {
|
|
11675
11697
|
const {rows: rows} = drawData;
|
|
11676
|
-
const {textAlign: textAlign, paraIndent: paraIndent,
|
|
11698
|
+
const {textAlign: textAlign, paraIndent: paraIndent, __letterSpacing: __letterSpacing} = style;
|
|
11677
11699
|
const justifyLast = width && textAlign.includes("both");
|
|
11678
11700
|
const justify = justifyLast || width && textAlign.includes("justify");
|
|
11679
11701
|
const justifyLetter = justify && textAlign.includes("letter");
|
|
@@ -11686,8 +11708,8 @@ var LeaferUI = function(exports) {
|
|
|
11686
11708
|
remainingWidth = width - row.width - indentWidth;
|
|
11687
11709
|
if (justifyLetter) addLetterWidth = remainingWidth / (row.words.reduce((total, item) => total + item.data.length, 0) - 1); else addWordWidth = wordsLength > 1 ? remainingWidth / (wordsLength - 1) : 0;
|
|
11688
11710
|
}
|
|
11689
|
-
mode =
|
|
11690
|
-
if (row.isOverflow && !
|
|
11711
|
+
mode = __letterSpacing || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
|
|
11712
|
+
if (row.isOverflow && !__letterSpacing) row.textMode = true;
|
|
11691
11713
|
if (mode === TextMode) {
|
|
11692
11714
|
row.x += indentWidth;
|
|
11693
11715
|
toTextChar$1(row);
|
|
@@ -11752,7 +11774,7 @@ var LeaferUI = function(exports) {
|
|
|
11752
11774
|
let {x: x, y: y, width: width, height: height} = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
11753
11775
|
let starY = __baseLine;
|
|
11754
11776
|
if (__clipText && realHeight > height) {
|
|
11755
|
-
realHeight = Math.max(height, __lineHeight);
|
|
11777
|
+
realHeight = Math.max(style.__autoHeight ? realHeight : height, __lineHeight);
|
|
11756
11778
|
if (countRows > 1) drawData.overflow = countRows;
|
|
11757
11779
|
} else if (height || autoSizeAlign) {
|
|
11758
11780
|
switch (verticalAlign) {
|
|
@@ -11808,10 +11830,10 @@ var LeaferUI = function(exports) {
|
|
|
11808
11830
|
bounds.height = realHeight;
|
|
11809
11831
|
}
|
|
11810
11832
|
function clipText(drawData, style, x, width) {
|
|
11811
|
-
if (!width) return;
|
|
11812
11833
|
const {rows: rows, overflow: overflow} = drawData;
|
|
11813
11834
|
let {textOverflow: textOverflow} = style;
|
|
11814
|
-
rows.splice(overflow);
|
|
11835
|
+
if (overflow) rows.splice(overflow);
|
|
11836
|
+
if (!width) return;
|
|
11815
11837
|
if (textOverflow && textOverflow !== "show") {
|
|
11816
11838
|
if (textOverflow === "hide") textOverflow = ""; else if (textOverflow === "ellipsis") textOverflow = "...";
|
|
11817
11839
|
let char, charRight;
|
|
@@ -12077,6 +12099,7 @@ var LeaferUI = function(exports) {
|
|
|
12077
12099
|
exports.UIEvent = UIEvent;
|
|
12078
12100
|
exports.UIRender = UIRender;
|
|
12079
12101
|
exports.UnitConvert = UnitConvert;
|
|
12102
|
+
exports.UnitConvertHelper = UnitConvertHelper;
|
|
12080
12103
|
exports.WaitHelper = WaitHelper;
|
|
12081
12104
|
exports.WatchEvent = WatchEvent;
|
|
12082
12105
|
exports.Watcher = Watcher;
|