leafer-ui 1.0.0-rc.7 → 1.0.0-rc.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/README.md +1 -1
- package/dist/web.esm.js +78 -27
- package/dist/web.esm.min.js +1 -1
- package/dist/web.js +208 -120
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +208 -121
- package/dist/web.module.min.js +1 -1
- package/package.json +4 -4
package/dist/web.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
|
},
|
|
@@ -5909,7 +5935,7 @@ const LeafRender = {
|
|
|
5909
5935
|
canvas.setWorld(this.__world, options.matrix);
|
|
5910
5936
|
canvas.opacity = this.__worldOpacity;
|
|
5911
5937
|
if (this.__.__single) {
|
|
5912
|
-
const tempCanvas = canvas.getSameCanvas(true);
|
|
5938
|
+
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
5913
5939
|
this.__draw(tempCanvas, options);
|
|
5914
5940
|
const blendMode = this.__.isEraser ? 'destination-out' : this.__.blendMode;
|
|
5915
5941
|
if (this.__worldFlipped || options.matrix) {
|
|
@@ -5986,7 +6012,7 @@ const BranchRender = {
|
|
|
5986
6012
|
if (this.__worldOpacity) {
|
|
5987
6013
|
if (this.__.__single) {
|
|
5988
6014
|
canvas.resetTransform();
|
|
5989
|
-
const tempCanvas = canvas.getSameCanvas();
|
|
6015
|
+
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
5990
6016
|
this.__renderBranch(tempCanvas, options);
|
|
5991
6017
|
canvas.opacity = this.__worldOpacity;
|
|
5992
6018
|
const blendMode = this.__.isEraser ? 'destination-out' : this.__.blendMode;
|
|
@@ -7332,6 +7358,8 @@ class LeaferCanvas extends LeaferCanvasBase {
|
|
|
7332
7358
|
const { style } = this.view;
|
|
7333
7359
|
style.display || (style.display = 'block');
|
|
7334
7360
|
this.parentView = this.view.parentElement;
|
|
7361
|
+
if (this.parentView)
|
|
7362
|
+
this.parentView.style.userSelect = 'none';
|
|
7335
7363
|
if (Platform.syncDomFont && !this.parentView) {
|
|
7336
7364
|
this.view.style.display = 'none';
|
|
7337
7365
|
document.body.appendChild(this.view);
|
|
@@ -8057,6 +8085,9 @@ class FrameData extends BoxData {
|
|
|
8057
8085
|
class LineData extends UIData {
|
|
8058
8086
|
}
|
|
8059
8087
|
|
|
8088
|
+
class ArrowData extends LineData {
|
|
8089
|
+
}
|
|
8090
|
+
|
|
8060
8091
|
class RectData extends UIData {
|
|
8061
8092
|
get __boxStroke() { return true; }
|
|
8062
8093
|
}
|
|
@@ -8115,6 +8146,25 @@ class TextData extends UIData {
|
|
|
8115
8146
|
}
|
|
8116
8147
|
|
|
8117
8148
|
class ImageData extends RectData {
|
|
8149
|
+
setUrl(value) {
|
|
8150
|
+
this.__setImageFill(value);
|
|
8151
|
+
this._url = value;
|
|
8152
|
+
}
|
|
8153
|
+
__setImageFill(value) {
|
|
8154
|
+
if (this.__leaf.image)
|
|
8155
|
+
this.__leaf.image = null;
|
|
8156
|
+
this.fill = value ? { type: 'image', mode: 'strench', url: value } : undefined;
|
|
8157
|
+
}
|
|
8158
|
+
__getData() {
|
|
8159
|
+
const data = super.__getData();
|
|
8160
|
+
delete data.fill;
|
|
8161
|
+
return data;
|
|
8162
|
+
}
|
|
8163
|
+
__getInputData() {
|
|
8164
|
+
const data = super.__getInputData();
|
|
8165
|
+
delete data.fill;
|
|
8166
|
+
return data;
|
|
8167
|
+
}
|
|
8118
8168
|
}
|
|
8119
8169
|
|
|
8120
8170
|
class CanvasData extends RectData {
|
|
@@ -8361,14 +8411,15 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8361
8411
|
findOne(condition, options) {
|
|
8362
8412
|
return this.leafer ? this.leafer.selector.getBy(condition, this, true, options) : null;
|
|
8363
8413
|
}
|
|
8364
|
-
getPath(curve) {
|
|
8365
|
-
|
|
8414
|
+
getPath(curve, pathForRender) {
|
|
8415
|
+
this.__layout.update();
|
|
8416
|
+
let path = pathForRender ? this.__.__pathForRender : this.__.path;
|
|
8366
8417
|
if (!path)
|
|
8367
|
-
|
|
8418
|
+
this.__drawPathByBox(new PathCreator(path = []));
|
|
8368
8419
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
8369
8420
|
}
|
|
8370
|
-
getPathString(curve) {
|
|
8371
|
-
return PathConvert.stringify(this.getPath(curve));
|
|
8421
|
+
getPathString(curve, pathForRender) {
|
|
8422
|
+
return PathConvert.stringify(this.getPath(curve, pathForRender));
|
|
8372
8423
|
}
|
|
8373
8424
|
__onUpdateSize() {
|
|
8374
8425
|
if (this.__.__input) {
|
|
@@ -8540,6 +8591,12 @@ __decorate([
|
|
|
8540
8591
|
__decorate([
|
|
8541
8592
|
strokeType(10)
|
|
8542
8593
|
], UI.prototype, "miterLimit", void 0);
|
|
8594
|
+
__decorate([
|
|
8595
|
+
strokeType('none')
|
|
8596
|
+
], UI.prototype, "startArrow", void 0);
|
|
8597
|
+
__decorate([
|
|
8598
|
+
strokeType('none')
|
|
8599
|
+
], UI.prototype, "endArrow", void 0);
|
|
8543
8600
|
__decorate([
|
|
8544
8601
|
pathType(0)
|
|
8545
8602
|
], UI.prototype, "cornerRadius", void 0);
|
|
@@ -9036,26 +9093,10 @@ let Image$1 = class Image extends Rect {
|
|
|
9036
9093
|
get ready() { return this.image ? this.image.ready : false; }
|
|
9037
9094
|
constructor(data) {
|
|
9038
9095
|
super(data);
|
|
9039
|
-
|
|
9040
|
-
|
|
9041
|
-
|
|
9042
|
-
|
|
9043
|
-
const fill = this.fill;
|
|
9044
|
-
if (fill) {
|
|
9045
|
-
if (fill.url !== url)
|
|
9046
|
-
update = true;
|
|
9047
|
-
}
|
|
9048
|
-
else {
|
|
9049
|
-
if (url)
|
|
9050
|
-
update = true;
|
|
9051
|
-
}
|
|
9052
|
-
if (update) {
|
|
9053
|
-
if (this.image)
|
|
9054
|
-
this.image = null;
|
|
9055
|
-
this.fill = url ? { type: 'image', mode: 'strench', url } : undefined;
|
|
9056
|
-
this.once(ImageEvent.LOADED, (e) => this.image = e.image);
|
|
9057
|
-
}
|
|
9058
|
-
super.__updateBoxBounds();
|
|
9096
|
+
this.on(ImageEvent.LOADED, (e) => {
|
|
9097
|
+
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
9098
|
+
this.image = e.image;
|
|
9099
|
+
});
|
|
9059
9100
|
}
|
|
9060
9101
|
destroy() {
|
|
9061
9102
|
this.image = null;
|
|
@@ -9185,11 +9226,12 @@ let Text = class Text extends UI {
|
|
|
9185
9226
|
__updateBoxBounds() {
|
|
9186
9227
|
const data = this.__;
|
|
9187
9228
|
const layout = this.__layout;
|
|
9188
|
-
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow } = data;
|
|
9229
|
+
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
|
|
9189
9230
|
const autoWidth = data.__autoWidth;
|
|
9190
9231
|
const autoHeight = data.__autoHeight;
|
|
9191
9232
|
data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
|
|
9192
9233
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
9234
|
+
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
|
|
9193
9235
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
9194
9236
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
9195
9237
|
data.__clipText = textOverflow !== 'show' && !data.__autoBounds;
|
|
@@ -9203,9 +9245,8 @@ let Text = class Text extends UI {
|
|
|
9203
9245
|
b.y = autoHeight ? bounds.y : 0;
|
|
9204
9246
|
b.width = autoWidth ? bounds.width : data.width;
|
|
9205
9247
|
b.height = autoHeight ? bounds.height : data.height;
|
|
9206
|
-
const { padding } = data;
|
|
9207
9248
|
if (padding) {
|
|
9208
|
-
const [top, right, bottom, left] =
|
|
9249
|
+
const [top, right, bottom, left] = data.__padding;
|
|
9209
9250
|
if (autoWidth) {
|
|
9210
9251
|
b.x -= left;
|
|
9211
9252
|
b.width += (right + left);
|
|
@@ -9390,6 +9431,7 @@ let Leafer = class Leafer extends Group {
|
|
|
9390
9431
|
get __tag() { return 'Leafer'; }
|
|
9391
9432
|
get isApp() { return false; }
|
|
9392
9433
|
get app() { return this.parent || this; }
|
|
9434
|
+
get imageReady() { return this.viewReady && ImageManager.isComplete; }
|
|
9393
9435
|
get layoutLocked() { return !this.layouter.running; }
|
|
9394
9436
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
9395
9437
|
constructor(userConfig, data) {
|
|
@@ -9592,23 +9634,26 @@ let Leafer = class Leafer extends Group {
|
|
|
9592
9634
|
this.emitLeafer(LeaferEvent.VIEW_READY);
|
|
9593
9635
|
WaitHelper.run(this.__viewReadyWait);
|
|
9594
9636
|
}
|
|
9595
|
-
|
|
9596
|
-
if (
|
|
9597
|
-
this.
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
this.
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9637
|
+
__onAnimateFrame() {
|
|
9638
|
+
if (this.viewReady) {
|
|
9639
|
+
if (this.__nextRenderWait.length)
|
|
9640
|
+
WaitHelper.run(this.__nextRenderWait);
|
|
9641
|
+
const { imageReady } = this;
|
|
9642
|
+
if (imageReady && !this.viewCompleted)
|
|
9643
|
+
this.__checkViewCompleted();
|
|
9644
|
+
if (!imageReady)
|
|
9645
|
+
this.viewCompleted = false;
|
|
9646
|
+
}
|
|
9647
|
+
}
|
|
9648
|
+
__checkViewCompleted(emit = true) {
|
|
9649
|
+
this.nextRender(() => {
|
|
9650
|
+
if (this.imageReady) {
|
|
9651
|
+
if (emit)
|
|
9652
|
+
this.emitLeafer(LeaferEvent.VIEW_COMPLETED);
|
|
9653
|
+
WaitHelper.run(this.__viewCompletedWait);
|
|
9654
|
+
this.viewCompleted = true;
|
|
9655
|
+
}
|
|
9656
|
+
});
|
|
9612
9657
|
}
|
|
9613
9658
|
__onWatchData() {
|
|
9614
9659
|
if (this.watcher.childrenChanged && this.interaction) {
|
|
@@ -9622,22 +9667,17 @@ let Leafer = class Leafer extends Group {
|
|
|
9622
9667
|
this.viewReady ? item() : this.__viewReadyWait.push(item);
|
|
9623
9668
|
}
|
|
9624
9669
|
waitViewCompleted(item) {
|
|
9670
|
+
this.__viewCompletedWait.push(item);
|
|
9625
9671
|
if (this.viewCompleted) {
|
|
9626
|
-
|
|
9672
|
+
this.__checkViewCompleted(false);
|
|
9627
9673
|
}
|
|
9628
9674
|
else {
|
|
9629
|
-
this.__viewCompletedWait.push(item);
|
|
9630
9675
|
if (!this.running)
|
|
9631
9676
|
this.start();
|
|
9632
9677
|
}
|
|
9633
9678
|
}
|
|
9634
9679
|
nextRender(item) {
|
|
9635
|
-
|
|
9636
|
-
item();
|
|
9637
|
-
}
|
|
9638
|
-
else {
|
|
9639
|
-
this.__nextRenderWait.push(item);
|
|
9640
|
-
}
|
|
9680
|
+
this.__nextRenderWait.push(item);
|
|
9641
9681
|
}
|
|
9642
9682
|
__checkUpdateLayout() {
|
|
9643
9683
|
this.__layout.update();
|
|
@@ -9650,7 +9690,8 @@ let Leafer = class Leafer extends Group {
|
|
|
9650
9690
|
this.once(LeaferEvent.START, () => Run.end(runId));
|
|
9651
9691
|
this.once(LayoutEvent.END, () => this.__onReady());
|
|
9652
9692
|
this.once(RenderEvent.START, () => this.__onCreated());
|
|
9653
|
-
this.
|
|
9693
|
+
this.once(RenderEvent.END, () => this.__onViewReady());
|
|
9694
|
+
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));
|
|
9654
9695
|
}
|
|
9655
9696
|
__removeListenEvents() {
|
|
9656
9697
|
this.off_(this.__eventIds);
|
|
@@ -9777,9 +9818,6 @@ let App = class App extends Leafer {
|
|
|
9777
9818
|
if (this.children.every(child => child.viewReady))
|
|
9778
9819
|
super.__onViewReady();
|
|
9779
9820
|
}
|
|
9780
|
-
__checkViewCompleted() {
|
|
9781
|
-
return this.children.every(item => item.viewCompleted);
|
|
9782
|
-
}
|
|
9783
9821
|
__onChildRenderEnd(e) {
|
|
9784
9822
|
this.renderer.addBlock(e.renderBounds);
|
|
9785
9823
|
if (this.viewReady)
|
|
@@ -9809,7 +9847,7 @@ let App = class App extends Leafer {
|
|
|
9809
9847
|
__listenChildEvents(leafer) {
|
|
9810
9848
|
leafer.once(LayoutEvent.END, () => this.__onReady());
|
|
9811
9849
|
leafer.once(RenderEvent.START, () => this.__onCreated());
|
|
9812
|
-
leafer.once(RenderEvent.END, (
|
|
9850
|
+
leafer.once(RenderEvent.END, () => this.__onViewReady());
|
|
9813
9851
|
if (this.realCanvas)
|
|
9814
9852
|
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9815
9853
|
}
|
|
@@ -9818,6 +9856,7 @@ App = __decorate([
|
|
|
9818
9856
|
registerUI()
|
|
9819
9857
|
], App);
|
|
9820
9858
|
|
|
9859
|
+
let origin = {};
|
|
9821
9860
|
const { get: get$4, rotateOfOuter: rotateOfOuter$2, translate: translate$1, scaleOfOuter: scaleOfOuter$2, scale: scaleHelper, rotate } = MatrixHelper;
|
|
9822
9861
|
function fillOrFitMode(data, mode, box, width, height, rotation) {
|
|
9823
9862
|
const transform = get$4();
|
|
@@ -9834,13 +9873,13 @@ function fillOrFitMode(data, mode, box, width, height, rotation) {
|
|
|
9834
9873
|
data.scaleX = data.scaleY = scale;
|
|
9835
9874
|
data.transform = transform;
|
|
9836
9875
|
}
|
|
9837
|
-
function clipMode(data, box,
|
|
9876
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
9838
9877
|
const transform = get$4();
|
|
9839
9878
|
translate$1(transform, box.x, box.y);
|
|
9840
|
-
if (
|
|
9841
|
-
translate$1(transform,
|
|
9842
|
-
if (
|
|
9843
|
-
|
|
9879
|
+
if (x || y)
|
|
9880
|
+
translate$1(transform, x, y);
|
|
9881
|
+
if (scaleX) {
|
|
9882
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
9844
9883
|
data.scaleX = transform.a;
|
|
9845
9884
|
data.scaleY = transform.d;
|
|
9846
9885
|
}
|
|
@@ -9848,7 +9887,7 @@ function clipMode(data, box, offset, scale, rotation) {
|
|
|
9848
9887
|
rotate(transform, rotation);
|
|
9849
9888
|
data.transform = transform;
|
|
9850
9889
|
}
|
|
9851
|
-
function repeatMode(data, box, width, height,
|
|
9890
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation) {
|
|
9852
9891
|
const transform = get$4();
|
|
9853
9892
|
if (rotation) {
|
|
9854
9893
|
rotate(transform, rotation);
|
|
@@ -9864,10 +9903,15 @@ function repeatMode(data, box, width, height, scale, rotation) {
|
|
|
9864
9903
|
break;
|
|
9865
9904
|
}
|
|
9866
9905
|
}
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9906
|
+
origin.x = box.x;
|
|
9907
|
+
origin.y = box.y;
|
|
9908
|
+
if (x || y)
|
|
9909
|
+
origin.x += x, origin.y += y;
|
|
9910
|
+
translate$1(transform, origin.x, origin.y);
|
|
9911
|
+
if (scaleX) {
|
|
9912
|
+
scaleOfOuter$2(transform, origin, scaleX, scaleY);
|
|
9913
|
+
data.scaleX = scaleX;
|
|
9914
|
+
data.scaleY = scaleY;
|
|
9871
9915
|
}
|
|
9872
9916
|
data.transform = transform;
|
|
9873
9917
|
}
|
|
@@ -9875,11 +9919,22 @@ function repeatMode(data, box, width, height, scale, rotation) {
|
|
|
9875
9919
|
const { get: get$3, translate } = MatrixHelper;
|
|
9876
9920
|
function createData(leafPaint, image, paint, box) {
|
|
9877
9921
|
let { width, height } = image;
|
|
9878
|
-
const { opacity, mode, offset, scale, rotation, blendMode } = paint;
|
|
9922
|
+
const { opacity, mode, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
9879
9923
|
const sameBox = box.width === width && box.height === height;
|
|
9880
9924
|
if (blendMode)
|
|
9881
9925
|
leafPaint.blendMode = blendMode;
|
|
9882
9926
|
const data = leafPaint.data = { mode };
|
|
9927
|
+
let x, y, scaleX, scaleY;
|
|
9928
|
+
if (offset)
|
|
9929
|
+
x = offset.x, y = offset.y;
|
|
9930
|
+
if (size) {
|
|
9931
|
+
scaleX = (typeof size === 'number' ? size : size.width) / width;
|
|
9932
|
+
scaleY = (typeof size === 'number' ? size : size.height) / height;
|
|
9933
|
+
}
|
|
9934
|
+
else if (scale) {
|
|
9935
|
+
scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
9936
|
+
scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
9937
|
+
}
|
|
9883
9938
|
switch (mode) {
|
|
9884
9939
|
case 'strench':
|
|
9885
9940
|
if (!sameBox)
|
|
@@ -9890,12 +9945,14 @@ function createData(leafPaint, image, paint, box) {
|
|
|
9890
9945
|
}
|
|
9891
9946
|
break;
|
|
9892
9947
|
case 'clip':
|
|
9893
|
-
if (offset ||
|
|
9894
|
-
clipMode(data, box,
|
|
9948
|
+
if (offset || scaleX || rotation)
|
|
9949
|
+
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
9895
9950
|
break;
|
|
9896
9951
|
case 'repeat':
|
|
9897
|
-
if (!sameBox ||
|
|
9898
|
-
repeatMode(data, box, width, height,
|
|
9952
|
+
if (!sameBox || scaleX || rotation)
|
|
9953
|
+
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation);
|
|
9954
|
+
if (!repeat)
|
|
9955
|
+
data.repeat = 'repeat';
|
|
9899
9956
|
break;
|
|
9900
9957
|
case 'fit':
|
|
9901
9958
|
case 'cover':
|
|
@@ -9907,6 +9964,8 @@ function createData(leafPaint, image, paint, box) {
|
|
|
9907
9964
|
data.height = height;
|
|
9908
9965
|
if (opacity)
|
|
9909
9966
|
data.opacity = opacity;
|
|
9967
|
+
if (repeat)
|
|
9968
|
+
data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
|
|
9910
9969
|
}
|
|
9911
9970
|
|
|
9912
9971
|
function image(ui, attrName, attrValue, box, firstUse) {
|
|
@@ -9953,11 +10012,11 @@ function hasNaturalSize(ui, attrName, image) {
|
|
|
9953
10012
|
d.__naturalWidth = image.width;
|
|
9954
10013
|
d.__naturalHeight = image.height;
|
|
9955
10014
|
if (!d.__getInput('width') || !d.__getInput('height')) {
|
|
10015
|
+
ui.forceUpdate('width');
|
|
9956
10016
|
if (ui.__proxyData) {
|
|
9957
10017
|
ui.setProxyAttr('width', ui.__.width);
|
|
9958
10018
|
ui.setProxyAttr('height', ui.__.height);
|
|
9959
10019
|
}
|
|
9960
|
-
ui.forceUpdate('width');
|
|
9961
10020
|
return false;
|
|
9962
10021
|
}
|
|
9963
10022
|
}
|
|
@@ -9976,7 +10035,7 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
9976
10035
|
scaleX = Math.abs(scaleX);
|
|
9977
10036
|
scaleY = Math.abs(scaleY);
|
|
9978
10037
|
const { image, data } = paint;
|
|
9979
|
-
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform,
|
|
10038
|
+
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
|
|
9980
10039
|
if (sx) {
|
|
9981
10040
|
imageMatrix = get$2();
|
|
9982
10041
|
copy$1(imageMatrix, transform);
|
|
@@ -9989,7 +10048,7 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
9989
10048
|
width *= scaleX;
|
|
9990
10049
|
height *= scaleY;
|
|
9991
10050
|
const size = width * height;
|
|
9992
|
-
if (
|
|
10051
|
+
if (!repeat) {
|
|
9993
10052
|
if (size > Platform.image.maxCacheSize)
|
|
9994
10053
|
return false;
|
|
9995
10054
|
}
|
|
@@ -10019,7 +10078,7 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
10019
10078
|
}
|
|
10020
10079
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
10021
10080
|
}
|
|
10022
|
-
const pattern = Platform.canvas.createPattern(image.getCanvas(width < 1 ? 1 : width, height < 1 ? 1 : height, opacity),
|
|
10081
|
+
const pattern = Platform.canvas.createPattern(image.getCanvas(width < 1 ? 1 : width, height < 1 ? 1 : height, opacity), repeat || (Platform.origin.noRepeat || 'no-repeat'));
|
|
10023
10082
|
try {
|
|
10024
10083
|
if (paint.transform)
|
|
10025
10084
|
paint.transform = null;
|
|
@@ -10047,7 +10106,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
|
|
|
10047
10106
|
else {
|
|
10048
10107
|
const { data } = paint;
|
|
10049
10108
|
if (allowPaint) {
|
|
10050
|
-
if (data.
|
|
10109
|
+
if (!data.repeat) {
|
|
10051
10110
|
let { width, height } = data;
|
|
10052
10111
|
width *= abs(scaleX) * canvas.pixelRatio;
|
|
10053
10112
|
height *= abs(scaleY) * canvas.pixelRatio;
|
|
@@ -11047,6 +11106,7 @@ function decorationText(drawData, style) {
|
|
|
11047
11106
|
}
|
|
11048
11107
|
}
|
|
11049
11108
|
|
|
11109
|
+
const { top, right, bottom, left } = Direction4;
|
|
11050
11110
|
const TextConvert = {
|
|
11051
11111
|
getDrawData(content, style) {
|
|
11052
11112
|
if (typeof content !== 'string')
|
|
@@ -11054,16 +11114,15 @@ const TextConvert = {
|
|
|
11054
11114
|
let x = 0, y = 0;
|
|
11055
11115
|
let width = style.__getInput('width') || 0;
|
|
11056
11116
|
let height = style.__getInput('height') || 0;
|
|
11057
|
-
const { textDecoration, __font, padding } = style;
|
|
11117
|
+
const { textDecoration, __font, __padding: padding } = style;
|
|
11058
11118
|
if (padding) {
|
|
11059
|
-
const [top, right, bottom, left] = MathHelper.fourNumber(padding);
|
|
11060
11119
|
if (width) {
|
|
11061
|
-
x = left;
|
|
11062
|
-
width -= (right + left);
|
|
11120
|
+
x = padding[left];
|
|
11121
|
+
width -= (padding[right] + padding[left]);
|
|
11063
11122
|
}
|
|
11064
11123
|
if (height) {
|
|
11065
|
-
y = top;
|
|
11066
|
-
height -= (top + bottom);
|
|
11124
|
+
y = padding[top];
|
|
11125
|
+
height -= (padding[top] + padding[bottom]);
|
|
11067
11126
|
}
|
|
11068
11127
|
}
|
|
11069
11128
|
const drawData = {
|
|
@@ -11073,6 +11132,8 @@ const TextConvert = {
|
|
|
11073
11132
|
font: Platform.canvas.font = __font
|
|
11074
11133
|
};
|
|
11075
11134
|
createRows(drawData, content, style);
|
|
11135
|
+
if (padding)
|
|
11136
|
+
padAutoText(padding, drawData, style, width, height);
|
|
11076
11137
|
layoutText(drawData, style);
|
|
11077
11138
|
layoutChar(drawData, style, width);
|
|
11078
11139
|
if (drawData.overflow)
|
|
@@ -11082,6 +11143,32 @@ const TextConvert = {
|
|
|
11082
11143
|
return drawData;
|
|
11083
11144
|
}
|
|
11084
11145
|
};
|
|
11146
|
+
function padAutoText(padding, drawData, style, width, height) {
|
|
11147
|
+
if (!width) {
|
|
11148
|
+
switch (style.textAlign) {
|
|
11149
|
+
case 'left':
|
|
11150
|
+
offsetText(drawData, 'x', padding[left]);
|
|
11151
|
+
break;
|
|
11152
|
+
case 'right':
|
|
11153
|
+
offsetText(drawData, 'x', -padding[right]);
|
|
11154
|
+
}
|
|
11155
|
+
}
|
|
11156
|
+
if (!height) {
|
|
11157
|
+
switch (style.verticalAlign) {
|
|
11158
|
+
case 'top':
|
|
11159
|
+
offsetText(drawData, 'y', padding[top]);
|
|
11160
|
+
break;
|
|
11161
|
+
case 'bottom':
|
|
11162
|
+
offsetText(drawData, 'y', -padding[bottom]);
|
|
11163
|
+
}
|
|
11164
|
+
}
|
|
11165
|
+
}
|
|
11166
|
+
function offsetText(drawData, attrName, value) {
|
|
11167
|
+
const { bounds, rows } = drawData;
|
|
11168
|
+
bounds[attrName] += value;
|
|
11169
|
+
for (let i = 0; i < rows.length; i++)
|
|
11170
|
+
rows[i][attrName] += value;
|
|
11171
|
+
}
|
|
11085
11172
|
|
|
11086
11173
|
const ColorConvert = {
|
|
11087
11174
|
string(color, opacity) {
|
|
@@ -11165,4 +11252,4 @@ Object.assign(Export$1, Export);
|
|
|
11165
11252
|
|
|
11166
11253
|
useCanvas();
|
|
11167
11254
|
|
|
11168
|
-
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$1 as 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 };
|
|
11255
|
+
export { Animate, AnimateEvent, App, AroundHelper, ArrowData, 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$1 as 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 };
|