@leafer-draw/node 1.0.6 → 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 +6 -6
package/dist/node.cjs
CHANGED
|
@@ -692,14 +692,10 @@ function fillText(ui, canvas) {
|
|
|
692
692
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
693
693
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
694
694
|
row = rows[i];
|
|
695
|
-
if (row.text)
|
|
695
|
+
if (row.text)
|
|
696
696
|
canvas.fillText(row.text, row.x, row.y);
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
row.data.forEach(charData => {
|
|
700
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
701
|
-
});
|
|
702
|
-
}
|
|
697
|
+
else if (row.data)
|
|
698
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
703
699
|
if (decorationY)
|
|
704
700
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
705
701
|
}
|
|
@@ -765,12 +761,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
765
761
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
766
762
|
fillText(ui, out);
|
|
767
763
|
out.blendMode = 'normal';
|
|
768
|
-
if (ui.__worldFlipped)
|
|
764
|
+
if (ui.__worldFlipped)
|
|
769
765
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
770
|
-
|
|
771
|
-
else {
|
|
766
|
+
else
|
|
772
767
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
773
|
-
}
|
|
774
768
|
out.recycle(ui.__nowWorld);
|
|
775
769
|
}
|
|
776
770
|
function drawTextStroke(ui, canvas) {
|
|
@@ -778,14 +772,10 @@ function drawTextStroke(ui, canvas) {
|
|
|
778
772
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
779
773
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
780
774
|
row = rows[i];
|
|
781
|
-
if (row.text)
|
|
775
|
+
if (row.text)
|
|
782
776
|
canvas.strokeText(row.text, row.x, row.y);
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
row.data.forEach(charData => {
|
|
786
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
787
|
-
});
|
|
788
|
-
}
|
|
777
|
+
else if (row.data)
|
|
778
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
789
779
|
if (decorationY)
|
|
790
780
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
791
781
|
}
|
|
@@ -838,12 +828,10 @@ function stroke(stroke, ui, canvas) {
|
|
|
838
828
|
out.stroke();
|
|
839
829
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
840
830
|
out.clearWorld(ui.__layout.renderBounds);
|
|
841
|
-
if (ui.__worldFlipped)
|
|
831
|
+
if (ui.__worldFlipped)
|
|
842
832
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
843
|
-
|
|
844
|
-
else {
|
|
833
|
+
else
|
|
845
834
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
846
|
-
}
|
|
847
835
|
out.recycle(ui.__nowWorld);
|
|
848
836
|
break;
|
|
849
837
|
}
|
|
@@ -878,12 +866,10 @@ function strokes(strokes, ui, canvas) {
|
|
|
878
866
|
drawStrokesStyle(strokes, false, ui, out);
|
|
879
867
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
880
868
|
out.clearWorld(renderBounds);
|
|
881
|
-
if (ui.__worldFlipped)
|
|
869
|
+
if (ui.__worldFlipped)
|
|
882
870
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
883
|
-
|
|
884
|
-
else {
|
|
871
|
+
else
|
|
885
872
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
886
|
-
}
|
|
887
873
|
out.recycle(ui.__nowWorld);
|
|
888
874
|
break;
|
|
889
875
|
}
|
|
@@ -947,12 +933,7 @@ function compute(attrName, ui) {
|
|
|
947
933
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
948
934
|
if (leafPaints.length && leafPaints[0].image)
|
|
949
935
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
950
|
-
|
|
951
|
-
data.__pixelFill = hasOpacityPixel;
|
|
952
|
-
}
|
|
953
|
-
else {
|
|
954
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
955
|
-
}
|
|
936
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
956
937
|
}
|
|
957
938
|
function getLeafPaint(attrName, paint, ui) {
|
|
958
939
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
package/dist/node.esm.js
CHANGED
|
@@ -693,14 +693,10 @@ function fillText(ui, canvas) {
|
|
|
693
693
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
694
694
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
695
695
|
row = rows[i];
|
|
696
|
-
if (row.text)
|
|
696
|
+
if (row.text)
|
|
697
697
|
canvas.fillText(row.text, row.x, row.y);
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
row.data.forEach(charData => {
|
|
701
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
702
|
-
});
|
|
703
|
-
}
|
|
698
|
+
else if (row.data)
|
|
699
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
704
700
|
if (decorationY)
|
|
705
701
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
706
702
|
}
|
|
@@ -766,12 +762,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
766
762
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
767
763
|
fillText(ui, out);
|
|
768
764
|
out.blendMode = 'normal';
|
|
769
|
-
if (ui.__worldFlipped)
|
|
765
|
+
if (ui.__worldFlipped)
|
|
770
766
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
771
|
-
|
|
772
|
-
else {
|
|
767
|
+
else
|
|
773
768
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
774
|
-
}
|
|
775
769
|
out.recycle(ui.__nowWorld);
|
|
776
770
|
}
|
|
777
771
|
function drawTextStroke(ui, canvas) {
|
|
@@ -779,14 +773,10 @@ function drawTextStroke(ui, canvas) {
|
|
|
779
773
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
780
774
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
781
775
|
row = rows[i];
|
|
782
|
-
if (row.text)
|
|
776
|
+
if (row.text)
|
|
783
777
|
canvas.strokeText(row.text, row.x, row.y);
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
row.data.forEach(charData => {
|
|
787
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
788
|
-
});
|
|
789
|
-
}
|
|
778
|
+
else if (row.data)
|
|
779
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
790
780
|
if (decorationY)
|
|
791
781
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
792
782
|
}
|
|
@@ -839,12 +829,10 @@ function stroke(stroke, ui, canvas) {
|
|
|
839
829
|
out.stroke();
|
|
840
830
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
841
831
|
out.clearWorld(ui.__layout.renderBounds);
|
|
842
|
-
if (ui.__worldFlipped)
|
|
832
|
+
if (ui.__worldFlipped)
|
|
843
833
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
844
|
-
|
|
845
|
-
else {
|
|
834
|
+
else
|
|
846
835
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
847
|
-
}
|
|
848
836
|
out.recycle(ui.__nowWorld);
|
|
849
837
|
break;
|
|
850
838
|
}
|
|
@@ -879,12 +867,10 @@ function strokes(strokes, ui, canvas) {
|
|
|
879
867
|
drawStrokesStyle(strokes, false, ui, out);
|
|
880
868
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
881
869
|
out.clearWorld(renderBounds);
|
|
882
|
-
if (ui.__worldFlipped)
|
|
870
|
+
if (ui.__worldFlipped)
|
|
883
871
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
884
|
-
|
|
885
|
-
else {
|
|
872
|
+
else
|
|
886
873
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
887
|
-
}
|
|
888
874
|
out.recycle(ui.__nowWorld);
|
|
889
875
|
break;
|
|
890
876
|
}
|
|
@@ -948,12 +934,7 @@ function compute(attrName, ui) {
|
|
|
948
934
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
949
935
|
if (leafPaints.length && leafPaints[0].image)
|
|
950
936
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
951
|
-
|
|
952
|
-
data.__pixelFill = hasOpacityPixel;
|
|
953
|
-
}
|
|
954
|
-
else {
|
|
955
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
956
|
-
}
|
|
937
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
957
938
|
}
|
|
958
939
|
function getLeafPaint(attrName, paint, ui) {
|
|
959
940
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-draw/node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "@leafer-draw/node",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"leaferjs"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@leafer/node": "1.0.
|
|
37
|
-
"@leafer-draw/partner": "1.0.
|
|
38
|
-
"@leafer-ui/draw": "1.0.
|
|
39
|
-
"@leafer-ui/partner": "1.0.
|
|
40
|
-
"@leafer-ui/interface": "1.0.
|
|
36
|
+
"@leafer/node": "1.0.8",
|
|
37
|
+
"@leafer-draw/partner": "1.0.8",
|
|
38
|
+
"@leafer-ui/draw": "1.0.8",
|
|
39
|
+
"@leafer-ui/partner": "1.0.8",
|
|
40
|
+
"@leafer-ui/interface": "1.0.8"
|
|
41
41
|
}
|
|
42
42
|
}
|