leafer-ui 1.0.4 → 1.0.6
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 +31 -13
- package/dist/web.cjs +35 -27
- package/dist/web.esm.js +35 -27
- package/dist/web.esm.min.js +1 -1
- package/dist/web.js +205 -199
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +205 -199
- package/dist/web.module.min.js +1 -1
- package/package.json +14 -14
package/dist/web.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]);
|
|
@@ -4755,6 +4786,7 @@ class RenderEvent extends Event {
|
|
|
4755
4786
|
}
|
|
4756
4787
|
}
|
|
4757
4788
|
RenderEvent.REQUEST = 'render.request';
|
|
4789
|
+
RenderEvent.CHILD_START = 'render.child_start';
|
|
4758
4790
|
RenderEvent.START = 'render.start';
|
|
4759
4791
|
RenderEvent.BEFORE = 'render.before';
|
|
4760
4792
|
RenderEvent.RENDER = 'render';
|
|
@@ -4930,7 +4962,7 @@ const { isFinite } = Number;
|
|
|
4930
4962
|
const debug$8 = Debug.get('setAttr');
|
|
4931
4963
|
const LeafDataProxy = {
|
|
4932
4964
|
__setAttr(name, newValue, checkFiniteNumber) {
|
|
4933
|
-
if (this.
|
|
4965
|
+
if (this.leaferIsCreated) {
|
|
4934
4966
|
const oldValue = this.__.__getInput(name);
|
|
4935
4967
|
if (checkFiniteNumber && !isFinite(newValue) && newValue !== undefined) {
|
|
4936
4968
|
debug$8.warn(this.innerName, name, newValue);
|
|
@@ -5002,7 +5034,7 @@ const LeafMatrix = {
|
|
|
5002
5034
|
|
|
5003
5035
|
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
|
|
5004
5036
|
const { updateBounds: updateBounds$1 } = BranchHelper;
|
|
5005
|
-
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$
|
|
5037
|
+
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5 } = BoundsHelper;
|
|
5006
5038
|
const { toBounds: toBounds$2 } = PathBounds;
|
|
5007
5039
|
const LeafBounds = {
|
|
5008
5040
|
__updateWorldBounds() {
|
|
@@ -5085,7 +5117,7 @@ const LeafBounds = {
|
|
|
5085
5117
|
const b = this.__layout.boxBounds;
|
|
5086
5118
|
const data = this.__;
|
|
5087
5119
|
if (data.__pathInputed) {
|
|
5088
|
-
toBounds$2(data.
|
|
5120
|
+
toBounds$2(data.path, b);
|
|
5089
5121
|
}
|
|
5090
5122
|
else {
|
|
5091
5123
|
b.x = 0;
|
|
@@ -5097,7 +5129,7 @@ const LeafBounds = {
|
|
|
5097
5129
|
__updateAutoLayout() {
|
|
5098
5130
|
this.__layout.matrixChanged = true;
|
|
5099
5131
|
if (this.isBranch) {
|
|
5100
|
-
if (this.
|
|
5132
|
+
if (this.leaferIsReady)
|
|
5101
5133
|
this.leafer.layouter.addExtra(this);
|
|
5102
5134
|
if (this.__.flow) {
|
|
5103
5135
|
if (this.__layout.boxChanged)
|
|
@@ -5123,11 +5155,11 @@ const LeafBounds = {
|
|
|
5123
5155
|
},
|
|
5124
5156
|
__updateStrokeBounds() {
|
|
5125
5157
|
const layout = this.__layout;
|
|
5126
|
-
copyAndSpread$
|
|
5158
|
+
copyAndSpread$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
5127
5159
|
},
|
|
5128
5160
|
__updateRenderBounds() {
|
|
5129
5161
|
const layout = this.__layout;
|
|
5130
|
-
layout.renderSpread > 0 ? copyAndSpread$
|
|
5162
|
+
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
|
|
5131
5163
|
}
|
|
5132
5164
|
};
|
|
5133
5165
|
|
|
@@ -5158,7 +5190,7 @@ const LeafRender = {
|
|
|
5158
5190
|
if (this.__worldOpacity) {
|
|
5159
5191
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5160
5192
|
this.__drawRenderPath(canvas);
|
|
5161
|
-
this.
|
|
5193
|
+
this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
|
|
5162
5194
|
}
|
|
5163
5195
|
},
|
|
5164
5196
|
__updateWorldOpacity() {
|
|
@@ -5232,6 +5264,8 @@ let Leaf = class Leaf {
|
|
|
5232
5264
|
get innerName() { return this.__.name || this.tag + this.innerId; }
|
|
5233
5265
|
get __DataProcessor() { return LeafData; }
|
|
5234
5266
|
get __LayoutProcessor() { return LeafLayout; }
|
|
5267
|
+
get leaferIsCreated() { return this.leafer && this.leafer.created; }
|
|
5268
|
+
get leaferIsReady() { return this.leafer && this.leafer.ready; }
|
|
5235
5269
|
get isLeafer() { return false; }
|
|
5236
5270
|
get isBranch() { return false; }
|
|
5237
5271
|
get isBranchLeaf() { return false; }
|
|
@@ -5673,10 +5707,17 @@ let Branch = class Branch extends Leaf {
|
|
|
5673
5707
|
add(child, index) {
|
|
5674
5708
|
if (child === this)
|
|
5675
5709
|
return;
|
|
5710
|
+
const noIndex = index === undefined;
|
|
5711
|
+
if (!child.__) {
|
|
5712
|
+
if (child instanceof Array)
|
|
5713
|
+
return child.forEach(item => { this.add(item, index); noIndex || index++; });
|
|
5714
|
+
else
|
|
5715
|
+
child = UICreator.get(child.tag, child);
|
|
5716
|
+
}
|
|
5676
5717
|
if (child.parent)
|
|
5677
5718
|
child.parent.remove(child);
|
|
5678
5719
|
child.parent = this;
|
|
5679
|
-
|
|
5720
|
+
noIndex ? this.children.push(child) : this.children.splice(index, 0, child);
|
|
5680
5721
|
if (child.isBranch)
|
|
5681
5722
|
this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
|
|
5682
5723
|
child.__layout.boxChanged || child.__layout.boxChange();
|
|
@@ -5690,15 +5731,17 @@ let Branch = class Branch extends Leaf {
|
|
|
5690
5731
|
}
|
|
5691
5732
|
this.__layout.affectChildrenSort && this.__layout.childrenSortChange();
|
|
5692
5733
|
}
|
|
5693
|
-
addMany(...children) {
|
|
5694
|
-
children.forEach(child => this.add(child));
|
|
5695
|
-
}
|
|
5734
|
+
addMany(...children) { this.add(children); }
|
|
5696
5735
|
remove(child, destroy) {
|
|
5697
5736
|
if (child) {
|
|
5698
|
-
if (child.
|
|
5699
|
-
|
|
5737
|
+
if (child.__) {
|
|
5738
|
+
if (child.animationOut)
|
|
5739
|
+
child.__runAnimation('out', () => this.__remove(child, destroy));
|
|
5740
|
+
else
|
|
5741
|
+
this.__remove(child, destroy);
|
|
5742
|
+
}
|
|
5700
5743
|
else
|
|
5701
|
-
this.
|
|
5744
|
+
this.find(child).forEach(item => this.remove(item, destroy));
|
|
5702
5745
|
}
|
|
5703
5746
|
else if (child === undefined) {
|
|
5704
5747
|
super.remove(null, destroy);
|
|
@@ -5916,7 +5959,7 @@ class LeafLevelList {
|
|
|
5916
5959
|
}
|
|
5917
5960
|
}
|
|
5918
5961
|
|
|
5919
|
-
const version = "1.0.
|
|
5962
|
+
const version = "1.0.6";
|
|
5920
5963
|
|
|
5921
5964
|
const debug$7 = Debug.get('LeaferCanvas');
|
|
5922
5965
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6074,7 +6117,7 @@ class LeaferCanvas extends LeaferCanvasBase {
|
|
|
6074
6117
|
const oldSize = {};
|
|
6075
6118
|
DataHelper.copyAttrs(oldSize, this, canvasSizeAttrs);
|
|
6076
6119
|
this.resize(size);
|
|
6077
|
-
if (this.width !== undefined)
|
|
6120
|
+
if (this.resizeListener && this.width !== undefined)
|
|
6078
6121
|
this.resizeListener(new ResizeEvent(size, oldSize));
|
|
6079
6122
|
}
|
|
6080
6123
|
unrealCanvas() {
|
|
@@ -6558,6 +6601,7 @@ class Renderer {
|
|
|
6558
6601
|
this.totalBounds = new Bounds();
|
|
6559
6602
|
debug$5.log(target.innerName, '--->');
|
|
6560
6603
|
try {
|
|
6604
|
+
target.app.emit(RenderEvent.CHILD_START, target);
|
|
6561
6605
|
this.emitRender(RenderEvent.START);
|
|
6562
6606
|
this.renderOnce(callback);
|
|
6563
6607
|
this.emitRender(RenderEvent.END, this.totalBounds);
|
|
@@ -6855,7 +6899,7 @@ class Picker {
|
|
|
6855
6899
|
if (child.isBranch) {
|
|
6856
6900
|
if (hit || child.__ignoreHitWorld) {
|
|
6857
6901
|
this.eachFind(child.children, child.__onlyHitMask);
|
|
6858
|
-
if (child.isBranchLeaf
|
|
6902
|
+
if (child.isBranchLeaf)
|
|
6859
6903
|
this.hitChild(child, point);
|
|
6860
6904
|
}
|
|
6861
6905
|
}
|
|
@@ -7068,6 +7112,13 @@ function zoomLayerType() {
|
|
|
7068
7112
|
|
|
7069
7113
|
const TextConvert = {};
|
|
7070
7114
|
const ColorConvert = {};
|
|
7115
|
+
const UnitConvert = {
|
|
7116
|
+
number(value, percentRefer) {
|
|
7117
|
+
if (typeof value === 'object')
|
|
7118
|
+
return value.type === 'percent' ? value.value * percentRefer : value.value;
|
|
7119
|
+
return value;
|
|
7120
|
+
}
|
|
7121
|
+
};
|
|
7071
7122
|
const PathArrow = {};
|
|
7072
7123
|
const Paint = {};
|
|
7073
7124
|
const PaintImage = {};
|
|
@@ -7088,7 +7139,7 @@ const Transition = {
|
|
|
7088
7139
|
}
|
|
7089
7140
|
};
|
|
7090
7141
|
|
|
7091
|
-
const { parse } = PathConvert;
|
|
7142
|
+
const { parse, objectToCanvasData } = PathConvert;
|
|
7092
7143
|
const emptyPaint = {};
|
|
7093
7144
|
const debug$4 = Debug.get('UIData');
|
|
7094
7145
|
class UIData extends LeafData {
|
|
@@ -7102,10 +7153,11 @@ class UIData extends LeafData {
|
|
|
7102
7153
|
scaleX = -scaleX;
|
|
7103
7154
|
return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
|
|
7104
7155
|
}
|
|
7105
|
-
else
|
|
7156
|
+
else
|
|
7106
7157
|
return strokeWidth;
|
|
7107
|
-
}
|
|
7108
7158
|
}
|
|
7159
|
+
get __hasStroke() { return this.stroke && this.strokeWidth; }
|
|
7160
|
+
get __clipAfterFill() { return (this.cornerRadius || this.__pathInputed); }
|
|
7109
7161
|
get __autoWidth() { return !this._width; }
|
|
7110
7162
|
get __autoHeight() { return !this._height; }
|
|
7111
7163
|
get __autoSide() { return !this._width || !this._height; }
|
|
@@ -7122,9 +7174,8 @@ class UIData extends LeafData {
|
|
|
7122
7174
|
this.__leaf.scaleX *= -1;
|
|
7123
7175
|
debug$4.warn('width < 0, instead -scaleX ', this);
|
|
7124
7176
|
}
|
|
7125
|
-
else
|
|
7177
|
+
else
|
|
7126
7178
|
this._width = value;
|
|
7127
|
-
}
|
|
7128
7179
|
}
|
|
7129
7180
|
setHeight(value) {
|
|
7130
7181
|
if (value < 0) {
|
|
@@ -7132,9 +7183,8 @@ class UIData extends LeafData {
|
|
|
7132
7183
|
this.__leaf.scaleY *= -1;
|
|
7133
7184
|
debug$4.warn('height < 0, instead -scaleY', this);
|
|
7134
7185
|
}
|
|
7135
|
-
else
|
|
7186
|
+
else
|
|
7136
7187
|
this._height = value;
|
|
7137
|
-
}
|
|
7138
7188
|
}
|
|
7139
7189
|
setFill(value) {
|
|
7140
7190
|
if (this.__naturalWidth)
|
|
@@ -7175,9 +7225,10 @@ class UIData extends LeafData {
|
|
|
7175
7225
|
}
|
|
7176
7226
|
}
|
|
7177
7227
|
setPath(value) {
|
|
7178
|
-
|
|
7228
|
+
const isString = typeof value === 'string';
|
|
7229
|
+
if (isString || (value && typeof value[0] === 'object')) {
|
|
7179
7230
|
this.__setInput('path', value);
|
|
7180
|
-
this._path = parse(value);
|
|
7231
|
+
this._path = isString ? parse(value) : objectToCanvasData(value);
|
|
7181
7232
|
}
|
|
7182
7233
|
else {
|
|
7183
7234
|
if (this.__input)
|
|
@@ -7192,12 +7243,8 @@ class UIData extends LeafData {
|
|
|
7192
7243
|
value = value.filter((item) => item.visible !== false);
|
|
7193
7244
|
this._shadow = value.length ? value : null;
|
|
7194
7245
|
}
|
|
7195
|
-
else
|
|
7196
|
-
this._shadow = value.visible
|
|
7197
|
-
}
|
|
7198
|
-
else {
|
|
7199
|
-
this._shadow = null;
|
|
7200
|
-
}
|
|
7246
|
+
else
|
|
7247
|
+
this._shadow = value && value.visible !== false ? [value] : null;
|
|
7201
7248
|
}
|
|
7202
7249
|
setInnerShadow(value) {
|
|
7203
7250
|
this.__setInput('innerShadow', value);
|
|
@@ -7206,12 +7253,8 @@ class UIData extends LeafData {
|
|
|
7206
7253
|
value = value.filter((item) => item.visible !== false);
|
|
7207
7254
|
this._innerShadow = value.length ? value : null;
|
|
7208
7255
|
}
|
|
7209
|
-
else
|
|
7210
|
-
this._innerShadow = value.visible
|
|
7211
|
-
}
|
|
7212
|
-
else {
|
|
7213
|
-
this._innerShadow = null;
|
|
7214
|
-
}
|
|
7256
|
+
else
|
|
7257
|
+
this._innerShadow = value && value.visible !== false ? [value] : null;
|
|
7215
7258
|
}
|
|
7216
7259
|
__computePaint() {
|
|
7217
7260
|
const { fill, stroke } = this.__input;
|
|
@@ -7222,24 +7265,19 @@ class UIData extends LeafData {
|
|
|
7222
7265
|
this.__needComputePaint = false;
|
|
7223
7266
|
}
|
|
7224
7267
|
}
|
|
7225
|
-
const UnitConvert = {
|
|
7226
|
-
number(value, percentRefer) {
|
|
7227
|
-
if (typeof value === 'object')
|
|
7228
|
-
return value.type === 'percent' ? value.value * percentRefer : value.value;
|
|
7229
|
-
return value;
|
|
7230
|
-
}
|
|
7231
|
-
};
|
|
7232
7268
|
|
|
7233
7269
|
class GroupData extends UIData {
|
|
7234
7270
|
}
|
|
7235
7271
|
|
|
7236
7272
|
class BoxData extends GroupData {
|
|
7237
7273
|
get __boxStroke() { return !this.__pathInputed; }
|
|
7274
|
+
get __drawAfterFill() { return this.overflow === 'hide' && this.__clipAfterFill && this.__leaf.children.length; }
|
|
7275
|
+
get __clipAfterFill() { return this.__leaf.isOverflow || super.__clipAfterFill; }
|
|
7238
7276
|
}
|
|
7239
7277
|
|
|
7240
7278
|
class LeaferData extends GroupData {
|
|
7241
|
-
__getInputData() {
|
|
7242
|
-
const data = super.__getInputData();
|
|
7279
|
+
__getInputData(names, options) {
|
|
7280
|
+
const data = super.__getInputData(names, options);
|
|
7243
7281
|
canvasSizeAttrs.forEach(key => delete data[key]);
|
|
7244
7282
|
return data;
|
|
7245
7283
|
}
|
|
@@ -7266,6 +7304,7 @@ class StarData extends UIData {
|
|
|
7266
7304
|
}
|
|
7267
7305
|
|
|
7268
7306
|
class PathData extends UIData {
|
|
7307
|
+
get __pathInputed() { return 2; }
|
|
7269
7308
|
}
|
|
7270
7309
|
|
|
7271
7310
|
class PenData extends GroupData {
|
|
@@ -7312,16 +7351,18 @@ class ImageData extends RectData {
|
|
|
7312
7351
|
delete data.fill;
|
|
7313
7352
|
return data;
|
|
7314
7353
|
}
|
|
7315
|
-
__getInputData() {
|
|
7316
|
-
const data = super.__getInputData();
|
|
7354
|
+
__getInputData(names, options) {
|
|
7355
|
+
const data = super.__getInputData(names, options);
|
|
7317
7356
|
delete data.fill;
|
|
7318
7357
|
return data;
|
|
7319
7358
|
}
|
|
7320
7359
|
}
|
|
7321
7360
|
|
|
7322
7361
|
class CanvasData extends RectData {
|
|
7323
|
-
|
|
7324
|
-
|
|
7362
|
+
get __isCanvas() { return true; }
|
|
7363
|
+
get __drawAfterFill() { return true; }
|
|
7364
|
+
__getInputData(names, options) {
|
|
7365
|
+
const data = super.__getInputData(names, options);
|
|
7325
7366
|
data.url = this.__leaf.canvas.toDataURL('image/png');
|
|
7326
7367
|
return data;
|
|
7327
7368
|
}
|
|
@@ -7348,16 +7389,12 @@ const UIBounds = {
|
|
|
7348
7389
|
let width = 0;
|
|
7349
7390
|
const { shadow, innerShadow, blur, backgroundBlur } = this.__;
|
|
7350
7391
|
if (shadow)
|
|
7351
|
-
shadow.forEach(item =>
|
|
7352
|
-
width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5);
|
|
7353
|
-
});
|
|
7392
|
+
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));
|
|
7354
7393
|
if (blur)
|
|
7355
7394
|
width = Math.max(width, blur);
|
|
7356
7395
|
let shapeWidth = width = Math.ceil(width);
|
|
7357
7396
|
if (innerShadow)
|
|
7358
|
-
innerShadow.forEach(item =>
|
|
7359
|
-
shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5);
|
|
7360
|
-
});
|
|
7397
|
+
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));
|
|
7361
7398
|
if (backgroundBlur)
|
|
7362
7399
|
shapeWidth = Math.max(shapeWidth, backgroundBlur);
|
|
7363
7400
|
this.__layout.renderShapeSpread = shapeWidth;
|
|
@@ -7439,6 +7476,16 @@ const UIRender = {
|
|
|
7439
7476
|
if (stroke && !ignoreStroke)
|
|
7440
7477
|
this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7441
7478
|
}
|
|
7479
|
+
},
|
|
7480
|
+
__drawAfterFill(canvas, options) {
|
|
7481
|
+
if (this.__.__clipAfterFill) {
|
|
7482
|
+
canvas.save();
|
|
7483
|
+
this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
|
|
7484
|
+
this.__drawContent(canvas, options);
|
|
7485
|
+
canvas.restore();
|
|
7486
|
+
}
|
|
7487
|
+
else
|
|
7488
|
+
this.__drawContent(canvas, options);
|
|
7442
7489
|
}
|
|
7443
7490
|
};
|
|
7444
7491
|
function drawFast(ui, canvas, options) {
|
|
@@ -7505,8 +7552,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7505
7552
|
return pen;
|
|
7506
7553
|
}
|
|
7507
7554
|
get editConfig() { return undefined; }
|
|
7508
|
-
get editOuter() { return
|
|
7509
|
-
get editInner() { return '
|
|
7555
|
+
get editOuter() { return ''; }
|
|
7556
|
+
get editInner() { return ''; }
|
|
7510
7557
|
constructor(data) {
|
|
7511
7558
|
super(data);
|
|
7512
7559
|
}
|
|
@@ -7517,9 +7564,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7517
7564
|
Object.assign(this, data);
|
|
7518
7565
|
this.lockNormalStyle = false;
|
|
7519
7566
|
}
|
|
7520
|
-
else
|
|
7567
|
+
else
|
|
7521
7568
|
Object.assign(this, data);
|
|
7522
|
-
}
|
|
7523
7569
|
}
|
|
7524
7570
|
get(name) {
|
|
7525
7571
|
return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
@@ -7565,12 +7611,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7565
7611
|
this.__drawPathByData(canvas, this.__.path);
|
|
7566
7612
|
}
|
|
7567
7613
|
__drawPathByData(drawer, data) {
|
|
7568
|
-
|
|
7569
|
-
PathDrawer.drawPathByData(drawer, data);
|
|
7570
|
-
}
|
|
7571
|
-
else {
|
|
7572
|
-
this.__drawPathByBox(drawer);
|
|
7573
|
-
}
|
|
7614
|
+
data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer);
|
|
7574
7615
|
}
|
|
7575
7616
|
__drawPathByBox(drawer) {
|
|
7576
7617
|
const { x, y, width, height } = this.__layout.boxBounds;
|
|
@@ -7578,9 +7619,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7578
7619
|
const { cornerRadius } = this.__;
|
|
7579
7620
|
drawer.roundRect(x, y, width, height, typeof cornerRadius === 'number' ? [cornerRadius] : cornerRadius);
|
|
7580
7621
|
}
|
|
7581
|
-
else
|
|
7622
|
+
else
|
|
7582
7623
|
drawer.rect(x, y, width, height);
|
|
7583
|
-
}
|
|
7584
7624
|
}
|
|
7585
7625
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7586
7626
|
return needPlugin('animate');
|
|
@@ -7827,23 +7867,13 @@ let Group = class Group extends UI {
|
|
|
7827
7867
|
if (data.children) {
|
|
7828
7868
|
const { children } = data;
|
|
7829
7869
|
delete data.children;
|
|
7830
|
-
|
|
7831
|
-
this.__setBranch();
|
|
7832
|
-
}
|
|
7833
|
-
else {
|
|
7834
|
-
this.clear();
|
|
7835
|
-
}
|
|
7870
|
+
this.children ? this.clear() : this.__setBranch();
|
|
7836
7871
|
super.set(data, isTemp);
|
|
7837
|
-
|
|
7838
|
-
children.forEach(childData => {
|
|
7839
|
-
child = childData.__ ? childData : UICreator.get(childData.tag, childData);
|
|
7840
|
-
this.add(child);
|
|
7841
|
-
});
|
|
7872
|
+
children.forEach(child => this.add(child));
|
|
7842
7873
|
data.children = children;
|
|
7843
7874
|
}
|
|
7844
|
-
else
|
|
7875
|
+
else
|
|
7845
7876
|
super.set(data, isTemp);
|
|
7846
|
-
}
|
|
7847
7877
|
}
|
|
7848
7878
|
toJSON(options) {
|
|
7849
7879
|
const data = super.toJSON(options);
|
|
@@ -8263,10 +8293,9 @@ Rect = __decorate([
|
|
|
8263
8293
|
registerUI()
|
|
8264
8294
|
], Rect);
|
|
8265
8295
|
|
|
8266
|
-
const
|
|
8267
|
-
const group$1 = Group.prototype;
|
|
8296
|
+
const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
|
|
8297
|
+
const rect$1 = Rect.prototype, group$1 = Group.prototype;
|
|
8268
8298
|
const childrenRenderBounds = {};
|
|
8269
|
-
const { copy: copy$3, add, includes: includes$1, copyAndSpread: copyAndSpread$1 } = BoundsHelper;
|
|
8270
8299
|
let Box = class Box extends Group {
|
|
8271
8300
|
get __tag() { return 'Box'; }
|
|
8272
8301
|
get isBranchLeaf() { return true; }
|
|
@@ -8276,37 +8305,31 @@ let Box = class Box extends Group {
|
|
|
8276
8305
|
}
|
|
8277
8306
|
__updateStrokeSpread() { return 0; }
|
|
8278
8307
|
__updateRectRenderSpread() { return 0; }
|
|
8279
|
-
__updateRenderSpread() {
|
|
8280
|
-
return this.__updateRectRenderSpread() || -1;
|
|
8281
|
-
}
|
|
8308
|
+
__updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
|
|
8282
8309
|
__updateRectBoxBounds() { }
|
|
8283
|
-
__updateBoxBounds(
|
|
8310
|
+
__updateBoxBounds(_secondLayout) {
|
|
8284
8311
|
const data = this.__;
|
|
8285
8312
|
if (this.children.length) {
|
|
8286
8313
|
if (data.__autoSide) {
|
|
8287
|
-
if (this.leafer && this.leafer.ready)
|
|
8288
|
-
this.leafer.layouter.addExtra(this);
|
|
8289
8314
|
super.__updateBoxBounds();
|
|
8290
8315
|
const { boxBounds } = this.__layout;
|
|
8291
8316
|
if (!data.__autoSize) {
|
|
8292
|
-
if (data.__autoWidth)
|
|
8293
|
-
boxBounds.width += boxBounds.x, boxBounds.
|
|
8294
|
-
|
|
8295
|
-
|
|
8317
|
+
if (data.__autoWidth) {
|
|
8318
|
+
boxBounds.width += boxBounds.x, boxBounds.x = 0;
|
|
8319
|
+
boxBounds.height = data.height, boxBounds.y = 0;
|
|
8320
|
+
}
|
|
8321
|
+
else {
|
|
8322
|
+
boxBounds.height += boxBounds.y, boxBounds.y = 0;
|
|
8323
|
+
boxBounds.width = data.width, boxBounds.x = 0;
|
|
8324
|
+
}
|
|
8296
8325
|
}
|
|
8297
|
-
if (secondLayout && data.flow && data.padding)
|
|
8298
|
-
copyAndSpread$1(boxBounds, boxBounds, data.padding, false, data.__autoSize ? null : (data.__autoWidth ? 'width' : 'height'));
|
|
8299
8326
|
this.__updateNaturalSize();
|
|
8300
8327
|
}
|
|
8301
|
-
else
|
|
8328
|
+
else
|
|
8302
8329
|
this.__updateRectBoxBounds();
|
|
8303
|
-
}
|
|
8304
|
-
if (data.flow)
|
|
8305
|
-
this.__updateContentBounds();
|
|
8306
8330
|
}
|
|
8307
|
-
else
|
|
8331
|
+
else
|
|
8308
8332
|
this.__updateRectBoxBounds();
|
|
8309
|
-
}
|
|
8310
8333
|
}
|
|
8311
8334
|
__updateStrokeBounds() { }
|
|
8312
8335
|
__updateRenderBounds() {
|
|
@@ -8316,14 +8339,13 @@ let Box = class Box extends Group {
|
|
|
8316
8339
|
super.__updateRenderBounds();
|
|
8317
8340
|
copy$3(childrenRenderBounds, renderBounds);
|
|
8318
8341
|
this.__updateRectRenderBounds();
|
|
8319
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8342
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8343
|
+
if (isOverflow && this.__.overflow !== 'hide')
|
|
8344
|
+
add(renderBounds, childrenRenderBounds);
|
|
8320
8345
|
}
|
|
8321
|
-
else
|
|
8346
|
+
else
|
|
8322
8347
|
this.__updateRectRenderBounds();
|
|
8323
|
-
|
|
8324
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8325
|
-
if (!(this.__.__drawAfterFill = this.__.overflow === 'hide') && isOverflow)
|
|
8326
|
-
add(renderBounds, childrenRenderBounds);
|
|
8348
|
+
!this.isOverflow !== !isOverflow && (this.isOverflow = isOverflow);
|
|
8327
8349
|
}
|
|
8328
8350
|
__updateRectRenderBounds() { }
|
|
8329
8351
|
__updateRectChange() { }
|
|
@@ -8343,20 +8365,9 @@ let Box = class Box extends Group {
|
|
|
8343
8365
|
this.__renderGroup(canvas, options);
|
|
8344
8366
|
}
|
|
8345
8367
|
}
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
if (this.
|
|
8349
|
-
canvas.save();
|
|
8350
|
-
canvas.clip();
|
|
8351
|
-
if (length)
|
|
8352
|
-
this.__renderGroup(canvas, options);
|
|
8353
|
-
canvas.restore();
|
|
8354
|
-
}
|
|
8355
|
-
else {
|
|
8356
|
-
if (length)
|
|
8357
|
-
this.__renderGroup(canvas, options);
|
|
8358
|
-
}
|
|
8359
|
-
if (this.__.stroke && length) {
|
|
8368
|
+
__drawContent(canvas, options) {
|
|
8369
|
+
this.__renderGroup(canvas, options);
|
|
8370
|
+
if (this.__.__hasStroke) {
|
|
8360
8371
|
canvas.setWorld(this.__nowWorld);
|
|
8361
8372
|
this.__drawRenderPath(canvas);
|
|
8362
8373
|
}
|
|
@@ -8368,6 +8379,9 @@ __decorate([
|
|
|
8368
8379
|
__decorate([
|
|
8369
8380
|
dataType(false)
|
|
8370
8381
|
], Box.prototype, "resizeChildren", void 0);
|
|
8382
|
+
__decorate([
|
|
8383
|
+
dataType(false)
|
|
8384
|
+
], Box.prototype, "textBox", void 0);
|
|
8371
8385
|
__decorate([
|
|
8372
8386
|
affectRenderBoundsType('show')
|
|
8373
8387
|
], Box.prototype, "overflow", void 0);
|
|
@@ -8517,17 +8531,15 @@ let Line = class Line extends UI {
|
|
|
8517
8531
|
if (data.__useArrow)
|
|
8518
8532
|
PathArrow.addArrows(this, false);
|
|
8519
8533
|
}
|
|
8520
|
-
else
|
|
8534
|
+
else
|
|
8521
8535
|
super.__updateRenderPath();
|
|
8522
|
-
}
|
|
8523
8536
|
}
|
|
8524
8537
|
__updateBoxBounds() {
|
|
8525
8538
|
if (this.points) {
|
|
8526
8539
|
toBounds$1(this.__.__pathForRender, this.__layout.boxBounds);
|
|
8527
8540
|
}
|
|
8528
|
-
else
|
|
8541
|
+
else
|
|
8529
8542
|
super.__updateBoxBounds();
|
|
8530
|
-
}
|
|
8531
8543
|
}
|
|
8532
8544
|
};
|
|
8533
8545
|
__decorate([
|
|
@@ -8665,7 +8677,6 @@ let Canvas = class Canvas extends Rect {
|
|
|
8665
8677
|
super(data);
|
|
8666
8678
|
this.canvas = Creator.canvas(this.__);
|
|
8667
8679
|
this.context = this.canvas.context;
|
|
8668
|
-
this.__.__isCanvas = this.__.__drawAfterFill = true;
|
|
8669
8680
|
if (data && data.url)
|
|
8670
8681
|
this.drawImage(data.url);
|
|
8671
8682
|
}
|
|
@@ -8678,8 +8689,7 @@ let Canvas = class Canvas extends Rect {
|
|
|
8678
8689
|
});
|
|
8679
8690
|
}
|
|
8680
8691
|
draw(ui, offset, scale, rotation) {
|
|
8681
|
-
ui.
|
|
8682
|
-
const matrix = new Matrix(ui.__world).invert();
|
|
8692
|
+
const matrix = new Matrix(ui.worldTransform).invert();
|
|
8683
8693
|
const m = new Matrix();
|
|
8684
8694
|
if (offset)
|
|
8685
8695
|
m.translate(offset.x, offset.y);
|
|
@@ -8694,17 +8704,9 @@ let Canvas = class Canvas extends Rect {
|
|
|
8694
8704
|
paint() {
|
|
8695
8705
|
this.forceRender();
|
|
8696
8706
|
}
|
|
8697
|
-
|
|
8698
|
-
const { width, height
|
|
8699
|
-
|
|
8700
|
-
canvas.save();
|
|
8701
|
-
canvas.clip();
|
|
8702
|
-
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8703
|
-
canvas.restore();
|
|
8704
|
-
}
|
|
8705
|
-
else {
|
|
8706
|
-
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8707
|
-
}
|
|
8707
|
+
__drawContent(canvas, _options) {
|
|
8708
|
+
const { width, height } = this.__, { view } = this.canvas;
|
|
8709
|
+
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8708
8710
|
}
|
|
8709
8711
|
__updateSize() {
|
|
8710
8712
|
const { canvas } = this;
|
|
@@ -8748,7 +8750,6 @@ Canvas = __decorate([
|
|
|
8748
8750
|
const { copyAndSpread, includes, isSame: isSame$1, spread, setList } = BoundsHelper;
|
|
8749
8751
|
let Text = class Text extends UI {
|
|
8750
8752
|
get __tag() { return 'Text'; }
|
|
8751
|
-
get editInner() { return 'TextEditor'; }
|
|
8752
8753
|
get textDrawData() {
|
|
8753
8754
|
this.__layout.update();
|
|
8754
8755
|
return this.__.__textDrawData;
|
|
@@ -8897,6 +8898,9 @@ __decorate([
|
|
|
8897
8898
|
__decorate([
|
|
8898
8899
|
boundsType('top')
|
|
8899
8900
|
], Text.prototype, "verticalAlign", void 0);
|
|
8901
|
+
__decorate([
|
|
8902
|
+
boundsType(true)
|
|
8903
|
+
], Text.prototype, "autoSizeAlign", void 0);
|
|
8900
8904
|
__decorate([
|
|
8901
8905
|
boundsType('normal')
|
|
8902
8906
|
], Text.prototype, "textWrap", void 0);
|
|
@@ -8911,7 +8915,6 @@ let Path = class Path extends UI {
|
|
|
8911
8915
|
get __tag() { return 'Path'; }
|
|
8912
8916
|
constructor(data) {
|
|
8913
8917
|
super(data);
|
|
8914
|
-
this.__.__pathInputed = 2;
|
|
8915
8918
|
}
|
|
8916
8919
|
};
|
|
8917
8920
|
__decorate([
|
|
@@ -8994,21 +8997,17 @@ let App = class App extends Leafer {
|
|
|
8994
8997
|
this.tree = this.addLeafer(tree);
|
|
8995
8998
|
if (sky || editor)
|
|
8996
8999
|
this.sky = this.addLeafer(sky || { type: 'draw', usePartRender: false });
|
|
8997
|
-
if (editor)
|
|
8998
|
-
this.editor = Creator.editor(editor);
|
|
8999
|
-
this.sky.add(this.editor);
|
|
9000
|
-
}
|
|
9000
|
+
if (editor)
|
|
9001
|
+
this.sky.add(this.editor = Creator.editor(editor));
|
|
9001
9002
|
}
|
|
9002
9003
|
}
|
|
9003
9004
|
__setApp() {
|
|
9004
9005
|
const { canvas } = this;
|
|
9005
9006
|
const { realCanvas, view } = this.config;
|
|
9006
|
-
if (realCanvas || view === this.canvas.view || !canvas.parentView)
|
|
9007
|
+
if (realCanvas || view === this.canvas.view || !canvas.parentView)
|
|
9007
9008
|
this.realCanvas = true;
|
|
9008
|
-
|
|
9009
|
-
else {
|
|
9009
|
+
else
|
|
9010
9010
|
canvas.unrealCanvas();
|
|
9011
|
-
}
|
|
9012
9011
|
this.leafer = this;
|
|
9013
9012
|
this.watcher.disable();
|
|
9014
9013
|
this.layouter.disable();
|
|
@@ -9414,10 +9413,7 @@ leafer.initType = function (type) {
|
|
|
9414
9413
|
leafer.getValidMove = function (moveX, moveY) {
|
|
9415
9414
|
const { scroll, disabled } = this.app.config.move;
|
|
9416
9415
|
if (scroll) {
|
|
9417
|
-
|
|
9418
|
-
moveY = 0;
|
|
9419
|
-
else
|
|
9420
|
-
moveX = 0;
|
|
9416
|
+
Math.abs(moveX) > Math.abs(moveY) ? moveY = 0 : moveX = 0;
|
|
9421
9417
|
if (scroll === 'limit') {
|
|
9422
9418
|
const { x, y, width, height } = new Bounds(this.__world).addPoint(this.zoomLayer);
|
|
9423
9419
|
const right = x + width - this.width, bottom = y + height - this.height;
|
|
@@ -9617,9 +9613,10 @@ class Dragger {
|
|
|
9617
9613
|
this.dragData = getDragEventData(data, data, data);
|
|
9618
9614
|
this.canAnimate = this.canDragOut = true;
|
|
9619
9615
|
}
|
|
9620
|
-
getList() {
|
|
9616
|
+
getList(realDraggable, hover) {
|
|
9621
9617
|
const { proxy } = this.interaction.selector;
|
|
9622
|
-
|
|
9618
|
+
const hasProxyList = proxy && proxy.list.length, dragList = DragEvent.list || this.draggableList || emptyList;
|
|
9619
|
+
return this.dragging && (hasProxyList ? (realDraggable ? emptyList : new LeafList(hover ? [...proxy.list, ...proxy.dragHoverExclude] : proxy.list)) : dragList);
|
|
9623
9620
|
}
|
|
9624
9621
|
checkDrag(data, canDrag) {
|
|
9625
9622
|
const { interaction } = this;
|
|
@@ -9644,8 +9641,8 @@ class Dragger {
|
|
|
9644
9641
|
this.dragging = canDrag && PointerButton.left(data);
|
|
9645
9642
|
if (this.dragging) {
|
|
9646
9643
|
this.interaction.emit(DragEvent.START, this.dragData);
|
|
9647
|
-
this.
|
|
9648
|
-
this.setDragStartPoints(this.
|
|
9644
|
+
this.getDraggableList(this.dragData.path);
|
|
9645
|
+
this.setDragStartPoints(this.realDraggableList = this.getList(true));
|
|
9649
9646
|
}
|
|
9650
9647
|
}
|
|
9651
9648
|
}
|
|
@@ -9653,12 +9650,12 @@ class Dragger {
|
|
|
9653
9650
|
this.dragStartPoints = {};
|
|
9654
9651
|
list.forEach(leaf => this.dragStartPoints[leaf.innerId] = { x: leaf.x, y: leaf.y });
|
|
9655
9652
|
}
|
|
9656
|
-
|
|
9653
|
+
getDraggableList(path) {
|
|
9657
9654
|
let leaf;
|
|
9658
9655
|
for (let i = 0, len = path.length; i < len; i++) {
|
|
9659
9656
|
leaf = path.list[i];
|
|
9660
|
-
if ((leaf.
|
|
9661
|
-
this.
|
|
9657
|
+
if ((leaf.draggable || leaf.editable) && leaf.hitSelf && !leaf.locked) {
|
|
9658
|
+
this.draggableList = new LeafList(leaf);
|
|
9662
9659
|
break;
|
|
9663
9660
|
}
|
|
9664
9661
|
}
|
|
@@ -9683,7 +9680,7 @@ class Dragger {
|
|
|
9683
9680
|
}
|
|
9684
9681
|
dragReal() {
|
|
9685
9682
|
const { running } = this.interaction;
|
|
9686
|
-
const list = this.
|
|
9683
|
+
const list = this.realDraggableList;
|
|
9687
9684
|
if (list.length && running) {
|
|
9688
9685
|
const { totalX, totalY } = this.dragData;
|
|
9689
9686
|
list.forEach(leaf => leaf.draggable && leaf.move(DragEvent.getValidMove(leaf, this.dragStartPoints[leaf.innerId], { x: totalX, y: totalY })));
|
|
@@ -9772,7 +9769,7 @@ class Dragger {
|
|
|
9772
9769
|
this.interaction.emit(DragEvent.LEAVE, data, dragEnterPath);
|
|
9773
9770
|
}
|
|
9774
9771
|
dragReset() {
|
|
9775
|
-
DragEvent.list = DragEvent.data = this.
|
|
9772
|
+
DragEvent.list = DragEvent.data = this.draggableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
|
|
9776
9773
|
}
|
|
9777
9774
|
checkDragOut(data) {
|
|
9778
9775
|
const { interaction } = this;
|
|
@@ -9913,6 +9910,7 @@ const config = {
|
|
|
9913
9910
|
touch: {
|
|
9914
9911
|
preventDefault: true
|
|
9915
9912
|
},
|
|
9913
|
+
multiTouch: {},
|
|
9916
9914
|
cursor: true,
|
|
9917
9915
|
keyEvent: true
|
|
9918
9916
|
};
|
|
@@ -10039,6 +10037,8 @@ class InteractionBase {
|
|
|
10039
10037
|
this.pointerUp(data);
|
|
10040
10038
|
}
|
|
10041
10039
|
multiTouch(data, list) {
|
|
10040
|
+
if (this.config.multiTouch.disabled)
|
|
10041
|
+
return;
|
|
10042
10042
|
const { move, angle, scale, center } = MultiTouchHelper.getData(list);
|
|
10043
10043
|
this.rotate(getRotateEventData$1(center, angle, data));
|
|
10044
10044
|
this.zoom(getZoomEventData$1(center, scale, data));
|
|
@@ -10228,7 +10228,7 @@ class InteractionBase {
|
|
|
10228
10228
|
data = this.hoverData;
|
|
10229
10229
|
if (!data)
|
|
10230
10230
|
return;
|
|
10231
|
-
this.findPath(data, { exclude: this.dragger.getList(), name: PointerEvent.MOVE });
|
|
10231
|
+
this.findPath(data, { exclude: this.dragger.getList(false, true), name: PointerEvent.MOVE });
|
|
10232
10232
|
this.hoverData = data;
|
|
10233
10233
|
}
|
|
10234
10234
|
updateCursor(data) {
|
|
@@ -10250,7 +10250,7 @@ class InteractionBase {
|
|
|
10250
10250
|
const { path } = data;
|
|
10251
10251
|
for (let i = 0, len = path.length; i < len; i++) {
|
|
10252
10252
|
leaf = path.list[i];
|
|
10253
|
-
cursor = leaf.syncEventer
|
|
10253
|
+
cursor = (leaf.syncEventer && leaf.syncEventer.cursor) || leaf.cursor;
|
|
10254
10254
|
if (cursor)
|
|
10255
10255
|
break;
|
|
10256
10256
|
}
|
|
@@ -10432,7 +10432,7 @@ ui$2.__updateHitCanvas = function () {
|
|
|
10432
10432
|
if (isHitPixel) {
|
|
10433
10433
|
const { renderBounds } = this.__layout;
|
|
10434
10434
|
const size = Platform.image.hitCanvasSize;
|
|
10435
|
-
const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds
|
|
10435
|
+
const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds).a;
|
|
10436
10436
|
const { x, y, width, height } = tempBounds$1.set(renderBounds).scale(scale);
|
|
10437
10437
|
h.resize({ width, height, pixelRatio: 1 });
|
|
10438
10438
|
h.clear();
|
|
@@ -10488,15 +10488,14 @@ ui$2.__hit = function (inner) {
|
|
|
10488
10488
|
return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
|
|
10489
10489
|
};
|
|
10490
10490
|
|
|
10491
|
-
const ui$1 =
|
|
10492
|
-
|
|
10493
|
-
rect.__updateHitCanvas = function () {
|
|
10491
|
+
const ui$1 = UI.prototype, rect = Rect.prototype, box$1 = Box.prototype;
|
|
10492
|
+
rect.__updateHitCanvas = box$1.__updateHitCanvas = function () {
|
|
10494
10493
|
if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
|
|
10495
10494
|
ui$1.__updateHitCanvas.call(this);
|
|
10496
10495
|
else if (this.__hitCanvas)
|
|
10497
10496
|
this.__hitCanvas = null;
|
|
10498
10497
|
};
|
|
10499
|
-
rect.__hitFill = function (inner) {
|
|
10498
|
+
rect.__hitFill = box$1.__hitFill = function (inner) {
|
|
10500
10499
|
return this.__hitCanvas ? ui$1.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
|
|
10501
10500
|
};
|
|
10502
10501
|
|
|
@@ -11347,9 +11346,10 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
11347
11346
|
onLoadError(ui, event, image.error);
|
|
11348
11347
|
}
|
|
11349
11348
|
else {
|
|
11350
|
-
|
|
11351
|
-
|
|
11349
|
+
if (firstUse) {
|
|
11350
|
+
ignoreRender(ui, true);
|
|
11352
11351
|
onLoad(ui, event);
|
|
11352
|
+
}
|
|
11353
11353
|
leafPaint.loadId = image.load(() => {
|
|
11354
11354
|
ignoreRender(ui, false);
|
|
11355
11355
|
if (!ui.destroyed) {
|
|
@@ -11497,7 +11497,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
|
|
|
11497
11497
|
}
|
|
11498
11498
|
if (allowPaint) {
|
|
11499
11499
|
canvas.save();
|
|
11500
|
-
canvas.clip();
|
|
11500
|
+
ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
|
|
11501
11501
|
if (paint.blendMode)
|
|
11502
11502
|
canvas.blendMode = paint.blendMode;
|
|
11503
11503
|
if (data.opacity)
|
|
@@ -11961,11 +11961,12 @@ const { trimRight } = TextRowHelper;
|
|
|
11961
11961
|
const { Letter, Single, Before, After, Symbol, Break } = CharType;
|
|
11962
11962
|
let word, row, wordWidth, rowWidth, realWidth;
|
|
11963
11963
|
let char, charWidth, startCharSize, charSize, charType, lastCharType, langBreak, afterBreak, paraStart;
|
|
11964
|
-
let textDrawData, rows = [], bounds;
|
|
11964
|
+
let textDrawData, rows = [], bounds, findMaxWidth;
|
|
11965
11965
|
function createRows(drawData, content, style) {
|
|
11966
11966
|
textDrawData = drawData;
|
|
11967
11967
|
rows = drawData.rows;
|
|
11968
11968
|
bounds = drawData.bounds;
|
|
11969
|
+
findMaxWidth = !bounds.width && !style.autoSizeAlign;
|
|
11969
11970
|
const { __letterSpacing, paraIndent, textCase } = style;
|
|
11970
11971
|
const { canvas } = Platform;
|
|
11971
11972
|
const { width, height } = bounds;
|
|
@@ -12050,7 +12051,10 @@ function createRows(drawData, content, style) {
|
|
|
12050
12051
|
else {
|
|
12051
12052
|
content.split('\n').forEach(content => {
|
|
12052
12053
|
textDrawData.paraNumber++;
|
|
12053
|
-
|
|
12054
|
+
rowWidth = canvas.measureText(content).width;
|
|
12055
|
+
rows.push({ x: paraIndent || 0, text: content, width: rowWidth, paraStart: true });
|
|
12056
|
+
if (findMaxWidth)
|
|
12057
|
+
setMaxWidth();
|
|
12054
12058
|
});
|
|
12055
12059
|
}
|
|
12056
12060
|
}
|
|
@@ -12081,10 +12085,16 @@ function addRow() {
|
|
|
12081
12085
|
row.width = rowWidth;
|
|
12082
12086
|
if (bounds.width)
|
|
12083
12087
|
trimRight(row);
|
|
12088
|
+
else if (findMaxWidth)
|
|
12089
|
+
setMaxWidth();
|
|
12084
12090
|
rows.push(row);
|
|
12085
12091
|
row = { words: [] };
|
|
12086
12092
|
rowWidth = 0;
|
|
12087
12093
|
}
|
|
12094
|
+
function setMaxWidth() {
|
|
12095
|
+
if (rowWidth > (textDrawData.maxWidth || 0))
|
|
12096
|
+
textDrawData.maxWidth = rowWidth;
|
|
12097
|
+
}
|
|
12088
12098
|
|
|
12089
12099
|
const CharMode = 0;
|
|
12090
12100
|
const WordMode = 1;
|
|
@@ -12156,34 +12166,32 @@ function toChar(data, charX, rowData, isOverflow) {
|
|
|
12156
12166
|
|
|
12157
12167
|
function layoutText(drawData, style) {
|
|
12158
12168
|
const { rows, bounds } = drawData;
|
|
12159
|
-
const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing } = style;
|
|
12169
|
+
const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
|
|
12160
12170
|
let { x, y, width, height } = bounds, realHeight = __lineHeight * rows.length + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
12161
12171
|
let starY = __baseLine;
|
|
12162
12172
|
if (__clipText && realHeight > height) {
|
|
12163
12173
|
realHeight = Math.max(height, __lineHeight);
|
|
12164
12174
|
drawData.overflow = rows.length;
|
|
12165
12175
|
}
|
|
12166
|
-
else {
|
|
12176
|
+
else if (height || autoSizeAlign) {
|
|
12167
12177
|
switch (verticalAlign) {
|
|
12168
12178
|
case 'middle':
|
|
12169
12179
|
y += (height - realHeight) / 2;
|
|
12170
12180
|
break;
|
|
12171
|
-
case 'bottom':
|
|
12172
|
-
y += (height - realHeight);
|
|
12181
|
+
case 'bottom': y += (height - realHeight);
|
|
12173
12182
|
}
|
|
12174
12183
|
}
|
|
12175
12184
|
starY += y;
|
|
12176
|
-
let row, rowX, rowWidth;
|
|
12185
|
+
let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
|
|
12177
12186
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
12178
12187
|
row = rows[i];
|
|
12179
12188
|
row.x = x;
|
|
12180
12189
|
if (row.width < width || (row.width > width && !__clipText)) {
|
|
12181
12190
|
switch (textAlign) {
|
|
12182
12191
|
case 'center':
|
|
12183
|
-
row.x += (
|
|
12192
|
+
row.x += (layoutWidth - row.width) / 2;
|
|
12184
12193
|
break;
|
|
12185
|
-
case 'right':
|
|
12186
|
-
row.x += width - row.width;
|
|
12194
|
+
case 'right': row.x += layoutWidth - row.width;
|
|
12187
12195
|
}
|
|
12188
12196
|
}
|
|
12189
12197
|
if (row.paraStart && paraSpacing && i > 0)
|
|
@@ -12288,14 +12296,14 @@ function getDrawData(content, style) {
|
|
|
12288
12296
|
let height = style.__getInput('height') || 0;
|
|
12289
12297
|
const { textDecoration, __font, __padding: padding } = style;
|
|
12290
12298
|
if (padding) {
|
|
12291
|
-
if (width)
|
|
12299
|
+
if (width)
|
|
12300
|
+
x = padding[left], width -= (padding[right] + padding[left]);
|
|
12301
|
+
else if (!style.autoSizeAlign)
|
|
12292
12302
|
x = padding[left];
|
|
12293
|
-
|
|
12294
|
-
|
|
12295
|
-
if (
|
|
12303
|
+
if (height)
|
|
12304
|
+
y = padding[top], height -= (padding[top] + padding[bottom]);
|
|
12305
|
+
else if (!style.autoSizeAlign)
|
|
12296
12306
|
y = padding[top];
|
|
12297
|
-
height -= (padding[top] + padding[bottom]);
|
|
12298
|
-
}
|
|
12299
12307
|
}
|
|
12300
12308
|
const drawData = {
|
|
12301
12309
|
bounds: { x, y, width, height },
|
|
@@ -12315,22 +12323,20 @@ function getDrawData(content, style) {
|
|
|
12315
12323
|
return drawData;
|
|
12316
12324
|
}
|
|
12317
12325
|
function padAutoText(padding, drawData, style, width, height) {
|
|
12318
|
-
if (!width) {
|
|
12326
|
+
if (!width && style.autoSizeAlign) {
|
|
12319
12327
|
switch (style.textAlign) {
|
|
12320
12328
|
case 'left':
|
|
12321
12329
|
offsetText(drawData, 'x', padding[left]);
|
|
12322
12330
|
break;
|
|
12323
|
-
case 'right':
|
|
12324
|
-
offsetText(drawData, 'x', -padding[right]);
|
|
12331
|
+
case 'right': offsetText(drawData, 'x', -padding[right]);
|
|
12325
12332
|
}
|
|
12326
12333
|
}
|
|
12327
|
-
if (!height) {
|
|
12334
|
+
if (!height && style.autoSizeAlign) {
|
|
12328
12335
|
switch (style.verticalAlign) {
|
|
12329
12336
|
case 'top':
|
|
12330
12337
|
offsetText(drawData, 'y', padding[top]);
|
|
12331
12338
|
break;
|
|
12332
|
-
case 'bottom':
|
|
12333
|
-
offsetText(drawData, 'y', -padding[bottom]);
|
|
12339
|
+
case 'bottom': offsetText(drawData, 'y', -padding[bottom]);
|
|
12334
12340
|
}
|
|
12335
12341
|
}
|
|
12336
12342
|
}
|