@leafer-ui/node 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/node.cjs CHANGED
@@ -2058,11 +2058,11 @@ const TextMode = 2;
2058
2058
  function layoutChar(drawData, style, width, _height) {
2059
2059
  const { rows } = drawData;
2060
2060
  const { textAlign, paraIndent, letterSpacing } = style;
2061
- let charX, addWordWidth, indentWidth, mode, wordChar;
2061
+ let charX, addWordWidth, indentWidth, mode, wordChar, wordsLength;
2062
2062
  rows.forEach(row => {
2063
2063
  if (row.words) {
2064
- indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
2065
- addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
2064
+ indentWidth = paraIndent && row.paraStart ? paraIndent : 0, wordsLength = row.words.length;
2065
+ addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && wordsLength > 1) ? (width - row.width - indentWidth) / (wordsLength - 1) : 0;
2066
2066
  mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
2067
2067
  if (row.isOverflow && !letterSpacing)
2068
2068
  row.textMode = true;
@@ -2074,7 +2074,7 @@ function layoutChar(drawData, style, width, _height) {
2074
2074
  row.x += indentWidth;
2075
2075
  charX = row.x;
2076
2076
  row.data = [];
2077
- row.words.forEach(word => {
2077
+ row.words.forEach((word, index) => {
2078
2078
  if (mode === WordMode) {
2079
2079
  wordChar = { char: '', x: charX };
2080
2080
  charX = toWordChar(word.data, charX, wordChar);
@@ -2084,7 +2084,7 @@ function layoutChar(drawData, style, width, _height) {
2084
2084
  else {
2085
2085
  charX = toChar(word.data, charX, row.data, row.isOverflow);
2086
2086
  }
2087
- if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
2087
+ if (addWordWidth && (!row.paraEnd || textAlign === 'both') && (index !== wordsLength - 1)) {
2088
2088
  charX += addWordWidth;
2089
2089
  row.width += addWordWidth;
2090
2090
  }
@@ -2558,3 +2558,4 @@ Object.keys(core$1).forEach(function (k) {
2558
2558
  get: function () { return core$1[k]; }
2559
2559
  });
2560
2560
  });
2561
+ //# sourceMappingURL=node.cjs.map