@leafer-draw/worker 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/worker.cjs +13 -32
- package/dist/worker.esm.js +13 -32
- package/dist/worker.js +51 -93
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +51 -93
- package/dist/worker.module.min.js +1 -1
- package/package.json +6 -6
package/dist/worker.cjs
CHANGED
|
@@ -679,14 +679,10 @@ function fillText(ui, canvas) {
|
|
|
679
679
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
680
680
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
681
681
|
row = rows[i];
|
|
682
|
-
if (row.text)
|
|
682
|
+
if (row.text)
|
|
683
683
|
canvas.fillText(row.text, row.x, row.y);
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
row.data.forEach(charData => {
|
|
687
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
688
|
-
});
|
|
689
|
-
}
|
|
684
|
+
else if (row.data)
|
|
685
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
690
686
|
if (decorationY)
|
|
691
687
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
692
688
|
}
|
|
@@ -752,12 +748,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
752
748
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
753
749
|
fillText(ui, out);
|
|
754
750
|
out.blendMode = 'normal';
|
|
755
|
-
if (ui.__worldFlipped)
|
|
751
|
+
if (ui.__worldFlipped)
|
|
756
752
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
757
|
-
|
|
758
|
-
else {
|
|
753
|
+
else
|
|
759
754
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
760
|
-
}
|
|
761
755
|
out.recycle(ui.__nowWorld);
|
|
762
756
|
}
|
|
763
757
|
function drawTextStroke(ui, canvas) {
|
|
@@ -765,14 +759,10 @@ function drawTextStroke(ui, canvas) {
|
|
|
765
759
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
766
760
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
767
761
|
row = rows[i];
|
|
768
|
-
if (row.text)
|
|
762
|
+
if (row.text)
|
|
769
763
|
canvas.strokeText(row.text, row.x, row.y);
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
row.data.forEach(charData => {
|
|
773
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
774
|
-
});
|
|
775
|
-
}
|
|
764
|
+
else if (row.data)
|
|
765
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
776
766
|
if (decorationY)
|
|
777
767
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
778
768
|
}
|
|
@@ -825,12 +815,10 @@ function stroke(stroke, ui, canvas) {
|
|
|
825
815
|
out.stroke();
|
|
826
816
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
827
817
|
out.clearWorld(ui.__layout.renderBounds);
|
|
828
|
-
if (ui.__worldFlipped)
|
|
818
|
+
if (ui.__worldFlipped)
|
|
829
819
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
830
|
-
|
|
831
|
-
else {
|
|
820
|
+
else
|
|
832
821
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
833
|
-
}
|
|
834
822
|
out.recycle(ui.__nowWorld);
|
|
835
823
|
break;
|
|
836
824
|
}
|
|
@@ -865,12 +853,10 @@ function strokes(strokes, ui, canvas) {
|
|
|
865
853
|
drawStrokesStyle(strokes, false, ui, out);
|
|
866
854
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
867
855
|
out.clearWorld(renderBounds);
|
|
868
|
-
if (ui.__worldFlipped)
|
|
856
|
+
if (ui.__worldFlipped)
|
|
869
857
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
870
|
-
|
|
871
|
-
else {
|
|
858
|
+
else
|
|
872
859
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
873
|
-
}
|
|
874
860
|
out.recycle(ui.__nowWorld);
|
|
875
861
|
break;
|
|
876
862
|
}
|
|
@@ -934,12 +920,7 @@ function compute(attrName, ui) {
|
|
|
934
920
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
935
921
|
if (leafPaints.length && leafPaints[0].image)
|
|
936
922
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
937
|
-
|
|
938
|
-
data.__pixelFill = hasOpacityPixel;
|
|
939
|
-
}
|
|
940
|
-
else {
|
|
941
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
942
|
-
}
|
|
923
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
943
924
|
}
|
|
944
925
|
function getLeafPaint(attrName, paint, ui) {
|
|
945
926
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
package/dist/worker.esm.js
CHANGED
|
@@ -680,14 +680,10 @@ function fillText(ui, canvas) {
|
|
|
680
680
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
681
681
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
682
682
|
row = rows[i];
|
|
683
|
-
if (row.text)
|
|
683
|
+
if (row.text)
|
|
684
684
|
canvas.fillText(row.text, row.x, row.y);
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
row.data.forEach(charData => {
|
|
688
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
689
|
-
});
|
|
690
|
-
}
|
|
685
|
+
else if (row.data)
|
|
686
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
691
687
|
if (decorationY)
|
|
692
688
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
693
689
|
}
|
|
@@ -753,12 +749,10 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
753
749
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
754
750
|
fillText(ui, out);
|
|
755
751
|
out.blendMode = 'normal';
|
|
756
|
-
if (ui.__worldFlipped)
|
|
752
|
+
if (ui.__worldFlipped)
|
|
757
753
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
758
|
-
|
|
759
|
-
else {
|
|
754
|
+
else
|
|
760
755
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
761
|
-
}
|
|
762
756
|
out.recycle(ui.__nowWorld);
|
|
763
757
|
}
|
|
764
758
|
function drawTextStroke(ui, canvas) {
|
|
@@ -766,14 +760,10 @@ function drawTextStroke(ui, canvas) {
|
|
|
766
760
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
767
761
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
768
762
|
row = rows[i];
|
|
769
|
-
if (row.text)
|
|
763
|
+
if (row.text)
|
|
770
764
|
canvas.strokeText(row.text, row.x, row.y);
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
row.data.forEach(charData => {
|
|
774
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
775
|
-
});
|
|
776
|
-
}
|
|
765
|
+
else if (row.data)
|
|
766
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
777
767
|
if (decorationY)
|
|
778
768
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
779
769
|
}
|
|
@@ -826,12 +816,10 @@ function stroke(stroke, ui, canvas) {
|
|
|
826
816
|
out.stroke();
|
|
827
817
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
828
818
|
out.clearWorld(ui.__layout.renderBounds);
|
|
829
|
-
if (ui.__worldFlipped)
|
|
819
|
+
if (ui.__worldFlipped)
|
|
830
820
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
831
|
-
|
|
832
|
-
else {
|
|
821
|
+
else
|
|
833
822
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
834
|
-
}
|
|
835
823
|
out.recycle(ui.__nowWorld);
|
|
836
824
|
break;
|
|
837
825
|
}
|
|
@@ -866,12 +854,10 @@ function strokes(strokes, ui, canvas) {
|
|
|
866
854
|
drawStrokesStyle(strokes, false, ui, out);
|
|
867
855
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
868
856
|
out.clearWorld(renderBounds);
|
|
869
|
-
if (ui.__worldFlipped)
|
|
857
|
+
if (ui.__worldFlipped)
|
|
870
858
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
871
|
-
|
|
872
|
-
else {
|
|
859
|
+
else
|
|
873
860
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
874
|
-
}
|
|
875
861
|
out.recycle(ui.__nowWorld);
|
|
876
862
|
break;
|
|
877
863
|
}
|
|
@@ -935,12 +921,7 @@ function compute(attrName, ui) {
|
|
|
935
921
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
936
922
|
if (leafPaints.length && leafPaints[0].image)
|
|
937
923
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
938
|
-
|
|
939
|
-
data.__pixelFill = hasOpacityPixel;
|
|
940
|
-
}
|
|
941
|
-
else {
|
|
942
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
943
|
-
}
|
|
924
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
944
925
|
}
|
|
945
926
|
function getLeafPaint(attrName, paint, ui) {
|
|
946
927
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|
package/dist/worker.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
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5968
5968
|
get allowBackgroundColor() { return true; }
|
|
@@ -6690,12 +6690,8 @@ var LeaferUI = (function (exports) {
|
|
|
6690
6690
|
};
|
|
6691
6691
|
const Transition = {
|
|
6692
6692
|
list: {},
|
|
6693
|
-
register(attrName, fn) {
|
|
6694
|
-
|
|
6695
|
-
},
|
|
6696
|
-
get(attrName) {
|
|
6697
|
-
return Transition.list[attrName];
|
|
6698
|
-
}
|
|
6693
|
+
register(attrName, fn) { Transition.list[attrName] = fn; },
|
|
6694
|
+
get(attrName) { return Transition.list[attrName]; }
|
|
6699
6695
|
};
|
|
6700
6696
|
|
|
6701
6697
|
const { parse, objectToCanvasData } = PathConvert;
|
|
@@ -7141,8 +7137,8 @@ var LeaferUI = (function (exports) {
|
|
|
7141
7137
|
pen.set(path = []), this.__drawPathByBox(pen);
|
|
7142
7138
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
7143
7139
|
}
|
|
7144
|
-
getPathString(curve, pathForRender) {
|
|
7145
|
-
return PathConvert.stringify(this.getPath(curve, pathForRender));
|
|
7140
|
+
getPathString(curve, pathForRender, floatLength) {
|
|
7141
|
+
return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
|
|
7146
7142
|
}
|
|
7147
7143
|
load() {
|
|
7148
7144
|
this.__.__computePaint();
|
|
@@ -7551,11 +7547,11 @@ var LeaferUI = (function (exports) {
|
|
|
7551
7547
|
start() {
|
|
7552
7548
|
clearTimeout(this.__startTimer);
|
|
7553
7549
|
if (!this.running && this.canvas) {
|
|
7550
|
+
this.running = true;
|
|
7554
7551
|
this.ready ? this.emitLeafer(LeaferEvent.RESTART) : this.emitLeafer(LeaferEvent.START);
|
|
7555
7552
|
this.__controllers.forEach(item => item.start());
|
|
7556
7553
|
if (!this.isApp)
|
|
7557
7554
|
this.renderer.render();
|
|
7558
|
-
this.running = true;
|
|
7559
7555
|
}
|
|
7560
7556
|
}
|
|
7561
7557
|
stop() {
|
|
@@ -7661,12 +7657,10 @@ var LeaferUI = (function (exports) {
|
|
|
7661
7657
|
}
|
|
7662
7658
|
__changeFill(newValue) {
|
|
7663
7659
|
this.config.fill = newValue;
|
|
7664
|
-
if (this.canvas.allowBackgroundColor)
|
|
7660
|
+
if (this.canvas.allowBackgroundColor)
|
|
7665
7661
|
this.canvas.backgroundColor = newValue;
|
|
7666
|
-
|
|
7667
|
-
else {
|
|
7662
|
+
else
|
|
7668
7663
|
this.forceRender();
|
|
7669
|
-
}
|
|
7670
7664
|
}
|
|
7671
7665
|
__onCreated() {
|
|
7672
7666
|
this.created = true;
|
|
@@ -7733,13 +7727,10 @@ var LeaferUI = (function (exports) {
|
|
|
7733
7727
|
if (bind)
|
|
7734
7728
|
item = item.bind(bind);
|
|
7735
7729
|
this.__viewCompletedWait.push(item);
|
|
7736
|
-
if (this.viewCompleted)
|
|
7730
|
+
if (this.viewCompleted)
|
|
7737
7731
|
this.__checkViewCompleted(false);
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
if (!this.running)
|
|
7741
|
-
this.start();
|
|
7742
|
-
}
|
|
7732
|
+
else if (!this.running)
|
|
7733
|
+
this.start();
|
|
7743
7734
|
}
|
|
7744
7735
|
nextRender(item, bind, off) {
|
|
7745
7736
|
if (bind)
|
|
@@ -7753,9 +7744,8 @@ var LeaferUI = (function (exports) {
|
|
|
7753
7744
|
}
|
|
7754
7745
|
}
|
|
7755
7746
|
}
|
|
7756
|
-
else
|
|
7747
|
+
else
|
|
7757
7748
|
list.push(item);
|
|
7758
|
-
}
|
|
7759
7749
|
}
|
|
7760
7750
|
zoom(_zoomType, _padding, _fixedScale) {
|
|
7761
7751
|
return needPlugin('view');
|
|
@@ -7799,10 +7789,7 @@ var LeaferUI = (function (exports) {
|
|
|
7799
7789
|
this.stop();
|
|
7800
7790
|
this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
|
|
7801
7791
|
this.__removeListenEvents();
|
|
7802
|
-
this.__controllers.forEach(item =>
|
|
7803
|
-
if (!(this.parent && item === this.interaction))
|
|
7804
|
-
item.destroy();
|
|
7805
|
-
});
|
|
7792
|
+
this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
|
|
7806
7793
|
this.__controllers.length = 0;
|
|
7807
7794
|
if (!this.parent) {
|
|
7808
7795
|
if (this.selector)
|
|
@@ -8335,23 +8322,23 @@ var LeaferUI = (function (exports) {
|
|
|
8335
8322
|
}
|
|
8336
8323
|
__updateTextDrawData() {
|
|
8337
8324
|
const data = this.__;
|
|
8338
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8339
|
-
}
|
|
8340
|
-
__updateBoxBounds() {
|
|
8341
|
-
const data = this.__;
|
|
8342
|
-
const layout = this.__layout;
|
|
8343
8325
|
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
|
|
8344
|
-
const autoWidth = data.__autoWidth;
|
|
8345
|
-
const autoHeight = data.__autoHeight;
|
|
8346
8326
|
data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
|
|
8347
8327
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
8348
8328
|
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
|
|
8349
8329
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8350
8330
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8351
8331
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8332
|
+
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8333
|
+
}
|
|
8334
|
+
__updateBoxBounds() {
|
|
8335
|
+
const data = this.__;
|
|
8336
|
+
const layout = this.__layout;
|
|
8337
|
+
const { fontSize, italic, padding, __autoWidth: autoWidth, __autoHeight: autoHeight } = data;
|
|
8352
8338
|
this.__updateTextDrawData();
|
|
8353
8339
|
const { bounds } = data.__textDrawData;
|
|
8354
8340
|
const b = layout.boxBounds;
|
|
8341
|
+
console.log(bounds, autoWidth, autoHeight);
|
|
8355
8342
|
if (data.__lineHeight < fontSize)
|
|
8356
8343
|
spread(bounds, fontSize / 2);
|
|
8357
8344
|
if (autoWidth || autoHeight) {
|
|
@@ -8361,20 +8348,15 @@ var LeaferUI = (function (exports) {
|
|
|
8361
8348
|
b.height = autoHeight ? bounds.height : data.height;
|
|
8362
8349
|
if (padding) {
|
|
8363
8350
|
const [top, right, bottom, left] = data.__padding;
|
|
8364
|
-
if (autoWidth)
|
|
8365
|
-
b.x -= left;
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
if (autoHeight) {
|
|
8369
|
-
b.y -= top;
|
|
8370
|
-
b.height += (bottom + top);
|
|
8371
|
-
}
|
|
8351
|
+
if (autoWidth)
|
|
8352
|
+
b.x -= left, b.width += (right + left);
|
|
8353
|
+
if (autoHeight)
|
|
8354
|
+
b.y -= top, b.height += (bottom + top);
|
|
8372
8355
|
}
|
|
8373
8356
|
this.__updateNaturalSize();
|
|
8374
8357
|
}
|
|
8375
|
-
else
|
|
8358
|
+
else
|
|
8376
8359
|
super.__updateBoxBounds();
|
|
8377
|
-
}
|
|
8378
8360
|
if (italic)
|
|
8379
8361
|
b.width += fontSize * 0.16;
|
|
8380
8362
|
const contentBounds = includes(b, bounds) ? b : bounds;
|
|
@@ -8383,9 +8365,8 @@ var LeaferUI = (function (exports) {
|
|
|
8383
8365
|
layout.renderChanged = true;
|
|
8384
8366
|
setList(data.__textBoxBounds = {}, [b, bounds]);
|
|
8385
8367
|
}
|
|
8386
|
-
else
|
|
8368
|
+
else
|
|
8387
8369
|
data.__textBoxBounds = contentBounds;
|
|
8388
|
-
}
|
|
8389
8370
|
}
|
|
8390
8371
|
__updateRenderSpread() {
|
|
8391
8372
|
let width = super.__updateRenderSpread();
|
|
@@ -8498,11 +8479,7 @@ var LeaferUI = (function (exports) {
|
|
|
8498
8479
|
this.add(path);
|
|
8499
8480
|
return this;
|
|
8500
8481
|
}
|
|
8501
|
-
beginPath() {
|
|
8502
|
-
this.__path.length = 0;
|
|
8503
|
-
this.paint();
|
|
8504
|
-
return this;
|
|
8505
|
-
}
|
|
8482
|
+
beginPath() { return this; }
|
|
8506
8483
|
moveTo(_x, _y) { return this; }
|
|
8507
8484
|
lineTo(_x, _y) { return this; }
|
|
8508
8485
|
bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) { return this; }
|
|
@@ -8529,7 +8506,7 @@ var LeaferUI = (function (exports) {
|
|
|
8529
8506
|
penPathType()
|
|
8530
8507
|
], exports.Pen.prototype, "path", void 0);
|
|
8531
8508
|
exports.Pen = __decorate([
|
|
8532
|
-
useModule(PathCreator, ['set', '
|
|
8509
|
+
useModule(PathCreator, ['set', 'path', 'paint']),
|
|
8533
8510
|
registerUI()
|
|
8534
8511
|
], exports.Pen);
|
|
8535
8512
|
function penPathType() {
|
|
@@ -8545,14 +8522,10 @@ var LeaferUI = (function (exports) {
|
|
|
8545
8522
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
8546
8523
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
8547
8524
|
row = rows[i];
|
|
8548
|
-
if (row.text)
|
|
8525
|
+
if (row.text)
|
|
8549
8526
|
canvas.fillText(row.text, row.x, row.y);
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
row.data.forEach(charData => {
|
|
8553
|
-
canvas.fillText(charData.char, charData.x, row.y);
|
|
8554
|
-
});
|
|
8555
|
-
}
|
|
8527
|
+
else if (row.data)
|
|
8528
|
+
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
8556
8529
|
if (decorationY)
|
|
8557
8530
|
canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
8558
8531
|
}
|
|
@@ -8618,12 +8591,10 @@ var LeaferUI = (function (exports) {
|
|
|
8618
8591
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
8619
8592
|
fillText(ui, out);
|
|
8620
8593
|
out.blendMode = 'normal';
|
|
8621
|
-
if (ui.__worldFlipped)
|
|
8594
|
+
if (ui.__worldFlipped)
|
|
8622
8595
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
8623
|
-
|
|
8624
|
-
else {
|
|
8596
|
+
else
|
|
8625
8597
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
8626
|
-
}
|
|
8627
8598
|
out.recycle(ui.__nowWorld);
|
|
8628
8599
|
}
|
|
8629
8600
|
function drawTextStroke(ui, canvas) {
|
|
@@ -8631,14 +8602,10 @@ var LeaferUI = (function (exports) {
|
|
|
8631
8602
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
8632
8603
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
8633
8604
|
row = rows[i];
|
|
8634
|
-
if (row.text)
|
|
8605
|
+
if (row.text)
|
|
8635
8606
|
canvas.strokeText(row.text, row.x, row.y);
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
row.data.forEach(charData => {
|
|
8639
|
-
canvas.strokeText(charData.char, charData.x, row.y);
|
|
8640
|
-
});
|
|
8641
|
-
}
|
|
8607
|
+
else if (row.data)
|
|
8608
|
+
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
8642
8609
|
if (decorationY)
|
|
8643
8610
|
canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
|
|
8644
8611
|
}
|
|
@@ -8691,12 +8658,10 @@ var LeaferUI = (function (exports) {
|
|
|
8691
8658
|
out.stroke();
|
|
8692
8659
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
8693
8660
|
out.clearWorld(ui.__layout.renderBounds);
|
|
8694
|
-
if (ui.__worldFlipped)
|
|
8661
|
+
if (ui.__worldFlipped)
|
|
8695
8662
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
8696
|
-
|
|
8697
|
-
else {
|
|
8663
|
+
else
|
|
8698
8664
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
8699
|
-
}
|
|
8700
8665
|
out.recycle(ui.__nowWorld);
|
|
8701
8666
|
break;
|
|
8702
8667
|
}
|
|
@@ -8731,12 +8696,10 @@ var LeaferUI = (function (exports) {
|
|
|
8731
8696
|
drawStrokesStyle(strokes, false, ui, out);
|
|
8732
8697
|
options.windingRule ? out.clip(options.windingRule) : out.clip();
|
|
8733
8698
|
out.clearWorld(renderBounds);
|
|
8734
|
-
if (ui.__worldFlipped)
|
|
8699
|
+
if (ui.__worldFlipped)
|
|
8735
8700
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
8736
|
-
|
|
8737
|
-
else {
|
|
8701
|
+
else
|
|
8738
8702
|
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
8739
|
-
}
|
|
8740
8703
|
out.recycle(ui.__nowWorld);
|
|
8741
8704
|
break;
|
|
8742
8705
|
}
|
|
@@ -8800,12 +8763,7 @@ var LeaferUI = (function (exports) {
|
|
|
8800
8763
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
8801
8764
|
if (leafPaints.length && leafPaints[0].image)
|
|
8802
8765
|
hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
|
|
8803
|
-
|
|
8804
|
-
data.__pixelFill = hasOpacityPixel;
|
|
8805
|
-
}
|
|
8806
|
-
else {
|
|
8807
|
-
data.__pixelStroke = hasOpacityPixel;
|
|
8808
|
-
}
|
|
8766
|
+
attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
|
|
8809
8767
|
}
|
|
8810
8768
|
function getLeafPaint(attrName, paint, ui) {
|
|
8811
8769
|
if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
|