@leafer-draw/worker 1.9.7 → 1.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.cjs +109 -81
- package/dist/worker.esm.js +110 -82
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +232 -169
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +240 -169
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +9 -9
package/dist/worker.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$8(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$8(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$8} = 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 = 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$4} = 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$3} = 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$3(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$2, move: move} = PointHelper;
|
|
6017
|
+
const {copy: copy$2, 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.9";
|
|
6778
6819
|
|
|
6779
6820
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6780
6821
|
get allowBackgroundColor() {
|
|
@@ -7199,6 +7240,7 @@ class Renderer {
|
|
|
7199
7240
|
usePartRender: true,
|
|
7200
7241
|
maxFPS: 120
|
|
7201
7242
|
};
|
|
7243
|
+
this.frames = [];
|
|
7202
7244
|
this.target = target;
|
|
7203
7245
|
this.canvas = canvas;
|
|
7204
7246
|
if (userConfig) this.config = DataHelper.default(userConfig, this.config);
|
|
@@ -7351,12 +7393,15 @@ class Renderer {
|
|
|
7351
7393
|
const target = this.target;
|
|
7352
7394
|
if (this.requestTime || !target) return;
|
|
7353
7395
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
7354
|
-
|
|
7396
|
+
this.requestTime = this.frameTime || Date.now();
|
|
7355
7397
|
const render = () => {
|
|
7356
|
-
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
7398
|
+
const nowFPS = 1e3 / ((this.frameTime = Date.now()) - this.requestTime);
|
|
7357
7399
|
const {maxFPS: maxFPS} = this.config;
|
|
7358
|
-
if (maxFPS && nowFPS > maxFPS
|
|
7359
|
-
|
|
7400
|
+
if (maxFPS && nowFPS > maxFPS) return Platform.requestRender(render);
|
|
7401
|
+
const {frames: frames} = this;
|
|
7402
|
+
if (frames.length > 30) frames.shift();
|
|
7403
|
+
frames.push(nowFPS);
|
|
7404
|
+
this.FPS = Math.round(frames.reduce((a, b) => a + b, 0) / frames.length);
|
|
7360
7405
|
this.requestTime = 0;
|
|
7361
7406
|
this.checkRender();
|
|
7362
7407
|
};
|
|
@@ -7829,39 +7874,41 @@ class CanvasData extends RectData {
|
|
|
7829
7874
|
}
|
|
7830
7875
|
}
|
|
7831
7876
|
|
|
7877
|
+
const {max: max$2, add: add$1} = FourNumberHelper;
|
|
7878
|
+
|
|
7832
7879
|
const UIBounds = {
|
|
7833
7880
|
__updateStrokeSpread() {
|
|
7834
|
-
let
|
|
7881
|
+
let spread = 0, boxSpread = 0;
|
|
7835
7882
|
const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
|
|
7836
7883
|
if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
|
|
7837
|
-
|
|
7884
|
+
boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
|
|
7838
7885
|
if (!data.__boxStroke) {
|
|
7839
|
-
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 *
|
|
7886
|
+
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
|
|
7840
7887
|
const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
|
|
7841
|
-
|
|
7888
|
+
spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
7842
7889
|
}
|
|
7843
7890
|
}
|
|
7844
|
-
if (data.__useArrow)
|
|
7891
|
+
if (data.__useArrow) spread += strokeWidth * 5;
|
|
7845
7892
|
if (box) {
|
|
7846
|
-
|
|
7847
|
-
|
|
7893
|
+
spread = max$2(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
|
|
7894
|
+
boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
|
|
7848
7895
|
}
|
|
7849
|
-
this.__layout.strokeBoxSpread =
|
|
7850
|
-
return
|
|
7896
|
+
this.__layout.strokeBoxSpread = boxSpread;
|
|
7897
|
+
return spread;
|
|
7851
7898
|
},
|
|
7852
7899
|
__updateRenderSpread() {
|
|
7853
|
-
let
|
|
7854
|
-
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
|
|
7855
|
-
if (shadow)
|
|
7856
|
-
if (blur)
|
|
7857
|
-
if (filter)
|
|
7858
|
-
if (renderSpread)
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
if (
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
return
|
|
7900
|
+
let spread = 0;
|
|
7901
|
+
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
|
|
7902
|
+
if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
|
|
7903
|
+
if (blur) spread = max$2(spread, blur);
|
|
7904
|
+
if (filter) spread = add$1(spread, Filter.getSpread(filter));
|
|
7905
|
+
if (renderSpread) spread = add$1(spread, renderSpread);
|
|
7906
|
+
if (strokeSpread) spread = add$1(spread, strokeSpread);
|
|
7907
|
+
let shapeSpread = spread;
|
|
7908
|
+
if (innerShadow) shapeSpread = max$2(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
|
|
7909
|
+
if (backgroundBlur) shapeSpread = max$2(shapeSpread, backgroundBlur);
|
|
7910
|
+
this.__layout.renderShapeSpread = shapeSpread;
|
|
7911
|
+
return box ? max$2(box.__updateRenderSpread(), spread) : spread;
|
|
7865
7912
|
}
|
|
7866
7913
|
};
|
|
7867
7914
|
|
|
@@ -9172,7 +9219,7 @@ __decorate([ resizeType() ], Canvas.prototype, "contextSettings", void 0);
|
|
|
9172
9219
|
|
|
9173
9220
|
Canvas = __decorate([ registerUI() ], Canvas);
|
|
9174
9221
|
|
|
9175
|
-
const {copyAndSpread: copyAndSpread, includes: includes, spread: spread, setList: setList} = BoundsHelper;
|
|
9222
|
+
const {copyAndSpread: copyAndSpread$1, includes: includes, spread: spread, setList: setList} = BoundsHelper;
|
|
9176
9223
|
|
|
9177
9224
|
let Text = class Text extends UI {
|
|
9178
9225
|
get __tag() {
|
|
@@ -9219,13 +9266,13 @@ let Text = class Text extends UI {
|
|
|
9219
9266
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
9220
9267
|
}
|
|
9221
9268
|
__updateRenderSpread() {
|
|
9222
|
-
let
|
|
9223
|
-
if (!
|
|
9224
|
-
return
|
|
9269
|
+
let spread = super.__updateRenderSpread();
|
|
9270
|
+
if (!spread) spread = this.isOverflow ? 1 : 0;
|
|
9271
|
+
return spread;
|
|
9225
9272
|
}
|
|
9226
9273
|
__updateRenderBounds() {
|
|
9227
9274
|
const {renderBounds: renderBounds, renderSpread: renderSpread} = this.__layout;
|
|
9228
|
-
copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
9275
|
+
copyAndSpread$1(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
9229
9276
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
9230
9277
|
}
|
|
9231
9278
|
__updateChange() {
|
|
@@ -9593,24 +9640,29 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
9593
9640
|
}
|
|
9594
9641
|
}
|
|
9595
9642
|
|
|
9596
|
-
const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIntersectData: getIntersectData} = BoundsHelper;
|
|
9643
|
+
const {getSpread: getSpread, copyAndSpread: copyAndSpread, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$1, getIntersectData: getIntersectData} = BoundsHelper;
|
|
9644
|
+
|
|
9645
|
+
const tempBounds$1 = {};
|
|
9597
9646
|
|
|
9598
9647
|
function shape(ui, current, options) {
|
|
9599
9648
|
const canvas = current.getSameCanvas();
|
|
9600
|
-
const nowWorld = ui.__nowWorld,
|
|
9601
|
-
|
|
9649
|
+
const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
|
|
9650
|
+
const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
|
|
9651
|
+
toOuterOf(layout.strokeSpread ? (copyAndSpread(tempBounds$1, layout.boxBounds, layout.strokeSpread),
|
|
9652
|
+
tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
|
|
9653
|
+
let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
9602
9654
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
9603
|
-
if (currentBounds.includes(
|
|
9655
|
+
if (currentBounds.includes(nowWorldShapeBounds)) {
|
|
9604
9656
|
worldCanvas = canvas;
|
|
9605
|
-
bounds = shapeBounds =
|
|
9657
|
+
bounds = shapeBounds = nowWorldShapeBounds;
|
|
9658
|
+
renderBounds = nowWorld;
|
|
9606
9659
|
} else {
|
|
9607
|
-
const {renderShapeSpread: spread} = ui.__layout;
|
|
9608
9660
|
let worldClipBounds;
|
|
9609
9661
|
if (Platform.fullImageShadow) {
|
|
9610
|
-
worldClipBounds =
|
|
9662
|
+
worldClipBounds = nowWorldShapeBounds;
|
|
9611
9663
|
} else {
|
|
9612
|
-
const spreadBounds =
|
|
9613
|
-
worldClipBounds = getIntersectData(spreadBounds,
|
|
9664
|
+
const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
|
|
9665
|
+
worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
|
|
9614
9666
|
}
|
|
9615
9667
|
fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
|
|
9616
9668
|
let {a: fitScaleX, d: fitScaleY} = fitMatrix;
|
|
@@ -9620,8 +9672,10 @@ function shape(ui, current, options) {
|
|
|
9620
9672
|
scaleX *= fitScaleX;
|
|
9621
9673
|
scaleY *= fitScaleY;
|
|
9622
9674
|
}
|
|
9623
|
-
shapeBounds = getOuterOf(
|
|
9675
|
+
shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
|
|
9624
9676
|
bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
|
|
9677
|
+
renderBounds = getOuterOf(nowWorld, fitMatrix);
|
|
9678
|
+
move$1(renderBounds, -fitMatrix.e, -fitMatrix.f);
|
|
9625
9679
|
const userMatrix = options.matrix;
|
|
9626
9680
|
if (userMatrix) {
|
|
9627
9681
|
matrix = new Matrix(fitMatrix);
|
|
@@ -9640,6 +9694,7 @@ function shape(ui, current, options) {
|
|
|
9640
9694
|
matrix: matrix,
|
|
9641
9695
|
fitMatrix: fitMatrix,
|
|
9642
9696
|
bounds: bounds,
|
|
9697
|
+
renderBounds: renderBounds,
|
|
9643
9698
|
worldCanvas: worldCanvas,
|
|
9644
9699
|
shapeBounds: shapeBounds,
|
|
9645
9700
|
scaleX: scaleX,
|
|
@@ -9743,7 +9798,7 @@ const PaintModule = {
|
|
|
9743
9798
|
shape: shape
|
|
9744
9799
|
};
|
|
9745
9800
|
|
|
9746
|
-
let origin = {}, tempMatrix = getMatrixData();
|
|
9801
|
+
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
9747
9802
|
|
|
9748
9803
|
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
9749
9804
|
|
|
@@ -9758,12 +9813,12 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
9758
9813
|
data.transform = transform;
|
|
9759
9814
|
}
|
|
9760
9815
|
|
|
9761
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew,
|
|
9816
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
9762
9817
|
const transform = get$3();
|
|
9763
9818
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
9764
|
-
if (
|
|
9765
|
-
tempMatrix.a =
|
|
9766
|
-
multiplyParent(transform, tempMatrix);
|
|
9819
|
+
if (clipScaleX) {
|
|
9820
|
+
tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
|
|
9821
|
+
multiplyParent(transform, tempMatrix$1);
|
|
9767
9822
|
}
|
|
9768
9823
|
data.transform = transform;
|
|
9769
9824
|
}
|
|
@@ -9864,7 +9919,12 @@ function getPatternData(paint, box, image) {
|
|
|
9864
9919
|
|
|
9865
9920
|
case "normal":
|
|
9866
9921
|
case "clip":
|
|
9867
|
-
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
9922
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
|
|
9923
|
+
let clipScaleX, clipScaleY;
|
|
9924
|
+
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
9925
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
9926
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
9927
|
+
}
|
|
9868
9928
|
break;
|
|
9869
9929
|
|
|
9870
9930
|
case "repeat":
|
|
@@ -10022,7 +10082,7 @@ function ignoreRender(ui, value) {
|
|
|
10022
10082
|
|
|
10023
10083
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
10024
10084
|
|
|
10025
|
-
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
10085
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
10026
10086
|
|
|
10027
10087
|
function createPattern(ui, paint, pixelRatio) {
|
|
10028
10088
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -10071,8 +10131,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
10071
10131
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
10072
10132
|
const canvasWidth = width + (xGap || 0);
|
|
10073
10133
|
const canvasHeight = height + (yGap || 0);
|
|
10074
|
-
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
10075
|
-
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
10134
|
+
scaleX /= canvasWidth / max$1(floor(canvasWidth), 1);
|
|
10135
|
+
scaleY /= canvasHeight / max$1(floor(canvasHeight), 1);
|
|
10076
10136
|
if (!imageMatrix) {
|
|
10077
10137
|
imageMatrix = get$1();
|
|
10078
10138
|
if (transform) copy$1(imageMatrix, transform);
|
|
@@ -10098,17 +10158,15 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
10098
10158
|
if (allowDraw) {
|
|
10099
10159
|
if (data.repeat) {
|
|
10100
10160
|
allowDraw = false;
|
|
10101
|
-
} else {
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
|
|
10107
|
-
|
|
10108
|
-
height *= data.scaleY;
|
|
10109
|
-
}
|
|
10110
|
-
allowDraw = width * height > Platform.image.maxCacheSize;
|
|
10161
|
+
} else if (!(paint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || Export.running)) {
|
|
10162
|
+
let {width: width, height: height} = data;
|
|
10163
|
+
width *= scaleX * pixelRatio;
|
|
10164
|
+
height *= scaleY * pixelRatio;
|
|
10165
|
+
if (data.scaleX) {
|
|
10166
|
+
width *= data.scaleX;
|
|
10167
|
+
height *= data.scaleY;
|
|
10111
10168
|
}
|
|
10169
|
+
allowDraw = width * height > Platform.image.maxCacheSize;
|
|
10112
10170
|
}
|
|
10113
10171
|
}
|
|
10114
10172
|
if (allowDraw) {
|
|
@@ -10288,75 +10346,82 @@ const PaintGradientModule = {
|
|
|
10288
10346
|
getTransform: getTransform
|
|
10289
10347
|
};
|
|
10290
10348
|
|
|
10291
|
-
const {copy: copy, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper;
|
|
10349
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
10292
10350
|
|
|
10293
|
-
const tempBounds = {};
|
|
10351
|
+
const tempBounds = {}, tempMatrix = new Matrix;
|
|
10294
10352
|
|
|
10295
10353
|
const offsetOutBounds$1 = {};
|
|
10296
10354
|
|
|
10297
10355
|
function shadow(ui, current, shape) {
|
|
10298
|
-
let copyBounds,
|
|
10299
|
-
const {__nowWorld: nowWorld
|
|
10356
|
+
let copyBounds, transform;
|
|
10357
|
+
const {__nowWorld: nowWorld} = ui;
|
|
10300
10358
|
const {shadow: shadow} = ui.__;
|
|
10301
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
10359
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
10302
10360
|
const other = current.getSameCanvas();
|
|
10303
10361
|
const end = shadow.length - 1;
|
|
10304
|
-
toOffsetOutBounds$1(bounds, offsetOutBounds$1);
|
|
10362
|
+
toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
|
|
10305
10363
|
shadow.forEach((item, index) => {
|
|
10306
10364
|
let otherScale = 1;
|
|
10307
10365
|
if (item.scaleFixed) {
|
|
10308
10366
|
const sx = Math.abs(nowWorld.scaleX);
|
|
10309
10367
|
if (sx > 1) otherScale = 1 / sx;
|
|
10310
10368
|
}
|
|
10311
|
-
other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, ColorConvert.string(item.color));
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10369
|
+
other.setWorldShadow(offsetOutBounds$1.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds$1.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale, ColorConvert.string(item.color));
|
|
10370
|
+
transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
10371
|
+
if (transform) other.setTransform(transform);
|
|
10372
|
+
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
10373
|
+
if (transform) other.resetTransform();
|
|
10374
|
+
copyBounds = renderBounds;
|
|
10315
10375
|
if (item.box) {
|
|
10316
10376
|
other.restore();
|
|
10317
10377
|
other.save();
|
|
10318
10378
|
if (worldCanvas) {
|
|
10319
|
-
other.copyWorld(other,
|
|
10379
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
10320
10380
|
copyBounds = nowWorld;
|
|
10321
10381
|
}
|
|
10322
10382
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
10323
10383
|
}
|
|
10324
|
-
|
|
10384
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
10325
10385
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
10326
10386
|
});
|
|
10327
10387
|
other.recycle(copyBounds);
|
|
10328
10388
|
}
|
|
10329
10389
|
|
|
10330
|
-
function
|
|
10331
|
-
let
|
|
10332
|
-
shadow.forEach(item =>
|
|
10333
|
-
|
|
10390
|
+
function getShadowRenderSpread(_ui, shadow) {
|
|
10391
|
+
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
10392
|
+
shadow.forEach(item => {
|
|
10393
|
+
x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
|
|
10394
|
+
top = max(top, spread + blur - y);
|
|
10395
|
+
right = max(right, spread + blur + x);
|
|
10396
|
+
bottom = max(bottom, spread + blur + y);
|
|
10397
|
+
left = max(left, spread + blur - x);
|
|
10398
|
+
});
|
|
10399
|
+
return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
|
|
10400
|
+
}
|
|
10401
|
+
|
|
10402
|
+
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
10403
|
+
if (shadow.spread) {
|
|
10404
|
+
const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
|
|
10405
|
+
tempMatrix.set().scaleOfOuter({
|
|
10406
|
+
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
10407
|
+
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
10408
|
+
}, spreadScale);
|
|
10409
|
+
return tempMatrix;
|
|
10410
|
+
}
|
|
10411
|
+
return undefined;
|
|
10334
10412
|
}
|
|
10335
10413
|
|
|
10336
|
-
function drawWorldShadow(canvas, outBounds,
|
|
10337
|
-
const {
|
|
10414
|
+
function drawWorldShadow(canvas, outBounds, shape) {
|
|
10415
|
+
const {shapeBounds: shapeBounds} = shape;
|
|
10416
|
+
let from, to;
|
|
10338
10417
|
if (Platform.fullImageShadow) {
|
|
10339
10418
|
copy(tempBounds, canvas.bounds);
|
|
10340
|
-
tempBounds.x
|
|
10341
|
-
|
|
10342
|
-
if (spreadScale) {
|
|
10343
|
-
const {fitMatrix: fitMatrix} = shape;
|
|
10344
|
-
tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
|
|
10345
|
-
tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
|
|
10346
|
-
tempBounds.width *= spreadScale;
|
|
10347
|
-
tempBounds.height *= spreadScale;
|
|
10348
|
-
}
|
|
10349
|
-
canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
|
|
10419
|
+
move(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
10420
|
+
from = canvas.bounds, to = tempBounds;
|
|
10350
10421
|
} else {
|
|
10351
|
-
|
|
10352
|
-
copy(tempBounds, outBounds);
|
|
10353
|
-
tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
|
|
10354
|
-
tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
|
|
10355
|
-
tempBounds.width *= spreadScale;
|
|
10356
|
-
tempBounds.height *= spreadScale;
|
|
10357
|
-
}
|
|
10358
|
-
canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
|
|
10422
|
+
from = shapeBounds, to = outBounds;
|
|
10359
10423
|
}
|
|
10424
|
+
canvas.copyWorld(shape.canvas, from, to);
|
|
10360
10425
|
}
|
|
10361
10426
|
|
|
10362
10427
|
const {toOffsetOutBounds: toOffsetOutBounds} = BoundsHelper;
|
|
@@ -10364,13 +10429,13 @@ const {toOffsetOutBounds: toOffsetOutBounds} = BoundsHelper;
|
|
|
10364
10429
|
const offsetOutBounds = {};
|
|
10365
10430
|
|
|
10366
10431
|
function innerShadow(ui, current, shape) {
|
|
10367
|
-
let copyBounds,
|
|
10368
|
-
const {__nowWorld: nowWorld
|
|
10432
|
+
let copyBounds, transform;
|
|
10433
|
+
const {__nowWorld: nowWorld} = ui;
|
|
10369
10434
|
const {innerShadow: innerShadow} = ui.__;
|
|
10370
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
10435
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
10371
10436
|
const other = current.getSameCanvas();
|
|
10372
10437
|
const end = innerShadow.length - 1;
|
|
10373
|
-
toOffsetOutBounds(bounds, offsetOutBounds);
|
|
10438
|
+
toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
|
|
10374
10439
|
innerShadow.forEach((item, index) => {
|
|
10375
10440
|
let otherScale = 1;
|
|
10376
10441
|
if (item.scaleFixed) {
|
|
@@ -10378,17 +10443,18 @@ function innerShadow(ui, current, shape) {
|
|
|
10378
10443
|
if (sx > 1) otherScale = 1 / sx;
|
|
10379
10444
|
}
|
|
10380
10445
|
other.save();
|
|
10381
|
-
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
10382
|
-
|
|
10383
|
-
|
|
10446
|
+
other.setWorldShadow(offsetOutBounds.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale);
|
|
10447
|
+
transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
10448
|
+
if (transform) other.setTransform(transform);
|
|
10449
|
+
drawWorldShadow(other, offsetOutBounds, shape);
|
|
10384
10450
|
other.restore();
|
|
10385
10451
|
if (worldCanvas) {
|
|
10386
|
-
other.copyWorld(other,
|
|
10452
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
10387
10453
|
other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
|
|
10388
10454
|
copyBounds = nowWorld;
|
|
10389
10455
|
} else {
|
|
10390
10456
|
other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
|
|
10391
|
-
copyBounds =
|
|
10457
|
+
copyBounds = renderBounds;
|
|
10392
10458
|
}
|
|
10393
10459
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
|
|
10394
10460
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
@@ -10397,6 +10463,8 @@ function innerShadow(ui, current, shape) {
|
|
|
10397
10463
|
other.recycle(copyBounds);
|
|
10398
10464
|
}
|
|
10399
10465
|
|
|
10466
|
+
const getInnerShadowSpread = getShadowRenderSpread;
|
|
10467
|
+
|
|
10400
10468
|
function blur(ui, current, origin) {
|
|
10401
10469
|
const {blur: blur} = ui.__;
|
|
10402
10470
|
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
@@ -10411,10 +10479,12 @@ const EffectModule = {
|
|
|
10411
10479
|
innerShadow: innerShadow,
|
|
10412
10480
|
blur: blur,
|
|
10413
10481
|
backgroundBlur: backgroundBlur,
|
|
10414
|
-
|
|
10482
|
+
getShadowRenderSpread: getShadowRenderSpread,
|
|
10483
|
+
getShadowTransform: getShadowTransform,
|
|
10415
10484
|
isTransformShadow(_shadow) {
|
|
10416
10485
|
return undefined;
|
|
10417
|
-
}
|
|
10486
|
+
},
|
|
10487
|
+
getInnerShadowSpread: getInnerShadowSpread
|
|
10418
10488
|
};
|
|
10419
10489
|
|
|
10420
10490
|
const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
|
|
@@ -10431,6 +10501,7 @@ Group.prototype.__renderMask = function(canvas, options) {
|
|
|
10431
10501
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
|
|
10432
10502
|
maskCanvas = contentCanvas = null;
|
|
10433
10503
|
}
|
|
10504
|
+
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
10434
10505
|
maskOpacity = child.__.opacity;
|
|
10435
10506
|
usedGrayscaleAlpha = false;
|
|
10436
10507
|
if (mask === "path" || mask === "clipping-path") {
|
|
@@ -10448,7 +10519,6 @@ Group.prototype.__renderMask = function(canvas, options) {
|
|
|
10448
10519
|
if (!contentCanvas) contentCanvas = getCanvas(canvas);
|
|
10449
10520
|
child.__render(maskCanvas, options);
|
|
10450
10521
|
}
|
|
10451
|
-
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
10452
10522
|
continue;
|
|
10453
10523
|
}
|
|
10454
10524
|
const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
|
|
@@ -11010,6 +11080,7 @@ const TextConvertModule = {
|
|
|
11010
11080
|
};
|
|
11011
11081
|
|
|
11012
11082
|
function string(color, opacity) {
|
|
11083
|
+
if (!color) return "#000";
|
|
11013
11084
|
const doOpacity = isNumber(opacity) && opacity < 1;
|
|
11014
11085
|
if (isString(color)) {
|
|
11015
11086
|
if (doOpacity && ColorConvert.object) color = ColorConvert.object(color); else return color;
|
|
@@ -11038,4 +11109,4 @@ Object.assign(Effect, EffectModule);
|
|
|
11038
11109
|
|
|
11039
11110
|
useCanvas();
|
|
11040
11111
|
|
|
11041
|
-
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, 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, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, 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$
|
|
11112
|
+
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, FourNumberHelper, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, 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, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, 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 };
|