@leafer-editor/worker 2.0.0 → 2.0.1
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.js +27 -19
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +27 -19
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +17 -17
package/dist/worker.js
CHANGED
|
@@ -1650,7 +1650,7 @@ var LeaferUI = function(exports) {
|
|
|
1650
1650
|
resize(view, width, height, xGap, yGap, clip, smooth, opacity, _filters, interlace) {
|
|
1651
1651
|
const realWidth = max$5(floor(width + (xGap || 0)), 1), realHeight = max$5(floor(height + (yGap || 0)), 1);
|
|
1652
1652
|
let interlaceX, interlaceY, interlaceOffset;
|
|
1653
|
-
if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset,
|
|
1653
|
+
if (interlace && (interlaceOffset = UnitConvertHelper.number(interlace.offset, interlace.type === "x" ? width : height))) interlace.type === "x" ? interlaceX = true : interlaceY = true;
|
|
1654
1654
|
const canvas = Platform.origin.createCanvas(interlaceY ? realWidth * 2 : realWidth, interlaceX ? realHeight * 2 : realHeight);
|
|
1655
1655
|
const ctx = canvas.getContext("2d");
|
|
1656
1656
|
if (opacity) ctx.globalAlpha = opacity;
|
|
@@ -3114,10 +3114,10 @@ var LeaferUI = function(exports) {
|
|
|
3114
3114
|
data.push(O$5, x, y, radius, startAngle, endAngle, anticlockwise ? 1 : 0);
|
|
3115
3115
|
}
|
|
3116
3116
|
},
|
|
3117
|
-
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3117
|
+
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
|
|
3118
3118
|
if (!isUndefined(lastX)) {
|
|
3119
|
-
const
|
|
3120
|
-
radius = min$2(radius, min$2(
|
|
3119
|
+
const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
|
|
3120
|
+
radius = min$2(radius, min$2(r, r * abs$7(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3121
3121
|
}
|
|
3122
3122
|
data.push(U$4, x1, y1, x2, y2, radius);
|
|
3123
3123
|
},
|
|
@@ -3442,7 +3442,7 @@ var LeaferUI = function(exports) {
|
|
|
3442
3442
|
let command, lastCommand, commandLen;
|
|
3443
3443
|
let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
|
|
3444
3444
|
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
3445
|
-
const len = data.length;
|
|
3445
|
+
const len = data.length, three = len === 9;
|
|
3446
3446
|
const smooth = [];
|
|
3447
3447
|
while (i < len) {
|
|
3448
3448
|
command = data[i];
|
|
@@ -3454,7 +3454,7 @@ var LeaferUI = function(exports) {
|
|
|
3454
3454
|
if (data[i] === L$4) {
|
|
3455
3455
|
secondX = data[i + 1];
|
|
3456
3456
|
secondY = data[i + 2];
|
|
3457
|
-
smooth.push(M$4, getCenterX(startX, secondX), getCenterY(startY, secondY));
|
|
3457
|
+
three ? smooth.push(M$4, startX, startY) : smooth.push(M$4, getCenterX(startX, secondX), getCenterY(startY, secondY));
|
|
3458
3458
|
} else {
|
|
3459
3459
|
smooth.push(M$4, startX, startY);
|
|
3460
3460
|
}
|
|
@@ -3466,11 +3466,11 @@ var LeaferUI = function(exports) {
|
|
|
3466
3466
|
i += 3;
|
|
3467
3467
|
switch (data[i]) {
|
|
3468
3468
|
case L$4:
|
|
3469
|
-
arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY);
|
|
3469
|
+
arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY, three);
|
|
3470
3470
|
break;
|
|
3471
3471
|
|
|
3472
3472
|
case Z$2:
|
|
3473
|
-
arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY);
|
|
3473
|
+
arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
|
|
3474
3474
|
break;
|
|
3475
3475
|
|
|
3476
3476
|
default:
|
|
@@ -3482,7 +3482,7 @@ var LeaferUI = function(exports) {
|
|
|
3482
3482
|
|
|
3483
3483
|
case Z$2:
|
|
3484
3484
|
if (lastCommand !== Z$2) {
|
|
3485
|
-
arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
|
|
3485
|
+
arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY, three);
|
|
3486
3486
|
smooth.push(Z$2);
|
|
3487
3487
|
}
|
|
3488
3488
|
i += 1;
|
|
@@ -6567,7 +6567,7 @@ var LeaferUI = function(exports) {
|
|
|
6567
6567
|
this.levelMap = null;
|
|
6568
6568
|
}
|
|
6569
6569
|
}
|
|
6570
|
-
const version = "2.0.
|
|
6570
|
+
const version = "2.0.1";
|
|
6571
6571
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6572
6572
|
get allowBackgroundColor() {
|
|
6573
6573
|
return true;
|
|
@@ -7523,16 +7523,16 @@ var LeaferUI = function(exports) {
|
|
|
7523
7523
|
return t.fill || t.stroke;
|
|
7524
7524
|
}
|
|
7525
7525
|
get __autoWidth() {
|
|
7526
|
-
return
|
|
7526
|
+
return this._width == null;
|
|
7527
7527
|
}
|
|
7528
7528
|
get __autoHeight() {
|
|
7529
|
-
return
|
|
7529
|
+
return this._height == null;
|
|
7530
7530
|
}
|
|
7531
7531
|
get __autoSide() {
|
|
7532
|
-
return
|
|
7532
|
+
return this._width == null || this._height == null;
|
|
7533
7533
|
}
|
|
7534
7534
|
get __autoSize() {
|
|
7535
|
-
return
|
|
7535
|
+
return this._width == null && this._height == null;
|
|
7536
7536
|
}
|
|
7537
7537
|
setVisible(value) {
|
|
7538
7538
|
this._visible = value;
|
|
@@ -11774,7 +11774,7 @@ var LeaferUI = function(exports) {
|
|
|
11774
11774
|
let {x: x, y: y, width: width, height: height} = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
11775
11775
|
let starY = __baseLine;
|
|
11776
11776
|
if (__clipText && realHeight > height) {
|
|
11777
|
-
realHeight = Math.max(height, __lineHeight);
|
|
11777
|
+
realHeight = Math.max(style.__autoHeight ? realHeight : height, __lineHeight);
|
|
11778
11778
|
if (countRows > 1) drawData.overflow = countRows;
|
|
11779
11779
|
} else if (height || autoSizeAlign) {
|
|
11780
11780
|
switch (verticalAlign) {
|
|
@@ -11830,10 +11830,10 @@ var LeaferUI = function(exports) {
|
|
|
11830
11830
|
bounds.height = realHeight;
|
|
11831
11831
|
}
|
|
11832
11832
|
function clipText(drawData, style, x, width) {
|
|
11833
|
-
if (!width) return;
|
|
11834
11833
|
const {rows: rows, overflow: overflow} = drawData;
|
|
11835
11834
|
let {textOverflow: textOverflow} = style;
|
|
11836
|
-
rows.splice(overflow);
|
|
11835
|
+
if (overflow) rows.splice(overflow);
|
|
11836
|
+
if (!width) return;
|
|
11837
11837
|
if (textOverflow && textOverflow !== "show") {
|
|
11838
11838
|
if (textOverflow === "hide") textOverflow = ""; else if (textOverflow === "ellipsis") textOverflow = "...";
|
|
11839
11839
|
let char, charRight;
|
|
@@ -12119,8 +12119,13 @@ var LeaferUI = function(exports) {
|
|
|
12119
12119
|
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
12120
12120
|
}
|
|
12121
12121
|
data.strokeWidth = strokeWidth / Math.max(aScaleX, aScaleY);
|
|
12122
|
+
if (data.shadow) {
|
|
12123
|
+
const shadow = data.shadow[0], {scaleX: scaleX, scaleY: scaleY} = this.getRenderScaleData(true, shadow.scaleFixed);
|
|
12124
|
+
canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
|
|
12125
|
+
}
|
|
12122
12126
|
if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas, options) : Paint.strokes(stroke, this, canvas, options);
|
|
12123
12127
|
if (fill) isString(fill) ? Paint.fill(fill, this, canvas, options) : Paint.fills(fill, this, canvas, options);
|
|
12128
|
+
if (data.shadow) canvas.restore();
|
|
12124
12129
|
}
|
|
12125
12130
|
}
|
|
12126
12131
|
data.strokeWidth = strokeWidth;
|
|
@@ -14138,7 +14143,10 @@ var LeaferUI = function(exports) {
|
|
|
14138
14143
|
return "focus";
|
|
14139
14144
|
}
|
|
14140
14145
|
get editBox() {
|
|
14141
|
-
return this.editor.editBox;
|
|
14146
|
+
return this._editBox || this.editor.editBox;
|
|
14147
|
+
}
|
|
14148
|
+
set editBox(value) {
|
|
14149
|
+
this._editBox = value;
|
|
14142
14150
|
}
|
|
14143
14151
|
constructor(editor) {
|
|
14144
14152
|
this.eventIds = [];
|
|
@@ -14324,7 +14332,7 @@ var LeaferUI = function(exports) {
|
|
|
14324
14332
|
onSkew(_e) {}
|
|
14325
14333
|
onUpdate() {
|
|
14326
14334
|
const {editBox: editBox} = this, {rotatePoints: rotatePoints, resizeLines: resizeLines, resizePoints: resizePoints, rect: rect} = editBox;
|
|
14327
|
-
const line =
|
|
14335
|
+
const line = editBox.target;
|
|
14328
14336
|
let fromTo, leftOrRight;
|
|
14329
14337
|
if (line.pathInputed) fromTo = this.getFromToByPath(line.__.path); else if (line.points) fromTo = this.getFromToByPoints(line.__.points);
|
|
14330
14338
|
if (fromTo) {
|