leafer-draw 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/web.cjs +26 -6
- package/dist/web.esm.js +27 -7
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +172 -102
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +189 -116
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +3 -3
package/dist/web.module.js
CHANGED
|
@@ -372,7 +372,7 @@ function getMatrixData() {
|
|
|
372
372
|
|
|
373
373
|
const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
|
|
374
374
|
|
|
375
|
-
const {float: float$
|
|
375
|
+
const {float: float$2} = MathHelper;
|
|
376
376
|
|
|
377
377
|
const tempPoint$3 = {};
|
|
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$6.toInnerPoint(t, origin, tempPoint$3);
|
|
428
437
|
M$6.scaleOfInner(t, tempPoint$3, 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$2(cos$5(rotation));
|
|
618
627
|
const sinR = sin$5(rotation);
|
|
619
|
-
scaleX = float$
|
|
620
|
-
skewX = cosR ? float$
|
|
621
|
-
skewY = cosR ? float$
|
|
622
|
-
rotation = float$
|
|
628
|
+
scaleX = float$2(scaleX), scaleY = float$2(scaleY);
|
|
629
|
+
skewX = cosR ? float$2((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
630
|
+
skewY = cosR ? float$2((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
631
|
+
rotation = float$2(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$2, addPoint: addPo
|
|
|
1141
1154
|
|
|
1142
1155
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1143
1156
|
|
|
1144
|
-
const {float: float, fourNumber: fourNumber} = MathHelper;
|
|
1157
|
+
const {float: float$1, fourNumber: fourNumber} = MathHelper;
|
|
1145
1158
|
|
|
1146
1159
|
const {floor: floor$2, ceil: ceil$2} = Math;
|
|
1147
1160
|
|
|
@@ -1324,10 +1337,10 @@ const BoundsHelper = {
|
|
|
1324
1337
|
}
|
|
1325
1338
|
},
|
|
1326
1339
|
float(t, maxLength) {
|
|
1327
|
-
t.x = float(t.x, maxLength);
|
|
1328
|
-
t.y = float(t.y, maxLength);
|
|
1329
|
-
t.width = float(t.width, maxLength);
|
|
1330
|
-
t.height = float(t.height, maxLength);
|
|
1340
|
+
t.x = float$1(t.x, maxLength);
|
|
1341
|
+
t.y = float$1(t.y, maxLength);
|
|
1342
|
+
t.width = float$1(t.width, maxLength);
|
|
1343
|
+
t.height = float$1(t.height, maxLength);
|
|
1331
1344
|
},
|
|
1332
1345
|
add(t, bounds, isPoint) {
|
|
1333
1346
|
right$1 = 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$7, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2162
|
+
const {copy: copy$7, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$1} = 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$1(w.e - .5) + .5, w.f = round$1(w.f - .5) + .5; else w.e = round$1(w.e),
|
|
2258
2266
|
w.f = round$1(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
|
const debug$4 = Debug.get("LeaferCanvas");
|
|
6755
6780
|
|
|
@@ -7509,7 +7534,7 @@ class Renderer {
|
|
|
7509
7534
|
};
|
|
7510
7535
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
7511
7536
|
if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
|
|
7512
|
-
this.target
|
|
7537
|
+
Platform.render(this.target, canvas, options);
|
|
7513
7538
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
7514
7539
|
this.renderOptions = options;
|
|
7515
7540
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
@@ -7602,6 +7627,15 @@ Object.assign(Creator, {
|
|
|
7602
7627
|
|
|
7603
7628
|
Platform.layout = Layouter.fullLayout;
|
|
7604
7629
|
|
|
7630
|
+
Platform.render = function(target, canvas, options) {
|
|
7631
|
+
const topOptions = Object.assign(Object.assign({}, options), {
|
|
7632
|
+
topRendering: true
|
|
7633
|
+
});
|
|
7634
|
+
options.topList = new LeafList;
|
|
7635
|
+
target.__render(canvas, options);
|
|
7636
|
+
if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
|
|
7637
|
+
};
|
|
7638
|
+
|
|
7605
7639
|
function effectType(defaultValue) {
|
|
7606
7640
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
7607
7641
|
set(value) {
|
|
@@ -7955,8 +7989,6 @@ class TextData extends UIData {
|
|
|
7955
7989
|
if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
|
|
7956
7990
|
box.set(value);
|
|
7957
7991
|
if (boxLayout.strokeChanged) layout.strokeChange();
|
|
7958
|
-
if (boxLayout.renderChanged) layout.renderChange();
|
|
7959
|
-
box.__updateChange();
|
|
7960
7992
|
} else if (box) {
|
|
7961
7993
|
t.__box = box.parent = null;
|
|
7962
7994
|
box.destroy();
|
|
@@ -8026,7 +8058,7 @@ const UIBounds = {
|
|
|
8026
8058
|
__updateRenderSpread() {
|
|
8027
8059
|
let width = 0;
|
|
8028
8060
|
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
|
|
8029
|
-
if (shadow)
|
|
8061
|
+
if (shadow) width = Effect.getShadowSpread(this, shadow);
|
|
8030
8062
|
if (blur) width = Math.max(width, blur);
|
|
8031
8063
|
if (filter) width += Filter.getSpread(filter);
|
|
8032
8064
|
if (renderSpread) width += renderSpread;
|
|
@@ -8039,36 +8071,69 @@ const UIBounds = {
|
|
|
8039
8071
|
}
|
|
8040
8072
|
};
|
|
8041
8073
|
|
|
8074
|
+
const {float: float} = MathHelper;
|
|
8075
|
+
|
|
8076
|
+
const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
|
|
8077
|
+
|
|
8042
8078
|
const DragBoundsHelper = {
|
|
8079
|
+
limitMove(leaf, move) {
|
|
8080
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8081
|
+
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
|
|
8082
|
+
D.axisMove(leaf, move);
|
|
8083
|
+
},
|
|
8084
|
+
limitScaleOf(leaf, origin, scale) {
|
|
8085
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8086
|
+
if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
|
|
8087
|
+
},
|
|
8088
|
+
axisMove(leaf, move) {
|
|
8089
|
+
const {draggable: draggable} = leaf;
|
|
8090
|
+
if (draggable === "x") move.y = 0;
|
|
8091
|
+
if (draggable === "y") move.x = 0;
|
|
8092
|
+
},
|
|
8093
|
+
getDragBounds(leaf) {
|
|
8094
|
+
const {dragBounds: dragBounds} = leaf;
|
|
8095
|
+
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
8096
|
+
},
|
|
8097
|
+
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
8098
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
8099
|
+
},
|
|
8043
8100
|
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
8044
8101
|
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
8045
8102
|
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
8046
8103
|
if (!change) move = Object.assign({}, move);
|
|
8047
|
-
|
|
8048
|
-
const isBiggerHeight = content.height > dragBounds.height;
|
|
8049
|
-
if (isBiggerWidth && dragBoundsType !== "outer") {
|
|
8104
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
8050
8105
|
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
8051
8106
|
} else {
|
|
8052
8107
|
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
8053
8108
|
}
|
|
8054
|
-
if (
|
|
8109
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
8055
8110
|
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
8056
8111
|
} else {
|
|
8057
8112
|
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
8058
8113
|
}
|
|
8059
|
-
move.x =
|
|
8060
|
-
move.y =
|
|
8114
|
+
move.x = float(move.x);
|
|
8115
|
+
move.y = float(move.y);
|
|
8061
8116
|
return move;
|
|
8062
8117
|
},
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8118
|
+
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
|
|
8119
|
+
if (!change) scale = Object.assign({}, scale);
|
|
8120
|
+
let fitScaleX, fitScaleY;
|
|
8121
|
+
tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
|
|
8122
|
+
tempMerge.set(tempContent).add(dragBounds);
|
|
8123
|
+
tempIntersect.set(tempContent).intersect(dragBounds);
|
|
8124
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
8125
|
+
fitScaleX = tempMerge.width / tempContent.width;
|
|
8126
|
+
} else {
|
|
8127
|
+
fitScaleX = tempIntersect.width / tempContent.width;
|
|
8128
|
+
}
|
|
8129
|
+
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
8130
|
+
fitScaleY = tempMerge.height / tempContent.height;
|
|
8131
|
+
} else {
|
|
8132
|
+
fitScaleY = tempIntersect.height / tempContent.height;
|
|
8133
|
+
}
|
|
8134
|
+
scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
8135
|
+
scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
8136
|
+
return scale;
|
|
8072
8137
|
}
|
|
8073
8138
|
};
|
|
8074
8139
|
|
|
@@ -8086,7 +8151,7 @@ const UIRender = {
|
|
|
8086
8151
|
}
|
|
8087
8152
|
if (data.__useEffect) {
|
|
8088
8153
|
const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
8089
|
-
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"));
|
|
8154
|
+
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"));
|
|
8090
8155
|
data.__useEffect = !!(shadow || otherEffect);
|
|
8091
8156
|
}
|
|
8092
8157
|
data.__checkSingle();
|
|
@@ -8346,9 +8411,9 @@ __decorate([ visibleType(true) ], UI.prototype, "visible", void 0);
|
|
|
8346
8411
|
|
|
8347
8412
|
__decorate([ surfaceType(false) ], UI.prototype, "locked", void 0);
|
|
8348
8413
|
|
|
8349
|
-
__decorate([
|
|
8414
|
+
__decorate([ dimType(false) ], UI.prototype, "dim", void 0);
|
|
8350
8415
|
|
|
8351
|
-
__decorate([
|
|
8416
|
+
__decorate([ dimType(false) ], UI.prototype, "dimskip", void 0);
|
|
8352
8417
|
|
|
8353
8418
|
__decorate([ sortType(0) ], UI.prototype, "zIndex", void 0);
|
|
8354
8419
|
|
|
@@ -8724,7 +8789,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8724
8789
|
} else if (attrName === "zIndex") {
|
|
8725
8790
|
this.canvas.zIndex = newValue;
|
|
8726
8791
|
setTimeout(() => this.parent && this.parent.__updateSortChildren());
|
|
8727
|
-
}
|
|
8792
|
+
} else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
|
|
8793
|
+
mode: newValue
|
|
8794
|
+
});
|
|
8728
8795
|
}
|
|
8729
8796
|
return super.__setAttr(attrName, newValue);
|
|
8730
8797
|
}
|
|
@@ -8907,6 +8974,8 @@ __decorate([ dataProcessor(LeaferData) ], Leafer.prototype, "__", void 0);
|
|
|
8907
8974
|
|
|
8908
8975
|
__decorate([ boundsType() ], Leafer.prototype, "pixelRatio", void 0);
|
|
8909
8976
|
|
|
8977
|
+
__decorate([ dataType("normal") ], Leafer.prototype, "mode", void 0);
|
|
8978
|
+
|
|
8910
8979
|
Leafer = Leafer_1 = __decorate([ registerUI() ], Leafer);
|
|
8911
8980
|
|
|
8912
8981
|
let Rect = class Rect extends UI {
|
|
@@ -9099,57 +9168,9 @@ __decorate([ pathType(0) ], Ellipse.prototype, "endAngle", void 0);
|
|
|
9099
9168
|
|
|
9100
9169
|
Ellipse = __decorate([ registerUI() ], Ellipse);
|
|
9101
9170
|
|
|
9102
|
-
const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
9103
|
-
|
|
9104
|
-
const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
|
|
9105
|
-
|
|
9106
|
-
let Line = class Line extends UI {
|
|
9107
|
-
get __tag() {
|
|
9108
|
-
return "Line";
|
|
9109
|
-
}
|
|
9110
|
-
get toPoint() {
|
|
9111
|
-
const {width: width, rotation: rotation} = this.__;
|
|
9112
|
-
const to = getPointData();
|
|
9113
|
-
if (width) to.x = width;
|
|
9114
|
-
if (rotation) rotate$1(to, rotation);
|
|
9115
|
-
return to;
|
|
9116
|
-
}
|
|
9117
|
-
set toPoint(value) {
|
|
9118
|
-
this.width = getDistance$2(defaultPoint, value);
|
|
9119
|
-
this.rotation = getAngle$1(defaultPoint, value);
|
|
9120
|
-
if (this.height) this.height = 0;
|
|
9121
|
-
}
|
|
9122
|
-
__updatePath() {
|
|
9123
|
-
const data = this.__;
|
|
9124
|
-
const path = data.path = [];
|
|
9125
|
-
if (data.points) {
|
|
9126
|
-
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
9127
|
-
} else {
|
|
9128
|
-
moveTo$2(path, 0, 0);
|
|
9129
|
-
lineTo$2(path, this.width, 0);
|
|
9130
|
-
}
|
|
9131
|
-
}
|
|
9132
|
-
};
|
|
9133
|
-
|
|
9134
|
-
__decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
|
|
9135
|
-
|
|
9136
|
-
__decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
|
|
9137
|
-
|
|
9138
|
-
__decorate([ boundsType(0) ], Line.prototype, "height", void 0);
|
|
9139
|
-
|
|
9140
|
-
__decorate([ pathType() ], Line.prototype, "points", void 0);
|
|
9141
|
-
|
|
9142
|
-
__decorate([ pathType(0) ], Line.prototype, "curve", void 0);
|
|
9143
|
-
|
|
9144
|
-
__decorate([ pathType(false) ], Line.prototype, "closed", void 0);
|
|
9145
|
-
|
|
9146
|
-
Line = __decorate([ registerUI() ], Line);
|
|
9147
|
-
|
|
9148
9171
|
const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
|
|
9149
9172
|
|
|
9150
|
-
const {moveTo: moveTo$
|
|
9151
|
-
|
|
9152
|
-
const line = Line.prototype;
|
|
9173
|
+
const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
|
|
9153
9174
|
|
|
9154
9175
|
let Polygon = class Polygon extends UI {
|
|
9155
9176
|
get __tag() {
|
|
@@ -9159,19 +9180,17 @@ let Polygon = class Polygon extends UI {
|
|
|
9159
9180
|
const data = this.__;
|
|
9160
9181
|
const path = data.path = [];
|
|
9161
9182
|
if (data.points) {
|
|
9162
|
-
drawPoints(path, data.points, data.curve, true);
|
|
9183
|
+
drawPoints$1(path, data.points, data.curve, true);
|
|
9163
9184
|
} else {
|
|
9164
9185
|
const {width: width, height: height, sides: sides} = data;
|
|
9165
9186
|
const rx = width / 2, ry = height / 2;
|
|
9166
|
-
moveTo$
|
|
9187
|
+
moveTo$2(path, rx, 0);
|
|
9167
9188
|
for (let i = 1; i < sides; i++) {
|
|
9168
|
-
lineTo$
|
|
9189
|
+
lineTo$2(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
|
|
9169
9190
|
}
|
|
9170
9191
|
closePath$1(path);
|
|
9171
9192
|
}
|
|
9172
9193
|
}
|
|
9173
|
-
__updateRenderPath() {}
|
|
9174
|
-
__updateBoxBounds() {}
|
|
9175
9194
|
};
|
|
9176
9195
|
|
|
9177
9196
|
__decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
|
|
@@ -9182,15 +9201,11 @@ __decorate([ pathType() ], Polygon.prototype, "points", void 0);
|
|
|
9182
9201
|
|
|
9183
9202
|
__decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
|
|
9184
9203
|
|
|
9185
|
-
__decorate([ rewrite(line.__updateRenderPath) ], Polygon.prototype, "__updateRenderPath", null);
|
|
9186
|
-
|
|
9187
|
-
__decorate([ rewrite(line.__updateBoxBounds) ], Polygon.prototype, "__updateBoxBounds", null);
|
|
9188
|
-
|
|
9189
9204
|
Polygon = __decorate([ rewriteAble(), registerUI() ], Polygon);
|
|
9190
9205
|
|
|
9191
9206
|
const {sin: sin, cos: cos, PI: PI} = Math;
|
|
9192
9207
|
|
|
9193
|
-
const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
|
|
9208
|
+
const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
|
|
9194
9209
|
|
|
9195
9210
|
let Star = class Star extends UI {
|
|
9196
9211
|
get __tag() {
|
|
@@ -9200,9 +9215,9 @@ let Star = class Star extends UI {
|
|
|
9200
9215
|
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
9201
9216
|
const rx = width / 2, ry = height / 2;
|
|
9202
9217
|
const path = this.__.path = [];
|
|
9203
|
-
moveTo(path, rx, 0);
|
|
9218
|
+
moveTo$1(path, rx, 0);
|
|
9204
9219
|
for (let i = 1; i < corners * 2; i++) {
|
|
9205
|
-
lineTo(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
|
|
9220
|
+
lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
|
|
9206
9221
|
}
|
|
9207
9222
|
closePath(path);
|
|
9208
9223
|
}
|
|
@@ -9216,6 +9231,52 @@ __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
|
|
|
9216
9231
|
|
|
9217
9232
|
Star = __decorate([ registerUI() ], Star);
|
|
9218
9233
|
|
|
9234
|
+
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
9235
|
+
|
|
9236
|
+
const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
|
|
9237
|
+
|
|
9238
|
+
let Line = class Line extends UI {
|
|
9239
|
+
get __tag() {
|
|
9240
|
+
return "Line";
|
|
9241
|
+
}
|
|
9242
|
+
get toPoint() {
|
|
9243
|
+
const {width: width, rotation: rotation} = this.__;
|
|
9244
|
+
const to = getPointData();
|
|
9245
|
+
if (width) to.x = width;
|
|
9246
|
+
if (rotation) rotate$1(to, rotation);
|
|
9247
|
+
return to;
|
|
9248
|
+
}
|
|
9249
|
+
set toPoint(value) {
|
|
9250
|
+
this.width = getDistance$2(defaultPoint, value);
|
|
9251
|
+
this.rotation = getAngle$1(defaultPoint, value);
|
|
9252
|
+
if (this.height) this.height = 0;
|
|
9253
|
+
}
|
|
9254
|
+
__updatePath() {
|
|
9255
|
+
const data = this.__;
|
|
9256
|
+
const path = data.path = [];
|
|
9257
|
+
if (data.points) {
|
|
9258
|
+
drawPoints(path, data.points, data.curve, data.closed);
|
|
9259
|
+
} else {
|
|
9260
|
+
moveTo(path, 0, 0);
|
|
9261
|
+
lineTo(path, this.width, 0);
|
|
9262
|
+
}
|
|
9263
|
+
}
|
|
9264
|
+
};
|
|
9265
|
+
|
|
9266
|
+
__decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
|
|
9267
|
+
|
|
9268
|
+
__decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
|
|
9269
|
+
|
|
9270
|
+
__decorate([ boundsType(0) ], Line.prototype, "height", void 0);
|
|
9271
|
+
|
|
9272
|
+
__decorate([ pathType() ], Line.prototype, "points", void 0);
|
|
9273
|
+
|
|
9274
|
+
__decorate([ pathType(0) ], Line.prototype, "curve", void 0);
|
|
9275
|
+
|
|
9276
|
+
__decorate([ pathType(false) ], Line.prototype, "closed", void 0);
|
|
9277
|
+
|
|
9278
|
+
Line = __decorate([ registerUI() ], Line);
|
|
9279
|
+
|
|
9219
9280
|
let Image$1 = class Image extends Rect {
|
|
9220
9281
|
get __tag() {
|
|
9221
9282
|
return "Image";
|
|
@@ -9363,10 +9424,6 @@ let Text = class Text extends UI {
|
|
|
9363
9424
|
DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
|
|
9364
9425
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
9365
9426
|
}
|
|
9366
|
-
__onUpdateSize() {
|
|
9367
|
-
if (this.__box) this.__box.__onUpdateSize();
|
|
9368
|
-
super.__onUpdateSize();
|
|
9369
|
-
}
|
|
9370
9427
|
__updateRenderSpread() {
|
|
9371
9428
|
let width = super.__updateRenderSpread();
|
|
9372
9429
|
if (!width) width = this.isOverflow ? 1 : 0;
|
|
@@ -9377,6 +9434,11 @@ let Text = class Text extends UI {
|
|
|
9377
9434
|
copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
9378
9435
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
9379
9436
|
}
|
|
9437
|
+
__updateChange() {
|
|
9438
|
+
super.__updateChange();
|
|
9439
|
+
const box = this.__box;
|
|
9440
|
+
if (box) box.__onUpdateSize(), box.__updateChange();
|
|
9441
|
+
}
|
|
9380
9442
|
__drawRenderPath(canvas) {
|
|
9381
9443
|
canvas.font = this.__.__font;
|
|
9382
9444
|
}
|
|
@@ -10465,12 +10527,18 @@ function shadow(ui, current, shape) {
|
|
|
10465
10527
|
}
|
|
10466
10528
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
10467
10529
|
}
|
|
10468
|
-
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
10530
|
+
if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
10469
10531
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
10470
10532
|
});
|
|
10471
10533
|
other.recycle(copyBounds);
|
|
10472
10534
|
}
|
|
10473
10535
|
|
|
10536
|
+
function getShadowSpread(_ui, shadow) {
|
|
10537
|
+
let width = 0;
|
|
10538
|
+
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));
|
|
10539
|
+
return width;
|
|
10540
|
+
}
|
|
10541
|
+
|
|
10474
10542
|
function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
|
|
10475
10543
|
const {bounds: bounds, shapeBounds: shapeBounds} = shape;
|
|
10476
10544
|
if (Platform.fullImageShadow) {
|
|
@@ -10548,7 +10616,11 @@ const EffectModule = {
|
|
|
10548
10616
|
shadow: shadow,
|
|
10549
10617
|
innerShadow: innerShadow,
|
|
10550
10618
|
blur: blur,
|
|
10551
|
-
backgroundBlur: backgroundBlur
|
|
10619
|
+
backgroundBlur: backgroundBlur,
|
|
10620
|
+
getShadowSpread: getShadowSpread,
|
|
10621
|
+
isTransformShadow(_shadow) {
|
|
10622
|
+
return undefined;
|
|
10623
|
+
}
|
|
10552
10624
|
};
|
|
10553
10625
|
|
|
10554
10626
|
const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
|
|
@@ -11056,16 +11128,17 @@ function toTextChar(row) {
|
|
|
11056
11128
|
}
|
|
11057
11129
|
|
|
11058
11130
|
function decorationText(drawData, style) {
|
|
11059
|
-
let type;
|
|
11131
|
+
let type, offset = 0;
|
|
11060
11132
|
const {fontSize: fontSize, textDecoration: textDecoration} = style;
|
|
11061
11133
|
drawData.decorationHeight = fontSize / 11;
|
|
11062
11134
|
if (isObject(textDecoration)) {
|
|
11063
11135
|
type = textDecoration.type;
|
|
11064
11136
|
if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
|
|
11137
|
+
if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
|
|
11065
11138
|
} else type = textDecoration;
|
|
11066
11139
|
switch (type) {
|
|
11067
11140
|
case "under":
|
|
11068
|
-
drawData.decorationY = [ fontSize * .15 ];
|
|
11141
|
+
drawData.decorationY = [ fontSize * .15 + offset ];
|
|
11069
11142
|
break;
|
|
11070
11143
|
|
|
11071
11144
|
case "delete":
|
|
@@ -11073,7 +11146,7 @@ function decorationText(drawData, style) {
|
|
|
11073
11146
|
break;
|
|
11074
11147
|
|
|
11075
11148
|
case "under-delete":
|
|
11076
|
-
drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
|
|
11149
|
+
drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
|
|
11077
11150
|
}
|
|
11078
11151
|
}
|
|
11079
11152
|
|
|
@@ -11171,4 +11244,4 @@ Object.assign(Effect, EffectModule);
|
|
|
11171
11244
|
|
|
11172
11245
|
useCanvas();
|
|
11173
11246
|
|
|
11174
|
-
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|
|
11247
|
+
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, 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, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|