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.js
CHANGED
|
@@ -230,7 +230,7 @@ var LeaferUI = function(exports) {
|
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
let tempA, tempB, tempTo;
|
|
233
|
-
const {max: max$
|
|
233
|
+
const {max: max$5} = Math, tempFour = [ 0, 0, 0, 0 ];
|
|
234
234
|
const FourNumberHelper = {
|
|
235
235
|
zero: [ ...tempFour ],
|
|
236
236
|
tempFour: tempFour,
|
|
@@ -243,7 +243,7 @@ var LeaferUI = function(exports) {
|
|
|
243
243
|
return to;
|
|
244
244
|
},
|
|
245
245
|
setTemp(top, right, bottom, left) {
|
|
246
|
-
return set$
|
|
246
|
+
return set$2(tempFour, top, right, bottom, left);
|
|
247
247
|
},
|
|
248
248
|
toTempAB(a, b, change) {
|
|
249
249
|
tempTo = change ? isNumber(a) ? b : a : [];
|
|
@@ -281,23 +281,23 @@ var LeaferUI = function(exports) {
|
|
|
281
281
|
return data;
|
|
282
282
|
},
|
|
283
283
|
max(t, other, change) {
|
|
284
|
-
if (isNumber(t) && isNumber(other)) return max$
|
|
284
|
+
if (isNumber(t) && isNumber(other)) return max$5(t, other);
|
|
285
285
|
toTempAB(t, other, change);
|
|
286
|
-
return set$
|
|
286
|
+
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]));
|
|
287
287
|
},
|
|
288
288
|
add(t, other, change) {
|
|
289
289
|
if (isNumber(t) && isNumber(other)) return t + other;
|
|
290
290
|
toTempAB(t, other, change);
|
|
291
|
-
return set$
|
|
291
|
+
return set$2(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
|
|
292
292
|
},
|
|
293
293
|
swapAndScale(t, scaleX, scaleY, change) {
|
|
294
294
|
if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
|
|
295
295
|
const to = change ? t : [];
|
|
296
296
|
const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
|
|
297
|
-
return set$
|
|
297
|
+
return set$2(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
|
|
298
298
|
}
|
|
299
299
|
};
|
|
300
|
-
const {set: set$
|
|
300
|
+
const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
301
301
|
const {round: round$3, pow: pow$1, PI: PI$3} = Math;
|
|
302
302
|
const MathHelper = {
|
|
303
303
|
within(value, min, max) {
|
|
@@ -682,7 +682,7 @@ var LeaferUI = function(exports) {
|
|
|
682
682
|
};
|
|
683
683
|
const M$6 = MatrixHelper;
|
|
684
684
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
685
|
-
const {sin: sin$4, cos: cos$4, abs: abs$
|
|
685
|
+
const {sin: sin$4, cos: cos$4, abs: abs$5, sqrt: sqrt$2, atan2: atan2$2, min: min$2, round: round$2} = Math;
|
|
686
686
|
const PointHelper = {
|
|
687
687
|
defaultPoint: getPointData(),
|
|
688
688
|
tempPoint: {},
|
|
@@ -774,12 +774,12 @@ var LeaferUI = function(exports) {
|
|
|
774
774
|
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
775
775
|
},
|
|
776
776
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
777
|
-
const x = abs$
|
|
778
|
-
const y = abs$
|
|
777
|
+
const x = abs$5(x2 - x1);
|
|
778
|
+
const y = abs$5(y2 - y1);
|
|
779
779
|
return sqrt$2(x * x + y * y);
|
|
780
780
|
},
|
|
781
781
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
782
|
-
return min$
|
|
782
|
+
return min$2(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
|
|
783
783
|
},
|
|
784
784
|
getAngle(t, to) {
|
|
785
785
|
return getAtan2(t, to) / OneRadian;
|
|
@@ -2417,9 +2417,9 @@ var LeaferUI = function(exports) {
|
|
|
2417
2417
|
data[0] ? drawer.arcTo(x, y, right, y, data[0]) : drawer.lineTo(x, y);
|
|
2418
2418
|
}
|
|
2419
2419
|
};
|
|
2420
|
-
const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs: abs$
|
|
2420
|
+
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;
|
|
2421
2421
|
const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
|
|
2422
|
-
const {set: set, toNumberPoints: toNumberPoints} = PointHelper;
|
|
2422
|
+
const {set: set$1, toNumberPoints: toNumberPoints} = PointHelper;
|
|
2423
2423
|
const {M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5} = PathCommandMap;
|
|
2424
2424
|
const tempPoint$1 = {};
|
|
2425
2425
|
const BezierHelper = {
|
|
@@ -2487,14 +2487,14 @@ var LeaferUI = function(exports) {
|
|
|
2487
2487
|
const lenCB = hypot(CBx, CBy);
|
|
2488
2488
|
let totalRadian = endRadian - startRadian;
|
|
2489
2489
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2490
|
-
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$
|
|
2490
|
+
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$4(totalRadian - PI$2) < 1e-12) {
|
|
2491
2491
|
if (data) data.push(L$6, x1, y1);
|
|
2492
2492
|
if (setPointBounds) {
|
|
2493
2493
|
setPoint$1(setPointBounds, fromX, fromY);
|
|
2494
2494
|
addPoint$1(setPointBounds, x1, y1);
|
|
2495
2495
|
}
|
|
2496
|
-
if (setStartPoint) set(setStartPoint, fromX, fromY);
|
|
2497
|
-
if (setEndPoint) set(setEndPoint, x1, y1);
|
|
2496
|
+
if (setStartPoint) set$1(setStartPoint, fromX, fromY);
|
|
2497
|
+
if (setEndPoint) set$1(setEndPoint, x1, y1);
|
|
2498
2498
|
return;
|
|
2499
2499
|
}
|
|
2500
2500
|
const anticlockwise = BAx * CBy - CBx * BAy < 0;
|
|
@@ -2520,7 +2520,7 @@ var LeaferUI = function(exports) {
|
|
|
2520
2520
|
let totalRadian = endRadian - startRadian;
|
|
2521
2521
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2522
2522
|
if (anticlockwise) totalRadian -= PI2;
|
|
2523
|
-
const parts = ceil$1(abs$
|
|
2523
|
+
const parts = ceil$1(abs$4(totalRadian / PI_2));
|
|
2524
2524
|
const partRadian = totalRadian / parts;
|
|
2525
2525
|
const partRadian4Sin = sin$3(partRadian / 4);
|
|
2526
2526
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
|
|
@@ -2534,7 +2534,7 @@ var LeaferUI = function(exports) {
|
|
|
2534
2534
|
let fromX = cx + x, fromY = cy + y;
|
|
2535
2535
|
if (data) data.push(data.length ? L$6 : M$5, fromX, fromY);
|
|
2536
2536
|
if (setPointBounds) setPoint$1(setPointBounds, fromX, fromY);
|
|
2537
|
-
if (setStartPoint) set(setStartPoint, fromX, fromY);
|
|
2537
|
+
if (setStartPoint) set$1(setStartPoint, fromX, fromY);
|
|
2538
2538
|
for (let i = 0; i < parts; i++) {
|
|
2539
2539
|
endCos = cos$3(endRadian);
|
|
2540
2540
|
endSin = sin$3(endRadian);
|
|
@@ -2553,7 +2553,7 @@ var LeaferUI = function(exports) {
|
|
|
2553
2553
|
startRadian = endRadian;
|
|
2554
2554
|
endRadian += partRadian;
|
|
2555
2555
|
}
|
|
2556
|
-
if (setEndPoint) set(setEndPoint, cx + x, cy + y);
|
|
2556
|
+
if (setEndPoint) set$1(setEndPoint, cx + x, cy + y);
|
|
2557
2557
|
},
|
|
2558
2558
|
quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
|
|
2559
2559
|
data.push(C$4, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
|
|
@@ -2973,7 +2973,7 @@ var LeaferUI = function(exports) {
|
|
|
2973
2973
|
const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
|
|
2974
2974
|
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: F$3, O: O$2, P: P$2, U: U$2} = PathCommandMap;
|
|
2975
2975
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
2976
|
-
const {tan: tan, min: min, abs: abs$
|
|
2976
|
+
const {tan: tan, min: min$1, abs: abs$3} = Math;
|
|
2977
2977
|
const startPoint = {};
|
|
2978
2978
|
const PathCommandDataHelper = {
|
|
2979
2979
|
beginPath(data) {
|
|
@@ -3029,7 +3029,7 @@ var LeaferUI = function(exports) {
|
|
|
3029
3029
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3030
3030
|
if (!isUndefined(lastX)) {
|
|
3031
3031
|
const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
|
|
3032
|
-
radius = min(radius, min(d / 2, d / 2 * abs$
|
|
3032
|
+
radius = min$1(radius, min$1(d / 2, d / 2 * abs$3(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3033
3033
|
}
|
|
3034
3034
|
data.push(U$2, x1, y1, x2, y2, radius);
|
|
3035
3035
|
},
|
|
@@ -3611,7 +3611,12 @@ var LeaferUI = function(exports) {
|
|
|
3611
3611
|
runTask() {
|
|
3612
3612
|
const task = this.list[this.index];
|
|
3613
3613
|
if (!task) {
|
|
3614
|
-
this.nextTask();
|
|
3614
|
+
this.timer = setTimeout(() => this.nextTask());
|
|
3615
|
+
return;
|
|
3616
|
+
}
|
|
3617
|
+
if (task.isCancel) {
|
|
3618
|
+
this.index++;
|
|
3619
|
+
this.runTask();
|
|
3615
3620
|
return;
|
|
3616
3621
|
}
|
|
3617
3622
|
task.run().then(() => {
|
|
@@ -3642,16 +3647,15 @@ var LeaferUI = function(exports) {
|
|
|
3642
3647
|
}
|
|
3643
3648
|
setParallelList() {
|
|
3644
3649
|
let task;
|
|
3650
|
+
const {config: config, list: list, index: index} = this;
|
|
3645
3651
|
this.parallelList = [];
|
|
3646
3652
|
this.parallelSuccessNumber = 0;
|
|
3647
|
-
let end =
|
|
3648
|
-
if (end >
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
this.parallelList.push(task);
|
|
3653
|
-
} else {
|
|
3654
|
-
break;
|
|
3653
|
+
let end = index + config.parallel;
|
|
3654
|
+
if (end > list.length) end = list.length;
|
|
3655
|
+
if (config.parallel > 1) {
|
|
3656
|
+
for (let i = index; i < end; i++) {
|
|
3657
|
+
task = list[i];
|
|
3658
|
+
if (task.parallel) this.parallelList.push(task); else break;
|
|
3655
3659
|
}
|
|
3656
3660
|
}
|
|
3657
3661
|
}
|
|
@@ -3787,7 +3791,7 @@ var LeaferUI = function(exports) {
|
|
|
3787
3791
|
};
|
|
3788
3792
|
const I$1 = ImageManager;
|
|
3789
3793
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
3790
|
-
const {floor: floor$1, max: max$
|
|
3794
|
+
const {floor: floor$1, max: max$4} = Math;
|
|
3791
3795
|
class LeaferImage {
|
|
3792
3796
|
get url() {
|
|
3793
3797
|
return this.config.url;
|
|
@@ -3875,7 +3879,7 @@ var LeaferUI = function(exports) {
|
|
|
3875
3879
|
}
|
|
3876
3880
|
if (data) return data;
|
|
3877
3881
|
}
|
|
3878
|
-
const canvas = Platform.origin.createCanvas(max$
|
|
3882
|
+
const canvas = Platform.origin.createCanvas(max$4(floor$1(width + (xGap || 0)), 1), max$4(floor$1(height + (yGap || 0)), 1));
|
|
3879
3883
|
const ctx = canvas.getContext("2d");
|
|
3880
3884
|
if (opacity) ctx.globalAlpha = opacity;
|
|
3881
3885
|
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
@@ -6409,7 +6413,7 @@ var LeaferUI = function(exports) {
|
|
|
6409
6413
|
this.levelMap = null;
|
|
6410
6414
|
}
|
|
6411
6415
|
}
|
|
6412
|
-
const version = "1.9.
|
|
6416
|
+
const version = "1.9.11";
|
|
6413
6417
|
const debug$5 = Debug.get("LeaferCanvas");
|
|
6414
6418
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6415
6419
|
set zIndex(zIndex) {
|
|
@@ -7251,7 +7255,7 @@ var LeaferUI = function(exports) {
|
|
|
7251
7255
|
children: [ target ]
|
|
7252
7256
|
} : target);
|
|
7253
7257
|
const {list: list} = this.findList;
|
|
7254
|
-
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable);
|
|
7258
|
+
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable, !!options.findList);
|
|
7255
7259
|
const path = ignoreHittable ? this.getPath(leaf) : this.getHitablePath(leaf);
|
|
7256
7260
|
this.clear();
|
|
7257
7261
|
return through ? {
|
|
@@ -7266,7 +7270,7 @@ var LeaferUI = function(exports) {
|
|
|
7266
7270
|
hitPoint(hitPoint, hitRadius, options) {
|
|
7267
7271
|
return !!this.getByPoint(hitPoint, hitRadius, options).target;
|
|
7268
7272
|
}
|
|
7269
|
-
getBestMatchLeaf(list, bottomList, ignoreHittable) {
|
|
7273
|
+
getBestMatchLeaf(list, bottomList, ignoreHittable, allowNull) {
|
|
7270
7274
|
const findList = this.findList = new LeafList;
|
|
7271
7275
|
if (list.length) {
|
|
7272
7276
|
let find;
|
|
@@ -7297,15 +7301,27 @@ var LeaferUI = function(exports) {
|
|
|
7297
7301
|
if (findList.length) return findList.list[0];
|
|
7298
7302
|
}
|
|
7299
7303
|
}
|
|
7304
|
+
if (allowNull) return null;
|
|
7300
7305
|
return ignoreHittable ? list[0] : list.find(item => LeafHelper.worldHittable(item));
|
|
7301
7306
|
}
|
|
7302
7307
|
getPath(leaf) {
|
|
7303
|
-
const path = new LeafList;
|
|
7308
|
+
const path = new LeafList, syncList = [], {target: target} = this;
|
|
7304
7309
|
while (leaf) {
|
|
7310
|
+
if (leaf.syncEventer) syncList.push(leaf.syncEventer);
|
|
7305
7311
|
path.add(leaf);
|
|
7306
7312
|
leaf = leaf.parent;
|
|
7313
|
+
if (leaf === target) break;
|
|
7314
|
+
}
|
|
7315
|
+
if (syncList.length) {
|
|
7316
|
+
syncList.forEach(item => {
|
|
7317
|
+
while (item) {
|
|
7318
|
+
if (item.__.hittable) path.add(item);
|
|
7319
|
+
item = item.parent;
|
|
7320
|
+
if (item === target) break;
|
|
7321
|
+
}
|
|
7322
|
+
});
|
|
7307
7323
|
}
|
|
7308
|
-
if (
|
|
7324
|
+
if (target) path.add(target);
|
|
7309
7325
|
return path;
|
|
7310
7326
|
}
|
|
7311
7327
|
getHitablePath(leaf) {
|
|
@@ -7762,12 +7778,12 @@ var LeaferUI = function(exports) {
|
|
|
7762
7778
|
}
|
|
7763
7779
|
__getData() {
|
|
7764
7780
|
const data = super.__getData();
|
|
7765
|
-
delete data.fill;
|
|
7781
|
+
if (data.url) delete data.fill;
|
|
7766
7782
|
return data;
|
|
7767
7783
|
}
|
|
7768
7784
|
__getInputData(names, options) {
|
|
7769
7785
|
const data = super.__getInputData(names, options);
|
|
7770
|
-
delete data.fill;
|
|
7786
|
+
if (data.url) delete data.fill;
|
|
7771
7787
|
return data;
|
|
7772
7788
|
}
|
|
7773
7789
|
}
|
|
@@ -7784,7 +7800,7 @@ var LeaferUI = function(exports) {
|
|
|
7784
7800
|
return data;
|
|
7785
7801
|
}
|
|
7786
7802
|
}
|
|
7787
|
-
const {max: max$
|
|
7803
|
+
const {max: max$3, add: add$1} = FourNumberHelper;
|
|
7788
7804
|
const UIBounds = {
|
|
7789
7805
|
__updateStrokeSpread() {
|
|
7790
7806
|
let spread = 0, boxSpread = 0;
|
|
@@ -7799,7 +7815,7 @@ var LeaferUI = function(exports) {
|
|
|
7799
7815
|
}
|
|
7800
7816
|
if (data.__useArrow) spread += strokeWidth * 5;
|
|
7801
7817
|
if (box) {
|
|
7802
|
-
spread = max$
|
|
7818
|
+
spread = max$3(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
|
|
7803
7819
|
boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
|
|
7804
7820
|
}
|
|
7805
7821
|
this.__layout.strokeBoxSpread = boxSpread;
|
|
@@ -7809,81 +7825,17 @@ var LeaferUI = function(exports) {
|
|
|
7809
7825
|
let spread = 0;
|
|
7810
7826
|
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
|
|
7811
7827
|
if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
|
|
7812
|
-
if (blur) spread = max$
|
|
7828
|
+
if (blur) spread = max$3(spread, blur);
|
|
7813
7829
|
if (filter) spread = add$1(spread, Filter.getSpread(filter));
|
|
7814
7830
|
if (renderSpread) spread = add$1(spread, renderSpread);
|
|
7815
7831
|
if (strokeSpread) spread = add$1(spread, strokeSpread);
|
|
7816
7832
|
let shapeSpread = spread;
|
|
7817
|
-
if (innerShadow) shapeSpread = max$
|
|
7818
|
-
if (backgroundBlur) shapeSpread = max$
|
|
7833
|
+
if (innerShadow) shapeSpread = max$3(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
|
|
7834
|
+
if (backgroundBlur) shapeSpread = max$3(shapeSpread, backgroundBlur);
|
|
7819
7835
|
this.__layout.renderShapeSpread = shapeSpread;
|
|
7820
|
-
return box ? max$
|
|
7836
|
+
return box ? max$3(box.__updateRenderSpread(), spread) : spread;
|
|
7821
7837
|
}
|
|
7822
7838
|
};
|
|
7823
|
-
const {float: float} = MathHelper;
|
|
7824
|
-
const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
|
|
7825
|
-
const DragBoundsHelper = {
|
|
7826
|
-
limitMove(leaf, move) {
|
|
7827
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7828
|
-
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
|
|
7829
|
-
D.axisMove(leaf, move);
|
|
7830
|
-
},
|
|
7831
|
-
limitScaleOf(leaf, origin, scale) {
|
|
7832
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7833
|
-
if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
|
|
7834
|
-
},
|
|
7835
|
-
axisMove(leaf, move) {
|
|
7836
|
-
const {draggable: draggable} = leaf;
|
|
7837
|
-
if (draggable === "x") move.y = 0;
|
|
7838
|
-
if (draggable === "y") move.x = 0;
|
|
7839
|
-
},
|
|
7840
|
-
getDragBounds(leaf) {
|
|
7841
|
-
const {dragBounds: dragBounds} = leaf;
|
|
7842
|
-
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
7843
|
-
},
|
|
7844
|
-
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
7845
|
-
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
7846
|
-
},
|
|
7847
|
-
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
7848
|
-
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
7849
|
-
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
7850
|
-
if (!change) move = Object.assign({}, move);
|
|
7851
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7852
|
-
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
7853
|
-
} else {
|
|
7854
|
-
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
7855
|
-
}
|
|
7856
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7857
|
-
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
7858
|
-
} else {
|
|
7859
|
-
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
7860
|
-
}
|
|
7861
|
-
move.x = float(move.x);
|
|
7862
|
-
move.y = float(move.y);
|
|
7863
|
-
return move;
|
|
7864
|
-
},
|
|
7865
|
-
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
|
|
7866
|
-
if (!change) scale = Object.assign({}, scale);
|
|
7867
|
-
let fitScaleX, fitScaleY;
|
|
7868
|
-
tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
|
|
7869
|
-
tempMerge.set(tempContent).add(dragBounds);
|
|
7870
|
-
tempIntersect.set(tempContent).intersect(dragBounds);
|
|
7871
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7872
|
-
fitScaleX = tempMerge.width / tempContent.width;
|
|
7873
|
-
} else {
|
|
7874
|
-
fitScaleX = tempIntersect.width / tempContent.width;
|
|
7875
|
-
}
|
|
7876
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7877
|
-
fitScaleY = tempMerge.height / tempContent.height;
|
|
7878
|
-
} else {
|
|
7879
|
-
fitScaleY = tempIntersect.height / tempContent.height;
|
|
7880
|
-
}
|
|
7881
|
-
scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
7882
|
-
scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
7883
|
-
return scale;
|
|
7884
|
-
}
|
|
7885
|
-
};
|
|
7886
|
-
const D = DragBoundsHelper;
|
|
7887
7839
|
const {stintSet: stintSet$1} = DataHelper;
|
|
7888
7840
|
const UIRender = {
|
|
7889
7841
|
__updateChange() {
|
|
@@ -9340,6 +9292,102 @@ var LeaferUI = function(exports) {
|
|
|
9340
9292
|
EventCreator.changeName(oldName, newName);
|
|
9341
9293
|
}
|
|
9342
9294
|
}
|
|
9295
|
+
const {min: min, max: max$2, abs: abs$2} = Math, {float: float, sign: sign} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
|
|
9296
|
+
const tempContent = new Bounds, tempDragBounds = new Bounds;
|
|
9297
|
+
const DragBoundsHelper = {
|
|
9298
|
+
limitMove(leaf, move) {
|
|
9299
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
9300
|
+
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
|
|
9301
|
+
D.axisMove(leaf, move);
|
|
9302
|
+
},
|
|
9303
|
+
limitScaleOf(leaf, origin, scale, lockRatio) {
|
|
9304
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
9305
|
+
if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, lockRatio, true);
|
|
9306
|
+
},
|
|
9307
|
+
axisMove(leaf, move) {
|
|
9308
|
+
const {draggable: draggable} = leaf;
|
|
9309
|
+
if (draggable === "x") move.y = 0;
|
|
9310
|
+
if (draggable === "y") move.x = 0;
|
|
9311
|
+
},
|
|
9312
|
+
getDragBounds(leaf) {
|
|
9313
|
+
const {dragBounds: dragBounds} = leaf;
|
|
9314
|
+
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
9315
|
+
},
|
|
9316
|
+
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
9317
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
9318
|
+
},
|
|
9319
|
+
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
9320
|
+
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
9321
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9322
|
+
if (!change) move = Object.assign({}, move);
|
|
9323
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
9324
|
+
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
9325
|
+
} else {
|
|
9326
|
+
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
9327
|
+
}
|
|
9328
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
9329
|
+
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
9330
|
+
} else {
|
|
9331
|
+
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
9332
|
+
}
|
|
9333
|
+
move.x = float(move.x);
|
|
9334
|
+
move.y = float(move.y);
|
|
9335
|
+
return move;
|
|
9336
|
+
},
|
|
9337
|
+
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, lockRatio, change) {
|
|
9338
|
+
if (!change) scale = Object.assign({}, scale);
|
|
9339
|
+
tempDragBounds.set(dragBounds);
|
|
9340
|
+
tempContent.set(content).scaleOf(origin, scale.x, scale.y);
|
|
9341
|
+
const originLeftScale = (origin.x - content.x) / content.width, originRightScale = 1 - originLeftScale;
|
|
9342
|
+
const originTopScale = (origin.y - content.y) / content.height, originBottomScale = 1 - originTopScale;
|
|
9343
|
+
let correctScaleX = 1, correctScaleY = 1, aScale, bScale, aSize, bSize;
|
|
9344
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
9345
|
+
if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
|
|
9346
|
+
aSize = float(tempContent.minX - tempDragBounds.minX);
|
|
9347
|
+
bSize = float(tempDragBounds.maxX - tempContent.maxX);
|
|
9348
|
+
aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
|
|
9349
|
+
bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
|
|
9350
|
+
correctScaleX *= max$2(aScale, bScale);
|
|
9351
|
+
} else {
|
|
9352
|
+
if (scale.x < 0) {
|
|
9353
|
+
if (float(minX(content) - minX(dragBounds)) <= 0 || float(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
|
|
9354
|
+
tempContent.unsign();
|
|
9355
|
+
}
|
|
9356
|
+
aSize = float(tempDragBounds.minX - tempContent.minX);
|
|
9357
|
+
bSize = float(tempContent.maxX - tempDragBounds.maxX);
|
|
9358
|
+
aScale = originLeftScale && aSize > 0 ? 1 - aSize / (originLeftScale * tempContent.width) : 1;
|
|
9359
|
+
bScale = originRightScale && bSize > 0 ? 1 - bSize / (originRightScale * tempContent.width) : 1;
|
|
9360
|
+
correctScaleX *= min(aScale, bScale);
|
|
9361
|
+
}
|
|
9362
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
9363
|
+
if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
|
|
9364
|
+
aSize = float(tempContent.minY - tempDragBounds.minY);
|
|
9365
|
+
bSize = float(tempDragBounds.maxY - tempContent.maxY);
|
|
9366
|
+
aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
|
|
9367
|
+
bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
|
|
9368
|
+
correctScaleY *= max$2(aScale, bScale);
|
|
9369
|
+
if (lockRatio) {
|
|
9370
|
+
aScale = max$2(abs$2(correctScaleX), abs$2(correctScaleY));
|
|
9371
|
+
correctScaleX = sign(correctScaleX) * aScale;
|
|
9372
|
+
correctScaleY = sign(correctScaleY) * aScale;
|
|
9373
|
+
}
|
|
9374
|
+
} else {
|
|
9375
|
+
if (scale.y < 0) {
|
|
9376
|
+
if (float(minY(content) - minY(dragBounds)) <= 0 || float(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
|
|
9377
|
+
tempContent.unsign();
|
|
9378
|
+
}
|
|
9379
|
+
aSize = float(tempDragBounds.minY - tempContent.minY);
|
|
9380
|
+
bSize = float(tempContent.maxY - tempDragBounds.maxY);
|
|
9381
|
+
aScale = originTopScale && aSize > 0 ? 1 - aSize / (originTopScale * tempContent.height) : 1;
|
|
9382
|
+
bScale = originBottomScale && bSize > 0 ? 1 - bSize / (originBottomScale * tempContent.height) : 1;
|
|
9383
|
+
correctScaleY *= min(aScale, bScale);
|
|
9384
|
+
}
|
|
9385
|
+
scale.x *= isFinite(correctScaleX) ? correctScaleX : 1;
|
|
9386
|
+
scale.y *= isFinite(correctScaleY) ? correctScaleY : 1;
|
|
9387
|
+
return scale;
|
|
9388
|
+
}
|
|
9389
|
+
};
|
|
9390
|
+
const D = DragBoundsHelper;
|
|
9343
9391
|
exports.PointerEvent = class PointerEvent extends UIEvent {};
|
|
9344
9392
|
exports.PointerEvent.POINTER = "pointer";
|
|
9345
9393
|
exports.PointerEvent.BEFORE_DOWN = "pointer.before_down";
|
|
@@ -10311,9 +10359,9 @@ var LeaferUI = function(exports) {
|
|
|
10311
10359
|
const ui$1 = exports.UI.prototype;
|
|
10312
10360
|
ui$1.__updateHitCanvas = function() {
|
|
10313
10361
|
if (this.__box) this.__box.__updateHitCanvas();
|
|
10314
|
-
const
|
|
10315
|
-
if (!
|
|
10316
|
-
const data = this.__
|
|
10362
|
+
const {hitCanvasManager: hitCanvasManager} = this.leafer || this.parent && this.parent.leafer || {};
|
|
10363
|
+
if (!hitCanvasManager) return;
|
|
10364
|
+
const data = this.__;
|
|
10317
10365
|
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === "pixel";
|
|
10318
10366
|
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === "pixel";
|
|
10319
10367
|
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
@@ -11075,7 +11123,13 @@ var LeaferUI = function(exports) {
|
|
|
11075
11123
|
shape: shape
|
|
11076
11124
|
};
|
|
11077
11125
|
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
11078
|
-
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
11126
|
+
const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
11127
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
11128
|
+
const transform = get$3();
|
|
11129
|
+
translate$1(transform, box.x, box.y);
|
|
11130
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
11131
|
+
data.transform = transform;
|
|
11132
|
+
}
|
|
11079
11133
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
11080
11134
|
const transform = get$3();
|
|
11081
11135
|
translate$1(transform, box.x + x, box.y + y);
|
|
@@ -11090,8 +11144,11 @@ var LeaferUI = function(exports) {
|
|
|
11090
11144
|
const transform = get$3();
|
|
11091
11145
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
11092
11146
|
if (clipScaleX) {
|
|
11093
|
-
|
|
11094
|
-
|
|
11147
|
+
if (rotation || skew) {
|
|
11148
|
+
set(tempMatrix$1);
|
|
11149
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
11150
|
+
multiplyParent(transform, tempMatrix$1);
|
|
11151
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
11095
11152
|
}
|
|
11096
11153
|
data.transform = transform;
|
|
11097
11154
|
}
|
|
@@ -11179,7 +11236,10 @@ var LeaferUI = function(exports) {
|
|
|
11179
11236
|
if (offset) PointHelper.move(tempImage, offset);
|
|
11180
11237
|
switch (mode) {
|
|
11181
11238
|
case "stretch":
|
|
11182
|
-
if (!sameBox)
|
|
11239
|
+
if (!sameBox) {
|
|
11240
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
11241
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
11242
|
+
}
|
|
11183
11243
|
break;
|
|
11184
11244
|
|
|
11185
11245
|
case "normal":
|
|
@@ -11188,7 +11248,7 @@ var LeaferUI = function(exports) {
|
|
|
11188
11248
|
let clipScaleX, clipScaleY;
|
|
11189
11249
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
11190
11250
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
11191
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
11251
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
11192
11252
|
}
|
|
11193
11253
|
break;
|
|
11194
11254
|
|
|
@@ -11205,17 +11265,14 @@ var LeaferUI = function(exports) {
|
|
|
11205
11265
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
11206
11266
|
}
|
|
11207
11267
|
if (!data.transform) {
|
|
11208
|
-
if (box.x || box.y)
|
|
11209
|
-
data.transform = get$2();
|
|
11210
|
-
translate(data.transform, box.x, box.y);
|
|
11211
|
-
}
|
|
11268
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
11212
11269
|
}
|
|
11213
|
-
|
|
11270
|
+
data.width = width;
|
|
11271
|
+
data.height = height;
|
|
11272
|
+
if (scaleX) {
|
|
11214
11273
|
data.scaleX = scaleX;
|
|
11215
11274
|
data.scaleY = scaleY;
|
|
11216
11275
|
}
|
|
11217
|
-
data.width = width;
|
|
11218
|
-
data.height = height;
|
|
11219
11276
|
if (opacity) data.opacity = opacity;
|
|
11220
11277
|
if (filters) data.filters = filters;
|
|
11221
11278
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -11334,7 +11391,7 @@ var LeaferUI = function(exports) {
|
|
|
11334
11391
|
if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
|
|
11335
11392
|
}
|
|
11336
11393
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
11337
|
-
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
11394
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
|
|
11338
11395
|
function createPattern(ui, paint, pixelRatio) {
|
|
11339
11396
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
11340
11397
|
const id = scaleX + "-" + scaleY + "-" + pixelRatio;
|
|
@@ -11344,8 +11401,8 @@ var LeaferUI = function(exports) {
|
|
|
11344
11401
|
scaleX *= pixelRatio;
|
|
11345
11402
|
scaleY *= pixelRatio;
|
|
11346
11403
|
if (sx) {
|
|
11347
|
-
sx = abs(sx);
|
|
11348
|
-
sy = abs(sy);
|
|
11404
|
+
sx = abs$1(sx);
|
|
11405
|
+
sy = abs$1(sy);
|
|
11349
11406
|
imageMatrix = get$1();
|
|
11350
11407
|
copy$1(imageMatrix, transform);
|
|
11351
11408
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -11483,6 +11540,7 @@ var LeaferUI = function(exports) {
|
|
|
11483
11540
|
recycleImage: recycleImage,
|
|
11484
11541
|
createData: createData,
|
|
11485
11542
|
getPatternData: getPatternData,
|
|
11543
|
+
stretchMode: stretchMode,
|
|
11486
11544
|
fillOrFitMode: fillOrFitMode,
|
|
11487
11545
|
clipMode: clipMode,
|
|
11488
11546
|
repeatMode: repeatMode
|
|
@@ -11574,7 +11632,7 @@ var LeaferUI = function(exports) {
|
|
|
11574
11632
|
conicGradient: conicGradient,
|
|
11575
11633
|
getTransform: getTransform
|
|
11576
11634
|
};
|
|
11577
|
-
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
11635
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max, abs: abs} = Math;
|
|
11578
11636
|
const tempBounds = {}, tempMatrix = new Matrix;
|
|
11579
11637
|
const offsetOutBounds$1 = {};
|
|
11580
11638
|
function shadow(ui, current, shape) {
|
|
@@ -11614,7 +11672,7 @@ var LeaferUI = function(exports) {
|
|
|
11614
11672
|
function getShadowRenderSpread(_ui, shadow) {
|
|
11615
11673
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
11616
11674
|
shadow.forEach(item => {
|
|
11617
|
-
x = item.x || 0, y = item.y || 0,
|
|
11675
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs(item.spread || 0);
|
|
11618
11676
|
top = max(top, spread + blur - y);
|
|
11619
11677
|
right = max(right, spread + blur + x);
|
|
11620
11678
|
bottom = max(bottom, spread + blur + y);
|
|
@@ -11624,11 +11682,11 @@ var LeaferUI = function(exports) {
|
|
|
11624
11682
|
}
|
|
11625
11683
|
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
11626
11684
|
if (shadow.spread) {
|
|
11627
|
-
const
|
|
11685
|
+
const spread = shadow.spread * 2 * otherScale * (isInnerShaodw ? -1 : 1), {width: width, height: height} = ui.__layout.strokeBounds;
|
|
11628
11686
|
tempMatrix.set().scaleOfOuter({
|
|
11629
11687
|
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
11630
11688
|
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
11631
|
-
},
|
|
11689
|
+
}, 1 + spread / width, 1 + spread / height);
|
|
11632
11690
|
return tempMatrix;
|
|
11633
11691
|
}
|
|
11634
11692
|
return undefined;
|