@leafer-ui/miniapp 1.9.7 → 1.9.8
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 +106 -79
- package/dist/miniapp.esm.js +108 -81
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +244 -174
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +12 -12
package/dist/miniapp.module.js
CHANGED
|
@@ -247,18 +247,34 @@ class LeafData {
|
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
250
|
+
let tempA, tempB, tempTo;
|
|
251
|
+
|
|
252
|
+
const {max: max$4} = Math, tempFour = [ 0, 0, 0, 0 ];
|
|
253
|
+
|
|
254
|
+
const FourNumberHelper = {
|
|
255
|
+
zero: [ ...tempFour ],
|
|
256
|
+
tempFour: tempFour,
|
|
257
|
+
set(to, top, right, bottom, left) {
|
|
258
|
+
if (right === undefined) right = bottom = left = top;
|
|
259
|
+
to[0] = top;
|
|
260
|
+
to[1] = right;
|
|
261
|
+
to[2] = bottom;
|
|
262
|
+
to[3] = left;
|
|
263
|
+
return to;
|
|
264
|
+
},
|
|
265
|
+
setTemp(top, right, bottom, left) {
|
|
266
|
+
return set$1(tempFour, top, right, bottom, left);
|
|
258
267
|
},
|
|
259
|
-
|
|
268
|
+
toTempAB(a, b, change) {
|
|
269
|
+
tempTo = change ? isNumber(a) ? b : a : [];
|
|
270
|
+
if (isNumber(a)) tempA = setTemp(a), tempB = b; else if (isNumber(b)) tempA = a,
|
|
271
|
+
tempB = setTemp(b); else tempA = a, tempB = b;
|
|
272
|
+
if (tempA.length !== 4) tempA = get$5(tempA);
|
|
273
|
+
if (tempB.length !== 4) tempB = get$5(tempB);
|
|
274
|
+
},
|
|
275
|
+
get(num, maxValue) {
|
|
260
276
|
let data;
|
|
261
|
-
if (
|
|
277
|
+
if (!isNumber(num)) {
|
|
262
278
|
switch (num.length) {
|
|
263
279
|
case 4:
|
|
264
280
|
data = isUndefined(maxValue) ? num : [ ...num ];
|
|
@@ -281,9 +297,39 @@ const MathHelper = {
|
|
|
281
297
|
}
|
|
282
298
|
}
|
|
283
299
|
if (!data) data = [ num, num, num, num ];
|
|
284
|
-
if (maxValue) for (let i = 0; i < 4; i++) if (data[i] > maxValue) data[i] = maxValue;
|
|
300
|
+
if (!isUndefined(maxValue)) for (let i = 0; i < 4; i++) if (data[i] > maxValue) data[i] = maxValue;
|
|
285
301
|
return data;
|
|
286
302
|
},
|
|
303
|
+
max(t, other, change) {
|
|
304
|
+
if (isNumber(t) && isNumber(other)) return max$4(t, other);
|
|
305
|
+
toTempAB(t, other, change);
|
|
306
|
+
return set$1(tempTo, max$4(tempA[0], tempB[0]), max$4(tempA[1], tempB[1]), max$4(tempA[2], tempB[2]), max$4(tempA[3], tempB[3]));
|
|
307
|
+
},
|
|
308
|
+
add(t, other, change) {
|
|
309
|
+
if (isNumber(t) && isNumber(other)) return t + other;
|
|
310
|
+
toTempAB(t, other, change);
|
|
311
|
+
return set$1(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
|
|
312
|
+
},
|
|
313
|
+
swapAndScale(t, scaleX, scaleY, change) {
|
|
314
|
+
if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
|
|
315
|
+
const to = change ? t : [];
|
|
316
|
+
const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
|
|
317
|
+
return set$1(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
const {set: set$1, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
322
|
+
|
|
323
|
+
const {round: round$3, pow: pow$1, PI: PI$3} = Math;
|
|
324
|
+
|
|
325
|
+
const MathHelper = {
|
|
326
|
+
within(value, min, max) {
|
|
327
|
+
if (isObject(min)) max = min.max, min = min.min;
|
|
328
|
+
if (!isUndefined(min) && value < min) value = min;
|
|
329
|
+
if (!isUndefined(max) && value > max) value = max;
|
|
330
|
+
return value;
|
|
331
|
+
},
|
|
332
|
+
fourNumber: FourNumberHelper.get,
|
|
287
333
|
formatRotation(rotation, unsign) {
|
|
288
334
|
rotation %= 360;
|
|
289
335
|
if (unsign) {
|
|
@@ -1014,7 +1060,7 @@ class Matrix {
|
|
|
1014
1060
|
}
|
|
1015
1061
|
}
|
|
1016
1062
|
|
|
1017
|
-
const tempMatrix$
|
|
1063
|
+
const tempMatrix$2 = new Matrix;
|
|
1018
1064
|
|
|
1019
1065
|
const TwoPointBoundsHelper = {
|
|
1020
1066
|
tempPointBounds: {},
|
|
@@ -1164,10 +1210,10 @@ const point = {};
|
|
|
1164
1210
|
|
|
1165
1211
|
const toPoint$4 = {};
|
|
1166
1212
|
|
|
1167
|
-
const tempBounds$
|
|
1213
|
+
const tempBounds$3 = {};
|
|
1168
1214
|
|
|
1169
1215
|
const BoundsHelper = {
|
|
1170
|
-
tempBounds: tempBounds$
|
|
1216
|
+
tempBounds: tempBounds$3,
|
|
1171
1217
|
set(t, x = 0, y = 0, width = 0, height = 0) {
|
|
1172
1218
|
t.x = x;
|
|
1173
1219
|
t.y = y;
|
|
@@ -1218,19 +1264,11 @@ const BoundsHelper = {
|
|
|
1218
1264
|
B.move(t, x, y);
|
|
1219
1265
|
return t;
|
|
1220
1266
|
},
|
|
1221
|
-
toOffsetOutBounds(t, to,
|
|
1222
|
-
if (!to)
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
}
|
|
1227
|
-
if (parent) {
|
|
1228
|
-
to.offsetX = -(B.maxX(parent) - t.x);
|
|
1229
|
-
to.offsetY = -(B.maxY(parent) - t.y);
|
|
1230
|
-
} else {
|
|
1231
|
-
to.offsetX = t.x + t.width;
|
|
1232
|
-
to.offsetY = t.y + t.height;
|
|
1233
|
-
}
|
|
1267
|
+
toOffsetOutBounds(t, to, offsetBounds) {
|
|
1268
|
+
if (!to) to = t; else copy$9(to, t);
|
|
1269
|
+
if (!offsetBounds) offsetBounds = t;
|
|
1270
|
+
to.offsetX = B.maxX(offsetBounds);
|
|
1271
|
+
to.offsetY = B.maxY(offsetBounds);
|
|
1234
1272
|
B.move(to, -to.offsetX, -to.offsetY);
|
|
1235
1273
|
},
|
|
1236
1274
|
scale(t, scaleX, scaleY = scaleX, onlySize) {
|
|
@@ -1244,9 +1282,9 @@ const BoundsHelper = {
|
|
|
1244
1282
|
t.height *= scaleY;
|
|
1245
1283
|
},
|
|
1246
1284
|
tempToOuterOf(t, matrix) {
|
|
1247
|
-
B.copy(tempBounds$
|
|
1248
|
-
B.toOuterOf(tempBounds$
|
|
1249
|
-
return tempBounds$
|
|
1285
|
+
B.copy(tempBounds$3, t);
|
|
1286
|
+
B.toOuterOf(tempBounds$3, matrix);
|
|
1287
|
+
return tempBounds$3;
|
|
1250
1288
|
},
|
|
1251
1289
|
getOuterOf(t, matrix) {
|
|
1252
1290
|
t = Object.assign({}, t);
|
|
@@ -1304,9 +1342,9 @@ const BoundsHelper = {
|
|
|
1304
1342
|
put(t, put, align = "center", putScale = 1, changeSize = true, to) {
|
|
1305
1343
|
to || (to = put);
|
|
1306
1344
|
if (isString(putScale)) putScale = B.getFitScale(t, put, putScale === "cover");
|
|
1307
|
-
tempBounds$
|
|
1308
|
-
tempBounds$
|
|
1309
|
-
AlignHelper.toPoint(align, tempBounds$
|
|
1345
|
+
tempBounds$3.width = changeSize ? put.width *= putScale : put.width * putScale;
|
|
1346
|
+
tempBounds$3.height = changeSize ? put.height *= putScale : put.height * putScale;
|
|
1347
|
+
AlignHelper.toPoint(align, tempBounds$3, t, to, true, true);
|
|
1310
1348
|
},
|
|
1311
1349
|
getSpread(t, spread, side) {
|
|
1312
1350
|
const n = {};
|
|
@@ -1376,7 +1414,7 @@ const BoundsHelper = {
|
|
|
1376
1414
|
first = false;
|
|
1377
1415
|
if (!addMode) copy$9(t, bounds);
|
|
1378
1416
|
} else {
|
|
1379
|
-
add$
|
|
1417
|
+
add$2(t, bounds);
|
|
1380
1418
|
}
|
|
1381
1419
|
}
|
|
1382
1420
|
}
|
|
@@ -1390,7 +1428,7 @@ const BoundsHelper = {
|
|
|
1390
1428
|
B.set(t, point.x, point.y);
|
|
1391
1429
|
},
|
|
1392
1430
|
addPoint(t, point) {
|
|
1393
|
-
add$
|
|
1431
|
+
add$2(t, point, true);
|
|
1394
1432
|
},
|
|
1395
1433
|
getPoints(t) {
|
|
1396
1434
|
const {x: x, y: y, width: width, height: height} = t;
|
|
@@ -1461,7 +1499,7 @@ const BoundsHelper = {
|
|
|
1461
1499
|
|
|
1462
1500
|
const B = BoundsHelper;
|
|
1463
1501
|
|
|
1464
|
-
const {add: add$
|
|
1502
|
+
const {add: add$2, copy: copy$9} = B;
|
|
1465
1503
|
|
|
1466
1504
|
class Bounds {
|
|
1467
1505
|
get minX() {
|
|
@@ -1606,7 +1644,7 @@ class Bounds {
|
|
|
1606
1644
|
}
|
|
1607
1645
|
}
|
|
1608
1646
|
|
|
1609
|
-
const tempBounds$
|
|
1647
|
+
const tempBounds$2 = new Bounds;
|
|
1610
1648
|
|
|
1611
1649
|
class AutoBounds {
|
|
1612
1650
|
constructor(top, right, bottom, left, width, height) {
|
|
@@ -2261,7 +2299,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2261
2299
|
const {pixelRatio: pixelRatio, pixelSnap: pixelSnap} = this, w = this.worldTransform;
|
|
2262
2300
|
if (parentMatrix) multiplyParent$4(matrix, parentMatrix, w);
|
|
2263
2301
|
pixelScale(matrix, pixelRatio, w);
|
|
2264
|
-
if (pixelSnap) {
|
|
2302
|
+
if (pixelSnap && !matrix.ignorePixelSnap) {
|
|
2265
2303
|
if (matrix.half && matrix.half * pixelRatio % 2) w.e = round$1(w.e - .5) + .5, w.f = round$1(w.f - .5) + .5; else w.e = round$1(w.e),
|
|
2266
2304
|
w.f = round$1(w.f);
|
|
2267
2305
|
}
|
|
@@ -3985,7 +4023,7 @@ const I$1 = ImageManager;
|
|
|
3985
4023
|
|
|
3986
4024
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
3987
4025
|
|
|
3988
|
-
const {floor: floor$1, max: max$
|
|
4026
|
+
const {floor: floor$1, max: max$3} = Math;
|
|
3989
4027
|
|
|
3990
4028
|
class LeaferImage {
|
|
3991
4029
|
get url() {
|
|
@@ -4074,7 +4112,7 @@ class LeaferImage {
|
|
|
4074
4112
|
}
|
|
4075
4113
|
if (data) return data;
|
|
4076
4114
|
}
|
|
4077
|
-
const canvas = Platform.origin.createCanvas(max$
|
|
4115
|
+
const canvas = Platform.origin.createCanvas(max$3(floor$1(width + (xGap || 0)), 1), max$3(floor$1(height + (yGap || 0)), 1));
|
|
4078
4116
|
const ctx = canvas.getContext("2d");
|
|
4079
4117
|
if (opacity) ctx.globalAlpha = opacity;
|
|
4080
4118
|
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
@@ -4868,7 +4906,7 @@ const WaitHelper = {
|
|
|
4868
4906
|
|
|
4869
4907
|
const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2} = LeafHelper;
|
|
4870
4908
|
|
|
4871
|
-
const {toOuterOf: toOuterOf$
|
|
4909
|
+
const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$5} = BoundsHelper;
|
|
4872
4910
|
|
|
4873
4911
|
const localContent = "_localContentBounds";
|
|
4874
4912
|
|
|
@@ -4891,7 +4929,7 @@ class LeafLayout {
|
|
|
4891
4929
|
this._renderBounds = bounds;
|
|
4892
4930
|
}
|
|
4893
4931
|
get localContentBounds() {
|
|
4894
|
-
toOuterOf$
|
|
4932
|
+
toOuterOf$3(this.contentBounds, this.leaf.__localMatrix, this[localContent] || (this[localContent] = {}));
|
|
4895
4933
|
return this[localContent];
|
|
4896
4934
|
}
|
|
4897
4935
|
get localStrokeBounds() {
|
|
@@ -4901,15 +4939,15 @@ class LeafLayout {
|
|
|
4901
4939
|
return this._localRenderBounds || this;
|
|
4902
4940
|
}
|
|
4903
4941
|
get worldContentBounds() {
|
|
4904
|
-
toOuterOf$
|
|
4942
|
+
toOuterOf$3(this.contentBounds, this.leaf.__world, this[worldContent] || (this[worldContent] = {}));
|
|
4905
4943
|
return this[worldContent];
|
|
4906
4944
|
}
|
|
4907
4945
|
get worldBoxBounds() {
|
|
4908
|
-
toOuterOf$
|
|
4946
|
+
toOuterOf$3(this.boxBounds, this.leaf.__world, this[worldBox] || (this[worldBox] = {}));
|
|
4909
4947
|
return this[worldBox];
|
|
4910
4948
|
}
|
|
4911
4949
|
get worldStrokeBounds() {
|
|
4912
|
-
toOuterOf$
|
|
4950
|
+
toOuterOf$3(this.strokeBounds, this.leaf.__world, this[worldStroke] || (this[worldStroke] = {}));
|
|
4913
4951
|
return this[worldStroke];
|
|
4914
4952
|
}
|
|
4915
4953
|
get a() {
|
|
@@ -5761,14 +5799,14 @@ const {updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2} = LeafH
|
|
|
5761
5799
|
|
|
5762
5800
|
const {updateBounds: updateBounds$1} = BranchHelper;
|
|
5763
5801
|
|
|
5764
|
-
const {toOuterOf: toOuterOf$
|
|
5802
|
+
const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$2, copy: copy$4} = BoundsHelper;
|
|
5765
5803
|
|
|
5766
5804
|
const {toBounds: toBounds} = PathBounds;
|
|
5767
5805
|
|
|
5768
5806
|
const LeafBounds = {
|
|
5769
5807
|
__updateWorldBounds() {
|
|
5770
5808
|
const layout = this.__layout;
|
|
5771
|
-
toOuterOf$
|
|
5809
|
+
toOuterOf$2(layout.renderBounds, this.__world, this.__world);
|
|
5772
5810
|
if (layout.resized) {
|
|
5773
5811
|
if (layout.resized === "inner") this.__onUpdateSize();
|
|
5774
5812
|
if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
|
|
@@ -5824,13 +5862,13 @@ const LeafBounds = {
|
|
|
5824
5862
|
__updateLocalBoxBounds() {
|
|
5825
5863
|
if (this.__hasMotionPath) this.__updateMotionPath();
|
|
5826
5864
|
if (this.__hasAutoLayout) this.__updateAutoLayout();
|
|
5827
|
-
toOuterOf$
|
|
5865
|
+
toOuterOf$2(this.__layout.boxBounds, this.__local, this.__local);
|
|
5828
5866
|
},
|
|
5829
5867
|
__updateLocalStrokeBounds() {
|
|
5830
|
-
toOuterOf$
|
|
5868
|
+
toOuterOf$2(this.__layout.strokeBounds, this.__localMatrix, this.__layout.localStrokeBounds);
|
|
5831
5869
|
},
|
|
5832
5870
|
__updateLocalRenderBounds() {
|
|
5833
|
-
toOuterOf$
|
|
5871
|
+
toOuterOf$2(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
|
|
5834
5872
|
},
|
|
5835
5873
|
__updateBoxBounds(_secondLayout, _bounds) {
|
|
5836
5874
|
const b = this.__layout.boxBounds;
|
|
@@ -5868,11 +5906,11 @@ const LeafBounds = {
|
|
|
5868
5906
|
},
|
|
5869
5907
|
__updateStrokeBounds(_bounds) {
|
|
5870
5908
|
const layout = this.__layout;
|
|
5871
|
-
copyAndSpread$
|
|
5909
|
+
copyAndSpread$2(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
5872
5910
|
},
|
|
5873
5911
|
__updateRenderBounds(_bounds) {
|
|
5874
|
-
const layout = this.__layout;
|
|
5875
|
-
|
|
5912
|
+
const layout = this.__layout, {renderSpread: renderSpread} = layout;
|
|
5913
|
+
isNumber(renderSpread) && renderSpread <= 0 ? copy$4(layout.renderBounds, layout.strokeBounds) : copyAndSpread$2(layout.renderBounds, layout.boxBounds, renderSpread);
|
|
5876
5914
|
}
|
|
5877
5915
|
};
|
|
5878
5916
|
|
|
@@ -5970,11 +6008,13 @@ const tempScaleData$1 = {};
|
|
|
5970
6008
|
|
|
5971
6009
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
5972
6010
|
|
|
6011
|
+
const {stintSet: stintSet$3} = DataHelper;
|
|
6012
|
+
|
|
5973
6013
|
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
5974
6014
|
|
|
5975
|
-
const {toOuterOf: toOuterOf} = BoundsHelper;
|
|
6015
|
+
const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
5976
6016
|
|
|
5977
|
-
const {copy: copy$3, move: move} = PointHelper;
|
|
6017
|
+
const {copy: copy$3, move: move$2} = PointHelper;
|
|
5978
6018
|
|
|
5979
6019
|
const {moveLocal: moveLocal, zoomOfLocal: zoomOfLocal, rotateOfLocal: rotateOfLocal, skewOfLocal: skewOfLocal, moveWorld: moveWorld, zoomOfWorld: zoomOfWorld, rotateOfWorld: rotateOfWorld, skewOfWorld: skewOfWorld, transform: transform, transformWorld: transformWorld, setTransform: setTransform, getFlipTransform: getFlipTransform, getLocalOrigin: getLocalOrigin, getRelativeWorld: getRelativeWorld, drop: drop} = LeafHelper;
|
|
5980
6020
|
|
|
@@ -6250,8 +6290,9 @@ let Leaf = class Leaf {
|
|
|
6250
6290
|
if (!this.__cameraWorld) this.__cameraWorld = {};
|
|
6251
6291
|
const cameraWorld = this.__cameraWorld, world = this.__world;
|
|
6252
6292
|
multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
|
|
6253
|
-
toOuterOf(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
6254
|
-
cameraWorld
|
|
6293
|
+
toOuterOf$1(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
6294
|
+
stintSet$3(cameraWorld, "half", world.half);
|
|
6295
|
+
stintSet$3(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
|
|
6255
6296
|
return cameraWorld;
|
|
6256
6297
|
} else {
|
|
6257
6298
|
return this.__world;
|
|
@@ -6285,7 +6326,7 @@ let Leaf = class Leaf {
|
|
|
6285
6326
|
getWorldBounds(inner, relative, change) {
|
|
6286
6327
|
const matrix = relative ? getRelativeWorld(this, relative) : this.worldTransform;
|
|
6287
6328
|
const to = change ? inner : {};
|
|
6288
|
-
toOuterOf(inner, matrix, to);
|
|
6329
|
+
toOuterOf$1(inner, matrix, to);
|
|
6289
6330
|
return to;
|
|
6290
6331
|
}
|
|
6291
6332
|
worldToLocal(world, to, distance, relative) {
|
|
@@ -6318,7 +6359,7 @@ let Leaf = class Leaf {
|
|
|
6318
6359
|
}
|
|
6319
6360
|
getBoxPointByInner(inner, _relative, _distance, change) {
|
|
6320
6361
|
const point = change ? inner : Object.assign({}, inner), {x: x, y: y} = this.boxBounds;
|
|
6321
|
-
move(point, -x, -y);
|
|
6362
|
+
move$2(point, -x, -y);
|
|
6322
6363
|
return point;
|
|
6323
6364
|
}
|
|
6324
6365
|
getInnerPoint(world, relative, distance, change) {
|
|
@@ -6328,7 +6369,7 @@ let Leaf = class Leaf {
|
|
|
6328
6369
|
}
|
|
6329
6370
|
getInnerPointByBox(box, _relative, _distance, change) {
|
|
6330
6371
|
const point = change ? box : Object.assign({}, box), {x: x, y: y} = this.boxBounds;
|
|
6331
|
-
move(point, x, y);
|
|
6372
|
+
move$2(point, x, y);
|
|
6332
6373
|
return point;
|
|
6333
6374
|
}
|
|
6334
6375
|
getInnerPointByLocal(local, _relative, distance, change) {
|
|
@@ -6774,7 +6815,7 @@ class LeafLevelList {
|
|
|
6774
6815
|
}
|
|
6775
6816
|
}
|
|
6776
6817
|
|
|
6777
|
-
const version = "1.9.
|
|
6818
|
+
const version = "1.9.8";
|
|
6778
6819
|
|
|
6779
6820
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6780
6821
|
get allowBackgroundColor() {
|
|
@@ -7352,6 +7393,7 @@ class Renderer {
|
|
|
7352
7393
|
usePartRender: true,
|
|
7353
7394
|
maxFPS: 120
|
|
7354
7395
|
};
|
|
7396
|
+
this.frames = [];
|
|
7355
7397
|
this.target = target;
|
|
7356
7398
|
this.canvas = canvas;
|
|
7357
7399
|
if (userConfig) this.config = DataHelper.default(userConfig, this.config);
|
|
@@ -7504,12 +7546,15 @@ class Renderer {
|
|
|
7504
7546
|
const target = this.target;
|
|
7505
7547
|
if (this.requestTime || !target) return;
|
|
7506
7548
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
7507
|
-
|
|
7549
|
+
this.requestTime = this.frameTime || Date.now();
|
|
7508
7550
|
const render = () => {
|
|
7509
|
-
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
7551
|
+
const nowFPS = 1e3 / ((this.frameTime = Date.now()) - this.requestTime);
|
|
7510
7552
|
const {maxFPS: maxFPS} = this.config;
|
|
7511
|
-
if (maxFPS && nowFPS > maxFPS
|
|
7512
|
-
|
|
7553
|
+
if (maxFPS && nowFPS > maxFPS) return Platform.requestRender(render);
|
|
7554
|
+
const {frames: frames} = this;
|
|
7555
|
+
if (frames.length > 30) frames.shift();
|
|
7556
|
+
frames.push(nowFPS);
|
|
7557
|
+
this.FPS = Math.round(frames.reduce((a, b) => a + b, 0) / frames.length);
|
|
7513
7558
|
this.requestTime = 0;
|
|
7514
7559
|
this.checkRender();
|
|
7515
7560
|
};
|
|
@@ -8165,39 +8210,41 @@ class CanvasData extends RectData {
|
|
|
8165
8210
|
}
|
|
8166
8211
|
}
|
|
8167
8212
|
|
|
8213
|
+
const {max: max$2, add: add$1} = FourNumberHelper;
|
|
8214
|
+
|
|
8168
8215
|
const UIBounds = {
|
|
8169
8216
|
__updateStrokeSpread() {
|
|
8170
|
-
let
|
|
8217
|
+
let spread = 0, boxSpread = 0;
|
|
8171
8218
|
const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
|
|
8172
8219
|
if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
|
|
8173
|
-
|
|
8220
|
+
boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
|
|
8174
8221
|
if (!data.__boxStroke) {
|
|
8175
|
-
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 *
|
|
8222
|
+
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
|
|
8176
8223
|
const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
|
|
8177
|
-
|
|
8224
|
+
spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
8178
8225
|
}
|
|
8179
8226
|
}
|
|
8180
|
-
if (data.__useArrow)
|
|
8227
|
+
if (data.__useArrow) spread += strokeWidth * 5;
|
|
8181
8228
|
if (box) {
|
|
8182
|
-
|
|
8183
|
-
|
|
8229
|
+
spread = max$2(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
|
|
8230
|
+
boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
|
|
8184
8231
|
}
|
|
8185
|
-
this.__layout.strokeBoxSpread =
|
|
8186
|
-
return
|
|
8232
|
+
this.__layout.strokeBoxSpread = boxSpread;
|
|
8233
|
+
return spread;
|
|
8187
8234
|
},
|
|
8188
8235
|
__updateRenderSpread() {
|
|
8189
|
-
let
|
|
8190
|
-
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
|
|
8191
|
-
if (shadow)
|
|
8192
|
-
if (blur)
|
|
8193
|
-
if (filter)
|
|
8194
|
-
if (renderSpread)
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
if (
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
return
|
|
8236
|
+
let spread = 0;
|
|
8237
|
+
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
|
|
8238
|
+
if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
|
|
8239
|
+
if (blur) spread = max$2(spread, blur);
|
|
8240
|
+
if (filter) spread = add$1(spread, Filter.getSpread(filter));
|
|
8241
|
+
if (renderSpread) spread = add$1(spread, renderSpread);
|
|
8242
|
+
if (strokeSpread) spread = add$1(spread, strokeSpread);
|
|
8243
|
+
let shapeSpread = spread;
|
|
8244
|
+
if (innerShadow) shapeSpread = max$2(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
|
|
8245
|
+
if (backgroundBlur) shapeSpread = max$2(shapeSpread, backgroundBlur);
|
|
8246
|
+
this.__layout.renderShapeSpread = shapeSpread;
|
|
8247
|
+
return box ? max$2(box.__updateRenderSpread(), spread) : spread;
|
|
8201
8248
|
}
|
|
8202
8249
|
};
|
|
8203
8250
|
|
|
@@ -9508,7 +9555,7 @@ __decorate([ resizeType() ], Canvas.prototype, "contextSettings", void 0);
|
|
|
9508
9555
|
|
|
9509
9556
|
Canvas = __decorate([ registerUI() ], Canvas);
|
|
9510
9557
|
|
|
9511
|
-
const {copyAndSpread: copyAndSpread, includes: includes, spread: spread, setList: setList} = BoundsHelper;
|
|
9558
|
+
const {copyAndSpread: copyAndSpread$1, includes: includes, spread: spread, setList: setList} = BoundsHelper;
|
|
9512
9559
|
|
|
9513
9560
|
let Text = class Text extends UI {
|
|
9514
9561
|
get __tag() {
|
|
@@ -9555,13 +9602,13 @@ let Text = class Text extends UI {
|
|
|
9555
9602
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
9556
9603
|
}
|
|
9557
9604
|
__updateRenderSpread() {
|
|
9558
|
-
let
|
|
9559
|
-
if (!
|
|
9560
|
-
return
|
|
9605
|
+
let spread = super.__updateRenderSpread();
|
|
9606
|
+
if (!spread) spread = this.isOverflow ? 1 : 0;
|
|
9607
|
+
return spread;
|
|
9561
9608
|
}
|
|
9562
9609
|
__updateRenderBounds() {
|
|
9563
9610
|
const {renderBounds: renderBounds, renderSpread: renderSpread} = this.__layout;
|
|
9564
|
-
copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
9611
|
+
copyAndSpread$1(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
9565
9612
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
9566
9613
|
}
|
|
9567
9614
|
__updateChange() {
|
|
@@ -9987,9 +10034,9 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9987
10034
|
static setData(data) {
|
|
9988
10035
|
this.data = data;
|
|
9989
10036
|
}
|
|
9990
|
-
static getValidMove(leaf,
|
|
9991
|
-
const move = leaf.getLocalPoint(
|
|
9992
|
-
PointHelper.move(move,
|
|
10037
|
+
static getValidMove(leaf, localStart, worldTotal, checkLimit = true) {
|
|
10038
|
+
const move = leaf.getLocalPoint(worldTotal, null, true);
|
|
10039
|
+
PointHelper.move(move, localStart.x - leaf.x, localStart.y - leaf.y);
|
|
9993
10040
|
if (checkLimit) this.limitMove(leaf, move);
|
|
9994
10041
|
DragBoundsHelper.axisMove(leaf, move);
|
|
9995
10042
|
return move;
|
|
@@ -11019,8 +11066,8 @@ ui$1.__updateHitCanvas = function() {
|
|
|
11019
11066
|
if (isHitPixel) {
|
|
11020
11067
|
const {renderBounds: renderBounds} = this.__layout;
|
|
11021
11068
|
const size = Platform.image.hitCanvasSize;
|
|
11022
|
-
const scale = h.hitScale = tempBounds$
|
|
11023
|
-
const {x: x, y: y, width: width, height: height} = tempBounds$
|
|
11069
|
+
const scale = h.hitScale = tempBounds$2.set(0, 0, size, size).getFitMatrix(renderBounds).a;
|
|
11070
|
+
const {x: x, y: y, width: width, height: height} = tempBounds$2.set(renderBounds).scale(scale);
|
|
11024
11071
|
h.resize({
|
|
11025
11072
|
width: width,
|
|
11026
11073
|
height: height,
|
|
@@ -11117,8 +11164,8 @@ canvas.hitStroke = function(point, strokeWidth) {
|
|
|
11117
11164
|
canvas.hitPixel = function(radiusPoint, offset, scale = 1) {
|
|
11118
11165
|
let {x: x, y: y, radiusX: radiusX, radiusY: radiusY} = radiusPoint;
|
|
11119
11166
|
if (offset) x -= offset.x, y -= offset.y;
|
|
11120
|
-
tempBounds$
|
|
11121
|
-
const {data: data} = this.context.getImageData(tempBounds$
|
|
11167
|
+
tempBounds$2.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
|
|
11168
|
+
const {data: data} = this.context.getImageData(tempBounds$2.x, tempBounds$2.y, tempBounds$2.width || 1, tempBounds$2.height || 1);
|
|
11122
11169
|
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
11123
11170
|
if (data[i + 3] > 0) return true;
|
|
11124
11171
|
}
|
|
@@ -11430,24 +11477,29 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
11430
11477
|
}
|
|
11431
11478
|
}
|
|
11432
11479
|
|
|
11433
|
-
const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIntersectData: getIntersectData} = BoundsHelper;
|
|
11480
|
+
const {getSpread: getSpread, copyAndSpread: copyAndSpread, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$1, getIntersectData: getIntersectData} = BoundsHelper;
|
|
11481
|
+
|
|
11482
|
+
const tempBounds$1 = {};
|
|
11434
11483
|
|
|
11435
11484
|
function shape(ui, current, options) {
|
|
11436
11485
|
const canvas = current.getSameCanvas();
|
|
11437
|
-
const nowWorld = ui.__nowWorld,
|
|
11438
|
-
|
|
11486
|
+
const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
|
|
11487
|
+
const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
|
|
11488
|
+
toOuterOf(layout.strokeSpread ? (copyAndSpread(tempBounds$1, layout.boxBounds, layout.strokeSpread),
|
|
11489
|
+
tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
|
|
11490
|
+
let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
11439
11491
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
11440
|
-
if (currentBounds.includes(
|
|
11492
|
+
if (currentBounds.includes(nowWorldShapeBounds)) {
|
|
11441
11493
|
worldCanvas = canvas;
|
|
11442
|
-
bounds = shapeBounds =
|
|
11494
|
+
bounds = shapeBounds = nowWorldShapeBounds;
|
|
11495
|
+
renderBounds = nowWorld;
|
|
11443
11496
|
} else {
|
|
11444
|
-
const {renderShapeSpread: spread} = ui.__layout;
|
|
11445
11497
|
let worldClipBounds;
|
|
11446
11498
|
if (Platform.fullImageShadow) {
|
|
11447
|
-
worldClipBounds =
|
|
11499
|
+
worldClipBounds = nowWorldShapeBounds;
|
|
11448
11500
|
} else {
|
|
11449
|
-
const spreadBounds =
|
|
11450
|
-
worldClipBounds = getIntersectData(spreadBounds,
|
|
11501
|
+
const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
|
|
11502
|
+
worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
|
|
11451
11503
|
}
|
|
11452
11504
|
fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
|
|
11453
11505
|
let {a: fitScaleX, d: fitScaleY} = fitMatrix;
|
|
@@ -11457,8 +11509,10 @@ function shape(ui, current, options) {
|
|
|
11457
11509
|
scaleX *= fitScaleX;
|
|
11458
11510
|
scaleY *= fitScaleY;
|
|
11459
11511
|
}
|
|
11460
|
-
shapeBounds = getOuterOf(
|
|
11512
|
+
shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
|
|
11461
11513
|
bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
|
|
11514
|
+
renderBounds = getOuterOf(nowWorld, fitMatrix);
|
|
11515
|
+
move$1(renderBounds, -fitMatrix.e, -fitMatrix.f);
|
|
11462
11516
|
const userMatrix = options.matrix;
|
|
11463
11517
|
if (userMatrix) {
|
|
11464
11518
|
matrix = new Matrix(fitMatrix);
|
|
@@ -11477,6 +11531,7 @@ function shape(ui, current, options) {
|
|
|
11477
11531
|
matrix: matrix,
|
|
11478
11532
|
fitMatrix: fitMatrix,
|
|
11479
11533
|
bounds: bounds,
|
|
11534
|
+
renderBounds: renderBounds,
|
|
11480
11535
|
worldCanvas: worldCanvas,
|
|
11481
11536
|
shapeBounds: shapeBounds,
|
|
11482
11537
|
scaleX: scaleX,
|
|
@@ -11580,7 +11635,7 @@ const PaintModule = {
|
|
|
11580
11635
|
shape: shape
|
|
11581
11636
|
};
|
|
11582
11637
|
|
|
11583
|
-
let origin = {}, tempMatrix = getMatrixData();
|
|
11638
|
+
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
11584
11639
|
|
|
11585
11640
|
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
11586
11641
|
|
|
@@ -11595,12 +11650,12 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
11595
11650
|
data.transform = transform;
|
|
11596
11651
|
}
|
|
11597
11652
|
|
|
11598
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew,
|
|
11653
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
11599
11654
|
const transform = get$3();
|
|
11600
11655
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
11601
|
-
if (
|
|
11602
|
-
tempMatrix.a =
|
|
11603
|
-
multiplyParent(transform, tempMatrix);
|
|
11656
|
+
if (clipScaleX) {
|
|
11657
|
+
tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
|
|
11658
|
+
multiplyParent(transform, tempMatrix$1);
|
|
11604
11659
|
}
|
|
11605
11660
|
data.transform = transform;
|
|
11606
11661
|
}
|
|
@@ -11701,7 +11756,12 @@ function getPatternData(paint, box, image) {
|
|
|
11701
11756
|
|
|
11702
11757
|
case "normal":
|
|
11703
11758
|
case "clip":
|
|
11704
|
-
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
11759
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
|
|
11760
|
+
let clipScaleX, clipScaleY;
|
|
11761
|
+
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
11762
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
11763
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
11764
|
+
}
|
|
11705
11765
|
break;
|
|
11706
11766
|
|
|
11707
11767
|
case "repeat":
|
|
@@ -11859,7 +11919,7 @@ function ignoreRender(ui, value) {
|
|
|
11859
11919
|
|
|
11860
11920
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
11861
11921
|
|
|
11862
|
-
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
11922
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
11863
11923
|
|
|
11864
11924
|
function createPattern(ui, paint, pixelRatio) {
|
|
11865
11925
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -11908,8 +11968,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
11908
11968
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
11909
11969
|
const canvasWidth = width + (xGap || 0);
|
|
11910
11970
|
const canvasHeight = height + (yGap || 0);
|
|
11911
|
-
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
11912
|
-
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
11971
|
+
scaleX /= canvasWidth / max$1(floor(canvasWidth), 1);
|
|
11972
|
+
scaleY /= canvasHeight / max$1(floor(canvasHeight), 1);
|
|
11913
11973
|
if (!imageMatrix) {
|
|
11914
11974
|
imageMatrix = get$1();
|
|
11915
11975
|
if (transform) copy$1(imageMatrix, transform);
|
|
@@ -11935,17 +11995,15 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
11935
11995
|
if (allowDraw) {
|
|
11936
11996
|
if (data.repeat) {
|
|
11937
11997
|
allowDraw = false;
|
|
11938
|
-
} else {
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
|
|
11944
|
-
|
|
11945
|
-
height *= data.scaleY;
|
|
11946
|
-
}
|
|
11947
|
-
allowDraw = width * height > Platform.image.maxCacheSize;
|
|
11998
|
+
} else if (!(paint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || Export.running)) {
|
|
11999
|
+
let {width: width, height: height} = data;
|
|
12000
|
+
width *= scaleX * pixelRatio;
|
|
12001
|
+
height *= scaleY * pixelRatio;
|
|
12002
|
+
if (data.scaleX) {
|
|
12003
|
+
width *= data.scaleX;
|
|
12004
|
+
height *= data.scaleY;
|
|
11948
12005
|
}
|
|
12006
|
+
allowDraw = width * height > Platform.image.maxCacheSize;
|
|
11949
12007
|
}
|
|
11950
12008
|
}
|
|
11951
12009
|
if (allowDraw) {
|
|
@@ -12125,20 +12183,20 @@ const PaintGradientModule = {
|
|
|
12125
12183
|
getTransform: getTransform
|
|
12126
12184
|
};
|
|
12127
12185
|
|
|
12128
|
-
const {copy: copy, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper;
|
|
12186
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
12129
12187
|
|
|
12130
|
-
const tempBounds = {};
|
|
12188
|
+
const tempBounds = {}, tempMatrix = new Matrix;
|
|
12131
12189
|
|
|
12132
12190
|
const offsetOutBounds$1 = {};
|
|
12133
12191
|
|
|
12134
12192
|
function shadow(ui, current, shape) {
|
|
12135
|
-
let copyBounds,
|
|
12136
|
-
const {__nowWorld: nowWorld
|
|
12193
|
+
let copyBounds, transform;
|
|
12194
|
+
const {__nowWorld: nowWorld} = ui;
|
|
12137
12195
|
const {shadow: shadow} = ui.__;
|
|
12138
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
12196
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
12139
12197
|
const other = current.getSameCanvas();
|
|
12140
12198
|
const end = shadow.length - 1;
|
|
12141
|
-
toOffsetOutBounds$1(bounds, offsetOutBounds$1);
|
|
12199
|
+
toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
|
|
12142
12200
|
shadow.forEach((item, index) => {
|
|
12143
12201
|
let otherScale = 1;
|
|
12144
12202
|
if (item.scaleFixed) {
|
|
@@ -12146,54 +12204,61 @@ function shadow(ui, current, shape) {
|
|
|
12146
12204
|
if (sx > 1) otherScale = 1 / sx;
|
|
12147
12205
|
}
|
|
12148
12206
|
other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, ColorConvert.string(item.color));
|
|
12149
|
-
|
|
12150
|
-
|
|
12151
|
-
|
|
12207
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
12208
|
+
if (transform) other.setTransform(transform);
|
|
12209
|
+
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
12210
|
+
if (transform) other.resetTransform();
|
|
12211
|
+
copyBounds = renderBounds;
|
|
12152
12212
|
if (item.box) {
|
|
12153
12213
|
other.restore();
|
|
12154
12214
|
other.save();
|
|
12155
12215
|
if (worldCanvas) {
|
|
12156
|
-
other.copyWorld(other,
|
|
12216
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
12157
12217
|
copyBounds = nowWorld;
|
|
12158
12218
|
}
|
|
12159
12219
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
12160
12220
|
}
|
|
12161
|
-
|
|
12221
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
12162
12222
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
12163
12223
|
});
|
|
12164
12224
|
other.recycle(copyBounds);
|
|
12165
12225
|
}
|
|
12166
12226
|
|
|
12167
|
-
function
|
|
12168
|
-
let
|
|
12169
|
-
shadow.forEach(item =>
|
|
12170
|
-
|
|
12227
|
+
function getShadowRenderSpread(_ui, shadow) {
|
|
12228
|
+
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
12229
|
+
shadow.forEach(item => {
|
|
12230
|
+
x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
|
|
12231
|
+
top = max(top, spread + blur - y);
|
|
12232
|
+
right = max(right, spread + blur + x);
|
|
12233
|
+
bottom = max(bottom, spread + blur + y);
|
|
12234
|
+
left = max(left, spread + blur - x);
|
|
12235
|
+
});
|
|
12236
|
+
return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
|
|
12237
|
+
}
|
|
12238
|
+
|
|
12239
|
+
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
12240
|
+
if (shadow.spread) {
|
|
12241
|
+
const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
|
|
12242
|
+
tempMatrix.set().scaleOfOuter({
|
|
12243
|
+
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
12244
|
+
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
12245
|
+
}, spreadScale);
|
|
12246
|
+
return tempMatrix;
|
|
12247
|
+
}
|
|
12248
|
+
return undefined;
|
|
12171
12249
|
}
|
|
12172
12250
|
|
|
12173
|
-
function drawWorldShadow(canvas, outBounds,
|
|
12174
|
-
const {
|
|
12251
|
+
function drawWorldShadow(canvas, outBounds, shape) {
|
|
12252
|
+
const {shapeBounds: shapeBounds} = shape;
|
|
12253
|
+
let from, to;
|
|
12175
12254
|
if (Platform.fullImageShadow) {
|
|
12176
12255
|
copy(tempBounds, canvas.bounds);
|
|
12177
|
-
tempBounds.x
|
|
12178
|
-
|
|
12179
|
-
if (spreadScale) {
|
|
12180
|
-
const {fitMatrix: fitMatrix} = shape;
|
|
12181
|
-
tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
|
|
12182
|
-
tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
|
|
12183
|
-
tempBounds.width *= spreadScale;
|
|
12184
|
-
tempBounds.height *= spreadScale;
|
|
12185
|
-
}
|
|
12186
|
-
canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
|
|
12256
|
+
move(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
12257
|
+
from = canvas.bounds, to = tempBounds;
|
|
12187
12258
|
} else {
|
|
12188
|
-
|
|
12189
|
-
copy(tempBounds, outBounds);
|
|
12190
|
-
tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
|
|
12191
|
-
tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
|
|
12192
|
-
tempBounds.width *= spreadScale;
|
|
12193
|
-
tempBounds.height *= spreadScale;
|
|
12194
|
-
}
|
|
12195
|
-
canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
|
|
12259
|
+
from = shapeBounds, to = outBounds;
|
|
12196
12260
|
}
|
|
12261
|
+
canvas.copyWorld(shape.canvas, from, to);
|
|
12197
12262
|
}
|
|
12198
12263
|
|
|
12199
12264
|
const {toOffsetOutBounds: toOffsetOutBounds} = BoundsHelper;
|
|
@@ -12201,13 +12266,13 @@ const {toOffsetOutBounds: toOffsetOutBounds} = BoundsHelper;
|
|
|
12201
12266
|
const offsetOutBounds = {};
|
|
12202
12267
|
|
|
12203
12268
|
function innerShadow(ui, current, shape) {
|
|
12204
|
-
let copyBounds,
|
|
12205
|
-
const {__nowWorld: nowWorld
|
|
12269
|
+
let copyBounds, transform;
|
|
12270
|
+
const {__nowWorld: nowWorld} = ui;
|
|
12206
12271
|
const {innerShadow: innerShadow} = ui.__;
|
|
12207
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
12272
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
12208
12273
|
const other = current.getSameCanvas();
|
|
12209
12274
|
const end = innerShadow.length - 1;
|
|
12210
|
-
toOffsetOutBounds(bounds, offsetOutBounds);
|
|
12275
|
+
toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
|
|
12211
12276
|
innerShadow.forEach((item, index) => {
|
|
12212
12277
|
let otherScale = 1;
|
|
12213
12278
|
if (item.scaleFixed) {
|
|
@@ -12216,16 +12281,17 @@ function innerShadow(ui, current, shape) {
|
|
|
12216
12281
|
}
|
|
12217
12282
|
other.save();
|
|
12218
12283
|
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
12219
|
-
|
|
12220
|
-
|
|
12284
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
12285
|
+
if (transform) other.setTransform(transform);
|
|
12286
|
+
drawWorldShadow(other, offsetOutBounds, shape);
|
|
12221
12287
|
other.restore();
|
|
12222
12288
|
if (worldCanvas) {
|
|
12223
|
-
other.copyWorld(other,
|
|
12289
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
12224
12290
|
other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
|
|
12225
12291
|
copyBounds = nowWorld;
|
|
12226
12292
|
} else {
|
|
12227
12293
|
other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
|
|
12228
|
-
copyBounds =
|
|
12294
|
+
copyBounds = renderBounds;
|
|
12229
12295
|
}
|
|
12230
12296
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
|
|
12231
12297
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
@@ -12234,6 +12300,8 @@ function innerShadow(ui, current, shape) {
|
|
|
12234
12300
|
other.recycle(copyBounds);
|
|
12235
12301
|
}
|
|
12236
12302
|
|
|
12303
|
+
const getInnerShadowSpread = getShadowRenderSpread;
|
|
12304
|
+
|
|
12237
12305
|
function blur(ui, current, origin) {
|
|
12238
12306
|
const {blur: blur} = ui.__;
|
|
12239
12307
|
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
@@ -12248,10 +12316,12 @@ const EffectModule = {
|
|
|
12248
12316
|
innerShadow: innerShadow,
|
|
12249
12317
|
blur: blur,
|
|
12250
12318
|
backgroundBlur: backgroundBlur,
|
|
12251
|
-
|
|
12319
|
+
getShadowRenderSpread: getShadowRenderSpread,
|
|
12320
|
+
getShadowTransform: getShadowTransform,
|
|
12252
12321
|
isTransformShadow(_shadow) {
|
|
12253
12322
|
return undefined;
|
|
12254
|
-
}
|
|
12323
|
+
},
|
|
12324
|
+
getInnerShadowSpread: getInnerShadowSpread
|
|
12255
12325
|
};
|
|
12256
12326
|
|
|
12257
12327
|
const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
|
|
@@ -12268,6 +12338,7 @@ Group.prototype.__renderMask = function(canvas, options) {
|
|
|
12268
12338
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
|
|
12269
12339
|
maskCanvas = contentCanvas = null;
|
|
12270
12340
|
}
|
|
12341
|
+
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
12271
12342
|
maskOpacity = child.__.opacity;
|
|
12272
12343
|
usedGrayscaleAlpha = false;
|
|
12273
12344
|
if (mask === "path" || mask === "clipping-path") {
|
|
@@ -12285,7 +12356,6 @@ Group.prototype.__renderMask = function(canvas, options) {
|
|
|
12285
12356
|
if (!contentCanvas) contentCanvas = getCanvas(canvas);
|
|
12286
12357
|
child.__render(maskCanvas, options);
|
|
12287
12358
|
}
|
|
12288
|
-
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
12289
12359
|
continue;
|
|
12290
12360
|
}
|
|
12291
12361
|
const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
|
|
@@ -12887,4 +12957,4 @@ try {
|
|
|
12887
12957
|
if (wx) useCanvas("miniapp", wx);
|
|
12888
12958
|
} catch (_a) {}
|
|
12889
12959
|
|
|
12890
|
-
export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, HitCanvasManager, 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, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$
|
|
12960
|
+
export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, FourNumberHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, 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, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|