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