@leafer-draw/worker 1.9.6 → 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/worker.cjs +116 -80
- package/dist/worker.esm.js +118 -82
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +273 -180
- 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 +282 -180
- 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;
|
|
258
264
|
},
|
|
259
|
-
|
|
265
|
+
setTemp(top, right, bottom, left) {
|
|
266
|
+
return set$1(tempFour, top, right, bottom, left);
|
|
267
|
+
},
|
|
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) {
|
|
@@ -423,6 +469,15 @@ const MatrixHelper = {
|
|
|
423
469
|
t.c *= scaleY;
|
|
424
470
|
t.d *= scaleY;
|
|
425
471
|
},
|
|
472
|
+
pixelScale(t, pixelRatio, to) {
|
|
473
|
+
to || (to = t);
|
|
474
|
+
to.a = t.a * pixelRatio;
|
|
475
|
+
to.b = t.b * pixelRatio;
|
|
476
|
+
to.c = t.c * pixelRatio;
|
|
477
|
+
to.d = t.d * pixelRatio;
|
|
478
|
+
to.e = t.e * pixelRatio;
|
|
479
|
+
to.f = t.f * pixelRatio;
|
|
480
|
+
},
|
|
426
481
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
427
482
|
M$6.toInnerPoint(t, origin, tempPoint$3);
|
|
428
483
|
M$6.scaleOfInner(t, tempPoint$3, scaleX, scaleY);
|
|
@@ -922,6 +977,10 @@ class Matrix {
|
|
|
922
977
|
this.scaleY *= y || x;
|
|
923
978
|
return this;
|
|
924
979
|
}
|
|
980
|
+
pixelScale(pixelRatio) {
|
|
981
|
+
MatrixHelper.pixelScale(this, pixelRatio);
|
|
982
|
+
return this;
|
|
983
|
+
}
|
|
925
984
|
scaleOfOuter(origin, x, y) {
|
|
926
985
|
MatrixHelper.scaleOfOuter(this, origin, x, y);
|
|
927
986
|
return this;
|
|
@@ -1001,7 +1060,7 @@ class Matrix {
|
|
|
1001
1060
|
}
|
|
1002
1061
|
}
|
|
1003
1062
|
|
|
1004
|
-
const tempMatrix$
|
|
1063
|
+
const tempMatrix$2 = new Matrix;
|
|
1005
1064
|
|
|
1006
1065
|
const TwoPointBoundsHelper = {
|
|
1007
1066
|
tempPointBounds: {},
|
|
@@ -1151,10 +1210,10 @@ const point = {};
|
|
|
1151
1210
|
|
|
1152
1211
|
const toPoint$4 = {};
|
|
1153
1212
|
|
|
1154
|
-
const tempBounds$
|
|
1213
|
+
const tempBounds$3 = {};
|
|
1155
1214
|
|
|
1156
1215
|
const BoundsHelper = {
|
|
1157
|
-
tempBounds: tempBounds$
|
|
1216
|
+
tempBounds: tempBounds$3,
|
|
1158
1217
|
set(t, x = 0, y = 0, width = 0, height = 0) {
|
|
1159
1218
|
t.x = x;
|
|
1160
1219
|
t.y = y;
|
|
@@ -1205,19 +1264,11 @@ const BoundsHelper = {
|
|
|
1205
1264
|
B.move(t, x, y);
|
|
1206
1265
|
return t;
|
|
1207
1266
|
},
|
|
1208
|
-
toOffsetOutBounds(t, to,
|
|
1209
|
-
if (!to)
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
}
|
|
1214
|
-
if (parent) {
|
|
1215
|
-
to.offsetX = -(B.maxX(parent) - t.x);
|
|
1216
|
-
to.offsetY = -(B.maxY(parent) - t.y);
|
|
1217
|
-
} else {
|
|
1218
|
-
to.offsetX = t.x + t.width;
|
|
1219
|
-
to.offsetY = t.y + t.height;
|
|
1220
|
-
}
|
|
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);
|
|
1221
1272
|
B.move(to, -to.offsetX, -to.offsetY);
|
|
1222
1273
|
},
|
|
1223
1274
|
scale(t, scaleX, scaleY = scaleX, onlySize) {
|
|
@@ -1231,9 +1282,9 @@ const BoundsHelper = {
|
|
|
1231
1282
|
t.height *= scaleY;
|
|
1232
1283
|
},
|
|
1233
1284
|
tempToOuterOf(t, matrix) {
|
|
1234
|
-
B.copy(tempBounds$
|
|
1235
|
-
B.toOuterOf(tempBounds$
|
|
1236
|
-
return tempBounds$
|
|
1285
|
+
B.copy(tempBounds$3, t);
|
|
1286
|
+
B.toOuterOf(tempBounds$3, matrix);
|
|
1287
|
+
return tempBounds$3;
|
|
1237
1288
|
},
|
|
1238
1289
|
getOuterOf(t, matrix) {
|
|
1239
1290
|
t = Object.assign({}, t);
|
|
@@ -1291,9 +1342,9 @@ const BoundsHelper = {
|
|
|
1291
1342
|
put(t, put, align = "center", putScale = 1, changeSize = true, to) {
|
|
1292
1343
|
to || (to = put);
|
|
1293
1344
|
if (isString(putScale)) putScale = B.getFitScale(t, put, putScale === "cover");
|
|
1294
|
-
tempBounds$
|
|
1295
|
-
tempBounds$
|
|
1296
|
-
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);
|
|
1297
1348
|
},
|
|
1298
1349
|
getSpread(t, spread, side) {
|
|
1299
1350
|
const n = {};
|
|
@@ -1363,7 +1414,7 @@ const BoundsHelper = {
|
|
|
1363
1414
|
first = false;
|
|
1364
1415
|
if (!addMode) copy$8(t, bounds);
|
|
1365
1416
|
} else {
|
|
1366
|
-
add$
|
|
1417
|
+
add$2(t, bounds);
|
|
1367
1418
|
}
|
|
1368
1419
|
}
|
|
1369
1420
|
}
|
|
@@ -1377,7 +1428,7 @@ const BoundsHelper = {
|
|
|
1377
1428
|
B.set(t, point.x, point.y);
|
|
1378
1429
|
},
|
|
1379
1430
|
addPoint(t, point) {
|
|
1380
|
-
add$
|
|
1431
|
+
add$2(t, point, true);
|
|
1381
1432
|
},
|
|
1382
1433
|
getPoints(t) {
|
|
1383
1434
|
const {x: x, y: y, width: width, height: height} = t;
|
|
@@ -1448,7 +1499,7 @@ const BoundsHelper = {
|
|
|
1448
1499
|
|
|
1449
1500
|
const B = BoundsHelper;
|
|
1450
1501
|
|
|
1451
|
-
const {add: add$
|
|
1502
|
+
const {add: add$2, copy: copy$8} = B;
|
|
1452
1503
|
|
|
1453
1504
|
class Bounds {
|
|
1454
1505
|
get minX() {
|
|
@@ -1593,7 +1644,7 @@ class Bounds {
|
|
|
1593
1644
|
}
|
|
1594
1645
|
}
|
|
1595
1646
|
|
|
1596
|
-
const tempBounds$
|
|
1647
|
+
const tempBounds$2 = new Bounds;
|
|
1597
1648
|
|
|
1598
1649
|
class AutoBounds {
|
|
1599
1650
|
constructor(top, right, bottom, left, width, height) {
|
|
@@ -2146,7 +2197,7 @@ __decorate([ contextMethod() ], Canvas$1.prototype, "measureText", null);
|
|
|
2146
2197
|
|
|
2147
2198
|
__decorate([ contextMethod() ], Canvas$1.prototype, "strokeText", null);
|
|
2148
2199
|
|
|
2149
|
-
const {copy: copy$7, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2200
|
+
const {copy: copy$7, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2150
2201
|
|
|
2151
2202
|
const minSize = {
|
|
2152
2203
|
width: 1,
|
|
@@ -2247,13 +2298,8 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2247
2298
|
setWorld(matrix, parentMatrix) {
|
|
2248
2299
|
const {pixelRatio: pixelRatio, pixelSnap: pixelSnap} = this, w = this.worldTransform;
|
|
2249
2300
|
if (parentMatrix) multiplyParent$4(matrix, parentMatrix, w);
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
w.c = matrix.c * pixelRatio;
|
|
2253
|
-
w.d = matrix.d * pixelRatio;
|
|
2254
|
-
w.e = matrix.e * pixelRatio;
|
|
2255
|
-
w.f = matrix.f * pixelRatio;
|
|
2256
|
-
if (pixelSnap) {
|
|
2301
|
+
pixelScale(matrix, pixelRatio, w);
|
|
2302
|
+
if (pixelSnap && !matrix.ignorePixelSnap) {
|
|
2257
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),
|
|
2258
2304
|
w.f = round$1(w.f);
|
|
2259
2305
|
}
|
|
@@ -3977,7 +4023,7 @@ const I = ImageManager;
|
|
|
3977
4023
|
|
|
3978
4024
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
3979
4025
|
|
|
3980
|
-
const {floor: floor$1, max: max$
|
|
4026
|
+
const {floor: floor$1, max: max$3} = Math;
|
|
3981
4027
|
|
|
3982
4028
|
class LeaferImage {
|
|
3983
4029
|
get url() {
|
|
@@ -4066,7 +4112,7 @@ class LeaferImage {
|
|
|
4066
4112
|
}
|
|
4067
4113
|
if (data) return data;
|
|
4068
4114
|
}
|
|
4069
|
-
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));
|
|
4070
4116
|
const ctx = canvas.getContext("2d");
|
|
4071
4117
|
if (opacity) ctx.globalAlpha = opacity;
|
|
4072
4118
|
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
@@ -4265,6 +4311,18 @@ function surfaceType(defaultValue) {
|
|
|
4265
4311
|
}));
|
|
4266
4312
|
}
|
|
4267
4313
|
|
|
4314
|
+
function dimType(defaultValue) {
|
|
4315
|
+
return decorateLeafAttr(defaultValue, key => attr({
|
|
4316
|
+
set(value) {
|
|
4317
|
+
if (this.__setAttr(key, value)) {
|
|
4318
|
+
const data = this.__;
|
|
4319
|
+
DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
|
|
4320
|
+
this.__layout.surfaceChange();
|
|
4321
|
+
}
|
|
4322
|
+
}
|
|
4323
|
+
}));
|
|
4324
|
+
}
|
|
4325
|
+
|
|
4268
4326
|
function opacityType(defaultValue) {
|
|
4269
4327
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4270
4328
|
set(value) {
|
|
@@ -4309,7 +4367,7 @@ function sortType(defaultValue) {
|
|
|
4309
4367
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4310
4368
|
set(value) {
|
|
4311
4369
|
if (this.__setAttr(key, value)) {
|
|
4312
|
-
this.__layout.
|
|
4370
|
+
this.__layout.surfaceChange();
|
|
4313
4371
|
this.waitParent(() => {
|
|
4314
4372
|
this.parent.__layout.childrenSortChange();
|
|
4315
4373
|
});
|
|
@@ -4346,7 +4404,7 @@ function hitType(defaultValue) {
|
|
|
4346
4404
|
set(value) {
|
|
4347
4405
|
if (this.__setAttr(key, value)) {
|
|
4348
4406
|
this.__layout.hitCanvasChanged = true;
|
|
4349
|
-
if (Debug.showBounds === "hit") this.__layout.
|
|
4407
|
+
if (Debug.showBounds === "hit") this.__layout.surfaceChange();
|
|
4350
4408
|
if (this.leafer) this.leafer.updateCursor();
|
|
4351
4409
|
}
|
|
4352
4410
|
}
|
|
@@ -4848,7 +4906,7 @@ const WaitHelper = {
|
|
|
4848
4906
|
|
|
4849
4907
|
const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2} = LeafHelper;
|
|
4850
4908
|
|
|
4851
|
-
const {toOuterOf: toOuterOf$
|
|
4909
|
+
const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$4} = BoundsHelper;
|
|
4852
4910
|
|
|
4853
4911
|
const localContent = "_localContentBounds";
|
|
4854
4912
|
|
|
@@ -4871,7 +4929,7 @@ class LeafLayout {
|
|
|
4871
4929
|
this._renderBounds = bounds;
|
|
4872
4930
|
}
|
|
4873
4931
|
get localContentBounds() {
|
|
4874
|
-
toOuterOf$
|
|
4932
|
+
toOuterOf$3(this.contentBounds, this.leaf.__localMatrix, this[localContent] || (this[localContent] = {}));
|
|
4875
4933
|
return this[localContent];
|
|
4876
4934
|
}
|
|
4877
4935
|
get localStrokeBounds() {
|
|
@@ -4881,15 +4939,15 @@ class LeafLayout {
|
|
|
4881
4939
|
return this._localRenderBounds || this;
|
|
4882
4940
|
}
|
|
4883
4941
|
get worldContentBounds() {
|
|
4884
|
-
toOuterOf$
|
|
4942
|
+
toOuterOf$3(this.contentBounds, this.leaf.__world, this[worldContent] || (this[worldContent] = {}));
|
|
4885
4943
|
return this[worldContent];
|
|
4886
4944
|
}
|
|
4887
4945
|
get worldBoxBounds() {
|
|
4888
|
-
toOuterOf$
|
|
4946
|
+
toOuterOf$3(this.boxBounds, this.leaf.__world, this[worldBox] || (this[worldBox] = {}));
|
|
4889
4947
|
return this[worldBox];
|
|
4890
4948
|
}
|
|
4891
4949
|
get worldStrokeBounds() {
|
|
4892
|
-
toOuterOf$
|
|
4950
|
+
toOuterOf$3(this.strokeBounds, this.leaf.__world, this[worldStroke] || (this[worldStroke] = {}));
|
|
4893
4951
|
return this[worldStroke];
|
|
4894
4952
|
}
|
|
4895
4953
|
get a() {
|
|
@@ -5741,14 +5799,14 @@ const {updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2} = LeafH
|
|
|
5741
5799
|
|
|
5742
5800
|
const {updateBounds: updateBounds$1} = BranchHelper;
|
|
5743
5801
|
|
|
5744
|
-
const {toOuterOf: toOuterOf$
|
|
5802
|
+
const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$2, copy: copy$3} = BoundsHelper;
|
|
5745
5803
|
|
|
5746
5804
|
const {toBounds: toBounds} = PathBounds;
|
|
5747
5805
|
|
|
5748
5806
|
const LeafBounds = {
|
|
5749
5807
|
__updateWorldBounds() {
|
|
5750
5808
|
const layout = this.__layout;
|
|
5751
|
-
toOuterOf$
|
|
5809
|
+
toOuterOf$2(layout.renderBounds, this.__world, this.__world);
|
|
5752
5810
|
if (layout.resized) {
|
|
5753
5811
|
if (layout.resized === "inner") this.__onUpdateSize();
|
|
5754
5812
|
if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
|
|
@@ -5804,13 +5862,13 @@ const LeafBounds = {
|
|
|
5804
5862
|
__updateLocalBoxBounds() {
|
|
5805
5863
|
if (this.__hasMotionPath) this.__updateMotionPath();
|
|
5806
5864
|
if (this.__hasAutoLayout) this.__updateAutoLayout();
|
|
5807
|
-
toOuterOf$
|
|
5865
|
+
toOuterOf$2(this.__layout.boxBounds, this.__local, this.__local);
|
|
5808
5866
|
},
|
|
5809
5867
|
__updateLocalStrokeBounds() {
|
|
5810
|
-
toOuterOf$
|
|
5868
|
+
toOuterOf$2(this.__layout.strokeBounds, this.__localMatrix, this.__layout.localStrokeBounds);
|
|
5811
5869
|
},
|
|
5812
5870
|
__updateLocalRenderBounds() {
|
|
5813
|
-
toOuterOf$
|
|
5871
|
+
toOuterOf$2(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
|
|
5814
5872
|
},
|
|
5815
5873
|
__updateBoxBounds(_secondLayout, _bounds) {
|
|
5816
5874
|
const b = this.__layout.boxBounds;
|
|
@@ -5848,11 +5906,11 @@ const LeafBounds = {
|
|
|
5848
5906
|
},
|
|
5849
5907
|
__updateStrokeBounds(_bounds) {
|
|
5850
5908
|
const layout = this.__layout;
|
|
5851
|
-
copyAndSpread$
|
|
5909
|
+
copyAndSpread$2(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
5852
5910
|
},
|
|
5853
5911
|
__updateRenderBounds(_bounds) {
|
|
5854
|
-
const layout = this.__layout;
|
|
5855
|
-
|
|
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);
|
|
5856
5914
|
}
|
|
5857
5915
|
};
|
|
5858
5916
|
|
|
@@ -5861,6 +5919,7 @@ const LeafRender = {
|
|
|
5861
5919
|
if (options.shape) return this.__renderShape(canvas, options);
|
|
5862
5920
|
if (this.__worldOpacity) {
|
|
5863
5921
|
const data = this.__;
|
|
5922
|
+
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
5864
5923
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5865
5924
|
canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
5866
5925
|
if (this.__.__single) {
|
|
@@ -5909,7 +5968,9 @@ const BranchRender = {
|
|
|
5909
5968
|
this.__nowWorld = this.__getNowWorld(options);
|
|
5910
5969
|
if (this.__worldOpacity) {
|
|
5911
5970
|
const data = this.__;
|
|
5912
|
-
if (data.
|
|
5971
|
+
if (data.__useDim) {
|
|
5972
|
+
if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.bright && !options.topRendering) return options.topList.add(this); else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
|
|
5973
|
+
}
|
|
5913
5974
|
if (data.__single && !this.isBranchLeaf) {
|
|
5914
5975
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
5915
5976
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
@@ -5947,11 +6008,13 @@ const tempScaleData$1 = {};
|
|
|
5947
6008
|
|
|
5948
6009
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
5949
6010
|
|
|
6011
|
+
const {stintSet: stintSet$3} = DataHelper;
|
|
6012
|
+
|
|
5950
6013
|
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
5951
6014
|
|
|
5952
|
-
const {toOuterOf: toOuterOf} = BoundsHelper;
|
|
6015
|
+
const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
5953
6016
|
|
|
5954
|
-
const {copy: copy$2, move: move} = PointHelper;
|
|
6017
|
+
const {copy: copy$2, move: move$2} = PointHelper;
|
|
5955
6018
|
|
|
5956
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;
|
|
5957
6020
|
|
|
@@ -6227,8 +6290,9 @@ let Leaf = class Leaf {
|
|
|
6227
6290
|
if (!this.__cameraWorld) this.__cameraWorld = {};
|
|
6228
6291
|
const cameraWorld = this.__cameraWorld, world = this.__world;
|
|
6229
6292
|
multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
|
|
6230
|
-
toOuterOf(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
6231
|
-
cameraWorld
|
|
6293
|
+
toOuterOf$1(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
6294
|
+
stintSet$3(cameraWorld, "half", world.half);
|
|
6295
|
+
stintSet$3(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
|
|
6232
6296
|
return cameraWorld;
|
|
6233
6297
|
} else {
|
|
6234
6298
|
return this.__world;
|
|
@@ -6262,7 +6326,7 @@ let Leaf = class Leaf {
|
|
|
6262
6326
|
getWorldBounds(inner, relative, change) {
|
|
6263
6327
|
const matrix = relative ? getRelativeWorld(this, relative) : this.worldTransform;
|
|
6264
6328
|
const to = change ? inner : {};
|
|
6265
|
-
toOuterOf(inner, matrix, to);
|
|
6329
|
+
toOuterOf$1(inner, matrix, to);
|
|
6266
6330
|
return to;
|
|
6267
6331
|
}
|
|
6268
6332
|
worldToLocal(world, to, distance, relative) {
|
|
@@ -6295,7 +6359,7 @@ let Leaf = class Leaf {
|
|
|
6295
6359
|
}
|
|
6296
6360
|
getBoxPointByInner(inner, _relative, _distance, change) {
|
|
6297
6361
|
const point = change ? inner : Object.assign({}, inner), {x: x, y: y} = this.boxBounds;
|
|
6298
|
-
move(point, -x, -y);
|
|
6362
|
+
move$2(point, -x, -y);
|
|
6299
6363
|
return point;
|
|
6300
6364
|
}
|
|
6301
6365
|
getInnerPoint(world, relative, distance, change) {
|
|
@@ -6305,7 +6369,7 @@ let Leaf = class Leaf {
|
|
|
6305
6369
|
}
|
|
6306
6370
|
getInnerPointByBox(box, _relative, _distance, change) {
|
|
6307
6371
|
const point = change ? box : Object.assign({}, box), {x: x, y: y} = this.boxBounds;
|
|
6308
|
-
move(point, x, y);
|
|
6372
|
+
move$2(point, x, y);
|
|
6309
6373
|
return point;
|
|
6310
6374
|
}
|
|
6311
6375
|
getInnerPointByLocal(local, _relative, distance, change) {
|
|
@@ -6751,7 +6815,7 @@ class LeafLevelList {
|
|
|
6751
6815
|
}
|
|
6752
6816
|
}
|
|
6753
6817
|
|
|
6754
|
-
const version = "1.9.
|
|
6818
|
+
const version = "1.9.8";
|
|
6755
6819
|
|
|
6756
6820
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6757
6821
|
get allowBackgroundColor() {
|
|
@@ -7176,6 +7240,7 @@ class Renderer {
|
|
|
7176
7240
|
usePartRender: true,
|
|
7177
7241
|
maxFPS: 120
|
|
7178
7242
|
};
|
|
7243
|
+
this.frames = [];
|
|
7179
7244
|
this.target = target;
|
|
7180
7245
|
this.canvas = canvas;
|
|
7181
7246
|
if (userConfig) this.config = DataHelper.default(userConfig, this.config);
|
|
@@ -7305,7 +7370,7 @@ class Renderer {
|
|
|
7305
7370
|
};
|
|
7306
7371
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
7307
7372
|
if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
|
|
7308
|
-
this.target
|
|
7373
|
+
Platform.render(this.target, canvas, options);
|
|
7309
7374
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
7310
7375
|
this.renderOptions = options;
|
|
7311
7376
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
@@ -7328,12 +7393,15 @@ class Renderer {
|
|
|
7328
7393
|
const target = this.target;
|
|
7329
7394
|
if (this.requestTime || !target) return;
|
|
7330
7395
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
7331
|
-
|
|
7396
|
+
this.requestTime = this.frameTime || Date.now();
|
|
7332
7397
|
const render = () => {
|
|
7333
|
-
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
7398
|
+
const nowFPS = 1e3 / ((this.frameTime = Date.now()) - this.requestTime);
|
|
7334
7399
|
const {maxFPS: maxFPS} = this.config;
|
|
7335
|
-
if (maxFPS && nowFPS > maxFPS
|
|
7336
|
-
|
|
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);
|
|
7337
7405
|
this.requestTime = 0;
|
|
7338
7406
|
this.checkRender();
|
|
7339
7407
|
};
|
|
@@ -7398,6 +7466,15 @@ Object.assign(Creator, {
|
|
|
7398
7466
|
|
|
7399
7467
|
Platform.layout = Layouter.fullLayout;
|
|
7400
7468
|
|
|
7469
|
+
Platform.render = function(target, canvas, options) {
|
|
7470
|
+
const topOptions = Object.assign(Object.assign({}, options), {
|
|
7471
|
+
topRendering: true
|
|
7472
|
+
});
|
|
7473
|
+
options.topList = new LeafList;
|
|
7474
|
+
target.__render(canvas, options);
|
|
7475
|
+
if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
|
|
7476
|
+
};
|
|
7477
|
+
|
|
7401
7478
|
function effectType(defaultValue) {
|
|
7402
7479
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
7403
7480
|
set(value) {
|
|
@@ -7797,39 +7874,41 @@ class CanvasData extends RectData {
|
|
|
7797
7874
|
}
|
|
7798
7875
|
}
|
|
7799
7876
|
|
|
7877
|
+
const {max: max$2, add: add$1} = FourNumberHelper;
|
|
7878
|
+
|
|
7800
7879
|
const UIBounds = {
|
|
7801
7880
|
__updateStrokeSpread() {
|
|
7802
|
-
let
|
|
7881
|
+
let spread = 0, boxSpread = 0;
|
|
7803
7882
|
const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
|
|
7804
7883
|
if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
|
|
7805
|
-
|
|
7884
|
+
boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
|
|
7806
7885
|
if (!data.__boxStroke) {
|
|
7807
|
-
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 *
|
|
7886
|
+
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
|
|
7808
7887
|
const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
|
|
7809
|
-
|
|
7888
|
+
spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
7810
7889
|
}
|
|
7811
7890
|
}
|
|
7812
|
-
if (data.__useArrow)
|
|
7891
|
+
if (data.__useArrow) spread += strokeWidth * 5;
|
|
7813
7892
|
if (box) {
|
|
7814
|
-
|
|
7815
|
-
|
|
7893
|
+
spread = max$2(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
|
|
7894
|
+
boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
|
|
7816
7895
|
}
|
|
7817
|
-
this.__layout.strokeBoxSpread =
|
|
7818
|
-
return
|
|
7896
|
+
this.__layout.strokeBoxSpread = boxSpread;
|
|
7897
|
+
return spread;
|
|
7819
7898
|
},
|
|
7820
7899
|
__updateRenderSpread() {
|
|
7821
|
-
let
|
|
7822
|
-
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
|
|
7823
|
-
if (shadow)
|
|
7824
|
-
if (blur)
|
|
7825
|
-
if (filter)
|
|
7826
|
-
if (renderSpread)
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
if (
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
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;
|
|
7833
7912
|
}
|
|
7834
7913
|
};
|
|
7835
7914
|
|
|
@@ -8173,9 +8252,9 @@ __decorate([ visibleType(true) ], UI.prototype, "visible", void 0);
|
|
|
8173
8252
|
|
|
8174
8253
|
__decorate([ surfaceType(false) ], UI.prototype, "locked", void 0);
|
|
8175
8254
|
|
|
8176
|
-
__decorate([
|
|
8255
|
+
__decorate([ dimType(false) ], UI.prototype, "dim", void 0);
|
|
8177
8256
|
|
|
8178
|
-
__decorate([
|
|
8257
|
+
__decorate([ dimType(false) ], UI.prototype, "dimskip", void 0);
|
|
8179
8258
|
|
|
8180
8259
|
__decorate([ sortType(0) ], UI.prototype, "zIndex", void 0);
|
|
8181
8260
|
|
|
@@ -9140,7 +9219,7 @@ __decorate([ resizeType() ], Canvas.prototype, "contextSettings", void 0);
|
|
|
9140
9219
|
|
|
9141
9220
|
Canvas = __decorate([ registerUI() ], Canvas);
|
|
9142
9221
|
|
|
9143
|
-
const {copyAndSpread: copyAndSpread, includes: includes, spread: spread, setList: setList} = BoundsHelper;
|
|
9222
|
+
const {copyAndSpread: copyAndSpread$1, includes: includes, spread: spread, setList: setList} = BoundsHelper;
|
|
9144
9223
|
|
|
9145
9224
|
let Text = class Text extends UI {
|
|
9146
9225
|
get __tag() {
|
|
@@ -9187,13 +9266,13 @@ let Text = class Text extends UI {
|
|
|
9187
9266
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
9188
9267
|
}
|
|
9189
9268
|
__updateRenderSpread() {
|
|
9190
|
-
let
|
|
9191
|
-
if (!
|
|
9192
|
-
return
|
|
9269
|
+
let spread = super.__updateRenderSpread();
|
|
9270
|
+
if (!spread) spread = this.isOverflow ? 1 : 0;
|
|
9271
|
+
return spread;
|
|
9193
9272
|
}
|
|
9194
9273
|
__updateRenderBounds() {
|
|
9195
9274
|
const {renderBounds: renderBounds, renderSpread: renderSpread} = this.__layout;
|
|
9196
|
-
copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
9275
|
+
copyAndSpread$1(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
9197
9276
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
9198
9277
|
}
|
|
9199
9278
|
__updateChange() {
|
|
@@ -9561,24 +9640,29 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
9561
9640
|
}
|
|
9562
9641
|
}
|
|
9563
9642
|
|
|
9564
|
-
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 = {};
|
|
9565
9646
|
|
|
9566
9647
|
function shape(ui, current, options) {
|
|
9567
9648
|
const canvas = current.getSameCanvas();
|
|
9568
|
-
const nowWorld = ui.__nowWorld,
|
|
9569
|
-
|
|
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;
|
|
9570
9654
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
9571
|
-
if (currentBounds.includes(
|
|
9655
|
+
if (currentBounds.includes(nowWorldShapeBounds)) {
|
|
9572
9656
|
worldCanvas = canvas;
|
|
9573
|
-
bounds = shapeBounds =
|
|
9657
|
+
bounds = shapeBounds = nowWorldShapeBounds;
|
|
9658
|
+
renderBounds = nowWorld;
|
|
9574
9659
|
} else {
|
|
9575
|
-
const {renderShapeSpread: spread} = ui.__layout;
|
|
9576
9660
|
let worldClipBounds;
|
|
9577
9661
|
if (Platform.fullImageShadow) {
|
|
9578
|
-
worldClipBounds =
|
|
9662
|
+
worldClipBounds = nowWorldShapeBounds;
|
|
9579
9663
|
} else {
|
|
9580
|
-
const spreadBounds =
|
|
9581
|
-
worldClipBounds = getIntersectData(spreadBounds,
|
|
9664
|
+
const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
|
|
9665
|
+
worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
|
|
9582
9666
|
}
|
|
9583
9667
|
fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
|
|
9584
9668
|
let {a: fitScaleX, d: fitScaleY} = fitMatrix;
|
|
@@ -9588,8 +9672,10 @@ function shape(ui, current, options) {
|
|
|
9588
9672
|
scaleX *= fitScaleX;
|
|
9589
9673
|
scaleY *= fitScaleY;
|
|
9590
9674
|
}
|
|
9591
|
-
shapeBounds = getOuterOf(
|
|
9675
|
+
shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
|
|
9592
9676
|
bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
|
|
9677
|
+
renderBounds = getOuterOf(nowWorld, fitMatrix);
|
|
9678
|
+
move$1(renderBounds, -fitMatrix.e, -fitMatrix.f);
|
|
9593
9679
|
const userMatrix = options.matrix;
|
|
9594
9680
|
if (userMatrix) {
|
|
9595
9681
|
matrix = new Matrix(fitMatrix);
|
|
@@ -9608,6 +9694,7 @@ function shape(ui, current, options) {
|
|
|
9608
9694
|
matrix: matrix,
|
|
9609
9695
|
fitMatrix: fitMatrix,
|
|
9610
9696
|
bounds: bounds,
|
|
9697
|
+
renderBounds: renderBounds,
|
|
9611
9698
|
worldCanvas: worldCanvas,
|
|
9612
9699
|
shapeBounds: shapeBounds,
|
|
9613
9700
|
scaleX: scaleX,
|
|
@@ -9711,7 +9798,7 @@ const PaintModule = {
|
|
|
9711
9798
|
shape: shape
|
|
9712
9799
|
};
|
|
9713
9800
|
|
|
9714
|
-
let origin = {}, tempMatrix = getMatrixData();
|
|
9801
|
+
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
9715
9802
|
|
|
9716
9803
|
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
9717
9804
|
|
|
@@ -9726,12 +9813,12 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
9726
9813
|
data.transform = transform;
|
|
9727
9814
|
}
|
|
9728
9815
|
|
|
9729
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew,
|
|
9816
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
9730
9817
|
const transform = get$3();
|
|
9731
9818
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
9732
|
-
if (
|
|
9733
|
-
tempMatrix.a =
|
|
9734
|
-
multiplyParent(transform, tempMatrix);
|
|
9819
|
+
if (clipScaleX) {
|
|
9820
|
+
tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
|
|
9821
|
+
multiplyParent(transform, tempMatrix$1);
|
|
9735
9822
|
}
|
|
9736
9823
|
data.transform = transform;
|
|
9737
9824
|
}
|
|
@@ -9832,7 +9919,12 @@ function getPatternData(paint, box, image) {
|
|
|
9832
9919
|
|
|
9833
9920
|
case "normal":
|
|
9834
9921
|
case "clip":
|
|
9835
|
-
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
|
+
}
|
|
9836
9928
|
break;
|
|
9837
9929
|
|
|
9838
9930
|
case "repeat":
|
|
@@ -9990,7 +10082,7 @@ function ignoreRender(ui, value) {
|
|
|
9990
10082
|
|
|
9991
10083
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
9992
10084
|
|
|
9993
|
-
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
10085
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
9994
10086
|
|
|
9995
10087
|
function createPattern(ui, paint, pixelRatio) {
|
|
9996
10088
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -10039,8 +10131,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
10039
10131
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
10040
10132
|
const canvasWidth = width + (xGap || 0);
|
|
10041
10133
|
const canvasHeight = height + (yGap || 0);
|
|
10042
|
-
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
10043
|
-
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
10134
|
+
scaleX /= canvasWidth / max$1(floor(canvasWidth), 1);
|
|
10135
|
+
scaleY /= canvasHeight / max$1(floor(canvasHeight), 1);
|
|
10044
10136
|
if (!imageMatrix) {
|
|
10045
10137
|
imageMatrix = get$1();
|
|
10046
10138
|
if (transform) copy$1(imageMatrix, transform);
|
|
@@ -10066,17 +10158,15 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
10066
10158
|
if (allowDraw) {
|
|
10067
10159
|
if (data.repeat) {
|
|
10068
10160
|
allowDraw = false;
|
|
10069
|
-
} else {
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
height *= data.scaleY;
|
|
10077
|
-
}
|
|
10078
|
-
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;
|
|
10079
10168
|
}
|
|
10169
|
+
allowDraw = width * height > Platform.image.maxCacheSize;
|
|
10080
10170
|
}
|
|
10081
10171
|
}
|
|
10082
10172
|
if (allowDraw) {
|
|
@@ -10256,20 +10346,20 @@ const PaintGradientModule = {
|
|
|
10256
10346
|
getTransform: getTransform
|
|
10257
10347
|
};
|
|
10258
10348
|
|
|
10259
|
-
const {copy: copy, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper;
|
|
10349
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
10260
10350
|
|
|
10261
|
-
const tempBounds = {};
|
|
10351
|
+
const tempBounds = {}, tempMatrix = new Matrix;
|
|
10262
10352
|
|
|
10263
10353
|
const offsetOutBounds$1 = {};
|
|
10264
10354
|
|
|
10265
10355
|
function shadow(ui, current, shape) {
|
|
10266
|
-
let copyBounds,
|
|
10267
|
-
const {__nowWorld: nowWorld
|
|
10356
|
+
let copyBounds, transform;
|
|
10357
|
+
const {__nowWorld: nowWorld} = ui;
|
|
10268
10358
|
const {shadow: shadow} = ui.__;
|
|
10269
|
-
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;
|
|
10270
10360
|
const other = current.getSameCanvas();
|
|
10271
10361
|
const end = shadow.length - 1;
|
|
10272
|
-
toOffsetOutBounds$1(bounds, offsetOutBounds$1);
|
|
10362
|
+
toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
|
|
10273
10363
|
shadow.forEach((item, index) => {
|
|
10274
10364
|
let otherScale = 1;
|
|
10275
10365
|
if (item.scaleFixed) {
|
|
@@ -10277,54 +10367,61 @@ function shadow(ui, current, shape) {
|
|
|
10277
10367
|
if (sx > 1) otherScale = 1 / sx;
|
|
10278
10368
|
}
|
|
10279
10369
|
other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, ColorConvert.string(item.color));
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
|
|
10370
|
+
transform = 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;
|
|
10283
10375
|
if (item.box) {
|
|
10284
10376
|
other.restore();
|
|
10285
10377
|
other.save();
|
|
10286
10378
|
if (worldCanvas) {
|
|
10287
|
-
other.copyWorld(other,
|
|
10379
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
10288
10380
|
copyBounds = nowWorld;
|
|
10289
10381
|
}
|
|
10290
10382
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
10291
10383
|
}
|
|
10292
|
-
|
|
10384
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
10293
10385
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
10294
10386
|
});
|
|
10295
10387
|
other.recycle(copyBounds);
|
|
10296
10388
|
}
|
|
10297
10389
|
|
|
10298
|
-
function
|
|
10299
|
-
let
|
|
10300
|
-
shadow.forEach(item =>
|
|
10301
|
-
|
|
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;
|
|
10302
10412
|
}
|
|
10303
10413
|
|
|
10304
|
-
function drawWorldShadow(canvas, outBounds,
|
|
10305
|
-
const {
|
|
10414
|
+
function drawWorldShadow(canvas, outBounds, shape) {
|
|
10415
|
+
const {shapeBounds: shapeBounds} = shape;
|
|
10416
|
+
let from, to;
|
|
10306
10417
|
if (Platform.fullImageShadow) {
|
|
10307
10418
|
copy(tempBounds, canvas.bounds);
|
|
10308
|
-
tempBounds.x
|
|
10309
|
-
|
|
10310
|
-
if (spreadScale) {
|
|
10311
|
-
const {fitMatrix: fitMatrix} = shape;
|
|
10312
|
-
tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
|
|
10313
|
-
tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
|
|
10314
|
-
tempBounds.width *= spreadScale;
|
|
10315
|
-
tempBounds.height *= spreadScale;
|
|
10316
|
-
}
|
|
10317
|
-
canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
|
|
10419
|
+
move(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
10420
|
+
from = canvas.bounds, to = tempBounds;
|
|
10318
10421
|
} else {
|
|
10319
|
-
|
|
10320
|
-
copy(tempBounds, outBounds);
|
|
10321
|
-
tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
|
|
10322
|
-
tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
|
|
10323
|
-
tempBounds.width *= spreadScale;
|
|
10324
|
-
tempBounds.height *= spreadScale;
|
|
10325
|
-
}
|
|
10326
|
-
canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
|
|
10422
|
+
from = shapeBounds, to = outBounds;
|
|
10327
10423
|
}
|
|
10424
|
+
canvas.copyWorld(shape.canvas, from, to);
|
|
10328
10425
|
}
|
|
10329
10426
|
|
|
10330
10427
|
const {toOffsetOutBounds: toOffsetOutBounds} = BoundsHelper;
|
|
@@ -10332,13 +10429,13 @@ const {toOffsetOutBounds: toOffsetOutBounds} = BoundsHelper;
|
|
|
10332
10429
|
const offsetOutBounds = {};
|
|
10333
10430
|
|
|
10334
10431
|
function innerShadow(ui, current, shape) {
|
|
10335
|
-
let copyBounds,
|
|
10336
|
-
const {__nowWorld: nowWorld
|
|
10432
|
+
let copyBounds, transform;
|
|
10433
|
+
const {__nowWorld: nowWorld} = ui;
|
|
10337
10434
|
const {innerShadow: innerShadow} = ui.__;
|
|
10338
|
-
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;
|
|
10339
10436
|
const other = current.getSameCanvas();
|
|
10340
10437
|
const end = innerShadow.length - 1;
|
|
10341
|
-
toOffsetOutBounds(bounds, offsetOutBounds);
|
|
10438
|
+
toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
|
|
10342
10439
|
innerShadow.forEach((item, index) => {
|
|
10343
10440
|
let otherScale = 1;
|
|
10344
10441
|
if (item.scaleFixed) {
|
|
@@ -10347,16 +10444,17 @@ function innerShadow(ui, current, shape) {
|
|
|
10347
10444
|
}
|
|
10348
10445
|
other.save();
|
|
10349
10446
|
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
10350
|
-
|
|
10351
|
-
|
|
10447
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
10448
|
+
if (transform) other.setTransform(transform);
|
|
10449
|
+
drawWorldShadow(other, offsetOutBounds, shape);
|
|
10352
10450
|
other.restore();
|
|
10353
10451
|
if (worldCanvas) {
|
|
10354
|
-
other.copyWorld(other,
|
|
10452
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
10355
10453
|
other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
|
|
10356
10454
|
copyBounds = nowWorld;
|
|
10357
10455
|
} else {
|
|
10358
10456
|
other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
|
|
10359
|
-
copyBounds =
|
|
10457
|
+
copyBounds = renderBounds;
|
|
10360
10458
|
}
|
|
10361
10459
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
|
|
10362
10460
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
@@ -10365,6 +10463,8 @@ function innerShadow(ui, current, shape) {
|
|
|
10365
10463
|
other.recycle(copyBounds);
|
|
10366
10464
|
}
|
|
10367
10465
|
|
|
10466
|
+
const getInnerShadowSpread = getShadowRenderSpread;
|
|
10467
|
+
|
|
10368
10468
|
function blur(ui, current, origin) {
|
|
10369
10469
|
const {blur: blur} = ui.__;
|
|
10370
10470
|
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
@@ -10379,10 +10479,12 @@ const EffectModule = {
|
|
|
10379
10479
|
innerShadow: innerShadow,
|
|
10380
10480
|
blur: blur,
|
|
10381
10481
|
backgroundBlur: backgroundBlur,
|
|
10382
|
-
|
|
10482
|
+
getShadowRenderSpread: getShadowRenderSpread,
|
|
10483
|
+
getShadowTransform: getShadowTransform,
|
|
10383
10484
|
isTransformShadow(_shadow) {
|
|
10384
10485
|
return undefined;
|
|
10385
|
-
}
|
|
10486
|
+
},
|
|
10487
|
+
getInnerShadowSpread: getInnerShadowSpread
|
|
10386
10488
|
};
|
|
10387
10489
|
|
|
10388
10490
|
const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
|
|
@@ -10399,6 +10501,7 @@ Group.prototype.__renderMask = function(canvas, options) {
|
|
|
10399
10501
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
|
|
10400
10502
|
maskCanvas = contentCanvas = null;
|
|
10401
10503
|
}
|
|
10504
|
+
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
10402
10505
|
maskOpacity = child.__.opacity;
|
|
10403
10506
|
usedGrayscaleAlpha = false;
|
|
10404
10507
|
if (mask === "path" || mask === "clipping-path") {
|
|
@@ -10416,7 +10519,6 @@ Group.prototype.__renderMask = function(canvas, options) {
|
|
|
10416
10519
|
if (!contentCanvas) contentCanvas = getCanvas(canvas);
|
|
10417
10520
|
child.__render(maskCanvas, options);
|
|
10418
10521
|
}
|
|
10419
|
-
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
10420
10522
|
continue;
|
|
10421
10523
|
}
|
|
10422
10524
|
const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
|
|
@@ -11006,4 +11108,4 @@ Object.assign(Effect, EffectModule);
|
|
|
11006
11108
|
|
|
11007
11109
|
useCanvas();
|
|
11008
11110
|
|
|
11009
|
-
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, 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$
|
|
11111
|
+
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 };
|