leafer-ui 1.9.9 → 1.9.11
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 +46 -23
- package/dist/web.esm.js +46 -23
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +189 -131
- 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 +194 -135
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/web.module.js
CHANGED
|
@@ -249,7 +249,7 @@ class LeafData {
|
|
|
249
249
|
|
|
250
250
|
let tempA, tempB, tempTo;
|
|
251
251
|
|
|
252
|
-
const {max: max$
|
|
252
|
+
const {max: max$5} = Math, tempFour = [ 0, 0, 0, 0 ];
|
|
253
253
|
|
|
254
254
|
const FourNumberHelper = {
|
|
255
255
|
zero: [ ...tempFour ],
|
|
@@ -263,7 +263,7 @@ const FourNumberHelper = {
|
|
|
263
263
|
return to;
|
|
264
264
|
},
|
|
265
265
|
setTemp(top, right, bottom, left) {
|
|
266
|
-
return set$
|
|
266
|
+
return set$2(tempFour, top, right, bottom, left);
|
|
267
267
|
},
|
|
268
268
|
toTempAB(a, b, change) {
|
|
269
269
|
tempTo = change ? isNumber(a) ? b : a : [];
|
|
@@ -301,24 +301,24 @@ const FourNumberHelper = {
|
|
|
301
301
|
return data;
|
|
302
302
|
},
|
|
303
303
|
max(t, other, change) {
|
|
304
|
-
if (isNumber(t) && isNumber(other)) return max$
|
|
304
|
+
if (isNumber(t) && isNumber(other)) return max$5(t, other);
|
|
305
305
|
toTempAB(t, other, change);
|
|
306
|
-
return set$
|
|
306
|
+
return set$2(tempTo, max$5(tempA[0], tempB[0]), max$5(tempA[1], tempB[1]), max$5(tempA[2], tempB[2]), max$5(tempA[3], tempB[3]));
|
|
307
307
|
},
|
|
308
308
|
add(t, other, change) {
|
|
309
309
|
if (isNumber(t) && isNumber(other)) return t + other;
|
|
310
310
|
toTempAB(t, other, change);
|
|
311
|
-
return set$
|
|
311
|
+
return set$2(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
|
|
312
312
|
},
|
|
313
313
|
swapAndScale(t, scaleX, scaleY, change) {
|
|
314
314
|
if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
|
|
315
315
|
const to = change ? t : [];
|
|
316
316
|
const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
|
|
317
|
-
return set$
|
|
317
|
+
return set$2(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
|
|
318
318
|
}
|
|
319
319
|
};
|
|
320
320
|
|
|
321
|
-
const {set: set$
|
|
321
|
+
const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
322
322
|
|
|
323
323
|
const {round: round$3, pow: pow$1, PI: PI$3} = Math;
|
|
324
324
|
|
|
@@ -720,7 +720,7 @@ const M$6 = MatrixHelper;
|
|
|
720
720
|
|
|
721
721
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
722
722
|
|
|
723
|
-
const {sin: sin$4, cos: cos$4, abs: abs$
|
|
723
|
+
const {sin: sin$4, cos: cos$4, abs: abs$5, sqrt: sqrt$2, atan2: atan2$2, min: min$2, round: round$2} = Math;
|
|
724
724
|
|
|
725
725
|
const PointHelper = {
|
|
726
726
|
defaultPoint: getPointData(),
|
|
@@ -813,12 +813,12 @@ const PointHelper = {
|
|
|
813
813
|
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
814
814
|
},
|
|
815
815
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
816
|
-
const x = abs$
|
|
817
|
-
const y = abs$
|
|
816
|
+
const x = abs$5(x2 - x1);
|
|
817
|
+
const y = abs$5(y2 - y1);
|
|
818
818
|
return sqrt$2(x * x + y * y);
|
|
819
819
|
},
|
|
820
820
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
821
|
-
return min$
|
|
821
|
+
return min$2(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
|
|
822
822
|
},
|
|
823
823
|
getAngle(t, to) {
|
|
824
824
|
return getAtan2(t, to) / OneRadian;
|
|
@@ -2592,11 +2592,11 @@ const RectHelper = {
|
|
|
2592
2592
|
}
|
|
2593
2593
|
};
|
|
2594
2594
|
|
|
2595
|
-
const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs: abs$
|
|
2595
|
+
const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs: abs$4, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
|
|
2596
2596
|
|
|
2597
2597
|
const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
|
|
2598
2598
|
|
|
2599
|
-
const {set: set, toNumberPoints: toNumberPoints} = PointHelper;
|
|
2599
|
+
const {set: set$1, toNumberPoints: toNumberPoints} = PointHelper;
|
|
2600
2600
|
|
|
2601
2601
|
const {M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5} = PathCommandMap;
|
|
2602
2602
|
|
|
@@ -2667,14 +2667,14 @@ const BezierHelper = {
|
|
|
2667
2667
|
const lenCB = hypot(CBx, CBy);
|
|
2668
2668
|
let totalRadian = endRadian - startRadian;
|
|
2669
2669
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2670
|
-
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$
|
|
2670
|
+
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$4(totalRadian - PI$2) < 1e-12) {
|
|
2671
2671
|
if (data) data.push(L$6, x1, y1);
|
|
2672
2672
|
if (setPointBounds) {
|
|
2673
2673
|
setPoint$1(setPointBounds, fromX, fromY);
|
|
2674
2674
|
addPoint$1(setPointBounds, x1, y1);
|
|
2675
2675
|
}
|
|
2676
|
-
if (setStartPoint) set(setStartPoint, fromX, fromY);
|
|
2677
|
-
if (setEndPoint) set(setEndPoint, x1, y1);
|
|
2676
|
+
if (setStartPoint) set$1(setStartPoint, fromX, fromY);
|
|
2677
|
+
if (setEndPoint) set$1(setEndPoint, x1, y1);
|
|
2678
2678
|
return;
|
|
2679
2679
|
}
|
|
2680
2680
|
const anticlockwise = BAx * CBy - CBx * BAy < 0;
|
|
@@ -2700,7 +2700,7 @@ const BezierHelper = {
|
|
|
2700
2700
|
let totalRadian = endRadian - startRadian;
|
|
2701
2701
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2702
2702
|
if (anticlockwise) totalRadian -= PI2;
|
|
2703
|
-
const parts = ceil$1(abs$
|
|
2703
|
+
const parts = ceil$1(abs$4(totalRadian / PI_2));
|
|
2704
2704
|
const partRadian = totalRadian / parts;
|
|
2705
2705
|
const partRadian4Sin = sin$3(partRadian / 4);
|
|
2706
2706
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
|
|
@@ -2714,7 +2714,7 @@ const BezierHelper = {
|
|
|
2714
2714
|
let fromX = cx + x, fromY = cy + y;
|
|
2715
2715
|
if (data) data.push(data.length ? L$6 : M$5, fromX, fromY);
|
|
2716
2716
|
if (setPointBounds) setPoint$1(setPointBounds, fromX, fromY);
|
|
2717
|
-
if (setStartPoint) set(setStartPoint, fromX, fromY);
|
|
2717
|
+
if (setStartPoint) set$1(setStartPoint, fromX, fromY);
|
|
2718
2718
|
for (let i = 0; i < parts; i++) {
|
|
2719
2719
|
endCos = cos$3(endRadian);
|
|
2720
2720
|
endSin = sin$3(endRadian);
|
|
@@ -2733,7 +2733,7 @@ const BezierHelper = {
|
|
|
2733
2733
|
startRadian = endRadian;
|
|
2734
2734
|
endRadian += partRadian;
|
|
2735
2735
|
}
|
|
2736
|
-
if (setEndPoint) set(setEndPoint, cx + x, cy + y);
|
|
2736
|
+
if (setEndPoint) set$1(setEndPoint, cx + x, cy + y);
|
|
2737
2737
|
},
|
|
2738
2738
|
quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
|
|
2739
2739
|
data.push(C$4, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
|
|
@@ -3167,7 +3167,7 @@ const {M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$3, X: X$2, G: G$2, F
|
|
|
3167
3167
|
|
|
3168
3168
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
3169
3169
|
|
|
3170
|
-
const {tan: tan, min: min, abs: abs$
|
|
3170
|
+
const {tan: tan, min: min$1, abs: abs$3} = Math;
|
|
3171
3171
|
|
|
3172
3172
|
const startPoint = {};
|
|
3173
3173
|
|
|
@@ -3225,7 +3225,7 @@ const PathCommandDataHelper = {
|
|
|
3225
3225
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3226
3226
|
if (!isUndefined(lastX)) {
|
|
3227
3227
|
const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
|
|
3228
|
-
radius = min(radius, min(d / 2, d / 2 * abs$
|
|
3228
|
+
radius = min$1(radius, min$1(d / 2, d / 2 * abs$3(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3229
3229
|
}
|
|
3230
3230
|
data.push(U$2, x1, y1, x2, y2, radius);
|
|
3231
3231
|
},
|
|
@@ -3840,7 +3840,12 @@ class TaskProcessor {
|
|
|
3840
3840
|
runTask() {
|
|
3841
3841
|
const task = this.list[this.index];
|
|
3842
3842
|
if (!task) {
|
|
3843
|
-
this.nextTask();
|
|
3843
|
+
this.timer = setTimeout(() => this.nextTask());
|
|
3844
|
+
return;
|
|
3845
|
+
}
|
|
3846
|
+
if (task.isCancel) {
|
|
3847
|
+
this.index++;
|
|
3848
|
+
this.runTask();
|
|
3844
3849
|
return;
|
|
3845
3850
|
}
|
|
3846
3851
|
task.run().then(() => {
|
|
@@ -3871,16 +3876,15 @@ class TaskProcessor {
|
|
|
3871
3876
|
}
|
|
3872
3877
|
setParallelList() {
|
|
3873
3878
|
let task;
|
|
3879
|
+
const {config: config, list: list, index: index} = this;
|
|
3874
3880
|
this.parallelList = [];
|
|
3875
3881
|
this.parallelSuccessNumber = 0;
|
|
3876
|
-
let end =
|
|
3877
|
-
if (end >
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
this.parallelList.push(task);
|
|
3882
|
-
} else {
|
|
3883
|
-
break;
|
|
3882
|
+
let end = index + config.parallel;
|
|
3883
|
+
if (end > list.length) end = list.length;
|
|
3884
|
+
if (config.parallel > 1) {
|
|
3885
|
+
for (let i = index; i < end; i++) {
|
|
3886
|
+
task = list[i];
|
|
3887
|
+
if (task.parallel) this.parallelList.push(task); else break;
|
|
3884
3888
|
}
|
|
3885
3889
|
}
|
|
3886
3890
|
}
|
|
@@ -4023,7 +4027,7 @@ const I$1 = ImageManager;
|
|
|
4023
4027
|
|
|
4024
4028
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
4025
4029
|
|
|
4026
|
-
const {floor: floor$1, max: max$
|
|
4030
|
+
const {floor: floor$1, max: max$4} = Math;
|
|
4027
4031
|
|
|
4028
4032
|
class LeaferImage {
|
|
4029
4033
|
get url() {
|
|
@@ -4112,7 +4116,7 @@ class LeaferImage {
|
|
|
4112
4116
|
}
|
|
4113
4117
|
if (data) return data;
|
|
4114
4118
|
}
|
|
4115
|
-
const canvas = Platform.origin.createCanvas(max$
|
|
4119
|
+
const canvas = Platform.origin.createCanvas(max$4(floor$1(width + (xGap || 0)), 1), max$4(floor$1(height + (yGap || 0)), 1));
|
|
4116
4120
|
const ctx = canvas.getContext("2d");
|
|
4117
4121
|
if (opacity) ctx.globalAlpha = opacity;
|
|
4118
4122
|
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
@@ -6815,7 +6819,7 @@ class LeafLevelList {
|
|
|
6815
6819
|
}
|
|
6816
6820
|
}
|
|
6817
6821
|
|
|
6818
|
-
const version = "1.9.
|
|
6822
|
+
const version = "1.9.11";
|
|
6819
6823
|
|
|
6820
6824
|
const debug$5 = Debug.get("LeaferCanvas");
|
|
6821
6825
|
|
|
@@ -7687,7 +7691,7 @@ class Picker {
|
|
|
7687
7691
|
children: [ target ]
|
|
7688
7692
|
} : target);
|
|
7689
7693
|
const {list: list} = this.findList;
|
|
7690
|
-
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable);
|
|
7694
|
+
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable, !!options.findList);
|
|
7691
7695
|
const path = ignoreHittable ? this.getPath(leaf) : this.getHitablePath(leaf);
|
|
7692
7696
|
this.clear();
|
|
7693
7697
|
return through ? {
|
|
@@ -7702,7 +7706,7 @@ class Picker {
|
|
|
7702
7706
|
hitPoint(hitPoint, hitRadius, options) {
|
|
7703
7707
|
return !!this.getByPoint(hitPoint, hitRadius, options).target;
|
|
7704
7708
|
}
|
|
7705
|
-
getBestMatchLeaf(list, bottomList, ignoreHittable) {
|
|
7709
|
+
getBestMatchLeaf(list, bottomList, ignoreHittable, allowNull) {
|
|
7706
7710
|
const findList = this.findList = new LeafList;
|
|
7707
7711
|
if (list.length) {
|
|
7708
7712
|
let find;
|
|
@@ -7733,15 +7737,27 @@ class Picker {
|
|
|
7733
7737
|
if (findList.length) return findList.list[0];
|
|
7734
7738
|
}
|
|
7735
7739
|
}
|
|
7740
|
+
if (allowNull) return null;
|
|
7736
7741
|
return ignoreHittable ? list[0] : list.find(item => LeafHelper.worldHittable(item));
|
|
7737
7742
|
}
|
|
7738
7743
|
getPath(leaf) {
|
|
7739
|
-
const path = new LeafList;
|
|
7744
|
+
const path = new LeafList, syncList = [], {target: target} = this;
|
|
7740
7745
|
while (leaf) {
|
|
7746
|
+
if (leaf.syncEventer) syncList.push(leaf.syncEventer);
|
|
7741
7747
|
path.add(leaf);
|
|
7742
7748
|
leaf = leaf.parent;
|
|
7749
|
+
if (leaf === target) break;
|
|
7750
|
+
}
|
|
7751
|
+
if (syncList.length) {
|
|
7752
|
+
syncList.forEach(item => {
|
|
7753
|
+
while (item) {
|
|
7754
|
+
if (item.__.hittable) path.add(item);
|
|
7755
|
+
item = item.parent;
|
|
7756
|
+
if (item === target) break;
|
|
7757
|
+
}
|
|
7758
|
+
});
|
|
7743
7759
|
}
|
|
7744
|
-
if (
|
|
7760
|
+
if (target) path.add(target);
|
|
7745
7761
|
return path;
|
|
7746
7762
|
}
|
|
7747
7763
|
getHitablePath(leaf) {
|
|
@@ -8239,12 +8255,12 @@ class ImageData extends RectData {
|
|
|
8239
8255
|
}
|
|
8240
8256
|
__getData() {
|
|
8241
8257
|
const data = super.__getData();
|
|
8242
|
-
delete data.fill;
|
|
8258
|
+
if (data.url) delete data.fill;
|
|
8243
8259
|
return data;
|
|
8244
8260
|
}
|
|
8245
8261
|
__getInputData(names, options) {
|
|
8246
8262
|
const data = super.__getInputData(names, options);
|
|
8247
|
-
delete data.fill;
|
|
8263
|
+
if (data.url) delete data.fill;
|
|
8248
8264
|
return data;
|
|
8249
8265
|
}
|
|
8250
8266
|
}
|
|
@@ -8263,7 +8279,7 @@ class CanvasData extends RectData {
|
|
|
8263
8279
|
}
|
|
8264
8280
|
}
|
|
8265
8281
|
|
|
8266
|
-
const {max: max$
|
|
8282
|
+
const {max: max$3, add: add$1} = FourNumberHelper;
|
|
8267
8283
|
|
|
8268
8284
|
const UIBounds = {
|
|
8269
8285
|
__updateStrokeSpread() {
|
|
@@ -8279,7 +8295,7 @@ const UIBounds = {
|
|
|
8279
8295
|
}
|
|
8280
8296
|
if (data.__useArrow) spread += strokeWidth * 5;
|
|
8281
8297
|
if (box) {
|
|
8282
|
-
spread = max$
|
|
8298
|
+
spread = max$3(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
|
|
8283
8299
|
boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
|
|
8284
8300
|
}
|
|
8285
8301
|
this.__layout.strokeBoxSpread = boxSpread;
|
|
@@ -8289,86 +8305,18 @@ const UIBounds = {
|
|
|
8289
8305
|
let spread = 0;
|
|
8290
8306
|
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
|
|
8291
8307
|
if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
|
|
8292
|
-
if (blur) spread = max$
|
|
8308
|
+
if (blur) spread = max$3(spread, blur);
|
|
8293
8309
|
if (filter) spread = add$1(spread, Filter.getSpread(filter));
|
|
8294
8310
|
if (renderSpread) spread = add$1(spread, renderSpread);
|
|
8295
8311
|
if (strokeSpread) spread = add$1(spread, strokeSpread);
|
|
8296
8312
|
let shapeSpread = spread;
|
|
8297
|
-
if (innerShadow) shapeSpread = max$
|
|
8298
|
-
if (backgroundBlur) shapeSpread = max$
|
|
8313
|
+
if (innerShadow) shapeSpread = max$3(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
|
|
8314
|
+
if (backgroundBlur) shapeSpread = max$3(shapeSpread, backgroundBlur);
|
|
8299
8315
|
this.__layout.renderShapeSpread = shapeSpread;
|
|
8300
|
-
return box ? max$
|
|
8301
|
-
}
|
|
8302
|
-
};
|
|
8303
|
-
|
|
8304
|
-
const {float: float} = MathHelper;
|
|
8305
|
-
|
|
8306
|
-
const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
|
|
8307
|
-
|
|
8308
|
-
const DragBoundsHelper = {
|
|
8309
|
-
limitMove(leaf, move) {
|
|
8310
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8311
|
-
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
|
|
8312
|
-
D.axisMove(leaf, move);
|
|
8313
|
-
},
|
|
8314
|
-
limitScaleOf(leaf, origin, scale) {
|
|
8315
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8316
|
-
if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
|
|
8317
|
-
},
|
|
8318
|
-
axisMove(leaf, move) {
|
|
8319
|
-
const {draggable: draggable} = leaf;
|
|
8320
|
-
if (draggable === "x") move.y = 0;
|
|
8321
|
-
if (draggable === "y") move.x = 0;
|
|
8322
|
-
},
|
|
8323
|
-
getDragBounds(leaf) {
|
|
8324
|
-
const {dragBounds: dragBounds} = leaf;
|
|
8325
|
-
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
8326
|
-
},
|
|
8327
|
-
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
8328
|
-
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
8329
|
-
},
|
|
8330
|
-
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
8331
|
-
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
8332
|
-
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
8333
|
-
if (!change) move = Object.assign({}, move);
|
|
8334
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
8335
|
-
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
8336
|
-
} else {
|
|
8337
|
-
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
8338
|
-
}
|
|
8339
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
8340
|
-
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
8341
|
-
} else {
|
|
8342
|
-
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
8343
|
-
}
|
|
8344
|
-
move.x = float(move.x);
|
|
8345
|
-
move.y = float(move.y);
|
|
8346
|
-
return move;
|
|
8347
|
-
},
|
|
8348
|
-
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
|
|
8349
|
-
if (!change) scale = Object.assign({}, scale);
|
|
8350
|
-
let fitScaleX, fitScaleY;
|
|
8351
|
-
tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
|
|
8352
|
-
tempMerge.set(tempContent).add(dragBounds);
|
|
8353
|
-
tempIntersect.set(tempContent).intersect(dragBounds);
|
|
8354
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
8355
|
-
fitScaleX = tempMerge.width / tempContent.width;
|
|
8356
|
-
} else {
|
|
8357
|
-
fitScaleX = tempIntersect.width / tempContent.width;
|
|
8358
|
-
}
|
|
8359
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
8360
|
-
fitScaleY = tempMerge.height / tempContent.height;
|
|
8361
|
-
} else {
|
|
8362
|
-
fitScaleY = tempIntersect.height / tempContent.height;
|
|
8363
|
-
}
|
|
8364
|
-
scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
8365
|
-
scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
8366
|
-
return scale;
|
|
8316
|
+
return box ? max$3(box.__updateRenderSpread(), spread) : spread;
|
|
8367
8317
|
}
|
|
8368
8318
|
};
|
|
8369
8319
|
|
|
8370
|
-
const D = DragBoundsHelper;
|
|
8371
|
-
|
|
8372
8320
|
const {stintSet: stintSet$1} = DataHelper;
|
|
8373
8321
|
|
|
8374
8322
|
const UIRender = {
|
|
@@ -10034,6 +9982,106 @@ class UIEvent extends Event {
|
|
|
10034
9982
|
}
|
|
10035
9983
|
}
|
|
10036
9984
|
|
|
9985
|
+
const {min: min, max: max$2, abs: abs$2} = Math, {float: float, sign: sign} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
|
|
9986
|
+
|
|
9987
|
+
const tempContent = new Bounds, tempDragBounds = new Bounds;
|
|
9988
|
+
|
|
9989
|
+
const DragBoundsHelper = {
|
|
9990
|
+
limitMove(leaf, move) {
|
|
9991
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
9992
|
+
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
|
|
9993
|
+
D.axisMove(leaf, move);
|
|
9994
|
+
},
|
|
9995
|
+
limitScaleOf(leaf, origin, scale, lockRatio) {
|
|
9996
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
9997
|
+
if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, lockRatio, true);
|
|
9998
|
+
},
|
|
9999
|
+
axisMove(leaf, move) {
|
|
10000
|
+
const {draggable: draggable} = leaf;
|
|
10001
|
+
if (draggable === "x") move.y = 0;
|
|
10002
|
+
if (draggable === "y") move.x = 0;
|
|
10003
|
+
},
|
|
10004
|
+
getDragBounds(leaf) {
|
|
10005
|
+
const {dragBounds: dragBounds} = leaf;
|
|
10006
|
+
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
10007
|
+
},
|
|
10008
|
+
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
10009
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
10010
|
+
},
|
|
10011
|
+
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
10012
|
+
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
10013
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
10014
|
+
if (!change) move = Object.assign({}, move);
|
|
10015
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
10016
|
+
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
10017
|
+
} else {
|
|
10018
|
+
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
10019
|
+
}
|
|
10020
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
10021
|
+
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
10022
|
+
} else {
|
|
10023
|
+
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
10024
|
+
}
|
|
10025
|
+
move.x = float(move.x);
|
|
10026
|
+
move.y = float(move.y);
|
|
10027
|
+
return move;
|
|
10028
|
+
},
|
|
10029
|
+
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, lockRatio, change) {
|
|
10030
|
+
if (!change) scale = Object.assign({}, scale);
|
|
10031
|
+
tempDragBounds.set(dragBounds);
|
|
10032
|
+
tempContent.set(content).scaleOf(origin, scale.x, scale.y);
|
|
10033
|
+
const originLeftScale = (origin.x - content.x) / content.width, originRightScale = 1 - originLeftScale;
|
|
10034
|
+
const originTopScale = (origin.y - content.y) / content.height, originBottomScale = 1 - originTopScale;
|
|
10035
|
+
let correctScaleX = 1, correctScaleY = 1, aScale, bScale, aSize, bSize;
|
|
10036
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
10037
|
+
if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
|
|
10038
|
+
aSize = float(tempContent.minX - tempDragBounds.minX);
|
|
10039
|
+
bSize = float(tempDragBounds.maxX - tempContent.maxX);
|
|
10040
|
+
aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
|
|
10041
|
+
bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
|
|
10042
|
+
correctScaleX *= max$2(aScale, bScale);
|
|
10043
|
+
} else {
|
|
10044
|
+
if (scale.x < 0) {
|
|
10045
|
+
if (float(minX(content) - minX(dragBounds)) <= 0 || float(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
|
|
10046
|
+
tempContent.unsign();
|
|
10047
|
+
}
|
|
10048
|
+
aSize = float(tempDragBounds.minX - tempContent.minX);
|
|
10049
|
+
bSize = float(tempContent.maxX - tempDragBounds.maxX);
|
|
10050
|
+
aScale = originLeftScale && aSize > 0 ? 1 - aSize / (originLeftScale * tempContent.width) : 1;
|
|
10051
|
+
bScale = originRightScale && bSize > 0 ? 1 - bSize / (originRightScale * tempContent.width) : 1;
|
|
10052
|
+
correctScaleX *= min(aScale, bScale);
|
|
10053
|
+
}
|
|
10054
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
10055
|
+
if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
|
|
10056
|
+
aSize = float(tempContent.minY - tempDragBounds.minY);
|
|
10057
|
+
bSize = float(tempDragBounds.maxY - tempContent.maxY);
|
|
10058
|
+
aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
|
|
10059
|
+
bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
|
|
10060
|
+
correctScaleY *= max$2(aScale, bScale);
|
|
10061
|
+
if (lockRatio) {
|
|
10062
|
+
aScale = max$2(abs$2(correctScaleX), abs$2(correctScaleY));
|
|
10063
|
+
correctScaleX = sign(correctScaleX) * aScale;
|
|
10064
|
+
correctScaleY = sign(correctScaleY) * aScale;
|
|
10065
|
+
}
|
|
10066
|
+
} else {
|
|
10067
|
+
if (scale.y < 0) {
|
|
10068
|
+
if (float(minY(content) - minY(dragBounds)) <= 0 || float(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
|
|
10069
|
+
tempContent.unsign();
|
|
10070
|
+
}
|
|
10071
|
+
aSize = float(tempDragBounds.minY - tempContent.minY);
|
|
10072
|
+
bSize = float(tempContent.maxY - tempDragBounds.maxY);
|
|
10073
|
+
aScale = originTopScale && aSize > 0 ? 1 - aSize / (originTopScale * tempContent.height) : 1;
|
|
10074
|
+
bScale = originBottomScale && bSize > 0 ? 1 - bSize / (originBottomScale * tempContent.height) : 1;
|
|
10075
|
+
correctScaleY *= min(aScale, bScale);
|
|
10076
|
+
}
|
|
10077
|
+
scale.x *= isFinite(correctScaleX) ? correctScaleX : 1;
|
|
10078
|
+
scale.y *= isFinite(correctScaleY) ? correctScaleY : 1;
|
|
10079
|
+
return scale;
|
|
10080
|
+
}
|
|
10081
|
+
};
|
|
10082
|
+
|
|
10083
|
+
const D = DragBoundsHelper;
|
|
10084
|
+
|
|
10037
10085
|
let PointerEvent$1 = class PointerEvent extends UIEvent {};
|
|
10038
10086
|
|
|
10039
10087
|
PointerEvent$1.POINTER = "pointer";
|
|
@@ -11104,9 +11152,9 @@ const ui$1 = UI.prototype;
|
|
|
11104
11152
|
|
|
11105
11153
|
ui$1.__updateHitCanvas = function() {
|
|
11106
11154
|
if (this.__box) this.__box.__updateHitCanvas();
|
|
11107
|
-
const
|
|
11108
|
-
if (!
|
|
11109
|
-
const data = this.__
|
|
11155
|
+
const {hitCanvasManager: hitCanvasManager} = this.leafer || this.parent && this.parent.leafer || {};
|
|
11156
|
+
if (!hitCanvasManager) return;
|
|
11157
|
+
const data = this.__;
|
|
11110
11158
|
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === "pixel";
|
|
11111
11159
|
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === "pixel";
|
|
11112
11160
|
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
@@ -11906,7 +11954,14 @@ const PaintModule = {
|
|
|
11906
11954
|
|
|
11907
11955
|
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
11908
11956
|
|
|
11909
|
-
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
11957
|
+
const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
11958
|
+
|
|
11959
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
11960
|
+
const transform = get$3();
|
|
11961
|
+
translate$1(transform, box.x, box.y);
|
|
11962
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
11963
|
+
data.transform = transform;
|
|
11964
|
+
}
|
|
11910
11965
|
|
|
11911
11966
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
11912
11967
|
const transform = get$3();
|
|
@@ -11923,8 +11978,11 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
|
|
|
11923
11978
|
const transform = get$3();
|
|
11924
11979
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
11925
11980
|
if (clipScaleX) {
|
|
11926
|
-
|
|
11927
|
-
|
|
11981
|
+
if (rotation || skew) {
|
|
11982
|
+
set(tempMatrix$1);
|
|
11983
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
11984
|
+
multiplyParent(transform, tempMatrix$1);
|
|
11985
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
11928
11986
|
}
|
|
11929
11987
|
data.transform = transform;
|
|
11930
11988
|
}
|
|
@@ -12020,7 +12078,10 @@ function getPatternData(paint, box, image) {
|
|
|
12020
12078
|
if (offset) PointHelper.move(tempImage, offset);
|
|
12021
12079
|
switch (mode) {
|
|
12022
12080
|
case "stretch":
|
|
12023
|
-
if (!sameBox)
|
|
12081
|
+
if (!sameBox) {
|
|
12082
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
12083
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
12084
|
+
}
|
|
12024
12085
|
break;
|
|
12025
12086
|
|
|
12026
12087
|
case "normal":
|
|
@@ -12029,7 +12090,7 @@ function getPatternData(paint, box, image) {
|
|
|
12029
12090
|
let clipScaleX, clipScaleY;
|
|
12030
12091
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
12031
12092
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
12032
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
12093
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
12033
12094
|
}
|
|
12034
12095
|
break;
|
|
12035
12096
|
|
|
@@ -12046,17 +12107,14 @@ function getPatternData(paint, box, image) {
|
|
|
12046
12107
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
12047
12108
|
}
|
|
12048
12109
|
if (!data.transform) {
|
|
12049
|
-
if (box.x || box.y)
|
|
12050
|
-
data.transform = get$2();
|
|
12051
|
-
translate(data.transform, box.x, box.y);
|
|
12052
|
-
}
|
|
12110
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
12053
12111
|
}
|
|
12054
|
-
|
|
12112
|
+
data.width = width;
|
|
12113
|
+
data.height = height;
|
|
12114
|
+
if (scaleX) {
|
|
12055
12115
|
data.scaleX = scaleX;
|
|
12056
12116
|
data.scaleY = scaleY;
|
|
12057
12117
|
}
|
|
12058
|
-
data.width = width;
|
|
12059
|
-
data.height = height;
|
|
12060
12118
|
if (opacity) data.opacity = opacity;
|
|
12061
12119
|
if (filters) data.filters = filters;
|
|
12062
12120
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -12188,7 +12246,7 @@ function ignoreRender(ui, value) {
|
|
|
12188
12246
|
|
|
12189
12247
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
12190
12248
|
|
|
12191
|
-
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
12249
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
|
|
12192
12250
|
|
|
12193
12251
|
function createPattern(ui, paint, pixelRatio) {
|
|
12194
12252
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -12199,8 +12257,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
12199
12257
|
scaleX *= pixelRatio;
|
|
12200
12258
|
scaleY *= pixelRatio;
|
|
12201
12259
|
if (sx) {
|
|
12202
|
-
sx = abs(sx);
|
|
12203
|
-
sy = abs(sy);
|
|
12260
|
+
sx = abs$1(sx);
|
|
12261
|
+
sy = abs$1(sy);
|
|
12204
12262
|
imageMatrix = get$1();
|
|
12205
12263
|
copy$1(imageMatrix, transform);
|
|
12206
12264
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -12342,6 +12400,7 @@ const PaintImageModule = {
|
|
|
12342
12400
|
recycleImage: recycleImage,
|
|
12343
12401
|
createData: createData,
|
|
12344
12402
|
getPatternData: getPatternData,
|
|
12403
|
+
stretchMode: stretchMode,
|
|
12345
12404
|
fillOrFitMode: fillOrFitMode,
|
|
12346
12405
|
clipMode: clipMode,
|
|
12347
12406
|
repeatMode: repeatMode
|
|
@@ -12452,7 +12511,7 @@ const PaintGradientModule = {
|
|
|
12452
12511
|
getTransform: getTransform
|
|
12453
12512
|
};
|
|
12454
12513
|
|
|
12455
|
-
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
12514
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max, abs: abs} = Math;
|
|
12456
12515
|
|
|
12457
12516
|
const tempBounds = {}, tempMatrix = new Matrix;
|
|
12458
12517
|
|
|
@@ -12496,7 +12555,7 @@ function shadow(ui, current, shape) {
|
|
|
12496
12555
|
function getShadowRenderSpread(_ui, shadow) {
|
|
12497
12556
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
12498
12557
|
shadow.forEach(item => {
|
|
12499
|
-
x = item.x || 0, y = item.y || 0,
|
|
12558
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs(item.spread || 0);
|
|
12500
12559
|
top = max(top, spread + blur - y);
|
|
12501
12560
|
right = max(right, spread + blur + x);
|
|
12502
12561
|
bottom = max(bottom, spread + blur + y);
|
|
@@ -12507,11 +12566,11 @@ function getShadowRenderSpread(_ui, shadow) {
|
|
|
12507
12566
|
|
|
12508
12567
|
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
12509
12568
|
if (shadow.spread) {
|
|
12510
|
-
const
|
|
12569
|
+
const spread = shadow.spread * 2 * otherScale * (isInnerShaodw ? -1 : 1), {width: width, height: height} = ui.__layout.strokeBounds;
|
|
12511
12570
|
tempMatrix.set().scaleOfOuter({
|
|
12512
12571
|
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
12513
12572
|
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
12514
|
-
},
|
|
12573
|
+
}, 1 + spread / width, 1 + spread / height);
|
|
12515
12574
|
return tempMatrix;
|
|
12516
12575
|
}
|
|
12517
12576
|
return undefined;
|