@leafer-ui/node 1.5.1 → 1.5.3

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