@leafer-ui/worker 1.9.5 → 1.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.cjs +27 -7
- package/dist/worker.esm.js +28 -8
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +173 -103
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +190 -117
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/worker.js
CHANGED
|
@@ -344,7 +344,7 @@ var LeaferUI = function(exports) {
|
|
|
344
344
|
};
|
|
345
345
|
}
|
|
346
346
|
const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
|
|
347
|
-
const {float: float$
|
|
347
|
+
const {float: float$2} = MathHelper;
|
|
348
348
|
const tempPoint$3 = {};
|
|
349
349
|
function getWorld() {
|
|
350
350
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
|
|
@@ -392,6 +392,15 @@ var LeaferUI = function(exports) {
|
|
|
392
392
|
t.c *= scaleY;
|
|
393
393
|
t.d *= scaleY;
|
|
394
394
|
},
|
|
395
|
+
pixelScale(t, pixelRatio, to) {
|
|
396
|
+
to || (to = t);
|
|
397
|
+
to.a = t.a * pixelRatio;
|
|
398
|
+
to.b = t.b * pixelRatio;
|
|
399
|
+
to.c = t.c * pixelRatio;
|
|
400
|
+
to.d = t.d * pixelRatio;
|
|
401
|
+
to.e = t.e * pixelRatio;
|
|
402
|
+
to.f = t.f * pixelRatio;
|
|
403
|
+
},
|
|
395
404
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
396
405
|
M$6.toInnerPoint(t, origin, tempPoint$3);
|
|
397
406
|
M$6.scaleOfInner(t, tempPoint$3, scaleX, scaleY);
|
|
@@ -583,12 +592,12 @@ var LeaferUI = function(exports) {
|
|
|
583
592
|
const cosR = c / scaleY;
|
|
584
593
|
rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
|
|
585
594
|
}
|
|
586
|
-
const cosR = float$
|
|
595
|
+
const cosR = float$2(cos$5(rotation));
|
|
587
596
|
const sinR = sin$5(rotation);
|
|
588
|
-
scaleX = float$
|
|
589
|
-
skewX = cosR ? float$
|
|
590
|
-
skewY = cosR ? float$
|
|
591
|
-
rotation = float$
|
|
597
|
+
scaleX = float$2(scaleX), scaleY = float$2(scaleY);
|
|
598
|
+
skewX = cosR ? float$2((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
599
|
+
skewY = cosR ? float$2((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
600
|
+
rotation = float$2(rotation / OneRadian);
|
|
592
601
|
} else {
|
|
593
602
|
scaleX = a;
|
|
594
603
|
scaleY = d;
|
|
@@ -882,6 +891,10 @@ var LeaferUI = function(exports) {
|
|
|
882
891
|
this.scaleY *= y || x;
|
|
883
892
|
return this;
|
|
884
893
|
}
|
|
894
|
+
pixelScale(pixelRatio) {
|
|
895
|
+
MatrixHelper.pixelScale(this, pixelRatio);
|
|
896
|
+
return this;
|
|
897
|
+
}
|
|
885
898
|
scaleOfOuter(origin, x, y) {
|
|
886
899
|
MatrixHelper.scaleOfOuter(this, origin, x, y);
|
|
887
900
|
return this;
|
|
@@ -1085,7 +1098,7 @@ var LeaferUI = function(exports) {
|
|
|
1085
1098
|
};
|
|
1086
1099
|
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
1087
1100
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1088
|
-
const {float: float, fourNumber: fourNumber} = MathHelper;
|
|
1101
|
+
const {float: float$1, fourNumber: fourNumber} = MathHelper;
|
|
1089
1102
|
const {floor: floor$2, ceil: ceil$2} = Math;
|
|
1090
1103
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
1091
1104
|
const point = {};
|
|
@@ -1262,10 +1275,10 @@ var LeaferUI = function(exports) {
|
|
|
1262
1275
|
}
|
|
1263
1276
|
},
|
|
1264
1277
|
float(t, maxLength) {
|
|
1265
|
-
t.x = float(t.x, maxLength);
|
|
1266
|
-
t.y = float(t.y, maxLength);
|
|
1267
|
-
t.width = float(t.width, maxLength);
|
|
1268
|
-
t.height = float(t.height, maxLength);
|
|
1278
|
+
t.x = float$1(t.x, maxLength);
|
|
1279
|
+
t.y = float$1(t.y, maxLength);
|
|
1280
|
+
t.width = float$1(t.width, maxLength);
|
|
1281
|
+
t.height = float$1(t.height, maxLength);
|
|
1269
1282
|
},
|
|
1270
1283
|
add(t, bounds, isPoint) {
|
|
1271
1284
|
right$1 = t.x + t.width;
|
|
@@ -1991,7 +2004,7 @@ var LeaferUI = function(exports) {
|
|
|
1991
2004
|
__decorate([ contextMethod() ], Canvas.prototype, "fillText", null);
|
|
1992
2005
|
__decorate([ contextMethod() ], Canvas.prototype, "measureText", null);
|
|
1993
2006
|
__decorate([ contextMethod() ], Canvas.prototype, "strokeText", null);
|
|
1994
|
-
const {copy: copy$8, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2007
|
+
const {copy: copy$8, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
1995
2008
|
const minSize = {
|
|
1996
2009
|
width: 1,
|
|
1997
2010
|
height: 1,
|
|
@@ -2089,12 +2102,7 @@ var LeaferUI = function(exports) {
|
|
|
2089
2102
|
setWorld(matrix, parentMatrix) {
|
|
2090
2103
|
const {pixelRatio: pixelRatio, pixelSnap: pixelSnap} = this, w = this.worldTransform;
|
|
2091
2104
|
if (parentMatrix) multiplyParent$4(matrix, parentMatrix, w);
|
|
2092
|
-
|
|
2093
|
-
w.b = matrix.b * pixelRatio;
|
|
2094
|
-
w.c = matrix.c * pixelRatio;
|
|
2095
|
-
w.d = matrix.d * pixelRatio;
|
|
2096
|
-
w.e = matrix.e * pixelRatio;
|
|
2097
|
-
w.f = matrix.f * pixelRatio;
|
|
2105
|
+
pixelScale(matrix, pixelRatio, w);
|
|
2098
2106
|
if (pixelSnap) {
|
|
2099
2107
|
if (matrix.half && matrix.half * pixelRatio % 2) w.e = round$1(w.e - .5) + .5, w.f = round$1(w.f - .5) + .5; else w.e = round$1(w.e),
|
|
2100
2108
|
w.f = round$1(w.f);
|
|
@@ -4008,6 +4016,17 @@ var LeaferUI = function(exports) {
|
|
|
4008
4016
|
}
|
|
4009
4017
|
}));
|
|
4010
4018
|
}
|
|
4019
|
+
function dimType(defaultValue) {
|
|
4020
|
+
return decorateLeafAttr(defaultValue, key => attr({
|
|
4021
|
+
set(value) {
|
|
4022
|
+
if (this.__setAttr(key, value)) {
|
|
4023
|
+
const data = this.__;
|
|
4024
|
+
DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
|
|
4025
|
+
this.__layout.surfaceChange();
|
|
4026
|
+
}
|
|
4027
|
+
}
|
|
4028
|
+
}));
|
|
4029
|
+
}
|
|
4011
4030
|
function opacityType(defaultValue) {
|
|
4012
4031
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4013
4032
|
set(value) {
|
|
@@ -4048,7 +4067,7 @@ var LeaferUI = function(exports) {
|
|
|
4048
4067
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4049
4068
|
set(value) {
|
|
4050
4069
|
if (this.__setAttr(key, value)) {
|
|
4051
|
-
this.__layout.
|
|
4070
|
+
this.__layout.surfaceChange();
|
|
4052
4071
|
this.waitParent(() => {
|
|
4053
4072
|
this.parent.__layout.childrenSortChange();
|
|
4054
4073
|
});
|
|
@@ -4082,7 +4101,7 @@ var LeaferUI = function(exports) {
|
|
|
4082
4101
|
set(value) {
|
|
4083
4102
|
if (this.__setAttr(key, value)) {
|
|
4084
4103
|
this.__layout.hitCanvasChanged = true;
|
|
4085
|
-
if (Debug.showBounds === "hit") this.__layout.
|
|
4104
|
+
if (Debug.showBounds === "hit") this.__layout.surfaceChange();
|
|
4086
4105
|
if (this.leafer) this.leafer.updateCursor();
|
|
4087
4106
|
}
|
|
4088
4107
|
}
|
|
@@ -5105,6 +5124,7 @@ var LeaferUI = function(exports) {
|
|
|
5105
5124
|
LeaferEvent.STOP = "leafer.stop";
|
|
5106
5125
|
LeaferEvent.RESTART = "leafer.restart";
|
|
5107
5126
|
LeaferEvent.END = "leafer.end";
|
|
5127
|
+
LeaferEvent.UPDATE_MODE = "leafer.update_mode";
|
|
5108
5128
|
LeaferEvent.TRANSFORM = "leafer.transform";
|
|
5109
5129
|
LeaferEvent.MOVE = "leafer.move";
|
|
5110
5130
|
LeaferEvent.SCALE = "leafer.scale";
|
|
@@ -5479,6 +5499,7 @@ var LeaferUI = function(exports) {
|
|
|
5479
5499
|
if (options.shape) return this.__renderShape(canvas, options);
|
|
5480
5500
|
if (this.__worldOpacity) {
|
|
5481
5501
|
const data = this.__;
|
|
5502
|
+
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
5482
5503
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5483
5504
|
canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
5484
5505
|
if (this.__.__single) {
|
|
@@ -5525,7 +5546,9 @@ var LeaferUI = function(exports) {
|
|
|
5525
5546
|
this.__nowWorld = this.__getNowWorld(options);
|
|
5526
5547
|
if (this.__worldOpacity) {
|
|
5527
5548
|
const data = this.__;
|
|
5528
|
-
if (data.
|
|
5549
|
+
if (data.__useDim) {
|
|
5550
|
+
if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.bright && !options.topRendering) return options.topList.add(this); else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
|
|
5551
|
+
}
|
|
5529
5552
|
if (data.__single && !this.isBranchLeaf) {
|
|
5530
5553
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
5531
5554
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
@@ -6350,7 +6373,7 @@ var LeaferUI = function(exports) {
|
|
|
6350
6373
|
this.levelMap = null;
|
|
6351
6374
|
}
|
|
6352
6375
|
}
|
|
6353
|
-
const version = "1.9.
|
|
6376
|
+
const version = "1.9.7";
|
|
6354
6377
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6355
6378
|
get allowBackgroundColor() {
|
|
6356
6379
|
return true;
|
|
@@ -6877,7 +6900,7 @@ var LeaferUI = function(exports) {
|
|
|
6877
6900
|
};
|
|
6878
6901
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
6879
6902
|
if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
|
|
6880
|
-
this.target
|
|
6903
|
+
Platform.render(this.target, canvas, options);
|
|
6881
6904
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
6882
6905
|
this.renderOptions = options;
|
|
6883
6906
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
@@ -7046,7 +7069,7 @@ var LeaferUI = function(exports) {
|
|
|
7046
7069
|
item = path.list[i];
|
|
7047
7070
|
if (!item.__.hittable) break;
|
|
7048
7071
|
hittablePath.addAt(item, 0);
|
|
7049
|
-
if (!item.__.hitChildren) break;
|
|
7072
|
+
if (!item.__.hitChildren || item.isLeafer && item.mode === "draw") break;
|
|
7050
7073
|
}
|
|
7051
7074
|
return hittablePath;
|
|
7052
7075
|
}
|
|
@@ -7146,6 +7169,14 @@ var LeaferUI = function(exports) {
|
|
|
7146
7169
|
selector: (target, options) => new Selector(target, options)
|
|
7147
7170
|
});
|
|
7148
7171
|
Platform.layout = Layouter.fullLayout;
|
|
7172
|
+
Platform.render = function(target, canvas, options) {
|
|
7173
|
+
const topOptions = Object.assign(Object.assign({}, options), {
|
|
7174
|
+
topRendering: true
|
|
7175
|
+
});
|
|
7176
|
+
options.topList = new LeafList;
|
|
7177
|
+
target.__render(canvas, options);
|
|
7178
|
+
if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
|
|
7179
|
+
};
|
|
7149
7180
|
function effectType(defaultValue) {
|
|
7150
7181
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
7151
7182
|
set(value) {
|
|
@@ -7464,8 +7495,6 @@ var LeaferUI = function(exports) {
|
|
|
7464
7495
|
if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
|
|
7465
7496
|
box.set(value);
|
|
7466
7497
|
if (boxLayout.strokeChanged) layout.strokeChange();
|
|
7467
|
-
if (boxLayout.renderChanged) layout.renderChange();
|
|
7468
|
-
box.__updateChange();
|
|
7469
7498
|
} else if (box) {
|
|
7470
7499
|
t.__box = box.parent = null;
|
|
7471
7500
|
box.destroy();
|
|
@@ -7532,7 +7561,7 @@ var LeaferUI = function(exports) {
|
|
|
7532
7561
|
__updateRenderSpread() {
|
|
7533
7562
|
let width = 0;
|
|
7534
7563
|
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
|
|
7535
|
-
if (shadow)
|
|
7564
|
+
if (shadow) width = Effect.getShadowSpread(this, shadow);
|
|
7536
7565
|
if (blur) width = Math.max(width, blur);
|
|
7537
7566
|
if (filter) width += Filter.getSpread(filter);
|
|
7538
7567
|
if (renderSpread) width += renderSpread;
|
|
@@ -7544,36 +7573,67 @@ var LeaferUI = function(exports) {
|
|
|
7544
7573
|
return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width;
|
|
7545
7574
|
}
|
|
7546
7575
|
};
|
|
7576
|
+
const {float: float} = MathHelper;
|
|
7577
|
+
const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
|
|
7547
7578
|
const DragBoundsHelper = {
|
|
7579
|
+
limitMove(leaf, move) {
|
|
7580
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7581
|
+
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
|
|
7582
|
+
D.axisMove(leaf, move);
|
|
7583
|
+
},
|
|
7584
|
+
limitScaleOf(leaf, origin, scale) {
|
|
7585
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7586
|
+
if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
|
|
7587
|
+
},
|
|
7588
|
+
axisMove(leaf, move) {
|
|
7589
|
+
const {draggable: draggable} = leaf;
|
|
7590
|
+
if (draggable === "x") move.y = 0;
|
|
7591
|
+
if (draggable === "y") move.x = 0;
|
|
7592
|
+
},
|
|
7593
|
+
getDragBounds(leaf) {
|
|
7594
|
+
const {dragBounds: dragBounds} = leaf;
|
|
7595
|
+
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
7596
|
+
},
|
|
7597
|
+
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
7598
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
7599
|
+
},
|
|
7548
7600
|
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
7549
7601
|
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
7550
7602
|
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
7551
7603
|
if (!change) move = Object.assign({}, move);
|
|
7552
|
-
|
|
7553
|
-
const isBiggerHeight = content.height > dragBounds.height;
|
|
7554
|
-
if (isBiggerWidth && dragBoundsType !== "outer") {
|
|
7604
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7555
7605
|
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
7556
7606
|
} else {
|
|
7557
7607
|
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
7558
7608
|
}
|
|
7559
|
-
if (
|
|
7609
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7560
7610
|
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
7561
7611
|
} else {
|
|
7562
7612
|
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
7563
7613
|
}
|
|
7564
|
-
move.x =
|
|
7565
|
-
move.y =
|
|
7614
|
+
move.x = float(move.x);
|
|
7615
|
+
move.y = float(move.y);
|
|
7566
7616
|
return move;
|
|
7567
7617
|
},
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7618
|
+
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
|
|
7619
|
+
if (!change) scale = Object.assign({}, scale);
|
|
7620
|
+
let fitScaleX, fitScaleY;
|
|
7621
|
+
tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
|
|
7622
|
+
tempMerge.set(tempContent).add(dragBounds);
|
|
7623
|
+
tempIntersect.set(tempContent).intersect(dragBounds);
|
|
7624
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7625
|
+
fitScaleX = tempMerge.width / tempContent.width;
|
|
7626
|
+
} else {
|
|
7627
|
+
fitScaleX = tempIntersect.width / tempContent.width;
|
|
7628
|
+
}
|
|
7629
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7630
|
+
fitScaleY = tempMerge.height / tempContent.height;
|
|
7631
|
+
} else {
|
|
7632
|
+
fitScaleY = tempIntersect.height / tempContent.height;
|
|
7633
|
+
}
|
|
7634
|
+
scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
7635
|
+
scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
7636
|
+
return scale;
|
|
7577
7637
|
}
|
|
7578
7638
|
};
|
|
7579
7639
|
const D = DragBoundsHelper;
|
|
@@ -7588,7 +7648,7 @@ var LeaferUI = function(exports) {
|
|
|
7588
7648
|
}
|
|
7589
7649
|
if (data.__useEffect) {
|
|
7590
7650
|
const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7591
|
-
stintSet$1(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
|
|
7651
|
+
stintSet$1(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
|
|
7592
7652
|
data.__useEffect = !!(shadow || otherEffect);
|
|
7593
7653
|
}
|
|
7594
7654
|
data.__checkSingle();
|
|
@@ -7834,8 +7894,8 @@ var LeaferUI = function(exports) {
|
|
|
7834
7894
|
__decorate([ opacityType(1) ], exports.UI.prototype, "opacity", void 0);
|
|
7835
7895
|
__decorate([ visibleType(true) ], exports.UI.prototype, "visible", void 0);
|
|
7836
7896
|
__decorate([ surfaceType(false) ], exports.UI.prototype, "locked", void 0);
|
|
7837
|
-
__decorate([
|
|
7838
|
-
__decorate([
|
|
7897
|
+
__decorate([ dimType(false) ], exports.UI.prototype, "dim", void 0);
|
|
7898
|
+
__decorate([ dimType(false) ], exports.UI.prototype, "dimskip", void 0);
|
|
7839
7899
|
__decorate([ sortType(0) ], exports.UI.prototype, "zIndex", void 0);
|
|
7840
7900
|
__decorate([ maskType(false) ], exports.UI.prototype, "mask", void 0);
|
|
7841
7901
|
__decorate([ eraserType(false) ], exports.UI.prototype, "eraser", void 0);
|
|
@@ -8140,7 +8200,9 @@ var LeaferUI = function(exports) {
|
|
|
8140
8200
|
} else if (attrName === "zIndex") {
|
|
8141
8201
|
this.canvas.zIndex = newValue;
|
|
8142
8202
|
setTimeout(() => this.parent && this.parent.__updateSortChildren());
|
|
8143
|
-
}
|
|
8203
|
+
} else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
|
|
8204
|
+
mode: newValue
|
|
8205
|
+
});
|
|
8144
8206
|
}
|
|
8145
8207
|
return super.__setAttr(attrName, newValue);
|
|
8146
8208
|
}
|
|
@@ -8319,6 +8381,7 @@ var LeaferUI = function(exports) {
|
|
|
8319
8381
|
exports.Leafer.list = new LeafList;
|
|
8320
8382
|
__decorate([ dataProcessor(LeaferData) ], exports.Leafer.prototype, "__", void 0);
|
|
8321
8383
|
__decorate([ boundsType() ], exports.Leafer.prototype, "pixelRatio", void 0);
|
|
8384
|
+
__decorate([ dataType("normal") ], exports.Leafer.prototype, "mode", void 0);
|
|
8322
8385
|
exports.Leafer = Leafer_1 = __decorate([ registerUI() ], exports.Leafer);
|
|
8323
8386
|
exports.Rect = class Rect extends exports.UI {
|
|
8324
8387
|
get __tag() {
|
|
@@ -8478,45 +8541,8 @@ var LeaferUI = function(exports) {
|
|
|
8478
8541
|
__decorate([ pathType(0) ], exports.Ellipse.prototype, "startAngle", void 0);
|
|
8479
8542
|
__decorate([ pathType(0) ], exports.Ellipse.prototype, "endAngle", void 0);
|
|
8480
8543
|
exports.Ellipse = __decorate([ registerUI() ], exports.Ellipse);
|
|
8481
|
-
const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
8482
|
-
const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
|
|
8483
|
-
exports.Line = class Line extends exports.UI {
|
|
8484
|
-
get __tag() {
|
|
8485
|
-
return "Line";
|
|
8486
|
-
}
|
|
8487
|
-
get toPoint() {
|
|
8488
|
-
const {width: width, rotation: rotation} = this.__;
|
|
8489
|
-
const to = getPointData();
|
|
8490
|
-
if (width) to.x = width;
|
|
8491
|
-
if (rotation) rotate$1(to, rotation);
|
|
8492
|
-
return to;
|
|
8493
|
-
}
|
|
8494
|
-
set toPoint(value) {
|
|
8495
|
-
this.width = getDistance$2(defaultPoint, value);
|
|
8496
|
-
this.rotation = getAngle$1(defaultPoint, value);
|
|
8497
|
-
if (this.height) this.height = 0;
|
|
8498
|
-
}
|
|
8499
|
-
__updatePath() {
|
|
8500
|
-
const data = this.__;
|
|
8501
|
-
const path = data.path = [];
|
|
8502
|
-
if (data.points) {
|
|
8503
|
-
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
8504
|
-
} else {
|
|
8505
|
-
moveTo$2(path, 0, 0);
|
|
8506
|
-
lineTo$2(path, this.width, 0);
|
|
8507
|
-
}
|
|
8508
|
-
}
|
|
8509
|
-
};
|
|
8510
|
-
__decorate([ dataProcessor(LineData) ], exports.Line.prototype, "__", void 0);
|
|
8511
|
-
__decorate([ affectStrokeBoundsType("center") ], exports.Line.prototype, "strokeAlign", void 0);
|
|
8512
|
-
__decorate([ boundsType(0) ], exports.Line.prototype, "height", void 0);
|
|
8513
|
-
__decorate([ pathType() ], exports.Line.prototype, "points", void 0);
|
|
8514
|
-
__decorate([ pathType(0) ], exports.Line.prototype, "curve", void 0);
|
|
8515
|
-
__decorate([ pathType(false) ], exports.Line.prototype, "closed", void 0);
|
|
8516
|
-
exports.Line = __decorate([ registerUI() ], exports.Line);
|
|
8517
8544
|
const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
|
|
8518
|
-
const {moveTo: moveTo$
|
|
8519
|
-
const line = exports.Line.prototype;
|
|
8545
|
+
const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
8520
8546
|
exports.Polygon = class Polygon extends exports.UI {
|
|
8521
8547
|
get __tag() {
|
|
8522
8548
|
return "Polygon";
|
|
@@ -8525,29 +8551,25 @@ var LeaferUI = function(exports) {
|
|
|
8525
8551
|
const data = this.__;
|
|
8526
8552
|
const path = data.path = [];
|
|
8527
8553
|
if (data.points) {
|
|
8528
|
-
drawPoints(path, data.points, data.curve, true);
|
|
8554
|
+
drawPoints$1(path, data.points, data.curve, true);
|
|
8529
8555
|
} else {
|
|
8530
8556
|
const {width: width, height: height, sides: sides} = data;
|
|
8531
8557
|
const rx = width / 2, ry = height / 2;
|
|
8532
|
-
moveTo$
|
|
8558
|
+
moveTo$2(path, rx, 0);
|
|
8533
8559
|
for (let i = 1; i < sides; i++) {
|
|
8534
|
-
lineTo$
|
|
8560
|
+
lineTo$2(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
|
|
8535
8561
|
}
|
|
8536
8562
|
closePath$1(path);
|
|
8537
8563
|
}
|
|
8538
8564
|
}
|
|
8539
|
-
__updateRenderPath() {}
|
|
8540
|
-
__updateBoxBounds() {}
|
|
8541
8565
|
};
|
|
8542
8566
|
__decorate([ dataProcessor(PolygonData) ], exports.Polygon.prototype, "__", void 0);
|
|
8543
8567
|
__decorate([ pathType(3) ], exports.Polygon.prototype, "sides", void 0);
|
|
8544
8568
|
__decorate([ pathType() ], exports.Polygon.prototype, "points", void 0);
|
|
8545
8569
|
__decorate([ pathType(0) ], exports.Polygon.prototype, "curve", void 0);
|
|
8546
|
-
__decorate([ rewrite(line.__updateRenderPath) ], exports.Polygon.prototype, "__updateRenderPath", null);
|
|
8547
|
-
__decorate([ rewrite(line.__updateBoxBounds) ], exports.Polygon.prototype, "__updateBoxBounds", null);
|
|
8548
8570
|
exports.Polygon = __decorate([ rewriteAble(), registerUI() ], exports.Polygon);
|
|
8549
8571
|
const {sin: sin, cos: cos, PI: PI} = Math;
|
|
8550
|
-
const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
|
|
8572
|
+
const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
|
|
8551
8573
|
exports.Star = class Star extends exports.UI {
|
|
8552
8574
|
get __tag() {
|
|
8553
8575
|
return "Star";
|
|
@@ -8556,9 +8578,9 @@ var LeaferUI = function(exports) {
|
|
|
8556
8578
|
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
8557
8579
|
const rx = width / 2, ry = height / 2;
|
|
8558
8580
|
const path = this.__.path = [];
|
|
8559
|
-
moveTo(path, rx, 0);
|
|
8581
|
+
moveTo$1(path, rx, 0);
|
|
8560
8582
|
for (let i = 1; i < corners * 2; i++) {
|
|
8561
|
-
lineTo(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
|
|
8583
|
+
lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
|
|
8562
8584
|
}
|
|
8563
8585
|
closePath(path);
|
|
8564
8586
|
}
|
|
@@ -8567,6 +8589,42 @@ var LeaferUI = function(exports) {
|
|
|
8567
8589
|
__decorate([ pathType(5) ], exports.Star.prototype, "corners", void 0);
|
|
8568
8590
|
__decorate([ pathType(.382) ], exports.Star.prototype, "innerRadius", void 0);
|
|
8569
8591
|
exports.Star = __decorate([ registerUI() ], exports.Star);
|
|
8592
|
+
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
8593
|
+
const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
|
|
8594
|
+
exports.Line = class Line extends exports.UI {
|
|
8595
|
+
get __tag() {
|
|
8596
|
+
return "Line";
|
|
8597
|
+
}
|
|
8598
|
+
get toPoint() {
|
|
8599
|
+
const {width: width, rotation: rotation} = this.__;
|
|
8600
|
+
const to = getPointData();
|
|
8601
|
+
if (width) to.x = width;
|
|
8602
|
+
if (rotation) rotate$1(to, rotation);
|
|
8603
|
+
return to;
|
|
8604
|
+
}
|
|
8605
|
+
set toPoint(value) {
|
|
8606
|
+
this.width = getDistance$2(defaultPoint, value);
|
|
8607
|
+
this.rotation = getAngle$1(defaultPoint, value);
|
|
8608
|
+
if (this.height) this.height = 0;
|
|
8609
|
+
}
|
|
8610
|
+
__updatePath() {
|
|
8611
|
+
const data = this.__;
|
|
8612
|
+
const path = data.path = [];
|
|
8613
|
+
if (data.points) {
|
|
8614
|
+
drawPoints(path, data.points, data.curve, data.closed);
|
|
8615
|
+
} else {
|
|
8616
|
+
moveTo(path, 0, 0);
|
|
8617
|
+
lineTo(path, this.width, 0);
|
|
8618
|
+
}
|
|
8619
|
+
}
|
|
8620
|
+
};
|
|
8621
|
+
__decorate([ dataProcessor(LineData) ], exports.Line.prototype, "__", void 0);
|
|
8622
|
+
__decorate([ affectStrokeBoundsType("center") ], exports.Line.prototype, "strokeAlign", void 0);
|
|
8623
|
+
__decorate([ boundsType(0) ], exports.Line.prototype, "height", void 0);
|
|
8624
|
+
__decorate([ pathType() ], exports.Line.prototype, "points", void 0);
|
|
8625
|
+
__decorate([ pathType(0) ], exports.Line.prototype, "curve", void 0);
|
|
8626
|
+
__decorate([ pathType(false) ], exports.Line.prototype, "closed", void 0);
|
|
8627
|
+
exports.Line = __decorate([ registerUI() ], exports.Line);
|
|
8570
8628
|
exports.Image = class Image extends exports.Rect {
|
|
8571
8629
|
get __tag() {
|
|
8572
8630
|
return "Image";
|
|
@@ -8699,10 +8757,6 @@ var LeaferUI = function(exports) {
|
|
|
8699
8757
|
DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
|
|
8700
8758
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
8701
8759
|
}
|
|
8702
|
-
__onUpdateSize() {
|
|
8703
|
-
if (this.__box) this.__box.__onUpdateSize();
|
|
8704
|
-
super.__onUpdateSize();
|
|
8705
|
-
}
|
|
8706
8760
|
__updateRenderSpread() {
|
|
8707
8761
|
let width = super.__updateRenderSpread();
|
|
8708
8762
|
if (!width) width = this.isOverflow ? 1 : 0;
|
|
@@ -8713,6 +8767,11 @@ var LeaferUI = function(exports) {
|
|
|
8713
8767
|
copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
8714
8768
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
8715
8769
|
}
|
|
8770
|
+
__updateChange() {
|
|
8771
|
+
super.__updateChange();
|
|
8772
|
+
const box = this.__box;
|
|
8773
|
+
if (box) box.__onUpdateSize(), box.__updateChange();
|
|
8774
|
+
}
|
|
8716
8775
|
__drawRenderPath(canvas) {
|
|
8717
8776
|
canvas.font = this.__.__font;
|
|
8718
8777
|
}
|
|
@@ -10964,11 +11023,16 @@ var LeaferUI = function(exports) {
|
|
|
10964
11023
|
}
|
|
10965
11024
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
10966
11025
|
}
|
|
10967
|
-
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
11026
|
+
if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
10968
11027
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
10969
11028
|
});
|
|
10970
11029
|
other.recycle(copyBounds);
|
|
10971
11030
|
}
|
|
11031
|
+
function getShadowSpread(_ui, shadow) {
|
|
11032
|
+
let width = 0;
|
|
11033
|
+
shadow.forEach(item => width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5));
|
|
11034
|
+
return width;
|
|
11035
|
+
}
|
|
10972
11036
|
function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
|
|
10973
11037
|
const {bounds: bounds, shapeBounds: shapeBounds} = shape;
|
|
10974
11038
|
if (Platform.fullImageShadow) {
|
|
@@ -11040,7 +11104,11 @@ var LeaferUI = function(exports) {
|
|
|
11040
11104
|
shadow: shadow,
|
|
11041
11105
|
innerShadow: innerShadow,
|
|
11042
11106
|
blur: blur,
|
|
11043
|
-
backgroundBlur: backgroundBlur
|
|
11107
|
+
backgroundBlur: backgroundBlur,
|
|
11108
|
+
getShadowSpread: getShadowSpread,
|
|
11109
|
+
isTransformShadow(_shadow) {
|
|
11110
|
+
return undefined;
|
|
11111
|
+
}
|
|
11044
11112
|
};
|
|
11045
11113
|
const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
|
|
11046
11114
|
let usedGrayscaleAlpha;
|
|
@@ -11496,16 +11564,17 @@ var LeaferUI = function(exports) {
|
|
|
11496
11564
|
row.data = null;
|
|
11497
11565
|
}
|
|
11498
11566
|
function decorationText(drawData, style) {
|
|
11499
|
-
let type;
|
|
11567
|
+
let type, offset = 0;
|
|
11500
11568
|
const {fontSize: fontSize, textDecoration: textDecoration} = style;
|
|
11501
11569
|
drawData.decorationHeight = fontSize / 11;
|
|
11502
11570
|
if (isObject(textDecoration)) {
|
|
11503
11571
|
type = textDecoration.type;
|
|
11504
11572
|
if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
|
|
11573
|
+
if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
|
|
11505
11574
|
} else type = textDecoration;
|
|
11506
11575
|
switch (type) {
|
|
11507
11576
|
case "under":
|
|
11508
|
-
drawData.decorationY = [ fontSize * .15 ];
|
|
11577
|
+
drawData.decorationY = [ fontSize * .15 + offset ];
|
|
11509
11578
|
break;
|
|
11510
11579
|
|
|
11511
11580
|
case "delete":
|
|
@@ -11513,7 +11582,7 @@ var LeaferUI = function(exports) {
|
|
|
11513
11582
|
break;
|
|
11514
11583
|
|
|
11515
11584
|
case "under-delete":
|
|
11516
|
-
drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
|
|
11585
|
+
drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
|
|
11517
11586
|
}
|
|
11518
11587
|
}
|
|
11519
11588
|
const {top: top, right: right, bottom: bottom, left: left} = exports.Direction4;
|
|
@@ -11736,6 +11805,7 @@ var LeaferUI = function(exports) {
|
|
|
11736
11805
|
exports.defineDataProcessor = defineDataProcessor;
|
|
11737
11806
|
exports.defineKey = defineKey;
|
|
11738
11807
|
exports.defineLeafAttr = defineLeafAttr;
|
|
11808
|
+
exports.dimType = dimType;
|
|
11739
11809
|
exports.doBoundsType = doBoundsType;
|
|
11740
11810
|
exports.doStrokeType = doStrokeType;
|
|
11741
11811
|
exports.effectType = effectType;
|