leafer-draw 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/web.cjs +117 -81
- package/dist/web.esm.js +119 -83
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +274 -181
- 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 +283 -181
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +3 -3
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);
|
|
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$8(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$8(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$8} = 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$7, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2041
|
+
const {copy: copy$7, 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 = 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$4} = 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$3} = 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$3(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$2, move: move} = PointHelper;
|
|
5622
|
+
const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
5623
|
+
const {copy: copy$2, 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
|
const debug$4 = Debug.get("LeaferCanvas");
|
|
6356
6414
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6357
6415
|
set zIndex(zIndex) {
|
|
@@ -6384,7 +6442,7 @@ var LeaferUI = function(exports) {
|
|
|
6384
6442
|
}
|
|
6385
6443
|
if (Platform.syncDomFont && !this.parentView) {
|
|
6386
6444
|
style.display = "none";
|
|
6387
|
-
document.body.appendChild(this.view);
|
|
6445
|
+
if (document.body) document.body.appendChild(this.view);
|
|
6388
6446
|
}
|
|
6389
6447
|
this.__createContext();
|
|
6390
6448
|
if (!this.autoLayout) this.resize(config);
|
|
@@ -6955,6 +7013,7 @@ var LeaferUI = function(exports) {
|
|
|
6955
7013
|
usePartRender: true,
|
|
6956
7014
|
maxFPS: 120
|
|
6957
7015
|
};
|
|
7016
|
+
this.frames = [];
|
|
6958
7017
|
this.target = target;
|
|
6959
7018
|
this.canvas = canvas;
|
|
6960
7019
|
if (userConfig) this.config = DataHelper.default(userConfig, this.config);
|
|
@@ -7084,7 +7143,7 @@ var LeaferUI = function(exports) {
|
|
|
7084
7143
|
};
|
|
7085
7144
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
7086
7145
|
if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
|
|
7087
|
-
this.target
|
|
7146
|
+
Platform.render(this.target, canvas, options);
|
|
7088
7147
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
7089
7148
|
this.renderOptions = options;
|
|
7090
7149
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
@@ -7107,12 +7166,15 @@ var LeaferUI = function(exports) {
|
|
|
7107
7166
|
const target = this.target;
|
|
7108
7167
|
if (this.requestTime || !target) return;
|
|
7109
7168
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
7110
|
-
|
|
7169
|
+
this.requestTime = this.frameTime || Date.now();
|
|
7111
7170
|
const render = () => {
|
|
7112
|
-
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
7171
|
+
const nowFPS = 1e3 / ((this.frameTime = Date.now()) - this.requestTime);
|
|
7113
7172
|
const {maxFPS: maxFPS} = this.config;
|
|
7114
|
-
if (maxFPS && nowFPS > maxFPS
|
|
7115
|
-
|
|
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);
|
|
7116
7178
|
this.requestTime = 0;
|
|
7117
7179
|
this.checkRender();
|
|
7118
7180
|
};
|
|
@@ -7173,6 +7235,14 @@ var LeaferUI = function(exports) {
|
|
|
7173
7235
|
interaction: (_target, _canvas, _selector, _options) => undefined
|
|
7174
7236
|
});
|
|
7175
7237
|
Platform.layout = Layouter.fullLayout;
|
|
7238
|
+
Platform.render = function(target, canvas, options) {
|
|
7239
|
+
const topOptions = Object.assign(Object.assign({}, options), {
|
|
7240
|
+
topRendering: true
|
|
7241
|
+
});
|
|
7242
|
+
options.topList = new LeafList;
|
|
7243
|
+
target.__render(canvas, options);
|
|
7244
|
+
if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
|
|
7245
|
+
};
|
|
7176
7246
|
function effectType(defaultValue) {
|
|
7177
7247
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
7178
7248
|
set(value) {
|
|
@@ -7534,39 +7604,40 @@ var LeaferUI = function(exports) {
|
|
|
7534
7604
|
return data;
|
|
7535
7605
|
}
|
|
7536
7606
|
}
|
|
7607
|
+
const {max: max$2, add: add$1} = FourNumberHelper;
|
|
7537
7608
|
const UIBounds = {
|
|
7538
7609
|
__updateStrokeSpread() {
|
|
7539
|
-
let
|
|
7610
|
+
let spread = 0, boxSpread = 0;
|
|
7540
7611
|
const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
|
|
7541
7612
|
if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
|
|
7542
|
-
|
|
7613
|
+
boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
|
|
7543
7614
|
if (!data.__boxStroke) {
|
|
7544
|
-
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 *
|
|
7615
|
+
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
|
|
7545
7616
|
const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
|
|
7546
|
-
|
|
7617
|
+
spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
7547
7618
|
}
|
|
7548
7619
|
}
|
|
7549
|
-
if (data.__useArrow)
|
|
7620
|
+
if (data.__useArrow) spread += strokeWidth * 5;
|
|
7550
7621
|
if (box) {
|
|
7551
|
-
|
|
7552
|
-
|
|
7622
|
+
spread = max$2(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
|
|
7623
|
+
boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
|
|
7553
7624
|
}
|
|
7554
|
-
this.__layout.strokeBoxSpread =
|
|
7555
|
-
return
|
|
7625
|
+
this.__layout.strokeBoxSpread = boxSpread;
|
|
7626
|
+
return spread;
|
|
7556
7627
|
},
|
|
7557
7628
|
__updateRenderSpread() {
|
|
7558
|
-
let
|
|
7559
|
-
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
|
|
7560
|
-
if (shadow)
|
|
7561
|
-
if (blur)
|
|
7562
|
-
if (filter)
|
|
7563
|
-
if (renderSpread)
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
if (
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
return
|
|
7629
|
+
let spread = 0;
|
|
7630
|
+
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
|
|
7631
|
+
if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
|
|
7632
|
+
if (blur) spread = max$2(spread, blur);
|
|
7633
|
+
if (filter) spread = add$1(spread, Filter.getSpread(filter));
|
|
7634
|
+
if (renderSpread) spread = add$1(spread, renderSpread);
|
|
7635
|
+
if (strokeSpread) spread = add$1(spread, strokeSpread);
|
|
7636
|
+
let shapeSpread = spread;
|
|
7637
|
+
if (innerShadow) shapeSpread = max$2(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
|
|
7638
|
+
if (backgroundBlur) shapeSpread = max$2(shapeSpread, backgroundBlur);
|
|
7639
|
+
this.__layout.renderShapeSpread = shapeSpread;
|
|
7640
|
+
return box ? max$2(box.__updateRenderSpread(), spread) : spread;
|
|
7570
7641
|
}
|
|
7571
7642
|
};
|
|
7572
7643
|
const {float: float} = MathHelper;
|
|
@@ -7890,8 +7961,8 @@ var LeaferUI = function(exports) {
|
|
|
7890
7961
|
__decorate([ opacityType(1) ], exports.UI.prototype, "opacity", void 0);
|
|
7891
7962
|
__decorate([ visibleType(true) ], exports.UI.prototype, "visible", void 0);
|
|
7892
7963
|
__decorate([ surfaceType(false) ], exports.UI.prototype, "locked", void 0);
|
|
7893
|
-
__decorate([
|
|
7894
|
-
__decorate([
|
|
7964
|
+
__decorate([ dimType(false) ], exports.UI.prototype, "dim", void 0);
|
|
7965
|
+
__decorate([ dimType(false) ], exports.UI.prototype, "dimskip", void 0);
|
|
7895
7966
|
__decorate([ sortType(0) ], exports.UI.prototype, "zIndex", void 0);
|
|
7896
7967
|
__decorate([ maskType(false) ], exports.UI.prototype, "mask", void 0);
|
|
7897
7968
|
__decorate([ eraserType(false) ], exports.UI.prototype, "eraser", void 0);
|
|
@@ -8708,7 +8779,7 @@ var LeaferUI = function(exports) {
|
|
|
8708
8779
|
__decorate([ dataType(false) ], exports.Canvas.prototype, "safeResize", void 0);
|
|
8709
8780
|
__decorate([ resizeType() ], exports.Canvas.prototype, "contextSettings", void 0);
|
|
8710
8781
|
exports.Canvas = __decorate([ registerUI() ], exports.Canvas);
|
|
8711
|
-
const {copyAndSpread: copyAndSpread, includes: includes, spread: spread, setList: setList} = BoundsHelper;
|
|
8782
|
+
const {copyAndSpread: copyAndSpread$1, includes: includes, spread: spread, setList: setList} = BoundsHelper;
|
|
8712
8783
|
exports.Text = class Text extends exports.UI {
|
|
8713
8784
|
get __tag() {
|
|
8714
8785
|
return "Text";
|
|
@@ -8754,13 +8825,13 @@ var LeaferUI = function(exports) {
|
|
|
8754
8825
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
8755
8826
|
}
|
|
8756
8827
|
__updateRenderSpread() {
|
|
8757
|
-
let
|
|
8758
|
-
if (!
|
|
8759
|
-
return
|
|
8828
|
+
let spread = super.__updateRenderSpread();
|
|
8829
|
+
if (!spread) spread = this.isOverflow ? 1 : 0;
|
|
8830
|
+
return spread;
|
|
8760
8831
|
}
|
|
8761
8832
|
__updateRenderBounds() {
|
|
8762
8833
|
const {renderBounds: renderBounds, renderSpread: renderSpread} = this.__layout;
|
|
8763
|
-
copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
8834
|
+
copyAndSpread$1(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
8764
8835
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
8765
8836
|
}
|
|
8766
8837
|
__updateChange() {
|
|
@@ -9076,23 +9147,27 @@ var LeaferUI = function(exports) {
|
|
|
9076
9147
|
out.recycle(ui.__nowWorld);
|
|
9077
9148
|
}
|
|
9078
9149
|
}
|
|
9079
|
-
const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIntersectData: getIntersectData} = BoundsHelper;
|
|
9150
|
+
const {getSpread: getSpread, copyAndSpread: copyAndSpread, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$1, getIntersectData: getIntersectData} = BoundsHelper;
|
|
9151
|
+
const tempBounds$1 = {};
|
|
9080
9152
|
function shape(ui, current, options) {
|
|
9081
9153
|
const canvas = current.getSameCanvas();
|
|
9082
|
-
const nowWorld = ui.__nowWorld,
|
|
9083
|
-
|
|
9154
|
+
const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
|
|
9155
|
+
const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
|
|
9156
|
+
toOuterOf(layout.strokeSpread ? (copyAndSpread(tempBounds$1, layout.boxBounds, layout.strokeSpread),
|
|
9157
|
+
tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
|
|
9158
|
+
let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
9084
9159
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
9085
|
-
if (currentBounds.includes(
|
|
9160
|
+
if (currentBounds.includes(nowWorldShapeBounds)) {
|
|
9086
9161
|
worldCanvas = canvas;
|
|
9087
|
-
bounds = shapeBounds =
|
|
9162
|
+
bounds = shapeBounds = nowWorldShapeBounds;
|
|
9163
|
+
renderBounds = nowWorld;
|
|
9088
9164
|
} else {
|
|
9089
|
-
const {renderShapeSpread: spread} = ui.__layout;
|
|
9090
9165
|
let worldClipBounds;
|
|
9091
9166
|
if (Platform.fullImageShadow) {
|
|
9092
|
-
worldClipBounds =
|
|
9167
|
+
worldClipBounds = nowWorldShapeBounds;
|
|
9093
9168
|
} else {
|
|
9094
|
-
const spreadBounds =
|
|
9095
|
-
worldClipBounds = getIntersectData(spreadBounds,
|
|
9169
|
+
const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
|
|
9170
|
+
worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
|
|
9096
9171
|
}
|
|
9097
9172
|
fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
|
|
9098
9173
|
let {a: fitScaleX, d: fitScaleY} = fitMatrix;
|
|
@@ -9102,8 +9177,10 @@ var LeaferUI = function(exports) {
|
|
|
9102
9177
|
scaleX *= fitScaleX;
|
|
9103
9178
|
scaleY *= fitScaleY;
|
|
9104
9179
|
}
|
|
9105
|
-
shapeBounds = getOuterOf(
|
|
9180
|
+
shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
|
|
9106
9181
|
bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
|
|
9182
|
+
renderBounds = getOuterOf(nowWorld, fitMatrix);
|
|
9183
|
+
move$1(renderBounds, -fitMatrix.e, -fitMatrix.f);
|
|
9107
9184
|
const userMatrix = options.matrix;
|
|
9108
9185
|
if (userMatrix) {
|
|
9109
9186
|
matrix = new Matrix(fitMatrix);
|
|
@@ -9122,6 +9199,7 @@ var LeaferUI = function(exports) {
|
|
|
9122
9199
|
matrix: matrix,
|
|
9123
9200
|
fitMatrix: fitMatrix,
|
|
9124
9201
|
bounds: bounds,
|
|
9202
|
+
renderBounds: renderBounds,
|
|
9125
9203
|
worldCanvas: worldCanvas,
|
|
9126
9204
|
shapeBounds: shapeBounds,
|
|
9127
9205
|
scaleX: scaleX,
|
|
@@ -9219,7 +9297,7 @@ var LeaferUI = function(exports) {
|
|
|
9219
9297
|
drawTextStroke: drawTextStroke,
|
|
9220
9298
|
shape: shape
|
|
9221
9299
|
};
|
|
9222
|
-
let origin = {}, tempMatrix = getMatrixData();
|
|
9300
|
+
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
9223
9301
|
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
9224
9302
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
9225
9303
|
const transform = get$3();
|
|
@@ -9231,12 +9309,12 @@ var LeaferUI = function(exports) {
|
|
|
9231
9309
|
}, rotation);
|
|
9232
9310
|
data.transform = transform;
|
|
9233
9311
|
}
|
|
9234
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew,
|
|
9312
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
9235
9313
|
const transform = get$3();
|
|
9236
9314
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
9237
|
-
if (
|
|
9238
|
-
tempMatrix.a =
|
|
9239
|
-
multiplyParent(transform, tempMatrix);
|
|
9315
|
+
if (clipScaleX) {
|
|
9316
|
+
tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
|
|
9317
|
+
multiplyParent(transform, tempMatrix$1);
|
|
9240
9318
|
}
|
|
9241
9319
|
data.transform = transform;
|
|
9242
9320
|
}
|
|
@@ -9329,7 +9407,12 @@ var LeaferUI = function(exports) {
|
|
|
9329
9407
|
|
|
9330
9408
|
case "normal":
|
|
9331
9409
|
case "clip":
|
|
9332
|
-
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
9410
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
|
|
9411
|
+
let clipScaleX, clipScaleY;
|
|
9412
|
+
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
9413
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
9414
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
9415
|
+
}
|
|
9333
9416
|
break;
|
|
9334
9417
|
|
|
9335
9418
|
case "repeat":
|
|
@@ -9474,7 +9557,7 @@ var LeaferUI = function(exports) {
|
|
|
9474
9557
|
if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
|
|
9475
9558
|
}
|
|
9476
9559
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
9477
|
-
const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
|
|
9560
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
9478
9561
|
function createPattern(ui, paint, pixelRatio) {
|
|
9479
9562
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
9480
9563
|
const id = scaleX + "-" + scaleY + "-" + pixelRatio;
|
|
@@ -9522,8 +9605,8 @@ var LeaferUI = function(exports) {
|
|
|
9522
9605
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
9523
9606
|
const canvasWidth = width + (xGap || 0);
|
|
9524
9607
|
const canvasHeight = height + (yGap || 0);
|
|
9525
|
-
scaleX /= canvasWidth / max(floor(canvasWidth), 1);
|
|
9526
|
-
scaleY /= canvasHeight / max(floor(canvasHeight), 1);
|
|
9608
|
+
scaleX /= canvasWidth / max$1(floor(canvasWidth), 1);
|
|
9609
|
+
scaleY /= canvasHeight / max$1(floor(canvasHeight), 1);
|
|
9527
9610
|
if (!imageMatrix) {
|
|
9528
9611
|
imageMatrix = get$1();
|
|
9529
9612
|
if (transform) copy$1(imageMatrix, transform);
|
|
@@ -9548,17 +9631,15 @@ var LeaferUI = function(exports) {
|
|
|
9548
9631
|
if (allowDraw) {
|
|
9549
9632
|
if (data.repeat) {
|
|
9550
9633
|
allowDraw = false;
|
|
9551
|
-
} else {
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
height *= data.scaleY;
|
|
9559
|
-
}
|
|
9560
|
-
allowDraw = width * height > Platform.image.maxCacheSize;
|
|
9634
|
+
} else if (!(paint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || Export.running)) {
|
|
9635
|
+
let {width: width, height: height} = data;
|
|
9636
|
+
width *= scaleX * pixelRatio;
|
|
9637
|
+
height *= scaleY * pixelRatio;
|
|
9638
|
+
if (data.scaleX) {
|
|
9639
|
+
width *= data.scaleX;
|
|
9640
|
+
height *= data.scaleY;
|
|
9561
9641
|
}
|
|
9642
|
+
allowDraw = width * height > Platform.image.maxCacheSize;
|
|
9562
9643
|
}
|
|
9563
9644
|
}
|
|
9564
9645
|
if (allowDraw) {
|
|
@@ -9716,17 +9797,17 @@ var LeaferUI = function(exports) {
|
|
|
9716
9797
|
conicGradient: conicGradient,
|
|
9717
9798
|
getTransform: getTransform
|
|
9718
9799
|
};
|
|
9719
|
-
const {copy: copy, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper;
|
|
9720
|
-
const tempBounds = {};
|
|
9800
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
9801
|
+
const tempBounds = {}, tempMatrix = new Matrix;
|
|
9721
9802
|
const offsetOutBounds$1 = {};
|
|
9722
9803
|
function shadow(ui, current, shape) {
|
|
9723
|
-
let copyBounds,
|
|
9724
|
-
const {__nowWorld: nowWorld
|
|
9804
|
+
let copyBounds, transform;
|
|
9805
|
+
const {__nowWorld: nowWorld} = ui;
|
|
9725
9806
|
const {shadow: shadow} = ui.__;
|
|
9726
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
9807
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
9727
9808
|
const other = current.getSameCanvas();
|
|
9728
9809
|
const end = shadow.length - 1;
|
|
9729
|
-
toOffsetOutBounds$1(bounds, offsetOutBounds$1);
|
|
9810
|
+
toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
|
|
9730
9811
|
shadow.forEach((item, index) => {
|
|
9731
9812
|
let otherScale = 1;
|
|
9732
9813
|
if (item.scaleFixed) {
|
|
@@ -9734,63 +9815,69 @@ var LeaferUI = function(exports) {
|
|
|
9734
9815
|
if (sx > 1) otherScale = 1 / sx;
|
|
9735
9816
|
}
|
|
9736
9817
|
other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, ColorConvert.string(item.color));
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9818
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
9819
|
+
if (transform) other.setTransform(transform);
|
|
9820
|
+
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
9821
|
+
if (transform) other.resetTransform();
|
|
9822
|
+
copyBounds = renderBounds;
|
|
9740
9823
|
if (item.box) {
|
|
9741
9824
|
other.restore();
|
|
9742
9825
|
other.save();
|
|
9743
9826
|
if (worldCanvas) {
|
|
9744
|
-
other.copyWorld(other,
|
|
9827
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
9745
9828
|
copyBounds = nowWorld;
|
|
9746
9829
|
}
|
|
9747
9830
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
9748
9831
|
}
|
|
9749
|
-
|
|
9832
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
9750
9833
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
9751
9834
|
});
|
|
9752
9835
|
other.recycle(copyBounds);
|
|
9753
9836
|
}
|
|
9754
|
-
function
|
|
9755
|
-
let
|
|
9756
|
-
shadow.forEach(item =>
|
|
9757
|
-
|
|
9837
|
+
function getShadowRenderSpread(_ui, shadow) {
|
|
9838
|
+
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
9839
|
+
shadow.forEach(item => {
|
|
9840
|
+
x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
|
|
9841
|
+
top = max(top, spread + blur - y);
|
|
9842
|
+
right = max(right, spread + blur + x);
|
|
9843
|
+
bottom = max(bottom, spread + blur + y);
|
|
9844
|
+
left = max(left, spread + blur - x);
|
|
9845
|
+
});
|
|
9846
|
+
return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
|
|
9847
|
+
}
|
|
9848
|
+
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
9849
|
+
if (shadow.spread) {
|
|
9850
|
+
const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
|
|
9851
|
+
tempMatrix.set().scaleOfOuter({
|
|
9852
|
+
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
9853
|
+
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
9854
|
+
}, spreadScale);
|
|
9855
|
+
return tempMatrix;
|
|
9856
|
+
}
|
|
9857
|
+
return undefined;
|
|
9758
9858
|
}
|
|
9759
|
-
function drawWorldShadow(canvas, outBounds,
|
|
9760
|
-
const {
|
|
9859
|
+
function drawWorldShadow(canvas, outBounds, shape) {
|
|
9860
|
+
const {shapeBounds: shapeBounds} = shape;
|
|
9861
|
+
let from, to;
|
|
9761
9862
|
if (Platform.fullImageShadow) {
|
|
9762
9863
|
copy(tempBounds, canvas.bounds);
|
|
9763
|
-
tempBounds.x
|
|
9764
|
-
|
|
9765
|
-
if (spreadScale) {
|
|
9766
|
-
const {fitMatrix: fitMatrix} = shape;
|
|
9767
|
-
tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
|
|
9768
|
-
tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
|
|
9769
|
-
tempBounds.width *= spreadScale;
|
|
9770
|
-
tempBounds.height *= spreadScale;
|
|
9771
|
-
}
|
|
9772
|
-
canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
|
|
9864
|
+
move(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
9865
|
+
from = canvas.bounds, to = tempBounds;
|
|
9773
9866
|
} else {
|
|
9774
|
-
|
|
9775
|
-
copy(tempBounds, outBounds);
|
|
9776
|
-
tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
|
|
9777
|
-
tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
|
|
9778
|
-
tempBounds.width *= spreadScale;
|
|
9779
|
-
tempBounds.height *= spreadScale;
|
|
9780
|
-
}
|
|
9781
|
-
canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
|
|
9867
|
+
from = shapeBounds, to = outBounds;
|
|
9782
9868
|
}
|
|
9869
|
+
canvas.copyWorld(shape.canvas, from, to);
|
|
9783
9870
|
}
|
|
9784
9871
|
const {toOffsetOutBounds: toOffsetOutBounds} = BoundsHelper;
|
|
9785
9872
|
const offsetOutBounds = {};
|
|
9786
9873
|
function innerShadow(ui, current, shape) {
|
|
9787
|
-
let copyBounds,
|
|
9788
|
-
const {__nowWorld: nowWorld
|
|
9874
|
+
let copyBounds, transform;
|
|
9875
|
+
const {__nowWorld: nowWorld} = ui;
|
|
9789
9876
|
const {innerShadow: innerShadow} = ui.__;
|
|
9790
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
9877
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
9791
9878
|
const other = current.getSameCanvas();
|
|
9792
9879
|
const end = innerShadow.length - 1;
|
|
9793
|
-
toOffsetOutBounds(bounds, offsetOutBounds);
|
|
9880
|
+
toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
|
|
9794
9881
|
innerShadow.forEach((item, index) => {
|
|
9795
9882
|
let otherScale = 1;
|
|
9796
9883
|
if (item.scaleFixed) {
|
|
@@ -9799,16 +9886,17 @@ var LeaferUI = function(exports) {
|
|
|
9799
9886
|
}
|
|
9800
9887
|
other.save();
|
|
9801
9888
|
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
9802
|
-
|
|
9803
|
-
|
|
9889
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
9890
|
+
if (transform) other.setTransform(transform);
|
|
9891
|
+
drawWorldShadow(other, offsetOutBounds, shape);
|
|
9804
9892
|
other.restore();
|
|
9805
9893
|
if (worldCanvas) {
|
|
9806
|
-
other.copyWorld(other,
|
|
9894
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
9807
9895
|
other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
|
|
9808
9896
|
copyBounds = nowWorld;
|
|
9809
9897
|
} else {
|
|
9810
9898
|
other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
|
|
9811
|
-
copyBounds =
|
|
9899
|
+
copyBounds = renderBounds;
|
|
9812
9900
|
}
|
|
9813
9901
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
|
|
9814
9902
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
@@ -9816,6 +9904,7 @@ var LeaferUI = function(exports) {
|
|
|
9816
9904
|
});
|
|
9817
9905
|
other.recycle(copyBounds);
|
|
9818
9906
|
}
|
|
9907
|
+
const getInnerShadowSpread = getShadowRenderSpread;
|
|
9819
9908
|
function blur(ui, current, origin) {
|
|
9820
9909
|
const {blur: blur} = ui.__;
|
|
9821
9910
|
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
@@ -9828,10 +9917,12 @@ var LeaferUI = function(exports) {
|
|
|
9828
9917
|
innerShadow: innerShadow,
|
|
9829
9918
|
blur: blur,
|
|
9830
9919
|
backgroundBlur: backgroundBlur,
|
|
9831
|
-
|
|
9920
|
+
getShadowRenderSpread: getShadowRenderSpread,
|
|
9921
|
+
getShadowTransform: getShadowTransform,
|
|
9832
9922
|
isTransformShadow(_shadow) {
|
|
9833
9923
|
return undefined;
|
|
9834
|
-
}
|
|
9924
|
+
},
|
|
9925
|
+
getInnerShadowSpread: getInnerShadowSpread
|
|
9835
9926
|
};
|
|
9836
9927
|
const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
|
|
9837
9928
|
let usedGrayscaleAlpha;
|
|
@@ -9845,6 +9936,7 @@ var LeaferUI = function(exports) {
|
|
|
9845
9936
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
|
|
9846
9937
|
maskCanvas = contentCanvas = null;
|
|
9847
9938
|
}
|
|
9939
|
+
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
9848
9940
|
maskOpacity = child.__.opacity;
|
|
9849
9941
|
usedGrayscaleAlpha = false;
|
|
9850
9942
|
if (mask === "path" || mask === "clipping-path") {
|
|
@@ -9862,7 +9954,6 @@ var LeaferUI = function(exports) {
|
|
|
9862
9954
|
if (!contentCanvas) contentCanvas = getCanvas(canvas);
|
|
9863
9955
|
child.__render(maskCanvas, options);
|
|
9864
9956
|
}
|
|
9865
|
-
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
9866
9957
|
continue;
|
|
9867
9958
|
}
|
|
9868
9959
|
const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
|
|
@@ -10415,6 +10506,7 @@ var LeaferUI = function(exports) {
|
|
|
10415
10506
|
exports.Export = Export;
|
|
10416
10507
|
exports.FileHelper = FileHelper;
|
|
10417
10508
|
exports.Filter = Filter;
|
|
10509
|
+
exports.FourNumberHelper = FourNumberHelper;
|
|
10418
10510
|
exports.FrameData = FrameData;
|
|
10419
10511
|
exports.GroupData = GroupData;
|
|
10420
10512
|
exports.ImageData = ImageData;
|
|
@@ -10511,6 +10603,7 @@ var LeaferUI = function(exports) {
|
|
|
10511
10603
|
exports.defineDataProcessor = defineDataProcessor;
|
|
10512
10604
|
exports.defineKey = defineKey;
|
|
10513
10605
|
exports.defineLeafAttr = defineLeafAttr;
|
|
10606
|
+
exports.dimType = dimType;
|
|
10514
10607
|
exports.doBoundsType = doBoundsType;
|
|
10515
10608
|
exports.doStrokeType = doStrokeType;
|
|
10516
10609
|
exports.effectType = effectType;
|
|
@@ -10552,8 +10645,8 @@ var LeaferUI = function(exports) {
|
|
|
10552
10645
|
exports.sortType = sortType;
|
|
10553
10646
|
exports.strokeType = strokeType;
|
|
10554
10647
|
exports.surfaceType = surfaceType;
|
|
10555
|
-
exports.tempBounds = tempBounds$
|
|
10556
|
-
exports.tempMatrix = tempMatrix$
|
|
10648
|
+
exports.tempBounds = tempBounds$2;
|
|
10649
|
+
exports.tempMatrix = tempMatrix$2;
|
|
10557
10650
|
exports.tempPoint = tempPoint$2;
|
|
10558
10651
|
exports.tryToNumber = tryToNumber;
|
|
10559
10652
|
exports.useCanvas = useCanvas;
|