@leafer-ui/worker 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.
@@ -837,16 +837,20 @@ Object.assign(Creator, {
837
837
  Platform.layout = Layouter.fullLayout;
838
838
 
839
839
  function fillText(ui, canvas) {
840
- let row;
841
- const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
840
+ let row, data = ui.__.__textDrawData;
841
+ const { rows, decorationY } = data;
842
842
  for (let i = 0, len = rows.length; i < len; i++) {
843
843
  row = rows[i];
844
844
  if (row.text)
845
845
  canvas.fillText(row.text, row.x, row.y);
846
846
  else if (row.data)
847
847
  row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
848
- if (decorationY)
849
- canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
848
+ }
849
+ if (decorationY) {
850
+ const { decorationColor, decorationHeight } = data;
851
+ if (decorationColor)
852
+ canvas.fillStyle = decorationColor;
853
+ rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
850
854
  }
851
855
  }
852
856
 
@@ -917,16 +921,18 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
917
921
  out.recycle(ui.__nowWorld);
918
922
  }
919
923
  function drawTextStroke(ui, canvas) {
920
- let row;
921
- const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
924
+ let row, data = ui.__.__textDrawData;
925
+ const { rows, decorationY } = data;
922
926
  for (let i = 0, len = rows.length; i < len; i++) {
923
927
  row = rows[i];
924
928
  if (row.text)
925
929
  canvas.strokeText(row.text, row.x, row.y);
926
930
  else if (row.data)
927
931
  row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
928
- if (decorationY)
929
- canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
932
+ }
933
+ if (decorationY) {
934
+ const { decorationHeight } = data;
935
+ rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
930
936
  }
931
937
  }
932
938
  function drawStrokesStyle(strokes, isText, ui, canvas) {
@@ -1524,6 +1530,8 @@ function recycleImage(attrName, data) {
1524
1530
  }
1525
1531
  image.unload(paints[i].loadId, !input.some((item) => item.url === url));
1526
1532
  }
1533
+ else
1534
+ paints[i].style = null;
1527
1535
  }
1528
1536
  }
1529
1537
  return recycleMap;
@@ -2256,14 +2264,25 @@ function toTextChar(row) {
2256
2264
  }
2257
2265
 
2258
2266
  function decorationText(drawData, style) {
2259
- const { fontSize } = style;
2267
+ let type;
2268
+ const { fontSize, textDecoration } = style;
2260
2269
  drawData.decorationHeight = fontSize / 11;
2261
- switch (style.textDecoration) {
2270
+ if (typeof textDecoration === 'object') {
2271
+ type = textDecoration.type;
2272
+ if (textDecoration.color)
2273
+ drawData.decorationColor = ColorConvert.string(textDecoration.color);
2274
+ }
2275
+ else
2276
+ type = textDecoration;
2277
+ switch (type) {
2262
2278
  case 'under':
2263
- drawData.decorationY = fontSize * 0.15;
2279
+ drawData.decorationY = [fontSize * 0.15];
2264
2280
  break;
2265
2281
  case 'delete':
2266
- drawData.decorationY = -fontSize * 0.35;
2282
+ drawData.decorationY = [-fontSize * 0.35];
2283
+ break;
2284
+ case 'under-delete':
2285
+ drawData.decorationY = [fontSize * 0.15, -fontSize * 0.35];
2267
2286
  }
2268
2287
  }
2269
2288