@leafer-draw/miniapp 1.4.2 → 1.5.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 +6 -5
- package/dist/miniapp.cjs.map +1 -1
- package/dist/miniapp.esm.js +6 -5
- package/dist/miniapp.esm.js.map +1 -1
- 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 +27 -23
- package/dist/miniapp.module.js.map +1 -1
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +8 -8
package/dist/miniapp.cjs
CHANGED
|
@@ -2124,13 +2124,14 @@ function toChar(data, charX, rowData, isOverflow) {
|
|
|
2124
2124
|
}
|
|
2125
2125
|
|
|
2126
2126
|
function layoutText(drawData, style) {
|
|
2127
|
-
const { rows, bounds } = drawData;
|
|
2127
|
+
const { rows, bounds } = drawData, countRows = rows.length;
|
|
2128
2128
|
const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
|
|
2129
|
-
let { x, y, width, height } = bounds, realHeight = __lineHeight *
|
|
2129
|
+
let { x, y, width, height } = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
2130
2130
|
let starY = __baseLine;
|
|
2131
2131
|
if (__clipText && realHeight > height) {
|
|
2132
2132
|
realHeight = Math.max(height, __lineHeight);
|
|
2133
|
-
|
|
2133
|
+
if (countRows > 1)
|
|
2134
|
+
drawData.overflow = countRows;
|
|
2134
2135
|
}
|
|
2135
2136
|
else if (height || autoSizeAlign) {
|
|
2136
2137
|
switch (verticalAlign) {
|
|
@@ -2142,7 +2143,7 @@ function layoutText(drawData, style) {
|
|
|
2142
2143
|
}
|
|
2143
2144
|
starY += y;
|
|
2144
2145
|
let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
|
|
2145
|
-
for (let i = 0, len =
|
|
2146
|
+
for (let i = 0, len = countRows; i < len; i++) {
|
|
2146
2147
|
row = rows[i];
|
|
2147
2148
|
row.x = x;
|
|
2148
2149
|
if (row.width < width || (row.width > width && !__clipText)) {
|
|
@@ -2211,7 +2212,7 @@ function clipText(drawData, style, x, width) {
|
|
|
2211
2212
|
if (i === end && charRight < right) {
|
|
2212
2213
|
break;
|
|
2213
2214
|
}
|
|
2214
|
-
else if (charRight < right && char.char !== ' ') {
|
|
2215
|
+
else if ((charRight < right && char.char !== ' ') || !i) {
|
|
2215
2216
|
row.data.splice(i + 1);
|
|
2216
2217
|
row.width -= char.width;
|
|
2217
2218
|
break;
|