leafer-draw 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/web.cjs +13 -32
- package/dist/web.esm.js +13 -32
- package/dist/web.js +51 -93
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +51 -93
- 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
|
},
|
|
@@ -4429,13 +4433,10 @@ var LeaferUI = (function (exports) {
|
|
|
4429
4433
|
update() {
|
|
4430
4434
|
const { leafer } = this.leaf;
|
|
4431
4435
|
if (leafer) {
|
|
4432
|
-
if (leafer.ready)
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
}
|
|
4436
|
-
else {
|
|
4436
|
+
if (leafer.ready)
|
|
4437
|
+
leafer.watcher.changed && leafer.layouter.layout();
|
|
4438
|
+
else
|
|
4437
4439
|
leafer.start();
|
|
4438
|
-
}
|
|
4439
4440
|
}
|
|
4440
4441
|
else {
|
|
4441
4442
|
let root = this.leaf;
|
|
@@ -5644,11 +5645,10 @@ var LeaferUI = (function (exports) {
|
|
|
5644
5645
|
}
|
|
5645
5646
|
destroy() {
|
|
5646
5647
|
if (!this.destroyed) {
|
|
5647
|
-
|
|
5648
|
-
if (parent)
|
|
5648
|
+
if (this.parent)
|
|
5649
5649
|
this.remove();
|
|
5650
5650
|
if (this.children)
|
|
5651
|
-
this.
|
|
5651
|
+
this.clear();
|
|
5652
5652
|
this.__emitLifeEvent(ChildEvent.DESTROY);
|
|
5653
5653
|
this.__.destroy();
|
|
5654
5654
|
this.__layout.destroy();
|
|
@@ -5962,7 +5962,7 @@ var LeaferUI = (function (exports) {
|
|
|
5962
5962
|
}
|
|
5963
5963
|
}
|
|
5964
5964
|
|
|
5965
|
-
const version = "1.0.
|
|
5965
|
+
const version = "1.0.8";
|
|
5966
5966
|
|
|
5967
5967
|
const debug$5 = Debug.get('LeaferCanvas');
|
|
5968
5968
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6863,12 +6863,8 @@ var LeaferUI = (function (exports) {
|
|
|
6863
6863
|
};
|
|
6864
6864
|
const Transition = {
|
|
6865
6865
|
list: {},
|
|
6866
|
-
register(attrName, fn) {
|
|
6867
|
-
|
|
6868
|
-
},
|
|
6869
|
-
get(attrName) {
|
|
6870
|
-
return Transition.list[attrName];
|
|
6871
|
-
}
|
|
6866
|
+
register(attrName, fn) { Transition.list[attrName] = fn; },
|
|
6867
|
+
get(attrName) { return Transition.list[attrName]; }
|
|
6872
6868
|
};
|
|
6873
6869
|
|
|
6874
6870
|
const { parse, objectToCanvasData } = PathConvert;
|
|
@@ -7314,8 +7310,8 @@ var LeaferUI = (function (exports) {
|
|
|
7314
7310
|
pen.set(path = []), this.__drawPathByBox(pen);
|
|
7315
7311
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
7316
7312
|
}
|
|
7317
|
-
getPathString(curve, pathForRender) {
|
|
7318
|
-
return PathConvert.stringify(this.getPath(curve, pathForRender));
|
|
7313
|
+
getPathString(curve, pathForRender, floatLength) {
|
|
7314
|
+
return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
|
|
7319
7315
|
}
|
|
7320
7316
|
load() {
|
|
7321
7317
|
this.__.__computePaint();
|
|
@@ -7724,11 +7720,11 @@ var LeaferUI = (function (exports) {
|
|
|
7724
7720
|
start() {
|
|
7725
7721
|
clearTimeout(this.__startTimer);
|
|
7726
7722
|
if (!this.running && this.canvas) {
|
|
7723
|
+
this.running = true;
|
|
7727
7724
|
this.ready ? this.emitLeafer(LeaferEvent.RESTART) : this.emitLeafer(LeaferEvent.START);
|
|
7728
7725
|
this.__controllers.forEach(item => item.start());
|
|
7729
7726
|
if (!this.isApp)
|
|
7730
7727
|
this.renderer.render();
|
|
7731
|
-
this.running = true;
|
|
7732
7728
|
}
|
|
7733
7729
|
}
|
|
7734
7730
|
stop() {
|
|
@@ -7834,12 +7830,10 @@ var LeaferUI = (function (exports) {
|
|
|
7834
7830
|
}
|
|
7835
7831
|
__changeFill(newValue) {
|
|
7836
7832
|
this.config.fill = newValue;
|
|
7837
|
-
if (this.canvas.allowBackgroundColor)
|
|
7833
|
+
if (this.canvas.allowBackgroundColor)
|
|
7838
7834
|
this.canvas.backgroundColor = newValue;
|
|
7839
|
-
|
|
7840
|
-
else {
|
|
7835
|
+
else
|
|
7841
7836
|
this.forceRender();
|
|
7842
|
-
}
|
|
7843
7837
|
}
|
|
7844
7838
|
__onCreated() {
|
|
7845
7839
|
this.created = true;
|
|
@@ -7906,13 +7900,10 @@ var LeaferUI = (function (exports) {
|
|
|
7906
7900
|
if (bind)
|
|
7907
7901
|
item = item.bind(bind);
|
|
7908
7902
|
this.__viewCompletedWait.push(item);
|
|
7909
|
-
if (this.viewCompleted)
|
|
7903
|
+
if (this.viewCompleted)
|
|
7910
7904
|
this.__checkViewCompleted(false);
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
if (!this.running)
|
|
7914
|
-
this.start();
|
|
7915
|
-
}
|
|
7905
|
+
else if (!this.running)
|
|
7906
|
+
this.start();
|
|
7916
7907
|
}
|
|
7917
7908
|
nextRender(item, bind, off) {
|
|
7918
7909
|
if (bind)
|
|
@@ -7926,9 +7917,8 @@ var LeaferUI = (function (exports) {
|
|
|
7926
7917
|
}
|
|
7927
7918
|
}
|
|
7928
7919
|
}
|
|
7929
|
-
else
|
|
7920
|
+
else
|
|
7930
7921
|
list.push(item);
|
|
7931
|
-
}
|
|
7932
7922
|
}
|
|
7933
7923
|
zoom(_zoomType, _padding, _fixedScale) {
|
|
7934
7924
|
return needPlugin('view');
|
|
@@ -7972,10 +7962,7 @@ var LeaferUI = (function (exports) {
|
|
|
7972
7962
|
this.stop();
|
|
7973
7963
|
this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
|
|
7974
7964
|
this.__removeListenEvents();
|
|
7975
|
-
this.__controllers.forEach(item =>
|
|
7976
|
-
if (!(this.parent && item === this.interaction))
|
|
7977
|
-
item.destroy();
|
|
7978
|
-
});
|
|
7965
|
+
this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
|
|
7979
7966
|
this.__controllers.length = 0;
|
|
7980
7967
|
if (!this.parent) {
|
|
7981
7968
|
if (this.selector)
|
|
@@ -8508,23 +8495,23 @@ var LeaferUI = (function (exports) {
|
|
|
8508
8495
|
}
|
|
8509
8496
|
__updateTextDrawData() {
|
|
8510
8497
|
const data = this.__;
|
|
8511
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8512
|
-
}
|
|
8513
|
-
__updateBoxBounds() {
|
|
8514
|
-
const data = this.__;
|
|
8515
|
-
const layout = this.__layout;
|
|
8516
8498
|
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
|
|
8517
|
-
const autoWidth = data.__autoWidth;
|
|
8518
|
-
const autoHeight = data.__autoHeight;
|
|
8519
8499
|
data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
|
|
8520
8500
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
8521
8501
|
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
|
|
8522
8502
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8523
8503
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8524
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;
|
|
8525
8511
|
this.__updateTextDrawData();
|
|
8526
8512
|
const { bounds } = data.__textDrawData;
|
|
8527
8513
|
const b = layout.boxBounds;
|
|
8514
|
+
console.log(bounds, autoWidth, autoHeight);
|
|
8528
8515
|
if (data.__lineHeight < fontSize)
|
|
8529
8516
|
spread(bounds, fontSize / 2);
|
|
8530
8517
|
if (autoWidth || autoHeight) {
|
|
@@ -8534,20 +8521,15 @@ var LeaferUI = (function (exports) {
|
|
|
8534
8521
|
b.height = autoHeight ? bounds.height : data.height;
|
|
8535
8522
|
if (padding) {
|
|
8536
8523
|
const [top, right, bottom, left] = data.__padding;
|
|
8537
|
-
if (autoWidth)
|
|
8538
|
-
b.x -= left;
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
if (autoHeight) {
|
|
8542
|
-
b.y -= top;
|
|
8543
|
-
b.height += (bottom + top);
|
|
8544
|
-
}
|
|
8524
|
+
if (autoWidth)
|
|
8525
|
+
b.x -= left, b.width += (right + left);
|
|
8526
|
+
if (autoHeight)
|
|
8527
|
+
b.y -= top, b.height += (bottom + top);
|
|
8545
8528
|
}
|
|
8546
8529
|
this.__updateNaturalSize();
|
|
8547
8530
|
}
|
|
8548
|
-
else
|
|
8531
|
+
else
|
|
8549
8532
|
super.__updateBoxBounds();
|
|
8550
|
-
}
|
|
8551
8533
|
if (italic)
|
|
8552
8534
|
b.width += fontSize * 0.16;
|
|
8553
8535
|
const contentBounds = includes(b, bounds) ? b : bounds;
|
|
@@ -8556,9 +8538,8 @@ var LeaferUI = (function (exports) {
|
|
|
8556
8538
|
layout.renderChanged = true;
|
|
8557
8539
|
setList(data.__textBoxBounds = {}, [b, bounds]);
|
|
8558
8540
|
}
|
|
8559
|
-
else
|
|
8541
|
+
else
|
|
8560
8542
|
data.__textBoxBounds = contentBounds;
|
|
8561
|
-
}
|
|
8562
8543
|
}
|
|
8563
8544
|
__updateRenderSpread() {
|
|
8564
8545
|
let width = super.__updateRenderSpread();
|
|
@@ -8671,11 +8652,7 @@ var LeaferUI = (function (exports) {
|
|
|
8671
8652
|
this.add(path);
|
|
8672
8653
|
return this;
|
|
8673
8654
|
}
|
|
8674
|
-
beginPath() {
|
|
8675
|
-
this.__path.length = 0;
|
|
8676
|
-
this.paint();
|
|
8677
|
-
return this;
|
|
8678
|
-
}
|
|
8655
|
+
beginPath() { return this; }
|
|
8679
8656
|
moveTo(_x, _y) { return this; }
|
|
8680
8657
|
lineTo(_x, _y) { return this; }
|
|
8681
8658
|
bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) { return this; }
|
|
@@ -8702,7 +8679,7 @@ var LeaferUI = (function (exports) {
|
|
|
8702
8679
|
penPathType()
|
|
8703
8680
|
], exports.Pen.prototype, "path", void 0);
|
|
8704
8681
|
exports.Pen = __decorate([
|
|
8705
|
-
useModule(PathCreator, ['set', '
|
|
8682
|
+
useModule(PathCreator, ['set', 'path', 'paint']),
|
|
8706
8683
|
registerUI()
|
|
8707
8684
|
], exports.Pen);
|
|
8708
8685
|
function penPathType() {
|
|
@@ -8718,14 +8695,10 @@ var LeaferUI = (function (exports) {
|
|
|
8718
8695
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
8719
8696
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
8720
8697
|
row = rows[i];
|
|
8721
|
-
if (row.text)
|
|
8698
|
+
if (row.text)
|
|
8722
8699
|
canvas.fillText(row.text, row.x, row.y);
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
row.data.forEach(charData => {
|
|
8726
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
8727
|
-
});
|
|
8728
|
-
}
|
|
8700
|
+
else if (row.data)
|
|
8701
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
8729
8702
|
if (decorationY)
|
|
8730
8703
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
8731
8704
|
}
|
|
@@ -8791,12 +8764,10 @@ var LeaferUI = (function (exports) {
|
|
|
8791
8764
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
8792
8765
|
fillText(ui, out);
|
|
8793
8766
|
out.blendMode = 'normal';
|
|
8794
|
-
if (ui.__worldFlipped)
|
|
8767
|
+
if (ui.__worldFlipped)
|
|
8795
8768
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
8796
|
-
|
|
8797
|
-
else {
|
|
8769
|
+
else
|
|
8798
8770
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
8799
|
-
}
|
|
8800
8771
|
out.recycle(ui.__nowWorld);
|
|
8801
8772
|
}
|
|
8802
8773
|
function drawTextStroke(ui, canvas) {
|
|
@@ -8804,14 +8775,10 @@ var LeaferUI = (function (exports) {
|
|
|
8804
8775
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
8805
8776
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
8806
8777
|
row = rows[i];
|
|
8807
|
-
if (row.text)
|
|
8778
|
+
if (row.text)
|
|
8808
8779
|
canvas.strokeText(row.text, row.x, row.y);
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
row.data.forEach(charData => {
|
|
8812
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
8813
|
-
});
|
|
8814
|
-
}
|
|
8780
|
+
else if (row.data)
|
|
8781
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
8815
8782
|
if (decorationY)
|
|
8816
8783
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
8817
8784
|
}
|
|
@@ -8864,12 +8831,10 @@ var LeaferUI = (function (exports) {
|
|
|
8864
8831
|
out.stroke();
|
|
8865
8832
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
8866
8833
|
out.clearWorld(ui.__layout.renderBounds);
|
|
8867
|
-
if (ui.__worldFlipped)
|
|
8834
|
+
if (ui.__worldFlipped)
|
|
8868
8835
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
8869
|
-
|
|
8870
|
-
else {
|
|
8836
|
+
else
|
|
8871
8837
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
8872
|
-
}
|
|
8873
8838
|
out.recycle(ui.__nowWorld);
|
|
8874
8839
|
break;
|
|
8875
8840
|
}
|
|
@@ -8904,12 +8869,10 @@ var LeaferUI = (function (exports) {
|
|
|
8904
8869
|
drawStrokesStyle(strokes, false, ui, out);
|
|
8905
8870
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
8906
8871
|
out.clearWorld(renderBounds);
|
|
8907
|
-
if (ui.__worldFlipped)
|
|
8872
|
+
if (ui.__worldFlipped)
|
|
8908
8873
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
8909
|
-
|
|
8910
|
-
else {
|
|
8874
|
+
else
|
|
8911
8875
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
8912
|
-
}
|
|
8913
8876
|
out.recycle(ui.__nowWorld);
|
|
8914
8877
|
break;
|
|
8915
8878
|
}
|
|
@@ -8973,12 +8936,7 @@ var LeaferUI = (function (exports) {
|
|
|
8973
8936
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
8974
8937
|
if (leafPaints.length && leafPaints[0].image)
|
|
8975
8938
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
8976
|
-
|
|
8977
|
-
data.__pixelFill = hasOpacityPixel;
|
|
8978
|
-
}
|
|
8979
|
-
else {
|
|
8980
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
8981
|
-
}
|
|
8939
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
8982
8940
|
}
|
|
8983
8941
|
function getLeafPaint(attrName, paint, ui) {
|
|
8984
8942
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|