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.js
CHANGED
|
@@ -104,14 +104,14 @@ var LeaferUI = (function (exports) {
|
|
|
104
104
|
const { sin: sin$5, cos: cos$5, acos, sqrt: sqrt$3 } = Math;
|
|
105
105
|
const { float } = MathHelper;
|
|
106
106
|
const tempPoint$2 = {};
|
|
107
|
-
function get$
|
|
107
|
+
function get$6() {
|
|
108
108
|
return { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 };
|
|
109
109
|
}
|
|
110
110
|
function getWorld() {
|
|
111
|
-
return Object.assign(Object.assign({}, get$
|
|
111
|
+
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 });
|
|
112
112
|
}
|
|
113
113
|
const MatrixHelper = {
|
|
114
|
-
defaultMatrix: get$
|
|
114
|
+
defaultMatrix: get$6(),
|
|
115
115
|
defaultWorld: getWorld(),
|
|
116
116
|
tempMatrix: {},
|
|
117
117
|
set(t, a = 1, b = 0, c = 0, d = 1, e = 0, f = 0) {
|
|
@@ -122,7 +122,7 @@ var LeaferUI = (function (exports) {
|
|
|
122
122
|
t.e = e;
|
|
123
123
|
t.f = f;
|
|
124
124
|
},
|
|
125
|
-
get: get$
|
|
125
|
+
get: get$6,
|
|
126
126
|
getWorld,
|
|
127
127
|
copy(t, matrix) {
|
|
128
128
|
t.a = matrix.a;
|
|
@@ -685,7 +685,7 @@ var LeaferUI = (function (exports) {
|
|
|
685
685
|
|
|
686
686
|
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$3 } = TwoPointBoundsHelper;
|
|
687
687
|
const { toOuterPoint: toOuterPoint$1 } = MatrixHelper;
|
|
688
|
-
let right, bottom, boundsRight, boundsBottom;
|
|
688
|
+
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
689
689
|
const point = {};
|
|
690
690
|
const toPoint$1 = {};
|
|
691
691
|
const BoundsHelper = {
|
|
@@ -828,16 +828,16 @@ var LeaferUI = (function (exports) {
|
|
|
828
828
|
}
|
|
829
829
|
},
|
|
830
830
|
add(t, bounds) {
|
|
831
|
-
right = t.x + t.width;
|
|
832
|
-
bottom = t.y + t.height;
|
|
831
|
+
right$1 = t.x + t.width;
|
|
832
|
+
bottom$1 = t.y + t.height;
|
|
833
833
|
boundsRight = bounds.x + bounds.width;
|
|
834
834
|
boundsBottom = bounds.y + bounds.height;
|
|
835
|
-
right = right > boundsRight ? right : boundsRight;
|
|
836
|
-
bottom = bottom > boundsBottom ? bottom : boundsBottom;
|
|
835
|
+
right$1 = right$1 > boundsRight ? right$1 : boundsRight;
|
|
836
|
+
bottom$1 = bottom$1 > boundsBottom ? bottom$1 : boundsBottom;
|
|
837
837
|
t.x = t.x < bounds.x ? t.x : bounds.x;
|
|
838
838
|
t.y = t.y < bounds.y ? t.y : bounds.y;
|
|
839
|
-
t.width = right - t.x;
|
|
840
|
-
t.height = bottom - t.y;
|
|
839
|
+
t.width = right$1 - t.x;
|
|
840
|
+
t.height = bottom$1 - t.y;
|
|
841
841
|
},
|
|
842
842
|
addList(t, list) {
|
|
843
843
|
B.setListWithFn(t, list, undefined, true);
|
|
@@ -903,16 +903,16 @@ var LeaferUI = (function (exports) {
|
|
|
903
903
|
if (otherMatrix)
|
|
904
904
|
other = B.tempToOuterOf(other, otherMatrix);
|
|
905
905
|
let { x, y, width, height } = other;
|
|
906
|
-
right = x + width;
|
|
907
|
-
bottom = y + height;
|
|
906
|
+
right$1 = x + width;
|
|
907
|
+
bottom$1 = y + height;
|
|
908
908
|
boundsRight = t.x + t.width;
|
|
909
909
|
boundsBottom = t.y + t.height;
|
|
910
910
|
x = x > t.x ? x : t.x;
|
|
911
911
|
y = y > t.y ? y : t.y;
|
|
912
|
-
right = right < boundsRight ? right : boundsRight;
|
|
913
|
-
bottom = bottom < boundsBottom ? bottom : boundsBottom;
|
|
914
|
-
width = right - x;
|
|
915
|
-
height = bottom - y;
|
|
912
|
+
right$1 = right$1 < boundsRight ? right$1 : boundsRight;
|
|
913
|
+
bottom$1 = bottom$1 < boundsBottom ? bottom$1 : boundsBottom;
|
|
914
|
+
width = right$1 - x;
|
|
915
|
+
height = bottom$1 - y;
|
|
916
916
|
return { x, y, width, height };
|
|
917
917
|
},
|
|
918
918
|
intersect(t, other, otherMatrix) {
|
|
@@ -1056,25 +1056,55 @@ var LeaferUI = (function (exports) {
|
|
|
1056
1056
|
}
|
|
1057
1057
|
}
|
|
1058
1058
|
|
|
1059
|
-
|
|
1059
|
+
exports.Direction4 = void 0;
|
|
1060
|
+
(function (Direction4) {
|
|
1061
|
+
Direction4[Direction4["top"] = 0] = "top";
|
|
1062
|
+
Direction4[Direction4["right"] = 1] = "right";
|
|
1063
|
+
Direction4[Direction4["bottom"] = 2] = "bottom";
|
|
1064
|
+
Direction4[Direction4["left"] = 3] = "left";
|
|
1065
|
+
})(exports.Direction4 || (exports.Direction4 = {}));
|
|
1066
|
+
exports.Direction9 = void 0;
|
|
1067
|
+
(function (Direction9) {
|
|
1068
|
+
Direction9[Direction9["topLeft"] = 0] = "topLeft";
|
|
1069
|
+
Direction9[Direction9["top"] = 1] = "top";
|
|
1070
|
+
Direction9[Direction9["topRight"] = 2] = "topRight";
|
|
1071
|
+
Direction9[Direction9["right"] = 3] = "right";
|
|
1072
|
+
Direction9[Direction9["bottomRight"] = 4] = "bottomRight";
|
|
1073
|
+
Direction9[Direction9["bottom"] = 5] = "bottom";
|
|
1074
|
+
Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
|
|
1075
|
+
Direction9[Direction9["left"] = 7] = "left";
|
|
1076
|
+
Direction9[Direction9["center"] = 8] = "center";
|
|
1077
|
+
})(exports.Direction9 || (exports.Direction9 = {}));
|
|
1078
|
+
|
|
1079
|
+
const directionData = [
|
|
1080
|
+
{ x: 0, y: 0 },
|
|
1081
|
+
{ x: 0.5, y: 0 },
|
|
1082
|
+
{ x: 1, y: 0 },
|
|
1083
|
+
{ x: 1, y: 0.5 },
|
|
1084
|
+
{ x: 1, y: 1 },
|
|
1085
|
+
{ x: 0.5, y: 1 },
|
|
1086
|
+
{ x: 0, y: 1 },
|
|
1087
|
+
{ x: 0, y: 0.5 },
|
|
1088
|
+
{ x: 0.5, y: 0.5 }
|
|
1089
|
+
];
|
|
1060
1090
|
const AroundHelper = {
|
|
1061
|
-
|
|
1091
|
+
directionData,
|
|
1062
1092
|
tempPoint: {},
|
|
1093
|
+
get: get$5,
|
|
1063
1094
|
toPoint(around, bounds, to, onlySize) {
|
|
1064
1095
|
to || (to = {});
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
break;
|
|
1069
|
-
}
|
|
1070
|
-
to.x = around.x * bounds.width;
|
|
1071
|
-
to.y = around.y * bounds.height;
|
|
1096
|
+
const point = get$5(around);
|
|
1097
|
+
to.x = point.x * bounds.width;
|
|
1098
|
+
to.y = point.y * bounds.height;
|
|
1072
1099
|
if (!onlySize) {
|
|
1073
1100
|
to.x += bounds.x;
|
|
1074
1101
|
to.y += bounds.y;
|
|
1075
1102
|
}
|
|
1076
1103
|
}
|
|
1077
1104
|
};
|
|
1105
|
+
function get$5(around) {
|
|
1106
|
+
return typeof around === 'string' ? directionData[exports.Direction9[around]] : around;
|
|
1107
|
+
}
|
|
1078
1108
|
|
|
1079
1109
|
const StringNumberMap = {
|
|
1080
1110
|
'0': 1,
|
|
@@ -3089,7 +3119,6 @@ var LeaferUI = (function (exports) {
|
|
|
3089
3119
|
break;
|
|
3090
3120
|
case G$1:
|
|
3091
3121
|
scalePoints(data, scaleX, scaleY, i, 2);
|
|
3092
|
-
console.log('G');
|
|
3093
3122
|
i += 9;
|
|
3094
3123
|
break;
|
|
3095
3124
|
case F$1:
|
|
@@ -3804,7 +3833,7 @@ var LeaferUI = (function (exports) {
|
|
|
3804
3833
|
LayoutEvent.REQUEST = 'layout.request';
|
|
3805
3834
|
LayoutEvent.START = 'layout.start';
|
|
3806
3835
|
LayoutEvent.BEFORE = 'layout.before';
|
|
3807
|
-
LayoutEvent.LAYOUT = 'layout
|
|
3836
|
+
LayoutEvent.LAYOUT = 'layout';
|
|
3808
3837
|
LayoutEvent.AFTER = 'layout.after';
|
|
3809
3838
|
LayoutEvent.AGAIN = 'layout.again';
|
|
3810
3839
|
LayoutEvent.END = 'layout.end';
|
|
@@ -4453,13 +4482,10 @@ var LeaferUI = (function (exports) {
|
|
|
4453
4482
|
}
|
|
4454
4483
|
},
|
|
4455
4484
|
worldHittable(t) {
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
let { parent } = t;
|
|
4459
|
-
while (parent) {
|
|
4460
|
-
if (!parent.__.hittable || !parent.__.hitChildren)
|
|
4485
|
+
while (t) {
|
|
4486
|
+
if (!t.__.hittable)
|
|
4461
4487
|
return false;
|
|
4462
|
-
|
|
4488
|
+
t = t.parent;
|
|
4463
4489
|
}
|
|
4464
4490
|
return true;
|
|
4465
4491
|
},
|
|
@@ -5912,7 +5938,7 @@ var LeaferUI = (function (exports) {
|
|
|
5912
5938
|
canvas.setWorld(this.__world, options.matrix);
|
|
5913
5939
|
canvas.opacity = this.__worldOpacity;
|
|
5914
5940
|
if (this.__.__single) {
|
|
5915
|
-
const tempCanvas = canvas.getSameCanvas(true);
|
|
5941
|
+
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
5916
5942
|
this.__draw(tempCanvas, options);
|
|
5917
5943
|
const blendMode = this.__.isEraser ? 'destination-out' : this.__.blendMode;
|
|
5918
5944
|
if (this.__worldFlipped || options.matrix) {
|
|
@@ -5989,7 +6015,7 @@ var LeaferUI = (function (exports) {
|
|
|
5989
6015
|
if (this.__worldOpacity) {
|
|
5990
6016
|
if (this.__.__single) {
|
|
5991
6017
|
canvas.resetTransform();
|
|
5992
|
-
const tempCanvas = canvas.getSameCanvas();
|
|
6018
|
+
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
5993
6019
|
this.__renderBranch(tempCanvas, options);
|
|
5994
6020
|
canvas.opacity = this.__worldOpacity;
|
|
5995
6021
|
const blendMode = this.__.isEraser ? 'destination-out' : this.__.blendMode;
|
|
@@ -7335,6 +7361,8 @@ var LeaferUI = (function (exports) {
|
|
|
7335
7361
|
const { style } = this.view;
|
|
7336
7362
|
style.display || (style.display = 'block');
|
|
7337
7363
|
this.parentView = this.view.parentElement;
|
|
7364
|
+
if (this.parentView)
|
|
7365
|
+
this.parentView.style.userSelect = 'none';
|
|
7338
7366
|
if (Platform.syncDomFont && !this.parentView) {
|
|
7339
7367
|
this.view.style.display = 'none';
|
|
7340
7368
|
document.body.appendChild(this.view);
|
|
@@ -8060,6 +8088,9 @@ var LeaferUI = (function (exports) {
|
|
|
8060
8088
|
class LineData extends UIData {
|
|
8061
8089
|
}
|
|
8062
8090
|
|
|
8091
|
+
class ArrowData extends LineData {
|
|
8092
|
+
}
|
|
8093
|
+
|
|
8063
8094
|
class RectData extends UIData {
|
|
8064
8095
|
get __boxStroke() { return true; }
|
|
8065
8096
|
}
|
|
@@ -8118,6 +8149,25 @@ var LeaferUI = (function (exports) {
|
|
|
8118
8149
|
}
|
|
8119
8150
|
|
|
8120
8151
|
class ImageData extends RectData {
|
|
8152
|
+
setUrl(value) {
|
|
8153
|
+
this.__setImageFill(value);
|
|
8154
|
+
this._url = value;
|
|
8155
|
+
}
|
|
8156
|
+
__setImageFill(value) {
|
|
8157
|
+
if (this.__leaf.image)
|
|
8158
|
+
this.__leaf.image = null;
|
|
8159
|
+
this.fill = value ? { type: 'image', mode: 'strench', url: value } : undefined;
|
|
8160
|
+
}
|
|
8161
|
+
__getData() {
|
|
8162
|
+
const data = super.__getData();
|
|
8163
|
+
delete data.fill;
|
|
8164
|
+
return data;
|
|
8165
|
+
}
|
|
8166
|
+
__getInputData() {
|
|
8167
|
+
const data = super.__getInputData();
|
|
8168
|
+
delete data.fill;
|
|
8169
|
+
return data;
|
|
8170
|
+
}
|
|
8121
8171
|
}
|
|
8122
8172
|
|
|
8123
8173
|
class CanvasData extends RectData {
|
|
@@ -8364,14 +8414,15 @@ var LeaferUI = (function (exports) {
|
|
|
8364
8414
|
findOne(condition, options) {
|
|
8365
8415
|
return this.leafer ? this.leafer.selector.getBy(condition, this, true, options) : null;
|
|
8366
8416
|
}
|
|
8367
|
-
getPath(curve) {
|
|
8368
|
-
|
|
8417
|
+
getPath(curve, pathForRender) {
|
|
8418
|
+
this.__layout.update();
|
|
8419
|
+
let path = pathForRender ? this.__.__pathForRender : this.__.path;
|
|
8369
8420
|
if (!path)
|
|
8370
|
-
|
|
8421
|
+
this.__drawPathByBox(new PathCreator(path = []));
|
|
8371
8422
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
8372
8423
|
}
|
|
8373
|
-
getPathString(curve) {
|
|
8374
|
-
return PathConvert.stringify(this.getPath(curve));
|
|
8424
|
+
getPathString(curve, pathForRender) {
|
|
8425
|
+
return PathConvert.stringify(this.getPath(curve, pathForRender));
|
|
8375
8426
|
}
|
|
8376
8427
|
__onUpdateSize() {
|
|
8377
8428
|
if (this.__.__input) {
|
|
@@ -8543,6 +8594,12 @@ var LeaferUI = (function (exports) {
|
|
|
8543
8594
|
__decorate([
|
|
8544
8595
|
strokeType(10)
|
|
8545
8596
|
], exports.UI.prototype, "miterLimit", void 0);
|
|
8597
|
+
__decorate([
|
|
8598
|
+
strokeType('none')
|
|
8599
|
+
], exports.UI.prototype, "startArrow", void 0);
|
|
8600
|
+
__decorate([
|
|
8601
|
+
strokeType('none')
|
|
8602
|
+
], exports.UI.prototype, "endArrow", void 0);
|
|
8546
8603
|
__decorate([
|
|
8547
8604
|
pathType(0)
|
|
8548
8605
|
], exports.UI.prototype, "cornerRadius", void 0);
|
|
@@ -9039,26 +9096,10 @@ var LeaferUI = (function (exports) {
|
|
|
9039
9096
|
get ready() { return this.image ? this.image.ready : false; }
|
|
9040
9097
|
constructor(data) {
|
|
9041
9098
|
super(data);
|
|
9042
|
-
|
|
9043
|
-
|
|
9044
|
-
|
|
9045
|
-
|
|
9046
|
-
const fill = this.fill;
|
|
9047
|
-
if (fill) {
|
|
9048
|
-
if (fill.url !== url)
|
|
9049
|
-
update = true;
|
|
9050
|
-
}
|
|
9051
|
-
else {
|
|
9052
|
-
if (url)
|
|
9053
|
-
update = true;
|
|
9054
|
-
}
|
|
9055
|
-
if (update) {
|
|
9056
|
-
if (this.image)
|
|
9057
|
-
this.image = null;
|
|
9058
|
-
this.fill = url ? { type: 'image', mode: 'strench', url } : undefined;
|
|
9059
|
-
this.once(ImageEvent.LOADED, (e) => this.image = e.image);
|
|
9060
|
-
}
|
|
9061
|
-
super.__updateBoxBounds();
|
|
9099
|
+
this.on(ImageEvent.LOADED, (e) => {
|
|
9100
|
+
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
9101
|
+
this.image = e.image;
|
|
9102
|
+
});
|
|
9062
9103
|
}
|
|
9063
9104
|
destroy() {
|
|
9064
9105
|
this.image = null;
|
|
@@ -9188,11 +9229,12 @@ var LeaferUI = (function (exports) {
|
|
|
9188
9229
|
__updateBoxBounds() {
|
|
9189
9230
|
const data = this.__;
|
|
9190
9231
|
const layout = this.__layout;
|
|
9191
|
-
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow } = data;
|
|
9232
|
+
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data;
|
|
9192
9233
|
const autoWidth = data.__autoWidth;
|
|
9193
9234
|
const autoHeight = data.__autoHeight;
|
|
9194
9235
|
data.__lineHeight = UnitConvert.number(lineHeight, fontSize);
|
|
9195
9236
|
data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
|
|
9237
|
+
data.__padding = padding ? MathHelper.fourNumber(padding) : undefined;
|
|
9196
9238
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
9197
9239
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
9198
9240
|
data.__clipText = textOverflow !== 'show' && !data.__autoBounds;
|
|
@@ -9206,9 +9248,8 @@ var LeaferUI = (function (exports) {
|
|
|
9206
9248
|
b.y = autoHeight ? bounds.y : 0;
|
|
9207
9249
|
b.width = autoWidth ? bounds.width : data.width;
|
|
9208
9250
|
b.height = autoHeight ? bounds.height : data.height;
|
|
9209
|
-
const { padding } = data;
|
|
9210
9251
|
if (padding) {
|
|
9211
|
-
const [top, right, bottom, left] =
|
|
9252
|
+
const [top, right, bottom, left] = data.__padding;
|
|
9212
9253
|
if (autoWidth) {
|
|
9213
9254
|
b.x -= left;
|
|
9214
9255
|
b.width += (right + left);
|
|
@@ -9393,6 +9434,7 @@ var LeaferUI = (function (exports) {
|
|
|
9393
9434
|
get __tag() { return 'Leafer'; }
|
|
9394
9435
|
get isApp() { return false; }
|
|
9395
9436
|
get app() { return this.parent || this; }
|
|
9437
|
+
get imageReady() { return this.viewReady && ImageManager.isComplete; }
|
|
9396
9438
|
get layoutLocked() { return !this.layouter.running; }
|
|
9397
9439
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
9398
9440
|
constructor(userConfig, data) {
|
|
@@ -9595,23 +9637,26 @@ var LeaferUI = (function (exports) {
|
|
|
9595
9637
|
this.emitLeafer(LeaferEvent.VIEW_READY);
|
|
9596
9638
|
WaitHelper.run(this.__viewReadyWait);
|
|
9597
9639
|
}
|
|
9598
|
-
|
|
9599
|
-
if (
|
|
9600
|
-
this.
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
this.
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9640
|
+
__onAnimateFrame() {
|
|
9641
|
+
if (this.viewReady) {
|
|
9642
|
+
if (this.__nextRenderWait.length)
|
|
9643
|
+
WaitHelper.run(this.__nextRenderWait);
|
|
9644
|
+
const { imageReady } = this;
|
|
9645
|
+
if (imageReady && !this.viewCompleted)
|
|
9646
|
+
this.__checkViewCompleted();
|
|
9647
|
+
if (!imageReady)
|
|
9648
|
+
this.viewCompleted = false;
|
|
9649
|
+
}
|
|
9650
|
+
}
|
|
9651
|
+
__checkViewCompleted(emit = true) {
|
|
9652
|
+
this.nextRender(() => {
|
|
9653
|
+
if (this.imageReady) {
|
|
9654
|
+
if (emit)
|
|
9655
|
+
this.emitLeafer(LeaferEvent.VIEW_COMPLETED);
|
|
9656
|
+
WaitHelper.run(this.__viewCompletedWait);
|
|
9657
|
+
this.viewCompleted = true;
|
|
9658
|
+
}
|
|
9659
|
+
});
|
|
9615
9660
|
}
|
|
9616
9661
|
__onWatchData() {
|
|
9617
9662
|
if (this.watcher.childrenChanged && this.interaction) {
|
|
@@ -9625,22 +9670,17 @@ var LeaferUI = (function (exports) {
|
|
|
9625
9670
|
this.viewReady ? item() : this.__viewReadyWait.push(item);
|
|
9626
9671
|
}
|
|
9627
9672
|
waitViewCompleted(item) {
|
|
9673
|
+
this.__viewCompletedWait.push(item);
|
|
9628
9674
|
if (this.viewCompleted) {
|
|
9629
|
-
|
|
9675
|
+
this.__checkViewCompleted(false);
|
|
9630
9676
|
}
|
|
9631
9677
|
else {
|
|
9632
|
-
this.__viewCompletedWait.push(item);
|
|
9633
9678
|
if (!this.running)
|
|
9634
9679
|
this.start();
|
|
9635
9680
|
}
|
|
9636
9681
|
}
|
|
9637
9682
|
nextRender(item) {
|
|
9638
|
-
|
|
9639
|
-
item();
|
|
9640
|
-
}
|
|
9641
|
-
else {
|
|
9642
|
-
this.__nextRenderWait.push(item);
|
|
9643
|
-
}
|
|
9683
|
+
this.__nextRenderWait.push(item);
|
|
9644
9684
|
}
|
|
9645
9685
|
__checkUpdateLayout() {
|
|
9646
9686
|
this.__layout.update();
|
|
@@ -9653,7 +9693,8 @@ var LeaferUI = (function (exports) {
|
|
|
9653
9693
|
this.once(LeaferEvent.START, () => Run.end(runId));
|
|
9654
9694
|
this.once(LayoutEvent.END, () => this.__onReady());
|
|
9655
9695
|
this.once(RenderEvent.START, () => this.__onCreated());
|
|
9656
|
-
this.
|
|
9696
|
+
this.once(RenderEvent.END, () => this.__onViewReady());
|
|
9697
|
+
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));
|
|
9657
9698
|
}
|
|
9658
9699
|
__removeListenEvents() {
|
|
9659
9700
|
this.off_(this.__eventIds);
|
|
@@ -9780,9 +9821,6 @@ var LeaferUI = (function (exports) {
|
|
|
9780
9821
|
if (this.children.every(child => child.viewReady))
|
|
9781
9822
|
super.__onViewReady();
|
|
9782
9823
|
}
|
|
9783
|
-
__checkViewCompleted() {
|
|
9784
|
-
return this.children.every(item => item.viewCompleted);
|
|
9785
|
-
}
|
|
9786
9824
|
__onChildRenderEnd(e) {
|
|
9787
9825
|
this.renderer.addBlock(e.renderBounds);
|
|
9788
9826
|
if (this.viewReady)
|
|
@@ -9812,7 +9850,7 @@ var LeaferUI = (function (exports) {
|
|
|
9812
9850
|
__listenChildEvents(leafer) {
|
|
9813
9851
|
leafer.once(LayoutEvent.END, () => this.__onReady());
|
|
9814
9852
|
leafer.once(RenderEvent.START, () => this.__onCreated());
|
|
9815
|
-
leafer.once(RenderEvent.END, (
|
|
9853
|
+
leafer.once(RenderEvent.END, () => this.__onViewReady());
|
|
9816
9854
|
if (this.realCanvas)
|
|
9817
9855
|
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9818
9856
|
}
|
|
@@ -9821,6 +9859,7 @@ var LeaferUI = (function (exports) {
|
|
|
9821
9859
|
registerUI()
|
|
9822
9860
|
], exports.App);
|
|
9823
9861
|
|
|
9862
|
+
let origin = {};
|
|
9824
9863
|
const { get: get$4, rotateOfOuter: rotateOfOuter$2, translate: translate$1, scaleOfOuter: scaleOfOuter$2, scale: scaleHelper, rotate } = MatrixHelper;
|
|
9825
9864
|
function fillOrFitMode(data, mode, box, width, height, rotation) {
|
|
9826
9865
|
const transform = get$4();
|
|
@@ -9837,13 +9876,13 @@ var LeaferUI = (function (exports) {
|
|
|
9837
9876
|
data.scaleX = data.scaleY = scale;
|
|
9838
9877
|
data.transform = transform;
|
|
9839
9878
|
}
|
|
9840
|
-
function clipMode(data, box,
|
|
9879
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
9841
9880
|
const transform = get$4();
|
|
9842
9881
|
translate$1(transform, box.x, box.y);
|
|
9843
|
-
if (
|
|
9844
|
-
translate$1(transform,
|
|
9845
|
-
if (
|
|
9846
|
-
|
|
9882
|
+
if (x || y)
|
|
9883
|
+
translate$1(transform, x, y);
|
|
9884
|
+
if (scaleX) {
|
|
9885
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
9847
9886
|
data.scaleX = transform.a;
|
|
9848
9887
|
data.scaleY = transform.d;
|
|
9849
9888
|
}
|
|
@@ -9851,7 +9890,7 @@ var LeaferUI = (function (exports) {
|
|
|
9851
9890
|
rotate(transform, rotation);
|
|
9852
9891
|
data.transform = transform;
|
|
9853
9892
|
}
|
|
9854
|
-
function repeatMode(data, box, width, height,
|
|
9893
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation) {
|
|
9855
9894
|
const transform = get$4();
|
|
9856
9895
|
if (rotation) {
|
|
9857
9896
|
rotate(transform, rotation);
|
|
@@ -9867,10 +9906,15 @@ var LeaferUI = (function (exports) {
|
|
|
9867
9906
|
break;
|
|
9868
9907
|
}
|
|
9869
9908
|
}
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9909
|
+
origin.x = box.x;
|
|
9910
|
+
origin.y = box.y;
|
|
9911
|
+
if (x || y)
|
|
9912
|
+
origin.x += x, origin.y += y;
|
|
9913
|
+
translate$1(transform, origin.x, origin.y);
|
|
9914
|
+
if (scaleX) {
|
|
9915
|
+
scaleOfOuter$2(transform, origin, scaleX, scaleY);
|
|
9916
|
+
data.scaleX = scaleX;
|
|
9917
|
+
data.scaleY = scaleY;
|
|
9874
9918
|
}
|
|
9875
9919
|
data.transform = transform;
|
|
9876
9920
|
}
|
|
@@ -9878,11 +9922,22 @@ var LeaferUI = (function (exports) {
|
|
|
9878
9922
|
const { get: get$3, translate } = MatrixHelper;
|
|
9879
9923
|
function createData(leafPaint, image, paint, box) {
|
|
9880
9924
|
let { width, height } = image;
|
|
9881
|
-
const { opacity, mode, offset, scale, rotation, blendMode } = paint;
|
|
9925
|
+
const { opacity, mode, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
9882
9926
|
const sameBox = box.width === width && box.height === height;
|
|
9883
9927
|
if (blendMode)
|
|
9884
9928
|
leafPaint.blendMode = blendMode;
|
|
9885
9929
|
const data = leafPaint.data = { mode };
|
|
9930
|
+
let x, y, scaleX, scaleY;
|
|
9931
|
+
if (offset)
|
|
9932
|
+
x = offset.x, y = offset.y;
|
|
9933
|
+
if (size) {
|
|
9934
|
+
scaleX = (typeof size === 'number' ? size : size.width) / width;
|
|
9935
|
+
scaleY = (typeof size === 'number' ? size : size.height) / height;
|
|
9936
|
+
}
|
|
9937
|
+
else if (scale) {
|
|
9938
|
+
scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
9939
|
+
scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
9940
|
+
}
|
|
9886
9941
|
switch (mode) {
|
|
9887
9942
|
case 'strench':
|
|
9888
9943
|
if (!sameBox)
|
|
@@ -9893,12 +9948,14 @@ var LeaferUI = (function (exports) {
|
|
|
9893
9948
|
}
|
|
9894
9949
|
break;
|
|
9895
9950
|
case 'clip':
|
|
9896
|
-
if (offset ||
|
|
9897
|
-
clipMode(data, box,
|
|
9951
|
+
if (offset || scaleX || rotation)
|
|
9952
|
+
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
9898
9953
|
break;
|
|
9899
9954
|
case 'repeat':
|
|
9900
|
-
if (!sameBox ||
|
|
9901
|
-
repeatMode(data, box, width, height,
|
|
9955
|
+
if (!sameBox || scaleX || rotation)
|
|
9956
|
+
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation);
|
|
9957
|
+
if (!repeat)
|
|
9958
|
+
data.repeat = 'repeat';
|
|
9902
9959
|
break;
|
|
9903
9960
|
case 'fit':
|
|
9904
9961
|
case 'cover':
|
|
@@ -9910,6 +9967,8 @@ var LeaferUI = (function (exports) {
|
|
|
9910
9967
|
data.height = height;
|
|
9911
9968
|
if (opacity)
|
|
9912
9969
|
data.opacity = opacity;
|
|
9970
|
+
if (repeat)
|
|
9971
|
+
data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
|
|
9913
9972
|
}
|
|
9914
9973
|
|
|
9915
9974
|
function image(ui, attrName, attrValue, box, firstUse) {
|
|
@@ -9956,11 +10015,11 @@ var LeaferUI = (function (exports) {
|
|
|
9956
10015
|
d.__naturalWidth = image.width;
|
|
9957
10016
|
d.__naturalHeight = image.height;
|
|
9958
10017
|
if (!d.__getInput('width') || !d.__getInput('height')) {
|
|
10018
|
+
ui.forceUpdate('width');
|
|
9959
10019
|
if (ui.__proxyData) {
|
|
9960
10020
|
ui.setProxyAttr('width', ui.__.width);
|
|
9961
10021
|
ui.setProxyAttr('height', ui.__.height);
|
|
9962
10022
|
}
|
|
9963
|
-
ui.forceUpdate('width');
|
|
9964
10023
|
return false;
|
|
9965
10024
|
}
|
|
9966
10025
|
}
|
|
@@ -9979,7 +10038,7 @@ var LeaferUI = (function (exports) {
|
|
|
9979
10038
|
scaleX = Math.abs(scaleX);
|
|
9980
10039
|
scaleY = Math.abs(scaleY);
|
|
9981
10040
|
const { image, data } = paint;
|
|
9982
|
-
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform,
|
|
10041
|
+
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
|
|
9983
10042
|
if (sx) {
|
|
9984
10043
|
imageMatrix = get$2();
|
|
9985
10044
|
copy$1(imageMatrix, transform);
|
|
@@ -9992,7 +10051,7 @@ var LeaferUI = (function (exports) {
|
|
|
9992
10051
|
width *= scaleX;
|
|
9993
10052
|
height *= scaleY;
|
|
9994
10053
|
const size = width * height;
|
|
9995
|
-
if (
|
|
10054
|
+
if (!repeat) {
|
|
9996
10055
|
if (size > Platform.image.maxCacheSize)
|
|
9997
10056
|
return false;
|
|
9998
10057
|
}
|
|
@@ -10022,7 +10081,7 @@ var LeaferUI = (function (exports) {
|
|
|
10022
10081
|
}
|
|
10023
10082
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
10024
10083
|
}
|
|
10025
|
-
const pattern = Platform.canvas.createPattern(image.getCanvas(width < 1 ? 1 : width, height < 1 ? 1 : height, opacity),
|
|
10084
|
+
const pattern = Platform.canvas.createPattern(image.getCanvas(width < 1 ? 1 : width, height < 1 ? 1 : height, opacity), repeat || (Platform.origin.noRepeat || 'no-repeat'));
|
|
10026
10085
|
try {
|
|
10027
10086
|
if (paint.transform)
|
|
10028
10087
|
paint.transform = null;
|
|
@@ -10050,7 +10109,7 @@ var LeaferUI = (function (exports) {
|
|
|
10050
10109
|
else {
|
|
10051
10110
|
const { data } = paint;
|
|
10052
10111
|
if (allowPaint) {
|
|
10053
|
-
if (data.
|
|
10112
|
+
if (!data.repeat) {
|
|
10054
10113
|
let { width, height } = data;
|
|
10055
10114
|
width *= abs(scaleX) * canvas.pixelRatio;
|
|
10056
10115
|
height *= abs(scaleY) * canvas.pixelRatio;
|
|
@@ -11050,6 +11109,7 @@ var LeaferUI = (function (exports) {
|
|
|
11050
11109
|
}
|
|
11051
11110
|
}
|
|
11052
11111
|
|
|
11112
|
+
const { top, right, bottom, left } = exports.Direction4;
|
|
11053
11113
|
const TextConvert = {
|
|
11054
11114
|
getDrawData(content, style) {
|
|
11055
11115
|
if (typeof content !== 'string')
|
|
@@ -11057,16 +11117,15 @@ var LeaferUI = (function (exports) {
|
|
|
11057
11117
|
let x = 0, y = 0;
|
|
11058
11118
|
let width = style.__getInput('width') || 0;
|
|
11059
11119
|
let height = style.__getInput('height') || 0;
|
|
11060
|
-
const { textDecoration, __font, padding } = style;
|
|
11120
|
+
const { textDecoration, __font, __padding: padding } = style;
|
|
11061
11121
|
if (padding) {
|
|
11062
|
-
const [top, right, bottom, left] = MathHelper.fourNumber(padding);
|
|
11063
11122
|
if (width) {
|
|
11064
|
-
x = left;
|
|
11065
|
-
width -= (right + left);
|
|
11123
|
+
x = padding[left];
|
|
11124
|
+
width -= (padding[right] + padding[left]);
|
|
11066
11125
|
}
|
|
11067
11126
|
if (height) {
|
|
11068
|
-
y = top;
|
|
11069
|
-
height -= (top + bottom);
|
|
11127
|
+
y = padding[top];
|
|
11128
|
+
height -= (padding[top] + padding[bottom]);
|
|
11070
11129
|
}
|
|
11071
11130
|
}
|
|
11072
11131
|
const drawData = {
|
|
@@ -11076,6 +11135,8 @@ var LeaferUI = (function (exports) {
|
|
|
11076
11135
|
font: Platform.canvas.font = __font
|
|
11077
11136
|
};
|
|
11078
11137
|
createRows(drawData, content, style);
|
|
11138
|
+
if (padding)
|
|
11139
|
+
padAutoText(padding, drawData, style, width, height);
|
|
11079
11140
|
layoutText(drawData, style);
|
|
11080
11141
|
layoutChar(drawData, style, width);
|
|
11081
11142
|
if (drawData.overflow)
|
|
@@ -11085,6 +11146,32 @@ var LeaferUI = (function (exports) {
|
|
|
11085
11146
|
return drawData;
|
|
11086
11147
|
}
|
|
11087
11148
|
};
|
|
11149
|
+
function padAutoText(padding, drawData, style, width, height) {
|
|
11150
|
+
if (!width) {
|
|
11151
|
+
switch (style.textAlign) {
|
|
11152
|
+
case 'left':
|
|
11153
|
+
offsetText(drawData, 'x', padding[left]);
|
|
11154
|
+
break;
|
|
11155
|
+
case 'right':
|
|
11156
|
+
offsetText(drawData, 'x', -padding[right]);
|
|
11157
|
+
}
|
|
11158
|
+
}
|
|
11159
|
+
if (!height) {
|
|
11160
|
+
switch (style.verticalAlign) {
|
|
11161
|
+
case 'top':
|
|
11162
|
+
offsetText(drawData, 'y', padding[top]);
|
|
11163
|
+
break;
|
|
11164
|
+
case 'bottom':
|
|
11165
|
+
offsetText(drawData, 'y', -padding[bottom]);
|
|
11166
|
+
}
|
|
11167
|
+
}
|
|
11168
|
+
}
|
|
11169
|
+
function offsetText(drawData, attrName, value) {
|
|
11170
|
+
const { bounds, rows } = drawData;
|
|
11171
|
+
bounds[attrName] += value;
|
|
11172
|
+
for (let i = 0; i < rows.length; i++)
|
|
11173
|
+
rows[i][attrName] += value;
|
|
11174
|
+
}
|
|
11088
11175
|
|
|
11089
11176
|
const ColorConvert = {
|
|
11090
11177
|
string(color, opacity) {
|
|
@@ -11171,6 +11258,7 @@ var LeaferUI = (function (exports) {
|
|
|
11171
11258
|
exports.Animate = Animate;
|
|
11172
11259
|
exports.AnimateEvent = AnimateEvent;
|
|
11173
11260
|
exports.AroundHelper = AroundHelper;
|
|
11261
|
+
exports.ArrowData = ArrowData;
|
|
11174
11262
|
exports.AutoBounds = AutoBounds;
|
|
11175
11263
|
exports.BezierHelper = BezierHelper;
|
|
11176
11264
|
exports.Bounds = Bounds;
|