@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.
@@ -2322,11 +2322,11 @@ const TextMode = 2;
2322
2322
  function layoutChar(drawData, style, width, _height) {
2323
2323
  const { rows } = drawData;
2324
2324
  const { textAlign, paraIndent, letterSpacing } = style;
2325
- let charX, addWordWidth, indentWidth, mode, wordChar;
2325
+ let charX, addWordWidth, indentWidth, mode, wordChar, wordsLength;
2326
2326
  rows.forEach(row => {
2327
2327
  if (row.words) {
2328
- indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
2329
- addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
2328
+ indentWidth = paraIndent && row.paraStart ? paraIndent : 0, wordsLength = row.words.length;
2329
+ addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && wordsLength > 1) ? (width - row.width - indentWidth) / (wordsLength - 1) : 0;
2330
2330
  mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
2331
2331
  if (row.isOverflow && !letterSpacing)
2332
2332
  row.textMode = true;
@@ -2338,7 +2338,7 @@ function layoutChar(drawData, style, width, _height) {
2338
2338
  row.x += indentWidth;
2339
2339
  charX = row.x;
2340
2340
  row.data = [];
2341
- row.words.forEach(word => {
2341
+ row.words.forEach((word, index) => {
2342
2342
  if (mode === WordMode) {
2343
2343
  wordChar = { char: '', x: charX };
2344
2344
  charX = toWordChar(word.data, charX, wordChar);
@@ -2348,7 +2348,7 @@ function layoutChar(drawData, style, width, _height) {
2348
2348
  else {
2349
2349
  charX = toChar(word.data, charX, row.data, row.isOverflow);
2350
2350
  }
2351
- if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
2351
+ if (addWordWidth && (!row.paraEnd || textAlign === 'both') && (index !== wordsLength - 1)) {
2352
2352
  charX += addWordWidth;
2353
2353
  row.width += addWordWidth;
2354
2354
  }
@@ -2636,3 +2636,4 @@ if (platform === 'ios') {
2636
2636
  }
2637
2637
 
2638
2638
  export { Interaction, Layouter, LeaferCanvas, Picker, Renderer, Selector, Watcher, useCanvas };
2639
+ //# sourceMappingURL=miniapp.esm.js.map