@leafer-ui/miniapp 1.3.3 → 1.4.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 CHANGED
@@ -2321,11 +2321,11 @@ const TextMode = 2;
2321
2321
  function layoutChar(drawData, style, width, _height) {
2322
2322
  const { rows } = drawData;
2323
2323
  const { textAlign, paraIndent, letterSpacing } = style;
2324
- let charX, addWordWidth, indentWidth, mode, wordChar;
2324
+ let charX, addWordWidth, indentWidth, mode, wordChar, wordsLength;
2325
2325
  rows.forEach(row => {
2326
2326
  if (row.words) {
2327
- indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
2328
- addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
2327
+ indentWidth = paraIndent && row.paraStart ? paraIndent : 0, wordsLength = row.words.length;
2328
+ addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && wordsLength > 1) ? (width - row.width - indentWidth) / (wordsLength - 1) : 0;
2329
2329
  mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
2330
2330
  if (row.isOverflow && !letterSpacing)
2331
2331
  row.textMode = true;
@@ -2337,7 +2337,7 @@ function layoutChar(drawData, style, width, _height) {
2337
2337
  row.x += indentWidth;
2338
2338
  charX = row.x;
2339
2339
  row.data = [];
2340
- row.words.forEach(word => {
2340
+ row.words.forEach((word, index) => {
2341
2341
  if (mode === WordMode) {
2342
2342
  wordChar = { char: '', x: charX };
2343
2343
  charX = toWordChar(word.data, charX, wordChar);
@@ -2347,7 +2347,7 @@ function layoutChar(drawData, style, width, _height) {
2347
2347
  else {
2348
2348
  charX = toChar(word.data, charX, row.data, row.isOverflow);
2349
2349
  }
2350
- if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
2350
+ if (addWordWidth && (!row.paraEnd || textAlign === 'both') && (index !== wordsLength - 1)) {
2351
2351
  charX += addWordWidth;
2352
2352
  row.width += addWordWidth;
2353
2353
  }
@@ -2658,3 +2658,4 @@ Object.keys(core$1).forEach(function (k) {
2658
2658
  get: function () { return core$1[k]; }
2659
2659
  });
2660
2660
  });
2661
+ //# sourceMappingURL=miniapp.cjs.map