@leafer-ui/node 1.5.0 → 1.5.2

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.esm.js CHANGED
@@ -850,16 +850,20 @@ Object.assign(Creator, {
850
850
  Platform.layout = Layouter.fullLayout;
851
851
 
852
852
  function fillText(ui, canvas) {
853
- let row;
854
- const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
853
+ let row, data = ui.__.__textDrawData;
854
+ const { rows, decorationY } = data;
855
855
  for (let i = 0, len = rows.length; i < len; i++) {
856
856
  row = rows[i];
857
857
  if (row.text)
858
858
  canvas.fillText(row.text, row.x, row.y);
859
859
  else if (row.data)
860
860
  row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
861
- if (decorationY)
862
- canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
861
+ }
862
+ if (decorationY) {
863
+ const { decorationColor, decorationHeight } = data;
864
+ if (decorationColor)
865
+ canvas.fillStyle = decorationColor;
866
+ rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
863
867
  }
864
868
  }
865
869
 
@@ -930,16 +934,18 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
930
934
  out.recycle(ui.__nowWorld);
931
935
  }
932
936
  function drawTextStroke(ui, canvas) {
933
- let row;
934
- const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
937
+ let row, data = ui.__.__textDrawData;
938
+ const { rows, decorationY } = data;
935
939
  for (let i = 0, len = rows.length; i < len; i++) {
936
940
  row = rows[i];
937
941
  if (row.text)
938
942
  canvas.strokeText(row.text, row.x, row.y);
939
943
  else if (row.data)
940
944
  row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
941
- if (decorationY)
942
- canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
945
+ }
946
+ if (decorationY) {
947
+ const { decorationHeight } = data;
948
+ rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
943
949
  }
944
950
  }
945
951
  function drawStrokesStyle(strokes, isText, ui, canvas) {
@@ -1505,6 +1511,8 @@ function recycleImage(attrName, data) {
1505
1511
  }
1506
1512
  image.unload(paints[i].loadId, !input.some((item) => item.url === url));
1507
1513
  }
1514
+ else
1515
+ paints[i].style = null;
1508
1516
  }
1509
1517
  }
1510
1518
  return recycleMap;
@@ -2237,14 +2245,25 @@ function toTextChar(row) {
2237
2245
  }
2238
2246
 
2239
2247
  function decorationText(drawData, style) {
2240
- const { fontSize } = style;
2248
+ let type;
2249
+ const { fontSize, textDecoration } = style;
2241
2250
  drawData.decorationHeight = fontSize / 11;
2242
- switch (style.textDecoration) {
2251
+ if (typeof textDecoration === 'object') {
2252
+ type = textDecoration.type;
2253
+ if (textDecoration.color)
2254
+ drawData.decorationColor = ColorConvert.string(textDecoration.color);
2255
+ }
2256
+ else
2257
+ type = textDecoration;
2258
+ switch (type) {
2243
2259
  case 'under':
2244
- drawData.decorationY = fontSize * 0.15;
2260
+ drawData.decorationY = [fontSize * 0.15];
2245
2261
  break;
2246
2262
  case 'delete':
2247
- drawData.decorationY = -fontSize * 0.35;
2263
+ drawData.decorationY = [-fontSize * 0.35];
2264
+ break;
2265
+ case 'under-delete':
2266
+ drawData.decorationY = [fontSize * 0.15, -fontSize * 0.35];
2248
2267
  }
2249
2268
  }
2250
2269