leafer-game 1.12.3 → 2.0.0
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.js +110 -85
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +114 -89
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +12 -12
package/dist/web.js
CHANGED
|
@@ -199,54 +199,6 @@ var LeaferUI = function(exports) {
|
|
|
199
199
|
this.__input = this.__middle = null;
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
const {floor: floor$3, 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$3(width + (xGap || 0)), 1), max$5(floor$3(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 (clip) {
|
|
232
|
-
const scaleX = width / clip.width, scaleY = height / clip.height;
|
|
233
|
-
ctx.setTransform(scaleX, 0, 0, scaleY, -clip.x * scaleX, -clip.y * scaleY);
|
|
234
|
-
ctx.drawImage(image, 0, 0, image.width, image.height);
|
|
235
|
-
} else ctx.drawImage(image, 0, 0, width, height);
|
|
236
|
-
return canvas;
|
|
237
|
-
},
|
|
238
|
-
setPatternTransform(pattern, transform, paint) {
|
|
239
|
-
try {
|
|
240
|
-
if (transform && pattern.setTransform) {
|
|
241
|
-
pattern.setTransform(transform);
|
|
242
|
-
transform = undefined;
|
|
243
|
-
}
|
|
244
|
-
} catch (_a) {}
|
|
245
|
-
if (paint) DataHelper.stintSet(paint, "transform", transform);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
const {image: image$1} = Platform;
|
|
250
202
|
const IncrementId = {
|
|
251
203
|
RUNTIME: "runtime",
|
|
252
204
|
LEAF: "leaf",
|
|
@@ -266,7 +218,7 @@ var LeaferUI = function(exports) {
|
|
|
266
218
|
};
|
|
267
219
|
const I$2 = IncrementId;
|
|
268
220
|
let tempA, tempB, tempTo;
|
|
269
|
-
const {max: max$
|
|
221
|
+
const {max: max$5} = Math, tempFour = [ 0, 0, 0, 0 ];
|
|
270
222
|
const FourNumberHelper = {
|
|
271
223
|
zero: [ ...tempFour ],
|
|
272
224
|
tempFour: tempFour,
|
|
@@ -317,9 +269,9 @@ var LeaferUI = function(exports) {
|
|
|
317
269
|
return data;
|
|
318
270
|
},
|
|
319
271
|
max(t, other, change) {
|
|
320
|
-
if (isNumber(t) && isNumber(other)) return max$
|
|
272
|
+
if (isNumber(t) && isNumber(other)) return max$5(t, other);
|
|
321
273
|
toTempAB(t, other, change);
|
|
322
|
-
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]));
|
|
323
275
|
},
|
|
324
276
|
add(t, other, change) {
|
|
325
277
|
if (isNumber(t) && isNumber(other)) return t + other;
|
|
@@ -334,7 +286,7 @@ var LeaferUI = function(exports) {
|
|
|
334
286
|
}
|
|
335
287
|
};
|
|
336
288
|
const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
337
|
-
const {round: round$6, pow: pow$2, max: max$
|
|
289
|
+
const {round: round$6, pow: pow$2, max: max$4, floor: floor$3, PI: PI$4} = Math;
|
|
338
290
|
const MathHelper = {
|
|
339
291
|
within(value, min, max) {
|
|
340
292
|
if (isObject(min)) max = min.max, min = min.min;
|
|
@@ -387,7 +339,7 @@ var LeaferUI = function(exports) {
|
|
|
387
339
|
}
|
|
388
340
|
},
|
|
389
341
|
getFloorScale(num, min = 1) {
|
|
390
|
-
return max$
|
|
342
|
+
return max$4(floor$3(num), min) / num;
|
|
391
343
|
},
|
|
392
344
|
randInt: randInt,
|
|
393
345
|
randColor(opacity) {
|
|
@@ -1193,7 +1145,7 @@ var LeaferUI = function(exports) {
|
|
|
1193
1145
|
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
1194
1146
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1195
1147
|
const {float: float$3, fourNumber: fourNumber$1} = MathHelper;
|
|
1196
|
-
const {floor: floor$
|
|
1148
|
+
const {floor: floor$2, ceil: ceil$2} = Math;
|
|
1197
1149
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
1198
1150
|
const point = {};
|
|
1199
1151
|
const toPoint$4 = {};
|
|
@@ -1345,8 +1297,8 @@ var LeaferUI = function(exports) {
|
|
|
1345
1297
|
},
|
|
1346
1298
|
ceil(t) {
|
|
1347
1299
|
const {x: x, y: y} = t;
|
|
1348
|
-
t.x = floor$
|
|
1349
|
-
t.y = floor$
|
|
1300
|
+
t.x = floor$2(t.x);
|
|
1301
|
+
t.y = floor$2(t.y);
|
|
1350
1302
|
t.width = x > t.x ? ceil$2(t.width + x - t.x) : ceil$2(t.width);
|
|
1351
1303
|
t.height = y > t.y ? ceil$2(t.height + y - t.y) : ceil$2(t.height);
|
|
1352
1304
|
},
|
|
@@ -1478,6 +1430,9 @@ var LeaferUI = function(exports) {
|
|
|
1478
1430
|
isEmpty(t) {
|
|
1479
1431
|
return t.x === 0 && t.y === 0 && t.width === 0 && t.height === 0;
|
|
1480
1432
|
},
|
|
1433
|
+
hasSize(t) {
|
|
1434
|
+
return t.width && t.height;
|
|
1435
|
+
},
|
|
1481
1436
|
reset(t) {
|
|
1482
1437
|
B.set(t);
|
|
1483
1438
|
}
|
|
@@ -1648,6 +1603,11 @@ var LeaferUI = function(exports) {
|
|
|
1648
1603
|
return new Bounds(left, top, width ? width : parent.width - left - right, height ? height : parent.height - top - bottom);
|
|
1649
1604
|
}
|
|
1650
1605
|
}
|
|
1606
|
+
const UnitConvertHelper = {
|
|
1607
|
+
number(value, percentRefer) {
|
|
1608
|
+
return isObject(value) ? value.type === "percent" ? value.value * percentRefer : value.value : value;
|
|
1609
|
+
}
|
|
1610
|
+
};
|
|
1651
1611
|
const StringNumberMap = {
|
|
1652
1612
|
0: 1,
|
|
1653
1613
|
1: 1,
|
|
@@ -1663,6 +1623,66 @@ var LeaferUI = function(exports) {
|
|
|
1663
1623
|
e: 1,
|
|
1664
1624
|
E: 1
|
|
1665
1625
|
};
|
|
1626
|
+
const {floor: floor$1, 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$1(width + (xGap || 0)), 1), realHeight = max$3(floor$1(height + (yGap || 0)), 1);
|
|
1652
|
+
let interlaceX, interlaceY, interlaceOffset;
|
|
1653
|
+
if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, (interlaceX = interlace.type === "x") ? width : height))) interlaceX || (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;
|
|
1666
1686
|
const {randColor: randColor} = MathHelper;
|
|
1667
1687
|
class Debug {
|
|
1668
1688
|
constructor(name) {
|
|
@@ -3549,9 +3569,10 @@ var LeaferUI = function(exports) {
|
|
|
3549
3569
|
run() {
|
|
3550
3570
|
return __awaiter(this, void 0, void 0, function*() {
|
|
3551
3571
|
try {
|
|
3552
|
-
if (this.isComplete) return;
|
|
3572
|
+
if (this.isComplete || this.runing) return;
|
|
3573
|
+
this.runing = true;
|
|
3553
3574
|
if (this.canUse && !this.canUse()) return this.cancel();
|
|
3554
|
-
if (this.task
|
|
3575
|
+
if (this.task) yield this.task();
|
|
3555
3576
|
} catch (error) {
|
|
3556
3577
|
debug$a.error(error);
|
|
3557
3578
|
}
|
|
@@ -3666,7 +3687,7 @@ var LeaferUI = function(exports) {
|
|
|
3666
3687
|
stop() {
|
|
3667
3688
|
this.isComplete = true;
|
|
3668
3689
|
this.list.forEach(task => {
|
|
3669
|
-
if (!task.isComplete) task.
|
|
3690
|
+
if (!task.isComplete) task.run();
|
|
3670
3691
|
});
|
|
3671
3692
|
this.pause();
|
|
3672
3693
|
this.empty();
|
|
@@ -3949,7 +3970,7 @@ var LeaferUI = function(exports) {
|
|
|
3949
3970
|
getFull(_filters) {
|
|
3950
3971
|
return this.view;
|
|
3951
3972
|
}
|
|
3952
|
-
getCanvas(width, height, opacity, filters, xGap, yGap, smooth) {
|
|
3973
|
+
getCanvas(width, height, opacity, filters, xGap, yGap, smooth, interlace) {
|
|
3953
3974
|
width || (width = this.width);
|
|
3954
3975
|
height || (height = this.height);
|
|
3955
3976
|
if (this.cache) {
|
|
@@ -3962,7 +3983,7 @@ var LeaferUI = function(exports) {
|
|
|
3962
3983
|
}
|
|
3963
3984
|
if (data) return data;
|
|
3964
3985
|
}
|
|
3965
|
-
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);
|
|
3966
3987
|
this.cache = this.use > 1 ? {
|
|
3967
3988
|
data: canvas,
|
|
3968
3989
|
params: arguments
|
|
@@ -3978,13 +3999,13 @@ var LeaferUI = function(exports) {
|
|
|
3978
3999
|
return this.url;
|
|
3979
4000
|
}
|
|
3980
4001
|
setThumbView(_view) {}
|
|
3981
|
-
getThumbSize() {
|
|
4002
|
+
getThumbSize(_lod) {
|
|
3982
4003
|
return undefined;
|
|
3983
4004
|
}
|
|
3984
4005
|
getMinLevel() {
|
|
3985
4006
|
return undefined;
|
|
3986
4007
|
}
|
|
3987
|
-
getLevelData(_level) {
|
|
4008
|
+
getLevelData(_level, _width, _height) {
|
|
3988
4009
|
return undefined;
|
|
3989
4010
|
}
|
|
3990
4011
|
clearLevels(_checkUse) {}
|
|
@@ -5704,7 +5725,7 @@ var LeaferUI = function(exports) {
|
|
|
5704
5725
|
if (this.__layout.opacityChanged) this.__layout.opacityChanged = false;
|
|
5705
5726
|
}
|
|
5706
5727
|
};
|
|
5707
|
-
const {excludeRenderBounds: excludeRenderBounds$1} = LeafBoundsHelper;
|
|
5728
|
+
const {excludeRenderBounds: excludeRenderBounds$1} = LeafBoundsHelper, {hasSize: hasSize} = BoundsHelper;
|
|
5708
5729
|
const BranchRender = {
|
|
5709
5730
|
__updateChange() {
|
|
5710
5731
|
const {__layout: layout} = this;
|
|
@@ -5715,8 +5736,8 @@ var LeaferUI = function(exports) {
|
|
|
5715
5736
|
this.__.__checkSingle();
|
|
5716
5737
|
},
|
|
5717
5738
|
__render(canvas, options) {
|
|
5718
|
-
this.__nowWorld = this.__getNowWorld(options);
|
|
5719
|
-
if (this.__worldOpacity) {
|
|
5739
|
+
const nowWorld = this.__nowWorld = this.__getNowWorld(options);
|
|
5740
|
+
if (this.__worldOpacity && hasSize(nowWorld)) {
|
|
5720
5741
|
const data = this.__;
|
|
5721
5742
|
if (data.__useDim) {
|
|
5722
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);
|
|
@@ -5725,7 +5746,6 @@ var LeaferUI = function(exports) {
|
|
|
5725
5746
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
5726
5747
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
5727
5748
|
this.__renderBranch(tempCanvas, options);
|
|
5728
|
-
const nowWorld = this.__nowWorld;
|
|
5729
5749
|
canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
|
|
5730
5750
|
canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true);
|
|
5731
5751
|
tempCanvas.recycle(nowWorld);
|
|
@@ -6547,7 +6567,7 @@ var LeaferUI = function(exports) {
|
|
|
6547
6567
|
this.levelMap = null;
|
|
6548
6568
|
}
|
|
6549
6569
|
}
|
|
6550
|
-
const version = "
|
|
6570
|
+
const version = "2.0.0";
|
|
6551
6571
|
const debug$5 = Debug.get("LeaferCanvas");
|
|
6552
6572
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6553
6573
|
set zIndex(zIndex) {
|
|
@@ -7144,6 +7164,7 @@ var LeaferUI = function(exports) {
|
|
|
7144
7164
|
this.times = 0;
|
|
7145
7165
|
this.config = {
|
|
7146
7166
|
usePartRender: true,
|
|
7167
|
+
ceilPartPixel: true,
|
|
7147
7168
|
maxFPS: 120
|
|
7148
7169
|
};
|
|
7149
7170
|
this.frames = [];
|
|
@@ -7252,8 +7273,9 @@ var LeaferUI = function(exports) {
|
|
|
7252
7273
|
const {canvas: canvas} = this, bounds = block.getIntersect(canvas.bounds), realBounds = new Bounds(bounds);
|
|
7253
7274
|
canvas.save();
|
|
7254
7275
|
bounds.spread(Renderer.clipSpread).ceil();
|
|
7255
|
-
|
|
7256
|
-
canvas.clipWorld(bounds);
|
|
7276
|
+
const {ceilPartPixel: ceilPartPixel} = this.config;
|
|
7277
|
+
canvas.clipWorld(bounds, ceilPartPixel);
|
|
7278
|
+
canvas.clearWorld(bounds, ceilPartPixel);
|
|
7257
7279
|
this.__render(bounds, realBounds);
|
|
7258
7280
|
canvas.restore();
|
|
7259
7281
|
Run.end(t);
|
|
@@ -7635,11 +7657,7 @@ var LeaferUI = function(exports) {
|
|
|
7635
7657
|
const ColorConvert = {
|
|
7636
7658
|
hasTransparent: hasTransparent$3
|
|
7637
7659
|
};
|
|
7638
|
-
const UnitConvert =
|
|
7639
|
-
number(value, percentRefer) {
|
|
7640
|
-
return isObject(value) ? value.type === "percent" ? value.value * percentRefer : value.value : value;
|
|
7641
|
-
}
|
|
7642
|
-
};
|
|
7660
|
+
const UnitConvert = UnitConvertHelper;
|
|
7643
7661
|
const PathArrow = {};
|
|
7644
7662
|
const Paint = {};
|
|
7645
7663
|
const PaintImage = {};
|
|
@@ -8857,9 +8875,10 @@ var LeaferUI = function(exports) {
|
|
|
8857
8875
|
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
|
|
8858
8876
|
const rx = width / 2, ry = height / 2;
|
|
8859
8877
|
const path = this.__.path = [];
|
|
8878
|
+
let open;
|
|
8860
8879
|
if (innerRadius) {
|
|
8861
8880
|
if (startAngle || endAngle) {
|
|
8862
|
-
if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false);
|
|
8881
|
+
if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false); else open = true;
|
|
8863
8882
|
ellipse(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
|
|
8864
8883
|
} else {
|
|
8865
8884
|
if (innerRadius < 1) {
|
|
@@ -8876,7 +8895,7 @@ var LeaferUI = function(exports) {
|
|
|
8876
8895
|
ellipse(path, rx, ry, rx, ry);
|
|
8877
8896
|
}
|
|
8878
8897
|
}
|
|
8879
|
-
closePath$2(path);
|
|
8898
|
+
if (!open) closePath$2(path);
|
|
8880
8899
|
if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
|
|
8881
8900
|
}
|
|
8882
8901
|
};
|
|
@@ -10542,6 +10561,7 @@ var LeaferUI = function(exports) {
|
|
|
10542
10561
|
ImageManager.patternLocked = true;
|
|
10543
10562
|
this.__renderShape(h, {
|
|
10544
10563
|
matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y),
|
|
10564
|
+
snapshot: true,
|
|
10545
10565
|
ignoreFill: !isHitPixelFill,
|
|
10546
10566
|
ignoreStroke: !isHitPixelStroke
|
|
10547
10567
|
});
|
|
@@ -11334,7 +11354,7 @@ var LeaferUI = function(exports) {
|
|
|
11334
11354
|
ignoreRender(ui, false);
|
|
11335
11355
|
onLoadError(ui, event, error);
|
|
11336
11356
|
leafPaint.loadId = undefined;
|
|
11337
|
-
}, paint.lod && image.getThumbSize());
|
|
11357
|
+
}, paint.lod && image.getThumbSize(paint.lod));
|
|
11338
11358
|
if (ui.placeholderColor) {
|
|
11339
11359
|
if (!ui.placeholderDelay) image.isPlacehold = true; else setTimeout(() => {
|
|
11340
11360
|
if (!image.ready) {
|
|
@@ -11392,7 +11412,7 @@ var LeaferUI = function(exports) {
|
|
|
11392
11412
|
if (paint.padding) box = tempBox.set(box).shrink(paint.padding);
|
|
11393
11413
|
if (paint.mode === "strench") paint.mode = "stretch";
|
|
11394
11414
|
const {width: width, height: height} = image;
|
|
11395
|
-
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;
|
|
11415
|
+
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;
|
|
11396
11416
|
const sameBox = box.width === width && box.height === height;
|
|
11397
11417
|
const data = {
|
|
11398
11418
|
mode: mode
|
|
@@ -11458,6 +11478,10 @@ var LeaferUI = function(exports) {
|
|
|
11458
11478
|
if (opacity && opacity < 1) data.opacity = opacity;
|
|
11459
11479
|
if (filters) data.filters = filters;
|
|
11460
11480
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
11481
|
+
if (interlace) data.interlace = isNumber(interlace) || interlace.type === "percent" ? {
|
|
11482
|
+
type: "x",
|
|
11483
|
+
offset: interlace
|
|
11484
|
+
} : interlace;
|
|
11461
11485
|
return data;
|
|
11462
11486
|
}
|
|
11463
11487
|
function getGapData(gap, repeat, width, height, box) {
|
|
@@ -11578,7 +11602,7 @@ var LeaferUI = function(exports) {
|
|
|
11578
11602
|
if (transform) copy$1(imageMatrix, transform);
|
|
11579
11603
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
11580
11604
|
}
|
|
11581
|
-
const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
|
|
11605
|
+
const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
11582
11606
|
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
11583
11607
|
paint.style = pattern;
|
|
11584
11608
|
paint.patternId = id;
|
|
@@ -11598,8 +11622,8 @@ var LeaferUI = function(exports) {
|
|
|
11598
11622
|
}
|
|
11599
11623
|
function checkImage(paint, drawImage, ui, canvas, renderOptions) {
|
|
11600
11624
|
const {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions);
|
|
11601
|
-
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting} = renderOptions;
|
|
11602
|
-
if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting) {
|
|
11625
|
+
const {image: image, data: data, originPaint: originPaint} = paint, {exporting: exporting, snapshot: snapshot} = renderOptions;
|
|
11626
|
+
if (!data || paint.patternId === scaleX + "-" + scaleY && !exporting || snapshot) {
|
|
11603
11627
|
return false;
|
|
11604
11628
|
} else {
|
|
11605
11629
|
if (drawImage) {
|
|
@@ -12192,7 +12216,7 @@ var LeaferUI = function(exports) {
|
|
|
12192
12216
|
const TextMode = 2;
|
|
12193
12217
|
function layoutChar(drawData, style, width, _height) {
|
|
12194
12218
|
const {rows: rows} = drawData;
|
|
12195
|
-
const {textAlign: textAlign, paraIndent: paraIndent,
|
|
12219
|
+
const {textAlign: textAlign, paraIndent: paraIndent, __letterSpacing: __letterSpacing} = style;
|
|
12196
12220
|
const justifyLast = width && textAlign.includes("both");
|
|
12197
12221
|
const justify = justifyLast || width && textAlign.includes("justify");
|
|
12198
12222
|
const justifyLetter = justify && textAlign.includes("letter");
|
|
@@ -12205,8 +12229,8 @@ var LeaferUI = function(exports) {
|
|
|
12205
12229
|
remainingWidth = width - row.width - indentWidth;
|
|
12206
12230
|
if (justifyLetter) addLetterWidth = remainingWidth / (row.words.reduce((total, item) => total + item.data.length, 0) - 1); else addWordWidth = wordsLength > 1 ? remainingWidth / (wordsLength - 1) : 0;
|
|
12207
12231
|
}
|
|
12208
|
-
mode =
|
|
12209
|
-
if (row.isOverflow && !
|
|
12232
|
+
mode = __letterSpacing || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
|
|
12233
|
+
if (row.isOverflow && !__letterSpacing) row.textMode = true;
|
|
12210
12234
|
if (mode === TextMode) {
|
|
12211
12235
|
row.x += indentWidth;
|
|
12212
12236
|
toTextChar$1(row);
|
|
@@ -14528,6 +14552,7 @@ var LeaferUI = function(exports) {
|
|
|
14528
14552
|
exports.UIEvent = UIEvent;
|
|
14529
14553
|
exports.UIRender = UIRender;
|
|
14530
14554
|
exports.UnitConvert = UnitConvert;
|
|
14555
|
+
exports.UnitConvertHelper = UnitConvertHelper;
|
|
14531
14556
|
exports.WaitHelper = WaitHelper;
|
|
14532
14557
|
exports.WatchEvent = WatchEvent;
|
|
14533
14558
|
exports.Watcher = Watcher;
|