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