leafer-ui 1.9.7 → 1.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -85
- package/dist/web.cjs +110 -82
- package/dist/web.esm.js +111 -83
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +240 -177
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +248 -177
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/web.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$9(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$9(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$9} = 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$1 = 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$5} = 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$4} = 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$4(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$3, move: move} = PointHelper;
|
|
5622
|
+
const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
5623
|
+
const {copy: copy$3, 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.9";
|
|
6377
6413
|
const debug$5 = Debug.get("LeaferCanvas");
|
|
6378
6414
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6379
6415
|
set zIndex(zIndex) {
|
|
@@ -6406,7 +6442,7 @@ var LeaferUI = function(exports) {
|
|
|
6406
6442
|
}
|
|
6407
6443
|
if (Platform.syncDomFont && !this.parentView) {
|
|
6408
6444
|
style.display = "none";
|
|
6409
|
-
document.body.appendChild(this.view);
|
|
6445
|
+
if (document.body) document.body.appendChild(this.view);
|
|
6410
6446
|
}
|
|
6411
6447
|
this.__createContext();
|
|
6412
6448
|
if (!this.autoLayout) this.resize(config);
|
|
@@ -6977,6 +7013,7 @@ var LeaferUI = function(exports) {
|
|
|
6977
7013
|
usePartRender: true,
|
|
6978
7014
|
maxFPS: 120
|
|
6979
7015
|
};
|
|
7016
|
+
this.frames = [];
|
|
6980
7017
|
this.target = target;
|
|
6981
7018
|
this.canvas = canvas;
|
|
6982
7019
|
if (userConfig) this.config = DataHelper.default(userConfig, this.config);
|
|
@@ -7129,12 +7166,15 @@ var LeaferUI = function(exports) {
|
|
|
7129
7166
|
const target = this.target;
|
|
7130
7167
|
if (this.requestTime || !target) return;
|
|
7131
7168
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
7132
|
-
|
|
7169
|
+
this.requestTime = this.frameTime || Date.now();
|
|
7133
7170
|
const render = () => {
|
|
7134
|
-
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
7171
|
+
const nowFPS = 1e3 / ((this.frameTime = Date.now()) - this.requestTime);
|
|
7135
7172
|
const {maxFPS: maxFPS} = this.config;
|
|
7136
|
-
if (maxFPS && nowFPS > maxFPS
|
|
7137
|
-
|
|
7173
|
+
if (maxFPS && nowFPS > maxFPS) return Platform.requestRender(render);
|
|
7174
|
+
const {frames: frames} = this;
|
|
7175
|
+
if (frames.length > 30) frames.shift();
|
|
7176
|
+
frames.push(nowFPS);
|
|
7177
|
+
this.FPS = Math.round(frames.reduce((a, b) => a + b, 0) / frames.length);
|
|
7138
7178
|
this.requestTime = 0;
|
|
7139
7179
|
this.checkRender();
|
|
7140
7180
|
};
|
|
@@ -7744,39 +7784,40 @@ var LeaferUI = function(exports) {
|
|
|
7744
7784
|
return data;
|
|
7745
7785
|
}
|
|
7746
7786
|
}
|
|
7787
|
+
const {max: max$2, add: add$1} = FourNumberHelper;
|
|
7747
7788
|
const UIBounds = {
|
|
7748
7789
|
__updateStrokeSpread() {
|
|
7749
|
-
let
|
|
7790
|
+
let spread = 0, boxSpread = 0;
|
|
7750
7791
|
const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
|
|
7751
7792
|
if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
|
|
7752
|
-
|
|
7793
|
+
boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
|
|
7753
7794
|
if (!data.__boxStroke) {
|
|
7754
|
-
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 *
|
|
7795
|
+
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
|
|
7755
7796
|
const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
|
|
7756
|
-
|
|
7797
|
+
spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
7757
7798
|
}
|
|
7758
7799
|
}
|
|
7759
|
-
if (data.__useArrow)
|
|
7800
|
+
if (data.__useArrow) spread += strokeWidth * 5;
|
|
7760
7801
|
if (box) {
|
|
7761
|
-
|
|
7762
|
-
|
|
7802
|
+
spread = max$2(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
|
|
7803
|
+
boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
|
|
7763
7804
|
}
|
|
7764
|
-
this.__layout.strokeBoxSpread =
|
|
7765
|
-
return
|
|
7805
|
+
this.__layout.strokeBoxSpread = boxSpread;
|
|
7806
|
+
return spread;
|
|
7766
7807
|
},
|
|
7767
7808
|
__updateRenderSpread() {
|
|
7768
|
-
let
|
|
7769
|
-
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
|
|
7770
|
-
if (shadow)
|
|
7771
|
-
if (blur)
|
|
7772
|
-
if (filter)
|
|
7773
|
-
if (renderSpread)
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
if (
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
return
|
|
7809
|
+
let spread = 0;
|
|
7810
|
+
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
|
|
7811
|
+
if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
|
|
7812
|
+
if (blur) spread = max$2(spread, blur);
|
|
7813
|
+
if (filter) spread = add$1(spread, Filter.getSpread(filter));
|
|
7814
|
+
if (renderSpread) spread = add$1(spread, renderSpread);
|
|
7815
|
+
if (strokeSpread) spread = add$1(spread, strokeSpread);
|
|
7816
|
+
let shapeSpread = spread;
|
|
7817
|
+
if (innerShadow) shapeSpread = max$2(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
|
|
7818
|
+
if (backgroundBlur) shapeSpread = max$2(shapeSpread, backgroundBlur);
|
|
7819
|
+
this.__layout.renderShapeSpread = shapeSpread;
|
|
7820
|
+
return box ? max$2(box.__updateRenderSpread(), spread) : spread;
|
|
7780
7821
|
}
|
|
7781
7822
|
};
|
|
7782
7823
|
const {float: float} = MathHelper;
|
|
@@ -8918,7 +8959,7 @@ var LeaferUI = function(exports) {
|
|
|
8918
8959
|
__decorate([ dataType(false) ], exports.Canvas.prototype, "safeResize", void 0);
|
|
8919
8960
|
__decorate([ resizeType() ], exports.Canvas.prototype, "contextSettings", void 0);
|
|
8920
8961
|
exports.Canvas = __decorate([ registerUI() ], exports.Canvas);
|
|
8921
|
-
const {copyAndSpread: copyAndSpread, includes: includes, spread: spread, setList: setList} = BoundsHelper;
|
|
8962
|
+
const {copyAndSpread: copyAndSpread$1, includes: includes, spread: spread, setList: setList} = BoundsHelper;
|
|
8922
8963
|
exports.Text = class Text extends exports.UI {
|
|
8923
8964
|
get __tag() {
|
|
8924
8965
|
return "Text";
|
|
@@ -8964,13 +9005,13 @@ var LeaferUI = function(exports) {
|
|
|
8964
9005
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
8965
9006
|
}
|
|
8966
9007
|
__updateRenderSpread() {
|
|
8967
|
-
let
|
|
8968
|
-
if (!
|
|
8969
|
-
return
|
|
9008
|
+
let spread = super.__updateRenderSpread();
|
|
9009
|
+
if (!spread) spread = this.isOverflow ? 1 : 0;
|
|
9010
|
+
return spread;
|
|
8970
9011
|
}
|
|
8971
9012
|
__updateRenderBounds() {
|
|
8972
9013
|
const {renderBounds: renderBounds, renderSpread: renderSpread} = this.__layout;
|
|
8973
|
-
copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
9014
|
+
copyAndSpread$1(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
8974
9015
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
8975
9016
|
}
|
|
8976
9017
|
__updateChange() {
|
|
@@ -9329,9 +9370,9 @@ var LeaferUI = function(exports) {
|
|
|
9329
9370
|
static setData(data) {
|
|
9330
9371
|
this.data = data;
|
|
9331
9372
|
}
|
|
9332
|
-
static getValidMove(leaf,
|
|
9333
|
-
const move = leaf.getLocalPoint(
|
|
9334
|
-
PointHelper.move(move,
|
|
9373
|
+
static getValidMove(leaf, localStart, worldTotal, checkLimit = true) {
|
|
9374
|
+
const move = leaf.getLocalPoint(worldTotal, null, true);
|
|
9375
|
+
PointHelper.move(move, localStart.x - leaf.x, localStart.y - leaf.y);
|
|
9335
9376
|
if (checkLimit) this.limitMove(leaf, move);
|
|
9336
9377
|
DragBoundsHelper.axisMove(leaf, move);
|
|
9337
9378
|
return move;
|
|
@@ -10285,8 +10326,8 @@ var LeaferUI = function(exports) {
|
|
|
10285
10326
|
if (isHitPixel) {
|
|
10286
10327
|
const {renderBounds: renderBounds} = this.__layout;
|
|
10287
10328
|
const size = Platform.image.hitCanvasSize;
|
|
10288
|
-
const scale = h.hitScale = tempBounds$
|
|
10289
|
-
const {x: x, y: y, width: width, height: height} = tempBounds$
|
|
10329
|
+
const scale = h.hitScale = tempBounds$2.set(0, 0, size, size).getFitMatrix(renderBounds).a;
|
|
10330
|
+
const {x: x, y: y, width: width, height: height} = tempBounds$2.set(renderBounds).scale(scale);
|
|
10290
10331
|
h.resize({
|
|
10291
10332
|
width: width,
|
|
10292
10333
|
height: height,
|
|
@@ -10373,8 +10414,8 @@ var LeaferUI = function(exports) {
|
|
|
10373
10414
|
canvas.hitPixel = function(radiusPoint, offset, scale = 1) {
|
|
10374
10415
|
let {x: x, y: y, radiusX: radiusX, radiusY: radiusY} = radiusPoint;
|
|
10375
10416
|
if (offset) x -= offset.x, y -= offset.y;
|
|
10376
|
-
tempBounds$
|
|
10377
|
-
const {data: data} = this.context.getImageData(tempBounds$
|
|
10417
|
+
tempBounds$2.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
|
|
10418
|
+
const {data: data} = this.context.getImageData(tempBounds$2.x, tempBounds$2.y, tempBounds$2.width || 1, tempBounds$2.height || 1);
|
|
10378
10419
|
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
10379
10420
|
if (data[i + 3] > 0) return true;
|
|
10380
10421
|
}
|
|
@@ -10883,23 +10924,27 @@ var LeaferUI = function(exports) {
|
|
|
10883
10924
|
out.recycle(ui.__nowWorld);
|
|
10884
10925
|
}
|
|
10885
10926
|
}
|
|
10886
|
-
const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIntersectData: getIntersectData} = BoundsHelper;
|
|
10927
|
+
const {getSpread: getSpread, copyAndSpread: copyAndSpread, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$1, getIntersectData: getIntersectData} = BoundsHelper;
|
|
10928
|
+
const tempBounds$1 = {};
|
|
10887
10929
|
function shape(ui, current, options) {
|
|
10888
10930
|
const canvas = current.getSameCanvas();
|
|
10889
|
-
const nowWorld = ui.__nowWorld,
|
|
10890
|
-
|
|
10931
|
+
const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
|
|
10932
|
+
const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
|
|
10933
|
+
toOuterOf(layout.strokeSpread ? (copyAndSpread(tempBounds$1, layout.boxBounds, layout.strokeSpread),
|
|
10934
|
+
tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
|
|
10935
|
+
let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
10891
10936
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
10892
|
-
if (currentBounds.includes(
|
|
10937
|
+
if (currentBounds.includes(nowWorldShapeBounds)) {
|
|
10893
10938
|
worldCanvas = canvas;
|
|
10894
|
-
bounds = shapeBounds =
|
|
10939
|
+
bounds = shapeBounds = nowWorldShapeBounds;
|
|
10940
|
+
renderBounds = nowWorld;
|
|
10895
10941
|
} else {
|
|
10896
|
-
const {renderShapeSpread: spread} = ui.__layout;
|
|
10897
10942
|
let worldClipBounds;
|
|
10898
10943
|
if (Platform.fullImageShadow) {
|
|
10899
|
-
worldClipBounds =
|
|
10944
|
+
worldClipBounds = nowWorldShapeBounds;
|
|
10900
10945
|
} else {
|
|
10901
|
-
const spreadBounds =
|
|
10902
|
-
worldClipBounds = getIntersectData(spreadBounds,
|
|
10946
|
+
const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
|
|
10947
|
+
worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
|
|
10903
10948
|
}
|
|
10904
10949
|
fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
|
|
10905
10950
|
let {a: fitScaleX, d: fitScaleY} = fitMatrix;
|
|
@@ -10909,8 +10954,10 @@ var LeaferUI = function(exports) {
|
|
|
10909
10954
|
scaleX *= fitScaleX;
|
|
10910
10955
|
scaleY *= fitScaleY;
|
|
10911
10956
|
}
|
|
10912
|
-
shapeBounds = getOuterOf(
|
|
10957
|
+
shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
|
|
10913
10958
|
bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
|
|
10959
|
+
renderBounds = getOuterOf(nowWorld, fitMatrix);
|
|
10960
|
+
move$1(renderBounds, -fitMatrix.e, -fitMatrix.f);
|
|
10914
10961
|
const userMatrix = options.matrix;
|
|
10915
10962
|
if (userMatrix) {
|
|
10916
10963
|
matrix = new Matrix(fitMatrix);
|
|
@@ -10929,6 +10976,7 @@ var LeaferUI = function(exports) {
|
|
|
10929
10976
|
matrix: matrix,
|
|
10930
10977
|
fitMatrix: fitMatrix,
|
|
10931
10978
|
bounds: bounds,
|
|
10979
|
+
renderBounds: renderBounds,
|
|
10932
10980
|
worldCanvas: worldCanvas,
|
|
10933
10981
|
shapeBounds: shapeBounds,
|
|
10934
10982
|
scaleX: scaleX,
|
|
@@ -11026,7 +11074,7 @@ var LeaferUI = function(exports) {
|
|
|
11026
11074
|
drawTextStroke: drawTextStroke,
|
|
11027
11075
|
shape: shape
|
|
11028
11076
|
};
|
|
11029
|
-
let origin = {}, tempMatrix = getMatrixData();
|
|
11077
|
+
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
11030
11078
|
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
11031
11079
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
11032
11080
|
const transform = get$3();
|
|
@@ -11038,12 +11086,12 @@ var LeaferUI = function(exports) {
|
|
|
11038
11086
|
}, rotation);
|
|
11039
11087
|
data.transform = transform;
|
|
11040
11088
|
}
|
|
11041
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew,
|
|
11089
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
11042
11090
|
const transform = get$3();
|
|
11043
11091
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
11044
|
-
if (
|
|
11045
|
-
tempMatrix.a =
|
|
11046
|
-
multiplyParent(transform, tempMatrix);
|
|
11092
|
+
if (clipScaleX) {
|
|
11093
|
+
tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
|
|
11094
|
+
multiplyParent(transform, tempMatrix$1);
|
|
11047
11095
|
}
|
|
11048
11096
|
data.transform = transform;
|
|
11049
11097
|
}
|
|
@@ -11136,7 +11184,12 @@ var LeaferUI = function(exports) {
|
|
|
11136
11184
|
|
|
11137
11185
|
case "normal":
|
|
11138
11186
|
case "clip":
|
|
11139
|
-
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
11187
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
|
|
11188
|
+
let clipScaleX, clipScaleY;
|
|
11189
|
+
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
11190
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
11191
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
11192
|
+
}
|
|
11140
11193
|
break;
|
|
11141
11194
|
|
|
11142
11195
|
case "repeat":
|
|
@@ -11281,7 +11334,7 @@ var LeaferUI = function(exports) {
|
|
|
11281
11334
|
if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
|
|
11282
11335
|
}
|
|
11283
11336
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
11284
|
-
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
11337
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
11285
11338
|
function createPattern(ui, paint, pixelRatio) {
|
|
11286
11339
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
11287
11340
|
const id = scaleX + "-" + scaleY + "-" + pixelRatio;
|
|
@@ -11329,8 +11382,8 @@ var LeaferUI = function(exports) {
|
|
|
11329
11382
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
11330
11383
|
const canvasWidth = width + (xGap || 0);
|
|
11331
11384
|
const canvasHeight = height + (yGap || 0);
|
|
11332
|
-
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
11333
|
-
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
11385
|
+
scaleX /= canvasWidth / max$1(floor(canvasWidth), 1);
|
|
11386
|
+
scaleY /= canvasHeight / max$1(floor(canvasHeight), 1);
|
|
11334
11387
|
if (!imageMatrix) {
|
|
11335
11388
|
imageMatrix = get$1();
|
|
11336
11389
|
if (transform) copy$1(imageMatrix, transform);
|
|
@@ -11355,17 +11408,15 @@ var LeaferUI = function(exports) {
|
|
|
11355
11408
|
if (allowDraw) {
|
|
11356
11409
|
if (data.repeat) {
|
|
11357
11410
|
allowDraw = false;
|
|
11358
|
-
} else {
|
|
11359
|
-
|
|
11360
|
-
|
|
11361
|
-
|
|
11362
|
-
|
|
11363
|
-
|
|
11364
|
-
|
|
11365
|
-
height *= data.scaleY;
|
|
11366
|
-
}
|
|
11367
|
-
allowDraw = width * height > Platform.image.maxCacheSize;
|
|
11411
|
+
} else if (!(paint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || Export.running)) {
|
|
11412
|
+
let {width: width, height: height} = data;
|
|
11413
|
+
width *= scaleX * pixelRatio;
|
|
11414
|
+
height *= scaleY * pixelRatio;
|
|
11415
|
+
if (data.scaleX) {
|
|
11416
|
+
width *= data.scaleX;
|
|
11417
|
+
height *= data.scaleY;
|
|
11368
11418
|
}
|
|
11419
|
+
allowDraw = width * height > Platform.image.maxCacheSize;
|
|
11369
11420
|
}
|
|
11370
11421
|
}
|
|
11371
11422
|
if (allowDraw) {
|
|
@@ -11523,81 +11574,87 @@ var LeaferUI = function(exports) {
|
|
|
11523
11574
|
conicGradient: conicGradient,
|
|
11524
11575
|
getTransform: getTransform
|
|
11525
11576
|
};
|
|
11526
|
-
const {copy: copy, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper;
|
|
11527
|
-
const tempBounds = {};
|
|
11577
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
11578
|
+
const tempBounds = {}, tempMatrix = new Matrix;
|
|
11528
11579
|
const offsetOutBounds$1 = {};
|
|
11529
11580
|
function shadow(ui, current, shape) {
|
|
11530
|
-
let copyBounds,
|
|
11531
|
-
const {__nowWorld: nowWorld
|
|
11581
|
+
let copyBounds, transform;
|
|
11582
|
+
const {__nowWorld: nowWorld} = ui;
|
|
11532
11583
|
const {shadow: shadow} = ui.__;
|
|
11533
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
11584
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
11534
11585
|
const other = current.getSameCanvas();
|
|
11535
11586
|
const end = shadow.length - 1;
|
|
11536
|
-
toOffsetOutBounds$1(bounds, offsetOutBounds$1);
|
|
11587
|
+
toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
|
|
11537
11588
|
shadow.forEach((item, index) => {
|
|
11538
11589
|
let otherScale = 1;
|
|
11539
11590
|
if (item.scaleFixed) {
|
|
11540
11591
|
const sx = Math.abs(nowWorld.scaleX);
|
|
11541
11592
|
if (sx > 1) otherScale = 1 / sx;
|
|
11542
11593
|
}
|
|
11543
|
-
other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, ColorConvert.string(item.color));
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11594
|
+
other.setWorldShadow(offsetOutBounds$1.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds$1.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale, ColorConvert.string(item.color));
|
|
11595
|
+
transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
11596
|
+
if (transform) other.setTransform(transform);
|
|
11597
|
+
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
11598
|
+
if (transform) other.resetTransform();
|
|
11599
|
+
copyBounds = renderBounds;
|
|
11547
11600
|
if (item.box) {
|
|
11548
11601
|
other.restore();
|
|
11549
11602
|
other.save();
|
|
11550
11603
|
if (worldCanvas) {
|
|
11551
|
-
other.copyWorld(other,
|
|
11604
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
11552
11605
|
copyBounds = nowWorld;
|
|
11553
11606
|
}
|
|
11554
11607
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
11555
11608
|
}
|
|
11556
|
-
|
|
11609
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
11557
11610
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
11558
11611
|
});
|
|
11559
11612
|
other.recycle(copyBounds);
|
|
11560
11613
|
}
|
|
11561
|
-
function
|
|
11562
|
-
let
|
|
11563
|
-
shadow.forEach(item =>
|
|
11564
|
-
|
|
11614
|
+
function getShadowRenderSpread(_ui, shadow) {
|
|
11615
|
+
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
11616
|
+
shadow.forEach(item => {
|
|
11617
|
+
x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
|
|
11618
|
+
top = max(top, spread + blur - y);
|
|
11619
|
+
right = max(right, spread + blur + x);
|
|
11620
|
+
bottom = max(bottom, spread + blur + y);
|
|
11621
|
+
left = max(left, spread + blur - x);
|
|
11622
|
+
});
|
|
11623
|
+
return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
|
|
11624
|
+
}
|
|
11625
|
+
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
11626
|
+
if (shadow.spread) {
|
|
11627
|
+
const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
|
|
11628
|
+
tempMatrix.set().scaleOfOuter({
|
|
11629
|
+
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
11630
|
+
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
11631
|
+
}, spreadScale);
|
|
11632
|
+
return tempMatrix;
|
|
11633
|
+
}
|
|
11634
|
+
return undefined;
|
|
11565
11635
|
}
|
|
11566
|
-
function drawWorldShadow(canvas, outBounds,
|
|
11567
|
-
const {
|
|
11636
|
+
function drawWorldShadow(canvas, outBounds, shape) {
|
|
11637
|
+
const {shapeBounds: shapeBounds} = shape;
|
|
11638
|
+
let from, to;
|
|
11568
11639
|
if (Platform.fullImageShadow) {
|
|
11569
11640
|
copy(tempBounds, canvas.bounds);
|
|
11570
|
-
tempBounds.x
|
|
11571
|
-
|
|
11572
|
-
if (spreadScale) {
|
|
11573
|
-
const {fitMatrix: fitMatrix} = shape;
|
|
11574
|
-
tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
|
|
11575
|
-
tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
|
|
11576
|
-
tempBounds.width *= spreadScale;
|
|
11577
|
-
tempBounds.height *= spreadScale;
|
|
11578
|
-
}
|
|
11579
|
-
canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
|
|
11641
|
+
move(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
11642
|
+
from = canvas.bounds, to = tempBounds;
|
|
11580
11643
|
} else {
|
|
11581
|
-
|
|
11582
|
-
copy(tempBounds, outBounds);
|
|
11583
|
-
tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
|
|
11584
|
-
tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
|
|
11585
|
-
tempBounds.width *= spreadScale;
|
|
11586
|
-
tempBounds.height *= spreadScale;
|
|
11587
|
-
}
|
|
11588
|
-
canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
|
|
11644
|
+
from = shapeBounds, to = outBounds;
|
|
11589
11645
|
}
|
|
11646
|
+
canvas.copyWorld(shape.canvas, from, to);
|
|
11590
11647
|
}
|
|
11591
11648
|
const {toOffsetOutBounds: toOffsetOutBounds} = BoundsHelper;
|
|
11592
11649
|
const offsetOutBounds = {};
|
|
11593
11650
|
function innerShadow(ui, current, shape) {
|
|
11594
|
-
let copyBounds,
|
|
11595
|
-
const {__nowWorld: nowWorld
|
|
11651
|
+
let copyBounds, transform;
|
|
11652
|
+
const {__nowWorld: nowWorld} = ui;
|
|
11596
11653
|
const {innerShadow: innerShadow} = ui.__;
|
|
11597
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
11654
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
11598
11655
|
const other = current.getSameCanvas();
|
|
11599
11656
|
const end = innerShadow.length - 1;
|
|
11600
|
-
toOffsetOutBounds(bounds, offsetOutBounds);
|
|
11657
|
+
toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
|
|
11601
11658
|
innerShadow.forEach((item, index) => {
|
|
11602
11659
|
let otherScale = 1;
|
|
11603
11660
|
if (item.scaleFixed) {
|
|
@@ -11605,17 +11662,18 @@ var LeaferUI = function(exports) {
|
|
|
11605
11662
|
if (sx > 1) otherScale = 1 / sx;
|
|
11606
11663
|
}
|
|
11607
11664
|
other.save();
|
|
11608
|
-
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
11609
|
-
|
|
11610
|
-
|
|
11665
|
+
other.setWorldShadow(offsetOutBounds.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale);
|
|
11666
|
+
transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
11667
|
+
if (transform) other.setTransform(transform);
|
|
11668
|
+
drawWorldShadow(other, offsetOutBounds, shape);
|
|
11611
11669
|
other.restore();
|
|
11612
11670
|
if (worldCanvas) {
|
|
11613
|
-
other.copyWorld(other,
|
|
11671
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
11614
11672
|
other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
|
|
11615
11673
|
copyBounds = nowWorld;
|
|
11616
11674
|
} else {
|
|
11617
11675
|
other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
|
|
11618
|
-
copyBounds =
|
|
11676
|
+
copyBounds = renderBounds;
|
|
11619
11677
|
}
|
|
11620
11678
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
|
|
11621
11679
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
@@ -11623,6 +11681,7 @@ var LeaferUI = function(exports) {
|
|
|
11623
11681
|
});
|
|
11624
11682
|
other.recycle(copyBounds);
|
|
11625
11683
|
}
|
|
11684
|
+
const getInnerShadowSpread = getShadowRenderSpread;
|
|
11626
11685
|
function blur(ui, current, origin) {
|
|
11627
11686
|
const {blur: blur} = ui.__;
|
|
11628
11687
|
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
@@ -11635,10 +11694,12 @@ var LeaferUI = function(exports) {
|
|
|
11635
11694
|
innerShadow: innerShadow,
|
|
11636
11695
|
blur: blur,
|
|
11637
11696
|
backgroundBlur: backgroundBlur,
|
|
11638
|
-
|
|
11697
|
+
getShadowRenderSpread: getShadowRenderSpread,
|
|
11698
|
+
getShadowTransform: getShadowTransform,
|
|
11639
11699
|
isTransformShadow(_shadow) {
|
|
11640
11700
|
return undefined;
|
|
11641
|
-
}
|
|
11701
|
+
},
|
|
11702
|
+
getInnerShadowSpread: getInnerShadowSpread
|
|
11642
11703
|
};
|
|
11643
11704
|
const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
|
|
11644
11705
|
let usedGrayscaleAlpha;
|
|
@@ -11652,6 +11713,7 @@ var LeaferUI = function(exports) {
|
|
|
11652
11713
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
|
|
11653
11714
|
maskCanvas = contentCanvas = null;
|
|
11654
11715
|
}
|
|
11716
|
+
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
11655
11717
|
maskOpacity = child.__.opacity;
|
|
11656
11718
|
usedGrayscaleAlpha = false;
|
|
11657
11719
|
if (mask === "path" || mask === "clipping-path") {
|
|
@@ -11669,7 +11731,6 @@ var LeaferUI = function(exports) {
|
|
|
11669
11731
|
if (!contentCanvas) contentCanvas = getCanvas(canvas);
|
|
11670
11732
|
child.__render(maskCanvas, options);
|
|
11671
11733
|
}
|
|
11672
|
-
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
11673
11734
|
continue;
|
|
11674
11735
|
}
|
|
11675
11736
|
const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
|
|
@@ -12176,6 +12237,7 @@ var LeaferUI = function(exports) {
|
|
|
12176
12237
|
getDrawData: getDrawData
|
|
12177
12238
|
};
|
|
12178
12239
|
function string(color, opacity) {
|
|
12240
|
+
if (!color) return "#000";
|
|
12179
12241
|
const doOpacity = isNumber(opacity) && opacity < 1;
|
|
12180
12242
|
if (isString(color)) {
|
|
12181
12243
|
if (doOpacity && ColorConvert.object) color = ColorConvert.object(color); else return color;
|
|
@@ -12229,6 +12291,7 @@ var LeaferUI = function(exports) {
|
|
|
12229
12291
|
exports.Export = Export;
|
|
12230
12292
|
exports.FileHelper = FileHelper;
|
|
12231
12293
|
exports.Filter = Filter;
|
|
12294
|
+
exports.FourNumberHelper = FourNumberHelper;
|
|
12232
12295
|
exports.FrameData = FrameData;
|
|
12233
12296
|
exports.GroupData = GroupData;
|
|
12234
12297
|
exports.HitCanvasManager = HitCanvasManager;
|
|
@@ -12378,8 +12441,8 @@ var LeaferUI = function(exports) {
|
|
|
12378
12441
|
exports.sortType = sortType;
|
|
12379
12442
|
exports.strokeType = strokeType;
|
|
12380
12443
|
exports.surfaceType = surfaceType;
|
|
12381
|
-
exports.tempBounds = tempBounds$
|
|
12382
|
-
exports.tempMatrix = tempMatrix$
|
|
12444
|
+
exports.tempBounds = tempBounds$2;
|
|
12445
|
+
exports.tempMatrix = tempMatrix$2;
|
|
12383
12446
|
exports.tempPoint = tempPoint$2;
|
|
12384
12447
|
exports.tryToNumber = tryToNumber;
|
|
12385
12448
|
exports.useCanvas = useCanvas;
|