@leafer/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 +11 -0
- package/dist/worker.esm.js +2 -0
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.js +242 -152
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +262 -167
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +23 -22
- package/src/index.ts +2 -0
- package/types/index.d.ts +1 -0
package/dist/worker.js
CHANGED
|
@@ -344,7 +344,7 @@ var LeaferUI = function(exports) {
|
|
|
344
344
|
};
|
|
345
345
|
}
|
|
346
346
|
const {sin: sin$6, cos: cos$6, acos: acos, sqrt: sqrt$5} = Math;
|
|
347
|
-
const {float: float$
|
|
347
|
+
const {float: float$3} = MathHelper;
|
|
348
348
|
const tempPoint$4 = {};
|
|
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$a.toInnerPoint(t, origin, tempPoint$4);
|
|
397
406
|
M$a.scaleOfInner(t, tempPoint$4, 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$3(cos$6(rotation));
|
|
587
596
|
const sinR = sin$6(rotation);
|
|
588
|
-
scaleX = float$
|
|
589
|
-
skewX = cosR ? float$
|
|
590
|
-
skewY = cosR ? float$
|
|
591
|
-
rotation = float$
|
|
597
|
+
scaleX = float$3(scaleX), scaleY = float$3(scaleY);
|
|
598
|
+
skewX = cosR ? float$3((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
599
|
+
skewY = cosR ? float$3((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
600
|
+
rotation = float$3(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$5, addPoint: addPoint$3, toBounds: toBounds$3} = TwoPointBoundsHelper;
|
|
1087
1100
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1088
|
-
const {float: float$
|
|
1101
|
+
const {float: float$2, fourNumber: fourNumber$1} = MathHelper;
|
|
1089
1102
|
const {floor: floor$3, ceil: ceil$3} = Math;
|
|
1090
1103
|
let right$4, bottom$3, boundsRight, boundsBottom;
|
|
1091
1104
|
const point$2 = {};
|
|
@@ -1262,10 +1275,10 @@ var LeaferUI = function(exports) {
|
|
|
1262
1275
|
}
|
|
1263
1276
|
},
|
|
1264
1277
|
float(t, maxLength) {
|
|
1265
|
-
t.x = float$
|
|
1266
|
-
t.y = float$
|
|
1267
|
-
t.width = float$
|
|
1268
|
-
t.height = float$
|
|
1278
|
+
t.x = float$2(t.x, maxLength);
|
|
1279
|
+
t.y = float$2(t.y, maxLength);
|
|
1280
|
+
t.width = float$2(t.width, maxLength);
|
|
1281
|
+
t.height = float$2(t.height, maxLength);
|
|
1269
1282
|
},
|
|
1270
1283
|
add(t, bounds, isPoint) {
|
|
1271
1284
|
right$4 = 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$b, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2007
|
+
const {copy: copy$b, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$4} = 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$4(w.e - .5) + .5, w.f = round$4(w.f - .5) + .5; else w.e = round$4(w.e),
|
|
2100
2108
|
w.f = round$4(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$1} = 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$2.getValidMove(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, move, true);
|
|
7582
|
+
D$2.axisMove(leaf, move);
|
|
7583
|
+
},
|
|
7584
|
+
limitScaleOf(leaf, origin, scale) {
|
|
7585
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7586
|
+
if (dragBounds) D$2.getValidScaleOf(leaf.__localBoxBounds, D$2.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$2.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$2.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$1(move.x);
|
|
7615
|
+
move.y = float$1(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$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7625
|
+
fitScaleX = tempMerge.width / tempContent.width;
|
|
7626
|
+
} else {
|
|
7627
|
+
fitScaleX = tempIntersect.width / tempContent.width;
|
|
7628
|
+
}
|
|
7629
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7630
|
+
fitScaleY = tempMerge.height / tempContent.height;
|
|
7631
|
+
} else {
|
|
7632
|
+
fitScaleY = tempIntersect.height / tempContent.height;
|
|
7633
|
+
}
|
|
7634
|
+
scale.x = float$1(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
7635
|
+
scale.y = float$1(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
7636
|
+
return scale;
|
|
7577
7637
|
}
|
|
7578
7638
|
};
|
|
7579
7639
|
const D$2 = 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$3, getAngle: getAngle$2, getDistance: getDistance$3, 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$3(to, rotation);
|
|
8492
|
-
return to;
|
|
8493
|
-
}
|
|
8494
|
-
set toPoint(value) {
|
|
8495
|
-
this.width = getDistance$3(defaultPoint, value);
|
|
8496
|
-
this.rotation = getAngle$2(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$2, cos: cos$2, PI: PI$2} = 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$2(i * 2 * PI$2 / sides), ry - ry * cos$2(i * 2 * PI$2 / 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$1, cos: cos$1, PI: PI$1} = 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$1(i * PI$1 / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos$1(i * PI$1 / corners));
|
|
8583
|
+
lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin$1(i * PI$1 / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos$1(i * PI$1 / 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$3, getAngle: getAngle$2, getDistance: getDistance$3, 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$3(to, rotation);
|
|
8603
|
+
return to;
|
|
8604
|
+
}
|
|
8605
|
+
set toPoint(value) {
|
|
8606
|
+
this.width = getDistance$3(defaultPoint, value);
|
|
8607
|
+
this.rotation = getAngle$2(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$1(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$1,
|
|
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$2, right: right$3, bottom: bottom$2, left: left$3} = exports.Direction4;
|
|
@@ -11631,12 +11700,15 @@ var LeaferUI = function(exports) {
|
|
|
11631
11700
|
set(value) {
|
|
11632
11701
|
const old = this[privateKey];
|
|
11633
11702
|
if (old !== value) {
|
|
11634
|
-
|
|
11703
|
+
const t = this;
|
|
11704
|
+
if (t.config) {
|
|
11635
11705
|
const isSelect = key === "target";
|
|
11636
11706
|
if (isSelect) {
|
|
11707
|
+
t.setDimOthers(false);
|
|
11708
|
+
t.setBright(false);
|
|
11637
11709
|
if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
|
|
11638
|
-
if (
|
|
11639
|
-
const {beforeSelect: beforeSelect} =
|
|
11710
|
+
if (t.single) t.element.syncEventer = null;
|
|
11711
|
+
const {beforeSelect: beforeSelect} = t.config;
|
|
11640
11712
|
if (beforeSelect) {
|
|
11641
11713
|
const check = beforeSelect({
|
|
11642
11714
|
target: value
|
|
@@ -11646,7 +11718,7 @@ var LeaferUI = function(exports) {
|
|
|
11646
11718
|
}
|
|
11647
11719
|
const type = isSelect ? EditorEvent.BEFORE_SELECT : EditorEvent.BEFORE_HOVER;
|
|
11648
11720
|
if (this.hasEvent(type)) this.emitEvent(new EditorEvent(type, {
|
|
11649
|
-
editor:
|
|
11721
|
+
editor: t,
|
|
11650
11722
|
value: value,
|
|
11651
11723
|
oldValue: old
|
|
11652
11724
|
}));
|
|
@@ -11814,7 +11886,7 @@ var LeaferUI = function(exports) {
|
|
|
11814
11886
|
}
|
|
11815
11887
|
get running() {
|
|
11816
11888
|
const {editor: editor} = this;
|
|
11817
|
-
return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector;
|
|
11889
|
+
return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector && this.app.mode === "normal";
|
|
11818
11890
|
}
|
|
11819
11891
|
get isMoveMode() {
|
|
11820
11892
|
return this.app && this.app.interaction.moveMode;
|
|
@@ -12112,17 +12184,13 @@ var LeaferUI = function(exports) {
|
|
|
12112
12184
|
}
|
|
12113
12185
|
toPoint(around || align, boxBounds, origin, true);
|
|
12114
12186
|
if (dragBounds) {
|
|
12115
|
-
const
|
|
12116
|
-
|
|
12117
|
-
|
|
12118
|
-
|
|
12119
|
-
|
|
12120
|
-
|
|
12121
|
-
|
|
12122
|
-
if (useScaleX) scaleX *= fitScaleX;
|
|
12123
|
-
if (useScaleY) scaleY *= fitScaleY;
|
|
12124
|
-
}
|
|
12125
|
-
}
|
|
12187
|
+
const scaleData = {
|
|
12188
|
+
x: scaleX,
|
|
12189
|
+
y: scaleY
|
|
12190
|
+
};
|
|
12191
|
+
DragBoundsHelper.limitScaleOf(target, origin, scaleData);
|
|
12192
|
+
scaleX = scaleData.x;
|
|
12193
|
+
scaleY = scaleData.y;
|
|
12126
12194
|
}
|
|
12127
12195
|
if (useScaleX && widthRange) {
|
|
12128
12196
|
const nowWidth = boxBounds.width * target.scaleX;
|
|
@@ -12300,13 +12368,18 @@ var LeaferUI = function(exports) {
|
|
|
12300
12368
|
function updatePointCursor(editBox, e) {
|
|
12301
12369
|
const {enterPoint: point, dragging: dragging, skewing: skewing, resizing: resizing, flippedX: flippedX, flippedY: flippedY} = editBox;
|
|
12302
12370
|
if (!point || !editBox.editor.editing || !editBox.canUse) return;
|
|
12371
|
+
if (point.name === "rect") return updateMoveCursor(editBox);
|
|
12303
12372
|
if (point.name === "circle") return;
|
|
12304
|
-
|
|
12373
|
+
let {rotation: rotation} = editBox;
|
|
12374
|
+
const {pointType: pointType} = point, {moveCursor: moveCursor, resizeCursor: resizeCursor, rotateCursor: rotateCursor, skewCursor: skewCursor, moveable: moveable, resizeable: resizeable, rotateable: rotateable, skewable: skewable} = editBox.mergeConfig;
|
|
12375
|
+
if (pointType === "move") {
|
|
12376
|
+
point.cursor = moveCursor;
|
|
12377
|
+
if (!moveable) point.visible = false;
|
|
12378
|
+
return;
|
|
12379
|
+
} else if (pointType === "button") {
|
|
12305
12380
|
if (!point.cursor) point.cursor = "pointer";
|
|
12306
12381
|
return;
|
|
12307
12382
|
}
|
|
12308
|
-
let {rotation: rotation} = editBox;
|
|
12309
|
-
const {pointType: pointType} = point, {resizeCursor: resizeCursor, rotateCursor: rotateCursor, skewCursor: skewCursor, resizeable: resizeable, rotateable: rotateable, skewable: skewable} = editBox.mergeConfig;
|
|
12310
12383
|
let showResize = pointType.includes("resize");
|
|
12311
12384
|
if (showResize && rotateable && (editBox.isHoldRotateKey(e) || !resizeable)) showResize = false;
|
|
12312
12385
|
const showSkew = skewable && !showResize && (point.name === "resize-line" || pointType === "skew");
|
|
@@ -12382,7 +12455,7 @@ var LeaferUI = function(exports) {
|
|
|
12382
12455
|
constructor(editor) {
|
|
12383
12456
|
super();
|
|
12384
12457
|
this.view = new exports.Group;
|
|
12385
|
-
this.rect = new
|
|
12458
|
+
this.rect = new EditPoint({
|
|
12386
12459
|
name: "rect",
|
|
12387
12460
|
hitFill: "all",
|
|
12388
12461
|
hitStroke: "none",
|
|
@@ -12444,12 +12517,13 @@ var LeaferUI = function(exports) {
|
|
|
12444
12517
|
this.listenPointEvents(resizePoint, "resize", i);
|
|
12445
12518
|
}
|
|
12446
12519
|
this.listenPointEvents(circle, "rotate", 2);
|
|
12520
|
+
this.listenPointEvents(rect, "move", 8);
|
|
12447
12521
|
view.addMany(...rotatePoints, rect, circle, buttons, ...resizeLines, ...resizePoints);
|
|
12448
12522
|
this.add(view);
|
|
12449
12523
|
}
|
|
12450
12524
|
load() {
|
|
12451
|
-
const {target: target, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, resizePoints: resizePoints} = this;
|
|
12452
|
-
const {stroke: stroke, strokeWidth: strokeWidth} = mergeConfig;
|
|
12525
|
+
const {target: target, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, resizePoints: resizePoints, resizeLines: resizeLines} = this;
|
|
12526
|
+
const {stroke: stroke, strokeWidth: strokeWidth, resizeLine: resizeLine} = mergeConfig;
|
|
12453
12527
|
const pointsStyle = this.getPointsStyle();
|
|
12454
12528
|
const middlePointsStyle = this.getMiddlePointsStyle();
|
|
12455
12529
|
this.visible = !target.locked;
|
|
@@ -12458,6 +12532,10 @@ var LeaferUI = function(exports) {
|
|
|
12458
12532
|
resizeP = resizePoints[i];
|
|
12459
12533
|
resizeP.set(this.getPointStyle(i % 2 ? middlePointsStyle[(i - 1) / 2 % middlePointsStyle.length] : pointsStyle[i / 2 % pointsStyle.length]));
|
|
12460
12534
|
resizeP.rotation = (i - (i % 2 ? 1 : 0)) / 2 * 90;
|
|
12535
|
+
if (i % 2) resizeLines[(i - 1) / 2].set(Object.assign({
|
|
12536
|
+
pointType: "resize",
|
|
12537
|
+
rotation: (i - 1) / 2 * 90
|
|
12538
|
+
}, resizeLine || {}));
|
|
12461
12539
|
}
|
|
12462
12540
|
circle.set(this.getPointStyle(mergeConfig.circle || mergeConfig.rotatePoint || pointsStyle[0]));
|
|
12463
12541
|
rect.set(Object.assign({
|
|
@@ -12502,10 +12580,12 @@ var LeaferUI = function(exports) {
|
|
|
12502
12580
|
if (this.app) this.rect.syncEventer = this.app.interaction.bottomList = null;
|
|
12503
12581
|
}
|
|
12504
12582
|
updateBounds(bounds) {
|
|
12505
|
-
const {
|
|
12506
|
-
const {
|
|
12507
|
-
const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
|
|
12583
|
+
const {editor: editor, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, buttons: buttons, resizePoints: resizePoints, rotatePoints: rotatePoints, resizeLines: resizeLines} = this;
|
|
12584
|
+
const {editMask: editMask} = editor;
|
|
12585
|
+
const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
|
|
12508
12586
|
editMask.visible = mask ? true : 0;
|
|
12587
|
+
editor.setDimOthers(dimOthers);
|
|
12588
|
+
editor.setBright(!!dimOthers || bright);
|
|
12509
12589
|
if (spread) BoundsHelper.spread(bounds, spread);
|
|
12510
12590
|
if (this.view.worldOpacity) {
|
|
12511
12591
|
const {width: width, height: height} = bounds;
|
|
@@ -12526,10 +12606,10 @@ var LeaferUI = function(exports) {
|
|
|
12526
12606
|
resizeL.visible = resizeP.visible && !hideResizeLines;
|
|
12527
12607
|
resizeP.visible = rotateP.visible = showPoints && !!middlePoint;
|
|
12528
12608
|
if ((i + 1) / 2 % 2) {
|
|
12529
|
-
resizeL.width = width;
|
|
12609
|
+
resizeL.width = width + resizeL.height;
|
|
12530
12610
|
if (hideOnSmall && resizeP.width * 2 > width) resizeP.visible = false;
|
|
12531
12611
|
} else {
|
|
12532
|
-
resizeL.
|
|
12612
|
+
resizeL.width = height + resizeL.height;
|
|
12533
12613
|
if (hideOnSmall && resizeP.width * 2 > height) resizeP.visible = false;
|
|
12534
12614
|
}
|
|
12535
12615
|
}
|
|
@@ -12606,7 +12686,7 @@ var LeaferUI = function(exports) {
|
|
|
12606
12686
|
this.dragging = true;
|
|
12607
12687
|
const point = this.dragPoint = e.current, {pointType: pointType} = point;
|
|
12608
12688
|
const {editor: editor, dragStartData: dragStartData} = this, {target: target} = this, {moveable: moveable, resizeable: resizeable, rotateable: rotateable, skewable: skewable, hideOnMove: hideOnMove} = this.mergeConfig;
|
|
12609
|
-
if (
|
|
12689
|
+
if (pointType === "move") {
|
|
12610
12690
|
moveable && (this.moving = true);
|
|
12611
12691
|
editor.opacity = hideOnMove ? 0 : 1;
|
|
12612
12692
|
} else {
|
|
@@ -12631,23 +12711,22 @@ var LeaferUI = function(exports) {
|
|
|
12631
12711
|
if (this.moving && this.mergeConfig.dragLimitAnimate && this.target.dragBounds) this.transformTool.onMove(e);
|
|
12632
12712
|
this.dragPoint = null;
|
|
12633
12713
|
this.resetDoing();
|
|
12634
|
-
const {
|
|
12635
|
-
if (
|
|
12714
|
+
const {pointType: pointType} = e.current;
|
|
12715
|
+
if (pointType === "move") this.editor.opacity = 1;
|
|
12636
12716
|
if (pointType && pointType.includes("resize")) ResizeEvent.resizingKeys = null;
|
|
12637
12717
|
}
|
|
12638
12718
|
onDrag(e) {
|
|
12639
12719
|
const {transformTool: transformTool, moving: moving, resizing: resizing, rotating: rotating, skewing: skewing} = this;
|
|
12640
12720
|
if (moving) {
|
|
12641
12721
|
transformTool.onMove(e);
|
|
12642
|
-
updateMoveCursor(this);
|
|
12643
12722
|
} else if (resizing || rotating || skewing) {
|
|
12644
12723
|
const point = e.current;
|
|
12645
12724
|
if (point.pointType) this.enterPoint = point;
|
|
12646
12725
|
if (rotating) transformTool.onRotate(e);
|
|
12647
12726
|
if (resizing) transformTool.onScale(e);
|
|
12648
12727
|
if (skewing) transformTool.onSkew(e);
|
|
12649
|
-
updatePointCursor(this, e);
|
|
12650
12728
|
}
|
|
12729
|
+
updatePointCursor(this, e);
|
|
12651
12730
|
}
|
|
12652
12731
|
resetDoing() {
|
|
12653
12732
|
if (this.canUse) this.dragging = this.gesturing = this.moving = this.resizing = this.rotating = this.skewing = false;
|
|
@@ -12743,17 +12822,15 @@ var LeaferUI = function(exports) {
|
|
|
12743
12822
|
listenPointEvents(point, type, direction) {
|
|
12744
12823
|
point.direction = direction;
|
|
12745
12824
|
point.pointType = type;
|
|
12746
|
-
|
|
12747
|
-
this.enterPoint = null;
|
|
12748
|
-
} ] ];
|
|
12749
|
-
if (point.name !== "circle") events.push([ exports.PointerEvent.ENTER, e => {
|
|
12825
|
+
this.__eventIds.push(point.on_([ [ exports.DragEvent.START, this.onDragStart, this ], [ exports.DragEvent.DRAG, this.onDrag, this ], [ exports.DragEvent.END, this.onDragEnd, this ], [ exports.PointerEvent.ENTER, e => {
|
|
12750
12826
|
this.enterPoint = point, updatePointCursor(this, e);
|
|
12751
|
-
} ])
|
|
12752
|
-
|
|
12827
|
+
} ], [ exports.PointerEvent.LEAVE, () => {
|
|
12828
|
+
this.enterPoint = null;
|
|
12829
|
+
} ] ]));
|
|
12753
12830
|
}
|
|
12754
12831
|
__listenEvents() {
|
|
12755
12832
|
const {rect: rect, editor: editor, __eventIds: events} = this;
|
|
12756
|
-
events.push(rect.on_([ [ exports.
|
|
12833
|
+
events.push(rect.on_([ [ exports.PointerEvent.DOUBLE_TAP, this.onDoubleTap, this ], [ exports.PointerEvent.LONG_PRESS, this.onLongPress, this ] ]));
|
|
12757
12834
|
this.waitLeafer(() => {
|
|
12758
12835
|
events.push(editor.app.on_([ [ [ exports.KeyEvent.HOLD, exports.KeyEvent.UP ], this.onKey, this ], [ exports.KeyEvent.DOWN, this.onArrow, this ], [ exports.MoveEvent.BEFORE_MOVE, this.onMove, this, true ], [ exports.ZoomEvent.BEFORE_ZOOM, this.onScale, this, true ], [ exports.RotateEvent.BEFORE_ROTATE, this.onRotate, this, true ], [ exports.MoveEvent.END, this.onMoveEnd, this ], [ exports.ZoomEvent.END, this.resetDoing, this ], [ exports.RotateEvent.END, this.resetDoing, this ] ]));
|
|
12759
12836
|
});
|
|
@@ -13431,6 +13508,16 @@ var LeaferUI = function(exports) {
|
|
|
13431
13508
|
shiftItem(item) {
|
|
13432
13509
|
this.hasItem(item) ? this.removeItem(item) : this.addItem(item);
|
|
13433
13510
|
}
|
|
13511
|
+
setDimOthers(value, attrName = "dim", list) {
|
|
13512
|
+
if (!list) {
|
|
13513
|
+
const {dimTarget: dimTarget, targetLeafer: targetLeafer} = this;
|
|
13514
|
+
list = dimTarget ? isArray(dimTarget) ? dimTarget : [ dimTarget ] : [ targetLeafer ];
|
|
13515
|
+
}
|
|
13516
|
+
if (list[0] && list[0][attrName] !== (value || false)) list.forEach(item => DataHelper.stintSet(item, attrName, value));
|
|
13517
|
+
}
|
|
13518
|
+
setBright(value) {
|
|
13519
|
+
this.setDimOthers(value, "bright", this.list);
|
|
13520
|
+
}
|
|
13434
13521
|
update() {
|
|
13435
13522
|
if (this.editing) {
|
|
13436
13523
|
if (!this.element.parent) return this.cancel();
|
|
@@ -13626,7 +13713,9 @@ var LeaferUI = function(exports) {
|
|
|
13626
13713
|
listenTargetEvents() {
|
|
13627
13714
|
if (!this.targetEventIds.length) {
|
|
13628
13715
|
const {app: app, leafer: leafer, targetLeafer: targetLeafer, editMask: editMask} = this;
|
|
13629
|
-
this.targetEventIds = [ leafer.on_(RenderEvent.START, this.onRenderStart, this), targetLeafer && targetLeafer.on_(PropertyEvent.SCROLL, this.onChildScroll, this), app.on_(RenderEvent.CHILD_START, this.onAppRenderStart, this)
|
|
13716
|
+
this.targetEventIds = [ leafer.on_(RenderEvent.START, this.onRenderStart, this), targetLeafer && targetLeafer.on_(PropertyEvent.SCROLL, this.onChildScroll, this), app.on_(RenderEvent.CHILD_START, this.onAppRenderStart, this), app.on_(LeaferEvent.UPDATE_MODE, data => {
|
|
13717
|
+
if (data.mode && data.mode !== "normal") this.cancel();
|
|
13718
|
+
}) ];
|
|
13630
13719
|
if (editMask.visible) editMask.forceRender();
|
|
13631
13720
|
}
|
|
13632
13721
|
}
|
|
@@ -13649,8 +13738,8 @@ var LeaferUI = function(exports) {
|
|
|
13649
13738
|
}
|
|
13650
13739
|
};
|
|
13651
13740
|
__decorate([ mergeConfigAttr() ], exports.Editor.prototype, "mergeConfig", void 0);
|
|
13652
|
-
__decorate([ targetAttr(onHover) ], exports.Editor.prototype, "hoverTarget", void 0);
|
|
13653
13741
|
__decorate([ targetAttr(onTarget) ], exports.Editor.prototype, "target", void 0);
|
|
13742
|
+
__decorate([ targetAttr(onHover) ], exports.Editor.prototype, "hoverTarget", void 0);
|
|
13654
13743
|
exports.Editor = __decorate([ useModule(TransformTool, [ "editBox", "editTool", "emitEvent" ]) ], exports.Editor);
|
|
13655
13744
|
class InnerEditor {
|
|
13656
13745
|
static registerInnerEditor() {
|
|
@@ -17772,14 +17861,10 @@ var LeaferUI = function(exports) {
|
|
|
17772
17861
|
renderOptions.bounds = canvas.bounds;
|
|
17773
17862
|
}
|
|
17774
17863
|
canvas.save();
|
|
17775
|
-
|
|
17776
|
-
|
|
17777
|
-
|
|
17778
|
-
|
|
17779
|
-
leaf.fill = oldFill;
|
|
17780
|
-
} else {
|
|
17781
|
-
leaf.__render(canvas, renderOptions);
|
|
17782
|
-
}
|
|
17864
|
+
const igroneFill = isFrame && !isUndefined(fill), oldFill = leaf.get("fill");
|
|
17865
|
+
if (igroneFill) leaf.fill = "";
|
|
17866
|
+
Platform.render(leaf, canvas, renderOptions);
|
|
17867
|
+
if (igroneFill) leaf.fill = oldFill;
|
|
17783
17868
|
canvas.restore();
|
|
17784
17869
|
if (sliceLeaf) sliceLeaf.__updateWorldOpacity();
|
|
17785
17870
|
if (trim) {
|
|
@@ -17822,6 +17907,8 @@ var LeaferUI = function(exports) {
|
|
|
17822
17907
|
renderBounds: renderBounds,
|
|
17823
17908
|
trimBounds: trimBounds
|
|
17824
17909
|
};
|
|
17910
|
+
const app = leafer && leafer.app;
|
|
17911
|
+
if (app && app.canvasManager) app.canvasManager.clearRecycled();
|
|
17825
17912
|
}
|
|
17826
17913
|
} catch (error) {
|
|
17827
17914
|
result = {
|
|
@@ -17923,6 +18010,8 @@ var LeaferUI = function(exports) {
|
|
|
17923
18010
|
return width;
|
|
17924
18011
|
}
|
|
17925
18012
|
});
|
|
18013
|
+
Plugin.add("bright");
|
|
18014
|
+
exports.UI.addAttr("bright", false, dimType);
|
|
17926
18015
|
exports.AlignHelper = AlignHelper;
|
|
17927
18016
|
exports.AnimateEasing = AnimateEasing;
|
|
17928
18017
|
exports.AnimateEvent = AnimateEvent;
|
|
@@ -18095,6 +18184,7 @@ var LeaferUI = function(exports) {
|
|
|
18095
18184
|
exports.defineDataProcessor = defineDataProcessor;
|
|
18096
18185
|
exports.defineKey = defineKey;
|
|
18097
18186
|
exports.defineLeafAttr = defineLeafAttr;
|
|
18187
|
+
exports.dimType = dimType;
|
|
18098
18188
|
exports.doBoundsType = doBoundsType;
|
|
18099
18189
|
exports.doStrokeType = doStrokeType;
|
|
18100
18190
|
exports.effectType = effectType;
|