@leafer-ui/miniapp 1.0.0-rc.7 → 1.0.0-rc.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/miniapp.esm.js +45 -13
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.module.js +135 -80
- package/dist/miniapp.module.min.js +1 -1
- package/package.json +6 -6
package/dist/miniapp.module.js
CHANGED
|
@@ -101,14 +101,14 @@ const PI_2 = PI$4 / 2;
|
|
|
101
101
|
const { sin: sin$5, cos: cos$5, acos, sqrt: sqrt$3 } = Math;
|
|
102
102
|
const { float } = MathHelper;
|
|
103
103
|
const tempPoint$2 = {};
|
|
104
|
-
function get$
|
|
104
|
+
function get$6() {
|
|
105
105
|
return { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 };
|
|
106
106
|
}
|
|
107
107
|
function getWorld() {
|
|
108
|
-
return Object.assign(Object.assign({}, get$
|
|
108
|
+
return Object.assign(Object.assign({}, get$6()), { x: 0, y: 0, width: 0, height: 0, scaleX: 1, scaleY: 1, rotation: 0, skewX: 0, skewY: 0 });
|
|
109
109
|
}
|
|
110
110
|
const MatrixHelper = {
|
|
111
|
-
defaultMatrix: get$
|
|
111
|
+
defaultMatrix: get$6(),
|
|
112
112
|
defaultWorld: getWorld(),
|
|
113
113
|
tempMatrix: {},
|
|
114
114
|
set(t, a = 1, b = 0, c = 0, d = 1, e = 0, f = 0) {
|
|
@@ -119,7 +119,7 @@ const MatrixHelper = {
|
|
|
119
119
|
t.e = e;
|
|
120
120
|
t.f = f;
|
|
121
121
|
},
|
|
122
|
-
get: get$
|
|
122
|
+
get: get$6,
|
|
123
123
|
getWorld,
|
|
124
124
|
copy(t, matrix) {
|
|
125
125
|
t.a = matrix.a;
|
|
@@ -682,7 +682,7 @@ const { addPoint: addPoint$3 } = TwoPointBoundsHelper;
|
|
|
682
682
|
|
|
683
683
|
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$3 } = TwoPointBoundsHelper;
|
|
684
684
|
const { toOuterPoint: toOuterPoint$1 } = MatrixHelper;
|
|
685
|
-
let right, bottom, boundsRight, boundsBottom;
|
|
685
|
+
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
686
686
|
const point = {};
|
|
687
687
|
const toPoint$1 = {};
|
|
688
688
|
const BoundsHelper = {
|
|
@@ -825,16 +825,16 @@ const BoundsHelper = {
|
|
|
825
825
|
}
|
|
826
826
|
},
|
|
827
827
|
add(t, bounds) {
|
|
828
|
-
right = t.x + t.width;
|
|
829
|
-
bottom = t.y + t.height;
|
|
828
|
+
right$1 = t.x + t.width;
|
|
829
|
+
bottom$1 = t.y + t.height;
|
|
830
830
|
boundsRight = bounds.x + bounds.width;
|
|
831
831
|
boundsBottom = bounds.y + bounds.height;
|
|
832
|
-
right = right > boundsRight ? right : boundsRight;
|
|
833
|
-
bottom = bottom > boundsBottom ? bottom : boundsBottom;
|
|
832
|
+
right$1 = right$1 > boundsRight ? right$1 : boundsRight;
|
|
833
|
+
bottom$1 = bottom$1 > boundsBottom ? bottom$1 : boundsBottom;
|
|
834
834
|
t.x = t.x < bounds.x ? t.x : bounds.x;
|
|
835
835
|
t.y = t.y < bounds.y ? t.y : bounds.y;
|
|
836
|
-
t.width = right - t.x;
|
|
837
|
-
t.height = bottom - t.y;
|
|
836
|
+
t.width = right$1 - t.x;
|
|
837
|
+
t.height = bottom$1 - t.y;
|
|
838
838
|
},
|
|
839
839
|
addList(t, list) {
|
|
840
840
|
B.setListWithFn(t, list, undefined, true);
|
|
@@ -900,16 +900,16 @@ const BoundsHelper = {
|
|
|
900
900
|
if (otherMatrix)
|
|
901
901
|
other = B.tempToOuterOf(other, otherMatrix);
|
|
902
902
|
let { x, y, width, height } = other;
|
|
903
|
-
right = x + width;
|
|
904
|
-
bottom = y + height;
|
|
903
|
+
right$1 = x + width;
|
|
904
|
+
bottom$1 = y + height;
|
|
905
905
|
boundsRight = t.x + t.width;
|
|
906
906
|
boundsBottom = t.y + t.height;
|
|
907
907
|
x = x > t.x ? x : t.x;
|
|
908
908
|
y = y > t.y ? y : t.y;
|
|
909
|
-
right = right < boundsRight ? right : boundsRight;
|
|
910
|
-
bottom = bottom < boundsBottom ? bottom : boundsBottom;
|
|
911
|
-
width = right - x;
|
|
912
|
-
height = bottom - y;
|
|
909
|
+
right$1 = right$1 < boundsRight ? right$1 : boundsRight;
|
|
910
|
+
bottom$1 = bottom$1 < boundsBottom ? bottom$1 : boundsBottom;
|
|
911
|
+
width = right$1 - x;
|
|
912
|
+
height = bottom$1 - y;
|
|
913
913
|
return { x, y, width, height };
|
|
914
914
|
},
|
|
915
915
|
intersect(t, other, otherMatrix) {
|
|
@@ -1053,25 +1053,55 @@ class AutoBounds {
|
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
1055
|
|
|
1056
|
-
|
|
1056
|
+
var Direction4;
|
|
1057
|
+
(function (Direction4) {
|
|
1058
|
+
Direction4[Direction4["top"] = 0] = "top";
|
|
1059
|
+
Direction4[Direction4["right"] = 1] = "right";
|
|
1060
|
+
Direction4[Direction4["bottom"] = 2] = "bottom";
|
|
1061
|
+
Direction4[Direction4["left"] = 3] = "left";
|
|
1062
|
+
})(Direction4 || (Direction4 = {}));
|
|
1063
|
+
var Direction9;
|
|
1064
|
+
(function (Direction9) {
|
|
1065
|
+
Direction9[Direction9["topLeft"] = 0] = "topLeft";
|
|
1066
|
+
Direction9[Direction9["top"] = 1] = "top";
|
|
1067
|
+
Direction9[Direction9["topRight"] = 2] = "topRight";
|
|
1068
|
+
Direction9[Direction9["right"] = 3] = "right";
|
|
1069
|
+
Direction9[Direction9["bottomRight"] = 4] = "bottomRight";
|
|
1070
|
+
Direction9[Direction9["bottom"] = 5] = "bottom";
|
|
1071
|
+
Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
|
|
1072
|
+
Direction9[Direction9["left"] = 7] = "left";
|
|
1073
|
+
Direction9[Direction9["center"] = 8] = "center";
|
|
1074
|
+
})(Direction9 || (Direction9 = {}));
|
|
1075
|
+
|
|
1076
|
+
const directionData = [
|
|
1077
|
+
{ x: 0, y: 0 },
|
|
1078
|
+
{ x: 0.5, y: 0 },
|
|
1079
|
+
{ x: 1, y: 0 },
|
|
1080
|
+
{ x: 1, y: 0.5 },
|
|
1081
|
+
{ x: 1, y: 1 },
|
|
1082
|
+
{ x: 0.5, y: 1 },
|
|
1083
|
+
{ x: 0, y: 1 },
|
|
1084
|
+
{ x: 0, y: 0.5 },
|
|
1085
|
+
{ x: 0.5, y: 0.5 }
|
|
1086
|
+
];
|
|
1057
1087
|
const AroundHelper = {
|
|
1058
|
-
|
|
1088
|
+
directionData,
|
|
1059
1089
|
tempPoint: {},
|
|
1090
|
+
get: get$5,
|
|
1060
1091
|
toPoint(around, bounds, to, onlySize) {
|
|
1061
1092
|
to || (to = {});
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
break;
|
|
1066
|
-
}
|
|
1067
|
-
to.x = around.x * bounds.width;
|
|
1068
|
-
to.y = around.y * bounds.height;
|
|
1093
|
+
const point = get$5(around);
|
|
1094
|
+
to.x = point.x * bounds.width;
|
|
1095
|
+
to.y = point.y * bounds.height;
|
|
1069
1096
|
if (!onlySize) {
|
|
1070
1097
|
to.x += bounds.x;
|
|
1071
1098
|
to.y += bounds.y;
|
|
1072
1099
|
}
|
|
1073
1100
|
}
|
|
1074
1101
|
};
|
|
1102
|
+
function get$5(around) {
|
|
1103
|
+
return typeof around === 'string' ? directionData[Direction9[around]] : around;
|
|
1104
|
+
}
|
|
1075
1105
|
|
|
1076
1106
|
const StringNumberMap = {
|
|
1077
1107
|
'0': 1,
|
|
@@ -3086,7 +3116,6 @@ const PathScaler = {
|
|
|
3086
3116
|
break;
|
|
3087
3117
|
case G$1:
|
|
3088
3118
|
scalePoints(data, scaleX, scaleY, i, 2);
|
|
3089
|
-
console.log('G');
|
|
3090
3119
|
i += 9;
|
|
3091
3120
|
break;
|
|
3092
3121
|
case F$1:
|
|
@@ -3801,7 +3830,7 @@ LayoutEvent.CHECK_UPDATE = 'layout.check_update';
|
|
|
3801
3830
|
LayoutEvent.REQUEST = 'layout.request';
|
|
3802
3831
|
LayoutEvent.START = 'layout.start';
|
|
3803
3832
|
LayoutEvent.BEFORE = 'layout.before';
|
|
3804
|
-
LayoutEvent.LAYOUT = 'layout
|
|
3833
|
+
LayoutEvent.LAYOUT = 'layout';
|
|
3805
3834
|
LayoutEvent.AFTER = 'layout.after';
|
|
3806
3835
|
LayoutEvent.AGAIN = 'layout.again';
|
|
3807
3836
|
LayoutEvent.END = 'layout.end';
|
|
@@ -4450,13 +4479,10 @@ const LeafHelper = {
|
|
|
4450
4479
|
}
|
|
4451
4480
|
},
|
|
4452
4481
|
worldHittable(t) {
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
let { parent } = t;
|
|
4456
|
-
while (parent) {
|
|
4457
|
-
if (!parent.__.hittable || !parent.__.hitChildren)
|
|
4482
|
+
while (t) {
|
|
4483
|
+
if (!t.__.hittable)
|
|
4458
4484
|
return false;
|
|
4459
|
-
|
|
4485
|
+
t = t.parent;
|
|
4460
4486
|
}
|
|
4461
4487
|
return true;
|
|
4462
4488
|
},
|
|
@@ -8942,11 +8968,12 @@ let Text = class Text extends UI {
|
|
|
8942
8968
|
__updateBoxBounds() {
|
|
8943
8969
|
const data = this.__;
|
|
8944
8970
|
const layout = this.__layout;
|
|
8945
|
-
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow } = data;
|
|
8971
|
+
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
|
|
8946
8972
|
const autoWidth = data.__autoWidth;
|
|
8947
8973
|
const autoHeight = data.__autoHeight;
|
|
8948
8974
|
data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
|
|
8949
8975
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
8976
|
+
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
|
|
8950
8977
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8951
8978
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8952
8979
|
data.__clipText = textOverflow !== 'show' && !data.__autoBounds;
|
|
@@ -8960,9 +8987,8 @@ let Text = class Text extends UI {
|
|
|
8960
8987
|
b.y = autoHeight ? bounds.y : 0;
|
|
8961
8988
|
b.width = autoWidth ? bounds.width : data.width;
|
|
8962
8989
|
b.height = autoHeight ? bounds.height : data.height;
|
|
8963
|
-
const { padding } = data;
|
|
8964
8990
|
if (padding) {
|
|
8965
|
-
const [top, right, bottom, left] =
|
|
8991
|
+
const [top, right, bottom, left] = data.__padding;
|
|
8966
8992
|
if (autoWidth) {
|
|
8967
8993
|
b.x -= left;
|
|
8968
8994
|
b.width += (right + left);
|
|
@@ -9147,6 +9173,7 @@ let Leafer = class Leafer extends Group {
|
|
|
9147
9173
|
get __tag() { return 'Leafer'; }
|
|
9148
9174
|
get isApp() { return false; }
|
|
9149
9175
|
get app() { return this.parent || this; }
|
|
9176
|
+
get imageReady() { return this.viewReady && ImageManager.isComplete; }
|
|
9150
9177
|
get layoutLocked() { return !this.layouter.running; }
|
|
9151
9178
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
9152
9179
|
constructor(userConfig, data) {
|
|
@@ -9349,23 +9376,26 @@ let Leafer = class Leafer extends Group {
|
|
|
9349
9376
|
this.emitLeafer(LeaferEvent.VIEW_READY);
|
|
9350
9377
|
WaitHelper.run(this.__viewReadyWait);
|
|
9351
9378
|
}
|
|
9352
|
-
|
|
9353
|
-
if (
|
|
9354
|
-
this.
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
this.
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9379
|
+
__onAnimateFrame() {
|
|
9380
|
+
if (this.viewReady) {
|
|
9381
|
+
if (this.__nextRenderWait.length)
|
|
9382
|
+
WaitHelper.run(this.__nextRenderWait);
|
|
9383
|
+
const { imageReady } = this;
|
|
9384
|
+
if (imageReady && !this.viewCompleted)
|
|
9385
|
+
this.__checkViewCompleted();
|
|
9386
|
+
if (!imageReady)
|
|
9387
|
+
this.viewCompleted = false;
|
|
9388
|
+
}
|
|
9389
|
+
}
|
|
9390
|
+
__checkViewCompleted(emit = true) {
|
|
9391
|
+
this.nextRender(() => {
|
|
9392
|
+
if (this.imageReady) {
|
|
9393
|
+
if (emit)
|
|
9394
|
+
this.emitLeafer(LeaferEvent.VIEW_COMPLETED);
|
|
9395
|
+
WaitHelper.run(this.__viewCompletedWait);
|
|
9396
|
+
this.viewCompleted = true;
|
|
9397
|
+
}
|
|
9398
|
+
});
|
|
9369
9399
|
}
|
|
9370
9400
|
__onWatchData() {
|
|
9371
9401
|
if (this.watcher.childrenChanged && this.interaction) {
|
|
@@ -9379,22 +9409,17 @@ let Leafer = class Leafer extends Group {
|
|
|
9379
9409
|
this.viewReady ? item() : this.__viewReadyWait.push(item);
|
|
9380
9410
|
}
|
|
9381
9411
|
waitViewCompleted(item) {
|
|
9412
|
+
this.__viewCompletedWait.push(item);
|
|
9382
9413
|
if (this.viewCompleted) {
|
|
9383
|
-
|
|
9414
|
+
this.__checkViewCompleted(false);
|
|
9384
9415
|
}
|
|
9385
9416
|
else {
|
|
9386
|
-
this.__viewCompletedWait.push(item);
|
|
9387
9417
|
if (!this.running)
|
|
9388
9418
|
this.start();
|
|
9389
9419
|
}
|
|
9390
9420
|
}
|
|
9391
9421
|
nextRender(item) {
|
|
9392
|
-
|
|
9393
|
-
item();
|
|
9394
|
-
}
|
|
9395
|
-
else {
|
|
9396
|
-
this.__nextRenderWait.push(item);
|
|
9397
|
-
}
|
|
9422
|
+
this.__nextRenderWait.push(item);
|
|
9398
9423
|
}
|
|
9399
9424
|
__checkUpdateLayout() {
|
|
9400
9425
|
this.__layout.update();
|
|
@@ -9407,7 +9432,8 @@ let Leafer = class Leafer extends Group {
|
|
|
9407
9432
|
this.once(LeaferEvent.START, () => Run.end(runId));
|
|
9408
9433
|
this.once(LayoutEvent.END, () => this.__onReady());
|
|
9409
9434
|
this.once(RenderEvent.START, () => this.__onCreated());
|
|
9410
|
-
this.
|
|
9435
|
+
this.once(RenderEvent.END, () => this.__onViewReady());
|
|
9436
|
+
this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(AnimateEvent.FRAME, this.__onAnimateFrame, this), this.on_(LayoutEvent.CHECK_UPDATE, this.__checkUpdateLayout, this));
|
|
9411
9437
|
}
|
|
9412
9438
|
__removeListenEvents() {
|
|
9413
9439
|
this.off_(this.__eventIds);
|
|
@@ -9534,9 +9560,6 @@ let App = class App extends Leafer {
|
|
|
9534
9560
|
if (this.children.every(child => child.viewReady))
|
|
9535
9561
|
super.__onViewReady();
|
|
9536
9562
|
}
|
|
9537
|
-
__checkViewCompleted() {
|
|
9538
|
-
return this.children.every(item => item.viewCompleted);
|
|
9539
|
-
}
|
|
9540
9563
|
__onChildRenderEnd(e) {
|
|
9541
9564
|
this.renderer.addBlock(e.renderBounds);
|
|
9542
9565
|
if (this.viewReady)
|
|
@@ -9566,7 +9589,7 @@ let App = class App extends Leafer {
|
|
|
9566
9589
|
__listenChildEvents(leafer) {
|
|
9567
9590
|
leafer.once(LayoutEvent.END, () => this.__onReady());
|
|
9568
9591
|
leafer.once(RenderEvent.START, () => this.__onCreated());
|
|
9569
|
-
leafer.once(RenderEvent.END, (
|
|
9592
|
+
leafer.once(RenderEvent.END, () => this.__onViewReady());
|
|
9570
9593
|
if (this.realCanvas)
|
|
9571
9594
|
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9572
9595
|
}
|
|
@@ -9632,7 +9655,7 @@ function repeatMode(data, box, width, height, scale, rotation) {
|
|
|
9632
9655
|
const { get: get$3, translate } = MatrixHelper;
|
|
9633
9656
|
function createData(leafPaint, image, paint, box) {
|
|
9634
9657
|
let { width, height } = image;
|
|
9635
|
-
const { opacity, mode, offset, scale, rotation, blendMode } = paint;
|
|
9658
|
+
const { opacity, mode, offset, scale, rotation, blendMode, repeat } = paint;
|
|
9636
9659
|
const sameBox = box.width === width && box.height === height;
|
|
9637
9660
|
if (blendMode)
|
|
9638
9661
|
leafPaint.blendMode = blendMode;
|
|
@@ -9653,6 +9676,8 @@ function createData(leafPaint, image, paint, box) {
|
|
|
9653
9676
|
case 'repeat':
|
|
9654
9677
|
if (!sameBox || scale || rotation)
|
|
9655
9678
|
repeatMode(data, box, width, height, scale, rotation);
|
|
9679
|
+
if (!repeat)
|
|
9680
|
+
data.repeat = 'repeat';
|
|
9656
9681
|
break;
|
|
9657
9682
|
case 'fit':
|
|
9658
9683
|
case 'cover':
|
|
@@ -9664,6 +9689,8 @@ function createData(leafPaint, image, paint, box) {
|
|
|
9664
9689
|
data.height = height;
|
|
9665
9690
|
if (opacity)
|
|
9666
9691
|
data.opacity = opacity;
|
|
9692
|
+
if (repeat)
|
|
9693
|
+
data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
|
|
9667
9694
|
}
|
|
9668
9695
|
|
|
9669
9696
|
function image(ui, attrName, attrValue, box, firstUse) {
|
|
@@ -9710,11 +9737,11 @@ function hasNaturalSize(ui, attrName, image) {
|
|
|
9710
9737
|
d.__naturalWidth = image.width;
|
|
9711
9738
|
d.__naturalHeight = image.height;
|
|
9712
9739
|
if (!d.__getInput('width') || !d.__getInput('height')) {
|
|
9740
|
+
ui.forceUpdate('width');
|
|
9713
9741
|
if (ui.__proxyData) {
|
|
9714
9742
|
ui.setProxyAttr('width', ui.__.width);
|
|
9715
9743
|
ui.setProxyAttr('height', ui.__.height);
|
|
9716
9744
|
}
|
|
9717
|
-
ui.forceUpdate('width');
|
|
9718
9745
|
return false;
|
|
9719
9746
|
}
|
|
9720
9747
|
}
|
|
@@ -9733,7 +9760,7 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
9733
9760
|
scaleX = Math.abs(scaleX);
|
|
9734
9761
|
scaleY = Math.abs(scaleY);
|
|
9735
9762
|
const { image, data } = paint;
|
|
9736
|
-
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform,
|
|
9763
|
+
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
|
|
9737
9764
|
if (sx) {
|
|
9738
9765
|
imageMatrix = get$2();
|
|
9739
9766
|
copy$1(imageMatrix, transform);
|
|
@@ -9746,7 +9773,7 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
9746
9773
|
width *= scaleX;
|
|
9747
9774
|
height *= scaleY;
|
|
9748
9775
|
const size = width * height;
|
|
9749
|
-
if (
|
|
9776
|
+
if (!repeat) {
|
|
9750
9777
|
if (size > Platform.image.maxCacheSize)
|
|
9751
9778
|
return false;
|
|
9752
9779
|
}
|
|
@@ -9776,7 +9803,7 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
9776
9803
|
}
|
|
9777
9804
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
9778
9805
|
}
|
|
9779
|
-
const pattern = Platform.canvas.createPattern(image.getCanvas(width < 1 ? 1 : width, height < 1 ? 1 : height, opacity),
|
|
9806
|
+
const pattern = Platform.canvas.createPattern(image.getCanvas(width < 1 ? 1 : width, height < 1 ? 1 : height, opacity), repeat || (Platform.origin.noRepeat || 'no-repeat'));
|
|
9780
9807
|
try {
|
|
9781
9808
|
if (paint.transform)
|
|
9782
9809
|
paint.transform = null;
|
|
@@ -9804,7 +9831,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
|
|
|
9804
9831
|
else {
|
|
9805
9832
|
const { data } = paint;
|
|
9806
9833
|
if (allowPaint) {
|
|
9807
|
-
if (data.
|
|
9834
|
+
if (!data.repeat) {
|
|
9808
9835
|
let { width, height } = data;
|
|
9809
9836
|
width *= abs(scaleX) * canvas.pixelRatio;
|
|
9810
9837
|
height *= abs(scaleY) * canvas.pixelRatio;
|
|
@@ -10804,6 +10831,7 @@ function decorationText(drawData, style) {
|
|
|
10804
10831
|
}
|
|
10805
10832
|
}
|
|
10806
10833
|
|
|
10834
|
+
const { top, right, bottom, left } = Direction4;
|
|
10807
10835
|
const TextConvert = {
|
|
10808
10836
|
getDrawData(content, style) {
|
|
10809
10837
|
if (typeof content !== 'string')
|
|
@@ -10811,16 +10839,15 @@ const TextConvert = {
|
|
|
10811
10839
|
let x = 0, y = 0;
|
|
10812
10840
|
let width = style.__getInput('width') || 0;
|
|
10813
10841
|
let height = style.__getInput('height') || 0;
|
|
10814
|
-
const { textDecoration, __font, padding } = style;
|
|
10842
|
+
const { textDecoration, __font, __padding: padding } = style;
|
|
10815
10843
|
if (padding) {
|
|
10816
|
-
const [top, right, bottom, left] = MathHelper.fourNumber(padding);
|
|
10817
10844
|
if (width) {
|
|
10818
|
-
x = left;
|
|
10819
|
-
width -= (right + left);
|
|
10845
|
+
x = padding[left];
|
|
10846
|
+
width -= (padding[right] + padding[left]);
|
|
10820
10847
|
}
|
|
10821
10848
|
if (height) {
|
|
10822
|
-
y = top;
|
|
10823
|
-
height -= (top + bottom);
|
|
10849
|
+
y = padding[top];
|
|
10850
|
+
height -= (padding[top] + padding[bottom]);
|
|
10824
10851
|
}
|
|
10825
10852
|
}
|
|
10826
10853
|
const drawData = {
|
|
@@ -10830,6 +10857,8 @@ const TextConvert = {
|
|
|
10830
10857
|
font: Platform.canvas.font = __font
|
|
10831
10858
|
};
|
|
10832
10859
|
createRows(drawData, content, style);
|
|
10860
|
+
if (padding)
|
|
10861
|
+
padAutoText(padding, drawData, style, width, height);
|
|
10833
10862
|
layoutText(drawData, style);
|
|
10834
10863
|
layoutChar(drawData, style, width);
|
|
10835
10864
|
if (drawData.overflow)
|
|
@@ -10839,6 +10868,32 @@ const TextConvert = {
|
|
|
10839
10868
|
return drawData;
|
|
10840
10869
|
}
|
|
10841
10870
|
};
|
|
10871
|
+
function padAutoText(padding, drawData, style, width, height) {
|
|
10872
|
+
if (!width) {
|
|
10873
|
+
switch (style.textAlign) {
|
|
10874
|
+
case 'left':
|
|
10875
|
+
offsetText(drawData, 'x', padding[left]);
|
|
10876
|
+
break;
|
|
10877
|
+
case 'right':
|
|
10878
|
+
offsetText(drawData, 'x', -padding[right]);
|
|
10879
|
+
}
|
|
10880
|
+
}
|
|
10881
|
+
if (!height) {
|
|
10882
|
+
switch (style.verticalAlign) {
|
|
10883
|
+
case 'top':
|
|
10884
|
+
offsetText(drawData, 'y', padding[top]);
|
|
10885
|
+
break;
|
|
10886
|
+
case 'bottom':
|
|
10887
|
+
offsetText(drawData, 'y', -padding[bottom]);
|
|
10888
|
+
}
|
|
10889
|
+
}
|
|
10890
|
+
}
|
|
10891
|
+
function offsetText(drawData, attrName, value) {
|
|
10892
|
+
const { bounds, rows } = drawData;
|
|
10893
|
+
bounds[attrName] += value;
|
|
10894
|
+
for (let i = 0; i < rows.length; i++)
|
|
10895
|
+
rows[i][attrName] += value;
|
|
10896
|
+
}
|
|
10842
10897
|
|
|
10843
10898
|
const ColorConvert = {
|
|
10844
10899
|
string(color, opacity) {
|
|
@@ -10955,4 +11010,4 @@ LeaferCanvas.prototype.updateViewSize = function () {
|
|
|
10955
11010
|
}
|
|
10956
11011
|
};
|
|
10957
11012
|
|
|
10958
|
-
export { Animate, AnimateEvent, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert$1 as ColorConvert, Creator, Cursor, DataHelper, Debug, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export$1 as Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafHit, LeafLayout, LeafLevelList, LeafList, LeafMask, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, Path, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Platform, PluginManager, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert$1 as TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIHit, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, defineDataProcessor, defineKey, defineLeafAttr, effectType, eraserType, getDescriptor, hitType, layoutProcessor, maskType, opacityType, pathType, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, useCanvas, useModule, usePlugin };
|
|
11013
|
+
export { Animate, AnimateEvent, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert$1 as ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export$1 as Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafHit, LeafLayout, LeafLevelList, LeafList, LeafMask, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, Path, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Platform, PluginManager, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert$1 as TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIHit, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, defineDataProcessor, defineKey, defineLeafAttr, effectType, eraserType, getDescriptor, hitType, layoutProcessor, maskType, opacityType, pathType, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, useCanvas, useModule, usePlugin };
|