@leafer-ui/miniapp 2.1.10 → 2.2.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/miniapp.cjs +9 -4
- package/dist/miniapp.esm.js +22 -17
- 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 +30 -13
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +10 -10
package/dist/miniapp.module.js
CHANGED
|
@@ -817,6 +817,11 @@ const PointHelper = {
|
|
|
817
817
|
toOuterOf(t, matrix, to) {
|
|
818
818
|
toOuterPoint$3(matrix, t, to);
|
|
819
819
|
},
|
|
820
|
+
toVertical(t, rotation, verticalDistance, to) {
|
|
821
|
+
const r = rotation * OneRadian;
|
|
822
|
+
t.x += -Math.sin(r) * verticalDistance;
|
|
823
|
+
t.y += Math.cos(r) * verticalDistance;
|
|
824
|
+
},
|
|
820
825
|
getCenter(t, to) {
|
|
821
826
|
return {
|
|
822
827
|
x: t.x + (to.x - t.x) / 2,
|
|
@@ -1256,7 +1261,6 @@ const BoundsHelper = {
|
|
|
1256
1261
|
},
|
|
1257
1262
|
copyAndSpread(t, bounds, spread, isShrink, side) {
|
|
1258
1263
|
const {x: x, y: y, width: width, height: height} = bounds;
|
|
1259
|
-
if (!spread) spread = 0;
|
|
1260
1264
|
if (isArray(spread)) {
|
|
1261
1265
|
const four = fourNumber(spread);
|
|
1262
1266
|
isShrink ? B.set(t, x + four[3], y + four[0], width - four[1] - four[3], height - four[2] - four[0]) : B.set(t, x - four[3], y - four[0], width + four[1] + four[3], height + four[2] + four[0]);
|
|
@@ -3577,7 +3581,8 @@ const PathDrawer = {
|
|
|
3577
3581
|
return;
|
|
3578
3582
|
}
|
|
3579
3583
|
}
|
|
3580
|
-
}
|
|
3584
|
+
},
|
|
3585
|
+
drawPathByPoints(_drawer, _points, _closed) {}
|
|
3581
3586
|
};
|
|
3582
3587
|
|
|
3583
3588
|
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;
|
|
@@ -6985,7 +6990,7 @@ class LeafLevelList {
|
|
|
6985
6990
|
}
|
|
6986
6991
|
}
|
|
6987
6992
|
|
|
6988
|
-
const version = "2.
|
|
6993
|
+
const version = "2.2.0";
|
|
6989
6994
|
|
|
6990
6995
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6991
6996
|
get allowBackgroundColor() {
|
|
@@ -8688,8 +8693,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8688
8693
|
this.__drawPathByData(canvas, data.__pathForRender);
|
|
8689
8694
|
}
|
|
8690
8695
|
__drawPath(canvas) {
|
|
8696
|
+
const data = this.__;
|
|
8691
8697
|
canvas.beginPath();
|
|
8692
|
-
this.__drawPathByData(canvas,
|
|
8698
|
+
data.__usePointsMode ? PathDrawer.drawPathByPoints(canvas, data.points, data.closed) : this.__drawPathByData(canvas, data.path, true);
|
|
8693
8699
|
}
|
|
8694
8700
|
__drawPathByData(drawer, data, ignoreCornerRadius) {
|
|
8695
8701
|
data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer, ignoreCornerRadius);
|
|
@@ -9546,6 +9552,9 @@ let Polygon = class Polygon extends UI {
|
|
|
9546
9552
|
get __tag() {
|
|
9547
9553
|
return "Polygon";
|
|
9548
9554
|
}
|
|
9555
|
+
get isPointsMode() {
|
|
9556
|
+
return this.points && !this.pathInputed;
|
|
9557
|
+
}
|
|
9549
9558
|
__updatePath() {
|
|
9550
9559
|
const data = this.__;
|
|
9551
9560
|
const path = data.path = [];
|
|
@@ -9623,6 +9632,9 @@ let Line = class Line extends UI {
|
|
|
9623
9632
|
get __tag() {
|
|
9624
9633
|
return "Line";
|
|
9625
9634
|
}
|
|
9635
|
+
get isPointsMode() {
|
|
9636
|
+
return this.points && !this.pathInputed;
|
|
9637
|
+
}
|
|
9626
9638
|
get toPoint() {
|
|
9627
9639
|
const {width: width, rotation: rotation} = this.__;
|
|
9628
9640
|
const to = getPointData();
|
|
@@ -9781,7 +9793,7 @@ let Text = class Text extends UI {
|
|
|
9781
9793
|
data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
|
|
9782
9794
|
stintSet$1(data, "__padding", padding && MathHelper.fourNumber(padding));
|
|
9783
9795
|
stintSet$1(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
|
|
9784
|
-
stintSet$1(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
|
|
9796
|
+
stintSet$1(data, "__isCharMode", width || height || data.__letterSpacing || data.motionText || textCase !== "none");
|
|
9785
9797
|
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
|
|
9786
9798
|
}
|
|
9787
9799
|
__updateBoxBounds() {
|
|
@@ -9806,7 +9818,7 @@ let Text = class Text extends UI {
|
|
|
9806
9818
|
this.__updateNaturalSize();
|
|
9807
9819
|
} else super.__updateBoxBounds();
|
|
9808
9820
|
if (italic) b.width += fontSize * .16;
|
|
9809
|
-
DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
|
|
9821
|
+
DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds) && !data.motionText);
|
|
9810
9822
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
9811
9823
|
}
|
|
9812
9824
|
__updateRenderSpread() {
|
|
@@ -11409,8 +11421,10 @@ ui$1.__hit = function(inner, forceHitFill) {
|
|
|
11409
11421
|
if (!needHitFillPath && !needHitStrokePath) return false;
|
|
11410
11422
|
const radiusWidth = inner.radiusX * 2;
|
|
11411
11423
|
let hitWidth = radiusWidth;
|
|
11424
|
+
let {strokeAlign: strokeAlign} = data;
|
|
11425
|
+
if (data.motionText) hitWidth += data.fontSize / 2, strokeAlign = "center";
|
|
11412
11426
|
if (needHitStrokePath) {
|
|
11413
|
-
switch (
|
|
11427
|
+
switch (strokeAlign) {
|
|
11414
11428
|
case "inside":
|
|
11415
11429
|
hitWidth += strokeWidth * 2;
|
|
11416
11430
|
if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth)) return true;
|
|
@@ -11444,9 +11458,9 @@ rect.__hitFill = box$1.__hitFill = function(inner) {
|
|
|
11444
11458
|
};
|
|
11445
11459
|
|
|
11446
11460
|
Text.prototype.__drawHitPath = function(canvas) {
|
|
11447
|
-
const {__lineHeight: __lineHeight, fontSize: fontSize, __baseLine: __baseLine, __letterSpacing: __letterSpacing, __textDrawData:
|
|
11461
|
+
const data = this.__, {__lineHeight: __lineHeight, fontSize: fontSize, __baseLine: __baseLine, __letterSpacing: __letterSpacing, __textDrawData: drawData} = data;
|
|
11448
11462
|
canvas.beginPath();
|
|
11449
|
-
if (__letterSpacing < 0) this.__drawPathByBox(canvas); else
|
|
11463
|
+
if (data.motionText) this.__drawPathByData(canvas, data.__pathForMotionText); else if (__letterSpacing < 0) this.__drawPathByBox(canvas); else drawData.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
|
|
11450
11464
|
};
|
|
11451
11465
|
|
|
11452
11466
|
Group.prototype.pick = function(hitPoint, options) {
|
|
@@ -11633,7 +11647,8 @@ function fillPathOrText(ui, canvas, renderOptions) {
|
|
|
11633
11647
|
ui.__.__font ? Paint.fillText(ui, canvas, renderOptions) : ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill();
|
|
11634
11648
|
}
|
|
11635
11649
|
|
|
11636
|
-
function fillText(ui, canvas,
|
|
11650
|
+
function fillText(ui, canvas, renderOptions) {
|
|
11651
|
+
if (ui.motionText) return Paint.fillMotionText(ui, canvas, renderOptions);
|
|
11637
11652
|
const data = ui.__, {rows: rows, decorationY: decorationY} = data.__textDrawData;
|
|
11638
11653
|
if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor;
|
|
11639
11654
|
let row;
|
|
@@ -12995,7 +13010,8 @@ const TextMode = 2;
|
|
|
12995
13010
|
|
|
12996
13011
|
function layoutChar(drawData, style, width, _height) {
|
|
12997
13012
|
const {rows: rows} = drawData;
|
|
12998
|
-
const {textAlign: textAlign, paraIndent: paraIndent
|
|
13013
|
+
const {textAlign: textAlign, paraIndent: paraIndent} = style;
|
|
13014
|
+
const useLetter = style.__letterSpacing || style.motionText;
|
|
12999
13015
|
const justifyLast = width && textAlign.includes("both");
|
|
13000
13016
|
const justify = justifyLast || width && textAlign.includes("justify");
|
|
13001
13017
|
const justifyLetter = justify && textAlign.includes("letter");
|
|
@@ -13008,8 +13024,8 @@ function layoutChar(drawData, style, width, _height) {
|
|
|
13008
13024
|
remainingWidth = width - row.width - indentWidth;
|
|
13009
13025
|
if (justifyLetter) addLetterWidth = remainingWidth / (row.words.reduce((total, item) => total + item.data.length, 0) - 1); else addWordWidth = wordsLength > 1 ? remainingWidth / (wordsLength - 1) : 0;
|
|
13010
13026
|
}
|
|
13011
|
-
mode =
|
|
13012
|
-
if (row.isOverflow && !
|
|
13027
|
+
mode = useLetter || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
|
|
13028
|
+
if (row.isOverflow && !useLetter) row.textMode = true;
|
|
13013
13029
|
if (mode === TextMode) {
|
|
13014
13030
|
row.x += indentWidth;
|
|
13015
13031
|
toTextChar$1(row);
|
|
@@ -13210,6 +13226,7 @@ function getDrawData(content, style) {
|
|
|
13210
13226
|
let width = style.__getInput("width") || 0;
|
|
13211
13227
|
let height = style.__getInput("height") || 0;
|
|
13212
13228
|
const {__padding: padding} = style;
|
|
13229
|
+
if (style.motionText) width = height = 0;
|
|
13213
13230
|
if (padding) {
|
|
13214
13231
|
if (width) x = padding[left], width -= padding[right] + padding[left], !width && (width = .01); else if (!style.autoSizeAlign) x = padding[left];
|
|
13215
13232
|
if (height) y = padding[top], height -= padding[top] + padding[bottom], !height && (height = .01); else if (!style.autoSizeAlign) y = padding[top];
|