@leafer-ui/miniapp 1.0.5 → 1.0.7
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.cjs +8 -6
- package/dist/miniapp.esm.js +8 -6
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.module.js +134 -143
- package/dist/miniapp.module.min.js +1 -1
- package/package.json +10 -10
package/dist/miniapp.module.js
CHANGED
|
@@ -552,6 +552,12 @@ const PointHelper = {
|
|
|
552
552
|
to.y = t.y + sin$4(r) * distance;
|
|
553
553
|
return to;
|
|
554
554
|
},
|
|
555
|
+
toNumberPoints(originPoints) {
|
|
556
|
+
let points = originPoints;
|
|
557
|
+
if (typeof originPoints[0] === 'object')
|
|
558
|
+
points = [], originPoints.forEach(p => points.push(p.x, p.y));
|
|
559
|
+
return points;
|
|
560
|
+
},
|
|
555
561
|
reset(t) {
|
|
556
562
|
P$5.reset(t);
|
|
557
563
|
}
|
|
@@ -1542,7 +1548,10 @@ const { assign } = DataHelper;
|
|
|
1542
1548
|
|
|
1543
1549
|
class LeafData {
|
|
1544
1550
|
get __useNaturalRatio() { return true; }
|
|
1545
|
-
get __isLinePath() {
|
|
1551
|
+
get __isLinePath() {
|
|
1552
|
+
const { path } = this;
|
|
1553
|
+
return path && path.length === 6 && path[0] === 1;
|
|
1554
|
+
}
|
|
1546
1555
|
get __blendMode() {
|
|
1547
1556
|
if (this.eraser && this.eraser !== 'path')
|
|
1548
1557
|
return 'destination-out';
|
|
@@ -2305,11 +2314,12 @@ const RectHelper = {
|
|
|
2305
2314
|
|
|
2306
2315
|
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
|
|
2307
2316
|
const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
|
|
2308
|
-
const { set } = PointHelper;
|
|
2317
|
+
const { set, toNumberPoints } = PointHelper;
|
|
2309
2318
|
const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
2310
2319
|
const tempPoint$2 = {};
|
|
2311
2320
|
const BezierHelper = {
|
|
2312
|
-
points(data,
|
|
2321
|
+
points(data, originPoints, curve, close) {
|
|
2322
|
+
let points = toNumberPoints(originPoints);
|
|
2313
2323
|
data.push(M$5, points[0], points[1]);
|
|
2314
2324
|
if (curve && points.length > 5) {
|
|
2315
2325
|
let aX, aY, bX, bY, cX, cY, c1X, c1Y, c2X, c2Y;
|
|
@@ -2818,6 +2828,27 @@ const PathConvert = {
|
|
|
2818
2828
|
}
|
|
2819
2829
|
return data;
|
|
2820
2830
|
},
|
|
2831
|
+
objectToCanvasData(list) {
|
|
2832
|
+
const data = [];
|
|
2833
|
+
list.forEach(item => {
|
|
2834
|
+
switch (item.name) {
|
|
2835
|
+
case 'M':
|
|
2836
|
+
data.push(M$4, item.x, item.y);
|
|
2837
|
+
break;
|
|
2838
|
+
case 'L':
|
|
2839
|
+
data.push(L$5, item.x, item.y);
|
|
2840
|
+
break;
|
|
2841
|
+
case 'C':
|
|
2842
|
+
data.push(C$4, item.x1, item.y1, item.x2, item.y2, item.x, item.y);
|
|
2843
|
+
break;
|
|
2844
|
+
case 'Q':
|
|
2845
|
+
data.push(Q$3, item.x1, item.y1, item.x, item.y);
|
|
2846
|
+
break;
|
|
2847
|
+
case 'Z': data.push(Z$4);
|
|
2848
|
+
}
|
|
2849
|
+
});
|
|
2850
|
+
return data;
|
|
2851
|
+
},
|
|
2821
2852
|
copyData(data, old, index, count) {
|
|
2822
2853
|
for (let i = index, end = index + count; i < end; i++) {
|
|
2823
2854
|
data.push(old[i]);
|
|
@@ -4395,13 +4426,10 @@ class LeafLayout {
|
|
|
4395
4426
|
update() {
|
|
4396
4427
|
const { leafer } = this.leaf;
|
|
4397
4428
|
if (leafer) {
|
|
4398
|
-
if (leafer.ready)
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
}
|
|
4402
|
-
else {
|
|
4429
|
+
if (leafer.ready)
|
|
4430
|
+
leafer.watcher.changed && leafer.layouter.layout();
|
|
4431
|
+
else
|
|
4403
4432
|
leafer.start();
|
|
4404
|
-
}
|
|
4405
4433
|
}
|
|
4406
4434
|
else {
|
|
4407
4435
|
let root = this.leaf;
|
|
@@ -5159,7 +5187,7 @@ const LeafRender = {
|
|
|
5159
5187
|
if (this.__worldOpacity) {
|
|
5160
5188
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5161
5189
|
this.__drawRenderPath(canvas);
|
|
5162
|
-
this.
|
|
5190
|
+
this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
|
|
5163
5191
|
}
|
|
5164
5192
|
},
|
|
5165
5193
|
__updateWorldOpacity() {
|
|
@@ -5676,11 +5704,17 @@ let Branch = class Branch extends Leaf {
|
|
|
5676
5704
|
add(child, index) {
|
|
5677
5705
|
if (child === this)
|
|
5678
5706
|
return;
|
|
5679
|
-
|
|
5707
|
+
const noIndex = index === undefined;
|
|
5708
|
+
if (!child.__) {
|
|
5709
|
+
if (child instanceof Array)
|
|
5710
|
+
return child.forEach(item => { this.add(item, index); noIndex || index++; });
|
|
5711
|
+
else
|
|
5712
|
+
child = UICreator.get(child.tag, child);
|
|
5713
|
+
}
|
|
5680
5714
|
if (child.parent)
|
|
5681
5715
|
child.parent.remove(child);
|
|
5682
5716
|
child.parent = this;
|
|
5683
|
-
|
|
5717
|
+
noIndex ? this.children.push(child) : this.children.splice(index, 0, child);
|
|
5684
5718
|
if (child.isBranch)
|
|
5685
5719
|
this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
|
|
5686
5720
|
child.__layout.boxChanged || child.__layout.boxChange();
|
|
@@ -5694,9 +5728,7 @@ let Branch = class Branch extends Leaf {
|
|
|
5694
5728
|
}
|
|
5695
5729
|
this.__layout.affectChildrenSort && this.__layout.childrenSortChange();
|
|
5696
5730
|
}
|
|
5697
|
-
addMany(...children) {
|
|
5698
|
-
children.forEach(child => this.add(child));
|
|
5699
|
-
}
|
|
5731
|
+
addMany(...children) { this.add(children); }
|
|
5700
5732
|
remove(child, destroy) {
|
|
5701
5733
|
if (child) {
|
|
5702
5734
|
if (child.__) {
|
|
@@ -5924,7 +5956,7 @@ class LeafLevelList {
|
|
|
5924
5956
|
}
|
|
5925
5957
|
}
|
|
5926
5958
|
|
|
5927
|
-
const version = "1.0.
|
|
5959
|
+
const version = "1.0.7";
|
|
5928
5960
|
|
|
5929
5961
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5930
5962
|
get allowBackgroundColor() { return false; }
|
|
@@ -6780,7 +6812,8 @@ class Picker {
|
|
|
6780
6812
|
path.add(leaf);
|
|
6781
6813
|
leaf = leaf.parent;
|
|
6782
6814
|
}
|
|
6783
|
-
|
|
6815
|
+
if (this.target)
|
|
6816
|
+
path.add(this.target);
|
|
6784
6817
|
return path;
|
|
6785
6818
|
}
|
|
6786
6819
|
getHitablePath(leaf) {
|
|
@@ -6866,8 +6899,8 @@ class Selector {
|
|
|
6866
6899
|
this.innerIdMap = {};
|
|
6867
6900
|
this.idMap = {};
|
|
6868
6901
|
this.methods = {
|
|
6869
|
-
id: (leaf, name) => leaf.id === name ? (this.idMap[name] = leaf, 1) : 0,
|
|
6870
|
-
innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.innerIdMap[innerId] = leaf, 1) : 0,
|
|
6902
|
+
id: (leaf, name) => leaf.id === name ? (this.target && (this.idMap[name] = leaf), 1) : 0,
|
|
6903
|
+
innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.target && (this.innerIdMap[innerId] = leaf), 1) : 0,
|
|
6871
6904
|
className: (leaf, name) => leaf.className === name ? 1 : 0,
|
|
6872
6905
|
tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
|
|
6873
6906
|
tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
|
|
@@ -6876,7 +6909,8 @@ class Selector {
|
|
|
6876
6909
|
if (userConfig)
|
|
6877
6910
|
this.config = DataHelper.default(userConfig, this.config);
|
|
6878
6911
|
this.picker = new Picker(target, this);
|
|
6879
|
-
|
|
6912
|
+
if (target)
|
|
6913
|
+
this.__listenEvents();
|
|
6880
6914
|
}
|
|
6881
6915
|
getBy(condition, branch, one, options) {
|
|
6882
6916
|
switch (typeof condition) {
|
|
@@ -6911,7 +6945,7 @@ class Selector {
|
|
|
6911
6945
|
}
|
|
6912
6946
|
}
|
|
6913
6947
|
getByPoint(hitPoint, hitRadius, options) {
|
|
6914
|
-
if (Platform.name === 'node')
|
|
6948
|
+
if (Platform.name === 'node' && this.target)
|
|
6915
6949
|
this.target.emit(LayoutEvent.CHECK_UPDATE);
|
|
6916
6950
|
return this.picker.getByPoint(hitPoint, hitRadius, options);
|
|
6917
6951
|
}
|
|
@@ -7041,6 +7075,13 @@ function zoomLayerType() {
|
|
|
7041
7075
|
|
|
7042
7076
|
const TextConvert = {};
|
|
7043
7077
|
const ColorConvert = {};
|
|
7078
|
+
const UnitConvert = {
|
|
7079
|
+
number(value, percentRefer) {
|
|
7080
|
+
if (typeof value === 'object')
|
|
7081
|
+
return value.type === 'percent' ? value.value * percentRefer : value.value;
|
|
7082
|
+
return value;
|
|
7083
|
+
}
|
|
7084
|
+
};
|
|
7044
7085
|
const PathArrow = {};
|
|
7045
7086
|
const Paint = {};
|
|
7046
7087
|
const PaintImage = {};
|
|
@@ -7061,7 +7102,7 @@ const Transition = {
|
|
|
7061
7102
|
}
|
|
7062
7103
|
};
|
|
7063
7104
|
|
|
7064
|
-
const { parse } = PathConvert;
|
|
7105
|
+
const { parse, objectToCanvasData } = PathConvert;
|
|
7065
7106
|
const emptyPaint = {};
|
|
7066
7107
|
const debug$4 = Debug.get('UIData');
|
|
7067
7108
|
class UIData extends LeafData {
|
|
@@ -7075,10 +7116,11 @@ class UIData extends LeafData {
|
|
|
7075
7116
|
scaleX = -scaleX;
|
|
7076
7117
|
return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
|
|
7077
7118
|
}
|
|
7078
|
-
else
|
|
7119
|
+
else
|
|
7079
7120
|
return strokeWidth;
|
|
7080
|
-
}
|
|
7081
7121
|
}
|
|
7122
|
+
get __hasStroke() { return this.stroke && this.strokeWidth; }
|
|
7123
|
+
get __clipAfterFill() { return (this.cornerRadius || this.__pathInputed); }
|
|
7082
7124
|
get __autoWidth() { return !this._width; }
|
|
7083
7125
|
get __autoHeight() { return !this._height; }
|
|
7084
7126
|
get __autoSide() { return !this._width || !this._height; }
|
|
@@ -7095,9 +7137,8 @@ class UIData extends LeafData {
|
|
|
7095
7137
|
this.__leaf.scaleX *= -1;
|
|
7096
7138
|
debug$4.warn('width < 0, instead -scaleX ', this);
|
|
7097
7139
|
}
|
|
7098
|
-
else
|
|
7140
|
+
else
|
|
7099
7141
|
this._width = value;
|
|
7100
|
-
}
|
|
7101
7142
|
}
|
|
7102
7143
|
setHeight(value) {
|
|
7103
7144
|
if (value < 0) {
|
|
@@ -7105,9 +7146,8 @@ class UIData extends LeafData {
|
|
|
7105
7146
|
this.__leaf.scaleY *= -1;
|
|
7106
7147
|
debug$4.warn('height < 0, instead -scaleY', this);
|
|
7107
7148
|
}
|
|
7108
|
-
else
|
|
7149
|
+
else
|
|
7109
7150
|
this._height = value;
|
|
7110
|
-
}
|
|
7111
7151
|
}
|
|
7112
7152
|
setFill(value) {
|
|
7113
7153
|
if (this.__naturalWidth)
|
|
@@ -7148,9 +7188,10 @@ class UIData extends LeafData {
|
|
|
7148
7188
|
}
|
|
7149
7189
|
}
|
|
7150
7190
|
setPath(value) {
|
|
7151
|
-
|
|
7191
|
+
const isString = typeof value === 'string';
|
|
7192
|
+
if (isString || (value && typeof value[0] === 'object')) {
|
|
7152
7193
|
this.__setInput('path', value);
|
|
7153
|
-
this._path = parse(value);
|
|
7194
|
+
this._path = isString ? parse(value) : objectToCanvasData(value);
|
|
7154
7195
|
}
|
|
7155
7196
|
else {
|
|
7156
7197
|
if (this.__input)
|
|
@@ -7165,12 +7206,8 @@ class UIData extends LeafData {
|
|
|
7165
7206
|
value = value.filter((item) => item.visible !== false);
|
|
7166
7207
|
this._shadow = value.length ? value : null;
|
|
7167
7208
|
}
|
|
7168
|
-
else
|
|
7169
|
-
this._shadow = value.visible
|
|
7170
|
-
}
|
|
7171
|
-
else {
|
|
7172
|
-
this._shadow = null;
|
|
7173
|
-
}
|
|
7209
|
+
else
|
|
7210
|
+
this._shadow = value && value.visible !== false ? [value] : null;
|
|
7174
7211
|
}
|
|
7175
7212
|
setInnerShadow(value) {
|
|
7176
7213
|
this.__setInput('innerShadow', value);
|
|
@@ -7179,12 +7216,8 @@ class UIData extends LeafData {
|
|
|
7179
7216
|
value = value.filter((item) => item.visible !== false);
|
|
7180
7217
|
this._innerShadow = value.length ? value : null;
|
|
7181
7218
|
}
|
|
7182
|
-
else
|
|
7183
|
-
this._innerShadow = value.visible
|
|
7184
|
-
}
|
|
7185
|
-
else {
|
|
7186
|
-
this._innerShadow = null;
|
|
7187
|
-
}
|
|
7219
|
+
else
|
|
7220
|
+
this._innerShadow = value && value.visible !== false ? [value] : null;
|
|
7188
7221
|
}
|
|
7189
7222
|
__computePaint() {
|
|
7190
7223
|
const { fill, stroke } = this.__input;
|
|
@@ -7195,24 +7228,19 @@ class UIData extends LeafData {
|
|
|
7195
7228
|
this.__needComputePaint = false;
|
|
7196
7229
|
}
|
|
7197
7230
|
}
|
|
7198
|
-
const UnitConvert = {
|
|
7199
|
-
number(value, percentRefer) {
|
|
7200
|
-
if (typeof value === 'object')
|
|
7201
|
-
return value.type === 'percent' ? value.value * percentRefer : value.value;
|
|
7202
|
-
return value;
|
|
7203
|
-
}
|
|
7204
|
-
};
|
|
7205
7231
|
|
|
7206
7232
|
class GroupData extends UIData {
|
|
7207
7233
|
}
|
|
7208
7234
|
|
|
7209
7235
|
class BoxData extends GroupData {
|
|
7210
7236
|
get __boxStroke() { return !this.__pathInputed; }
|
|
7237
|
+
get __drawAfterFill() { return this.overflow === 'hide' && this.__clipAfterFill && this.__leaf.children.length; }
|
|
7238
|
+
get __clipAfterFill() { return this.__leaf.isOverflow || super.__clipAfterFill; }
|
|
7211
7239
|
}
|
|
7212
7240
|
|
|
7213
7241
|
class LeaferData extends GroupData {
|
|
7214
|
-
__getInputData() {
|
|
7215
|
-
const data = super.__getInputData();
|
|
7242
|
+
__getInputData(names, options) {
|
|
7243
|
+
const data = super.__getInputData(names, options);
|
|
7216
7244
|
canvasSizeAttrs.forEach(key => delete data[key]);
|
|
7217
7245
|
return data;
|
|
7218
7246
|
}
|
|
@@ -7239,6 +7267,7 @@ class StarData extends UIData {
|
|
|
7239
7267
|
}
|
|
7240
7268
|
|
|
7241
7269
|
class PathData extends UIData {
|
|
7270
|
+
get __pathInputed() { return 2; }
|
|
7242
7271
|
}
|
|
7243
7272
|
|
|
7244
7273
|
class PenData extends GroupData {
|
|
@@ -7285,16 +7314,18 @@ class ImageData extends RectData {
|
|
|
7285
7314
|
delete data.fill;
|
|
7286
7315
|
return data;
|
|
7287
7316
|
}
|
|
7288
|
-
__getInputData() {
|
|
7289
|
-
const data = super.__getInputData();
|
|
7317
|
+
__getInputData(names, options) {
|
|
7318
|
+
const data = super.__getInputData(names, options);
|
|
7290
7319
|
delete data.fill;
|
|
7291
7320
|
return data;
|
|
7292
7321
|
}
|
|
7293
7322
|
}
|
|
7294
7323
|
|
|
7295
7324
|
class CanvasData extends RectData {
|
|
7296
|
-
|
|
7297
|
-
|
|
7325
|
+
get __isCanvas() { return true; }
|
|
7326
|
+
get __drawAfterFill() { return true; }
|
|
7327
|
+
__getInputData(names, options) {
|
|
7328
|
+
const data = super.__getInputData(names, options);
|
|
7298
7329
|
data.url = this.__leaf.canvas.toDataURL('image/png');
|
|
7299
7330
|
return data;
|
|
7300
7331
|
}
|
|
@@ -7321,16 +7352,12 @@ const UIBounds = {
|
|
|
7321
7352
|
let width = 0;
|
|
7322
7353
|
const { shadow, innerShadow, blur, backgroundBlur } = this.__;
|
|
7323
7354
|
if (shadow)
|
|
7324
|
-
shadow.forEach(item =>
|
|
7325
|
-
width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5);
|
|
7326
|
-
});
|
|
7355
|
+
shadow.forEach(item => width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5));
|
|
7327
7356
|
if (blur)
|
|
7328
7357
|
width = Math.max(width, blur);
|
|
7329
7358
|
let shapeWidth = width = Math.ceil(width);
|
|
7330
7359
|
if (innerShadow)
|
|
7331
|
-
innerShadow.forEach(item =>
|
|
7332
|
-
shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5);
|
|
7333
|
-
});
|
|
7360
|
+
innerShadow.forEach(item => shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5));
|
|
7334
7361
|
if (backgroundBlur)
|
|
7335
7362
|
shapeWidth = Math.max(shapeWidth, backgroundBlur);
|
|
7336
7363
|
this.__layout.renderShapeSpread = shapeWidth;
|
|
@@ -7412,6 +7439,16 @@ const UIRender = {
|
|
|
7412
7439
|
if (stroke && !ignoreStroke)
|
|
7413
7440
|
this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7414
7441
|
}
|
|
7442
|
+
},
|
|
7443
|
+
__drawAfterFill(canvas, options) {
|
|
7444
|
+
if (this.__.__clipAfterFill) {
|
|
7445
|
+
canvas.save();
|
|
7446
|
+
this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
|
|
7447
|
+
this.__drawContent(canvas, options);
|
|
7448
|
+
canvas.restore();
|
|
7449
|
+
}
|
|
7450
|
+
else
|
|
7451
|
+
this.__drawContent(canvas, options);
|
|
7415
7452
|
}
|
|
7416
7453
|
};
|
|
7417
7454
|
function drawFast(ui, canvas, options) {
|
|
@@ -7478,8 +7515,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7478
7515
|
return pen;
|
|
7479
7516
|
}
|
|
7480
7517
|
get editConfig() { return undefined; }
|
|
7481
|
-
get editOuter() { return
|
|
7482
|
-
get editInner() { return '
|
|
7518
|
+
get editOuter() { return ''; }
|
|
7519
|
+
get editInner() { return ''; }
|
|
7483
7520
|
constructor(data) {
|
|
7484
7521
|
super(data);
|
|
7485
7522
|
}
|
|
@@ -7490,9 +7527,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7490
7527
|
Object.assign(this, data);
|
|
7491
7528
|
this.lockNormalStyle = false;
|
|
7492
7529
|
}
|
|
7493
|
-
else
|
|
7530
|
+
else
|
|
7494
7531
|
Object.assign(this, data);
|
|
7495
|
-
}
|
|
7496
7532
|
}
|
|
7497
7533
|
get(name) {
|
|
7498
7534
|
return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
@@ -7794,23 +7830,13 @@ let Group = class Group extends UI {
|
|
|
7794
7830
|
if (data.children) {
|
|
7795
7831
|
const { children } = data;
|
|
7796
7832
|
delete data.children;
|
|
7797
|
-
|
|
7798
|
-
this.__setBranch();
|
|
7799
|
-
}
|
|
7800
|
-
else {
|
|
7801
|
-
this.clear();
|
|
7802
|
-
}
|
|
7833
|
+
this.children ? this.clear() : this.__setBranch();
|
|
7803
7834
|
super.set(data, isTemp);
|
|
7804
|
-
|
|
7805
|
-
children.forEach(childData => {
|
|
7806
|
-
child = childData.__ ? childData : UICreator.get(childData.tag, childData);
|
|
7807
|
-
this.add(child);
|
|
7808
|
-
});
|
|
7835
|
+
children.forEach(child => this.add(child));
|
|
7809
7836
|
data.children = children;
|
|
7810
7837
|
}
|
|
7811
|
-
else
|
|
7838
|
+
else
|
|
7812
7839
|
super.set(data, isTemp);
|
|
7813
|
-
}
|
|
7814
7840
|
}
|
|
7815
7841
|
toJSON(options) {
|
|
7816
7842
|
const data = super.toJSON(options);
|
|
@@ -8242,9 +8268,7 @@ let Box = class Box extends Group {
|
|
|
8242
8268
|
}
|
|
8243
8269
|
__updateStrokeSpread() { return 0; }
|
|
8244
8270
|
__updateRectRenderSpread() { return 0; }
|
|
8245
|
-
__updateRenderSpread() {
|
|
8246
|
-
return this.__updateRectRenderSpread() || -1;
|
|
8247
|
-
}
|
|
8271
|
+
__updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
|
|
8248
8272
|
__updateRectBoxBounds() { }
|
|
8249
8273
|
__updateBoxBounds(_secondLayout) {
|
|
8250
8274
|
const data = this.__;
|
|
@@ -8264,13 +8288,11 @@ let Box = class Box extends Group {
|
|
|
8264
8288
|
}
|
|
8265
8289
|
this.__updateNaturalSize();
|
|
8266
8290
|
}
|
|
8267
|
-
else
|
|
8291
|
+
else
|
|
8268
8292
|
this.__updateRectBoxBounds();
|
|
8269
|
-
}
|
|
8270
8293
|
}
|
|
8271
|
-
else
|
|
8294
|
+
else
|
|
8272
8295
|
this.__updateRectBoxBounds();
|
|
8273
|
-
}
|
|
8274
8296
|
}
|
|
8275
8297
|
__updateStrokeBounds() { }
|
|
8276
8298
|
__updateRenderBounds() {
|
|
@@ -8280,14 +8302,13 @@ let Box = class Box extends Group {
|
|
|
8280
8302
|
super.__updateRenderBounds();
|
|
8281
8303
|
copy$3(childrenRenderBounds, renderBounds);
|
|
8282
8304
|
this.__updateRectRenderBounds();
|
|
8283
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8305
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8306
|
+
if (isOverflow && this.__.overflow !== 'hide')
|
|
8307
|
+
add(renderBounds, childrenRenderBounds);
|
|
8284
8308
|
}
|
|
8285
|
-
else
|
|
8309
|
+
else
|
|
8286
8310
|
this.__updateRectRenderBounds();
|
|
8287
|
-
|
|
8288
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8289
|
-
if (!(this.__.__drawAfterFill = this.__.overflow === 'hide') && isOverflow)
|
|
8290
|
-
add(renderBounds, childrenRenderBounds);
|
|
8311
|
+
!this.isOverflow !== !isOverflow && (this.isOverflow = isOverflow);
|
|
8291
8312
|
}
|
|
8292
8313
|
__updateRectRenderBounds() { }
|
|
8293
8314
|
__updateRectChange() { }
|
|
@@ -8307,20 +8328,9 @@ let Box = class Box extends Group {
|
|
|
8307
8328
|
this.__renderGroup(canvas, options);
|
|
8308
8329
|
}
|
|
8309
8330
|
}
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
if (this.
|
|
8313
|
-
canvas.save();
|
|
8314
|
-
canvas.clip();
|
|
8315
|
-
if (length)
|
|
8316
|
-
this.__renderGroup(canvas, options);
|
|
8317
|
-
canvas.restore();
|
|
8318
|
-
}
|
|
8319
|
-
else {
|
|
8320
|
-
if (length)
|
|
8321
|
-
this.__renderGroup(canvas, options);
|
|
8322
|
-
}
|
|
8323
|
-
if (this.__.stroke && length) {
|
|
8331
|
+
__drawContent(canvas, options) {
|
|
8332
|
+
this.__renderGroup(canvas, options);
|
|
8333
|
+
if (this.__.__hasStroke) {
|
|
8324
8334
|
canvas.setWorld(this.__nowWorld);
|
|
8325
8335
|
this.__drawRenderPath(canvas);
|
|
8326
8336
|
}
|
|
@@ -8484,17 +8494,15 @@ let Line = class Line extends UI {
|
|
|
8484
8494
|
if (data.__useArrow)
|
|
8485
8495
|
PathArrow.addArrows(this, false);
|
|
8486
8496
|
}
|
|
8487
|
-
else
|
|
8497
|
+
else
|
|
8488
8498
|
super.__updateRenderPath();
|
|
8489
|
-
}
|
|
8490
8499
|
}
|
|
8491
8500
|
__updateBoxBounds() {
|
|
8492
8501
|
if (this.points) {
|
|
8493
8502
|
toBounds$1(this.__.__pathForRender, this.__layout.boxBounds);
|
|
8494
8503
|
}
|
|
8495
|
-
else
|
|
8504
|
+
else
|
|
8496
8505
|
super.__updateBoxBounds();
|
|
8497
|
-
}
|
|
8498
8506
|
}
|
|
8499
8507
|
};
|
|
8500
8508
|
__decorate([
|
|
@@ -8632,7 +8640,6 @@ let Canvas = class Canvas extends Rect {
|
|
|
8632
8640
|
super(data);
|
|
8633
8641
|
this.canvas = Creator.canvas(this.__);
|
|
8634
8642
|
this.context = this.canvas.context;
|
|
8635
|
-
this.__.__isCanvas = this.__.__drawAfterFill = true;
|
|
8636
8643
|
if (data && data.url)
|
|
8637
8644
|
this.drawImage(data.url);
|
|
8638
8645
|
}
|
|
@@ -8645,8 +8652,7 @@ let Canvas = class Canvas extends Rect {
|
|
|
8645
8652
|
});
|
|
8646
8653
|
}
|
|
8647
8654
|
draw(ui, offset, scale, rotation) {
|
|
8648
|
-
ui.
|
|
8649
|
-
const matrix = new Matrix(ui.__world).invert();
|
|
8655
|
+
const matrix = new Matrix(ui.worldTransform).invert();
|
|
8650
8656
|
const m = new Matrix();
|
|
8651
8657
|
if (offset)
|
|
8652
8658
|
m.translate(offset.x, offset.y);
|
|
@@ -8661,17 +8667,9 @@ let Canvas = class Canvas extends Rect {
|
|
|
8661
8667
|
paint() {
|
|
8662
8668
|
this.forceRender();
|
|
8663
8669
|
}
|
|
8664
|
-
|
|
8665
|
-
const { width, height
|
|
8666
|
-
|
|
8667
|
-
canvas.save();
|
|
8668
|
-
canvas.clip();
|
|
8669
|
-
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8670
|
-
canvas.restore();
|
|
8671
|
-
}
|
|
8672
|
-
else {
|
|
8673
|
-
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8674
|
-
}
|
|
8670
|
+
__drawContent(canvas, _options) {
|
|
8671
|
+
const { width, height } = this.__, { view } = this.canvas;
|
|
8672
|
+
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8675
8673
|
}
|
|
8676
8674
|
__updateSize() {
|
|
8677
8675
|
const { canvas } = this;
|
|
@@ -8715,7 +8713,6 @@ Canvas = __decorate([
|
|
|
8715
8713
|
const { copyAndSpread, includes, isSame: isSame$1, spread, setList } = BoundsHelper;
|
|
8716
8714
|
let Text = class Text extends UI {
|
|
8717
8715
|
get __tag() { return 'Text'; }
|
|
8718
|
-
get editInner() { return 'TextEditor'; }
|
|
8719
8716
|
get textDrawData() {
|
|
8720
8717
|
this.__layout.update();
|
|
8721
8718
|
return this.__.__textDrawData;
|
|
@@ -8790,9 +8787,8 @@ let Text = class Text extends UI {
|
|
|
8790
8787
|
layout.renderChanged = true;
|
|
8791
8788
|
setList(data.__textBoxBounds = {}, [b, bounds]);
|
|
8792
8789
|
}
|
|
8793
|
-
else
|
|
8790
|
+
else
|
|
8794
8791
|
data.__textBoxBounds = contentBounds;
|
|
8795
|
-
}
|
|
8796
8792
|
}
|
|
8797
8793
|
__updateRenderSpread() {
|
|
8798
8794
|
let width = super.__updateRenderSpread();
|
|
@@ -8881,7 +8877,6 @@ let Path = class Path extends UI {
|
|
|
8881
8877
|
get __tag() { return 'Path'; }
|
|
8882
8878
|
constructor(data) {
|
|
8883
8879
|
super(data);
|
|
8884
|
-
this.__.__pathInputed = 2;
|
|
8885
8880
|
}
|
|
8886
8881
|
};
|
|
8887
8882
|
__decorate([
|
|
@@ -8964,21 +8959,17 @@ let App = class App extends Leafer {
|
|
|
8964
8959
|
this.tree = this.addLeafer(tree);
|
|
8965
8960
|
if (sky || editor)
|
|
8966
8961
|
this.sky = this.addLeafer(sky || { type: 'draw', usePartRender: false });
|
|
8967
|
-
if (editor)
|
|
8968
|
-
this.editor = Creator.editor(editor);
|
|
8969
|
-
this.sky.add(this.editor);
|
|
8970
|
-
}
|
|
8962
|
+
if (editor)
|
|
8963
|
+
this.sky.add(this.editor = Creator.editor(editor));
|
|
8971
8964
|
}
|
|
8972
8965
|
}
|
|
8973
8966
|
__setApp() {
|
|
8974
8967
|
const { canvas } = this;
|
|
8975
8968
|
const { realCanvas, view } = this.config;
|
|
8976
|
-
if (realCanvas || view === this.canvas.view || !canvas.parentView)
|
|
8969
|
+
if (realCanvas || view === this.canvas.view || !canvas.parentView)
|
|
8977
8970
|
this.realCanvas = true;
|
|
8978
|
-
|
|
8979
|
-
else {
|
|
8971
|
+
else
|
|
8980
8972
|
canvas.unrealCanvas();
|
|
8981
|
-
}
|
|
8982
8973
|
this.leafer = this;
|
|
8983
8974
|
this.watcher.disable();
|
|
8984
8975
|
this.layouter.disable();
|
|
@@ -9384,10 +9375,7 @@ leafer.initType = function (type) {
|
|
|
9384
9375
|
leafer.getValidMove = function (moveX, moveY) {
|
|
9385
9376
|
const { scroll, disabled } = this.app.config.move;
|
|
9386
9377
|
if (scroll) {
|
|
9387
|
-
|
|
9388
|
-
moveY = 0;
|
|
9389
|
-
else
|
|
9390
|
-
moveX = 0;
|
|
9378
|
+
Math.abs(moveX) > Math.abs(moveY) ? moveY = 0 : moveX = 0;
|
|
9391
9379
|
if (scroll === 'limit') {
|
|
9392
9380
|
const { x, y, width, height } = new Bounds(this.__world).addPoint(this.zoomLayer);
|
|
9393
9381
|
const right = x + width - this.width, bottom = y + height - this.height;
|
|
@@ -10474,17 +10462,20 @@ rect.__hitFill = box$1.__hitFill = function (inner) {
|
|
|
10474
10462
|
};
|
|
10475
10463
|
|
|
10476
10464
|
const ui = UI.prototype, group = Group.prototype;
|
|
10465
|
+
function getSelector(ui) {
|
|
10466
|
+
return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
|
|
10467
|
+
}
|
|
10477
10468
|
ui.find = function (condition, options) {
|
|
10478
|
-
return this.
|
|
10469
|
+
return getSelector(this).getBy(condition, this, false, options);
|
|
10479
10470
|
};
|
|
10480
10471
|
ui.findOne = function (condition, options) {
|
|
10481
|
-
return this.
|
|
10472
|
+
return getSelector(this).getBy(condition, this, true, options);
|
|
10482
10473
|
};
|
|
10483
10474
|
group.pick = function (hitPoint, options) {
|
|
10484
10475
|
this.__layout.update();
|
|
10485
10476
|
if (!options)
|
|
10486
10477
|
options = {};
|
|
10487
|
-
return this.
|
|
10478
|
+
return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
|
|
10488
10479
|
};
|
|
10489
10480
|
|
|
10490
10481
|
const canvas$1 = LeaferCanvasBase.prototype;
|
|
@@ -11224,7 +11215,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
|
|
|
11224
11215
|
}
|
|
11225
11216
|
if (allowPaint) {
|
|
11226
11217
|
canvas.save();
|
|
11227
|
-
canvas.clip();
|
|
11218
|
+
ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
|
|
11228
11219
|
if (paint.blendMode)
|
|
11229
11220
|
canvas.blendMode = paint.blendMode;
|
|
11230
11221
|
if (data.opacity)
|