leafer-draw 1.0.7 → 1.0.9
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/web.cjs +13 -32
- package/dist/web.esm.js +13 -32
- package/dist/web.js +46 -85
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +46 -85
- package/dist/web.module.min.js +1 -1
- package/package.json +2 -2
package/dist/web.cjs
CHANGED
|
@@ -852,14 +852,10 @@ function fillText(ui, canvas) {
|
|
|
852
852
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
853
853
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
854
854
|
row = rows[i];
|
|
855
|
-
if (row.text)
|
|
855
|
+
if (row.text)
|
|
856
856
|
canvas.fillText(row.text, row.x, row.y);
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
row.data.forEach(charData => {
|
|
860
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
861
|
-
});
|
|
862
|
-
}
|
|
857
|
+
else if (row.data)
|
|
858
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
863
859
|
if (decorationY)
|
|
864
860
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
865
861
|
}
|
|
@@ -925,12 +921,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
925
921
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
926
922
|
fillText(ui, out);
|
|
927
923
|
out.blendMode = 'normal';
|
|
928
|
-
if (ui.__worldFlipped)
|
|
924
|
+
if (ui.__worldFlipped)
|
|
929
925
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
930
|
-
|
|
931
|
-
else {
|
|
926
|
+
else
|
|
932
927
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
933
|
-
}
|
|
934
928
|
out.recycle(ui.__nowWorld);
|
|
935
929
|
}
|
|
936
930
|
function drawTextStroke(ui, canvas) {
|
|
@@ -938,14 +932,10 @@ function drawTextStroke(ui, canvas) {
|
|
|
938
932
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
939
933
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
940
934
|
row = rows[i];
|
|
941
|
-
if (row.text)
|
|
935
|
+
if (row.text)
|
|
942
936
|
canvas.strokeText(row.text, row.x, row.y);
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
row.data.forEach(charData => {
|
|
946
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
947
|
-
});
|
|
948
|
-
}
|
|
937
|
+
else if (row.data)
|
|
938
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
949
939
|
if (decorationY)
|
|
950
940
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
951
941
|
}
|
|
@@ -998,12 +988,10 @@ function stroke(stroke, ui, canvas) {
|
|
|
998
988
|
out.stroke();
|
|
999
989
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
1000
990
|
out.clearWorld(ui.__layout.renderBounds);
|
|
1001
|
-
if (ui.__worldFlipped)
|
|
991
|
+
if (ui.__worldFlipped)
|
|
1002
992
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1003
|
-
|
|
1004
|
-
else {
|
|
993
|
+
else
|
|
1005
994
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
1006
|
-
}
|
|
1007
995
|
out.recycle(ui.__nowWorld);
|
|
1008
996
|
break;
|
|
1009
997
|
}
|
|
@@ -1038,12 +1026,10 @@ function strokes(strokes, ui, canvas) {
|
|
|
1038
1026
|
drawStrokesStyle(strokes, false, ui, out);
|
|
1039
1027
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
1040
1028
|
out.clearWorld(renderBounds);
|
|
1041
|
-
if (ui.__worldFlipped)
|
|
1029
|
+
if (ui.__worldFlipped)
|
|
1042
1030
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1043
|
-
|
|
1044
|
-
else {
|
|
1031
|
+
else
|
|
1045
1032
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
1046
|
-
}
|
|
1047
1033
|
out.recycle(ui.__nowWorld);
|
|
1048
1034
|
break;
|
|
1049
1035
|
}
|
|
@@ -1107,12 +1093,7 @@ function compute(attrName, ui) {
|
|
|
1107
1093
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
1108
1094
|
if (leafPaints.length && leafPaints[0].image)
|
|
1109
1095
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
1110
|
-
|
|
1111
|
-
data.__pixelFill = hasOpacityPixel;
|
|
1112
|
-
}
|
|
1113
|
-
else {
|
|
1114
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
1115
|
-
}
|
|
1096
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
1116
1097
|
}
|
|
1117
1098
|
function getLeafPaint(attrName, paint, ui) {
|
|
1118
1099
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
package/dist/web.esm.js
CHANGED
|
@@ -853,14 +853,10 @@ function fillText(ui, canvas) {
|
|
|
853
853
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
854
854
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
855
855
|
row = rows[i];
|
|
856
|
-
if (row.text)
|
|
856
|
+
if (row.text)
|
|
857
857
|
canvas.fillText(row.text, row.x, row.y);
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
row.data.forEach(charData => {
|
|
861
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
862
|
-
});
|
|
863
|
-
}
|
|
858
|
+
else if (row.data)
|
|
859
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
864
860
|
if (decorationY)
|
|
865
861
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
866
862
|
}
|
|
@@ -926,12 +922,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
926
922
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
927
923
|
fillText(ui, out);
|
|
928
924
|
out.blendMode = 'normal';
|
|
929
|
-
if (ui.__worldFlipped)
|
|
925
|
+
if (ui.__worldFlipped)
|
|
930
926
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
931
|
-
|
|
932
|
-
else {
|
|
927
|
+
else
|
|
933
928
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
934
|
-
}
|
|
935
929
|
out.recycle(ui.__nowWorld);
|
|
936
930
|
}
|
|
937
931
|
function drawTextStroke(ui, canvas) {
|
|
@@ -939,14 +933,10 @@ function drawTextStroke(ui, canvas) {
|
|
|
939
933
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
940
934
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
941
935
|
row = rows[i];
|
|
942
|
-
if (row.text)
|
|
936
|
+
if (row.text)
|
|
943
937
|
canvas.strokeText(row.text, row.x, row.y);
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
row.data.forEach(charData => {
|
|
947
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
948
|
-
});
|
|
949
|
-
}
|
|
938
|
+
else if (row.data)
|
|
939
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
950
940
|
if (decorationY)
|
|
951
941
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
952
942
|
}
|
|
@@ -999,12 +989,10 @@ function stroke(stroke, ui, canvas) {
|
|
|
999
989
|
out.stroke();
|
|
1000
990
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
1001
991
|
out.clearWorld(ui.__layout.renderBounds);
|
|
1002
|
-
if (ui.__worldFlipped)
|
|
992
|
+
if (ui.__worldFlipped)
|
|
1003
993
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1004
|
-
|
|
1005
|
-
else {
|
|
994
|
+
else
|
|
1006
995
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
1007
|
-
}
|
|
1008
996
|
out.recycle(ui.__nowWorld);
|
|
1009
997
|
break;
|
|
1010
998
|
}
|
|
@@ -1039,12 +1027,10 @@ function strokes(strokes, ui, canvas) {
|
|
|
1039
1027
|
drawStrokesStyle(strokes, false, ui, out);
|
|
1040
1028
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
1041
1029
|
out.clearWorld(renderBounds);
|
|
1042
|
-
if (ui.__worldFlipped)
|
|
1030
|
+
if (ui.__worldFlipped)
|
|
1043
1031
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
1044
|
-
|
|
1045
|
-
else {
|
|
1032
|
+
else
|
|
1046
1033
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
1047
|
-
}
|
|
1048
1034
|
out.recycle(ui.__nowWorld);
|
|
1049
1035
|
break;
|
|
1050
1036
|
}
|
|
@@ -1108,12 +1094,7 @@ function compute(attrName, ui) {
|
|
|
1108
1094
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
1109
1095
|
if (leafPaints.length && leafPaints[0].image)
|
|
1110
1096
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
1111
|
-
|
|
1112
|
-
data.__pixelFill = hasOpacityPixel;
|
|
1113
|
-
}
|
|
1114
|
-
else {
|
|
1115
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
1116
|
-
}
|
|
1097
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
1117
1098
|
}
|
|
1118
1099
|
function getLeafPaint(attrName, paint, ui) {
|
|
1119
1100
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
package/dist/web.js
CHANGED
|
@@ -2961,7 +2961,6 @@ var LeaferUI = (function (exports) {
|
|
|
2961
2961
|
set path(value) { this.__path = value; }
|
|
2962
2962
|
get path() { return this.__path; }
|
|
2963
2963
|
constructor(path) {
|
|
2964
|
-
this.clearPath = this.beginPath;
|
|
2965
2964
|
this.set(path);
|
|
2966
2965
|
}
|
|
2967
2966
|
set(path) {
|
|
@@ -3043,6 +3042,9 @@ var LeaferUI = (function (exports) {
|
|
|
3043
3042
|
this.paint();
|
|
3044
3043
|
return this;
|
|
3045
3044
|
}
|
|
3045
|
+
clearPath() {
|
|
3046
|
+
return this.beginPath();
|
|
3047
|
+
}
|
|
3046
3048
|
paint() { }
|
|
3047
3049
|
}
|
|
3048
3050
|
|
|
@@ -3638,6 +3640,8 @@ var LeaferUI = (function (exports) {
|
|
|
3638
3640
|
else {
|
|
3639
3641
|
if (url.includes('.' + format) || url.includes('.' + FileHelper.upperCaseTypeMap[format]))
|
|
3640
3642
|
return true;
|
|
3643
|
+
else if (format === 'png' && !url.includes('.'))
|
|
3644
|
+
return true;
|
|
3641
3645
|
}
|
|
3642
3646
|
return false;
|
|
3643
3647
|
},
|
|
@@ -5641,11 +5645,10 @@ var LeaferUI = (function (exports) {
|
|
|
5641
5645
|
}
|
|
5642
5646
|
destroy() {
|
|
5643
5647
|
if (!this.destroyed) {
|
|
5644
|
-
|
|
5645
|
-
if (parent)
|
|
5648
|
+
if (this.parent)
|
|
5646
5649
|
this.remove();
|
|
5647
5650
|
if (this.children)
|
|
5648
|
-
this.
|
|
5651
|
+
this.clear();
|
|
5649
5652
|
this.__emitLifeEvent(ChildEvent.DESTROY);
|
|
5650
5653
|
this.__.destroy();
|
|
5651
5654
|
this.__layout.destroy();
|
|
@@ -5959,7 +5962,7 @@ var LeaferUI = (function (exports) {
|
|
|
5959
5962
|
}
|
|
5960
5963
|
}
|
|
5961
5964
|
|
|
5962
|
-
const version = "1.0.
|
|
5965
|
+
const version = "1.0.9";
|
|
5963
5966
|
|
|
5964
5967
|
const debug$5 = Debug.get('LeaferCanvas');
|
|
5965
5968
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6860,12 +6863,8 @@ var LeaferUI = (function (exports) {
|
|
|
6860
6863
|
};
|
|
6861
6864
|
const Transition = {
|
|
6862
6865
|
list: {},
|
|
6863
|
-
register(attrName, fn) {
|
|
6864
|
-
|
|
6865
|
-
},
|
|
6866
|
-
get(attrName) {
|
|
6867
|
-
return Transition.list[attrName];
|
|
6868
|
-
}
|
|
6866
|
+
register(attrName, fn) { Transition.list[attrName] = fn; },
|
|
6867
|
+
get(attrName) { return Transition.list[attrName]; }
|
|
6869
6868
|
};
|
|
6870
6869
|
|
|
6871
6870
|
const { parse, objectToCanvasData } = PathConvert;
|
|
@@ -7311,8 +7310,8 @@ var LeaferUI = (function (exports) {
|
|
|
7311
7310
|
pen.set(path = []), this.__drawPathByBox(pen);
|
|
7312
7311
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
7313
7312
|
}
|
|
7314
|
-
getPathString(curve, pathForRender) {
|
|
7315
|
-
return PathConvert.stringify(this.getPath(curve, pathForRender));
|
|
7313
|
+
getPathString(curve, pathForRender, floatLength) {
|
|
7314
|
+
return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
|
|
7316
7315
|
}
|
|
7317
7316
|
load() {
|
|
7318
7317
|
this.__.__computePaint();
|
|
@@ -7721,11 +7720,11 @@ var LeaferUI = (function (exports) {
|
|
|
7721
7720
|
start() {
|
|
7722
7721
|
clearTimeout(this.__startTimer);
|
|
7723
7722
|
if (!this.running && this.canvas) {
|
|
7723
|
+
this.running = true;
|
|
7724
7724
|
this.ready ? this.emitLeafer(LeaferEvent.RESTART) : this.emitLeafer(LeaferEvent.START);
|
|
7725
7725
|
this.__controllers.forEach(item => item.start());
|
|
7726
7726
|
if (!this.isApp)
|
|
7727
7727
|
this.renderer.render();
|
|
7728
|
-
this.running = true;
|
|
7729
7728
|
}
|
|
7730
7729
|
}
|
|
7731
7730
|
stop() {
|
|
@@ -7831,12 +7830,10 @@ var LeaferUI = (function (exports) {
|
|
|
7831
7830
|
}
|
|
7832
7831
|
__changeFill(newValue) {
|
|
7833
7832
|
this.config.fill = newValue;
|
|
7834
|
-
if (this.canvas.allowBackgroundColor)
|
|
7833
|
+
if (this.canvas.allowBackgroundColor)
|
|
7835
7834
|
this.canvas.backgroundColor = newValue;
|
|
7836
|
-
|
|
7837
|
-
else {
|
|
7835
|
+
else
|
|
7838
7836
|
this.forceRender();
|
|
7839
|
-
}
|
|
7840
7837
|
}
|
|
7841
7838
|
__onCreated() {
|
|
7842
7839
|
this.created = true;
|
|
@@ -7903,13 +7900,10 @@ var LeaferUI = (function (exports) {
|
|
|
7903
7900
|
if (bind)
|
|
7904
7901
|
item = item.bind(bind);
|
|
7905
7902
|
this.__viewCompletedWait.push(item);
|
|
7906
|
-
if (this.viewCompleted)
|
|
7903
|
+
if (this.viewCompleted)
|
|
7907
7904
|
this.__checkViewCompleted(false);
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
if (!this.running)
|
|
7911
|
-
this.start();
|
|
7912
|
-
}
|
|
7905
|
+
else if (!this.running)
|
|
7906
|
+
this.start();
|
|
7913
7907
|
}
|
|
7914
7908
|
nextRender(item, bind, off) {
|
|
7915
7909
|
if (bind)
|
|
@@ -7923,9 +7917,8 @@ var LeaferUI = (function (exports) {
|
|
|
7923
7917
|
}
|
|
7924
7918
|
}
|
|
7925
7919
|
}
|
|
7926
|
-
else
|
|
7920
|
+
else
|
|
7927
7921
|
list.push(item);
|
|
7928
|
-
}
|
|
7929
7922
|
}
|
|
7930
7923
|
zoom(_zoomType, _padding, _fixedScale) {
|
|
7931
7924
|
return needPlugin('view');
|
|
@@ -7969,10 +7962,7 @@ var LeaferUI = (function (exports) {
|
|
|
7969
7962
|
this.stop();
|
|
7970
7963
|
this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
|
|
7971
7964
|
this.__removeListenEvents();
|
|
7972
|
-
this.__controllers.forEach(item =>
|
|
7973
|
-
if (!(this.parent && item === this.interaction))
|
|
7974
|
-
item.destroy();
|
|
7975
|
-
});
|
|
7965
|
+
this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
|
|
7976
7966
|
this.__controllers.length = 0;
|
|
7977
7967
|
if (!this.parent) {
|
|
7978
7968
|
if (this.selector)
|
|
@@ -8505,20 +8495,19 @@ var LeaferUI = (function (exports) {
|
|
|
8505
8495
|
}
|
|
8506
8496
|
__updateTextDrawData() {
|
|
8507
8497
|
const data = this.__;
|
|
8508
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8509
|
-
}
|
|
8510
|
-
__updateBoxBounds() {
|
|
8511
|
-
const data = this.__;
|
|
8512
|
-
const layout = this.__layout;
|
|
8513
8498
|
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
|
|
8514
|
-
const autoWidth = data.__autoWidth;
|
|
8515
|
-
const autoHeight = data.__autoHeight;
|
|
8516
8499
|
data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
|
|
8517
8500
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
8518
8501
|
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
|
|
8519
8502
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8520
8503
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8521
8504
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8505
|
+
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8506
|
+
}
|
|
8507
|
+
__updateBoxBounds() {
|
|
8508
|
+
const data = this.__;
|
|
8509
|
+
const layout = this.__layout;
|
|
8510
|
+
const { fontSize, italic, padding, __autoWidth: autoWidth, __autoHeight: autoHeight } = data;
|
|
8522
8511
|
this.__updateTextDrawData();
|
|
8523
8512
|
const { bounds } = data.__textDrawData;
|
|
8524
8513
|
const b = layout.boxBounds;
|
|
@@ -8531,20 +8520,15 @@ var LeaferUI = (function (exports) {
|
|
|
8531
8520
|
b.height = autoHeight ? bounds.height : data.height;
|
|
8532
8521
|
if (padding) {
|
|
8533
8522
|
const [top, right, bottom, left] = data.__padding;
|
|
8534
|
-
if (autoWidth)
|
|
8535
|
-
b.x -= left;
|
|
8536
|
-
|
|
8537
|
-
|
|
8538
|
-
if (autoHeight) {
|
|
8539
|
-
b.y -= top;
|
|
8540
|
-
b.height += (bottom + top);
|
|
8541
|
-
}
|
|
8523
|
+
if (autoWidth)
|
|
8524
|
+
b.x -= left, b.width += (right + left);
|
|
8525
|
+
if (autoHeight)
|
|
8526
|
+
b.y -= top, b.height += (bottom + top);
|
|
8542
8527
|
}
|
|
8543
8528
|
this.__updateNaturalSize();
|
|
8544
8529
|
}
|
|
8545
|
-
else
|
|
8530
|
+
else
|
|
8546
8531
|
super.__updateBoxBounds();
|
|
8547
|
-
}
|
|
8548
8532
|
if (italic)
|
|
8549
8533
|
b.width += fontSize * 0.16;
|
|
8550
8534
|
const contentBounds = includes(b, bounds) ? b : bounds;
|
|
@@ -8667,11 +8651,7 @@ var LeaferUI = (function (exports) {
|
|
|
8667
8651
|
this.add(path);
|
|
8668
8652
|
return this;
|
|
8669
8653
|
}
|
|
8670
|
-
beginPath() {
|
|
8671
|
-
this.__path.length = 0;
|
|
8672
|
-
this.paint();
|
|
8673
|
-
return this;
|
|
8674
|
-
}
|
|
8654
|
+
beginPath() { return this; }
|
|
8675
8655
|
moveTo(_x, _y) { return this; }
|
|
8676
8656
|
lineTo(_x, _y) { return this; }
|
|
8677
8657
|
bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) { return this; }
|
|
@@ -8698,7 +8678,7 @@ var LeaferUI = (function (exports) {
|
|
|
8698
8678
|
penPathType()
|
|
8699
8679
|
], exports.Pen.prototype, "path", void 0);
|
|
8700
8680
|
exports.Pen = __decorate([
|
|
8701
|
-
useModule(PathCreator, ['set', '
|
|
8681
|
+
useModule(PathCreator, ['set', 'path', 'paint']),
|
|
8702
8682
|
registerUI()
|
|
8703
8683
|
], exports.Pen);
|
|
8704
8684
|
function penPathType() {
|
|
@@ -8714,14 +8694,10 @@ var LeaferUI = (function (exports) {
|
|
|
8714
8694
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
8715
8695
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
8716
8696
|
row = rows[i];
|
|
8717
|
-
if (row.text)
|
|
8697
|
+
if (row.text)
|
|
8718
8698
|
canvas.fillText(row.text, row.x, row.y);
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
row.data.forEach(charData => {
|
|
8722
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
8723
|
-
});
|
|
8724
|
-
}
|
|
8699
|
+
else if (row.data)
|
|
8700
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
8725
8701
|
if (decorationY)
|
|
8726
8702
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
8727
8703
|
}
|
|
@@ -8787,12 +8763,10 @@ var LeaferUI = (function (exports) {
|
|
|
8787
8763
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
8788
8764
|
fillText(ui, out);
|
|
8789
8765
|
out.blendMode = 'normal';
|
|
8790
|
-
if (ui.__worldFlipped)
|
|
8766
|
+
if (ui.__worldFlipped)
|
|
8791
8767
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
8792
|
-
|
|
8793
|
-
else {
|
|
8768
|
+
else
|
|
8794
8769
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
8795
|
-
}
|
|
8796
8770
|
out.recycle(ui.__nowWorld);
|
|
8797
8771
|
}
|
|
8798
8772
|
function drawTextStroke(ui, canvas) {
|
|
@@ -8800,14 +8774,10 @@ var LeaferUI = (function (exports) {
|
|
|
8800
8774
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
8801
8775
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
8802
8776
|
row = rows[i];
|
|
8803
|
-
if (row.text)
|
|
8777
|
+
if (row.text)
|
|
8804
8778
|
canvas.strokeText(row.text, row.x, row.y);
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
row.data.forEach(charData => {
|
|
8808
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
8809
|
-
});
|
|
8810
|
-
}
|
|
8779
|
+
else if (row.data)
|
|
8780
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
8811
8781
|
if (decorationY)
|
|
8812
8782
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
8813
8783
|
}
|
|
@@ -8860,12 +8830,10 @@ var LeaferUI = (function (exports) {
|
|
|
8860
8830
|
out.stroke();
|
|
8861
8831
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
8862
8832
|
out.clearWorld(ui.__layout.renderBounds);
|
|
8863
|
-
if (ui.__worldFlipped)
|
|
8833
|
+
if (ui.__worldFlipped)
|
|
8864
8834
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
8865
|
-
|
|
8866
|
-
else {
|
|
8835
|
+
else
|
|
8867
8836
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
8868
|
-
}
|
|
8869
8837
|
out.recycle(ui.__nowWorld);
|
|
8870
8838
|
break;
|
|
8871
8839
|
}
|
|
@@ -8900,12 +8868,10 @@ var LeaferUI = (function (exports) {
|
|
|
8900
8868
|
drawStrokesStyle(strokes, false, ui, out);
|
|
8901
8869
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
8902
8870
|
out.clearWorld(renderBounds);
|
|
8903
|
-
if (ui.__worldFlipped)
|
|
8871
|
+
if (ui.__worldFlipped)
|
|
8904
8872
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
8905
|
-
|
|
8906
|
-
else {
|
|
8873
|
+
else
|
|
8907
8874
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
8908
|
-
}
|
|
8909
8875
|
out.recycle(ui.__nowWorld);
|
|
8910
8876
|
break;
|
|
8911
8877
|
}
|
|
@@ -8969,12 +8935,7 @@ var LeaferUI = (function (exports) {
|
|
|
8969
8935
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
8970
8936
|
if (leafPaints.length && leafPaints[0].image)
|
|
8971
8937
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
8972
|
-
|
|
8973
|
-
data.__pixelFill = hasOpacityPixel;
|
|
8974
|
-
}
|
|
8975
|
-
else {
|
|
8976
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
8977
|
-
}
|
|
8938
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
8978
8939
|
}
|
|
8979
8940
|
function getLeafPaint(attrName, paint, ui) {
|
|
8980
8941
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|