@leafer-draw/worker 1.9.7 → 1.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.cjs +106 -79
- package/dist/worker.esm.js +108 -81
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +229 -167
- 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 +237 -167
- 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.js
CHANGED
|
@@ -229,17 +229,32 @@ var LeaferUI = function(exports) {
|
|
|
229
229
|
this.__input = this.__middle = null;
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
232
|
+
let tempA, tempB, tempTo;
|
|
233
|
+
const {max: max$4} = Math, tempFour = [ 0, 0, 0, 0 ];
|
|
234
|
+
const FourNumberHelper = {
|
|
235
|
+
zero: [ ...tempFour ],
|
|
236
|
+
tempFour: tempFour,
|
|
237
|
+
set(to, top, right, bottom, left) {
|
|
238
|
+
if (right === undefined) right = bottom = left = top;
|
|
239
|
+
to[0] = top;
|
|
240
|
+
to[1] = right;
|
|
241
|
+
to[2] = bottom;
|
|
242
|
+
to[3] = left;
|
|
243
|
+
return to;
|
|
244
|
+
},
|
|
245
|
+
setTemp(top, right, bottom, left) {
|
|
246
|
+
return set$1(tempFour, top, right, bottom, left);
|
|
247
|
+
},
|
|
248
|
+
toTempAB(a, b, change) {
|
|
249
|
+
tempTo = change ? isNumber(a) ? b : a : [];
|
|
250
|
+
if (isNumber(a)) tempA = setTemp(a), tempB = b; else if (isNumber(b)) tempA = a,
|
|
251
|
+
tempB = setTemp(b); else tempA = a, tempB = b;
|
|
252
|
+
if (tempA.length !== 4) tempA = get$5(tempA);
|
|
253
|
+
if (tempB.length !== 4) tempB = get$5(tempB);
|
|
239
254
|
},
|
|
240
|
-
|
|
255
|
+
get(num, maxValue) {
|
|
241
256
|
let data;
|
|
242
|
-
if (
|
|
257
|
+
if (!isNumber(num)) {
|
|
243
258
|
switch (num.length) {
|
|
244
259
|
case 4:
|
|
245
260
|
data = isUndefined(maxValue) ? num : [ ...num ];
|
|
@@ -262,9 +277,36 @@ var LeaferUI = function(exports) {
|
|
|
262
277
|
}
|
|
263
278
|
}
|
|
264
279
|
if (!data) data = [ num, num, num, num ];
|
|
265
|
-
if (maxValue) for (let i = 0; i < 4; i++) if (data[i] > maxValue) data[i] = maxValue;
|
|
280
|
+
if (!isUndefined(maxValue)) for (let i = 0; i < 4; i++) if (data[i] > maxValue) data[i] = maxValue;
|
|
266
281
|
return data;
|
|
267
282
|
},
|
|
283
|
+
max(t, other, change) {
|
|
284
|
+
if (isNumber(t) && isNumber(other)) return max$4(t, other);
|
|
285
|
+
toTempAB(t, other, change);
|
|
286
|
+
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]));
|
|
287
|
+
},
|
|
288
|
+
add(t, other, change) {
|
|
289
|
+
if (isNumber(t) && isNumber(other)) return t + other;
|
|
290
|
+
toTempAB(t, other, change);
|
|
291
|
+
return set$1(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
|
|
292
|
+
},
|
|
293
|
+
swapAndScale(t, scaleX, scaleY, change) {
|
|
294
|
+
if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
|
|
295
|
+
const to = change ? t : [];
|
|
296
|
+
const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
|
|
297
|
+
return set$1(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
const {set: set$1, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
301
|
+
const {round: round$3, pow: pow$1, PI: PI$3} = Math;
|
|
302
|
+
const MathHelper = {
|
|
303
|
+
within(value, min, max) {
|
|
304
|
+
if (isObject(min)) max = min.max, min = min.min;
|
|
305
|
+
if (!isUndefined(min) && value < min) value = min;
|
|
306
|
+
if (!isUndefined(max) && value > max) value = max;
|
|
307
|
+
return value;
|
|
308
|
+
},
|
|
309
|
+
fourNumber: FourNumberHelper.get,
|
|
268
310
|
formatRotation(rotation, unsign) {
|
|
269
311
|
rotation %= 360;
|
|
270
312
|
if (unsign) {
|
|
@@ -973,7 +1015,7 @@ var LeaferUI = function(exports) {
|
|
|
973
1015
|
MatrixHelper.reset(this);
|
|
974
1016
|
}
|
|
975
1017
|
}
|
|
976
|
-
const tempMatrix$
|
|
1018
|
+
const tempMatrix$2 = new Matrix;
|
|
977
1019
|
const TwoPointBoundsHelper = {
|
|
978
1020
|
tempPointBounds: {},
|
|
979
1021
|
setPoint(t, minX, minY) {
|
|
@@ -1103,9 +1145,9 @@ var LeaferUI = function(exports) {
|
|
|
1103
1145
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
1104
1146
|
const point = {};
|
|
1105
1147
|
const toPoint$4 = {};
|
|
1106
|
-
const tempBounds$
|
|
1148
|
+
const tempBounds$3 = {};
|
|
1107
1149
|
const BoundsHelper = {
|
|
1108
|
-
tempBounds: tempBounds$
|
|
1150
|
+
tempBounds: tempBounds$3,
|
|
1109
1151
|
set(t, x = 0, y = 0, width = 0, height = 0) {
|
|
1110
1152
|
t.x = x;
|
|
1111
1153
|
t.y = y;
|
|
@@ -1156,19 +1198,11 @@ var LeaferUI = function(exports) {
|
|
|
1156
1198
|
B.move(t, x, y);
|
|
1157
1199
|
return t;
|
|
1158
1200
|
},
|
|
1159
|
-
toOffsetOutBounds(t, to,
|
|
1160
|
-
if (!to)
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
}
|
|
1165
|
-
if (parent) {
|
|
1166
|
-
to.offsetX = -(B.maxX(parent) - t.x);
|
|
1167
|
-
to.offsetY = -(B.maxY(parent) - t.y);
|
|
1168
|
-
} else {
|
|
1169
|
-
to.offsetX = t.x + t.width;
|
|
1170
|
-
to.offsetY = t.y + t.height;
|
|
1171
|
-
}
|
|
1201
|
+
toOffsetOutBounds(t, to, offsetBounds) {
|
|
1202
|
+
if (!to) to = t; else copy$8(to, t);
|
|
1203
|
+
if (!offsetBounds) offsetBounds = t;
|
|
1204
|
+
to.offsetX = B.maxX(offsetBounds);
|
|
1205
|
+
to.offsetY = B.maxY(offsetBounds);
|
|
1172
1206
|
B.move(to, -to.offsetX, -to.offsetY);
|
|
1173
1207
|
},
|
|
1174
1208
|
scale(t, scaleX, scaleY = scaleX, onlySize) {
|
|
@@ -1182,9 +1216,9 @@ var LeaferUI = function(exports) {
|
|
|
1182
1216
|
t.height *= scaleY;
|
|
1183
1217
|
},
|
|
1184
1218
|
tempToOuterOf(t, matrix) {
|
|
1185
|
-
B.copy(tempBounds$
|
|
1186
|
-
B.toOuterOf(tempBounds$
|
|
1187
|
-
return tempBounds$
|
|
1219
|
+
B.copy(tempBounds$3, t);
|
|
1220
|
+
B.toOuterOf(tempBounds$3, matrix);
|
|
1221
|
+
return tempBounds$3;
|
|
1188
1222
|
},
|
|
1189
1223
|
getOuterOf(t, matrix) {
|
|
1190
1224
|
t = Object.assign({}, t);
|
|
@@ -1242,9 +1276,9 @@ var LeaferUI = function(exports) {
|
|
|
1242
1276
|
put(t, put, align = "center", putScale = 1, changeSize = true, to) {
|
|
1243
1277
|
to || (to = put);
|
|
1244
1278
|
if (isString(putScale)) putScale = B.getFitScale(t, put, putScale === "cover");
|
|
1245
|
-
tempBounds$
|
|
1246
|
-
tempBounds$
|
|
1247
|
-
AlignHelper.toPoint(align, tempBounds$
|
|
1279
|
+
tempBounds$3.width = changeSize ? put.width *= putScale : put.width * putScale;
|
|
1280
|
+
tempBounds$3.height = changeSize ? put.height *= putScale : put.height * putScale;
|
|
1281
|
+
AlignHelper.toPoint(align, tempBounds$3, t, to, true, true);
|
|
1248
1282
|
},
|
|
1249
1283
|
getSpread(t, spread, side) {
|
|
1250
1284
|
const n = {};
|
|
@@ -1314,7 +1348,7 @@ var LeaferUI = function(exports) {
|
|
|
1314
1348
|
first = false;
|
|
1315
1349
|
if (!addMode) copy$8(t, bounds);
|
|
1316
1350
|
} else {
|
|
1317
|
-
add$
|
|
1351
|
+
add$2(t, bounds);
|
|
1318
1352
|
}
|
|
1319
1353
|
}
|
|
1320
1354
|
}
|
|
@@ -1328,7 +1362,7 @@ var LeaferUI = function(exports) {
|
|
|
1328
1362
|
B.set(t, point.x, point.y);
|
|
1329
1363
|
},
|
|
1330
1364
|
addPoint(t, point) {
|
|
1331
|
-
add$
|
|
1365
|
+
add$2(t, point, true);
|
|
1332
1366
|
},
|
|
1333
1367
|
getPoints(t) {
|
|
1334
1368
|
const {x: x, y: y, width: width, height: height} = t;
|
|
@@ -1397,7 +1431,7 @@ var LeaferUI = function(exports) {
|
|
|
1397
1431
|
}
|
|
1398
1432
|
};
|
|
1399
1433
|
const B = BoundsHelper;
|
|
1400
|
-
const {add: add$
|
|
1434
|
+
const {add: add$2, copy: copy$8} = B;
|
|
1401
1435
|
class Bounds {
|
|
1402
1436
|
get minX() {
|
|
1403
1437
|
return BoundsHelper.minX(this);
|
|
@@ -1540,7 +1574,7 @@ var LeaferUI = function(exports) {
|
|
|
1540
1574
|
BoundsHelper.reset(this);
|
|
1541
1575
|
}
|
|
1542
1576
|
}
|
|
1543
|
-
const tempBounds$
|
|
1577
|
+
const tempBounds$2 = new Bounds;
|
|
1544
1578
|
class AutoBounds {
|
|
1545
1579
|
constructor(top, right, bottom, left, width, height) {
|
|
1546
1580
|
isObject(top) ? this.copy(top) : this.set(top, right, bottom, left, width, height);
|
|
@@ -2103,7 +2137,7 @@ var LeaferUI = function(exports) {
|
|
|
2103
2137
|
const {pixelRatio: pixelRatio, pixelSnap: pixelSnap} = this, w = this.worldTransform;
|
|
2104
2138
|
if (parentMatrix) multiplyParent$4(matrix, parentMatrix, w);
|
|
2105
2139
|
pixelScale(matrix, pixelRatio, w);
|
|
2106
|
-
if (pixelSnap) {
|
|
2140
|
+
if (pixelSnap && !matrix.ignorePixelSnap) {
|
|
2107
2141
|
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),
|
|
2108
2142
|
w.f = round$1(w.f);
|
|
2109
2143
|
}
|
|
@@ -3753,7 +3787,7 @@ var LeaferUI = function(exports) {
|
|
|
3753
3787
|
};
|
|
3754
3788
|
const I = ImageManager;
|
|
3755
3789
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
3756
|
-
const {floor: floor$1, max: max$
|
|
3790
|
+
const {floor: floor$1, max: max$3} = Math;
|
|
3757
3791
|
class LeaferImage {
|
|
3758
3792
|
get url() {
|
|
3759
3793
|
return this.config.url;
|
|
@@ -3841,7 +3875,7 @@ var LeaferUI = function(exports) {
|
|
|
3841
3875
|
}
|
|
3842
3876
|
if (data) return data;
|
|
3843
3877
|
}
|
|
3844
|
-
const canvas = Platform.origin.createCanvas(max$
|
|
3878
|
+
const canvas = Platform.origin.createCanvas(max$3(floor$1(width + (xGap || 0)), 1), max$3(floor$1(height + (yGap || 0)), 1));
|
|
3845
3879
|
const ctx = canvas.getContext("2d");
|
|
3846
3880
|
if (opacity) ctx.globalAlpha = opacity;
|
|
3847
3881
|
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
@@ -4573,7 +4607,7 @@ var LeaferUI = function(exports) {
|
|
|
4573
4607
|
}
|
|
4574
4608
|
};
|
|
4575
4609
|
const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2} = LeafHelper;
|
|
4576
|
-
const {toOuterOf: toOuterOf$
|
|
4610
|
+
const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$4} = BoundsHelper;
|
|
4577
4611
|
const localContent = "_localContentBounds";
|
|
4578
4612
|
const worldContent = "_worldContentBounds", worldBox = "_worldBoxBounds", worldStroke = "_worldStrokeBounds";
|
|
4579
4613
|
class LeafLayout {
|
|
@@ -4593,7 +4627,7 @@ var LeaferUI = function(exports) {
|
|
|
4593
4627
|
this._renderBounds = bounds;
|
|
4594
4628
|
}
|
|
4595
4629
|
get localContentBounds() {
|
|
4596
|
-
toOuterOf$
|
|
4630
|
+
toOuterOf$3(this.contentBounds, this.leaf.__localMatrix, this[localContent] || (this[localContent] = {}));
|
|
4597
4631
|
return this[localContent];
|
|
4598
4632
|
}
|
|
4599
4633
|
get localStrokeBounds() {
|
|
@@ -4603,15 +4637,15 @@ var LeaferUI = function(exports) {
|
|
|
4603
4637
|
return this._localRenderBounds || this;
|
|
4604
4638
|
}
|
|
4605
4639
|
get worldContentBounds() {
|
|
4606
|
-
toOuterOf$
|
|
4640
|
+
toOuterOf$3(this.contentBounds, this.leaf.__world, this[worldContent] || (this[worldContent] = {}));
|
|
4607
4641
|
return this[worldContent];
|
|
4608
4642
|
}
|
|
4609
4643
|
get worldBoxBounds() {
|
|
4610
|
-
toOuterOf$
|
|
4644
|
+
toOuterOf$3(this.boxBounds, this.leaf.__world, this[worldBox] || (this[worldBox] = {}));
|
|
4611
4645
|
return this[worldBox];
|
|
4612
4646
|
}
|
|
4613
4647
|
get worldStrokeBounds() {
|
|
4614
|
-
toOuterOf$
|
|
4648
|
+
toOuterOf$3(this.strokeBounds, this.leaf.__world, this[worldStroke] || (this[worldStroke] = {}));
|
|
4615
4649
|
return this[worldStroke];
|
|
4616
4650
|
}
|
|
4617
4651
|
get a() {
|
|
@@ -5382,12 +5416,12 @@ var LeaferUI = function(exports) {
|
|
|
5382
5416
|
};
|
|
5383
5417
|
const {updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2} = LeafHelper;
|
|
5384
5418
|
const {updateBounds: updateBounds$1} = BranchHelper;
|
|
5385
|
-
const {toOuterOf: toOuterOf$
|
|
5419
|
+
const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$2, copy: copy$3} = BoundsHelper;
|
|
5386
5420
|
const {toBounds: toBounds} = PathBounds;
|
|
5387
5421
|
const LeafBounds = {
|
|
5388
5422
|
__updateWorldBounds() {
|
|
5389
5423
|
const layout = this.__layout;
|
|
5390
|
-
toOuterOf$
|
|
5424
|
+
toOuterOf$2(layout.renderBounds, this.__world, this.__world);
|
|
5391
5425
|
if (layout.resized) {
|
|
5392
5426
|
if (layout.resized === "inner") this.__onUpdateSize();
|
|
5393
5427
|
if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
|
|
@@ -5443,13 +5477,13 @@ var LeaferUI = function(exports) {
|
|
|
5443
5477
|
__updateLocalBoxBounds() {
|
|
5444
5478
|
if (this.__hasMotionPath) this.__updateMotionPath();
|
|
5445
5479
|
if (this.__hasAutoLayout) this.__updateAutoLayout();
|
|
5446
|
-
toOuterOf$
|
|
5480
|
+
toOuterOf$2(this.__layout.boxBounds, this.__local, this.__local);
|
|
5447
5481
|
},
|
|
5448
5482
|
__updateLocalStrokeBounds() {
|
|
5449
|
-
toOuterOf$
|
|
5483
|
+
toOuterOf$2(this.__layout.strokeBounds, this.__localMatrix, this.__layout.localStrokeBounds);
|
|
5450
5484
|
},
|
|
5451
5485
|
__updateLocalRenderBounds() {
|
|
5452
|
-
toOuterOf$
|
|
5486
|
+
toOuterOf$2(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
|
|
5453
5487
|
},
|
|
5454
5488
|
__updateBoxBounds(_secondLayout, _bounds) {
|
|
5455
5489
|
const b = this.__layout.boxBounds;
|
|
@@ -5487,11 +5521,11 @@ var LeaferUI = function(exports) {
|
|
|
5487
5521
|
},
|
|
5488
5522
|
__updateStrokeBounds(_bounds) {
|
|
5489
5523
|
const layout = this.__layout;
|
|
5490
|
-
copyAndSpread$
|
|
5524
|
+
copyAndSpread$2(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
5491
5525
|
},
|
|
5492
5526
|
__updateRenderBounds(_bounds) {
|
|
5493
|
-
const layout = this.__layout;
|
|
5494
|
-
|
|
5527
|
+
const layout = this.__layout, {renderSpread: renderSpread} = layout;
|
|
5528
|
+
isNumber(renderSpread) && renderSpread <= 0 ? copy$3(layout.renderBounds, layout.strokeBounds) : copyAndSpread$2(layout.renderBounds, layout.boxBounds, renderSpread);
|
|
5495
5529
|
}
|
|
5496
5530
|
};
|
|
5497
5531
|
const LeafRender = {
|
|
@@ -5583,9 +5617,10 @@ var LeaferUI = function(exports) {
|
|
|
5583
5617
|
};
|
|
5584
5618
|
const tempScaleData$1 = {};
|
|
5585
5619
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
5620
|
+
const {stintSet: stintSet$3} = DataHelper;
|
|
5586
5621
|
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
5587
|
-
const {toOuterOf: toOuterOf} = BoundsHelper;
|
|
5588
|
-
const {copy: copy$2, move: move} = PointHelper;
|
|
5622
|
+
const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
5623
|
+
const {copy: copy$2, move: move$2} = PointHelper;
|
|
5589
5624
|
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;
|
|
5590
5625
|
exports.Leaf = class Leaf {
|
|
5591
5626
|
get tag() {
|
|
@@ -5859,8 +5894,9 @@ var LeaferUI = function(exports) {
|
|
|
5859
5894
|
if (!this.__cameraWorld) this.__cameraWorld = {};
|
|
5860
5895
|
const cameraWorld = this.__cameraWorld, world = this.__world;
|
|
5861
5896
|
multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
|
|
5862
|
-
toOuterOf(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
5863
|
-
cameraWorld
|
|
5897
|
+
toOuterOf$1(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
5898
|
+
stintSet$3(cameraWorld, "half", world.half);
|
|
5899
|
+
stintSet$3(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
|
|
5864
5900
|
return cameraWorld;
|
|
5865
5901
|
} else {
|
|
5866
5902
|
return this.__world;
|
|
@@ -5894,7 +5930,7 @@ var LeaferUI = function(exports) {
|
|
|
5894
5930
|
getWorldBounds(inner, relative, change) {
|
|
5895
5931
|
const matrix = relative ? getRelativeWorld(this, relative) : this.worldTransform;
|
|
5896
5932
|
const to = change ? inner : {};
|
|
5897
|
-
toOuterOf(inner, matrix, to);
|
|
5933
|
+
toOuterOf$1(inner, matrix, to);
|
|
5898
5934
|
return to;
|
|
5899
5935
|
}
|
|
5900
5936
|
worldToLocal(world, to, distance, relative) {
|
|
@@ -5927,7 +5963,7 @@ var LeaferUI = function(exports) {
|
|
|
5927
5963
|
}
|
|
5928
5964
|
getBoxPointByInner(inner, _relative, _distance, change) {
|
|
5929
5965
|
const point = change ? inner : Object.assign({}, inner), {x: x, y: y} = this.boxBounds;
|
|
5930
|
-
move(point, -x, -y);
|
|
5966
|
+
move$2(point, -x, -y);
|
|
5931
5967
|
return point;
|
|
5932
5968
|
}
|
|
5933
5969
|
getInnerPoint(world, relative, distance, change) {
|
|
@@ -5937,7 +5973,7 @@ var LeaferUI = function(exports) {
|
|
|
5937
5973
|
}
|
|
5938
5974
|
getInnerPointByBox(box, _relative, _distance, change) {
|
|
5939
5975
|
const point = change ? box : Object.assign({}, box), {x: x, y: y} = this.boxBounds;
|
|
5940
|
-
move(point, x, y);
|
|
5976
|
+
move$2(point, x, y);
|
|
5941
5977
|
return point;
|
|
5942
5978
|
}
|
|
5943
5979
|
getInnerPointByLocal(local, _relative, distance, change) {
|
|
@@ -6373,7 +6409,7 @@ var LeaferUI = function(exports) {
|
|
|
6373
6409
|
this.levelMap = null;
|
|
6374
6410
|
}
|
|
6375
6411
|
}
|
|
6376
|
-
const version = "1.9.
|
|
6412
|
+
const version = "1.9.8";
|
|
6377
6413
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6378
6414
|
get allowBackgroundColor() {
|
|
6379
6415
|
return true;
|
|
@@ -6771,6 +6807,7 @@ var LeaferUI = function(exports) {
|
|
|
6771
6807
|
usePartRender: true,
|
|
6772
6808
|
maxFPS: 120
|
|
6773
6809
|
};
|
|
6810
|
+
this.frames = [];
|
|
6774
6811
|
this.target = target;
|
|
6775
6812
|
this.canvas = canvas;
|
|
6776
6813
|
if (userConfig) this.config = DataHelper.default(userConfig, this.config);
|
|
@@ -6923,12 +6960,15 @@ var LeaferUI = function(exports) {
|
|
|
6923
6960
|
const target = this.target;
|
|
6924
6961
|
if (this.requestTime || !target) return;
|
|
6925
6962
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
6926
|
-
|
|
6963
|
+
this.requestTime = this.frameTime || Date.now();
|
|
6927
6964
|
const render = () => {
|
|
6928
|
-
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
6965
|
+
const nowFPS = 1e3 / ((this.frameTime = Date.now()) - this.requestTime);
|
|
6929
6966
|
const {maxFPS: maxFPS} = this.config;
|
|
6930
|
-
if (maxFPS && nowFPS > maxFPS
|
|
6931
|
-
|
|
6967
|
+
if (maxFPS && nowFPS > maxFPS) return Platform.requestRender(render);
|
|
6968
|
+
const {frames: frames} = this;
|
|
6969
|
+
if (frames.length > 30) frames.shift();
|
|
6970
|
+
frames.push(nowFPS);
|
|
6971
|
+
this.FPS = Math.round(frames.reduce((a, b) => a + b, 0) / frames.length);
|
|
6932
6972
|
this.requestTime = 0;
|
|
6933
6973
|
this.checkRender();
|
|
6934
6974
|
};
|
|
@@ -7358,39 +7398,40 @@ var LeaferUI = function(exports) {
|
|
|
7358
7398
|
return data;
|
|
7359
7399
|
}
|
|
7360
7400
|
}
|
|
7401
|
+
const {max: max$2, add: add$1} = FourNumberHelper;
|
|
7361
7402
|
const UIBounds = {
|
|
7362
7403
|
__updateStrokeSpread() {
|
|
7363
|
-
let
|
|
7404
|
+
let spread = 0, boxSpread = 0;
|
|
7364
7405
|
const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
|
|
7365
7406
|
if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
|
|
7366
|
-
|
|
7407
|
+
boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
|
|
7367
7408
|
if (!data.__boxStroke) {
|
|
7368
|
-
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 *
|
|
7409
|
+
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
|
|
7369
7410
|
const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
|
|
7370
|
-
|
|
7411
|
+
spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
7371
7412
|
}
|
|
7372
7413
|
}
|
|
7373
|
-
if (data.__useArrow)
|
|
7414
|
+
if (data.__useArrow) spread += strokeWidth * 5;
|
|
7374
7415
|
if (box) {
|
|
7375
|
-
|
|
7376
|
-
|
|
7416
|
+
spread = max$2(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
|
|
7417
|
+
boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
|
|
7377
7418
|
}
|
|
7378
|
-
this.__layout.strokeBoxSpread =
|
|
7379
|
-
return
|
|
7419
|
+
this.__layout.strokeBoxSpread = boxSpread;
|
|
7420
|
+
return spread;
|
|
7380
7421
|
},
|
|
7381
7422
|
__updateRenderSpread() {
|
|
7382
|
-
let
|
|
7383
|
-
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
|
|
7384
|
-
if (shadow)
|
|
7385
|
-
if (blur)
|
|
7386
|
-
if (filter)
|
|
7387
|
-
if (renderSpread)
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
if (
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
return
|
|
7423
|
+
let spread = 0;
|
|
7424
|
+
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
|
|
7425
|
+
if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
|
|
7426
|
+
if (blur) spread = max$2(spread, blur);
|
|
7427
|
+
if (filter) spread = add$1(spread, Filter.getSpread(filter));
|
|
7428
|
+
if (renderSpread) spread = add$1(spread, renderSpread);
|
|
7429
|
+
if (strokeSpread) spread = add$1(spread, strokeSpread);
|
|
7430
|
+
let shapeSpread = spread;
|
|
7431
|
+
if (innerShadow) shapeSpread = max$2(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
|
|
7432
|
+
if (backgroundBlur) shapeSpread = max$2(shapeSpread, backgroundBlur);
|
|
7433
|
+
this.__layout.renderShapeSpread = shapeSpread;
|
|
7434
|
+
return box ? max$2(box.__updateRenderSpread(), spread) : spread;
|
|
7394
7435
|
}
|
|
7395
7436
|
};
|
|
7396
7437
|
const {float: float} = MathHelper;
|
|
@@ -8532,7 +8573,7 @@ var LeaferUI = function(exports) {
|
|
|
8532
8573
|
__decorate([ dataType(false) ], exports.Canvas.prototype, "safeResize", void 0);
|
|
8533
8574
|
__decorate([ resizeType() ], exports.Canvas.prototype, "contextSettings", void 0);
|
|
8534
8575
|
exports.Canvas = __decorate([ registerUI() ], exports.Canvas);
|
|
8535
|
-
const {copyAndSpread: copyAndSpread, includes: includes, spread: spread, setList: setList} = BoundsHelper;
|
|
8576
|
+
const {copyAndSpread: copyAndSpread$1, includes: includes, spread: spread, setList: setList} = BoundsHelper;
|
|
8536
8577
|
exports.Text = class Text extends exports.UI {
|
|
8537
8578
|
get __tag() {
|
|
8538
8579
|
return "Text";
|
|
@@ -8578,13 +8619,13 @@ var LeaferUI = function(exports) {
|
|
|
8578
8619
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
8579
8620
|
}
|
|
8580
8621
|
__updateRenderSpread() {
|
|
8581
|
-
let
|
|
8582
|
-
if (!
|
|
8583
|
-
return
|
|
8622
|
+
let spread = super.__updateRenderSpread();
|
|
8623
|
+
if (!spread) spread = this.isOverflow ? 1 : 0;
|
|
8624
|
+
return spread;
|
|
8584
8625
|
}
|
|
8585
8626
|
__updateRenderBounds() {
|
|
8586
8627
|
const {renderBounds: renderBounds, renderSpread: renderSpread} = this.__layout;
|
|
8587
|
-
copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
8628
|
+
copyAndSpread$1(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
8588
8629
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
8589
8630
|
}
|
|
8590
8631
|
__updateChange() {
|
|
@@ -8900,23 +8941,27 @@ var LeaferUI = function(exports) {
|
|
|
8900
8941
|
out.recycle(ui.__nowWorld);
|
|
8901
8942
|
}
|
|
8902
8943
|
}
|
|
8903
|
-
const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIntersectData: getIntersectData} = BoundsHelper;
|
|
8944
|
+
const {getSpread: getSpread, copyAndSpread: copyAndSpread, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$1, getIntersectData: getIntersectData} = BoundsHelper;
|
|
8945
|
+
const tempBounds$1 = {};
|
|
8904
8946
|
function shape(ui, current, options) {
|
|
8905
8947
|
const canvas = current.getSameCanvas();
|
|
8906
|
-
const nowWorld = ui.__nowWorld,
|
|
8907
|
-
|
|
8948
|
+
const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
|
|
8949
|
+
const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
|
|
8950
|
+
toOuterOf(layout.strokeSpread ? (copyAndSpread(tempBounds$1, layout.boxBounds, layout.strokeSpread),
|
|
8951
|
+
tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
|
|
8952
|
+
let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
8908
8953
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
8909
|
-
if (currentBounds.includes(
|
|
8954
|
+
if (currentBounds.includes(nowWorldShapeBounds)) {
|
|
8910
8955
|
worldCanvas = canvas;
|
|
8911
|
-
bounds = shapeBounds =
|
|
8956
|
+
bounds = shapeBounds = nowWorldShapeBounds;
|
|
8957
|
+
renderBounds = nowWorld;
|
|
8912
8958
|
} else {
|
|
8913
|
-
const {renderShapeSpread: spread} = ui.__layout;
|
|
8914
8959
|
let worldClipBounds;
|
|
8915
8960
|
if (Platform.fullImageShadow) {
|
|
8916
|
-
worldClipBounds =
|
|
8961
|
+
worldClipBounds = nowWorldShapeBounds;
|
|
8917
8962
|
} else {
|
|
8918
|
-
const spreadBounds =
|
|
8919
|
-
worldClipBounds = getIntersectData(spreadBounds,
|
|
8963
|
+
const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
|
|
8964
|
+
worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
|
|
8920
8965
|
}
|
|
8921
8966
|
fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
|
|
8922
8967
|
let {a: fitScaleX, d: fitScaleY} = fitMatrix;
|
|
@@ -8926,8 +8971,10 @@ var LeaferUI = function(exports) {
|
|
|
8926
8971
|
scaleX *= fitScaleX;
|
|
8927
8972
|
scaleY *= fitScaleY;
|
|
8928
8973
|
}
|
|
8929
|
-
shapeBounds = getOuterOf(
|
|
8974
|
+
shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
|
|
8930
8975
|
bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
|
|
8976
|
+
renderBounds = getOuterOf(nowWorld, fitMatrix);
|
|
8977
|
+
move$1(renderBounds, -fitMatrix.e, -fitMatrix.f);
|
|
8931
8978
|
const userMatrix = options.matrix;
|
|
8932
8979
|
if (userMatrix) {
|
|
8933
8980
|
matrix = new Matrix(fitMatrix);
|
|
@@ -8946,6 +8993,7 @@ var LeaferUI = function(exports) {
|
|
|
8946
8993
|
matrix: matrix,
|
|
8947
8994
|
fitMatrix: fitMatrix,
|
|
8948
8995
|
bounds: bounds,
|
|
8996
|
+
renderBounds: renderBounds,
|
|
8949
8997
|
worldCanvas: worldCanvas,
|
|
8950
8998
|
shapeBounds: shapeBounds,
|
|
8951
8999
|
scaleX: scaleX,
|
|
@@ -9043,7 +9091,7 @@ var LeaferUI = function(exports) {
|
|
|
9043
9091
|
drawTextStroke: drawTextStroke,
|
|
9044
9092
|
shape: shape
|
|
9045
9093
|
};
|
|
9046
|
-
let origin = {}, tempMatrix = getMatrixData();
|
|
9094
|
+
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
9047
9095
|
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
9048
9096
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
9049
9097
|
const transform = get$3();
|
|
@@ -9055,12 +9103,12 @@ var LeaferUI = function(exports) {
|
|
|
9055
9103
|
}, rotation);
|
|
9056
9104
|
data.transform = transform;
|
|
9057
9105
|
}
|
|
9058
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew,
|
|
9106
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
9059
9107
|
const transform = get$3();
|
|
9060
9108
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
9061
|
-
if (
|
|
9062
|
-
tempMatrix.a =
|
|
9063
|
-
multiplyParent(transform, tempMatrix);
|
|
9109
|
+
if (clipScaleX) {
|
|
9110
|
+
tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
|
|
9111
|
+
multiplyParent(transform, tempMatrix$1);
|
|
9064
9112
|
}
|
|
9065
9113
|
data.transform = transform;
|
|
9066
9114
|
}
|
|
@@ -9153,7 +9201,12 @@ var LeaferUI = function(exports) {
|
|
|
9153
9201
|
|
|
9154
9202
|
case "normal":
|
|
9155
9203
|
case "clip":
|
|
9156
|
-
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
9204
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
|
|
9205
|
+
let clipScaleX, clipScaleY;
|
|
9206
|
+
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
9207
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
9208
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
9209
|
+
}
|
|
9157
9210
|
break;
|
|
9158
9211
|
|
|
9159
9212
|
case "repeat":
|
|
@@ -9298,7 +9351,7 @@ var LeaferUI = function(exports) {
|
|
|
9298
9351
|
if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
|
|
9299
9352
|
}
|
|
9300
9353
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
9301
|
-
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
9354
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
9302
9355
|
function createPattern(ui, paint, pixelRatio) {
|
|
9303
9356
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
9304
9357
|
const id = scaleX + "-" + scaleY + "-" + pixelRatio;
|
|
@@ -9346,8 +9399,8 @@ var LeaferUI = function(exports) {
|
|
|
9346
9399
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
9347
9400
|
const canvasWidth = width + (xGap || 0);
|
|
9348
9401
|
const canvasHeight = height + (yGap || 0);
|
|
9349
|
-
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
9350
|
-
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
9402
|
+
scaleX /= canvasWidth / max$1(floor(canvasWidth), 1);
|
|
9403
|
+
scaleY /= canvasHeight / max$1(floor(canvasHeight), 1);
|
|
9351
9404
|
if (!imageMatrix) {
|
|
9352
9405
|
imageMatrix = get$1();
|
|
9353
9406
|
if (transform) copy$1(imageMatrix, transform);
|
|
@@ -9372,17 +9425,15 @@ var LeaferUI = function(exports) {
|
|
|
9372
9425
|
if (allowDraw) {
|
|
9373
9426
|
if (data.repeat) {
|
|
9374
9427
|
allowDraw = false;
|
|
9375
|
-
} else {
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
height *= data.scaleY;
|
|
9383
|
-
}
|
|
9384
|
-
allowDraw = width * height > Platform.image.maxCacheSize;
|
|
9428
|
+
} else if (!(paint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || Export.running)) {
|
|
9429
|
+
let {width: width, height: height} = data;
|
|
9430
|
+
width *= scaleX * pixelRatio;
|
|
9431
|
+
height *= scaleY * pixelRatio;
|
|
9432
|
+
if (data.scaleX) {
|
|
9433
|
+
width *= data.scaleX;
|
|
9434
|
+
height *= data.scaleY;
|
|
9385
9435
|
}
|
|
9436
|
+
allowDraw = width * height > Platform.image.maxCacheSize;
|
|
9386
9437
|
}
|
|
9387
9438
|
}
|
|
9388
9439
|
if (allowDraw) {
|
|
@@ -9540,17 +9591,17 @@ var LeaferUI = function(exports) {
|
|
|
9540
9591
|
conicGradient: conicGradient,
|
|
9541
9592
|
getTransform: getTransform
|
|
9542
9593
|
};
|
|
9543
|
-
const {copy: copy, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper;
|
|
9544
|
-
const tempBounds = {};
|
|
9594
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
9595
|
+
const tempBounds = {}, tempMatrix = new Matrix;
|
|
9545
9596
|
const offsetOutBounds$1 = {};
|
|
9546
9597
|
function shadow(ui, current, shape) {
|
|
9547
|
-
let copyBounds,
|
|
9548
|
-
const {__nowWorld: nowWorld
|
|
9598
|
+
let copyBounds, transform;
|
|
9599
|
+
const {__nowWorld: nowWorld} = ui;
|
|
9549
9600
|
const {shadow: shadow} = ui.__;
|
|
9550
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
9601
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
9551
9602
|
const other = current.getSameCanvas();
|
|
9552
9603
|
const end = shadow.length - 1;
|
|
9553
|
-
toOffsetOutBounds$1(bounds, offsetOutBounds$1);
|
|
9604
|
+
toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
|
|
9554
9605
|
shadow.forEach((item, index) => {
|
|
9555
9606
|
let otherScale = 1;
|
|
9556
9607
|
if (item.scaleFixed) {
|
|
@@ -9558,63 +9609,69 @@ var LeaferUI = function(exports) {
|
|
|
9558
9609
|
if (sx > 1) otherScale = 1 / sx;
|
|
9559
9610
|
}
|
|
9560
9611
|
other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, ColorConvert.string(item.color));
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9612
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
9613
|
+
if (transform) other.setTransform(transform);
|
|
9614
|
+
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
9615
|
+
if (transform) other.resetTransform();
|
|
9616
|
+
copyBounds = renderBounds;
|
|
9564
9617
|
if (item.box) {
|
|
9565
9618
|
other.restore();
|
|
9566
9619
|
other.save();
|
|
9567
9620
|
if (worldCanvas) {
|
|
9568
|
-
other.copyWorld(other,
|
|
9621
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
9569
9622
|
copyBounds = nowWorld;
|
|
9570
9623
|
}
|
|
9571
9624
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
9572
9625
|
}
|
|
9573
|
-
|
|
9626
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
9574
9627
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
9575
9628
|
});
|
|
9576
9629
|
other.recycle(copyBounds);
|
|
9577
9630
|
}
|
|
9578
|
-
function
|
|
9579
|
-
let
|
|
9580
|
-
shadow.forEach(item =>
|
|
9581
|
-
|
|
9631
|
+
function getShadowRenderSpread(_ui, shadow) {
|
|
9632
|
+
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
9633
|
+
shadow.forEach(item => {
|
|
9634
|
+
x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
|
|
9635
|
+
top = max(top, spread + blur - y);
|
|
9636
|
+
right = max(right, spread + blur + x);
|
|
9637
|
+
bottom = max(bottom, spread + blur + y);
|
|
9638
|
+
left = max(left, spread + blur - x);
|
|
9639
|
+
});
|
|
9640
|
+
return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
|
|
9641
|
+
}
|
|
9642
|
+
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
9643
|
+
if (shadow.spread) {
|
|
9644
|
+
const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
|
|
9645
|
+
tempMatrix.set().scaleOfOuter({
|
|
9646
|
+
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
9647
|
+
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
9648
|
+
}, spreadScale);
|
|
9649
|
+
return tempMatrix;
|
|
9650
|
+
}
|
|
9651
|
+
return undefined;
|
|
9582
9652
|
}
|
|
9583
|
-
function drawWorldShadow(canvas, outBounds,
|
|
9584
|
-
const {
|
|
9653
|
+
function drawWorldShadow(canvas, outBounds, shape) {
|
|
9654
|
+
const {shapeBounds: shapeBounds} = shape;
|
|
9655
|
+
let from, to;
|
|
9585
9656
|
if (Platform.fullImageShadow) {
|
|
9586
9657
|
copy(tempBounds, canvas.bounds);
|
|
9587
|
-
tempBounds.x
|
|
9588
|
-
|
|
9589
|
-
if (spreadScale) {
|
|
9590
|
-
const {fitMatrix: fitMatrix} = shape;
|
|
9591
|
-
tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
|
|
9592
|
-
tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
|
|
9593
|
-
tempBounds.width *= spreadScale;
|
|
9594
|
-
tempBounds.height *= spreadScale;
|
|
9595
|
-
}
|
|
9596
|
-
canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
|
|
9658
|
+
move(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
9659
|
+
from = canvas.bounds, to = tempBounds;
|
|
9597
9660
|
} else {
|
|
9598
|
-
|
|
9599
|
-
copy(tempBounds, outBounds);
|
|
9600
|
-
tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
|
|
9601
|
-
tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
|
|
9602
|
-
tempBounds.width *= spreadScale;
|
|
9603
|
-
tempBounds.height *= spreadScale;
|
|
9604
|
-
}
|
|
9605
|
-
canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
|
|
9661
|
+
from = shapeBounds, to = outBounds;
|
|
9606
9662
|
}
|
|
9663
|
+
canvas.copyWorld(shape.canvas, from, to);
|
|
9607
9664
|
}
|
|
9608
9665
|
const {toOffsetOutBounds: toOffsetOutBounds} = BoundsHelper;
|
|
9609
9666
|
const offsetOutBounds = {};
|
|
9610
9667
|
function innerShadow(ui, current, shape) {
|
|
9611
|
-
let copyBounds,
|
|
9612
|
-
const {__nowWorld: nowWorld
|
|
9668
|
+
let copyBounds, transform;
|
|
9669
|
+
const {__nowWorld: nowWorld} = ui;
|
|
9613
9670
|
const {innerShadow: innerShadow} = ui.__;
|
|
9614
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
9671
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
9615
9672
|
const other = current.getSameCanvas();
|
|
9616
9673
|
const end = innerShadow.length - 1;
|
|
9617
|
-
toOffsetOutBounds(bounds, offsetOutBounds);
|
|
9674
|
+
toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
|
|
9618
9675
|
innerShadow.forEach((item, index) => {
|
|
9619
9676
|
let otherScale = 1;
|
|
9620
9677
|
if (item.scaleFixed) {
|
|
@@ -9623,16 +9680,17 @@ var LeaferUI = function(exports) {
|
|
|
9623
9680
|
}
|
|
9624
9681
|
other.save();
|
|
9625
9682
|
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
9626
|
-
|
|
9627
|
-
|
|
9683
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
9684
|
+
if (transform) other.setTransform(transform);
|
|
9685
|
+
drawWorldShadow(other, offsetOutBounds, shape);
|
|
9628
9686
|
other.restore();
|
|
9629
9687
|
if (worldCanvas) {
|
|
9630
|
-
other.copyWorld(other,
|
|
9688
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
9631
9689
|
other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
|
|
9632
9690
|
copyBounds = nowWorld;
|
|
9633
9691
|
} else {
|
|
9634
9692
|
other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
|
|
9635
|
-
copyBounds =
|
|
9693
|
+
copyBounds = renderBounds;
|
|
9636
9694
|
}
|
|
9637
9695
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
|
|
9638
9696
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
@@ -9640,6 +9698,7 @@ var LeaferUI = function(exports) {
|
|
|
9640
9698
|
});
|
|
9641
9699
|
other.recycle(copyBounds);
|
|
9642
9700
|
}
|
|
9701
|
+
const getInnerShadowSpread = getShadowRenderSpread;
|
|
9643
9702
|
function blur(ui, current, origin) {
|
|
9644
9703
|
const {blur: blur} = ui.__;
|
|
9645
9704
|
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
@@ -9652,10 +9711,12 @@ var LeaferUI = function(exports) {
|
|
|
9652
9711
|
innerShadow: innerShadow,
|
|
9653
9712
|
blur: blur,
|
|
9654
9713
|
backgroundBlur: backgroundBlur,
|
|
9655
|
-
|
|
9714
|
+
getShadowRenderSpread: getShadowRenderSpread,
|
|
9715
|
+
getShadowTransform: getShadowTransform,
|
|
9656
9716
|
isTransformShadow(_shadow) {
|
|
9657
9717
|
return undefined;
|
|
9658
|
-
}
|
|
9718
|
+
},
|
|
9719
|
+
getInnerShadowSpread: getInnerShadowSpread
|
|
9659
9720
|
};
|
|
9660
9721
|
const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
|
|
9661
9722
|
let usedGrayscaleAlpha;
|
|
@@ -9669,6 +9730,7 @@ var LeaferUI = function(exports) {
|
|
|
9669
9730
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
|
|
9670
9731
|
maskCanvas = contentCanvas = null;
|
|
9671
9732
|
}
|
|
9733
|
+
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
9672
9734
|
maskOpacity = child.__.opacity;
|
|
9673
9735
|
usedGrayscaleAlpha = false;
|
|
9674
9736
|
if (mask === "path" || mask === "clipping-path") {
|
|
@@ -9686,7 +9748,6 @@ var LeaferUI = function(exports) {
|
|
|
9686
9748
|
if (!contentCanvas) contentCanvas = getCanvas(canvas);
|
|
9687
9749
|
child.__render(maskCanvas, options);
|
|
9688
9750
|
}
|
|
9689
|
-
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
9690
9751
|
continue;
|
|
9691
9752
|
}
|
|
9692
9753
|
const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
|
|
@@ -10239,6 +10300,7 @@ var LeaferUI = function(exports) {
|
|
|
10239
10300
|
exports.Export = Export;
|
|
10240
10301
|
exports.FileHelper = FileHelper;
|
|
10241
10302
|
exports.Filter = Filter;
|
|
10303
|
+
exports.FourNumberHelper = FourNumberHelper;
|
|
10242
10304
|
exports.FrameData = FrameData;
|
|
10243
10305
|
exports.GroupData = GroupData;
|
|
10244
10306
|
exports.ImageData = ImageData;
|
|
@@ -10377,8 +10439,8 @@ var LeaferUI = function(exports) {
|
|
|
10377
10439
|
exports.sortType = sortType;
|
|
10378
10440
|
exports.strokeType = strokeType;
|
|
10379
10441
|
exports.surfaceType = surfaceType;
|
|
10380
|
-
exports.tempBounds = tempBounds$
|
|
10381
|
-
exports.tempMatrix = tempMatrix$
|
|
10442
|
+
exports.tempBounds = tempBounds$2;
|
|
10443
|
+
exports.tempMatrix = tempMatrix$2;
|
|
10382
10444
|
exports.tempPoint = tempPoint$2;
|
|
10383
10445
|
exports.tryToNumber = tryToNumber;
|
|
10384
10446
|
exports.useCanvas = useCanvas;
|