leafer-ui 1.9.9 → 1.9.10
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 +44 -21
- package/dist/web.esm.js +44 -21
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +167 -117
- 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 +172 -121
- 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
|
},
|
|
@@ -3787,7 +3787,7 @@ var LeaferUI = function(exports) {
|
|
|
3787
3787
|
};
|
|
3788
3788
|
const I$1 = ImageManager;
|
|
3789
3789
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
3790
|
-
const {floor: floor$1, max: max$
|
|
3790
|
+
const {floor: floor$1, max: max$4} = Math;
|
|
3791
3791
|
class LeaferImage {
|
|
3792
3792
|
get url() {
|
|
3793
3793
|
return this.config.url;
|
|
@@ -3875,7 +3875,7 @@ var LeaferUI = function(exports) {
|
|
|
3875
3875
|
}
|
|
3876
3876
|
if (data) return data;
|
|
3877
3877
|
}
|
|
3878
|
-
const canvas = Platform.origin.createCanvas(max$
|
|
3878
|
+
const canvas = Platform.origin.createCanvas(max$4(floor$1(width + (xGap || 0)), 1), max$4(floor$1(height + (yGap || 0)), 1));
|
|
3879
3879
|
const ctx = canvas.getContext("2d");
|
|
3880
3880
|
if (opacity) ctx.globalAlpha = opacity;
|
|
3881
3881
|
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
@@ -6409,7 +6409,7 @@ var LeaferUI = function(exports) {
|
|
|
6409
6409
|
this.levelMap = null;
|
|
6410
6410
|
}
|
|
6411
6411
|
}
|
|
6412
|
-
const version = "1.9.
|
|
6412
|
+
const version = "1.9.10";
|
|
6413
6413
|
const debug$5 = Debug.get("LeaferCanvas");
|
|
6414
6414
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6415
6415
|
set zIndex(zIndex) {
|
|
@@ -7251,7 +7251,7 @@ var LeaferUI = function(exports) {
|
|
|
7251
7251
|
children: [ target ]
|
|
7252
7252
|
} : target);
|
|
7253
7253
|
const {list: list} = this.findList;
|
|
7254
|
-
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable);
|
|
7254
|
+
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable, !!options.findList);
|
|
7255
7255
|
const path = ignoreHittable ? this.getPath(leaf) : this.getHitablePath(leaf);
|
|
7256
7256
|
this.clear();
|
|
7257
7257
|
return through ? {
|
|
@@ -7266,7 +7266,7 @@ var LeaferUI = function(exports) {
|
|
|
7266
7266
|
hitPoint(hitPoint, hitRadius, options) {
|
|
7267
7267
|
return !!this.getByPoint(hitPoint, hitRadius, options).target;
|
|
7268
7268
|
}
|
|
7269
|
-
getBestMatchLeaf(list, bottomList, ignoreHittable) {
|
|
7269
|
+
getBestMatchLeaf(list, bottomList, ignoreHittable, allowNull) {
|
|
7270
7270
|
const findList = this.findList = new LeafList;
|
|
7271
7271
|
if (list.length) {
|
|
7272
7272
|
let find;
|
|
@@ -7297,15 +7297,27 @@ var LeaferUI = function(exports) {
|
|
|
7297
7297
|
if (findList.length) return findList.list[0];
|
|
7298
7298
|
}
|
|
7299
7299
|
}
|
|
7300
|
+
if (allowNull) return null;
|
|
7300
7301
|
return ignoreHittable ? list[0] : list.find(item => LeafHelper.worldHittable(item));
|
|
7301
7302
|
}
|
|
7302
7303
|
getPath(leaf) {
|
|
7303
|
-
const path = new LeafList;
|
|
7304
|
+
const path = new LeafList, syncList = [], {target: target} = this;
|
|
7304
7305
|
while (leaf) {
|
|
7306
|
+
if (leaf.syncEventer) syncList.push(leaf.syncEventer);
|
|
7305
7307
|
path.add(leaf);
|
|
7306
7308
|
leaf = leaf.parent;
|
|
7309
|
+
if (leaf === target) break;
|
|
7310
|
+
}
|
|
7311
|
+
if (syncList.length) {
|
|
7312
|
+
syncList.forEach(item => {
|
|
7313
|
+
while (item) {
|
|
7314
|
+
if (item.__.hittable) path.add(item);
|
|
7315
|
+
item = item.parent;
|
|
7316
|
+
if (item === target) break;
|
|
7317
|
+
}
|
|
7318
|
+
});
|
|
7307
7319
|
}
|
|
7308
|
-
if (
|
|
7320
|
+
if (target) path.add(target);
|
|
7309
7321
|
return path;
|
|
7310
7322
|
}
|
|
7311
7323
|
getHitablePath(leaf) {
|
|
@@ -7762,12 +7774,12 @@ var LeaferUI = function(exports) {
|
|
|
7762
7774
|
}
|
|
7763
7775
|
__getData() {
|
|
7764
7776
|
const data = super.__getData();
|
|
7765
|
-
delete data.fill;
|
|
7777
|
+
if (data.url) delete data.fill;
|
|
7766
7778
|
return data;
|
|
7767
7779
|
}
|
|
7768
7780
|
__getInputData(names, options) {
|
|
7769
7781
|
const data = super.__getInputData(names, options);
|
|
7770
|
-
delete data.fill;
|
|
7782
|
+
if (data.url) delete data.fill;
|
|
7771
7783
|
return data;
|
|
7772
7784
|
}
|
|
7773
7785
|
}
|
|
@@ -7784,7 +7796,7 @@ var LeaferUI = function(exports) {
|
|
|
7784
7796
|
return data;
|
|
7785
7797
|
}
|
|
7786
7798
|
}
|
|
7787
|
-
const {max: max$
|
|
7799
|
+
const {max: max$3, add: add$1} = FourNumberHelper;
|
|
7788
7800
|
const UIBounds = {
|
|
7789
7801
|
__updateStrokeSpread() {
|
|
7790
7802
|
let spread = 0, boxSpread = 0;
|
|
@@ -7799,7 +7811,7 @@ var LeaferUI = function(exports) {
|
|
|
7799
7811
|
}
|
|
7800
7812
|
if (data.__useArrow) spread += strokeWidth * 5;
|
|
7801
7813
|
if (box) {
|
|
7802
|
-
spread = max$
|
|
7814
|
+
spread = max$3(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
|
|
7803
7815
|
boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
|
|
7804
7816
|
}
|
|
7805
7817
|
this.__layout.strokeBoxSpread = boxSpread;
|
|
@@ -7809,81 +7821,17 @@ var LeaferUI = function(exports) {
|
|
|
7809
7821
|
let spread = 0;
|
|
7810
7822
|
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
|
|
7811
7823
|
if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
|
|
7812
|
-
if (blur) spread = max$
|
|
7824
|
+
if (blur) spread = max$3(spread, blur);
|
|
7813
7825
|
if (filter) spread = add$1(spread, Filter.getSpread(filter));
|
|
7814
7826
|
if (renderSpread) spread = add$1(spread, renderSpread);
|
|
7815
7827
|
if (strokeSpread) spread = add$1(spread, strokeSpread);
|
|
7816
7828
|
let shapeSpread = spread;
|
|
7817
|
-
if (innerShadow) shapeSpread = max$
|
|
7818
|
-
if (backgroundBlur) shapeSpread = max$
|
|
7829
|
+
if (innerShadow) shapeSpread = max$3(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
|
|
7830
|
+
if (backgroundBlur) shapeSpread = max$3(shapeSpread, backgroundBlur);
|
|
7819
7831
|
this.__layout.renderShapeSpread = shapeSpread;
|
|
7820
|
-
return box ? max$
|
|
7832
|
+
return box ? max$3(box.__updateRenderSpread(), spread) : spread;
|
|
7821
7833
|
}
|
|
7822
7834
|
};
|
|
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
7835
|
const {stintSet: stintSet$1} = DataHelper;
|
|
7888
7836
|
const UIRender = {
|
|
7889
7837
|
__updateChange() {
|
|
@@ -9340,6 +9288,98 @@ var LeaferUI = function(exports) {
|
|
|
9340
9288
|
EventCreator.changeName(oldName, newName);
|
|
9341
9289
|
}
|
|
9342
9290
|
}
|
|
9291
|
+
const {float: float, sign: sign} = MathHelper, {min: min, max: max$2, abs: abs$2} = Math;
|
|
9292
|
+
const tempContent = new Bounds, tempDragBounds = new Bounds;
|
|
9293
|
+
const DragBoundsHelper = {
|
|
9294
|
+
limitMove(leaf, move) {
|
|
9295
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
9296
|
+
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
|
|
9297
|
+
D.axisMove(leaf, move);
|
|
9298
|
+
},
|
|
9299
|
+
limitScaleOf(leaf, origin, scale, lockRatio) {
|
|
9300
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
9301
|
+
if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, lockRatio, true);
|
|
9302
|
+
},
|
|
9303
|
+
axisMove(leaf, move) {
|
|
9304
|
+
const {draggable: draggable} = leaf;
|
|
9305
|
+
if (draggable === "x") move.y = 0;
|
|
9306
|
+
if (draggable === "y") move.x = 0;
|
|
9307
|
+
},
|
|
9308
|
+
getDragBounds(leaf) {
|
|
9309
|
+
const {dragBounds: dragBounds} = leaf;
|
|
9310
|
+
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
9311
|
+
},
|
|
9312
|
+
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
9313
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
9314
|
+
},
|
|
9315
|
+
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
9316
|
+
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
9317
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9318
|
+
if (!change) move = Object.assign({}, move);
|
|
9319
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
9320
|
+
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
9321
|
+
} else {
|
|
9322
|
+
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
9323
|
+
}
|
|
9324
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
9325
|
+
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
9326
|
+
} else {
|
|
9327
|
+
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
9328
|
+
}
|
|
9329
|
+
move.x = float(move.x);
|
|
9330
|
+
move.y = float(move.y);
|
|
9331
|
+
return move;
|
|
9332
|
+
},
|
|
9333
|
+
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, lockRatio, change) {
|
|
9334
|
+
if (!change) scale = Object.assign({}, scale);
|
|
9335
|
+
tempDragBounds.set(dragBounds);
|
|
9336
|
+
tempContent.set(content).scaleOf(origin, scale.x, scale.y);
|
|
9337
|
+
const originLeftScale = (origin.x - content.x) / content.width, originRightScale = 1 - originLeftScale;
|
|
9338
|
+
const originTopScale = (origin.y - content.y) / content.height, originBottomScale = 1 - originTopScale;
|
|
9339
|
+
let correctScaleX, correctScaleY, aScale, bScale, aSize, bSize;
|
|
9340
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
9341
|
+
correctScaleX = scale.x < 0 ? 1 / scale.x : 1;
|
|
9342
|
+
if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX, 1);
|
|
9343
|
+
aSize = float(tempContent.minX - tempDragBounds.minX);
|
|
9344
|
+
bSize = float(tempDragBounds.maxX - tempContent.maxX);
|
|
9345
|
+
aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
|
|
9346
|
+
bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
|
|
9347
|
+
correctScaleX *= max$2(aScale, bScale);
|
|
9348
|
+
} else {
|
|
9349
|
+
if (scale.x < 0) tempContent.unsign();
|
|
9350
|
+
aSize = float(tempDragBounds.minX - tempContent.minX);
|
|
9351
|
+
bSize = float(tempContent.maxX - tempDragBounds.maxX);
|
|
9352
|
+
aScale = originLeftScale && aSize > 0 ? 1 - aSize / (originLeftScale * tempContent.width) : 1;
|
|
9353
|
+
bScale = originRightScale && bSize > 0 ? 1 - bSize / (originRightScale * tempContent.width) : 1;
|
|
9354
|
+
correctScaleX = min(aScale, bScale);
|
|
9355
|
+
}
|
|
9356
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
9357
|
+
correctScaleY = scale.y < 0 ? 1 / scale.y : 1;
|
|
9358
|
+
if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY);
|
|
9359
|
+
aSize = float(tempContent.minY - tempDragBounds.minY);
|
|
9360
|
+
bSize = float(tempDragBounds.maxY - tempContent.maxY);
|
|
9361
|
+
aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
|
|
9362
|
+
bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
|
|
9363
|
+
correctScaleY *= max$2(aScale, bScale);
|
|
9364
|
+
if (lockRatio) {
|
|
9365
|
+
aScale = max$2(abs$2(correctScaleX), abs$2(correctScaleY));
|
|
9366
|
+
correctScaleX = sign(correctScaleX) * aScale;
|
|
9367
|
+
correctScaleY = sign(correctScaleY) * aScale;
|
|
9368
|
+
}
|
|
9369
|
+
} else {
|
|
9370
|
+
if (scale.y < 0) tempContent.unsign();
|
|
9371
|
+
aSize = float(tempDragBounds.minY - tempContent.minY);
|
|
9372
|
+
bSize = float(tempContent.maxY - tempDragBounds.maxY);
|
|
9373
|
+
aScale = originTopScale && aSize > 0 ? 1 - aSize / (originTopScale * tempContent.height) : 1;
|
|
9374
|
+
bScale = originBottomScale && bSize > 0 ? 1 - bSize / (originBottomScale * tempContent.height) : 1;
|
|
9375
|
+
correctScaleY = min(aScale, bScale);
|
|
9376
|
+
}
|
|
9377
|
+
scale.x *= isFinite(correctScaleX) ? correctScaleX : 1;
|
|
9378
|
+
scale.y *= isFinite(correctScaleY) ? correctScaleY : 1;
|
|
9379
|
+
return scale;
|
|
9380
|
+
}
|
|
9381
|
+
};
|
|
9382
|
+
const D = DragBoundsHelper;
|
|
9343
9383
|
exports.PointerEvent = class PointerEvent extends UIEvent {};
|
|
9344
9384
|
exports.PointerEvent.POINTER = "pointer";
|
|
9345
9385
|
exports.PointerEvent.BEFORE_DOWN = "pointer.before_down";
|
|
@@ -11075,7 +11115,13 @@ var LeaferUI = function(exports) {
|
|
|
11075
11115
|
shape: shape
|
|
11076
11116
|
};
|
|
11077
11117
|
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;
|
|
11118
|
+
const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
11119
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
11120
|
+
const transform = get$3();
|
|
11121
|
+
translate$1(transform, box.x, box.y);
|
|
11122
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
11123
|
+
data.transform = transform;
|
|
11124
|
+
}
|
|
11079
11125
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
11080
11126
|
const transform = get$3();
|
|
11081
11127
|
translate$1(transform, box.x + x, box.y + y);
|
|
@@ -11090,8 +11136,11 @@ var LeaferUI = function(exports) {
|
|
|
11090
11136
|
const transform = get$3();
|
|
11091
11137
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
11092
11138
|
if (clipScaleX) {
|
|
11093
|
-
|
|
11094
|
-
|
|
11139
|
+
if (rotation || skew) {
|
|
11140
|
+
set(tempMatrix$1);
|
|
11141
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
11142
|
+
multiplyParent(transform, tempMatrix$1);
|
|
11143
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
11095
11144
|
}
|
|
11096
11145
|
data.transform = transform;
|
|
11097
11146
|
}
|
|
@@ -11179,7 +11228,10 @@ var LeaferUI = function(exports) {
|
|
|
11179
11228
|
if (offset) PointHelper.move(tempImage, offset);
|
|
11180
11229
|
switch (mode) {
|
|
11181
11230
|
case "stretch":
|
|
11182
|
-
if (!sameBox)
|
|
11231
|
+
if (!sameBox) {
|
|
11232
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
11233
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
11234
|
+
}
|
|
11183
11235
|
break;
|
|
11184
11236
|
|
|
11185
11237
|
case "normal":
|
|
@@ -11188,7 +11240,7 @@ var LeaferUI = function(exports) {
|
|
|
11188
11240
|
let clipScaleX, clipScaleY;
|
|
11189
11241
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
11190
11242
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
11191
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
11243
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
11192
11244
|
}
|
|
11193
11245
|
break;
|
|
11194
11246
|
|
|
@@ -11205,17 +11257,14 @@ var LeaferUI = function(exports) {
|
|
|
11205
11257
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
11206
11258
|
}
|
|
11207
11259
|
if (!data.transform) {
|
|
11208
|
-
if (box.x || box.y)
|
|
11209
|
-
data.transform = get$2();
|
|
11210
|
-
translate(data.transform, box.x, box.y);
|
|
11211
|
-
}
|
|
11260
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
11212
11261
|
}
|
|
11213
|
-
|
|
11262
|
+
data.width = width;
|
|
11263
|
+
data.height = height;
|
|
11264
|
+
if (scaleX) {
|
|
11214
11265
|
data.scaleX = scaleX;
|
|
11215
11266
|
data.scaleY = scaleY;
|
|
11216
11267
|
}
|
|
11217
|
-
data.width = width;
|
|
11218
|
-
data.height = height;
|
|
11219
11268
|
if (opacity) data.opacity = opacity;
|
|
11220
11269
|
if (filters) data.filters = filters;
|
|
11221
11270
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -11334,7 +11383,7 @@ var LeaferUI = function(exports) {
|
|
|
11334
11383
|
if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
|
|
11335
11384
|
}
|
|
11336
11385
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
11337
|
-
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
11386
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
|
|
11338
11387
|
function createPattern(ui, paint, pixelRatio) {
|
|
11339
11388
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
11340
11389
|
const id = scaleX + "-" + scaleY + "-" + pixelRatio;
|
|
@@ -11344,8 +11393,8 @@ var LeaferUI = function(exports) {
|
|
|
11344
11393
|
scaleX *= pixelRatio;
|
|
11345
11394
|
scaleY *= pixelRatio;
|
|
11346
11395
|
if (sx) {
|
|
11347
|
-
sx = abs(sx);
|
|
11348
|
-
sy = abs(sy);
|
|
11396
|
+
sx = abs$1(sx);
|
|
11397
|
+
sy = abs$1(sy);
|
|
11349
11398
|
imageMatrix = get$1();
|
|
11350
11399
|
copy$1(imageMatrix, transform);
|
|
11351
11400
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -11483,6 +11532,7 @@ var LeaferUI = function(exports) {
|
|
|
11483
11532
|
recycleImage: recycleImage,
|
|
11484
11533
|
createData: createData,
|
|
11485
11534
|
getPatternData: getPatternData,
|
|
11535
|
+
stretchMode: stretchMode,
|
|
11486
11536
|
fillOrFitMode: fillOrFitMode,
|
|
11487
11537
|
clipMode: clipMode,
|
|
11488
11538
|
repeatMode: repeatMode
|
|
@@ -11574,7 +11624,7 @@ var LeaferUI = function(exports) {
|
|
|
11574
11624
|
conicGradient: conicGradient,
|
|
11575
11625
|
getTransform: getTransform
|
|
11576
11626
|
};
|
|
11577
|
-
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
11627
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max, abs: abs} = Math;
|
|
11578
11628
|
const tempBounds = {}, tempMatrix = new Matrix;
|
|
11579
11629
|
const offsetOutBounds$1 = {};
|
|
11580
11630
|
function shadow(ui, current, shape) {
|
|
@@ -11614,7 +11664,7 @@ var LeaferUI = function(exports) {
|
|
|
11614
11664
|
function getShadowRenderSpread(_ui, shadow) {
|
|
11615
11665
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
11616
11666
|
shadow.forEach(item => {
|
|
11617
|
-
x = item.x || 0, y = item.y || 0,
|
|
11667
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs(item.spread || 0);
|
|
11618
11668
|
top = max(top, spread + blur - y);
|
|
11619
11669
|
right = max(right, spread + blur + x);
|
|
11620
11670
|
bottom = max(bottom, spread + blur + y);
|