@leafer-ui/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 +280 -187
- 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 +289 -187
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +11 -11
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);
|
|
239
247
|
},
|
|
240
|
-
|
|
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);
|
|
254
|
+
},
|
|
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) {
|
|
@@ -392,6 +434,15 @@ var LeaferUI = function(exports) {
|
|
|
392
434
|
t.c *= scaleY;
|
|
393
435
|
t.d *= scaleY;
|
|
394
436
|
},
|
|
437
|
+
pixelScale(t, pixelRatio, to) {
|
|
438
|
+
to || (to = t);
|
|
439
|
+
to.a = t.a * pixelRatio;
|
|
440
|
+
to.b = t.b * pixelRatio;
|
|
441
|
+
to.c = t.c * pixelRatio;
|
|
442
|
+
to.d = t.d * pixelRatio;
|
|
443
|
+
to.e = t.e * pixelRatio;
|
|
444
|
+
to.f = t.f * pixelRatio;
|
|
445
|
+
},
|
|
395
446
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
396
447
|
M$6.toInnerPoint(t, origin, tempPoint$3);
|
|
397
448
|
M$6.scaleOfInner(t, tempPoint$3, scaleX, scaleY);
|
|
@@ -882,6 +933,10 @@ var LeaferUI = function(exports) {
|
|
|
882
933
|
this.scaleY *= y || x;
|
|
883
934
|
return this;
|
|
884
935
|
}
|
|
936
|
+
pixelScale(pixelRatio) {
|
|
937
|
+
MatrixHelper.pixelScale(this, pixelRatio);
|
|
938
|
+
return this;
|
|
939
|
+
}
|
|
885
940
|
scaleOfOuter(origin, x, y) {
|
|
886
941
|
MatrixHelper.scaleOfOuter(this, origin, x, y);
|
|
887
942
|
return this;
|
|
@@ -960,7 +1015,7 @@ var LeaferUI = function(exports) {
|
|
|
960
1015
|
MatrixHelper.reset(this);
|
|
961
1016
|
}
|
|
962
1017
|
}
|
|
963
|
-
const tempMatrix$
|
|
1018
|
+
const tempMatrix$2 = new Matrix;
|
|
964
1019
|
const TwoPointBoundsHelper = {
|
|
965
1020
|
tempPointBounds: {},
|
|
966
1021
|
setPoint(t, minX, minY) {
|
|
@@ -1090,9 +1145,9 @@ var LeaferUI = function(exports) {
|
|
|
1090
1145
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
1091
1146
|
const point = {};
|
|
1092
1147
|
const toPoint$4 = {};
|
|
1093
|
-
const tempBounds$
|
|
1148
|
+
const tempBounds$3 = {};
|
|
1094
1149
|
const BoundsHelper = {
|
|
1095
|
-
tempBounds: tempBounds$
|
|
1150
|
+
tempBounds: tempBounds$3,
|
|
1096
1151
|
set(t, x = 0, y = 0, width = 0, height = 0) {
|
|
1097
1152
|
t.x = x;
|
|
1098
1153
|
t.y = y;
|
|
@@ -1143,19 +1198,11 @@ var LeaferUI = function(exports) {
|
|
|
1143
1198
|
B.move(t, x, y);
|
|
1144
1199
|
return t;
|
|
1145
1200
|
},
|
|
1146
|
-
toOffsetOutBounds(t, to,
|
|
1147
|
-
if (!to)
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
}
|
|
1152
|
-
if (parent) {
|
|
1153
|
-
to.offsetX = -(B.maxX(parent) - t.x);
|
|
1154
|
-
to.offsetY = -(B.maxY(parent) - t.y);
|
|
1155
|
-
} else {
|
|
1156
|
-
to.offsetX = t.x + t.width;
|
|
1157
|
-
to.offsetY = t.y + t.height;
|
|
1158
|
-
}
|
|
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);
|
|
1159
1206
|
B.move(to, -to.offsetX, -to.offsetY);
|
|
1160
1207
|
},
|
|
1161
1208
|
scale(t, scaleX, scaleY = scaleX, onlySize) {
|
|
@@ -1169,9 +1216,9 @@ var LeaferUI = function(exports) {
|
|
|
1169
1216
|
t.height *= scaleY;
|
|
1170
1217
|
},
|
|
1171
1218
|
tempToOuterOf(t, matrix) {
|
|
1172
|
-
B.copy(tempBounds$
|
|
1173
|
-
B.toOuterOf(tempBounds$
|
|
1174
|
-
return tempBounds$
|
|
1219
|
+
B.copy(tempBounds$3, t);
|
|
1220
|
+
B.toOuterOf(tempBounds$3, matrix);
|
|
1221
|
+
return tempBounds$3;
|
|
1175
1222
|
},
|
|
1176
1223
|
getOuterOf(t, matrix) {
|
|
1177
1224
|
t = Object.assign({}, t);
|
|
@@ -1229,9 +1276,9 @@ var LeaferUI = function(exports) {
|
|
|
1229
1276
|
put(t, put, align = "center", putScale = 1, changeSize = true, to) {
|
|
1230
1277
|
to || (to = put);
|
|
1231
1278
|
if (isString(putScale)) putScale = B.getFitScale(t, put, putScale === "cover");
|
|
1232
|
-
tempBounds$
|
|
1233
|
-
tempBounds$
|
|
1234
|
-
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);
|
|
1235
1282
|
},
|
|
1236
1283
|
getSpread(t, spread, side) {
|
|
1237
1284
|
const n = {};
|
|
@@ -1301,7 +1348,7 @@ var LeaferUI = function(exports) {
|
|
|
1301
1348
|
first = false;
|
|
1302
1349
|
if (!addMode) copy$9(t, bounds);
|
|
1303
1350
|
} else {
|
|
1304
|
-
add$
|
|
1351
|
+
add$2(t, bounds);
|
|
1305
1352
|
}
|
|
1306
1353
|
}
|
|
1307
1354
|
}
|
|
@@ -1315,7 +1362,7 @@ var LeaferUI = function(exports) {
|
|
|
1315
1362
|
B.set(t, point.x, point.y);
|
|
1316
1363
|
},
|
|
1317
1364
|
addPoint(t, point) {
|
|
1318
|
-
add$
|
|
1365
|
+
add$2(t, point, true);
|
|
1319
1366
|
},
|
|
1320
1367
|
getPoints(t) {
|
|
1321
1368
|
const {x: x, y: y, width: width, height: height} = t;
|
|
@@ -1384,7 +1431,7 @@ var LeaferUI = function(exports) {
|
|
|
1384
1431
|
}
|
|
1385
1432
|
};
|
|
1386
1433
|
const B = BoundsHelper;
|
|
1387
|
-
const {add: add$
|
|
1434
|
+
const {add: add$2, copy: copy$9} = B;
|
|
1388
1435
|
class Bounds {
|
|
1389
1436
|
get minX() {
|
|
1390
1437
|
return BoundsHelper.minX(this);
|
|
@@ -1527,7 +1574,7 @@ var LeaferUI = function(exports) {
|
|
|
1527
1574
|
BoundsHelper.reset(this);
|
|
1528
1575
|
}
|
|
1529
1576
|
}
|
|
1530
|
-
const tempBounds$
|
|
1577
|
+
const tempBounds$2 = new Bounds;
|
|
1531
1578
|
class AutoBounds {
|
|
1532
1579
|
constructor(top, right, bottom, left, width, height) {
|
|
1533
1580
|
isObject(top) ? this.copy(top) : this.set(top, right, bottom, left, width, height);
|
|
@@ -1991,7 +2038,7 @@ var LeaferUI = function(exports) {
|
|
|
1991
2038
|
__decorate([ contextMethod() ], Canvas.prototype, "fillText", null);
|
|
1992
2039
|
__decorate([ contextMethod() ], Canvas.prototype, "measureText", null);
|
|
1993
2040
|
__decorate([ contextMethod() ], Canvas.prototype, "strokeText", null);
|
|
1994
|
-
const {copy: copy$8, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2041
|
+
const {copy: copy$8, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
1995
2042
|
const minSize = {
|
|
1996
2043
|
width: 1,
|
|
1997
2044
|
height: 1,
|
|
@@ -2089,13 +2136,8 @@ var LeaferUI = function(exports) {
|
|
|
2089
2136
|
setWorld(matrix, parentMatrix) {
|
|
2090
2137
|
const {pixelRatio: pixelRatio, pixelSnap: pixelSnap} = this, w = this.worldTransform;
|
|
2091
2138
|
if (parentMatrix) multiplyParent$4(matrix, parentMatrix, w);
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
w.c = matrix.c * pixelRatio;
|
|
2095
|
-
w.d = matrix.d * pixelRatio;
|
|
2096
|
-
w.e = matrix.e * pixelRatio;
|
|
2097
|
-
w.f = matrix.f * pixelRatio;
|
|
2098
|
-
if (pixelSnap) {
|
|
2139
|
+
pixelScale(matrix, pixelRatio, w);
|
|
2140
|
+
if (pixelSnap && !matrix.ignorePixelSnap) {
|
|
2099
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),
|
|
2100
2142
|
w.f = round$1(w.f);
|
|
2101
2143
|
}
|
|
@@ -3745,7 +3787,7 @@ var LeaferUI = function(exports) {
|
|
|
3745
3787
|
};
|
|
3746
3788
|
const I$1 = ImageManager;
|
|
3747
3789
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
3748
|
-
const {floor: floor$1, max: max$
|
|
3790
|
+
const {floor: floor$1, max: max$3} = Math;
|
|
3749
3791
|
class LeaferImage {
|
|
3750
3792
|
get url() {
|
|
3751
3793
|
return this.config.url;
|
|
@@ -3833,7 +3875,7 @@ var LeaferUI = function(exports) {
|
|
|
3833
3875
|
}
|
|
3834
3876
|
if (data) return data;
|
|
3835
3877
|
}
|
|
3836
|
-
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));
|
|
3837
3879
|
const ctx = canvas.getContext("2d");
|
|
3838
3880
|
if (opacity) ctx.globalAlpha = opacity;
|
|
3839
3881
|
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
@@ -4008,6 +4050,17 @@ var LeaferUI = function(exports) {
|
|
|
4008
4050
|
}
|
|
4009
4051
|
}));
|
|
4010
4052
|
}
|
|
4053
|
+
function dimType(defaultValue) {
|
|
4054
|
+
return decorateLeafAttr(defaultValue, key => attr({
|
|
4055
|
+
set(value) {
|
|
4056
|
+
if (this.__setAttr(key, value)) {
|
|
4057
|
+
const data = this.__;
|
|
4058
|
+
DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
|
|
4059
|
+
this.__layout.surfaceChange();
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
4062
|
+
}));
|
|
4063
|
+
}
|
|
4011
4064
|
function opacityType(defaultValue) {
|
|
4012
4065
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4013
4066
|
set(value) {
|
|
@@ -4048,7 +4101,7 @@ var LeaferUI = function(exports) {
|
|
|
4048
4101
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4049
4102
|
set(value) {
|
|
4050
4103
|
if (this.__setAttr(key, value)) {
|
|
4051
|
-
this.__layout.
|
|
4104
|
+
this.__layout.surfaceChange();
|
|
4052
4105
|
this.waitParent(() => {
|
|
4053
4106
|
this.parent.__layout.childrenSortChange();
|
|
4054
4107
|
});
|
|
@@ -4082,7 +4135,7 @@ var LeaferUI = function(exports) {
|
|
|
4082
4135
|
set(value) {
|
|
4083
4136
|
if (this.__setAttr(key, value)) {
|
|
4084
4137
|
this.__layout.hitCanvasChanged = true;
|
|
4085
|
-
if (Debug.showBounds === "hit") this.__layout.
|
|
4138
|
+
if (Debug.showBounds === "hit") this.__layout.surfaceChange();
|
|
4086
4139
|
if (this.leafer) this.leafer.updateCursor();
|
|
4087
4140
|
}
|
|
4088
4141
|
}
|
|
@@ -4554,7 +4607,7 @@ var LeaferUI = function(exports) {
|
|
|
4554
4607
|
}
|
|
4555
4608
|
};
|
|
4556
4609
|
const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2} = LeafHelper;
|
|
4557
|
-
const {toOuterOf: toOuterOf$
|
|
4610
|
+
const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$5} = BoundsHelper;
|
|
4558
4611
|
const localContent = "_localContentBounds";
|
|
4559
4612
|
const worldContent = "_worldContentBounds", worldBox = "_worldBoxBounds", worldStroke = "_worldStrokeBounds";
|
|
4560
4613
|
class LeafLayout {
|
|
@@ -4574,7 +4627,7 @@ var LeaferUI = function(exports) {
|
|
|
4574
4627
|
this._renderBounds = bounds;
|
|
4575
4628
|
}
|
|
4576
4629
|
get localContentBounds() {
|
|
4577
|
-
toOuterOf$
|
|
4630
|
+
toOuterOf$3(this.contentBounds, this.leaf.__localMatrix, this[localContent] || (this[localContent] = {}));
|
|
4578
4631
|
return this[localContent];
|
|
4579
4632
|
}
|
|
4580
4633
|
get localStrokeBounds() {
|
|
@@ -4584,15 +4637,15 @@ var LeaferUI = function(exports) {
|
|
|
4584
4637
|
return this._localRenderBounds || this;
|
|
4585
4638
|
}
|
|
4586
4639
|
get worldContentBounds() {
|
|
4587
|
-
toOuterOf$
|
|
4640
|
+
toOuterOf$3(this.contentBounds, this.leaf.__world, this[worldContent] || (this[worldContent] = {}));
|
|
4588
4641
|
return this[worldContent];
|
|
4589
4642
|
}
|
|
4590
4643
|
get worldBoxBounds() {
|
|
4591
|
-
toOuterOf$
|
|
4644
|
+
toOuterOf$3(this.boxBounds, this.leaf.__world, this[worldBox] || (this[worldBox] = {}));
|
|
4592
4645
|
return this[worldBox];
|
|
4593
4646
|
}
|
|
4594
4647
|
get worldStrokeBounds() {
|
|
4595
|
-
toOuterOf$
|
|
4648
|
+
toOuterOf$3(this.strokeBounds, this.leaf.__world, this[worldStroke] || (this[worldStroke] = {}));
|
|
4596
4649
|
return this[worldStroke];
|
|
4597
4650
|
}
|
|
4598
4651
|
get a() {
|
|
@@ -5363,12 +5416,12 @@ var LeaferUI = function(exports) {
|
|
|
5363
5416
|
};
|
|
5364
5417
|
const {updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2} = LeafHelper;
|
|
5365
5418
|
const {updateBounds: updateBounds$1} = BranchHelper;
|
|
5366
|
-
const {toOuterOf: toOuterOf$
|
|
5419
|
+
const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$2, copy: copy$4} = BoundsHelper;
|
|
5367
5420
|
const {toBounds: toBounds} = PathBounds;
|
|
5368
5421
|
const LeafBounds = {
|
|
5369
5422
|
__updateWorldBounds() {
|
|
5370
5423
|
const layout = this.__layout;
|
|
5371
|
-
toOuterOf$
|
|
5424
|
+
toOuterOf$2(layout.renderBounds, this.__world, this.__world);
|
|
5372
5425
|
if (layout.resized) {
|
|
5373
5426
|
if (layout.resized === "inner") this.__onUpdateSize();
|
|
5374
5427
|
if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
|
|
@@ -5424,13 +5477,13 @@ var LeaferUI = function(exports) {
|
|
|
5424
5477
|
__updateLocalBoxBounds() {
|
|
5425
5478
|
if (this.__hasMotionPath) this.__updateMotionPath();
|
|
5426
5479
|
if (this.__hasAutoLayout) this.__updateAutoLayout();
|
|
5427
|
-
toOuterOf$
|
|
5480
|
+
toOuterOf$2(this.__layout.boxBounds, this.__local, this.__local);
|
|
5428
5481
|
},
|
|
5429
5482
|
__updateLocalStrokeBounds() {
|
|
5430
|
-
toOuterOf$
|
|
5483
|
+
toOuterOf$2(this.__layout.strokeBounds, this.__localMatrix, this.__layout.localStrokeBounds);
|
|
5431
5484
|
},
|
|
5432
5485
|
__updateLocalRenderBounds() {
|
|
5433
|
-
toOuterOf$
|
|
5486
|
+
toOuterOf$2(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
|
|
5434
5487
|
},
|
|
5435
5488
|
__updateBoxBounds(_secondLayout, _bounds) {
|
|
5436
5489
|
const b = this.__layout.boxBounds;
|
|
@@ -5468,11 +5521,11 @@ var LeaferUI = function(exports) {
|
|
|
5468
5521
|
},
|
|
5469
5522
|
__updateStrokeBounds(_bounds) {
|
|
5470
5523
|
const layout = this.__layout;
|
|
5471
|
-
copyAndSpread$
|
|
5524
|
+
copyAndSpread$2(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
5472
5525
|
},
|
|
5473
5526
|
__updateRenderBounds(_bounds) {
|
|
5474
|
-
const layout = this.__layout;
|
|
5475
|
-
|
|
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);
|
|
5476
5529
|
}
|
|
5477
5530
|
};
|
|
5478
5531
|
const LeafRender = {
|
|
@@ -5480,6 +5533,7 @@ var LeaferUI = function(exports) {
|
|
|
5480
5533
|
if (options.shape) return this.__renderShape(canvas, options);
|
|
5481
5534
|
if (this.__worldOpacity) {
|
|
5482
5535
|
const data = this.__;
|
|
5536
|
+
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
5483
5537
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5484
5538
|
canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
5485
5539
|
if (this.__.__single) {
|
|
@@ -5526,7 +5580,9 @@ var LeaferUI = function(exports) {
|
|
|
5526
5580
|
this.__nowWorld = this.__getNowWorld(options);
|
|
5527
5581
|
if (this.__worldOpacity) {
|
|
5528
5582
|
const data = this.__;
|
|
5529
|
-
if (data.
|
|
5583
|
+
if (data.__useDim) {
|
|
5584
|
+
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);
|
|
5585
|
+
}
|
|
5530
5586
|
if (data.__single && !this.isBranchLeaf) {
|
|
5531
5587
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
5532
5588
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
@@ -5561,9 +5617,10 @@ var LeaferUI = function(exports) {
|
|
|
5561
5617
|
};
|
|
5562
5618
|
const tempScaleData$1 = {};
|
|
5563
5619
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
5620
|
+
const {stintSet: stintSet$3} = DataHelper;
|
|
5564
5621
|
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
5565
|
-
const {toOuterOf: toOuterOf} = BoundsHelper;
|
|
5566
|
-
const {copy: copy$3, move: move} = PointHelper;
|
|
5622
|
+
const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
5623
|
+
const {copy: copy$3, move: move$2} = PointHelper;
|
|
5567
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;
|
|
5568
5625
|
exports.Leaf = class Leaf {
|
|
5569
5626
|
get tag() {
|
|
@@ -5837,8 +5894,9 @@ var LeaferUI = function(exports) {
|
|
|
5837
5894
|
if (!this.__cameraWorld) this.__cameraWorld = {};
|
|
5838
5895
|
const cameraWorld = this.__cameraWorld, world = this.__world;
|
|
5839
5896
|
multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
|
|
5840
|
-
toOuterOf(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
5841
|
-
cameraWorld
|
|
5897
|
+
toOuterOf$1(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
5898
|
+
stintSet$3(cameraWorld, "half", world.half);
|
|
5899
|
+
stintSet$3(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
|
|
5842
5900
|
return cameraWorld;
|
|
5843
5901
|
} else {
|
|
5844
5902
|
return this.__world;
|
|
@@ -5872,7 +5930,7 @@ var LeaferUI = function(exports) {
|
|
|
5872
5930
|
getWorldBounds(inner, relative, change) {
|
|
5873
5931
|
const matrix = relative ? getRelativeWorld(this, relative) : this.worldTransform;
|
|
5874
5932
|
const to = change ? inner : {};
|
|
5875
|
-
toOuterOf(inner, matrix, to);
|
|
5933
|
+
toOuterOf$1(inner, matrix, to);
|
|
5876
5934
|
return to;
|
|
5877
5935
|
}
|
|
5878
5936
|
worldToLocal(world, to, distance, relative) {
|
|
@@ -5905,7 +5963,7 @@ var LeaferUI = function(exports) {
|
|
|
5905
5963
|
}
|
|
5906
5964
|
getBoxPointByInner(inner, _relative, _distance, change) {
|
|
5907
5965
|
const point = change ? inner : Object.assign({}, inner), {x: x, y: y} = this.boxBounds;
|
|
5908
|
-
move(point, -x, -y);
|
|
5966
|
+
move$2(point, -x, -y);
|
|
5909
5967
|
return point;
|
|
5910
5968
|
}
|
|
5911
5969
|
getInnerPoint(world, relative, distance, change) {
|
|
@@ -5915,7 +5973,7 @@ var LeaferUI = function(exports) {
|
|
|
5915
5973
|
}
|
|
5916
5974
|
getInnerPointByBox(box, _relative, _distance, change) {
|
|
5917
5975
|
const point = change ? box : Object.assign({}, box), {x: x, y: y} = this.boxBounds;
|
|
5918
|
-
move(point, x, y);
|
|
5976
|
+
move$2(point, x, y);
|
|
5919
5977
|
return point;
|
|
5920
5978
|
}
|
|
5921
5979
|
getInnerPointByLocal(local, _relative, distance, change) {
|
|
@@ -6351,7 +6409,7 @@ var LeaferUI = function(exports) {
|
|
|
6351
6409
|
this.levelMap = null;
|
|
6352
6410
|
}
|
|
6353
6411
|
}
|
|
6354
|
-
const version = "1.9.
|
|
6412
|
+
const version = "1.9.8";
|
|
6355
6413
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6356
6414
|
get allowBackgroundColor() {
|
|
6357
6415
|
return true;
|
|
@@ -6749,6 +6807,7 @@ var LeaferUI = function(exports) {
|
|
|
6749
6807
|
usePartRender: true,
|
|
6750
6808
|
maxFPS: 120
|
|
6751
6809
|
};
|
|
6810
|
+
this.frames = [];
|
|
6752
6811
|
this.target = target;
|
|
6753
6812
|
this.canvas = canvas;
|
|
6754
6813
|
if (userConfig) this.config = DataHelper.default(userConfig, this.config);
|
|
@@ -6878,7 +6937,7 @@ var LeaferUI = function(exports) {
|
|
|
6878
6937
|
};
|
|
6879
6938
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
6880
6939
|
if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
|
|
6881
|
-
this.target
|
|
6940
|
+
Platform.render(this.target, canvas, options);
|
|
6882
6941
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
6883
6942
|
this.renderOptions = options;
|
|
6884
6943
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
@@ -6901,12 +6960,15 @@ var LeaferUI = function(exports) {
|
|
|
6901
6960
|
const target = this.target;
|
|
6902
6961
|
if (this.requestTime || !target) return;
|
|
6903
6962
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
6904
|
-
|
|
6963
|
+
this.requestTime = this.frameTime || Date.now();
|
|
6905
6964
|
const render = () => {
|
|
6906
|
-
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
6965
|
+
const nowFPS = 1e3 / ((this.frameTime = Date.now()) - this.requestTime);
|
|
6907
6966
|
const {maxFPS: maxFPS} = this.config;
|
|
6908
|
-
if (maxFPS && nowFPS > maxFPS
|
|
6909
|
-
|
|
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);
|
|
6910
6972
|
this.requestTime = 0;
|
|
6911
6973
|
this.checkRender();
|
|
6912
6974
|
};
|
|
@@ -7147,6 +7209,14 @@ var LeaferUI = function(exports) {
|
|
|
7147
7209
|
selector: (target, options) => new Selector(target, options)
|
|
7148
7210
|
});
|
|
7149
7211
|
Platform.layout = Layouter.fullLayout;
|
|
7212
|
+
Platform.render = function(target, canvas, options) {
|
|
7213
|
+
const topOptions = Object.assign(Object.assign({}, options), {
|
|
7214
|
+
topRendering: true
|
|
7215
|
+
});
|
|
7216
|
+
options.topList = new LeafList;
|
|
7217
|
+
target.__render(canvas, options);
|
|
7218
|
+
if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
|
|
7219
|
+
};
|
|
7150
7220
|
function effectType(defaultValue) {
|
|
7151
7221
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
7152
7222
|
set(value) {
|
|
@@ -7508,39 +7578,40 @@ var LeaferUI = function(exports) {
|
|
|
7508
7578
|
return data;
|
|
7509
7579
|
}
|
|
7510
7580
|
}
|
|
7581
|
+
const {max: max$2, add: add$1} = FourNumberHelper;
|
|
7511
7582
|
const UIBounds = {
|
|
7512
7583
|
__updateStrokeSpread() {
|
|
7513
|
-
let
|
|
7584
|
+
let spread = 0, boxSpread = 0;
|
|
7514
7585
|
const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
|
|
7515
7586
|
if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
|
|
7516
|
-
|
|
7587
|
+
boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
|
|
7517
7588
|
if (!data.__boxStroke) {
|
|
7518
|
-
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 *
|
|
7589
|
+
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
|
|
7519
7590
|
const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
|
|
7520
|
-
|
|
7591
|
+
spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
7521
7592
|
}
|
|
7522
7593
|
}
|
|
7523
|
-
if (data.__useArrow)
|
|
7594
|
+
if (data.__useArrow) spread += strokeWidth * 5;
|
|
7524
7595
|
if (box) {
|
|
7525
|
-
|
|
7526
|
-
|
|
7596
|
+
spread = max$2(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
|
|
7597
|
+
boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
|
|
7527
7598
|
}
|
|
7528
|
-
this.__layout.strokeBoxSpread =
|
|
7529
|
-
return
|
|
7599
|
+
this.__layout.strokeBoxSpread = boxSpread;
|
|
7600
|
+
return spread;
|
|
7530
7601
|
},
|
|
7531
7602
|
__updateRenderSpread() {
|
|
7532
|
-
let
|
|
7533
|
-
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
|
|
7534
|
-
if (shadow)
|
|
7535
|
-
if (blur)
|
|
7536
|
-
if (filter)
|
|
7537
|
-
if (renderSpread)
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
if (
|
|
7541
|
-
|
|
7542
|
-
|
|
7543
|
-
return
|
|
7603
|
+
let spread = 0;
|
|
7604
|
+
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
|
|
7605
|
+
if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
|
|
7606
|
+
if (blur) spread = max$2(spread, blur);
|
|
7607
|
+
if (filter) spread = add$1(spread, Filter.getSpread(filter));
|
|
7608
|
+
if (renderSpread) spread = add$1(spread, renderSpread);
|
|
7609
|
+
if (strokeSpread) spread = add$1(spread, strokeSpread);
|
|
7610
|
+
let shapeSpread = spread;
|
|
7611
|
+
if (innerShadow) shapeSpread = max$2(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
|
|
7612
|
+
if (backgroundBlur) shapeSpread = max$2(shapeSpread, backgroundBlur);
|
|
7613
|
+
this.__layout.renderShapeSpread = shapeSpread;
|
|
7614
|
+
return box ? max$2(box.__updateRenderSpread(), spread) : spread;
|
|
7544
7615
|
}
|
|
7545
7616
|
};
|
|
7546
7617
|
const {float: float} = MathHelper;
|
|
@@ -7864,8 +7935,8 @@ var LeaferUI = function(exports) {
|
|
|
7864
7935
|
__decorate([ opacityType(1) ], exports.UI.prototype, "opacity", void 0);
|
|
7865
7936
|
__decorate([ visibleType(true) ], exports.UI.prototype, "visible", void 0);
|
|
7866
7937
|
__decorate([ surfaceType(false) ], exports.UI.prototype, "locked", void 0);
|
|
7867
|
-
__decorate([
|
|
7868
|
-
__decorate([
|
|
7938
|
+
__decorate([ dimType(false) ], exports.UI.prototype, "dim", void 0);
|
|
7939
|
+
__decorate([ dimType(false) ], exports.UI.prototype, "dimskip", void 0);
|
|
7869
7940
|
__decorate([ sortType(0) ], exports.UI.prototype, "zIndex", void 0);
|
|
7870
7941
|
__decorate([ maskType(false) ], exports.UI.prototype, "mask", void 0);
|
|
7871
7942
|
__decorate([ eraserType(false) ], exports.UI.prototype, "eraser", void 0);
|
|
@@ -8682,7 +8753,7 @@ var LeaferUI = function(exports) {
|
|
|
8682
8753
|
__decorate([ dataType(false) ], exports.Canvas.prototype, "safeResize", void 0);
|
|
8683
8754
|
__decorate([ resizeType() ], exports.Canvas.prototype, "contextSettings", void 0);
|
|
8684
8755
|
exports.Canvas = __decorate([ registerUI() ], exports.Canvas);
|
|
8685
|
-
const {copyAndSpread: copyAndSpread, includes: includes, spread: spread, setList: setList} = BoundsHelper;
|
|
8756
|
+
const {copyAndSpread: copyAndSpread$1, includes: includes, spread: spread, setList: setList} = BoundsHelper;
|
|
8686
8757
|
exports.Text = class Text extends exports.UI {
|
|
8687
8758
|
get __tag() {
|
|
8688
8759
|
return "Text";
|
|
@@ -8728,13 +8799,13 @@ var LeaferUI = function(exports) {
|
|
|
8728
8799
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
8729
8800
|
}
|
|
8730
8801
|
__updateRenderSpread() {
|
|
8731
|
-
let
|
|
8732
|
-
if (!
|
|
8733
|
-
return
|
|
8802
|
+
let spread = super.__updateRenderSpread();
|
|
8803
|
+
if (!spread) spread = this.isOverflow ? 1 : 0;
|
|
8804
|
+
return spread;
|
|
8734
8805
|
}
|
|
8735
8806
|
__updateRenderBounds() {
|
|
8736
8807
|
const {renderBounds: renderBounds, renderSpread: renderSpread} = this.__layout;
|
|
8737
|
-
copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
8808
|
+
copyAndSpread$1(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
8738
8809
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
8739
8810
|
}
|
|
8740
8811
|
__updateChange() {
|
|
@@ -9093,9 +9164,9 @@ var LeaferUI = function(exports) {
|
|
|
9093
9164
|
static setData(data) {
|
|
9094
9165
|
this.data = data;
|
|
9095
9166
|
}
|
|
9096
|
-
static getValidMove(leaf,
|
|
9097
|
-
const move = leaf.getLocalPoint(
|
|
9098
|
-
PointHelper.move(move,
|
|
9167
|
+
static getValidMove(leaf, localStart, worldTotal, checkLimit = true) {
|
|
9168
|
+
const move = leaf.getLocalPoint(worldTotal, null, true);
|
|
9169
|
+
PointHelper.move(move, localStart.x - leaf.x, localStart.y - leaf.y);
|
|
9099
9170
|
if (checkLimit) this.limitMove(leaf, move);
|
|
9100
9171
|
DragBoundsHelper.axisMove(leaf, move);
|
|
9101
9172
|
return move;
|
|
@@ -10049,8 +10120,8 @@ var LeaferUI = function(exports) {
|
|
|
10049
10120
|
if (isHitPixel) {
|
|
10050
10121
|
const {renderBounds: renderBounds} = this.__layout;
|
|
10051
10122
|
const size = Platform.image.hitCanvasSize;
|
|
10052
|
-
const scale = h.hitScale = tempBounds$
|
|
10053
|
-
const {x: x, y: y, width: width, height: height} = tempBounds$
|
|
10123
|
+
const scale = h.hitScale = tempBounds$2.set(0, 0, size, size).getFitMatrix(renderBounds).a;
|
|
10124
|
+
const {x: x, y: y, width: width, height: height} = tempBounds$2.set(renderBounds).scale(scale);
|
|
10054
10125
|
h.resize({
|
|
10055
10126
|
width: width,
|
|
10056
10127
|
height: height,
|
|
@@ -10137,8 +10208,8 @@ var LeaferUI = function(exports) {
|
|
|
10137
10208
|
canvas.hitPixel = function(radiusPoint, offset, scale = 1) {
|
|
10138
10209
|
let {x: x, y: y, radiusX: radiusX, radiusY: radiusY} = radiusPoint;
|
|
10139
10210
|
if (offset) x -= offset.x, y -= offset.y;
|
|
10140
|
-
tempBounds$
|
|
10141
|
-
const {data: data} = this.context.getImageData(tempBounds$
|
|
10211
|
+
tempBounds$2.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
|
|
10212
|
+
const {data: data} = this.context.getImageData(tempBounds$2.x, tempBounds$2.y, tempBounds$2.width || 1, tempBounds$2.height || 1);
|
|
10142
10213
|
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
10143
10214
|
if (data[i + 3] > 0) return true;
|
|
10144
10215
|
}
|
|
@@ -10323,23 +10394,27 @@ var LeaferUI = function(exports) {
|
|
|
10323
10394
|
out.recycle(ui.__nowWorld);
|
|
10324
10395
|
}
|
|
10325
10396
|
}
|
|
10326
|
-
const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIntersectData: getIntersectData} = BoundsHelper;
|
|
10397
|
+
const {getSpread: getSpread, copyAndSpread: copyAndSpread, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$1, getIntersectData: getIntersectData} = BoundsHelper;
|
|
10398
|
+
const tempBounds$1 = {};
|
|
10327
10399
|
function shape(ui, current, options) {
|
|
10328
10400
|
const canvas = current.getSameCanvas();
|
|
10329
|
-
const nowWorld = ui.__nowWorld,
|
|
10330
|
-
|
|
10401
|
+
const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
|
|
10402
|
+
const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
|
|
10403
|
+
toOuterOf(layout.strokeSpread ? (copyAndSpread(tempBounds$1, layout.boxBounds, layout.strokeSpread),
|
|
10404
|
+
tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
|
|
10405
|
+
let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
10331
10406
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
10332
|
-
if (currentBounds.includes(
|
|
10407
|
+
if (currentBounds.includes(nowWorldShapeBounds)) {
|
|
10333
10408
|
worldCanvas = canvas;
|
|
10334
|
-
bounds = shapeBounds =
|
|
10409
|
+
bounds = shapeBounds = nowWorldShapeBounds;
|
|
10410
|
+
renderBounds = nowWorld;
|
|
10335
10411
|
} else {
|
|
10336
|
-
const {renderShapeSpread: spread} = ui.__layout;
|
|
10337
10412
|
let worldClipBounds;
|
|
10338
10413
|
if (Platform.fullImageShadow) {
|
|
10339
|
-
worldClipBounds =
|
|
10414
|
+
worldClipBounds = nowWorldShapeBounds;
|
|
10340
10415
|
} else {
|
|
10341
|
-
const spreadBounds =
|
|
10342
|
-
worldClipBounds = getIntersectData(spreadBounds,
|
|
10416
|
+
const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
|
|
10417
|
+
worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
|
|
10343
10418
|
}
|
|
10344
10419
|
fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
|
|
10345
10420
|
let {a: fitScaleX, d: fitScaleY} = fitMatrix;
|
|
@@ -10349,8 +10424,10 @@ var LeaferUI = function(exports) {
|
|
|
10349
10424
|
scaleX *= fitScaleX;
|
|
10350
10425
|
scaleY *= fitScaleY;
|
|
10351
10426
|
}
|
|
10352
|
-
shapeBounds = getOuterOf(
|
|
10427
|
+
shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
|
|
10353
10428
|
bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
|
|
10429
|
+
renderBounds = getOuterOf(nowWorld, fitMatrix);
|
|
10430
|
+
move$1(renderBounds, -fitMatrix.e, -fitMatrix.f);
|
|
10354
10431
|
const userMatrix = options.matrix;
|
|
10355
10432
|
if (userMatrix) {
|
|
10356
10433
|
matrix = new Matrix(fitMatrix);
|
|
@@ -10369,6 +10446,7 @@ var LeaferUI = function(exports) {
|
|
|
10369
10446
|
matrix: matrix,
|
|
10370
10447
|
fitMatrix: fitMatrix,
|
|
10371
10448
|
bounds: bounds,
|
|
10449
|
+
renderBounds: renderBounds,
|
|
10372
10450
|
worldCanvas: worldCanvas,
|
|
10373
10451
|
shapeBounds: shapeBounds,
|
|
10374
10452
|
scaleX: scaleX,
|
|
@@ -10466,7 +10544,7 @@ var LeaferUI = function(exports) {
|
|
|
10466
10544
|
drawTextStroke: drawTextStroke,
|
|
10467
10545
|
shape: shape
|
|
10468
10546
|
};
|
|
10469
|
-
let origin = {}, tempMatrix = getMatrixData();
|
|
10547
|
+
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
10470
10548
|
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
10471
10549
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
10472
10550
|
const transform = get$3();
|
|
@@ -10478,12 +10556,12 @@ var LeaferUI = function(exports) {
|
|
|
10478
10556
|
}, rotation);
|
|
10479
10557
|
data.transform = transform;
|
|
10480
10558
|
}
|
|
10481
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew,
|
|
10559
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
10482
10560
|
const transform = get$3();
|
|
10483
10561
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
10484
|
-
if (
|
|
10485
|
-
tempMatrix.a =
|
|
10486
|
-
multiplyParent(transform, tempMatrix);
|
|
10562
|
+
if (clipScaleX) {
|
|
10563
|
+
tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
|
|
10564
|
+
multiplyParent(transform, tempMatrix$1);
|
|
10487
10565
|
}
|
|
10488
10566
|
data.transform = transform;
|
|
10489
10567
|
}
|
|
@@ -10576,7 +10654,12 @@ var LeaferUI = function(exports) {
|
|
|
10576
10654
|
|
|
10577
10655
|
case "normal":
|
|
10578
10656
|
case "clip":
|
|
10579
|
-
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
10657
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
|
|
10658
|
+
let clipScaleX, clipScaleY;
|
|
10659
|
+
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
10660
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
10661
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
10662
|
+
}
|
|
10580
10663
|
break;
|
|
10581
10664
|
|
|
10582
10665
|
case "repeat":
|
|
@@ -10721,7 +10804,7 @@ var LeaferUI = function(exports) {
|
|
|
10721
10804
|
if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
|
|
10722
10805
|
}
|
|
10723
10806
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
10724
|
-
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
10807
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
10725
10808
|
function createPattern(ui, paint, pixelRatio) {
|
|
10726
10809
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
10727
10810
|
const id = scaleX + "-" + scaleY + "-" + pixelRatio;
|
|
@@ -10769,8 +10852,8 @@ var LeaferUI = function(exports) {
|
|
|
10769
10852
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
10770
10853
|
const canvasWidth = width + (xGap || 0);
|
|
10771
10854
|
const canvasHeight = height + (yGap || 0);
|
|
10772
|
-
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
10773
|
-
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
10855
|
+
scaleX /= canvasWidth / max$1(floor(canvasWidth), 1);
|
|
10856
|
+
scaleY /= canvasHeight / max$1(floor(canvasHeight), 1);
|
|
10774
10857
|
if (!imageMatrix) {
|
|
10775
10858
|
imageMatrix = get$1();
|
|
10776
10859
|
if (transform) copy$1(imageMatrix, transform);
|
|
@@ -10795,17 +10878,15 @@ var LeaferUI = function(exports) {
|
|
|
10795
10878
|
if (allowDraw) {
|
|
10796
10879
|
if (data.repeat) {
|
|
10797
10880
|
allowDraw = false;
|
|
10798
|
-
} else {
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
height *= data.scaleY;
|
|
10806
|
-
}
|
|
10807
|
-
allowDraw = width * height > Platform.image.maxCacheSize;
|
|
10881
|
+
} else if (!(paint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || Export.running)) {
|
|
10882
|
+
let {width: width, height: height} = data;
|
|
10883
|
+
width *= scaleX * pixelRatio;
|
|
10884
|
+
height *= scaleY * pixelRatio;
|
|
10885
|
+
if (data.scaleX) {
|
|
10886
|
+
width *= data.scaleX;
|
|
10887
|
+
height *= data.scaleY;
|
|
10808
10888
|
}
|
|
10889
|
+
allowDraw = width * height > Platform.image.maxCacheSize;
|
|
10809
10890
|
}
|
|
10810
10891
|
}
|
|
10811
10892
|
if (allowDraw) {
|
|
@@ -10963,17 +11044,17 @@ var LeaferUI = function(exports) {
|
|
|
10963
11044
|
conicGradient: conicGradient,
|
|
10964
11045
|
getTransform: getTransform
|
|
10965
11046
|
};
|
|
10966
|
-
const {copy: copy, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper;
|
|
10967
|
-
const tempBounds = {};
|
|
11047
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
11048
|
+
const tempBounds = {}, tempMatrix = new Matrix;
|
|
10968
11049
|
const offsetOutBounds$1 = {};
|
|
10969
11050
|
function shadow(ui, current, shape) {
|
|
10970
|
-
let copyBounds,
|
|
10971
|
-
const {__nowWorld: nowWorld
|
|
11051
|
+
let copyBounds, transform;
|
|
11052
|
+
const {__nowWorld: nowWorld} = ui;
|
|
10972
11053
|
const {shadow: shadow} = ui.__;
|
|
10973
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
11054
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
10974
11055
|
const other = current.getSameCanvas();
|
|
10975
11056
|
const end = shadow.length - 1;
|
|
10976
|
-
toOffsetOutBounds$1(bounds, offsetOutBounds$1);
|
|
11057
|
+
toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
|
|
10977
11058
|
shadow.forEach((item, index) => {
|
|
10978
11059
|
let otherScale = 1;
|
|
10979
11060
|
if (item.scaleFixed) {
|
|
@@ -10981,63 +11062,69 @@ var LeaferUI = function(exports) {
|
|
|
10981
11062
|
if (sx > 1) otherScale = 1 / sx;
|
|
10982
11063
|
}
|
|
10983
11064
|
other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, ColorConvert.string(item.color));
|
|
10984
|
-
|
|
10985
|
-
|
|
10986
|
-
|
|
11065
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
11066
|
+
if (transform) other.setTransform(transform);
|
|
11067
|
+
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
11068
|
+
if (transform) other.resetTransform();
|
|
11069
|
+
copyBounds = renderBounds;
|
|
10987
11070
|
if (item.box) {
|
|
10988
11071
|
other.restore();
|
|
10989
11072
|
other.save();
|
|
10990
11073
|
if (worldCanvas) {
|
|
10991
|
-
other.copyWorld(other,
|
|
11074
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
10992
11075
|
copyBounds = nowWorld;
|
|
10993
11076
|
}
|
|
10994
11077
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
10995
11078
|
}
|
|
10996
|
-
|
|
11079
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
10997
11080
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
10998
11081
|
});
|
|
10999
11082
|
other.recycle(copyBounds);
|
|
11000
11083
|
}
|
|
11001
|
-
function
|
|
11002
|
-
let
|
|
11003
|
-
shadow.forEach(item =>
|
|
11004
|
-
|
|
11084
|
+
function getShadowRenderSpread(_ui, shadow) {
|
|
11085
|
+
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
11086
|
+
shadow.forEach(item => {
|
|
11087
|
+
x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
|
|
11088
|
+
top = max(top, spread + blur - y);
|
|
11089
|
+
right = max(right, spread + blur + x);
|
|
11090
|
+
bottom = max(bottom, spread + blur + y);
|
|
11091
|
+
left = max(left, spread + blur - x);
|
|
11092
|
+
});
|
|
11093
|
+
return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
|
|
11094
|
+
}
|
|
11095
|
+
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
11096
|
+
if (shadow.spread) {
|
|
11097
|
+
const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
|
|
11098
|
+
tempMatrix.set().scaleOfOuter({
|
|
11099
|
+
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
11100
|
+
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
11101
|
+
}, spreadScale);
|
|
11102
|
+
return tempMatrix;
|
|
11103
|
+
}
|
|
11104
|
+
return undefined;
|
|
11005
11105
|
}
|
|
11006
|
-
function drawWorldShadow(canvas, outBounds,
|
|
11007
|
-
const {
|
|
11106
|
+
function drawWorldShadow(canvas, outBounds, shape) {
|
|
11107
|
+
const {shapeBounds: shapeBounds} = shape;
|
|
11108
|
+
let from, to;
|
|
11008
11109
|
if (Platform.fullImageShadow) {
|
|
11009
11110
|
copy(tempBounds, canvas.bounds);
|
|
11010
|
-
tempBounds.x
|
|
11011
|
-
|
|
11012
|
-
if (spreadScale) {
|
|
11013
|
-
const {fitMatrix: fitMatrix} = shape;
|
|
11014
|
-
tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
|
|
11015
|
-
tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
|
|
11016
|
-
tempBounds.width *= spreadScale;
|
|
11017
|
-
tempBounds.height *= spreadScale;
|
|
11018
|
-
}
|
|
11019
|
-
canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
|
|
11111
|
+
move(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
11112
|
+
from = canvas.bounds, to = tempBounds;
|
|
11020
11113
|
} else {
|
|
11021
|
-
|
|
11022
|
-
copy(tempBounds, outBounds);
|
|
11023
|
-
tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
|
|
11024
|
-
tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
|
|
11025
|
-
tempBounds.width *= spreadScale;
|
|
11026
|
-
tempBounds.height *= spreadScale;
|
|
11027
|
-
}
|
|
11028
|
-
canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
|
|
11114
|
+
from = shapeBounds, to = outBounds;
|
|
11029
11115
|
}
|
|
11116
|
+
canvas.copyWorld(shape.canvas, from, to);
|
|
11030
11117
|
}
|
|
11031
11118
|
const {toOffsetOutBounds: toOffsetOutBounds} = BoundsHelper;
|
|
11032
11119
|
const offsetOutBounds = {};
|
|
11033
11120
|
function innerShadow(ui, current, shape) {
|
|
11034
|
-
let copyBounds,
|
|
11035
|
-
const {__nowWorld: nowWorld
|
|
11121
|
+
let copyBounds, transform;
|
|
11122
|
+
const {__nowWorld: nowWorld} = ui;
|
|
11036
11123
|
const {innerShadow: innerShadow} = ui.__;
|
|
11037
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
11124
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
11038
11125
|
const other = current.getSameCanvas();
|
|
11039
11126
|
const end = innerShadow.length - 1;
|
|
11040
|
-
toOffsetOutBounds(bounds, offsetOutBounds);
|
|
11127
|
+
toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
|
|
11041
11128
|
innerShadow.forEach((item, index) => {
|
|
11042
11129
|
let otherScale = 1;
|
|
11043
11130
|
if (item.scaleFixed) {
|
|
@@ -11046,16 +11133,17 @@ var LeaferUI = function(exports) {
|
|
|
11046
11133
|
}
|
|
11047
11134
|
other.save();
|
|
11048
11135
|
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
11049
|
-
|
|
11050
|
-
|
|
11136
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
11137
|
+
if (transform) other.setTransform(transform);
|
|
11138
|
+
drawWorldShadow(other, offsetOutBounds, shape);
|
|
11051
11139
|
other.restore();
|
|
11052
11140
|
if (worldCanvas) {
|
|
11053
|
-
other.copyWorld(other,
|
|
11141
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
11054
11142
|
other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
|
|
11055
11143
|
copyBounds = nowWorld;
|
|
11056
11144
|
} else {
|
|
11057
11145
|
other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
|
|
11058
|
-
copyBounds =
|
|
11146
|
+
copyBounds = renderBounds;
|
|
11059
11147
|
}
|
|
11060
11148
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
|
|
11061
11149
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
@@ -11063,6 +11151,7 @@ var LeaferUI = function(exports) {
|
|
|
11063
11151
|
});
|
|
11064
11152
|
other.recycle(copyBounds);
|
|
11065
11153
|
}
|
|
11154
|
+
const getInnerShadowSpread = getShadowRenderSpread;
|
|
11066
11155
|
function blur(ui, current, origin) {
|
|
11067
11156
|
const {blur: blur} = ui.__;
|
|
11068
11157
|
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
@@ -11075,10 +11164,12 @@ var LeaferUI = function(exports) {
|
|
|
11075
11164
|
innerShadow: innerShadow,
|
|
11076
11165
|
blur: blur,
|
|
11077
11166
|
backgroundBlur: backgroundBlur,
|
|
11078
|
-
|
|
11167
|
+
getShadowRenderSpread: getShadowRenderSpread,
|
|
11168
|
+
getShadowTransform: getShadowTransform,
|
|
11079
11169
|
isTransformShadow(_shadow) {
|
|
11080
11170
|
return undefined;
|
|
11081
|
-
}
|
|
11171
|
+
},
|
|
11172
|
+
getInnerShadowSpread: getInnerShadowSpread
|
|
11082
11173
|
};
|
|
11083
11174
|
const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
|
|
11084
11175
|
let usedGrayscaleAlpha;
|
|
@@ -11092,6 +11183,7 @@ var LeaferUI = function(exports) {
|
|
|
11092
11183
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
|
|
11093
11184
|
maskCanvas = contentCanvas = null;
|
|
11094
11185
|
}
|
|
11186
|
+
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
11095
11187
|
maskOpacity = child.__.opacity;
|
|
11096
11188
|
usedGrayscaleAlpha = false;
|
|
11097
11189
|
if (mask === "path" || mask === "clipping-path") {
|
|
@@ -11109,7 +11201,6 @@ var LeaferUI = function(exports) {
|
|
|
11109
11201
|
if (!contentCanvas) contentCanvas = getCanvas(canvas);
|
|
11110
11202
|
child.__render(maskCanvas, options);
|
|
11111
11203
|
}
|
|
11112
|
-
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
11113
11204
|
continue;
|
|
11114
11205
|
}
|
|
11115
11206
|
const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
|
|
@@ -11669,6 +11760,7 @@ var LeaferUI = function(exports) {
|
|
|
11669
11760
|
exports.Export = Export;
|
|
11670
11761
|
exports.FileHelper = FileHelper;
|
|
11671
11762
|
exports.Filter = Filter;
|
|
11763
|
+
exports.FourNumberHelper = FourNumberHelper;
|
|
11672
11764
|
exports.FrameData = FrameData;
|
|
11673
11765
|
exports.GroupData = GroupData;
|
|
11674
11766
|
exports.HitCanvasManager = HitCanvasManager;
|
|
@@ -11775,6 +11867,7 @@ var LeaferUI = function(exports) {
|
|
|
11775
11867
|
exports.defineDataProcessor = defineDataProcessor;
|
|
11776
11868
|
exports.defineKey = defineKey;
|
|
11777
11869
|
exports.defineLeafAttr = defineLeafAttr;
|
|
11870
|
+
exports.dimType = dimType;
|
|
11778
11871
|
exports.doBoundsType = doBoundsType;
|
|
11779
11872
|
exports.doStrokeType = doStrokeType;
|
|
11780
11873
|
exports.effectType = effectType;
|
|
@@ -11816,8 +11909,8 @@ var LeaferUI = function(exports) {
|
|
|
11816
11909
|
exports.sortType = sortType;
|
|
11817
11910
|
exports.strokeType = strokeType;
|
|
11818
11911
|
exports.surfaceType = surfaceType;
|
|
11819
|
-
exports.tempBounds = tempBounds$
|
|
11820
|
-
exports.tempMatrix = tempMatrix$
|
|
11912
|
+
exports.tempBounds = tempBounds$2;
|
|
11913
|
+
exports.tempMatrix = tempMatrix$2;
|
|
11821
11914
|
exports.tempPoint = tempPoint$2;
|
|
11822
11915
|
exports.tryToNumber = tryToNumber;
|
|
11823
11916
|
exports.useCanvas = useCanvas;
|