@leafer-ui/worker 1.0.7 → 1.0.8

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/worker.cjs CHANGED
@@ -953,14 +953,10 @@ function fillText(ui, canvas) {
953
953
  const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
954
954
  for (let i = 0, len = rows.length; i < len; i++) {
955
955
  row = rows[i];
956
- if (row.text) {
956
+ if (row.text)
957
957
  canvas.fillText(row.text, row.x, row.y);
958
- }
959
- else if (row.data) {
960
- row.data.forEach(charData => {
961
- canvas.fillText(charData.char, charData.x, row.y);
962
- });
963
- }
958
+ else if (row.data)
959
+ row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
964
960
  if (decorationY)
965
961
  canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
966
962
  }
@@ -1026,12 +1022,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
1026
1022
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
1027
1023
  fillText(ui, out);
1028
1024
  out.blendMode = 'normal';
1029
- if (ui.__worldFlipped) {
1025
+ if (ui.__worldFlipped)
1030
1026
  canvas.copyWorldByReset(out, ui.__nowWorld);
1031
- }
1032
- else {
1027
+ else
1033
1028
  canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
1034
- }
1035
1029
  out.recycle(ui.__nowWorld);
1036
1030
  }
1037
1031
  function drawTextStroke(ui, canvas) {
@@ -1039,14 +1033,10 @@ function drawTextStroke(ui, canvas) {
1039
1033
  const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
1040
1034
  for (let i = 0, len = rows.length; i < len; i++) {
1041
1035
  row = rows[i];
1042
- if (row.text) {
1036
+ if (row.text)
1043
1037
  canvas.strokeText(row.text, row.x, row.y);
1044
- }
1045
- else if (row.data) {
1046
- row.data.forEach(charData => {
1047
- canvas.strokeText(charData.char, charData.x, row.y);
1048
- });
1049
- }
1038
+ else if (row.data)
1039
+ row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
1050
1040
  if (decorationY)
1051
1041
  canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
1052
1042
  }
@@ -1099,12 +1089,10 @@ function stroke(stroke, ui, canvas) {
1099
1089
  out.stroke();
1100
1090
  options.windingRule ? out.clip(options.windingRule) : out.clip();
1101
1091
  out.clearWorld(ui.__layout.renderBounds);
1102
- if (ui.__worldFlipped) {
1092
+ if (ui.__worldFlipped)
1103
1093
  canvas.copyWorldByReset(out, ui.__nowWorld);
1104
- }
1105
- else {
1094
+ else
1106
1095
  canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
1107
- }
1108
1096
  out.recycle(ui.__nowWorld);
1109
1097
  break;
1110
1098
  }
@@ -1139,12 +1127,10 @@ function strokes(strokes, ui, canvas) {
1139
1127
  drawStrokesStyle(strokes, false, ui, out);
1140
1128
  options.windingRule ? out.clip(options.windingRule) : out.clip();
1141
1129
  out.clearWorld(renderBounds);
1142
- if (ui.__worldFlipped) {
1130
+ if (ui.__worldFlipped)
1143
1131
  canvas.copyWorldByReset(out, ui.__nowWorld);
1144
- }
1145
- else {
1132
+ else
1146
1133
  canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
1147
- }
1148
1134
  out.recycle(ui.__nowWorld);
1149
1135
  break;
1150
1136
  }
@@ -1208,12 +1194,7 @@ function compute(attrName, ui) {
1208
1194
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
1209
1195
  if (leafPaints.length && leafPaints[0].image)
1210
1196
  hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
1211
- if (attrName === 'fill') {
1212
- data.__pixelFill = hasOpacityPixel;
1213
- }
1214
- else {
1215
- data.__pixelStroke = hasOpacityPixel;
1216
- }
1197
+ attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
1217
1198
  }
1218
1199
  function getLeafPaint(attrName, paint, ui) {
1219
1200
  if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
@@ -954,14 +954,10 @@ function fillText(ui, canvas) {
954
954
  const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
955
955
  for (let i = 0, len = rows.length; i < len; i++) {
956
956
  row = rows[i];
957
- if (row.text) {
957
+ if (row.text)
958
958
  canvas.fillText(row.text, row.x, row.y);
959
- }
960
- else if (row.data) {
961
- row.data.forEach(charData => {
962
- canvas.fillText(charData.char, charData.x, row.y);
963
- });
964
- }
959
+ else if (row.data)
960
+ row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
965
961
  if (decorationY)
966
962
  canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
967
963
  }
@@ -1027,12 +1023,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
1027
1023
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
1028
1024
  fillText(ui, out);
1029
1025
  out.blendMode = 'normal';
1030
- if (ui.__worldFlipped) {
1026
+ if (ui.__worldFlipped)
1031
1027
  canvas.copyWorldByReset(out, ui.__nowWorld);
1032
- }
1033
- else {
1028
+ else
1034
1029
  canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
1035
- }
1036
1030
  out.recycle(ui.__nowWorld);
1037
1031
  }
1038
1032
  function drawTextStroke(ui, canvas) {
@@ -1040,14 +1034,10 @@ function drawTextStroke(ui, canvas) {
1040
1034
  const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
1041
1035
  for (let i = 0, len = rows.length; i < len; i++) {
1042
1036
  row = rows[i];
1043
- if (row.text) {
1037
+ if (row.text)
1044
1038
  canvas.strokeText(row.text, row.x, row.y);
1045
- }
1046
- else if (row.data) {
1047
- row.data.forEach(charData => {
1048
- canvas.strokeText(charData.char, charData.x, row.y);
1049
- });
1050
- }
1039
+ else if (row.data)
1040
+ row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
1051
1041
  if (decorationY)
1052
1042
  canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
1053
1043
  }
@@ -1100,12 +1090,10 @@ function stroke(stroke, ui, canvas) {
1100
1090
  out.stroke();
1101
1091
  options.windingRule ? out.clip(options.windingRule) : out.clip();
1102
1092
  out.clearWorld(ui.__layout.renderBounds);
1103
- if (ui.__worldFlipped) {
1093
+ if (ui.__worldFlipped)
1104
1094
  canvas.copyWorldByReset(out, ui.__nowWorld);
1105
- }
1106
- else {
1095
+ else
1107
1096
  canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
1108
- }
1109
1097
  out.recycle(ui.__nowWorld);
1110
1098
  break;
1111
1099
  }
@@ -1140,12 +1128,10 @@ function strokes(strokes, ui, canvas) {
1140
1128
  drawStrokesStyle(strokes, false, ui, out);
1141
1129
  options.windingRule ? out.clip(options.windingRule) : out.clip();
1142
1130
  out.clearWorld(renderBounds);
1143
- if (ui.__worldFlipped) {
1131
+ if (ui.__worldFlipped)
1144
1132
  canvas.copyWorldByReset(out, ui.__nowWorld);
1145
- }
1146
- else {
1133
+ else
1147
1134
  canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
1148
- }
1149
1135
  out.recycle(ui.__nowWorld);
1150
1136
  break;
1151
1137
  }
@@ -1209,12 +1195,7 @@ function compute(attrName, ui) {
1209
1195
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
1210
1196
  if (leafPaints.length && leafPaints[0].image)
1211
1197
  hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
1212
- if (attrName === 'fill') {
1213
- data.__pixelFill = hasOpacityPixel;
1214
- }
1215
- else {
1216
- data.__pixelStroke = hasOpacityPixel;
1217
- }
1198
+ attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
1218
1199
  }
1219
1200
  function getLeafPaint(attrName, paint, ui) {
1220
1201
  if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)