@leafer-ui/node 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/node.cjs +13 -32
- package/dist/node.esm.js +13 -32
- package/package.json +9 -9
package/dist/node.cjs
CHANGED
|
@@ -966,14 +966,10 @@ function fillText(ui, canvas) {
|
|
|
966
966
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
967
967
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
968
968
|
row = rows[i];
|
|
969
|
-
if (row.text)
|
|
969
|
+
if (row.text)
|
|
970
970
|
canvas.fillText(row.text, row.x, row.y);
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
row.data.forEach(charData => {
|
|
974
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
975
|
-
});
|
|
976
|
-
}
|
|
971
|
+
else if (row.data)
|
|
972
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
977
973
|
if (decorationY)
|
|
978
974
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
979
975
|
}
|
|
@@ -1039,12 +1035,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
1039
1035
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
1040
1036
|
fillText(ui, out);
|
|
1041
1037
|
out.blendMode = 'normal';
|
|
1042
|
-
if (ui.__worldFlipped)
|
|
1038
|
+
if (ui.__worldFlipped)
|
|
1043
1039
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1044
|
-
|
|
1045
|
-
else {
|
|
1040
|
+
else
|
|
1046
1041
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
1047
|
-
}
|
|
1048
1042
|
out.recycle(ui.__nowWorld);
|
|
1049
1043
|
}
|
|
1050
1044
|
function drawTextStroke(ui, canvas) {
|
|
@@ -1052,14 +1046,10 @@ function drawTextStroke(ui, canvas) {
|
|
|
1052
1046
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
1053
1047
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
1054
1048
|
row = rows[i];
|
|
1055
|
-
if (row.text)
|
|
1049
|
+
if (row.text)
|
|
1056
1050
|
canvas.strokeText(row.text, row.x, row.y);
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
row.data.forEach(charData => {
|
|
1060
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
1061
|
-
});
|
|
1062
|
-
}
|
|
1051
|
+
else if (row.data)
|
|
1052
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
1063
1053
|
if (decorationY)
|
|
1064
1054
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
1065
1055
|
}
|
|
@@ -1112,12 +1102,10 @@ function stroke(stroke, ui, canvas) {
|
|
|
1112
1102
|
out.stroke();
|
|
1113
1103
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
1114
1104
|
out.clearWorld(ui.__layout.renderBounds);
|
|
1115
|
-
if (ui.__worldFlipped)
|
|
1105
|
+
if (ui.__worldFlipped)
|
|
1116
1106
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1117
|
-
|
|
1118
|
-
else {
|
|
1107
|
+
else
|
|
1119
1108
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
1120
|
-
}
|
|
1121
1109
|
out.recycle(ui.__nowWorld);
|
|
1122
1110
|
break;
|
|
1123
1111
|
}
|
|
@@ -1152,12 +1140,10 @@ function strokes(strokes, ui, canvas) {
|
|
|
1152
1140
|
drawStrokesStyle(strokes, false, ui, out);
|
|
1153
1141
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
1154
1142
|
out.clearWorld(renderBounds);
|
|
1155
|
-
if (ui.__worldFlipped)
|
|
1143
|
+
if (ui.__worldFlipped)
|
|
1156
1144
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1157
|
-
|
|
1158
|
-
else {
|
|
1145
|
+
else
|
|
1159
1146
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
1160
|
-
}
|
|
1161
1147
|
out.recycle(ui.__nowWorld);
|
|
1162
1148
|
break;
|
|
1163
1149
|
}
|
|
@@ -1221,12 +1207,7 @@ function compute(attrName, ui) {
|
|
|
1221
1207
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
1222
1208
|
if (leafPaints.length && leafPaints[0].image)
|
|
1223
1209
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
1224
|
-
|
|
1225
|
-
data.__pixelFill = hasOpacityPixel;
|
|
1226
|
-
}
|
|
1227
|
-
else {
|
|
1228
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
1229
|
-
}
|
|
1210
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
1230
1211
|
}
|
|
1231
1212
|
function getLeafPaint(attrName, paint, ui) {
|
|
1232
1213
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
package/dist/node.esm.js
CHANGED
|
@@ -967,14 +967,10 @@ function fillText(ui, canvas) {
|
|
|
967
967
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
968
968
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
969
969
|
row = rows[i];
|
|
970
|
-
if (row.text)
|
|
970
|
+
if (row.text)
|
|
971
971
|
canvas.fillText(row.text, row.x, row.y);
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
row.data.forEach(charData => {
|
|
975
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
976
|
-
});
|
|
977
|
-
}
|
|
972
|
+
else if (row.data)
|
|
973
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
978
974
|
if (decorationY)
|
|
979
975
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
980
976
|
}
|
|
@@ -1040,12 +1036,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
1040
1036
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
1041
1037
|
fillText(ui, out);
|
|
1042
1038
|
out.blendMode = 'normal';
|
|
1043
|
-
if (ui.__worldFlipped)
|
|
1039
|
+
if (ui.__worldFlipped)
|
|
1044
1040
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1045
|
-
|
|
1046
|
-
else {
|
|
1041
|
+
else
|
|
1047
1042
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
1048
|
-
}
|
|
1049
1043
|
out.recycle(ui.__nowWorld);
|
|
1050
1044
|
}
|
|
1051
1045
|
function drawTextStroke(ui, canvas) {
|
|
@@ -1053,14 +1047,10 @@ function drawTextStroke(ui, canvas) {
|
|
|
1053
1047
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
1054
1048
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
1055
1049
|
row = rows[i];
|
|
1056
|
-
if (row.text)
|
|
1050
|
+
if (row.text)
|
|
1057
1051
|
canvas.strokeText(row.text, row.x, row.y);
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
row.data.forEach(charData => {
|
|
1061
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
1062
|
-
});
|
|
1063
|
-
}
|
|
1052
|
+
else if (row.data)
|
|
1053
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
1064
1054
|
if (decorationY)
|
|
1065
1055
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
1066
1056
|
}
|
|
@@ -1113,12 +1103,10 @@ function stroke(stroke, ui, canvas) {
|
|
|
1113
1103
|
out.stroke();
|
|
1114
1104
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
1115
1105
|
out.clearWorld(ui.__layout.renderBounds);
|
|
1116
|
-
if (ui.__worldFlipped)
|
|
1106
|
+
if (ui.__worldFlipped)
|
|
1117
1107
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1118
|
-
|
|
1119
|
-
else {
|
|
1108
|
+
else
|
|
1120
1109
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
1121
|
-
}
|
|
1122
1110
|
out.recycle(ui.__nowWorld);
|
|
1123
1111
|
break;
|
|
1124
1112
|
}
|
|
@@ -1153,12 +1141,10 @@ function strokes(strokes, ui, canvas) {
|
|
|
1153
1141
|
drawStrokesStyle(strokes, false, ui, out);
|
|
1154
1142
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
1155
1143
|
out.clearWorld(renderBounds);
|
|
1156
|
-
if (ui.__worldFlipped)
|
|
1144
|
+
if (ui.__worldFlipped)
|
|
1157
1145
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1158
|
-
|
|
1159
|
-
else {
|
|
1146
|
+
else
|
|
1160
1147
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
1161
|
-
}
|
|
1162
1148
|
out.recycle(ui.__nowWorld);
|
|
1163
1149
|
break;
|
|
1164
1150
|
}
|
|
@@ -1222,12 +1208,7 @@ function compute(attrName, ui) {
|
|
|
1222
1208
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
1223
1209
|
if (leafPaints.length && leafPaints[0].image)
|
|
1224
1210
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
1225
|
-
|
|
1226
|
-
data.__pixelFill = hasOpacityPixel;
|
|
1227
|
-
}
|
|
1228
|
-
else {
|
|
1229
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
1230
|
-
}
|
|
1211
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
1231
1212
|
}
|
|
1232
1213
|
function getLeafPaint(attrName, paint, ui) {
|
|
1233
1214
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "@leafer-ui/node",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"leaferjs"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@leafer/core": "1.0.
|
|
36
|
-
"@leafer/node": "1.0.
|
|
37
|
-
"@leafer/partner": "1.0.
|
|
38
|
-
"@leafer/interface": "1.0.
|
|
39
|
-
"@leafer-ui/draw": "1.0.
|
|
40
|
-
"@leafer-ui/core": "1.0.
|
|
41
|
-
"@leafer-ui/partner": "1.0.
|
|
42
|
-
"@leafer-ui/interface": "1.0.
|
|
35
|
+
"@leafer/core": "1.0.8",
|
|
36
|
+
"@leafer/node": "1.0.8",
|
|
37
|
+
"@leafer/partner": "1.0.8",
|
|
38
|
+
"@leafer/interface": "1.0.8",
|
|
39
|
+
"@leafer-ui/draw": "1.0.8",
|
|
40
|
+
"@leafer-ui/core": "1.0.8",
|
|
41
|
+
"@leafer-ui/partner": "1.0.8",
|
|
42
|
+
"@leafer-ui/interface": "1.0.8"
|
|
43
43
|
}
|
|
44
44
|
}
|