@leafer-ui/miniapp 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.
@@ -1081,16 +1081,20 @@ class Interaction extends InteractionBase {
1081
1081
  }
1082
1082
 
1083
1083
  function fillText(ui, canvas) {
1084
- let row;
1085
- const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
1084
+ let row, data = ui.__.__textDrawData;
1085
+ const { rows, decorationY } = data;
1086
1086
  for (let i = 0, len = rows.length; i < len; i++) {
1087
1087
  row = rows[i];
1088
1088
  if (row.text)
1089
1089
  canvas.fillText(row.text, row.x, row.y);
1090
1090
  else if (row.data)
1091
1091
  row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
1092
- if (decorationY)
1093
- canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
1092
+ }
1093
+ if (decorationY) {
1094
+ const { decorationColor, decorationHeight } = data;
1095
+ if (decorationColor)
1096
+ canvas.fillStyle = decorationColor;
1097
+ rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
1094
1098
  }
1095
1099
  }
1096
1100
 
@@ -1161,16 +1165,18 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
1161
1165
  out.recycle(ui.__nowWorld);
1162
1166
  }
1163
1167
  function drawTextStroke(ui, canvas) {
1164
- let row;
1165
- const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
1168
+ let row, data = ui.__.__textDrawData;
1169
+ const { rows, decorationY } = data;
1166
1170
  for (let i = 0, len = rows.length; i < len; i++) {
1167
1171
  row = rows[i];
1168
1172
  if (row.text)
1169
1173
  canvas.strokeText(row.text, row.x, row.y);
1170
1174
  else if (row.data)
1171
1175
  row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
1172
- if (decorationY)
1173
- canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
1176
+ }
1177
+ if (decorationY) {
1178
+ const { decorationHeight } = data;
1179
+ rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
1174
1180
  }
1175
1181
  }
1176
1182
  function drawStrokesStyle(strokes, isText, ui, canvas) {
@@ -1768,6 +1774,8 @@ function recycleImage(attrName, data) {
1768
1774
  }
1769
1775
  image.unload(paints[i].loadId, !input.some((item) => item.url === url));
1770
1776
  }
1777
+ else
1778
+ paints[i].style = null;
1771
1779
  }
1772
1780
  }
1773
1781
  return recycleMap;
@@ -2500,14 +2508,25 @@ function toTextChar(row) {
2500
2508
  }
2501
2509
 
2502
2510
  function decorationText(drawData, style) {
2503
- const { fontSize } = style;
2511
+ let type;
2512
+ const { fontSize, textDecoration } = style;
2504
2513
  drawData.decorationHeight = fontSize / 11;
2505
- switch (style.textDecoration) {
2514
+ if (typeof textDecoration === 'object') {
2515
+ type = textDecoration.type;
2516
+ if (textDecoration.color)
2517
+ drawData.decorationColor = ColorConvert.string(textDecoration.color);
2518
+ }
2519
+ else
2520
+ type = textDecoration;
2521
+ switch (type) {
2506
2522
  case 'under':
2507
- drawData.decorationY = fontSize * 0.15;
2523
+ drawData.decorationY = [fontSize * 0.15];
2508
2524
  break;
2509
2525
  case 'delete':
2510
- drawData.decorationY = -fontSize * 0.35;
2526
+ drawData.decorationY = [-fontSize * 0.35];
2527
+ break;
2528
+ case 'under-delete':
2529
+ drawData.decorationY = [fontSize * 0.15, -fontSize * 0.35];
2511
2530
  }
2512
2531
  }
2513
2532