@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.module.js
CHANGED
|
@@ -372,7 +372,7 @@ function getMatrixData() {
|
|
|
372
372
|
|
|
373
373
|
const {sin: sin$6, cos: cos$6, acos: acos, sqrt: sqrt$5} = Math;
|
|
374
374
|
|
|
375
|
-
const {float: float$
|
|
375
|
+
const {float: float$3} = MathHelper;
|
|
376
376
|
|
|
377
377
|
const tempPoint$4 = {};
|
|
378
378
|
|
|
@@ -423,6 +423,15 @@ const MatrixHelper = {
|
|
|
423
423
|
t.c *= scaleY;
|
|
424
424
|
t.d *= scaleY;
|
|
425
425
|
},
|
|
426
|
+
pixelScale(t, pixelRatio, to) {
|
|
427
|
+
to || (to = t);
|
|
428
|
+
to.a = t.a * pixelRatio;
|
|
429
|
+
to.b = t.b * pixelRatio;
|
|
430
|
+
to.c = t.c * pixelRatio;
|
|
431
|
+
to.d = t.d * pixelRatio;
|
|
432
|
+
to.e = t.e * pixelRatio;
|
|
433
|
+
to.f = t.f * pixelRatio;
|
|
434
|
+
},
|
|
426
435
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
427
436
|
M$a.toInnerPoint(t, origin, tempPoint$4);
|
|
428
437
|
M$a.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
|
|
@@ -614,12 +623,12 @@ const MatrixHelper = {
|
|
|
614
623
|
const cosR = c / scaleY;
|
|
615
624
|
rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
|
|
616
625
|
}
|
|
617
|
-
const cosR = float$
|
|
626
|
+
const cosR = float$3(cos$6(rotation));
|
|
618
627
|
const sinR = sin$6(rotation);
|
|
619
|
-
scaleX = float$
|
|
620
|
-
skewX = cosR ? float$
|
|
621
|
-
skewY = cosR ? float$
|
|
622
|
-
rotation = float$
|
|
628
|
+
scaleX = float$3(scaleX), scaleY = float$3(scaleY);
|
|
629
|
+
skewX = cosR ? float$3((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
630
|
+
skewY = cosR ? float$3((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
631
|
+
rotation = float$3(rotation / OneRadian);
|
|
623
632
|
} else {
|
|
624
633
|
scaleX = a;
|
|
625
634
|
scaleY = d;
|
|
@@ -922,6 +931,10 @@ class Matrix {
|
|
|
922
931
|
this.scaleY *= y || x;
|
|
923
932
|
return this;
|
|
924
933
|
}
|
|
934
|
+
pixelScale(pixelRatio) {
|
|
935
|
+
MatrixHelper.pixelScale(this, pixelRatio);
|
|
936
|
+
return this;
|
|
937
|
+
}
|
|
925
938
|
scaleOfOuter(origin, x, y) {
|
|
926
939
|
MatrixHelper.scaleOfOuter(this, origin, x, y);
|
|
927
940
|
return this;
|
|
@@ -1141,7 +1154,7 @@ const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPo
|
|
|
1141
1154
|
|
|
1142
1155
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1143
1156
|
|
|
1144
|
-
const {float: float$
|
|
1157
|
+
const {float: float$2, fourNumber: fourNumber$1} = MathHelper;
|
|
1145
1158
|
|
|
1146
1159
|
const {floor: floor$3, ceil: ceil$3} = Math;
|
|
1147
1160
|
|
|
@@ -1324,10 +1337,10 @@ const BoundsHelper = {
|
|
|
1324
1337
|
}
|
|
1325
1338
|
},
|
|
1326
1339
|
float(t, maxLength) {
|
|
1327
|
-
t.x = float$
|
|
1328
|
-
t.y = float$
|
|
1329
|
-
t.width = float$
|
|
1330
|
-
t.height = float$
|
|
1340
|
+
t.x = float$2(t.x, maxLength);
|
|
1341
|
+
t.y = float$2(t.y, maxLength);
|
|
1342
|
+
t.width = float$2(t.width, maxLength);
|
|
1343
|
+
t.height = float$2(t.height, maxLength);
|
|
1331
1344
|
},
|
|
1332
1345
|
add(t, bounds, isPoint) {
|
|
1333
1346
|
right$4 = t.x + t.width;
|
|
@@ -2146,7 +2159,7 @@ __decorate([ contextMethod() ], Canvas$1.prototype, "measureText", null);
|
|
|
2146
2159
|
|
|
2147
2160
|
__decorate([ contextMethod() ], Canvas$1.prototype, "strokeText", null);
|
|
2148
2161
|
|
|
2149
|
-
const {copy: copy$b, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2162
|
+
const {copy: copy$b, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2150
2163
|
|
|
2151
2164
|
const minSize = {
|
|
2152
2165
|
width: 1,
|
|
@@ -2247,12 +2260,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2247
2260
|
setWorld(matrix, parentMatrix) {
|
|
2248
2261
|
const {pixelRatio: pixelRatio, pixelSnap: pixelSnap} = this, w = this.worldTransform;
|
|
2249
2262
|
if (parentMatrix) multiplyParent$4(matrix, parentMatrix, w);
|
|
2250
|
-
|
|
2251
|
-
w.b = matrix.b * pixelRatio;
|
|
2252
|
-
w.c = matrix.c * pixelRatio;
|
|
2253
|
-
w.d = matrix.d * pixelRatio;
|
|
2254
|
-
w.e = matrix.e * pixelRatio;
|
|
2255
|
-
w.f = matrix.f * pixelRatio;
|
|
2263
|
+
pixelScale(matrix, pixelRatio, w);
|
|
2256
2264
|
if (pixelSnap) {
|
|
2257
2265
|
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),
|
|
2258
2266
|
w.f = round$4(w.f);
|
|
@@ -4265,6 +4273,18 @@ function surfaceType(defaultValue) {
|
|
|
4265
4273
|
}));
|
|
4266
4274
|
}
|
|
4267
4275
|
|
|
4276
|
+
function dimType(defaultValue) {
|
|
4277
|
+
return decorateLeafAttr(defaultValue, key => attr({
|
|
4278
|
+
set(value) {
|
|
4279
|
+
if (this.__setAttr(key, value)) {
|
|
4280
|
+
const data = this.__;
|
|
4281
|
+
DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
|
|
4282
|
+
this.__layout.surfaceChange();
|
|
4283
|
+
}
|
|
4284
|
+
}
|
|
4285
|
+
}));
|
|
4286
|
+
}
|
|
4287
|
+
|
|
4268
4288
|
function opacityType(defaultValue) {
|
|
4269
4289
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4270
4290
|
set(value) {
|
|
@@ -4309,7 +4329,7 @@ function sortType(defaultValue) {
|
|
|
4309
4329
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4310
4330
|
set(value) {
|
|
4311
4331
|
if (this.__setAttr(key, value)) {
|
|
4312
|
-
this.__layout.
|
|
4332
|
+
this.__layout.surfaceChange();
|
|
4313
4333
|
this.waitParent(() => {
|
|
4314
4334
|
this.parent.__layout.childrenSortChange();
|
|
4315
4335
|
});
|
|
@@ -4346,7 +4366,7 @@ function hitType(defaultValue) {
|
|
|
4346
4366
|
set(value) {
|
|
4347
4367
|
if (this.__setAttr(key, value)) {
|
|
4348
4368
|
this.__layout.hitCanvasChanged = true;
|
|
4349
|
-
if (Debug.showBounds === "hit") this.__layout.
|
|
4369
|
+
if (Debug.showBounds === "hit") this.__layout.surfaceChange();
|
|
4350
4370
|
if (this.leafer) this.leafer.updateCursor();
|
|
4351
4371
|
}
|
|
4352
4372
|
}
|
|
@@ -5463,6 +5483,8 @@ LeaferEvent.RESTART = "leafer.restart";
|
|
|
5463
5483
|
|
|
5464
5484
|
LeaferEvent.END = "leafer.end";
|
|
5465
5485
|
|
|
5486
|
+
LeaferEvent.UPDATE_MODE = "leafer.update_mode";
|
|
5487
|
+
|
|
5466
5488
|
LeaferEvent.TRANSFORM = "leafer.transform";
|
|
5467
5489
|
|
|
5468
5490
|
LeaferEvent.MOVE = "leafer.move";
|
|
@@ -5859,6 +5881,7 @@ const LeafRender = {
|
|
|
5859
5881
|
if (options.shape) return this.__renderShape(canvas, options);
|
|
5860
5882
|
if (this.__worldOpacity) {
|
|
5861
5883
|
const data = this.__;
|
|
5884
|
+
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
5862
5885
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5863
5886
|
canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
5864
5887
|
if (this.__.__single) {
|
|
@@ -5907,7 +5930,9 @@ const BranchRender = {
|
|
|
5907
5930
|
this.__nowWorld = this.__getNowWorld(options);
|
|
5908
5931
|
if (this.__worldOpacity) {
|
|
5909
5932
|
const data = this.__;
|
|
5910
|
-
if (data.
|
|
5933
|
+
if (data.__useDim) {
|
|
5934
|
+
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);
|
|
5935
|
+
}
|
|
5911
5936
|
if (data.__single && !this.isBranchLeaf) {
|
|
5912
5937
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
5913
5938
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
@@ -6749,7 +6774,7 @@ class LeafLevelList {
|
|
|
6749
6774
|
}
|
|
6750
6775
|
}
|
|
6751
6776
|
|
|
6752
|
-
const version = "1.9.
|
|
6777
|
+
const version = "1.9.7";
|
|
6753
6778
|
|
|
6754
6779
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6755
6780
|
get allowBackgroundColor() {
|
|
@@ -7303,7 +7328,7 @@ class Renderer {
|
|
|
7303
7328
|
};
|
|
7304
7329
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
7305
7330
|
if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
|
|
7306
|
-
this.target
|
|
7331
|
+
Platform.render(this.target, canvas, options);
|
|
7307
7332
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
7308
7333
|
this.renderOptions = options;
|
|
7309
7334
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
@@ -7475,7 +7500,7 @@ class Picker {
|
|
|
7475
7500
|
item = path.list[i];
|
|
7476
7501
|
if (!item.__.hittable) break;
|
|
7477
7502
|
hittablePath.addAt(item, 0);
|
|
7478
|
-
if (!item.__.hitChildren) break;
|
|
7503
|
+
if (!item.__.hitChildren || item.isLeafer && item.mode === "draw") break;
|
|
7479
7504
|
}
|
|
7480
7505
|
return hittablePath;
|
|
7481
7506
|
}
|
|
@@ -7579,6 +7604,15 @@ Object.assign(Creator, {
|
|
|
7579
7604
|
|
|
7580
7605
|
Platform.layout = Layouter.fullLayout;
|
|
7581
7606
|
|
|
7607
|
+
Platform.render = function(target, canvas, options) {
|
|
7608
|
+
const topOptions = Object.assign(Object.assign({}, options), {
|
|
7609
|
+
topRendering: true
|
|
7610
|
+
});
|
|
7611
|
+
options.topList = new LeafList;
|
|
7612
|
+
target.__render(canvas, options);
|
|
7613
|
+
if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
|
|
7614
|
+
};
|
|
7615
|
+
|
|
7582
7616
|
function effectType(defaultValue) {
|
|
7583
7617
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
7584
7618
|
set(value) {
|
|
@@ -7932,8 +7966,6 @@ class TextData extends UIData {
|
|
|
7932
7966
|
if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
|
|
7933
7967
|
box.set(value);
|
|
7934
7968
|
if (boxLayout.strokeChanged) layout.strokeChange();
|
|
7935
|
-
if (boxLayout.renderChanged) layout.renderChange();
|
|
7936
|
-
box.__updateChange();
|
|
7937
7969
|
} else if (box) {
|
|
7938
7970
|
t.__box = box.parent = null;
|
|
7939
7971
|
box.destroy();
|
|
@@ -8003,7 +8035,7 @@ const UIBounds = {
|
|
|
8003
8035
|
__updateRenderSpread() {
|
|
8004
8036
|
let width = 0;
|
|
8005
8037
|
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
|
|
8006
|
-
if (shadow)
|
|
8038
|
+
if (shadow) width = Effect.getShadowSpread(this, shadow);
|
|
8007
8039
|
if (blur) width = Math.max(width, blur);
|
|
8008
8040
|
if (filter) width += Filter.getSpread(filter);
|
|
8009
8041
|
if (renderSpread) width += renderSpread;
|
|
@@ -8016,36 +8048,69 @@ const UIBounds = {
|
|
|
8016
8048
|
}
|
|
8017
8049
|
};
|
|
8018
8050
|
|
|
8051
|
+
const {float: float$1} = MathHelper;
|
|
8052
|
+
|
|
8053
|
+
const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
|
|
8054
|
+
|
|
8019
8055
|
const DragBoundsHelper = {
|
|
8056
|
+
limitMove(leaf, move) {
|
|
8057
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8058
|
+
if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, move, true);
|
|
8059
|
+
D$2.axisMove(leaf, move);
|
|
8060
|
+
},
|
|
8061
|
+
limitScaleOf(leaf, origin, scale) {
|
|
8062
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8063
|
+
if (dragBounds) D$2.getValidScaleOf(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
|
|
8064
|
+
},
|
|
8065
|
+
axisMove(leaf, move) {
|
|
8066
|
+
const {draggable: draggable} = leaf;
|
|
8067
|
+
if (draggable === "x") move.y = 0;
|
|
8068
|
+
if (draggable === "y") move.x = 0;
|
|
8069
|
+
},
|
|
8070
|
+
getDragBounds(leaf) {
|
|
8071
|
+
const {dragBounds: dragBounds} = leaf;
|
|
8072
|
+
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
8073
|
+
},
|
|
8074
|
+
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
8075
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
8076
|
+
},
|
|
8020
8077
|
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
8021
8078
|
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
8022
8079
|
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
8023
8080
|
if (!change) move = Object.assign({}, move);
|
|
8024
|
-
|
|
8025
|
-
const isBiggerHeight = content.height > dragBounds.height;
|
|
8026
|
-
if (isBiggerWidth && dragBoundsType !== "outer") {
|
|
8081
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
8027
8082
|
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
8028
8083
|
} else {
|
|
8029
8084
|
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
8030
8085
|
}
|
|
8031
|
-
if (
|
|
8086
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
8032
8087
|
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
8033
8088
|
} else {
|
|
8034
8089
|
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
8035
8090
|
}
|
|
8036
|
-
move.x =
|
|
8037
|
-
move.y =
|
|
8091
|
+
move.x = float$1(move.x);
|
|
8092
|
+
move.y = float$1(move.y);
|
|
8038
8093
|
return move;
|
|
8039
8094
|
},
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8095
|
+
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
|
|
8096
|
+
if (!change) scale = Object.assign({}, scale);
|
|
8097
|
+
let fitScaleX, fitScaleY;
|
|
8098
|
+
tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
|
|
8099
|
+
tempMerge.set(tempContent).add(dragBounds);
|
|
8100
|
+
tempIntersect.set(tempContent).intersect(dragBounds);
|
|
8101
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
8102
|
+
fitScaleX = tempMerge.width / tempContent.width;
|
|
8103
|
+
} else {
|
|
8104
|
+
fitScaleX = tempIntersect.width / tempContent.width;
|
|
8105
|
+
}
|
|
8106
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
8107
|
+
fitScaleY = tempMerge.height / tempContent.height;
|
|
8108
|
+
} else {
|
|
8109
|
+
fitScaleY = tempIntersect.height / tempContent.height;
|
|
8110
|
+
}
|
|
8111
|
+
scale.x = float$1(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
8112
|
+
scale.y = float$1(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
8113
|
+
return scale;
|
|
8049
8114
|
}
|
|
8050
8115
|
};
|
|
8051
8116
|
|
|
@@ -8063,7 +8128,7 @@ const UIRender = {
|
|
|
8063
8128
|
}
|
|
8064
8129
|
if (data.__useEffect) {
|
|
8065
8130
|
const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
8066
|
-
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"));
|
|
8131
|
+
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"));
|
|
8067
8132
|
data.__useEffect = !!(shadow || otherEffect);
|
|
8068
8133
|
}
|
|
8069
8134
|
data.__checkSingle();
|
|
@@ -8323,9 +8388,9 @@ __decorate([ visibleType(true) ], UI.prototype, "visible", void 0);
|
|
|
8323
8388
|
|
|
8324
8389
|
__decorate([ surfaceType(false) ], UI.prototype, "locked", void 0);
|
|
8325
8390
|
|
|
8326
|
-
__decorate([
|
|
8391
|
+
__decorate([ dimType(false) ], UI.prototype, "dim", void 0);
|
|
8327
8392
|
|
|
8328
|
-
__decorate([
|
|
8393
|
+
__decorate([ dimType(false) ], UI.prototype, "dimskip", void 0);
|
|
8329
8394
|
|
|
8330
8395
|
__decorate([ sortType(0) ], UI.prototype, "zIndex", void 0);
|
|
8331
8396
|
|
|
@@ -8701,7 +8766,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8701
8766
|
} else if (attrName === "zIndex") {
|
|
8702
8767
|
this.canvas.zIndex = newValue;
|
|
8703
8768
|
setTimeout(() => this.parent && this.parent.__updateSortChildren());
|
|
8704
|
-
}
|
|
8769
|
+
} else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
|
|
8770
|
+
mode: newValue
|
|
8771
|
+
});
|
|
8705
8772
|
}
|
|
8706
8773
|
return super.__setAttr(attrName, newValue);
|
|
8707
8774
|
}
|
|
@@ -8884,6 +8951,8 @@ __decorate([ dataProcessor(LeaferData) ], Leafer.prototype, "__", void 0);
|
|
|
8884
8951
|
|
|
8885
8952
|
__decorate([ boundsType() ], Leafer.prototype, "pixelRatio", void 0);
|
|
8886
8953
|
|
|
8954
|
+
__decorate([ dataType("normal") ], Leafer.prototype, "mode", void 0);
|
|
8955
|
+
|
|
8887
8956
|
Leafer = Leafer_1 = __decorate([ registerUI() ], Leafer);
|
|
8888
8957
|
|
|
8889
8958
|
let Rect = class Rect extends UI {
|
|
@@ -9076,57 +9145,9 @@ __decorate([ pathType(0) ], Ellipse.prototype, "endAngle", void 0);
|
|
|
9076
9145
|
|
|
9077
9146
|
Ellipse = __decorate([ registerUI() ], Ellipse);
|
|
9078
9147
|
|
|
9079
|
-
const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
9080
|
-
|
|
9081
|
-
const {rotate: rotate$3, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
|
|
9082
|
-
|
|
9083
|
-
let Line = class Line extends UI {
|
|
9084
|
-
get __tag() {
|
|
9085
|
-
return "Line";
|
|
9086
|
-
}
|
|
9087
|
-
get toPoint() {
|
|
9088
|
-
const {width: width, rotation: rotation} = this.__;
|
|
9089
|
-
const to = getPointData();
|
|
9090
|
-
if (width) to.x = width;
|
|
9091
|
-
if (rotation) rotate$3(to, rotation);
|
|
9092
|
-
return to;
|
|
9093
|
-
}
|
|
9094
|
-
set toPoint(value) {
|
|
9095
|
-
this.width = getDistance$3(defaultPoint, value);
|
|
9096
|
-
this.rotation = getAngle$2(defaultPoint, value);
|
|
9097
|
-
if (this.height) this.height = 0;
|
|
9098
|
-
}
|
|
9099
|
-
__updatePath() {
|
|
9100
|
-
const data = this.__;
|
|
9101
|
-
const path = data.path = [];
|
|
9102
|
-
if (data.points) {
|
|
9103
|
-
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
9104
|
-
} else {
|
|
9105
|
-
moveTo$2(path, 0, 0);
|
|
9106
|
-
lineTo$2(path, this.width, 0);
|
|
9107
|
-
}
|
|
9108
|
-
}
|
|
9109
|
-
};
|
|
9110
|
-
|
|
9111
|
-
__decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
|
|
9112
|
-
|
|
9113
|
-
__decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
|
|
9114
|
-
|
|
9115
|
-
__decorate([ boundsType(0) ], Line.prototype, "height", void 0);
|
|
9116
|
-
|
|
9117
|
-
__decorate([ pathType() ], Line.prototype, "points", void 0);
|
|
9118
|
-
|
|
9119
|
-
__decorate([ pathType(0) ], Line.prototype, "curve", void 0);
|
|
9120
|
-
|
|
9121
|
-
__decorate([ pathType(false) ], Line.prototype, "closed", void 0);
|
|
9122
|
-
|
|
9123
|
-
Line = __decorate([ registerUI() ], Line);
|
|
9124
|
-
|
|
9125
9148
|
const {sin: sin$2, cos: cos$2, PI: PI$2} = Math;
|
|
9126
9149
|
|
|
9127
|
-
const {moveTo: moveTo$
|
|
9128
|
-
|
|
9129
|
-
const line = Line.prototype;
|
|
9150
|
+
const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
9130
9151
|
|
|
9131
9152
|
let Polygon = class Polygon extends UI {
|
|
9132
9153
|
get __tag() {
|
|
@@ -9136,19 +9157,17 @@ let Polygon = class Polygon extends UI {
|
|
|
9136
9157
|
const data = this.__;
|
|
9137
9158
|
const path = data.path = [];
|
|
9138
9159
|
if (data.points) {
|
|
9139
|
-
drawPoints(path, data.points, data.curve, true);
|
|
9160
|
+
drawPoints$1(path, data.points, data.curve, true);
|
|
9140
9161
|
} else {
|
|
9141
9162
|
const {width: width, height: height, sides: sides} = data;
|
|
9142
9163
|
const rx = width / 2, ry = height / 2;
|
|
9143
|
-
moveTo$
|
|
9164
|
+
moveTo$2(path, rx, 0);
|
|
9144
9165
|
for (let i = 1; i < sides; i++) {
|
|
9145
|
-
lineTo$
|
|
9166
|
+
lineTo$2(path, rx + rx * sin$2(i * 2 * PI$2 / sides), ry - ry * cos$2(i * 2 * PI$2 / sides));
|
|
9146
9167
|
}
|
|
9147
9168
|
closePath$1(path);
|
|
9148
9169
|
}
|
|
9149
9170
|
}
|
|
9150
|
-
__updateRenderPath() {}
|
|
9151
|
-
__updateBoxBounds() {}
|
|
9152
9171
|
};
|
|
9153
9172
|
|
|
9154
9173
|
__decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
|
|
@@ -9159,15 +9178,11 @@ __decorate([ pathType() ], Polygon.prototype, "points", void 0);
|
|
|
9159
9178
|
|
|
9160
9179
|
__decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
|
|
9161
9180
|
|
|
9162
|
-
__decorate([ rewrite(line.__updateRenderPath) ], Polygon.prototype, "__updateRenderPath", null);
|
|
9163
|
-
|
|
9164
|
-
__decorate([ rewrite(line.__updateBoxBounds) ], Polygon.prototype, "__updateBoxBounds", null);
|
|
9165
|
-
|
|
9166
9181
|
Polygon = __decorate([ rewriteAble(), registerUI() ], Polygon);
|
|
9167
9182
|
|
|
9168
9183
|
const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
|
|
9169
9184
|
|
|
9170
|
-
const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
|
|
9185
|
+
const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
|
|
9171
9186
|
|
|
9172
9187
|
let Star = class Star extends UI {
|
|
9173
9188
|
get __tag() {
|
|
@@ -9177,9 +9192,9 @@ let Star = class Star extends UI {
|
|
|
9177
9192
|
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
9178
9193
|
const rx = width / 2, ry = height / 2;
|
|
9179
9194
|
const path = this.__.path = [];
|
|
9180
|
-
moveTo(path, rx, 0);
|
|
9195
|
+
moveTo$1(path, rx, 0);
|
|
9181
9196
|
for (let i = 1; i < corners * 2; i++) {
|
|
9182
|
-
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));
|
|
9197
|
+
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));
|
|
9183
9198
|
}
|
|
9184
9199
|
closePath(path);
|
|
9185
9200
|
}
|
|
@@ -9193,6 +9208,52 @@ __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
|
|
|
9193
9208
|
|
|
9194
9209
|
Star = __decorate([ registerUI() ], Star);
|
|
9195
9210
|
|
|
9211
|
+
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
9212
|
+
|
|
9213
|
+
const {rotate: rotate$3, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
|
|
9214
|
+
|
|
9215
|
+
let Line = class Line extends UI {
|
|
9216
|
+
get __tag() {
|
|
9217
|
+
return "Line";
|
|
9218
|
+
}
|
|
9219
|
+
get toPoint() {
|
|
9220
|
+
const {width: width, rotation: rotation} = this.__;
|
|
9221
|
+
const to = getPointData();
|
|
9222
|
+
if (width) to.x = width;
|
|
9223
|
+
if (rotation) rotate$3(to, rotation);
|
|
9224
|
+
return to;
|
|
9225
|
+
}
|
|
9226
|
+
set toPoint(value) {
|
|
9227
|
+
this.width = getDistance$3(defaultPoint, value);
|
|
9228
|
+
this.rotation = getAngle$2(defaultPoint, value);
|
|
9229
|
+
if (this.height) this.height = 0;
|
|
9230
|
+
}
|
|
9231
|
+
__updatePath() {
|
|
9232
|
+
const data = this.__;
|
|
9233
|
+
const path = data.path = [];
|
|
9234
|
+
if (data.points) {
|
|
9235
|
+
drawPoints(path, data.points, data.curve, data.closed);
|
|
9236
|
+
} else {
|
|
9237
|
+
moveTo(path, 0, 0);
|
|
9238
|
+
lineTo(path, this.width, 0);
|
|
9239
|
+
}
|
|
9240
|
+
}
|
|
9241
|
+
};
|
|
9242
|
+
|
|
9243
|
+
__decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
|
|
9244
|
+
|
|
9245
|
+
__decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
|
|
9246
|
+
|
|
9247
|
+
__decorate([ boundsType(0) ], Line.prototype, "height", void 0);
|
|
9248
|
+
|
|
9249
|
+
__decorate([ pathType() ], Line.prototype, "points", void 0);
|
|
9250
|
+
|
|
9251
|
+
__decorate([ pathType(0) ], Line.prototype, "curve", void 0);
|
|
9252
|
+
|
|
9253
|
+
__decorate([ pathType(false) ], Line.prototype, "closed", void 0);
|
|
9254
|
+
|
|
9255
|
+
Line = __decorate([ registerUI() ], Line);
|
|
9256
|
+
|
|
9196
9257
|
let Image = class Image extends Rect {
|
|
9197
9258
|
get __tag() {
|
|
9198
9259
|
return "Image";
|
|
@@ -9340,10 +9401,6 @@ let Text = class Text extends UI {
|
|
|
9340
9401
|
DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
|
|
9341
9402
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
9342
9403
|
}
|
|
9343
|
-
__onUpdateSize() {
|
|
9344
|
-
if (this.__box) this.__box.__onUpdateSize();
|
|
9345
|
-
super.__onUpdateSize();
|
|
9346
|
-
}
|
|
9347
9404
|
__updateRenderSpread() {
|
|
9348
9405
|
let width = super.__updateRenderSpread();
|
|
9349
9406
|
if (!width) width = this.isOverflow ? 1 : 0;
|
|
@@ -9354,6 +9411,11 @@ let Text = class Text extends UI {
|
|
|
9354
9411
|
copyAndSpread$1(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
9355
9412
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
9356
9413
|
}
|
|
9414
|
+
__updateChange() {
|
|
9415
|
+
super.__updateChange();
|
|
9416
|
+
const box = this.__box;
|
|
9417
|
+
if (box) box.__onUpdateSize(), box.__updateChange();
|
|
9418
|
+
}
|
|
9357
9419
|
__drawRenderPath(canvas) {
|
|
9358
9420
|
canvas.font = this.__.__font;
|
|
9359
9421
|
}
|
|
@@ -11831,12 +11893,18 @@ function shadow$1(ui, current, shape) {
|
|
|
11831
11893
|
}
|
|
11832
11894
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
11833
11895
|
}
|
|
11834
|
-
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
11896
|
+
if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
11835
11897
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
11836
11898
|
});
|
|
11837
11899
|
other.recycle(copyBounds);
|
|
11838
11900
|
}
|
|
11839
11901
|
|
|
11902
|
+
function getShadowSpread(_ui, shadow) {
|
|
11903
|
+
let width = 0;
|
|
11904
|
+
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));
|
|
11905
|
+
return width;
|
|
11906
|
+
}
|
|
11907
|
+
|
|
11840
11908
|
function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
|
|
11841
11909
|
const {bounds: bounds, shapeBounds: shapeBounds} = shape;
|
|
11842
11910
|
if (Platform.fullImageShadow) {
|
|
@@ -11914,7 +11982,11 @@ const EffectModule = {
|
|
|
11914
11982
|
shadow: shadow$1,
|
|
11915
11983
|
innerShadow: innerShadow,
|
|
11916
11984
|
blur: blur,
|
|
11917
|
-
backgroundBlur: backgroundBlur
|
|
11985
|
+
backgroundBlur: backgroundBlur,
|
|
11986
|
+
getShadowSpread: getShadowSpread,
|
|
11987
|
+
isTransformShadow(_shadow) {
|
|
11988
|
+
return undefined;
|
|
11989
|
+
}
|
|
11918
11990
|
};
|
|
11919
11991
|
|
|
11920
11992
|
const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
|
|
@@ -12422,16 +12494,17 @@ function toTextChar(row) {
|
|
|
12422
12494
|
}
|
|
12423
12495
|
|
|
12424
12496
|
function decorationText(drawData, style) {
|
|
12425
|
-
let type;
|
|
12497
|
+
let type, offset = 0;
|
|
12426
12498
|
const {fontSize: fontSize, textDecoration: textDecoration} = style;
|
|
12427
12499
|
drawData.decorationHeight = fontSize / 11;
|
|
12428
12500
|
if (isObject(textDecoration)) {
|
|
12429
12501
|
type = textDecoration.type;
|
|
12430
12502
|
if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
|
|
12503
|
+
if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
|
|
12431
12504
|
} else type = textDecoration;
|
|
12432
12505
|
switch (type) {
|
|
12433
12506
|
case "under":
|
|
12434
|
-
drawData.decorationY = [ fontSize * .15 ];
|
|
12507
|
+
drawData.decorationY = [ fontSize * .15 + offset ];
|
|
12435
12508
|
break;
|
|
12436
12509
|
|
|
12437
12510
|
case "delete":
|
|
@@ -12439,7 +12512,7 @@ function decorationText(drawData, style) {
|
|
|
12439
12512
|
break;
|
|
12440
12513
|
|
|
12441
12514
|
case "under-delete":
|
|
12442
|
-
drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
|
|
12515
|
+
drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
|
|
12443
12516
|
}
|
|
12444
12517
|
}
|
|
12445
12518
|
|
|
@@ -12580,12 +12653,15 @@ function targetAttr(fn) {
|
|
|
12580
12653
|
set(value) {
|
|
12581
12654
|
const old = this[privateKey];
|
|
12582
12655
|
if (old !== value) {
|
|
12583
|
-
|
|
12656
|
+
const t = this;
|
|
12657
|
+
if (t.config) {
|
|
12584
12658
|
const isSelect = key === "target";
|
|
12585
12659
|
if (isSelect) {
|
|
12660
|
+
t.setDimOthers(false);
|
|
12661
|
+
t.setBright(false);
|
|
12586
12662
|
if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
|
|
12587
|
-
if (
|
|
12588
|
-
const {beforeSelect: beforeSelect} =
|
|
12663
|
+
if (t.single) t.element.syncEventer = null;
|
|
12664
|
+
const {beforeSelect: beforeSelect} = t.config;
|
|
12589
12665
|
if (beforeSelect) {
|
|
12590
12666
|
const check = beforeSelect({
|
|
12591
12667
|
target: value
|
|
@@ -12595,7 +12671,7 @@ function targetAttr(fn) {
|
|
|
12595
12671
|
}
|
|
12596
12672
|
const type = isSelect ? EditorEvent.BEFORE_SELECT : EditorEvent.BEFORE_HOVER;
|
|
12597
12673
|
if (this.hasEvent(type)) this.emitEvent(new EditorEvent(type, {
|
|
12598
|
-
editor:
|
|
12674
|
+
editor: t,
|
|
12599
12675
|
value: value,
|
|
12600
12676
|
oldValue: old
|
|
12601
12677
|
}));
|
|
@@ -12778,7 +12854,7 @@ class EditSelect extends Group {
|
|
|
12778
12854
|
}
|
|
12779
12855
|
get running() {
|
|
12780
12856
|
const {editor: editor} = this;
|
|
12781
|
-
return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector;
|
|
12857
|
+
return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector && this.app.mode === "normal";
|
|
12782
12858
|
}
|
|
12783
12859
|
get isMoveMode() {
|
|
12784
12860
|
return this.app && this.app.interaction.moveMode;
|
|
@@ -13080,17 +13156,13 @@ const EditDataHelper = {
|
|
|
13080
13156
|
}
|
|
13081
13157
|
toPoint(around || align, boxBounds, origin, true);
|
|
13082
13158
|
if (dragBounds) {
|
|
13083
|
-
const
|
|
13084
|
-
|
|
13085
|
-
|
|
13086
|
-
|
|
13087
|
-
|
|
13088
|
-
|
|
13089
|
-
|
|
13090
|
-
if (useScaleX) scaleX *= fitScaleX;
|
|
13091
|
-
if (useScaleY) scaleY *= fitScaleY;
|
|
13092
|
-
}
|
|
13093
|
-
}
|
|
13159
|
+
const scaleData = {
|
|
13160
|
+
x: scaleX,
|
|
13161
|
+
y: scaleY
|
|
13162
|
+
};
|
|
13163
|
+
DragBoundsHelper.limitScaleOf(target, origin, scaleData);
|
|
13164
|
+
scaleX = scaleData.x;
|
|
13165
|
+
scaleY = scaleData.y;
|
|
13094
13166
|
}
|
|
13095
13167
|
if (useScaleX && widthRange) {
|
|
13096
13168
|
const nowWidth = boxBounds.width * target.scaleX;
|
|
@@ -13270,13 +13342,18 @@ const cacheCursors = {};
|
|
|
13270
13342
|
function updatePointCursor(editBox, e) {
|
|
13271
13343
|
const {enterPoint: point, dragging: dragging, skewing: skewing, resizing: resizing, flippedX: flippedX, flippedY: flippedY} = editBox;
|
|
13272
13344
|
if (!point || !editBox.editor.editing || !editBox.canUse) return;
|
|
13345
|
+
if (point.name === "rect") return updateMoveCursor(editBox);
|
|
13273
13346
|
if (point.name === "circle") return;
|
|
13274
|
-
|
|
13347
|
+
let {rotation: rotation} = editBox;
|
|
13348
|
+
const {pointType: pointType} = point, {moveCursor: moveCursor, resizeCursor: resizeCursor, rotateCursor: rotateCursor, skewCursor: skewCursor, moveable: moveable, resizeable: resizeable, rotateable: rotateable, skewable: skewable} = editBox.mergeConfig;
|
|
13349
|
+
if (pointType === "move") {
|
|
13350
|
+
point.cursor = moveCursor;
|
|
13351
|
+
if (!moveable) point.visible = false;
|
|
13352
|
+
return;
|
|
13353
|
+
} else if (pointType === "button") {
|
|
13275
13354
|
if (!point.cursor) point.cursor = "pointer";
|
|
13276
13355
|
return;
|
|
13277
13356
|
}
|
|
13278
|
-
let {rotation: rotation} = editBox;
|
|
13279
|
-
const {pointType: pointType} = point, {resizeCursor: resizeCursor, rotateCursor: rotateCursor, skewCursor: skewCursor, resizeable: resizeable, rotateable: rotateable, skewable: skewable} = editBox.mergeConfig;
|
|
13280
13357
|
let showResize = pointType.includes("resize");
|
|
13281
13358
|
if (showResize && rotateable && (editBox.isHoldRotateKey(e) || !resizeable)) showResize = false;
|
|
13282
13359
|
const showSkew = skewable && !showResize && (point.name === "resize-line" || pointType === "skew");
|
|
@@ -13357,7 +13434,7 @@ class EditBox extends Group {
|
|
|
13357
13434
|
constructor(editor) {
|
|
13358
13435
|
super();
|
|
13359
13436
|
this.view = new Group;
|
|
13360
|
-
this.rect = new
|
|
13437
|
+
this.rect = new EditPoint({
|
|
13361
13438
|
name: "rect",
|
|
13362
13439
|
hitFill: "all",
|
|
13363
13440
|
hitStroke: "none",
|
|
@@ -13419,12 +13496,13 @@ class EditBox extends Group {
|
|
|
13419
13496
|
this.listenPointEvents(resizePoint, "resize", i);
|
|
13420
13497
|
}
|
|
13421
13498
|
this.listenPointEvents(circle, "rotate", 2);
|
|
13499
|
+
this.listenPointEvents(rect, "move", 8);
|
|
13422
13500
|
view.addMany(...rotatePoints, rect, circle, buttons, ...resizeLines, ...resizePoints);
|
|
13423
13501
|
this.add(view);
|
|
13424
13502
|
}
|
|
13425
13503
|
load() {
|
|
13426
|
-
const {target: target, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, resizePoints: resizePoints} = this;
|
|
13427
|
-
const {stroke: stroke, strokeWidth: strokeWidth} = mergeConfig;
|
|
13504
|
+
const {target: target, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, resizePoints: resizePoints, resizeLines: resizeLines} = this;
|
|
13505
|
+
const {stroke: stroke, strokeWidth: strokeWidth, resizeLine: resizeLine} = mergeConfig;
|
|
13428
13506
|
const pointsStyle = this.getPointsStyle();
|
|
13429
13507
|
const middlePointsStyle = this.getMiddlePointsStyle();
|
|
13430
13508
|
this.visible = !target.locked;
|
|
@@ -13433,6 +13511,10 @@ class EditBox extends Group {
|
|
|
13433
13511
|
resizeP = resizePoints[i];
|
|
13434
13512
|
resizeP.set(this.getPointStyle(i % 2 ? middlePointsStyle[(i - 1) / 2 % middlePointsStyle.length] : pointsStyle[i / 2 % pointsStyle.length]));
|
|
13435
13513
|
resizeP.rotation = (i - (i % 2 ? 1 : 0)) / 2 * 90;
|
|
13514
|
+
if (i % 2) resizeLines[(i - 1) / 2].set(Object.assign({
|
|
13515
|
+
pointType: "resize",
|
|
13516
|
+
rotation: (i - 1) / 2 * 90
|
|
13517
|
+
}, resizeLine || {}));
|
|
13436
13518
|
}
|
|
13437
13519
|
circle.set(this.getPointStyle(mergeConfig.circle || mergeConfig.rotatePoint || pointsStyle[0]));
|
|
13438
13520
|
rect.set(Object.assign({
|
|
@@ -13477,10 +13559,12 @@ class EditBox extends Group {
|
|
|
13477
13559
|
if (this.app) this.rect.syncEventer = this.app.interaction.bottomList = null;
|
|
13478
13560
|
}
|
|
13479
13561
|
updateBounds(bounds) {
|
|
13480
|
-
const {
|
|
13481
|
-
const {
|
|
13482
|
-
const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
|
|
13562
|
+
const {editor: editor, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, buttons: buttons, resizePoints: resizePoints, rotatePoints: rotatePoints, resizeLines: resizeLines} = this;
|
|
13563
|
+
const {editMask: editMask} = editor;
|
|
13564
|
+
const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
|
|
13483
13565
|
editMask.visible = mask ? true : 0;
|
|
13566
|
+
editor.setDimOthers(dimOthers);
|
|
13567
|
+
editor.setBright(!!dimOthers || bright);
|
|
13484
13568
|
if (spread) BoundsHelper.spread(bounds, spread);
|
|
13485
13569
|
if (this.view.worldOpacity) {
|
|
13486
13570
|
const {width: width, height: height} = bounds;
|
|
@@ -13501,10 +13585,10 @@ class EditBox extends Group {
|
|
|
13501
13585
|
resizeL.visible = resizeP.visible && !hideResizeLines;
|
|
13502
13586
|
resizeP.visible = rotateP.visible = showPoints && !!middlePoint;
|
|
13503
13587
|
if ((i + 1) / 2 % 2) {
|
|
13504
|
-
resizeL.width = width;
|
|
13588
|
+
resizeL.width = width + resizeL.height;
|
|
13505
13589
|
if (hideOnSmall && resizeP.width * 2 > width) resizeP.visible = false;
|
|
13506
13590
|
} else {
|
|
13507
|
-
resizeL.
|
|
13591
|
+
resizeL.width = height + resizeL.height;
|
|
13508
13592
|
if (hideOnSmall && resizeP.width * 2 > height) resizeP.visible = false;
|
|
13509
13593
|
}
|
|
13510
13594
|
}
|
|
@@ -13581,7 +13665,7 @@ class EditBox extends Group {
|
|
|
13581
13665
|
this.dragging = true;
|
|
13582
13666
|
const point = this.dragPoint = e.current, {pointType: pointType} = point;
|
|
13583
13667
|
const {editor: editor, dragStartData: dragStartData} = this, {target: target} = this, {moveable: moveable, resizeable: resizeable, rotateable: rotateable, skewable: skewable, hideOnMove: hideOnMove} = this.mergeConfig;
|
|
13584
|
-
if (
|
|
13668
|
+
if (pointType === "move") {
|
|
13585
13669
|
moveable && (this.moving = true);
|
|
13586
13670
|
editor.opacity = hideOnMove ? 0 : 1;
|
|
13587
13671
|
} else {
|
|
@@ -13606,23 +13690,22 @@ class EditBox extends Group {
|
|
|
13606
13690
|
if (this.moving && this.mergeConfig.dragLimitAnimate && this.target.dragBounds) this.transformTool.onMove(e);
|
|
13607
13691
|
this.dragPoint = null;
|
|
13608
13692
|
this.resetDoing();
|
|
13609
|
-
const {
|
|
13610
|
-
if (
|
|
13693
|
+
const {pointType: pointType} = e.current;
|
|
13694
|
+
if (pointType === "move") this.editor.opacity = 1;
|
|
13611
13695
|
if (pointType && pointType.includes("resize")) ResizeEvent.resizingKeys = null;
|
|
13612
13696
|
}
|
|
13613
13697
|
onDrag(e) {
|
|
13614
13698
|
const {transformTool: transformTool, moving: moving, resizing: resizing, rotating: rotating, skewing: skewing} = this;
|
|
13615
13699
|
if (moving) {
|
|
13616
13700
|
transformTool.onMove(e);
|
|
13617
|
-
updateMoveCursor(this);
|
|
13618
13701
|
} else if (resizing || rotating || skewing) {
|
|
13619
13702
|
const point = e.current;
|
|
13620
13703
|
if (point.pointType) this.enterPoint = point;
|
|
13621
13704
|
if (rotating) transformTool.onRotate(e);
|
|
13622
13705
|
if (resizing) transformTool.onScale(e);
|
|
13623
13706
|
if (skewing) transformTool.onSkew(e);
|
|
13624
|
-
updatePointCursor(this, e);
|
|
13625
13707
|
}
|
|
13708
|
+
updatePointCursor(this, e);
|
|
13626
13709
|
}
|
|
13627
13710
|
resetDoing() {
|
|
13628
13711
|
if (this.canUse) this.dragging = this.gesturing = this.moving = this.resizing = this.rotating = this.skewing = false;
|
|
@@ -13718,17 +13801,15 @@ class EditBox extends Group {
|
|
|
13718
13801
|
listenPointEvents(point, type, direction) {
|
|
13719
13802
|
point.direction = direction;
|
|
13720
13803
|
point.pointType = type;
|
|
13721
|
-
|
|
13722
|
-
this.enterPoint = null;
|
|
13723
|
-
} ] ];
|
|
13724
|
-
if (point.name !== "circle") events.push([ PointerEvent.ENTER, e => {
|
|
13804
|
+
this.__eventIds.push(point.on_([ [ DragEvent.START, this.onDragStart, this ], [ DragEvent.DRAG, this.onDrag, this ], [ DragEvent.END, this.onDragEnd, this ], [ PointerEvent.ENTER, e => {
|
|
13725
13805
|
this.enterPoint = point, updatePointCursor(this, e);
|
|
13726
|
-
} ])
|
|
13727
|
-
|
|
13806
|
+
} ], [ PointerEvent.LEAVE, () => {
|
|
13807
|
+
this.enterPoint = null;
|
|
13808
|
+
} ] ]));
|
|
13728
13809
|
}
|
|
13729
13810
|
__listenEvents() {
|
|
13730
13811
|
const {rect: rect, editor: editor, __eventIds: events} = this;
|
|
13731
|
-
events.push(rect.on_([ [
|
|
13812
|
+
events.push(rect.on_([ [ PointerEvent.DOUBLE_TAP, this.onDoubleTap, this ], [ PointerEvent.LONG_PRESS, this.onLongPress, this ] ]));
|
|
13732
13813
|
this.waitLeafer(() => {
|
|
13733
13814
|
events.push(editor.app.on_([ [ [ KeyEvent.HOLD, KeyEvent.UP ], this.onKey, this ], [ KeyEvent.DOWN, this.onArrow, this ], [ MoveEvent.BEFORE_MOVE, this.onMove, this, true ], [ ZoomEvent.BEFORE_ZOOM, this.onScale, this, true ], [ RotateEvent.BEFORE_ROTATE, this.onRotate, this, true ], [ MoveEvent.END, this.onMoveEnd, this ], [ ZoomEvent.END, this.resetDoing, this ], [ RotateEvent.END, this.resetDoing, this ] ]));
|
|
13734
13815
|
});
|
|
@@ -14456,6 +14537,16 @@ let Editor = class Editor extends Group {
|
|
|
14456
14537
|
shiftItem(item) {
|
|
14457
14538
|
this.hasItem(item) ? this.removeItem(item) : this.addItem(item);
|
|
14458
14539
|
}
|
|
14540
|
+
setDimOthers(value, attrName = "dim", list) {
|
|
14541
|
+
if (!list) {
|
|
14542
|
+
const {dimTarget: dimTarget, targetLeafer: targetLeafer} = this;
|
|
14543
|
+
list = dimTarget ? isArray(dimTarget) ? dimTarget : [ dimTarget ] : [ targetLeafer ];
|
|
14544
|
+
}
|
|
14545
|
+
if (list[0] && list[0][attrName] !== (value || false)) list.forEach(item => DataHelper.stintSet(item, attrName, value));
|
|
14546
|
+
}
|
|
14547
|
+
setBright(value) {
|
|
14548
|
+
this.setDimOthers(value, "bright", this.list);
|
|
14549
|
+
}
|
|
14459
14550
|
update() {
|
|
14460
14551
|
if (this.editing) {
|
|
14461
14552
|
if (!this.element.parent) return this.cancel();
|
|
@@ -14651,7 +14742,9 @@ let Editor = class Editor extends Group {
|
|
|
14651
14742
|
listenTargetEvents() {
|
|
14652
14743
|
if (!this.targetEventIds.length) {
|
|
14653
14744
|
const {app: app, leafer: leafer, targetLeafer: targetLeafer, editMask: editMask} = this;
|
|
14654
|
-
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)
|
|
14745
|
+
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 => {
|
|
14746
|
+
if (data.mode && data.mode !== "normal") this.cancel();
|
|
14747
|
+
}) ];
|
|
14655
14748
|
if (editMask.visible) editMask.forceRender();
|
|
14656
14749
|
}
|
|
14657
14750
|
}
|
|
@@ -14676,10 +14769,10 @@ let Editor = class Editor extends Group {
|
|
|
14676
14769
|
|
|
14677
14770
|
__decorate([ mergeConfigAttr() ], Editor.prototype, "mergeConfig", void 0);
|
|
14678
14771
|
|
|
14679
|
-
__decorate([ targetAttr(onHover) ], Editor.prototype, "hoverTarget", void 0);
|
|
14680
|
-
|
|
14681
14772
|
__decorate([ targetAttr(onTarget) ], Editor.prototype, "target", void 0);
|
|
14682
14773
|
|
|
14774
|
+
__decorate([ targetAttr(onHover) ], Editor.prototype, "hoverTarget", void 0);
|
|
14775
|
+
|
|
14683
14776
|
Editor = __decorate([ useModule(TransformTool, [ "editBox", "editTool", "emitEvent" ]) ], Editor);
|
|
14684
14777
|
|
|
14685
14778
|
class InnerEditor {
|
|
@@ -19189,14 +19282,10 @@ const ExportModule = {
|
|
|
19189
19282
|
renderOptions.bounds = canvas.bounds;
|
|
19190
19283
|
}
|
|
19191
19284
|
canvas.save();
|
|
19192
|
-
|
|
19193
|
-
|
|
19194
|
-
|
|
19195
|
-
|
|
19196
|
-
leaf.fill = oldFill;
|
|
19197
|
-
} else {
|
|
19198
|
-
leaf.__render(canvas, renderOptions);
|
|
19199
|
-
}
|
|
19285
|
+
const igroneFill = isFrame && !isUndefined(fill), oldFill = leaf.get("fill");
|
|
19286
|
+
if (igroneFill) leaf.fill = "";
|
|
19287
|
+
Platform.render(leaf, canvas, renderOptions);
|
|
19288
|
+
if (igroneFill) leaf.fill = oldFill;
|
|
19200
19289
|
canvas.restore();
|
|
19201
19290
|
if (sliceLeaf) sliceLeaf.__updateWorldOpacity();
|
|
19202
19291
|
if (trim) {
|
|
@@ -19239,6 +19328,8 @@ const ExportModule = {
|
|
|
19239
19328
|
renderBounds: renderBounds,
|
|
19240
19329
|
trimBounds: trimBounds
|
|
19241
19330
|
};
|
|
19331
|
+
const app = leafer && leafer.app;
|
|
19332
|
+
if (app && app.canvasManager) app.canvasManager.clearRecycled();
|
|
19242
19333
|
}
|
|
19243
19334
|
} catch (error) {
|
|
19244
19335
|
result = {
|
|
@@ -19356,4 +19447,8 @@ Object.assign(Filter, {
|
|
|
19356
19447
|
}
|
|
19357
19448
|
});
|
|
19358
19449
|
|
|
19359
|
-
|
|
19450
|
+
Plugin.add("bright");
|
|
19451
|
+
|
|
19452
|
+
UI.addAttr("bright", false, dimType);
|
|
19453
|
+
|
|
19454
|
+
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, Frame, FrameData, Group, GroupData, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TextEditor, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$3 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|