leafer-draw 1.4.2 → 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/web.cjs +6 -5
- package/dist/web.cjs.map +1 -1
- package/dist/web.esm.js +6 -5
- package/dist/web.esm.js.map +1 -1
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +25 -17
- package/dist/web.js.map +1 -1
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +25 -17
- package/dist/web.module.js.map +1 -1
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +2 -2
package/dist/web.esm.js
CHANGED
|
@@ -2167,13 +2167,14 @@ function toChar(data, charX, rowData, isOverflow) {
|
|
|
2167
2167
|
}
|
|
2168
2168
|
|
|
2169
2169
|
function layoutText(drawData, style) {
|
|
2170
|
-
const { rows, bounds } = drawData;
|
|
2170
|
+
const { rows, bounds } = drawData, countRows = rows.length;
|
|
2171
2171
|
const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
|
|
2172
|
-
let { x, y, width, height } = bounds, realHeight = __lineHeight *
|
|
2172
|
+
let { x, y, width, height } = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
2173
2173
|
let starY = __baseLine;
|
|
2174
2174
|
if (__clipText && realHeight > height) {
|
|
2175
2175
|
realHeight = Math.max(height, __lineHeight);
|
|
2176
|
-
|
|
2176
|
+
if (countRows > 1)
|
|
2177
|
+
drawData.overflow = countRows;
|
|
2177
2178
|
}
|
|
2178
2179
|
else if (height || autoSizeAlign) {
|
|
2179
2180
|
switch (verticalAlign) {
|
|
@@ -2185,7 +2186,7 @@ function layoutText(drawData, style) {
|
|
|
2185
2186
|
}
|
|
2186
2187
|
starY += y;
|
|
2187
2188
|
let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
|
|
2188
|
-
for (let i = 0, len =
|
|
2189
|
+
for (let i = 0, len = countRows; i < len; i++) {
|
|
2189
2190
|
row = rows[i];
|
|
2190
2191
|
row.x = x;
|
|
2191
2192
|
if (row.width < width || (row.width > width && !__clipText)) {
|
|
@@ -2254,7 +2255,7 @@ function clipText(drawData, style, x, width) {
|
|
|
2254
2255
|
if (i === end && charRight < right) {
|
|
2255
2256
|
break;
|
|
2256
2257
|
}
|
|
2257
|
-
else if (charRight < right && char.char !== ' ') {
|
|
2258
|
+
else if ((charRight < right && char.char !== ' ') || !i) {
|
|
2258
2259
|
row.data.splice(i + 1);
|
|
2259
2260
|
row.width -= char.width;
|
|
2260
2261
|
break;
|