@leafer-draw/worker 1.4.1 → 1.5.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/worker.cjs +6 -5
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.esm.js +6 -5
- package/dist/worker.esm.js.map +1 -1
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +34 -25
- package/dist/worker.js.map +1 -1
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +34 -25
- package/dist/worker.module.js.map +1 -1
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +7 -7
package/dist/worker.esm.js
CHANGED
|
@@ -1986,13 +1986,14 @@ function toChar(data, charX, rowData, isOverflow) {
|
|
|
1986
1986
|
}
|
|
1987
1987
|
|
|
1988
1988
|
function layoutText(drawData, style) {
|
|
1989
|
-
const { rows, bounds } = drawData;
|
|
1989
|
+
const { rows, bounds } = drawData, countRows = rows.length;
|
|
1990
1990
|
const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
|
|
1991
|
-
let { x, y, width, height } = bounds, realHeight = __lineHeight *
|
|
1991
|
+
let { x, y, width, height } = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
1992
1992
|
let starY = __baseLine;
|
|
1993
1993
|
if (__clipText && realHeight > height) {
|
|
1994
1994
|
realHeight = Math.max(height, __lineHeight);
|
|
1995
|
-
|
|
1995
|
+
if (countRows > 1)
|
|
1996
|
+
drawData.overflow = countRows;
|
|
1996
1997
|
}
|
|
1997
1998
|
else if (height || autoSizeAlign) {
|
|
1998
1999
|
switch (verticalAlign) {
|
|
@@ -2004,7 +2005,7 @@ function layoutText(drawData, style) {
|
|
|
2004
2005
|
}
|
|
2005
2006
|
starY += y;
|
|
2006
2007
|
let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
|
|
2007
|
-
for (let i = 0, len =
|
|
2008
|
+
for (let i = 0, len = countRows; i < len; i++) {
|
|
2008
2009
|
row = rows[i];
|
|
2009
2010
|
row.x = x;
|
|
2010
2011
|
if (row.width < width || (row.width > width && !__clipText)) {
|
|
@@ -2073,7 +2074,7 @@ function clipText(drawData, style, x, width) {
|
|
|
2073
2074
|
if (i === end && charRight < right) {
|
|
2074
2075
|
break;
|
|
2075
2076
|
}
|
|
2076
|
-
else if (charRight < right && char.char !== ' ') {
|
|
2077
|
+
else if ((charRight < right && char.char !== ' ') || !i) {
|
|
2077
2078
|
row.data.splice(i + 1);
|
|
2078
2079
|
row.width -= char.width;
|
|
2079
2080
|
break;
|