leafer-ui 1.0.0-rc.22 → 1.0.0-rc.23
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 +44 -20
- package/dist/web.esm.min.js +1 -1
- package/dist/web.js +285 -160
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +285 -161
- package/dist/web.module.min.js +1 -1
- package/package.json +11 -11
package/dist/web.module.js
CHANGED
|
@@ -3,7 +3,7 @@ const Platform = {
|
|
|
3
3
|
hitCanvasSize: 100,
|
|
4
4
|
maxCacheSize: 2560 * 1600,
|
|
5
5
|
maxPatternSize: 4096 * 2160,
|
|
6
|
-
suffix: '
|
|
6
|
+
suffix: '',
|
|
7
7
|
crossOrigin: 'anonymous'
|
|
8
8
|
}
|
|
9
9
|
};
|
|
@@ -33,24 +33,12 @@ const I$2 = IncrementId;
|
|
|
33
33
|
const { round, pow: pow$1, PI: PI$4 } = Math;
|
|
34
34
|
const MathHelper = {
|
|
35
35
|
within(value, min, max) {
|
|
36
|
-
if (value < min)
|
|
36
|
+
if (min !== undefined && value < min)
|
|
37
37
|
value = min;
|
|
38
|
-
if (value > max)
|
|
38
|
+
if (max !== undefined && value > max)
|
|
39
39
|
value = max;
|
|
40
40
|
return value;
|
|
41
41
|
},
|
|
42
|
-
minus(value, isFourNumber) {
|
|
43
|
-
if (value instanceof Array) {
|
|
44
|
-
if (isFourNumber)
|
|
45
|
-
value = MathHelper.fourNumber(value, 0);
|
|
46
|
-
for (let i = 0; i < value.length; i++)
|
|
47
|
-
value[i] = -value[i];
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
value = -value;
|
|
51
|
-
}
|
|
52
|
-
return value;
|
|
53
|
-
},
|
|
54
42
|
fourNumber(num, maxValue) {
|
|
55
43
|
let data;
|
|
56
44
|
if (num instanceof Array) {
|
|
@@ -147,9 +135,11 @@ const MatrixHelper = {
|
|
|
147
135
|
t.e += x;
|
|
148
136
|
t.f += y;
|
|
149
137
|
},
|
|
150
|
-
translateInner(t, x, y) {
|
|
138
|
+
translateInner(t, x, y, isMoveOrigin) {
|
|
151
139
|
t.e += t.a * x + t.c * y;
|
|
152
140
|
t.f += t.b * x + t.d * y;
|
|
141
|
+
if (isMoveOrigin)
|
|
142
|
+
t.e -= x, t.f -= y;
|
|
153
143
|
},
|
|
154
144
|
scale(t, scaleX, scaleY = scaleX) {
|
|
155
145
|
t.a *= scaleX;
|
|
@@ -216,8 +206,10 @@ const MatrixHelper = {
|
|
|
216
206
|
t.e = child.e * a + child.f * c + e;
|
|
217
207
|
t.f = child.e * b + child.f * d + f;
|
|
218
208
|
},
|
|
219
|
-
multiplyParent(t, parent, to, abcdChanged, childScaleData) {
|
|
220
|
-
|
|
209
|
+
multiplyParent(t, parent, to, abcdChanged, childScaleData, scrollData) {
|
|
210
|
+
let { e, f } = t;
|
|
211
|
+
if (scrollData)
|
|
212
|
+
e += scrollData.scrollX, f += scrollData.scrollY;
|
|
221
213
|
to || (to = t);
|
|
222
214
|
if (abcdChanged === undefined)
|
|
223
215
|
abcdChanged = t.a !== 1 || t.b || t.c || t.d !== 1;
|
|
@@ -338,7 +330,7 @@ const MatrixHelper = {
|
|
|
338
330
|
t.e = x;
|
|
339
331
|
t.f = y;
|
|
340
332
|
if (origin)
|
|
341
|
-
M$6.translateInner(t, -origin.x, -origin.y);
|
|
333
|
+
M$6.translateInner(t, -origin.x, -origin.y, true);
|
|
342
334
|
},
|
|
343
335
|
getLayout(t, origin, firstSkewY) {
|
|
344
336
|
const { a, b, c, d, e, f } = t;
|
|
@@ -758,7 +750,7 @@ const { float, fourNumber } = MathHelper;
|
|
|
758
750
|
const { floor, ceil: ceil$2 } = Math;
|
|
759
751
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
760
752
|
const point = {};
|
|
761
|
-
const toPoint$
|
|
753
|
+
const toPoint$2 = {};
|
|
762
754
|
const BoundsHelper = {
|
|
763
755
|
tempBounds: {},
|
|
764
756
|
set(t, x = 0, y = 0, width = 0, height = 0) {
|
|
@@ -773,15 +765,17 @@ const BoundsHelper = {
|
|
|
773
765
|
t.width = bounds.width;
|
|
774
766
|
t.height = bounds.height;
|
|
775
767
|
},
|
|
776
|
-
copyAndSpread(t, bounds,
|
|
777
|
-
if (
|
|
778
|
-
const four = fourNumber(
|
|
779
|
-
|
|
768
|
+
copyAndSpread(t, bounds, spread, isShrink) {
|
|
769
|
+
if (spread instanceof Array) {
|
|
770
|
+
const four = fourNumber(spread);
|
|
771
|
+
isShrink
|
|
772
|
+
? B.set(t, bounds.x + four[3], bounds.y + four[0], bounds.width - four[1] - four[3], bounds.height - four[2] - four[0])
|
|
773
|
+
: B.set(t, bounds.x - four[3], bounds.y - four[0], bounds.width + four[1] + four[3], bounds.height + four[2] + four[0]);
|
|
780
774
|
}
|
|
781
775
|
else {
|
|
782
|
-
if (
|
|
783
|
-
|
|
784
|
-
B.set(t, bounds.x -
|
|
776
|
+
if (isShrink)
|
|
777
|
+
spread = -spread;
|
|
778
|
+
B.set(t, bounds.x - spread, bounds.y - spread, bounds.width + spread * 2, bounds.height + spread * 2);
|
|
785
779
|
}
|
|
786
780
|
},
|
|
787
781
|
minX(t) { return t.width > 0 ? t.x : t.x + t.width; },
|
|
@@ -858,17 +852,17 @@ const BoundsHelper = {
|
|
|
858
852
|
else {
|
|
859
853
|
point.x = t.x;
|
|
860
854
|
point.y = t.y;
|
|
861
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
862
|
-
setPoint$3(tempPointBounds$1, toPoint$
|
|
855
|
+
toOuterPoint$1(matrix, point, toPoint$2);
|
|
856
|
+
setPoint$3(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
863
857
|
point.x = t.x + t.width;
|
|
864
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
865
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
858
|
+
toOuterPoint$1(matrix, point, toPoint$2);
|
|
859
|
+
addPoint$3(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
866
860
|
point.y = t.y + t.height;
|
|
867
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
868
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
861
|
+
toOuterPoint$1(matrix, point, toPoint$2);
|
|
862
|
+
addPoint$3(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
869
863
|
point.x = t.x;
|
|
870
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
871
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
864
|
+
toOuterPoint$1(matrix, point, toPoint$2);
|
|
865
|
+
addPoint$3(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
872
866
|
toBounds$4(tempPointBounds$1, to);
|
|
873
867
|
}
|
|
874
868
|
},
|
|
@@ -881,13 +875,16 @@ const BoundsHelper = {
|
|
|
881
875
|
const scale = Math.min(baseScale, Math.min(t.width / put.width, t.height / put.height));
|
|
882
876
|
return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
|
|
883
877
|
},
|
|
884
|
-
getSpread(t,
|
|
878
|
+
getSpread(t, spread) {
|
|
885
879
|
const n = {};
|
|
886
|
-
B.copyAndSpread(n, t,
|
|
880
|
+
B.copyAndSpread(n, t, spread);
|
|
887
881
|
return n;
|
|
888
882
|
},
|
|
889
|
-
spread(t,
|
|
890
|
-
B.copyAndSpread(t, t,
|
|
883
|
+
spread(t, spread) {
|
|
884
|
+
B.copyAndSpread(t, t, spread);
|
|
885
|
+
},
|
|
886
|
+
shrink(t, shrink) {
|
|
887
|
+
B.copyAndSpread(t, t, shrink, true);
|
|
891
888
|
},
|
|
892
889
|
ceil(t) {
|
|
893
890
|
const { x, y } = t;
|
|
@@ -1067,12 +1064,12 @@ class Bounds {
|
|
|
1067
1064
|
getFitMatrix(put, baseScale) {
|
|
1068
1065
|
return BoundsHelper.getFitMatrix(this, put, baseScale);
|
|
1069
1066
|
}
|
|
1070
|
-
spread(fourNumber
|
|
1071
|
-
BoundsHelper.spread(this, fourNumber
|
|
1067
|
+
spread(fourNumber) {
|
|
1068
|
+
BoundsHelper.spread(this, fourNumber);
|
|
1072
1069
|
return this;
|
|
1073
1070
|
}
|
|
1074
1071
|
shrink(fourNumber) {
|
|
1075
|
-
BoundsHelper.
|
|
1072
|
+
BoundsHelper.shrink(this, fourNumber);
|
|
1076
1073
|
return this;
|
|
1077
1074
|
}
|
|
1078
1075
|
ceil() {
|
|
@@ -1189,6 +1186,10 @@ var Direction9;
|
|
|
1189
1186
|
Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
|
|
1190
1187
|
Direction9[Direction9["left"] = 7] = "left";
|
|
1191
1188
|
Direction9[Direction9["center"] = 8] = "center";
|
|
1189
|
+
Direction9[Direction9["top-left"] = 0] = "top-left";
|
|
1190
|
+
Direction9[Direction9["top-right"] = 2] = "top-right";
|
|
1191
|
+
Direction9[Direction9["bottom-right"] = 4] = "bottom-right";
|
|
1192
|
+
Direction9[Direction9["bottom-left"] = 6] = "bottom-left";
|
|
1192
1193
|
})(Direction9 || (Direction9 = {}));
|
|
1193
1194
|
|
|
1194
1195
|
const directionData = [
|
|
@@ -1202,6 +1203,7 @@ const directionData = [
|
|
|
1202
1203
|
{ x: 0, y: 0.5 },
|
|
1203
1204
|
{ x: 0.5, y: 0.5 }
|
|
1204
1205
|
];
|
|
1206
|
+
directionData.forEach(item => item.type = 'percent');
|
|
1205
1207
|
const AroundHelper = {
|
|
1206
1208
|
directionData,
|
|
1207
1209
|
tempPoint: {},
|
|
@@ -1209,15 +1211,19 @@ const AroundHelper = {
|
|
|
1209
1211
|
toPoint(around, bounds, to, onlySize, pointBounds) {
|
|
1210
1212
|
to || (to = {});
|
|
1211
1213
|
const point = get$5(around);
|
|
1212
|
-
to.x = point.x
|
|
1213
|
-
to.y = point.y
|
|
1214
|
-
if (
|
|
1215
|
-
to.x
|
|
1216
|
-
to.y
|
|
1217
|
-
if (
|
|
1218
|
-
to.x -=
|
|
1219
|
-
|
|
1220
|
-
|
|
1214
|
+
to.x = point.x;
|
|
1215
|
+
to.y = point.y;
|
|
1216
|
+
if (point.type === 'percent') {
|
|
1217
|
+
to.x *= bounds.width;
|
|
1218
|
+
to.y *= bounds.height;
|
|
1219
|
+
if (pointBounds) {
|
|
1220
|
+
to.x -= pointBounds.x;
|
|
1221
|
+
to.y -= pointBounds.y;
|
|
1222
|
+
if (point.x)
|
|
1223
|
+
to.x -= (point.x === 1) ? pointBounds.width : (point.x === 0.5 ? point.x * pointBounds.width : 0);
|
|
1224
|
+
if (point.y)
|
|
1225
|
+
to.y -= (point.y === 1) ? pointBounds.height : (point.y === 0.5 ? point.y * pointBounds.height : 0);
|
|
1226
|
+
}
|
|
1221
1227
|
}
|
|
1222
1228
|
if (!onlySize) {
|
|
1223
1229
|
to.x += bounds.x;
|
|
@@ -1229,6 +1235,13 @@ function get$5(around) {
|
|
|
1229
1235
|
return typeof around === 'string' ? directionData[Direction9[around]] : around;
|
|
1230
1236
|
}
|
|
1231
1237
|
|
|
1238
|
+
const { toPoint: toPoint$1 } = AroundHelper;
|
|
1239
|
+
const AlignHelper = {
|
|
1240
|
+
toPoint(align, contentBounds, bounds, to, onlySize) {
|
|
1241
|
+
toPoint$1(align, bounds, to, onlySize, contentBounds);
|
|
1242
|
+
}
|
|
1243
|
+
};
|
|
1244
|
+
|
|
1232
1245
|
const StringNumberMap = {
|
|
1233
1246
|
'0': 1,
|
|
1234
1247
|
'1': 1,
|
|
@@ -1461,13 +1474,19 @@ const DataHelper = {
|
|
|
1461
1474
|
},
|
|
1462
1475
|
clone(data) {
|
|
1463
1476
|
return JSON.parse(JSON.stringify(data));
|
|
1477
|
+
},
|
|
1478
|
+
toMap(list) {
|
|
1479
|
+
const map = {};
|
|
1480
|
+
for (let i = 0, len = list.length; i < len; i++)
|
|
1481
|
+
map[list[i]] = true;
|
|
1482
|
+
return map;
|
|
1464
1483
|
}
|
|
1465
1484
|
};
|
|
1466
1485
|
const { assign } = DataHelper;
|
|
1467
1486
|
|
|
1468
1487
|
class LeafData {
|
|
1469
1488
|
get __blendMode() {
|
|
1470
|
-
if (this.eraser)
|
|
1489
|
+
if (this.eraser && this.eraser !== 'path')
|
|
1471
1490
|
return 'destination-out';
|
|
1472
1491
|
const { blendMode } = this;
|
|
1473
1492
|
return blendMode === 'pass-through' ? null : blendMode;
|
|
@@ -2097,7 +2116,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2097
2116
|
}
|
|
2098
2117
|
clear() {
|
|
2099
2118
|
const { pixelRatio } = this;
|
|
2100
|
-
this.clearRect(0, 0, this.width * pixelRatio, this.height * pixelRatio);
|
|
2119
|
+
this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
|
|
2101
2120
|
}
|
|
2102
2121
|
isSameSize(size) {
|
|
2103
2122
|
return this.width === size.width && this.height === size.height && this.pixelRatio === size.pixelRatio;
|
|
@@ -3753,6 +3772,8 @@ function maskType(defaultValue) {
|
|
|
3753
3772
|
this.__setAttr(key, value);
|
|
3754
3773
|
this.__layout.boxChanged || this.__layout.boxChange();
|
|
3755
3774
|
this.waitParent(() => { this.parent.__updateMask(value); });
|
|
3775
|
+
if (typeof value === 'string')
|
|
3776
|
+
this.maskType = value;
|
|
3756
3777
|
}
|
|
3757
3778
|
}));
|
|
3758
3779
|
}
|
|
@@ -4182,11 +4203,19 @@ const WaitHelper = {
|
|
|
4182
4203
|
|
|
4183
4204
|
const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
|
|
4184
4205
|
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$6 } = BoundsHelper;
|
|
4206
|
+
const localContent = '_localContentBounds';
|
|
4207
|
+
const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
|
|
4185
4208
|
class LeafLayout {
|
|
4209
|
+
get contentBounds() { return this._contentBounds || this.boxBounds; }
|
|
4210
|
+
set contentBounds(bounds) { this._contentBounds = bounds; }
|
|
4186
4211
|
get strokeBounds() { return this._strokeBounds || this.boxBounds; }
|
|
4187
4212
|
get renderBounds() { return this._renderBounds || this.boxBounds; }
|
|
4213
|
+
get localContentBounds() { toOuterOf$2(this.contentBounds, this.leaf.__localMatrix, this[localContent] || (this[localContent] = {})); return this[localContent]; }
|
|
4188
4214
|
get localStrokeBounds() { return this._localStrokeBounds || this; }
|
|
4189
4215
|
get localRenderBounds() { return this._localRenderBounds || this; }
|
|
4216
|
+
get worldContentBounds() { toOuterOf$2(this.contentBounds, this.leaf.__world, this[worldContent] || (this[worldContent] = {})); return this[worldContent]; }
|
|
4217
|
+
get worldBoxBounds() { toOuterOf$2(this.boxBounds, this.leaf.__world, this[worldBox] || (this[worldBox] = {})); return this[worldBox]; }
|
|
4218
|
+
get worldStrokeBounds() { toOuterOf$2(this.strokeBounds, this.leaf.__world, this[worldStroke] || (this[worldStroke] = {})); return this[worldStroke]; }
|
|
4190
4219
|
get a() { return 1; }
|
|
4191
4220
|
get b() { return 0; }
|
|
4192
4221
|
get c() { return 0; }
|
|
@@ -4269,7 +4298,6 @@ class LeafLayout {
|
|
|
4269
4298
|
case 'content':
|
|
4270
4299
|
if (this.contentBounds)
|
|
4271
4300
|
return this.contentBounds;
|
|
4272
|
-
case 'margin':
|
|
4273
4301
|
case 'box':
|
|
4274
4302
|
return this.boxBounds;
|
|
4275
4303
|
case 'stroke':
|
|
@@ -4282,8 +4310,9 @@ class LeafLayout {
|
|
|
4282
4310
|
return this.localRenderBounds;
|
|
4283
4311
|
case 'stroke':
|
|
4284
4312
|
return this.localStrokeBounds;
|
|
4285
|
-
case 'margin':
|
|
4286
4313
|
case 'content':
|
|
4314
|
+
if (this.contentBounds)
|
|
4315
|
+
return this.localContentBounds;
|
|
4287
4316
|
case 'box':
|
|
4288
4317
|
return this.leaf.__localBoxBounds;
|
|
4289
4318
|
}
|
|
@@ -4292,15 +4321,13 @@ class LeafLayout {
|
|
|
4292
4321
|
switch (type) {
|
|
4293
4322
|
case 'render':
|
|
4294
4323
|
return this.leaf.__world;
|
|
4324
|
+
case 'stroke':
|
|
4325
|
+
return this.worldStrokeBounds;
|
|
4295
4326
|
case 'content':
|
|
4296
4327
|
if (this.contentBounds)
|
|
4297
|
-
return this.
|
|
4298
|
-
case 'margin':
|
|
4328
|
+
return this.worldContentBounds;
|
|
4299
4329
|
case 'box':
|
|
4300
|
-
return this.
|
|
4301
|
-
case 'margin':
|
|
4302
|
-
case 'stroke':
|
|
4303
|
-
return this.getWorldStrokeBounds();
|
|
4330
|
+
return this.worldBoxBounds;
|
|
4304
4331
|
}
|
|
4305
4332
|
}
|
|
4306
4333
|
getLayoutBounds(type, relative = 'world', unscale) {
|
|
@@ -4363,20 +4390,24 @@ class LeafLayout {
|
|
|
4363
4390
|
points.forEach(point => leaf.innerToWorld(point, null, false, relativeLeaf));
|
|
4364
4391
|
return points;
|
|
4365
4392
|
}
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4393
|
+
shrinkContent() {
|
|
4394
|
+
const { x, y, width, height } = this.boxBounds;
|
|
4395
|
+
this._contentBounds = { x, y, width, height };
|
|
4396
|
+
}
|
|
4397
|
+
spreadStroke() {
|
|
4398
|
+
const { x, y, width, height } = this.strokeBounds;
|
|
4399
|
+
this._strokeBounds = { x, y, width, height };
|
|
4400
|
+
this._localStrokeBounds = { x, y, width, height };
|
|
4401
|
+
if (!this.renderSpread)
|
|
4402
|
+
this.spreadRenderCancel();
|
|
4370
4403
|
}
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4404
|
+
spreadRender() {
|
|
4405
|
+
const { x, y, width, height } = this.renderBounds;
|
|
4406
|
+
this._renderBounds = { x, y, width, height };
|
|
4407
|
+
this._localRenderBounds = { x, y, width, height };
|
|
4375
4408
|
}
|
|
4376
|
-
|
|
4377
|
-
this.
|
|
4378
|
-
toOuterOf$2(this.strokeBounds, this.leaf.__world, this._worldStrokeBounds);
|
|
4379
|
-
return this._worldStrokeBounds;
|
|
4409
|
+
shrinkContentCancel() {
|
|
4410
|
+
this._contentBounds = undefined;
|
|
4380
4411
|
}
|
|
4381
4412
|
spreadStrokeCancel() {
|
|
4382
4413
|
const same = this.renderBounds === this.strokeBounds;
|
|
@@ -4389,18 +4420,6 @@ class LeafLayout {
|
|
|
4389
4420
|
this._renderBounds = this._strokeBounds;
|
|
4390
4421
|
this._localRenderBounds = this._localStrokeBounds;
|
|
4391
4422
|
}
|
|
4392
|
-
spreadStroke() {
|
|
4393
|
-
const { x, y, width, height } = this.strokeBounds;
|
|
4394
|
-
this._strokeBounds = { x, y, width, height };
|
|
4395
|
-
this._localStrokeBounds = { x, y, width, height };
|
|
4396
|
-
if (!this.renderSpread)
|
|
4397
|
-
this.spreadRenderCancel();
|
|
4398
|
-
}
|
|
4399
|
-
spreadRender() {
|
|
4400
|
-
const { x, y, width, height } = this.renderBounds;
|
|
4401
|
-
this._renderBounds = { x, y, width, height };
|
|
4402
|
-
this._localRenderBounds = { x, y, width, height };
|
|
4403
|
-
}
|
|
4404
4423
|
boxChange() {
|
|
4405
4424
|
this.boxChanged = true;
|
|
4406
4425
|
this.localBoxChanged || this.localBoxChange();
|
|
@@ -4487,24 +4506,40 @@ const LeafEventer = {
|
|
|
4487
4506
|
});
|
|
4488
4507
|
},
|
|
4489
4508
|
off(type, listener, options) {
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4509
|
+
if (type) {
|
|
4510
|
+
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4511
|
+
if (listener) {
|
|
4512
|
+
let capture;
|
|
4513
|
+
if (options)
|
|
4514
|
+
capture = typeof options === 'boolean' ? options : options.capture;
|
|
4515
|
+
let events, index;
|
|
4516
|
+
const map = __getListenerMap(this, capture);
|
|
4517
|
+
typeList.forEach(type => {
|
|
4518
|
+
if (type) {
|
|
4519
|
+
events = map[type];
|
|
4520
|
+
if (events) {
|
|
4521
|
+
index = events.findIndex(item => item.listener === listener);
|
|
4522
|
+
if (index > -1)
|
|
4523
|
+
events.splice(index, 1);
|
|
4524
|
+
if (!events.length)
|
|
4525
|
+
delete map[type];
|
|
4526
|
+
}
|
|
4527
|
+
}
|
|
4528
|
+
});
|
|
4506
4529
|
}
|
|
4507
|
-
|
|
4530
|
+
else {
|
|
4531
|
+
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4532
|
+
typeList.forEach(type => {
|
|
4533
|
+
if (b)
|
|
4534
|
+
delete b[type];
|
|
4535
|
+
if (c)
|
|
4536
|
+
delete c[type];
|
|
4537
|
+
});
|
|
4538
|
+
}
|
|
4539
|
+
}
|
|
4540
|
+
else {
|
|
4541
|
+
this.__bubbleMap = this.__captureMap = undefined;
|
|
4542
|
+
}
|
|
4508
4543
|
},
|
|
4509
4544
|
on_(type, listener, bind, options) {
|
|
4510
4545
|
if (bind)
|
|
@@ -4771,7 +4806,7 @@ const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorl
|
|
|
4771
4806
|
const { toPoint, tempPoint: tempPoint$1 } = AroundHelper;
|
|
4772
4807
|
const LeafMatrix = {
|
|
4773
4808
|
__updateWorldMatrix() {
|
|
4774
|
-
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__);
|
|
4809
|
+
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
|
|
4775
4810
|
},
|
|
4776
4811
|
__updateLocalMatrix() {
|
|
4777
4812
|
if (this.__local) {
|
|
@@ -4782,11 +4817,11 @@ const LeafMatrix = {
|
|
|
4782
4817
|
layout.scaleChanged = layout.rotationChanged = false;
|
|
4783
4818
|
}
|
|
4784
4819
|
}
|
|
4785
|
-
local.e = data.x;
|
|
4786
|
-
local.f = data.y;
|
|
4787
|
-
if (data.around) {
|
|
4788
|
-
toPoint(data.around, layout.boxBounds, tempPoint$1);
|
|
4789
|
-
translateInner(local, -tempPoint$1.x, -tempPoint$1.y);
|
|
4820
|
+
local.e = data.x + data.offsetX;
|
|
4821
|
+
local.f = data.y + data.offsetY;
|
|
4822
|
+
if (data.around || data.origin) {
|
|
4823
|
+
toPoint(data.around || data.origin, layout.boxBounds, tempPoint$1);
|
|
4824
|
+
translateInner(local, -tempPoint$1.x, -tempPoint$1.y, data.origin);
|
|
4790
4825
|
}
|
|
4791
4826
|
}
|
|
4792
4827
|
this.__layout.matrixChanged = false;
|
|
@@ -4892,6 +4927,8 @@ const LeafBounds = {
|
|
|
4892
4927
|
if (this.isBranch) {
|
|
4893
4928
|
if (this.leafer)
|
|
4894
4929
|
this.leafer.layouter.addExtra(this);
|
|
4930
|
+
if (this.__.flow)
|
|
4931
|
+
this.__updateFlowLayout();
|
|
4895
4932
|
if (hasParentAutoLayout(this)) {
|
|
4896
4933
|
updateMatrix$1(this);
|
|
4897
4934
|
}
|
|
@@ -4924,6 +4961,8 @@ const LeafRender = {
|
|
|
4924
4961
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
4925
4962
|
canvas.opacity = this.__.opacity;
|
|
4926
4963
|
if (this.__.__single) {
|
|
4964
|
+
if (this.__.eraser === 'path')
|
|
4965
|
+
return this.__renderEraser(canvas, options);
|
|
4927
4966
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
4928
4967
|
this.__draw(tempCanvas, options);
|
|
4929
4968
|
if (this.__worldFlipped) {
|
|
@@ -4966,6 +5005,8 @@ const BranchRender = {
|
|
|
4966
5005
|
__render(canvas, options) {
|
|
4967
5006
|
if (this.__worldOpacity) {
|
|
4968
5007
|
if (this.__.__single) {
|
|
5008
|
+
if (this.__.eraser === 'path')
|
|
5009
|
+
return this.__renderEraser(canvas, options);
|
|
4969
5010
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
4970
5011
|
this.__renderBranch(tempCanvas, options);
|
|
4971
5012
|
const nowWorld = this.__getNowWorld(options);
|
|
@@ -5105,7 +5146,9 @@ let Leaf = class Leaf {
|
|
|
5105
5146
|
setProxyAttr(_attrName, _newValue) { }
|
|
5106
5147
|
getProxyAttr(_attrName) { return undefined; }
|
|
5107
5148
|
find(_condition, _options) { return undefined; }
|
|
5149
|
+
findTag(_tag) { return undefined; }
|
|
5108
5150
|
findOne(_condition, _options) { return undefined; }
|
|
5151
|
+
findId(_id) { return undefined; }
|
|
5109
5152
|
focus(_value) { }
|
|
5110
5153
|
forceUpdate(attrName) {
|
|
5111
5154
|
if (attrName === undefined)
|
|
@@ -5127,9 +5170,11 @@ let Leaf = class Leaf {
|
|
|
5127
5170
|
__updateLocalStrokeBounds() { }
|
|
5128
5171
|
__updateLocalRenderBounds() { }
|
|
5129
5172
|
__updateBoxBounds() { }
|
|
5173
|
+
__updateContentBounds() { }
|
|
5130
5174
|
__updateStrokeBounds() { }
|
|
5131
5175
|
__updateRenderBounds() { }
|
|
5132
5176
|
__updateAutoLayout() { }
|
|
5177
|
+
__updateFlowLayout() { }
|
|
5133
5178
|
__updateNaturalSize() { }
|
|
5134
5179
|
__updateStrokeSpread() { return 0; }
|
|
5135
5180
|
__updateRenderSpread() { return 0; }
|
|
@@ -5137,6 +5182,13 @@ let Leaf = class Leaf {
|
|
|
5137
5182
|
__updateEraser(value) {
|
|
5138
5183
|
this.__hasEraser = value ? true : this.children.some(item => item.__.eraser);
|
|
5139
5184
|
}
|
|
5185
|
+
__renderEraser(canvas, options) {
|
|
5186
|
+
canvas.save();
|
|
5187
|
+
this.__clip(canvas, options);
|
|
5188
|
+
const { renderBounds: r } = this.__layout;
|
|
5189
|
+
canvas.clearRect(r.x, r.y, r.width, r.height);
|
|
5190
|
+
canvas.restore();
|
|
5191
|
+
}
|
|
5140
5192
|
__updateMask(value) {
|
|
5141
5193
|
this.__hasMask = value ? true : this.children.some(item => item.__.mask);
|
|
5142
5194
|
}
|
|
@@ -5317,8 +5369,8 @@ let Leaf = class Leaf {
|
|
|
5317
5369
|
emit(_type, _event, _capture) { }
|
|
5318
5370
|
emitEvent(_event, _capture) { }
|
|
5319
5371
|
hasEvent(_type, _capture) { return false; }
|
|
5320
|
-
static changeAttr(attrName, defaultValue) {
|
|
5321
|
-
defineDataProcessor(this.prototype, attrName, defaultValue);
|
|
5372
|
+
static changeAttr(attrName, defaultValue, fn) {
|
|
5373
|
+
fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue);
|
|
5322
5374
|
}
|
|
5323
5375
|
static addAttr(attrName, defaultValue, fn) {
|
|
5324
5376
|
if (!fn)
|
|
@@ -5815,7 +5867,7 @@ function useCanvas(_canvasType, _power) {
|
|
|
5815
5867
|
}
|
|
5816
5868
|
img.onload = () => { resolve(img); };
|
|
5817
5869
|
img.onerror = (e) => { reject(e); };
|
|
5818
|
-
if (!src.startsWith('data:') && !src.startsWith('blob:')
|
|
5870
|
+
if (suffix && !src.startsWith('data:') && !src.startsWith('blob:'))
|
|
5819
5871
|
src += (src.includes("?") ? "&" : "?") + suffix;
|
|
5820
5872
|
img.src = src;
|
|
5821
5873
|
});
|
|
@@ -6377,8 +6429,11 @@ class Renderer {
|
|
|
6377
6429
|
if (!bounds.includes(this.target.__world) || this.needFill || !e.samePixelRatio) {
|
|
6378
6430
|
this.addBlock(this.canvas.bounds);
|
|
6379
6431
|
this.target.forceUpdate('surface');
|
|
6432
|
+
return;
|
|
6380
6433
|
}
|
|
6381
6434
|
}
|
|
6435
|
+
this.addBlock(new Bounds(0, 0, 1, 1));
|
|
6436
|
+
this.changed = true;
|
|
6382
6437
|
}
|
|
6383
6438
|
__onLayoutEnd(event) {
|
|
6384
6439
|
if (event.data)
|
|
@@ -6551,6 +6606,7 @@ class Picker {
|
|
|
6551
6606
|
}
|
|
6552
6607
|
|
|
6553
6608
|
const { Yes, NoAndSkip, YesAndSkip } = Answer;
|
|
6609
|
+
const idCondition = {}, classNameCondition = {}, tagCondition = {};
|
|
6554
6610
|
class Selector {
|
|
6555
6611
|
constructor(target, userConfig) {
|
|
6556
6612
|
this.config = {};
|
|
@@ -6560,7 +6616,8 @@ class Selector {
|
|
|
6560
6616
|
id: (leaf, name) => leaf.id === name ? (this.idMap[name] = leaf, 1) : 0,
|
|
6561
6617
|
innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.innerIdMap[innerId] = leaf, 1) : 0,
|
|
6562
6618
|
className: (leaf, name) => leaf.className === name ? 1 : 0,
|
|
6563
|
-
tag: (leaf, name) => leaf.__tag === name ? 1 : 0
|
|
6619
|
+
tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
|
|
6620
|
+
tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
|
|
6564
6621
|
};
|
|
6565
6622
|
this.target = target;
|
|
6566
6623
|
if (userConfig)
|
|
@@ -6576,12 +6633,25 @@ class Selector {
|
|
|
6576
6633
|
case 'string':
|
|
6577
6634
|
switch (condition[0]) {
|
|
6578
6635
|
case '#':
|
|
6579
|
-
|
|
6580
|
-
|
|
6636
|
+
idCondition.id = condition.substring(1), condition = idCondition;
|
|
6637
|
+
break;
|
|
6581
6638
|
case '.':
|
|
6582
|
-
|
|
6639
|
+
classNameCondition.className = condition.substring(1), condition = classNameCondition;
|
|
6640
|
+
break;
|
|
6583
6641
|
default:
|
|
6584
|
-
|
|
6642
|
+
tagCondition.tag = condition, condition = tagCondition;
|
|
6643
|
+
}
|
|
6644
|
+
case 'object':
|
|
6645
|
+
if (condition.id !== undefined) {
|
|
6646
|
+
const leaf = this.getById(condition.id, branch);
|
|
6647
|
+
return one ? leaf : (leaf ? [leaf] : []);
|
|
6648
|
+
}
|
|
6649
|
+
else if (condition.tag) {
|
|
6650
|
+
const { tag } = condition, isArray = tag instanceof Array;
|
|
6651
|
+
return this.getByMethod(isArray ? this.methods.tags : this.methods.tag, branch, one, isArray ? DataHelper.toMap(tag) : tag);
|
|
6652
|
+
}
|
|
6653
|
+
else {
|
|
6654
|
+
return this.getByMethod(this.methods.className, branch, one, condition.className);
|
|
6585
6655
|
}
|
|
6586
6656
|
case 'function':
|
|
6587
6657
|
return this.getByMethod(condition, branch, one, options);
|
|
@@ -6880,7 +6950,7 @@ class UIData extends LeafData {
|
|
|
6880
6950
|
const UnitConvert = {
|
|
6881
6951
|
number(value, percentRefer) {
|
|
6882
6952
|
if (typeof value === 'object')
|
|
6883
|
-
return value.type === 'percent' ? value.value / 100 * percentRefer : value.value;
|
|
6953
|
+
return value.type === 'percent' ? (value.value > 49 ? value.value / 100 : value.value) * percentRefer : value.value;
|
|
6884
6954
|
return value;
|
|
6885
6955
|
}
|
|
6886
6956
|
};
|
|
@@ -7161,7 +7231,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7161
7231
|
}
|
|
7162
7232
|
createProxyData() { return undefined; }
|
|
7163
7233
|
find(_condition, _options) { return undefined; }
|
|
7234
|
+
findTag(tag) { return this.find({ tag }); }
|
|
7164
7235
|
findOne(_condition, _options) { return undefined; }
|
|
7236
|
+
findId(id) { return this.findOne({ id }); }
|
|
7165
7237
|
getPath(curve, pathForRender) {
|
|
7166
7238
|
this.__layout.update();
|
|
7167
7239
|
let path = pathForRender ? this.__.__pathForRender : this.__.path;
|
|
@@ -7312,9 +7384,75 @@ __decorate([
|
|
|
7312
7384
|
__decorate([
|
|
7313
7385
|
rotationType(0, true)
|
|
7314
7386
|
], UI.prototype, "skewY", void 0);
|
|
7387
|
+
__decorate([
|
|
7388
|
+
positionType(0, true)
|
|
7389
|
+
], UI.prototype, "offsetX", void 0);
|
|
7390
|
+
__decorate([
|
|
7391
|
+
positionType(0, true)
|
|
7392
|
+
], UI.prototype, "offsetY", void 0);
|
|
7393
|
+
__decorate([
|
|
7394
|
+
positionType(0, true)
|
|
7395
|
+
], UI.prototype, "scrollX", void 0);
|
|
7396
|
+
__decorate([
|
|
7397
|
+
positionType(0, true)
|
|
7398
|
+
], UI.prototype, "scrollY", void 0);
|
|
7399
|
+
__decorate([
|
|
7400
|
+
autoLayoutType()
|
|
7401
|
+
], UI.prototype, "origin", void 0);
|
|
7315
7402
|
__decorate([
|
|
7316
7403
|
autoLayoutType()
|
|
7317
7404
|
], UI.prototype, "around", void 0);
|
|
7405
|
+
__decorate([
|
|
7406
|
+
dataType(false)
|
|
7407
|
+
], UI.prototype, "lazy", void 0);
|
|
7408
|
+
__decorate([
|
|
7409
|
+
naturalBoundsType(1)
|
|
7410
|
+
], UI.prototype, "pixelRatio", void 0);
|
|
7411
|
+
__decorate([
|
|
7412
|
+
pathInputType()
|
|
7413
|
+
], UI.prototype, "path", void 0);
|
|
7414
|
+
__decorate([
|
|
7415
|
+
pathType()
|
|
7416
|
+
], UI.prototype, "windingRule", void 0);
|
|
7417
|
+
__decorate([
|
|
7418
|
+
pathType(true)
|
|
7419
|
+
], UI.prototype, "closed", void 0);
|
|
7420
|
+
__decorate([
|
|
7421
|
+
autoLayoutType(false)
|
|
7422
|
+
], UI.prototype, "flow", void 0);
|
|
7423
|
+
__decorate([
|
|
7424
|
+
boundsType(0)
|
|
7425
|
+
], UI.prototype, "padding", void 0);
|
|
7426
|
+
__decorate([
|
|
7427
|
+
boundsType(0)
|
|
7428
|
+
], UI.prototype, "gap", void 0);
|
|
7429
|
+
__decorate([
|
|
7430
|
+
boundsType('top-left')
|
|
7431
|
+
], UI.prototype, "align", void 0);
|
|
7432
|
+
__decorate([
|
|
7433
|
+
boundsType(false)
|
|
7434
|
+
], UI.prototype, "wrap", void 0);
|
|
7435
|
+
__decorate([
|
|
7436
|
+
boundsType('box')
|
|
7437
|
+
], UI.prototype, "itemBox", void 0);
|
|
7438
|
+
__decorate([
|
|
7439
|
+
boundsType(true)
|
|
7440
|
+
], UI.prototype, "inFlow", void 0);
|
|
7441
|
+
__decorate([
|
|
7442
|
+
boundsType()
|
|
7443
|
+
], UI.prototype, "autoWidth", void 0);
|
|
7444
|
+
__decorate([
|
|
7445
|
+
boundsType()
|
|
7446
|
+
], UI.prototype, "autoHeight", void 0);
|
|
7447
|
+
__decorate([
|
|
7448
|
+
boundsType()
|
|
7449
|
+
], UI.prototype, "autoBox", void 0);
|
|
7450
|
+
__decorate([
|
|
7451
|
+
boundsType()
|
|
7452
|
+
], UI.prototype, "widthRange", void 0);
|
|
7453
|
+
__decorate([
|
|
7454
|
+
boundsType()
|
|
7455
|
+
], UI.prototype, "heightRange", void 0);
|
|
7318
7456
|
__decorate([
|
|
7319
7457
|
dataType(false)
|
|
7320
7458
|
], UI.prototype, "draggable", void 0);
|
|
@@ -7324,9 +7462,6 @@ __decorate([
|
|
|
7324
7462
|
__decorate([
|
|
7325
7463
|
dataType(false)
|
|
7326
7464
|
], UI.prototype, "editable", void 0);
|
|
7327
|
-
__decorate([
|
|
7328
|
-
dataType('size')
|
|
7329
|
-
], UI.prototype, "editSize", void 0);
|
|
7330
7465
|
__decorate([
|
|
7331
7466
|
hitType(true)
|
|
7332
7467
|
], UI.prototype, "hittable", void 0);
|
|
@@ -7381,21 +7516,6 @@ __decorate([
|
|
|
7381
7516
|
__decorate([
|
|
7382
7517
|
strokeType(10)
|
|
7383
7518
|
], UI.prototype, "miterLimit", void 0);
|
|
7384
|
-
__decorate([
|
|
7385
|
-
dataType(false)
|
|
7386
|
-
], UI.prototype, "lazy", void 0);
|
|
7387
|
-
__decorate([
|
|
7388
|
-
naturalBoundsType(1)
|
|
7389
|
-
], UI.prototype, "pixelRatio", void 0);
|
|
7390
|
-
__decorate([
|
|
7391
|
-
pathInputType()
|
|
7392
|
-
], UI.prototype, "path", void 0);
|
|
7393
|
-
__decorate([
|
|
7394
|
-
pathType()
|
|
7395
|
-
], UI.prototype, "windingRule", void 0);
|
|
7396
|
-
__decorate([
|
|
7397
|
-
pathType(true)
|
|
7398
|
-
], UI.prototype, "closed", void 0);
|
|
7399
7519
|
__decorate([
|
|
7400
7520
|
arrowType('none')
|
|
7401
7521
|
], UI.prototype, "startArrow", void 0);
|
|
@@ -7629,9 +7749,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7629
7749
|
const data = DataHelper.copyAttrs({}, size, canvasSizeAttrs);
|
|
7630
7750
|
Object.keys(data).forEach(key => this[key] = data[key]);
|
|
7631
7751
|
}
|
|
7632
|
-
forceFullRender() {
|
|
7633
|
-
this.forceRender();
|
|
7634
|
-
}
|
|
7635
7752
|
forceRender(bounds) {
|
|
7636
7753
|
this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
|
|
7637
7754
|
if (this.viewReady)
|
|
@@ -7709,7 +7826,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7709
7826
|
this.canvas.backgroundColor = newValue;
|
|
7710
7827
|
}
|
|
7711
7828
|
else {
|
|
7712
|
-
this.
|
|
7829
|
+
this.forceRender();
|
|
7713
7830
|
}
|
|
7714
7831
|
}
|
|
7715
7832
|
__onCreated() {
|
|
@@ -7920,6 +8037,8 @@ let Box = class Box extends Group {
|
|
|
7920
8037
|
else {
|
|
7921
8038
|
this.__updateRectBoxBounds();
|
|
7922
8039
|
}
|
|
8040
|
+
if (data.flow)
|
|
8041
|
+
this.__updateContentBounds();
|
|
7923
8042
|
}
|
|
7924
8043
|
__updateStrokeBounds() { }
|
|
7925
8044
|
__updateRenderBounds() {
|
|
@@ -8329,7 +8448,7 @@ Canvas = __decorate([
|
|
|
8329
8448
|
registerUI()
|
|
8330
8449
|
], Canvas);
|
|
8331
8450
|
|
|
8332
|
-
const { copyAndSpread, includes, spread, setList } = BoundsHelper;
|
|
8451
|
+
const { copyAndSpread, includes, isSame: isSame$1, spread, setList } = BoundsHelper;
|
|
8333
8452
|
let Text = class Text extends UI {
|
|
8334
8453
|
get __tag() { return 'Text'; }
|
|
8335
8454
|
get editInner() { return 'TextEditor'; }
|
|
@@ -8402,7 +8521,7 @@ let Text = class Text extends UI {
|
|
|
8402
8521
|
if (italic)
|
|
8403
8522
|
b.width += fontSize * 0.16;
|
|
8404
8523
|
const contentBounds = includes(b, bounds) ? b : bounds;
|
|
8405
|
-
if (contentBounds
|
|
8524
|
+
if (!isSame$1(contentBounds, layout.contentBounds)) {
|
|
8406
8525
|
layout.contentBounds = contentBounds;
|
|
8407
8526
|
layout.renderChanged = true;
|
|
8408
8527
|
setList(data.__textBoxBounds = {}, [b, bounds]);
|
|
@@ -8430,9 +8549,6 @@ __decorate([
|
|
|
8430
8549
|
__decorate([
|
|
8431
8550
|
boundsType(0)
|
|
8432
8551
|
], Text.prototype, "height", void 0);
|
|
8433
|
-
__decorate([
|
|
8434
|
-
boundsType(0)
|
|
8435
|
-
], Text.prototype, "padding", void 0);
|
|
8436
8552
|
__decorate([
|
|
8437
8553
|
surfaceType('#000000')
|
|
8438
8554
|
], Text.prototype, "fill", void 0);
|
|
@@ -8561,7 +8677,7 @@ function penPathType() {
|
|
|
8561
8677
|
};
|
|
8562
8678
|
}
|
|
8563
8679
|
|
|
8564
|
-
const version = "1.0.0-rc.
|
|
8680
|
+
const version = "1.0.0-rc.23";
|
|
8565
8681
|
|
|
8566
8682
|
let App = class App extends Leafer {
|
|
8567
8683
|
get __tag() { return 'App'; }
|
|
@@ -8655,8 +8771,10 @@ let App = class App extends Leafer {
|
|
|
8655
8771
|
this.renderer.update();
|
|
8656
8772
|
}
|
|
8657
8773
|
__render(canvas, options) {
|
|
8658
|
-
if (options.matrix)
|
|
8659
|
-
|
|
8774
|
+
if (options.matrix) {
|
|
8775
|
+
const { a, b, c, d, e, f } = options.matrix;
|
|
8776
|
+
canvas.setTransform(a, b, c, d, e, f);
|
|
8777
|
+
}
|
|
8660
8778
|
this.children.forEach(leafer => canvas.copyWorld(leafer.canvas));
|
|
8661
8779
|
}
|
|
8662
8780
|
__onResize(event) {
|
|
@@ -10619,7 +10737,7 @@ function shape(ui, current, options) {
|
|
|
10619
10737
|
}
|
|
10620
10738
|
else {
|
|
10621
10739
|
const { renderShapeSpread: spread } = ui.__layout;
|
|
10622
|
-
const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, spread * scaleX, spread *
|
|
10740
|
+
const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, scaleX === scaleY ? spread * scaleX : [spread * scaleY, spread * scaleX]) : current.bounds, nowWorld);
|
|
10623
10741
|
fitMatrix = current.bounds.getFitMatrix(worldClipBounds);
|
|
10624
10742
|
let { a: fitScaleX, d: fitScaleY } = fitMatrix;
|
|
10625
10743
|
if (fitMatrix.a < 1) {
|
|
@@ -10719,10 +10837,10 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
10719
10837
|
rotate(transform, rotation);
|
|
10720
10838
|
data.transform = transform;
|
|
10721
10839
|
}
|
|
10722
|
-
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation,
|
|
10840
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
10723
10841
|
const transform = get$4();
|
|
10724
10842
|
if (rotation) {
|
|
10725
|
-
if (
|
|
10843
|
+
if (align === 'center') {
|
|
10726
10844
|
rotateOfOuter$2(transform, { x: width / 2, y: height / 2 }, rotation);
|
|
10727
10845
|
}
|
|
10728
10846
|
else {
|
|
@@ -10755,12 +10873,12 @@ function createData(leafPaint, image, paint, box) {
|
|
|
10755
10873
|
let { width, height } = image;
|
|
10756
10874
|
if (paint.padding)
|
|
10757
10875
|
box = tempBox.set(box).shrink(paint.padding);
|
|
10758
|
-
const { opacity, mode,
|
|
10876
|
+
const { opacity, mode, align, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
10759
10877
|
const sameBox = box.width === width && box.height === height;
|
|
10760
10878
|
if (blendMode)
|
|
10761
10879
|
leafPaint.blendMode = blendMode;
|
|
10762
10880
|
const data = leafPaint.data = { mode };
|
|
10763
|
-
const swapSize =
|
|
10881
|
+
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
10764
10882
|
const swapWidth = swapSize ? height : width, swapHeight = swapSize ? width : height;
|
|
10765
10883
|
let x = 0, y = 0, scaleX, scaleY;
|
|
10766
10884
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
@@ -10778,11 +10896,11 @@ function createData(leafPaint, image, paint, box) {
|
|
|
10778
10896
|
scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
10779
10897
|
scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
10780
10898
|
}
|
|
10781
|
-
if (
|
|
10899
|
+
if (align) {
|
|
10782
10900
|
const imageBounds = { x, y, width: swapWidth, height: swapHeight };
|
|
10783
10901
|
if (scaleX)
|
|
10784
10902
|
imageBounds.width *= scaleX, imageBounds.height *= scaleY;
|
|
10785
|
-
|
|
10903
|
+
AlignHelper.toPoint(align, imageBounds, box, tempPoint, true);
|
|
10786
10904
|
x += tempPoint.x, y += tempPoint.y;
|
|
10787
10905
|
}
|
|
10788
10906
|
if (offset)
|
|
@@ -10799,7 +10917,7 @@ function createData(leafPaint, image, paint, box) {
|
|
|
10799
10917
|
break;
|
|
10800
10918
|
case 'repeat':
|
|
10801
10919
|
if (!sameBox || scaleX || rotation)
|
|
10802
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation,
|
|
10920
|
+
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
10803
10921
|
if (!repeat)
|
|
10804
10922
|
data.repeat = 'repeat';
|
|
10805
10923
|
break;
|
|
@@ -11716,11 +11834,13 @@ function clipText(drawData, style) {
|
|
|
11716
11834
|
const { rows, overflow } = drawData;
|
|
11717
11835
|
let { textOverflow } = style;
|
|
11718
11836
|
rows.splice(overflow);
|
|
11719
|
-
if (textOverflow !== '
|
|
11720
|
-
if (textOverflow === '
|
|
11837
|
+
if (textOverflow && textOverflow !== 'show') {
|
|
11838
|
+
if (textOverflow === 'hide')
|
|
11839
|
+
textOverflow = '';
|
|
11840
|
+
else if (textOverflow === 'ellipsis')
|
|
11721
11841
|
textOverflow = '...';
|
|
11722
11842
|
let char, charRight;
|
|
11723
|
-
const ellipsisWidth = Platform.canvas.measureText(textOverflow).width;
|
|
11843
|
+
const ellipsisWidth = textOverflow ? Platform.canvas.measureText(textOverflow).width : 0;
|
|
11724
11844
|
const right = style.x + style.width - ellipsisWidth;
|
|
11725
11845
|
const list = style.textWrap === 'none' ? rows : [rows[overflow - 1]];
|
|
11726
11846
|
list.forEach(row => {
|
|
@@ -11888,8 +12008,12 @@ const ExportModule = {
|
|
|
11888
12008
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
11889
12009
|
const { worldTransform, isLeafer, isFrame } = leaf;
|
|
11890
12010
|
const { slice, trim, onCanvas } = options;
|
|
11891
|
-
|
|
11892
|
-
|
|
12011
|
+
let scale = options.scale || 1;
|
|
12012
|
+
let pixelRatio = options.pixelRatio || 1;
|
|
12013
|
+
if (leaf.isApp) {
|
|
12014
|
+
scale *= pixelRatio;
|
|
12015
|
+
pixelRatio = leaf.app.pixelRatio;
|
|
12016
|
+
}
|
|
11893
12017
|
const screenshot = options.screenshot || leaf.isApp;
|
|
11894
12018
|
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
|
|
11895
12019
|
const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
|
|
@@ -12030,4 +12154,4 @@ window.addEventListener('unload', () => {
|
|
|
12030
12154
|
ImageManager.destroy();
|
|
12031
12155
|
});
|
|
12032
12156
|
|
|
12033
|
-
export { AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, zoomLayerType };
|
|
12157
|
+
export { AlignHelper, AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, zoomLayerType };
|