@leafer-draw/miniapp 2.0.0 → 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/miniapp.cjs +3 -3
- package/dist/miniapp.esm.js +3 -3
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +17 -17
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +9 -9
package/dist/miniapp.module.js
CHANGED
|
@@ -1727,7 +1727,7 @@ const Platform = {
|
|
|
1727
1727
|
resize(view, width, height, xGap, yGap, clip, smooth, opacity, _filters, interlace) {
|
|
1728
1728
|
const realWidth = max$2(floor(width + (xGap || 0)), 1), realHeight = max$2(floor(height + (yGap || 0)), 1);
|
|
1729
1729
|
let interlaceX, interlaceY, interlaceOffset;
|
|
1730
|
-
if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset,
|
|
1730
|
+
if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, interlace.type === "x" ? width : height))) interlace.type === "x" ? interlaceX = true : interlaceY = true;
|
|
1731
1731
|
const canvas = Platform.origin.createCanvas(interlaceY ? realWidth * 2 : realWidth, interlaceX ? realHeight * 2 : realHeight);
|
|
1732
1732
|
const ctx = canvas.getContext("2d");
|
|
1733
1733
|
if (opacity) ctx.globalAlpha = opacity;
|
|
@@ -3317,10 +3317,10 @@ const PathCommandDataHelper = {
|
|
|
3317
3317
|
data.push(O$2, x, y, radius, startAngle, endAngle, anticlockwise ? 1 : 0);
|
|
3318
3318
|
}
|
|
3319
3319
|
},
|
|
3320
|
-
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3320
|
+
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
|
|
3321
3321
|
if (!isUndefined(lastX)) {
|
|
3322
|
-
const
|
|
3323
|
-
radius = min(radius, min(
|
|
3322
|
+
const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
|
|
3323
|
+
radius = min(radius, min(r, r * abs$2(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3324
3324
|
}
|
|
3325
3325
|
data.push(U$2, x1, y1, x2, y2, radius);
|
|
3326
3326
|
},
|
|
@@ -3664,7 +3664,7 @@ const PathCorner = {
|
|
|
3664
3664
|
let command, lastCommand, commandLen;
|
|
3665
3665
|
let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
|
|
3666
3666
|
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
3667
|
-
const len = data.length;
|
|
3667
|
+
const len = data.length, three = len === 9;
|
|
3668
3668
|
const smooth = [];
|
|
3669
3669
|
while (i < len) {
|
|
3670
3670
|
command = data[i];
|
|
@@ -3676,7 +3676,7 @@ const PathCorner = {
|
|
|
3676
3676
|
if (data[i] === L$1) {
|
|
3677
3677
|
secondX = data[i + 1];
|
|
3678
3678
|
secondY = data[i + 2];
|
|
3679
|
-
smooth.push(M, getCenterX(startX, secondX), getCenterY(startY, secondY));
|
|
3679
|
+
three ? smooth.push(M, startX, startY) : smooth.push(M, getCenterX(startX, secondX), getCenterY(startY, secondY));
|
|
3680
3680
|
} else {
|
|
3681
3681
|
smooth.push(M, startX, startY);
|
|
3682
3682
|
}
|
|
@@ -3688,11 +3688,11 @@ const PathCorner = {
|
|
|
3688
3688
|
i += 3;
|
|
3689
3689
|
switch (data[i]) {
|
|
3690
3690
|
case L$1:
|
|
3691
|
-
arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY);
|
|
3691
|
+
arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY, three);
|
|
3692
3692
|
break;
|
|
3693
3693
|
|
|
3694
3694
|
case Z:
|
|
3695
|
-
arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY);
|
|
3695
|
+
arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
|
|
3696
3696
|
break;
|
|
3697
3697
|
|
|
3698
3698
|
default:
|
|
@@ -3704,7 +3704,7 @@ const PathCorner = {
|
|
|
3704
3704
|
|
|
3705
3705
|
case Z:
|
|
3706
3706
|
if (lastCommand !== Z) {
|
|
3707
|
-
arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
|
|
3707
|
+
arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY, three);
|
|
3708
3708
|
smooth.push(Z);
|
|
3709
3709
|
}
|
|
3710
3710
|
i += 1;
|
|
@@ -6979,7 +6979,7 @@ class LeafLevelList {
|
|
|
6979
6979
|
}
|
|
6980
6980
|
}
|
|
6981
6981
|
|
|
6982
|
-
const version = "2.0.
|
|
6982
|
+
const version = "2.0.1";
|
|
6983
6983
|
|
|
6984
6984
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6985
6985
|
get allowBackgroundColor() {
|
|
@@ -7946,16 +7946,16 @@ class UIData extends LeafData {
|
|
|
7946
7946
|
return t.fill || t.stroke;
|
|
7947
7947
|
}
|
|
7948
7948
|
get __autoWidth() {
|
|
7949
|
-
return
|
|
7949
|
+
return this._width == null;
|
|
7950
7950
|
}
|
|
7951
7951
|
get __autoHeight() {
|
|
7952
|
-
return
|
|
7952
|
+
return this._height == null;
|
|
7953
7953
|
}
|
|
7954
7954
|
get __autoSide() {
|
|
7955
|
-
return
|
|
7955
|
+
return this._width == null || this._height == null;
|
|
7956
7956
|
}
|
|
7957
7957
|
get __autoSize() {
|
|
7958
|
-
return
|
|
7958
|
+
return this._width == null && this._height == null;
|
|
7959
7959
|
}
|
|
7960
7960
|
setVisible(value) {
|
|
7961
7961
|
this._visible = value;
|
|
@@ -11174,7 +11174,7 @@ function layoutText(drawData, style) {
|
|
|
11174
11174
|
let {x: x, y: y, width: width, height: height} = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
11175
11175
|
let starY = __baseLine;
|
|
11176
11176
|
if (__clipText && realHeight > height) {
|
|
11177
|
-
realHeight = Math.max(height, __lineHeight);
|
|
11177
|
+
realHeight = Math.max(style.__autoHeight ? realHeight : height, __lineHeight);
|
|
11178
11178
|
if (countRows > 1) drawData.overflow = countRows;
|
|
11179
11179
|
} else if (height || autoSizeAlign) {
|
|
11180
11180
|
switch (verticalAlign) {
|
|
@@ -11231,10 +11231,10 @@ function layoutText(drawData, style) {
|
|
|
11231
11231
|
}
|
|
11232
11232
|
|
|
11233
11233
|
function clipText(drawData, style, x, width) {
|
|
11234
|
-
if (!width) return;
|
|
11235
11234
|
const {rows: rows, overflow: overflow} = drawData;
|
|
11236
11235
|
let {textOverflow: textOverflow} = style;
|
|
11237
|
-
rows.splice(overflow);
|
|
11236
|
+
if (overflow) rows.splice(overflow);
|
|
11237
|
+
if (!width) return;
|
|
11238
11238
|
if (textOverflow && textOverflow !== "show") {
|
|
11239
11239
|
if (textOverflow === "hide") textOverflow = ""; else if (textOverflow === "ellipsis") textOverflow = "...";
|
|
11240
11240
|
let char, charRight;
|