@leafer/worker 2.0.7 → 2.0.9
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.esm.min.js.map +1 -1
- package/dist/worker.js +100 -49
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +103 -49
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +27 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.esm.min.js","sources":["../../../../../../../src/leafer/packages/interface/src/path/IPathCommand.ts"],"sourcesContent":["import { IPointData } from '../math/IMath'\n\ntype Command = number\ntype x = number\ntype y = number\ntype x1 = number\ntype y1 = number\ntype x2 = number\ntype y2 = number\ntype radiusX = number\ntype radiusY = number\ntype xAxisRotation = number\ntype largeArcFlag = number\ntype sweepFlag = number\n\n\nexport type MCommandData = [Command, x, y]\nexport type HCommandData = [Command, x]\nexport type VCommandData = [Command, y]\nexport type LCommandData = MCommandData\n\nexport type CCommandData = [Command, x1, y1, x2, y2, x, y]\nexport type SCommandData = [Command, x2, y2, x, y]\n\nexport type QCommandData = [Command, x1, y1, x, y]\nexport type TCommandData = [Command, x, y]\n\nexport type ZCommandData = [Command]\n\nexport type ACommandData = [Command, radiusX, radiusY, xAxisRotation, largeArcFlag, sweepFlag, x, y]\n\n\n// 非svg标准的canvas绘图命令\ntype width = number\ntype height = number\ntype rotation = number\ntype startAngle = number\ntype endAngle = number\ntype anticlockwise = boolean\ntype cornerRadius = number | number[]\ntype radius = number\n\nexport type RectCommandData = [Command, x, y, width, height]\nexport type RoundRectCommandData = [Command, x, y, width, height, cornerRadius]\nexport type EllipseCommandData = [Command, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise]\nexport type ArcCommandData = [Command, x, y, radius, startAngle, endAngle, anticlockwise]\nexport type ArcToCommandData = [Command, x1, y1, x2, y2, radius]\n\n\nexport type CanvasPathCommand = 1 | 2 | 5 | 7 | 11 // M | L | C | Q | Z canvas可以绘制的命令\n\nexport type IPathCommandData = number[] // ...(MCommandData | LCommandData | CCommandData | QCommandData | ZCommandData)\n\nexport interface IPathCommandDataWithRadius {\n data: IPathCommandData\n radius: number[]\n}\n\n// 路径命令对象\nexport interface MoveToCommandObject {\n name: 'M'\n x: number\n y: number\n}\nexport interface LineToCommandObject {\n name: 'L'\n x: number\n y: number\n}\n\nexport interface BezierCurveToCommandObject {\n name: 'C'\n x1: number\n y1: number\n x2: number\n y2: number\n x: number\n y: number\n}\n\nexport interface QuadraticCurveToCommandObject {\n name: 'Q'\n x1: number\n y1: number\n x: number\n y: number\n}\n\nexport interface ClosePathCommandObject {\n name: 'Z'\n}\n\nexport type IPathCommandObject = MoveToCommandObject | LineToCommandObject | BezierCurveToCommandObject | QuadraticCurveToCommandObject | ClosePathCommandObject // M | L | C | Q | Z canvas可以绘制的命令\n\n\n// 可视化路径节点\n\nexport interface IPathCommandNodeBase {\n name: 'M^' | 'L^' | 'C^' | 'Z^'\n x: number\n y: number\n r?: number // 圆角半径\n a?: IPointData // 第一个手柄,连接上一个节点\n b?: IPointData // 第二个手柄,连接下一个节点\n ab?: PathNodeHandleType // 手柄类型\n}\n\nexport interface MoveToCommandNode extends IPathCommandNodeBase {\n name: 'M^'\n}\nexport interface LineToCommandNode extends IPathCommandNodeBase {\n name: 'L^'\n}\n\nexport interface BezierCurveToCommandNode extends IPathCommandNodeBase {\n name: 'C^'\n}\n\nexport interface ClosePathCommandNode {\n name: 'Z^'\n x?: number\n y?: number\n r?: number // 圆角半径\n a?: IPointData\n b?: IPointData\n ab?: PathNodeHandleType\n}\n\nexport type IPathCommandNode = MoveToCommandNode | LineToCommandNode | BezierCurveToCommandNode | ClosePathCommandNode // M | L | C | Z 路径节点命令(适合可视化编辑)\n\nexport enum PathNodeHandleType { // 手柄类型\n none = 1, // 无手柄\n free = 2, // 每个手柄自由控制\n mirrorAngle = 3, // 仅镜像角度\n mirror = 4, // 镜像角度和长度\n}\n\nexport type PathNodeHandleName = 'a' | 'b' // 手柄名称\n\nexport interface IPathNodeBase {\n pathNode: IPathCommandNode\n}"],"names":["PathNodeHandleType"],"mappings":"
|
|
1
|
+
{"version":3,"file":"worker.esm.min.js","sources":["../../../../../../../src/leafer/packages/interface/src/path/IPathCommand.ts"],"sourcesContent":["import { IPointData } from '../math/IMath'\nimport { IWindingRule } from '../canvas/ICanvas'\n\ntype Command = number\ntype x = number\ntype y = number\ntype x1 = number\ntype y1 = number\ntype x2 = number\ntype y2 = number\ntype radiusX = number\ntype radiusY = number\ntype xAxisRotation = number\ntype largeArcFlag = number\ntype sweepFlag = number\n\n\nexport type MCommandData = [Command, x, y]\nexport type HCommandData = [Command, x]\nexport type VCommandData = [Command, y]\nexport type LCommandData = MCommandData\n\nexport type CCommandData = [Command, x1, y1, x2, y2, x, y]\nexport type SCommandData = [Command, x2, y2, x, y]\n\nexport type QCommandData = [Command, x1, y1, x, y]\nexport type TCommandData = [Command, x, y]\n\nexport type ZCommandData = [Command]\n\nexport type ACommandData = [Command, radiusX, radiusY, xAxisRotation, largeArcFlag, sweepFlag, x, y]\n\n\n// 非svg标准的canvas绘图命令\ntype width = number\ntype height = number\ntype rotation = number\ntype startAngle = number\ntype endAngle = number\ntype anticlockwise = boolean\ntype cornerRadius = number | number[]\ntype radius = number\n\nexport type RectCommandData = [Command, x, y, width, height]\nexport type RoundRectCommandData = [Command, x, y, width, height, cornerRadius]\nexport type EllipseCommandData = [Command, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise]\nexport type ArcCommandData = [Command, x, y, radius, startAngle, endAngle, anticlockwise]\nexport type ArcToCommandData = [Command, x1, y1, x2, y2, radius]\n\n\nexport type CanvasPathCommand = 1 | 2 | 5 | 7 | 11 // M | L | C | Q | Z canvas可以绘制的命令\n\nexport type IPathCommandData = number[] // ...(MCommandData | LCommandData | CCommandData | QCommandData | ZCommandData)\n\nexport interface IPathCommandDataWithRadius {\n data: IPathCommandData\n radius: number[]\n}\n\nexport interface IPathCommandDataWithWindingRule {\n data: IPathCommandData\n windingRule?: IWindingRule\n}\n\n// 路径命令对象\nexport interface MoveToCommandObject {\n name: 'M'\n x: number\n y: number\n}\nexport interface LineToCommandObject {\n name: 'L'\n x: number\n y: number\n}\n\nexport interface BezierCurveToCommandObject {\n name: 'C'\n x1: number\n y1: number\n x2: number\n y2: number\n x: number\n y: number\n}\n\nexport interface QuadraticCurveToCommandObject {\n name: 'Q'\n x1: number\n y1: number\n x: number\n y: number\n}\n\nexport interface ClosePathCommandObject {\n name: 'Z'\n}\n\nexport type IPathCommandObject = MoveToCommandObject | LineToCommandObject | BezierCurveToCommandObject | QuadraticCurveToCommandObject | ClosePathCommandObject // M | L | C | Q | Z canvas可以绘制的命令\n\n\n// 可视化路径节点\n\nexport interface IPathCommandNodeBase {\n name: 'M^' | 'L^' | 'C^' | 'Z^'\n x: number\n y: number\n r?: number // 圆角半径\n a?: IPointData // 第一个手柄,连接上一个节点\n b?: IPointData // 第二个手柄,连接下一个节点\n ab?: PathNodeHandleType // 手柄类型\n}\n\nexport interface MoveToCommandNode extends IPathCommandNodeBase {\n name: 'M^'\n}\nexport interface LineToCommandNode extends IPathCommandNodeBase {\n name: 'L^'\n}\n\nexport interface BezierCurveToCommandNode extends IPathCommandNodeBase {\n name: 'C^'\n}\n\nexport interface ClosePathCommandNode {\n name: 'Z^'\n x?: number\n y?: number\n r?: number // 圆角半径\n a?: IPointData\n b?: IPointData\n ab?: PathNodeHandleType\n}\n\nexport type IPathCommandNode = MoveToCommandNode | LineToCommandNode | BezierCurveToCommandNode | ClosePathCommandNode // M | L | C | Z 路径节点命令(适合可视化编辑)\n\nexport enum PathNodeHandleType { // 手柄类型\n none = 1, // 无手柄\n free = 2, // 每个手柄自由控制\n mirrorAngle = 3, // 仅镜像角度\n mirror = 4, // 镜像角度和长度\n}\n\nexport type PathNodeHandleName = 'a' | 'b' // 手柄名称\n\nexport interface IPathNodeBase {\n pathNode: IPathCommandNode\n}"],"names":["PathNodeHandleType"],"mappings":"ktBAwIYA,GAAZ,SAAYA,GACRA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,YAAA,GAAA,cACAA,EAAAA,EAAA,OAAA,GAAA,QACH,CALD,CAAYA,IAAAA,EAAkB,CAAA"}
|
package/dist/worker.js
CHANGED
|
@@ -730,7 +730,7 @@ var LeaferUI = function(exports) {
|
|
|
730
730
|
const M$c = MatrixHelper;
|
|
731
731
|
const {float: float$5} = MathHelper;
|
|
732
732
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
733
|
-
const {sin: sin$5, cos: cos$5, abs: abs$
|
|
733
|
+
const {sin: sin$5, cos: cos$5, abs: abs$b, sqrt: sqrt$4, atan2: atan2$2, min: min$3, round: round$5} = Math;
|
|
734
734
|
const PointHelper = {
|
|
735
735
|
defaultPoint: getPointData(),
|
|
736
736
|
tempPoint: {},
|
|
@@ -827,8 +827,8 @@ var LeaferUI = function(exports) {
|
|
|
827
827
|
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
828
828
|
},
|
|
829
829
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
830
|
-
const x = abs$
|
|
831
|
-
const y = abs$
|
|
830
|
+
const x = abs$b(x2 - x1);
|
|
831
|
+
const y = abs$b(y2 - y1);
|
|
832
832
|
return sqrt$4(x * x + y * y);
|
|
833
833
|
},
|
|
834
834
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
@@ -2518,7 +2518,7 @@ var LeaferUI = function(exports) {
|
|
|
2518
2518
|
data[0] ? drawer.arcTo(x, y, right, y, data[0]) : drawer.lineTo(x, y);
|
|
2519
2519
|
}
|
|
2520
2520
|
};
|
|
2521
|
-
const {sin: sin$4, cos: cos$4, hypot: hypot$1, atan2: atan2$1, ceil: ceil$1, abs: abs$
|
|
2521
|
+
const {sin: sin$4, cos: cos$4, hypot: hypot$1, atan2: atan2$1, ceil: ceil$1, abs: abs$a, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
|
|
2522
2522
|
const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
|
|
2523
2523
|
const {set: set$1, toNumberPoints: toNumberPoints$1} = PointHelper;
|
|
2524
2524
|
const {M: M$b, L: L$b, C: C$9, Q: Q$7, Z: Z$9} = PathCommandMap;
|
|
@@ -2590,7 +2590,7 @@ var LeaferUI = function(exports) {
|
|
|
2590
2590
|
const lenCB = hypot$1(CBx, CBy);
|
|
2591
2591
|
let totalRadian = endRadian - startRadian;
|
|
2592
2592
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2593
|
-
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$
|
|
2593
|
+
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$a(totalRadian - PI$3) < 1e-12) {
|
|
2594
2594
|
if (data) data.push(L$b, x1, y1);
|
|
2595
2595
|
if (setPointBounds) {
|
|
2596
2596
|
setPoint$4(setPointBounds, fromX, fromY);
|
|
@@ -2623,7 +2623,7 @@ var LeaferUI = function(exports) {
|
|
|
2623
2623
|
let totalRadian = endRadian - startRadian;
|
|
2624
2624
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2625
2625
|
if (anticlockwise) totalRadian -= PI2;
|
|
2626
|
-
const parts = ceil$1(abs$
|
|
2626
|
+
const parts = ceil$1(abs$a(totalRadian / PI_2));
|
|
2627
2627
|
const partRadian = totalRadian / parts;
|
|
2628
2628
|
const partRadian4Sin = sin$4(partRadian / 4);
|
|
2629
2629
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$4(partRadian / 2);
|
|
@@ -3114,7 +3114,7 @@ var LeaferUI = function(exports) {
|
|
|
3114
3114
|
const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
|
|
3115
3115
|
const {M: M$9, L: L$9, C: C$7, Q: Q$5, Z: Z$7, N: N$4, D: D$5, X: X$4, G: G$4, F: F$5, O: O$5, P: P$4, U: U$4} = PathCommandMap;
|
|
3116
3116
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
3117
|
-
const {tan: tan, min: min$2, abs: abs$
|
|
3117
|
+
const {tan: tan, min: min$2, abs: abs$9} = Math;
|
|
3118
3118
|
const startPoint = {};
|
|
3119
3119
|
const PathCommandDataHelper = {
|
|
3120
3120
|
beginPath(data) {
|
|
@@ -3172,7 +3172,7 @@ var LeaferUI = function(exports) {
|
|
|
3172
3172
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
|
|
3173
3173
|
if (!isUndefined(lastX)) {
|
|
3174
3174
|
const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
|
|
3175
|
-
radius = min$2(radius, min$2(r, r * abs$
|
|
3175
|
+
radius = min$2(radius, min$2(r, r * abs$9(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3176
3176
|
}
|
|
3177
3177
|
data.push(U$4, x1, y1, x2, y2, radius);
|
|
3178
3178
|
},
|
|
@@ -6663,7 +6663,7 @@ var LeaferUI = function(exports) {
|
|
|
6663
6663
|
this.levelMap = null;
|
|
6664
6664
|
}
|
|
6665
6665
|
}
|
|
6666
|
-
const version = "2.0.
|
|
6666
|
+
const version = "2.0.9";
|
|
6667
6667
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6668
6668
|
get allowBackgroundColor() {
|
|
6669
6669
|
return true;
|
|
@@ -8851,11 +8851,16 @@ var LeaferUI = function(exports) {
|
|
|
8851
8851
|
if (data.points) {
|
|
8852
8852
|
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
8853
8853
|
} else {
|
|
8854
|
-
const {width: width, height: height, sides: sides} = data;
|
|
8854
|
+
const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
|
|
8855
8855
|
const rx = width / 2, ry = height / 2;
|
|
8856
|
-
|
|
8856
|
+
let startRadian = 0, radian;
|
|
8857
|
+
if (startAngle) {
|
|
8858
|
+
startRadian = startAngle * OneRadian;
|
|
8859
|
+
moveTo$2(path, rx + rx * sin$2(startRadian), ry - ry * cos$2(startRadian));
|
|
8860
|
+
} else moveTo$2(path, rx, 0);
|
|
8857
8861
|
for (let i = 1; i < sides; i++) {
|
|
8858
|
-
|
|
8862
|
+
radian = i * 2 * PI$2 / sides + startRadian;
|
|
8863
|
+
lineTo$2(path, rx + rx * sin$2(radian), ry - ry * cos$2(radian));
|
|
8859
8864
|
}
|
|
8860
8865
|
closePath$1(path);
|
|
8861
8866
|
}
|
|
@@ -8863,6 +8868,7 @@ var LeaferUI = function(exports) {
|
|
|
8863
8868
|
};
|
|
8864
8869
|
__decorate([ dataProcessor(PolygonData) ], exports.Polygon.prototype, "__", void 0);
|
|
8865
8870
|
__decorate([ pathType(3) ], exports.Polygon.prototype, "sides", void 0);
|
|
8871
|
+
__decorate([ pathType(0) ], exports.Polygon.prototype, "startAngle", void 0);
|
|
8866
8872
|
__decorate([ pathType() ], exports.Polygon.prototype, "points", void 0);
|
|
8867
8873
|
__decorate([ pathType(0) ], exports.Polygon.prototype, "curve", void 0);
|
|
8868
8874
|
exports.Polygon = __decorate([ rewriteAble(), registerUI() ], exports.Polygon);
|
|
@@ -8873,12 +8879,17 @@ var LeaferUI = function(exports) {
|
|
|
8873
8879
|
return "Star";
|
|
8874
8880
|
}
|
|
8875
8881
|
__updatePath() {
|
|
8876
|
-
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
8882
|
+
const {width: width, height: height, corners: corners, innerRadius: innerRadius, startAngle: startAngle} = this.__;
|
|
8877
8883
|
const rx = width / 2, ry = height / 2;
|
|
8878
8884
|
const path = this.__.path = [];
|
|
8879
|
-
|
|
8885
|
+
let startRadian = 0, radian;
|
|
8886
|
+
if (startAngle) {
|
|
8887
|
+
startRadian = startAngle * OneRadian;
|
|
8888
|
+
moveTo$1(path, rx + rx * sin$1(startRadian), ry - ry * cos$1(startRadian));
|
|
8889
|
+
} else moveTo$1(path, rx, 0);
|
|
8880
8890
|
for (let i = 1; i < corners * 2; i++) {
|
|
8881
|
-
|
|
8891
|
+
radian = i * PI$1 / corners + startRadian;
|
|
8892
|
+
lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin$1(radian), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos$1(radian));
|
|
8882
8893
|
}
|
|
8883
8894
|
closePath(path);
|
|
8884
8895
|
}
|
|
@@ -8886,6 +8897,7 @@ var LeaferUI = function(exports) {
|
|
|
8886
8897
|
__decorate([ dataProcessor(StarData) ], exports.Star.prototype, "__", void 0);
|
|
8887
8898
|
__decorate([ pathType(5) ], exports.Star.prototype, "corners", void 0);
|
|
8888
8899
|
__decorate([ pathType(.382) ], exports.Star.prototype, "innerRadius", void 0);
|
|
8900
|
+
__decorate([ pathType(0) ], exports.Star.prototype, "startAngle", void 0);
|
|
8889
8901
|
exports.Star = __decorate([ registerUI() ], exports.Star);
|
|
8890
8902
|
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
8891
8903
|
const {rotate: rotate$3, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
|
|
@@ -9185,7 +9197,8 @@ var LeaferUI = function(exports) {
|
|
|
9185
9197
|
return this;
|
|
9186
9198
|
}
|
|
9187
9199
|
paint() {
|
|
9188
|
-
|
|
9200
|
+
const {pathElement: pathElement} = this;
|
|
9201
|
+
if (!pathElement.__layout.boxChanged) pathElement.forceUpdate("path");
|
|
9189
9202
|
}
|
|
9190
9203
|
};
|
|
9191
9204
|
__decorate([ dataProcessor(PenData) ], exports.Pen.prototype, "__", void 0);
|
|
@@ -9392,7 +9405,7 @@ var LeaferUI = function(exports) {
|
|
|
9392
9405
|
EventCreator.changeName(oldName, newName);
|
|
9393
9406
|
}
|
|
9394
9407
|
}
|
|
9395
|
-
const {min: min$1, max: max$3, abs: abs$
|
|
9408
|
+
const {min: min$1, max: max$3, abs: abs$8} = Math, {float: float$3, sign: sign$2} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
|
|
9396
9409
|
const tempContent = new Bounds, tempDragBounds = new Bounds;
|
|
9397
9410
|
const DragBoundsHelper = {
|
|
9398
9411
|
limitMove(leaf, move) {
|
|
@@ -9414,7 +9427,7 @@ var LeaferUI = function(exports) {
|
|
|
9414
9427
|
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
9415
9428
|
},
|
|
9416
9429
|
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
9417
|
-
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
9430
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && float$3(content[sideType]) > float$3(dragBounds[sideType]);
|
|
9418
9431
|
},
|
|
9419
9432
|
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
9420
9433
|
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
@@ -9467,7 +9480,7 @@ var LeaferUI = function(exports) {
|
|
|
9467
9480
|
bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
|
|
9468
9481
|
correctScaleY *= max$3(aScale, bScale);
|
|
9469
9482
|
if (lockRatio) {
|
|
9470
|
-
aScale = max$3(abs$
|
|
9483
|
+
aScale = max$3(abs$8(correctScaleX), abs$8(correctScaleY));
|
|
9471
9484
|
correctScaleX = sign$2(correctScaleX) * aScale;
|
|
9472
9485
|
correctScaleY = sign$2(correctScaleY) * aScale;
|
|
9473
9486
|
}
|
|
@@ -10650,6 +10663,8 @@ var LeaferUI = function(exports) {
|
|
|
10650
10663
|
if (!data.__strokeWidth) return;
|
|
10651
10664
|
if (data.__font) {
|
|
10652
10665
|
Paint.strokeText(stroke, ui, canvas, renderOptions);
|
|
10666
|
+
} else if (data.__pathForStroke) {
|
|
10667
|
+
Paint.fillStroke(stroke, ui, canvas, renderOptions);
|
|
10653
10668
|
} else {
|
|
10654
10669
|
switch (data.strokeAlign) {
|
|
10655
10670
|
case "center":
|
|
@@ -10927,11 +10942,11 @@ var LeaferUI = function(exports) {
|
|
|
10927
10942
|
shape: shape
|
|
10928
10943
|
};
|
|
10929
10944
|
let cache$1, box$2 = new Bounds;
|
|
10930
|
-
const {isSame: isSame$
|
|
10945
|
+
const {isSame: isSame$2} = BoundsHelper;
|
|
10931
10946
|
function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
10932
10947
|
let leafPaint, event;
|
|
10933
10948
|
const image = ImageManager.get(paint, paint.type);
|
|
10934
|
-
if (cache$1 && paint === cache$1.paint && isSame$
|
|
10949
|
+
if (cache$1 && paint === cache$1.paint && isSame$2(boxBounds, cache$1.boxBounds)) {
|
|
10935
10950
|
leafPaint = cache$1.leafPaint;
|
|
10936
10951
|
} else {
|
|
10937
10952
|
leafPaint = {
|
|
@@ -11199,7 +11214,7 @@ var LeaferUI = function(exports) {
|
|
|
11199
11214
|
translate(transform, box.x + x, box.y + y);
|
|
11200
11215
|
}
|
|
11201
11216
|
const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
|
|
11202
|
-
const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$
|
|
11217
|
+
const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$7} = Math;
|
|
11203
11218
|
function createPatternTask(paint, ui, canvas, renderOptions) {
|
|
11204
11219
|
if (!paint.patternTask) {
|
|
11205
11220
|
paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
@@ -11221,8 +11236,8 @@ var LeaferUI = function(exports) {
|
|
|
11221
11236
|
width *= scaleX;
|
|
11222
11237
|
height *= scaleY;
|
|
11223
11238
|
if (gap) {
|
|
11224
|
-
xGap = gap.x * scaleX / abs$
|
|
11225
|
-
yGap = gap.y * scaleY / abs$
|
|
11239
|
+
xGap = gap.x * scaleX / abs$7(data.scaleX || 1);
|
|
11240
|
+
yGap = gap.y * scaleY / abs$7(data.scaleY || 1);
|
|
11226
11241
|
}
|
|
11227
11242
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
11228
11243
|
scaleX *= getFloorScale(width + (xGap || 0));
|
|
@@ -11434,7 +11449,7 @@ var LeaferUI = function(exports) {
|
|
|
11434
11449
|
conicGradient: conicGradient,
|
|
11435
11450
|
getTransform: getTransform
|
|
11436
11451
|
};
|
|
11437
|
-
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$
|
|
11452
|
+
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$6} = Math;
|
|
11438
11453
|
const tempBounds$1 = {}, tempMatrix = new Matrix;
|
|
11439
11454
|
const offsetOutBounds$1 = {};
|
|
11440
11455
|
function shadow$1(ui, current, shape) {
|
|
@@ -11474,7 +11489,7 @@ var LeaferUI = function(exports) {
|
|
|
11474
11489
|
function getShadowRenderSpread(_ui, shadow) {
|
|
11475
11490
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
11476
11491
|
shadow.forEach(item => {
|
|
11477
|
-
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$
|
|
11492
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$6(item.spread || 0);
|
|
11478
11493
|
top = max$2(top, spread + blur - y);
|
|
11479
11494
|
right = max$2(right, spread + blur + x);
|
|
11480
11495
|
bottom = max$2(bottom, spread + blur + y);
|
|
@@ -12223,7 +12238,7 @@ var LeaferUI = function(exports) {
|
|
|
12223
12238
|
});
|
|
12224
12239
|
};
|
|
12225
12240
|
}
|
|
12226
|
-
const {abs: abs$
|
|
12241
|
+
const {abs: abs$5} = Math;
|
|
12227
12242
|
const {copy: copy$2} = MatrixHelper;
|
|
12228
12243
|
const {setListWithFn: setListWithFn} = BoundsHelper;
|
|
12229
12244
|
const {worldBounds: worldBounds} = LeafBoundsHelper;
|
|
@@ -12260,7 +12275,7 @@ var LeaferUI = function(exports) {
|
|
|
12260
12275
|
leaf = list[i];
|
|
12261
12276
|
const {worldTransform: worldTransform, worldRenderBounds: worldRenderBounds} = leaf;
|
|
12262
12277
|
if (worldRenderBounds.width && worldRenderBounds.height && (!bounds || bounds.hit(worldRenderBounds, options.matrix))) {
|
|
12263
|
-
const aScaleX = abs$
|
|
12278
|
+
const aScaleX = abs$5(worldTransform.scaleX), aScaleY = abs$5(worldTransform.scaleY);
|
|
12264
12279
|
copy$2(matrix$1, worldTransform);
|
|
12265
12280
|
matrix$1.half = strokeWidth % 2;
|
|
12266
12281
|
canvas.setWorld(matrix$1, options.matrix);
|
|
@@ -12563,7 +12578,7 @@ var LeaferUI = function(exports) {
|
|
|
12563
12578
|
}
|
|
12564
12579
|
}
|
|
12565
12580
|
const {topLeft: topLeft$1, top: top$1, topRight: topRight$1, right: right$2, bottomRight: bottomRight, bottom: bottom$1, bottomLeft: bottomLeft, left: left$2} = exports.Direction9;
|
|
12566
|
-
const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$
|
|
12581
|
+
const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$4} = Math;
|
|
12567
12582
|
const EditDataHelper = {
|
|
12568
12583
|
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
|
|
12569
12584
|
let align, origin = {}, scaleX = 1, scaleY = 1, lockScale;
|
|
@@ -12648,7 +12663,7 @@ var LeaferUI = function(exports) {
|
|
|
12648
12663
|
break;
|
|
12649
12664
|
|
|
12650
12665
|
default:
|
|
12651
|
-
lockScale = Math.sqrt(abs$
|
|
12666
|
+
lockScale = Math.sqrt(abs$4(scaleX * scaleY));
|
|
12652
12667
|
scaleX = sign$1(scaleX) * lockScale;
|
|
12653
12668
|
scaleY = sign$1(scaleY) * lockScale;
|
|
12654
12669
|
}
|
|
@@ -12681,10 +12696,10 @@ var LeaferUI = function(exports) {
|
|
|
12681
12696
|
const nowHeight = boxBounds.height * target.scaleY;
|
|
12682
12697
|
scaleY = within$3(nowHeight * scaleY, heightRange) / nowHeight;
|
|
12683
12698
|
}
|
|
12684
|
-
if (useScaleX && abs$
|
|
12685
|
-
if (useScaleY && abs$
|
|
12699
|
+
if (useScaleX && abs$4(scaleX * worldBoxBounds.width) < 1) scaleX = sign$1(scaleX) / worldBoxBounds.width;
|
|
12700
|
+
if (useScaleY && abs$4(scaleY * worldBoxBounds.height) < 1) scaleY = sign$1(scaleY) / worldBoxBounds.height;
|
|
12686
12701
|
if (lockRatio && scaleX !== scaleY) {
|
|
12687
|
-
lockScale = Math.min(abs$
|
|
12702
|
+
lockScale = Math.min(abs$4(scaleX), abs$4(scaleY));
|
|
12688
12703
|
scaleX = sign$1(scaleX) * lockScale;
|
|
12689
12704
|
scaleY = sign$1(scaleY) * lockScale;
|
|
12690
12705
|
}
|
|
@@ -14648,10 +14663,22 @@ var LeaferUI = function(exports) {
|
|
|
14648
14663
|
}
|
|
14649
14664
|
}
|
|
14650
14665
|
leaf.fontSize *= fontScale;
|
|
14651
|
-
const data = leaf.__, {padding: padding} = data;
|
|
14666
|
+
const data = leaf.__, {padding: padding, lineHeight: lineHeight, letterSpacing: letterSpacing} = data;
|
|
14652
14667
|
if (padding) leaf.padding = isArray(padding) ? padding.map(item => item * fontScale) : padding * fontScale;
|
|
14653
14668
|
if (!data.__autoWidth) leaf.width *= fontScale;
|
|
14654
14669
|
if (!data.__autoHeight) leaf.height *= fontScale;
|
|
14670
|
+
if (isObject(lineHeight)) {
|
|
14671
|
+
if (lineHeight.type === "px") data.lineHeight = {
|
|
14672
|
+
type: "px",
|
|
14673
|
+
value: lineHeight.value * fontScale
|
|
14674
|
+
};
|
|
14675
|
+
} else if (lineHeight) data.lineHeight = lineHeight * fontScale;
|
|
14676
|
+
if (isObject(letterSpacing)) {
|
|
14677
|
+
if (letterSpacing.type === "px") data.letterSpacing = {
|
|
14678
|
+
type: "px",
|
|
14679
|
+
value: letterSpacing.value * fontScale
|
|
14680
|
+
};
|
|
14681
|
+
} else if (letterSpacing) data.letterSpacing = letterSpacing * fontScale;
|
|
14655
14682
|
}
|
|
14656
14683
|
function scaleResizePath(leaf, scaleX, scaleY) {
|
|
14657
14684
|
PathScaler.scale(leaf.__.path, scaleX, scaleY);
|
|
@@ -15170,7 +15197,7 @@ var LeaferUI = function(exports) {
|
|
|
15170
15197
|
}
|
|
15171
15198
|
};
|
|
15172
15199
|
const M$4 = MultiTouchHelper;
|
|
15173
|
-
const {abs: abs$
|
|
15200
|
+
const {abs: abs$3, max: max$1} = Math, {sign: sign, within: within$2} = MathHelper;
|
|
15174
15201
|
const WheelEventHelper = {
|
|
15175
15202
|
getMove(event, config) {
|
|
15176
15203
|
let {moveSpeed: moveSpeed} = config;
|
|
@@ -15179,7 +15206,7 @@ var LeaferUI = function(exports) {
|
|
|
15179
15206
|
deltaX = deltaY;
|
|
15180
15207
|
deltaY = 0;
|
|
15181
15208
|
}
|
|
15182
|
-
const absX = abs$
|
|
15209
|
+
const absX = abs$3(deltaX), absY = abs$3(deltaY);
|
|
15183
15210
|
if (absX > 50) deltaX = max$1(50, absX / 3) * sign(deltaX);
|
|
15184
15211
|
if (absY > 50) deltaY = max$1(50, absY / 3) * sign(deltaY);
|
|
15185
15212
|
return {
|
|
@@ -15201,7 +15228,7 @@ var LeaferUI = function(exports) {
|
|
|
15201
15228
|
if (zoom) {
|
|
15202
15229
|
zoomSpeed = within$2(zoomSpeed, 0, 1);
|
|
15203
15230
|
const min = event.deltaY ? config.delta.y : config.delta.x;
|
|
15204
|
-
const absScale = within$2(1 - abs$
|
|
15231
|
+
const absScale = within$2(1 - abs$3(delta) / (min * 4) * zoomSpeed, .5, 2);
|
|
15205
15232
|
scale = delta > 0 ? absScale : 1 / absScale;
|
|
15206
15233
|
}
|
|
15207
15234
|
return scale;
|
|
@@ -15420,7 +15447,7 @@ var LeaferUI = function(exports) {
|
|
|
15420
15447
|
if (moving) this.move(getMoveEventData(gestureData.move, data));
|
|
15421
15448
|
};
|
|
15422
15449
|
const dragger = Dragger.prototype;
|
|
15423
|
-
const {abs: abs$
|
|
15450
|
+
const {abs: abs$2, min: min, max: max, hypot: hypot} = Math;
|
|
15424
15451
|
dragger.checkDragEndAnimate = function(data) {
|
|
15425
15452
|
const {interaction: interaction} = this;
|
|
15426
15453
|
const dragAnimate = this.canAnimate && this.moving && interaction.m.dragAnimate;
|
|
@@ -15448,7 +15475,7 @@ var LeaferUI = function(exports) {
|
|
|
15448
15475
|
moveX *= boost;
|
|
15449
15476
|
moveY *= boost;
|
|
15450
15477
|
}
|
|
15451
|
-
const maxAbs = max(abs$
|
|
15478
|
+
const maxAbs = max(abs$2(moveX), abs$2(moveY));
|
|
15452
15479
|
if (maxAbs > maxMove) {
|
|
15453
15480
|
s = maxMove / maxAbs;
|
|
15454
15481
|
moveX *= s;
|
|
@@ -15458,7 +15485,7 @@ var LeaferUI = function(exports) {
|
|
|
15458
15485
|
moveX *= inertia;
|
|
15459
15486
|
moveY *= inertia;
|
|
15460
15487
|
data = Object.assign({}, data);
|
|
15461
|
-
if (abs$
|
|
15488
|
+
if (abs$2(moveX) < stopMove && abs$2(moveY) < stopMove) return this.dragEndReal(data);
|
|
15462
15489
|
PointHelper.move(data, moveX, moveY);
|
|
15463
15490
|
this.drag(data);
|
|
15464
15491
|
this.animate(step);
|
|
@@ -16115,7 +16142,7 @@ var LeaferUI = function(exports) {
|
|
|
16115
16142
|
return arrowData;
|
|
16116
16143
|
}
|
|
16117
16144
|
const {M: M$2, L: L$2, C: C$2, Q: Q, Z: Z$2, N: N, D: D, X: X, G: G, F: F, O: O, P: P, U: U} = PathCommandMap;
|
|
16118
|
-
const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame} = PointHelper;
|
|
16145
|
+
const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame$1} = PointHelper;
|
|
16119
16146
|
const {stintSet: stintSet$1} = DataHelper;
|
|
16120
16147
|
const connectPoint = {};
|
|
16121
16148
|
const first = {}, second = {};
|
|
@@ -16204,7 +16231,7 @@ var LeaferUI = function(exports) {
|
|
|
16204
16231
|
}
|
|
16205
16232
|
count++;
|
|
16206
16233
|
if (count === 1 && command !== M$2) return;
|
|
16207
|
-
if (count === 2 && useStartArrow) copy(second, command === L$2 ? now : isSame(old, first) ? last : old);
|
|
16234
|
+
if (count === 2 && useStartArrow) copy(second, command === L$2 ? now : isSame$1(old, first) ? last : old);
|
|
16208
16235
|
if (i === len) {
|
|
16209
16236
|
const path = uData.__pathForRender = clonePathForArrow ? [ ...data ] : data;
|
|
16210
16237
|
if (useStartArrow) {
|
|
@@ -16218,7 +16245,7 @@ var LeaferUI = function(exports) {
|
|
|
16218
16245
|
}
|
|
16219
16246
|
}
|
|
16220
16247
|
if (endArrow && endArrow !== "none") {
|
|
16221
|
-
if (isSame(last, now)) copy(last, old);
|
|
16248
|
+
if (isSame$1(last, now)) copy(last, old);
|
|
16222
16249
|
endArrowPath = getArrowPath(ui, endArrow, last, now, strokeWidth, connectPoint, !!dashPattern);
|
|
16223
16250
|
singleEndArrow = endArrowPath.fill || dashPattern;
|
|
16224
16251
|
if (!singleEndArrow) path.push(...endArrowPath.data);
|
|
@@ -16774,7 +16801,7 @@ var LeaferUI = function(exports) {
|
|
|
16774
16801
|
this.__updateRectBoxBounds();
|
|
16775
16802
|
}
|
|
16776
16803
|
};
|
|
16777
|
-
const {cos: cos, sin: sin, pow: pow, sqrt: sqrt$1, abs: abs, ceil: ceil, floor: floor, round: round$2, PI: PI} = Math;
|
|
16804
|
+
const {cos: cos, sin: sin, pow: pow, sqrt: sqrt$1, abs: abs$1, ceil: ceil, floor: floor, round: round$2, PI: PI} = Math;
|
|
16778
16805
|
const PIx5 = PI * 5;
|
|
16779
16806
|
const n1$1 = 1.70158;
|
|
16780
16807
|
const n2$1 = 1.70158 * 1.525;
|
|
@@ -16802,7 +16829,7 @@ var LeaferUI = function(exports) {
|
|
|
16802
16829
|
o = 1 - v;
|
|
16803
16830
|
x = bezier(v, x1, x2) - t;
|
|
16804
16831
|
dx = 3 * o * o * x1 + 6 * o * v * (x2 - x1) + 3 * v * v * (1 - x2);
|
|
16805
|
-
if (abs(dx) < 1e-6) break;
|
|
16832
|
+
if (abs$1(dx) < 1e-6) break;
|
|
16806
16833
|
v -= x / dx;
|
|
16807
16834
|
}
|
|
16808
16835
|
return cache[key] = bezier(v, y1, y2);
|
|
@@ -19403,12 +19430,12 @@ var LeaferUI = function(exports) {
|
|
|
19403
19430
|
}
|
|
19404
19431
|
return Math.max(0, Math.min(.5, t));
|
|
19405
19432
|
}
|
|
19406
|
-
const {M: M, L: L, C: C, Z: Z} = PathCommandMap;
|
|
19433
|
+
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {abs: abs} = Math;
|
|
19407
19434
|
const {getCenterX: getCenterX, getCenterY: getCenterY} = PointHelper;
|
|
19408
19435
|
const {arcTo: arcTo} = PathCommandDataHelper;
|
|
19409
19436
|
PathCorner.smooth = function smooth(data, cornerRadius, _cornerSmoothing) {
|
|
19410
19437
|
const radius = data.radius;
|
|
19411
|
-
if (isNeedConvert(data)) data = PathConvert.toCanvasData(data, true);
|
|
19438
|
+
if (isNeedConvert(data)) data = PathConvert.toCanvasData(data, true); else data = [ ...data ];
|
|
19412
19439
|
let command, lastCommand, commandLen;
|
|
19413
19440
|
let i = 0, countCommand = 0, x = 0, y = 0, startX = 0, startY = 0, startR = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0, r, x1, y1, x2, y2, toX, toY;
|
|
19414
19441
|
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
@@ -19494,6 +19521,9 @@ var LeaferUI = function(exports) {
|
|
|
19494
19521
|
toX = startX, toY = startY;
|
|
19495
19522
|
setBeforeC(smooth, r, lastX, lastY, x1, y1, x2, y2, x, y, toX, toY, three);
|
|
19496
19523
|
break;
|
|
19524
|
+
|
|
19525
|
+
default:
|
|
19526
|
+
smooth.push(C, x1, y1, x2, y2, x, y);
|
|
19497
19527
|
}
|
|
19498
19528
|
lastX = x;
|
|
19499
19529
|
lastY = y;
|
|
@@ -19580,7 +19610,16 @@ var LeaferUI = function(exports) {
|
|
|
19580
19610
|
return undefined;
|
|
19581
19611
|
}
|
|
19582
19612
|
function setAfterC(data, i, cornerRadius, lastX, lastY, fromX, fromY, x1, y1, x2, y2, toX, toY) {
|
|
19583
|
-
|
|
19613
|
+
let targetX = x1, targetY = y1;
|
|
19614
|
+
if (isSame(x1, fromX) && isSame(y1, fromY)) {
|
|
19615
|
+
targetX = x2;
|
|
19616
|
+
targetY = y2;
|
|
19617
|
+
if (isSame(x2, fromX) && isSame(y2, fromY)) {
|
|
19618
|
+
targetX = toX;
|
|
19619
|
+
targetY = toY;
|
|
19620
|
+
}
|
|
19621
|
+
}
|
|
19622
|
+
const d = getTangentDistance(cornerRadius, fromX, fromY, lastX, lastY, targetX, targetY);
|
|
19584
19623
|
const t = getCorrectT(d, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
19585
19624
|
const two = BezierHelper.cut(t, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
19586
19625
|
const {left: left, right: right} = two;
|
|
@@ -19593,7 +19632,16 @@ var LeaferUI = function(exports) {
|
|
|
19593
19632
|
return two;
|
|
19594
19633
|
}
|
|
19595
19634
|
function setBeforeC(smooth, cornerRadius, fromX, fromY, x1, y1, x2, y2, toX, toY, nextX, nextY, three) {
|
|
19596
|
-
|
|
19635
|
+
let targetX = x2, targetY = y2;
|
|
19636
|
+
if (isSame(targetX, toX) && isSame(targetY, toY)) {
|
|
19637
|
+
targetX = x1;
|
|
19638
|
+
targetY = y1;
|
|
19639
|
+
if (isSame(targetX, toX) && isSame(targetY, toY)) {
|
|
19640
|
+
targetX = fromX;
|
|
19641
|
+
targetY = fromY;
|
|
19642
|
+
}
|
|
19643
|
+
}
|
|
19644
|
+
const d = getTangentDistance(cornerRadius, toX, toY, targetX, targetY, nextX, nextY);
|
|
19597
19645
|
const t = getCorrectT(d, toX, toY, x2, y2, x1, y1, fromX, fromY);
|
|
19598
19646
|
const {left: left, right: right} = BezierHelper.cut(1 - t, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
19599
19647
|
if (left && right) {
|
|
@@ -19603,6 +19651,9 @@ var LeaferUI = function(exports) {
|
|
|
19603
19651
|
smooth.push(C, x1, y1, x2, y2, toX, toY);
|
|
19604
19652
|
}
|
|
19605
19653
|
}
|
|
19654
|
+
function isSame(a, b) {
|
|
19655
|
+
return abs(a - b) < .01;
|
|
19656
|
+
}
|
|
19606
19657
|
Plugin.add("corner");
|
|
19607
19658
|
exports.AlignHelper = AlignHelper;
|
|
19608
19659
|
exports.AnimateEasing = AnimateEasing;
|
package/dist/worker.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.min.cjs","sources":["../../../../../../../src/leafer/packages/interface/src/path/IPathCommand.ts"],"sourcesContent":["import { IPointData } from '../math/IMath'\n\ntype Command = number\ntype x = number\ntype y = number\ntype x1 = number\ntype y1 = number\ntype x2 = number\ntype y2 = number\ntype radiusX = number\ntype radiusY = number\ntype xAxisRotation = number\ntype largeArcFlag = number\ntype sweepFlag = number\n\n\nexport type MCommandData = [Command, x, y]\nexport type HCommandData = [Command, x]\nexport type VCommandData = [Command, y]\nexport type LCommandData = MCommandData\n\nexport type CCommandData = [Command, x1, y1, x2, y2, x, y]\nexport type SCommandData = [Command, x2, y2, x, y]\n\nexport type QCommandData = [Command, x1, y1, x, y]\nexport type TCommandData = [Command, x, y]\n\nexport type ZCommandData = [Command]\n\nexport type ACommandData = [Command, radiusX, radiusY, xAxisRotation, largeArcFlag, sweepFlag, x, y]\n\n\n// 非svg标准的canvas绘图命令\ntype width = number\ntype height = number\ntype rotation = number\ntype startAngle = number\ntype endAngle = number\ntype anticlockwise = boolean\ntype cornerRadius = number | number[]\ntype radius = number\n\nexport type RectCommandData = [Command, x, y, width, height]\nexport type RoundRectCommandData = [Command, x, y, width, height, cornerRadius]\nexport type EllipseCommandData = [Command, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise]\nexport type ArcCommandData = [Command, x, y, radius, startAngle, endAngle, anticlockwise]\nexport type ArcToCommandData = [Command, x1, y1, x2, y2, radius]\n\n\nexport type CanvasPathCommand = 1 | 2 | 5 | 7 | 11 // M | L | C | Q | Z canvas可以绘制的命令\n\nexport type IPathCommandData = number[] // ...(MCommandData | LCommandData | CCommandData | QCommandData | ZCommandData)\n\nexport interface IPathCommandDataWithRadius {\n data: IPathCommandData\n radius: number[]\n}\n\n// 路径命令对象\nexport interface MoveToCommandObject {\n name: 'M'\n x: number\n y: number\n}\nexport interface LineToCommandObject {\n name: 'L'\n x: number\n y: number\n}\n\nexport interface BezierCurveToCommandObject {\n name: 'C'\n x1: number\n y1: number\n x2: number\n y2: number\n x: number\n y: number\n}\n\nexport interface QuadraticCurveToCommandObject {\n name: 'Q'\n x1: number\n y1: number\n x: number\n y: number\n}\n\nexport interface ClosePathCommandObject {\n name: 'Z'\n}\n\nexport type IPathCommandObject = MoveToCommandObject | LineToCommandObject | BezierCurveToCommandObject | QuadraticCurveToCommandObject | ClosePathCommandObject // M | L | C | Q | Z canvas可以绘制的命令\n\n\n// 可视化路径节点\n\nexport interface IPathCommandNodeBase {\n name: 'M^' | 'L^' | 'C^' | 'Z^'\n x: number\n y: number\n r?: number // 圆角半径\n a?: IPointData // 第一个手柄,连接上一个节点\n b?: IPointData // 第二个手柄,连接下一个节点\n ab?: PathNodeHandleType // 手柄类型\n}\n\nexport interface MoveToCommandNode extends IPathCommandNodeBase {\n name: 'M^'\n}\nexport interface LineToCommandNode extends IPathCommandNodeBase {\n name: 'L^'\n}\n\nexport interface BezierCurveToCommandNode extends IPathCommandNodeBase {\n name: 'C^'\n}\n\nexport interface ClosePathCommandNode {\n name: 'Z^'\n x?: number\n y?: number\n r?: number // 圆角半径\n a?: IPointData\n b?: IPointData\n ab?: PathNodeHandleType\n}\n\nexport type IPathCommandNode = MoveToCommandNode | LineToCommandNode | BezierCurveToCommandNode | ClosePathCommandNode // M | L | C | Z 路径节点命令(适合可视化编辑)\n\nexport enum PathNodeHandleType { // 手柄类型\n none = 1, // 无手柄\n free = 2, // 每个手柄自由控制\n mirrorAngle = 3, // 仅镜像角度\n mirror = 4, // 镜像角度和长度\n}\n\nexport type PathNodeHandleName = 'a' | 'b' // 手柄名称\n\nexport interface IPathNodeBase {\n pathNode: IPathCommandNode\n}"],"names":["PathNodeHandleType"],"mappings":"
|
|
1
|
+
{"version":3,"file":"worker.min.cjs","sources":["../../../../../../../src/leafer/packages/interface/src/path/IPathCommand.ts"],"sourcesContent":["import { IPointData } from '../math/IMath'\nimport { IWindingRule } from '../canvas/ICanvas'\n\ntype Command = number\ntype x = number\ntype y = number\ntype x1 = number\ntype y1 = number\ntype x2 = number\ntype y2 = number\ntype radiusX = number\ntype radiusY = number\ntype xAxisRotation = number\ntype largeArcFlag = number\ntype sweepFlag = number\n\n\nexport type MCommandData = [Command, x, y]\nexport type HCommandData = [Command, x]\nexport type VCommandData = [Command, y]\nexport type LCommandData = MCommandData\n\nexport type CCommandData = [Command, x1, y1, x2, y2, x, y]\nexport type SCommandData = [Command, x2, y2, x, y]\n\nexport type QCommandData = [Command, x1, y1, x, y]\nexport type TCommandData = [Command, x, y]\n\nexport type ZCommandData = [Command]\n\nexport type ACommandData = [Command, radiusX, radiusY, xAxisRotation, largeArcFlag, sweepFlag, x, y]\n\n\n// 非svg标准的canvas绘图命令\ntype width = number\ntype height = number\ntype rotation = number\ntype startAngle = number\ntype endAngle = number\ntype anticlockwise = boolean\ntype cornerRadius = number | number[]\ntype radius = number\n\nexport type RectCommandData = [Command, x, y, width, height]\nexport type RoundRectCommandData = [Command, x, y, width, height, cornerRadius]\nexport type EllipseCommandData = [Command, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise]\nexport type ArcCommandData = [Command, x, y, radius, startAngle, endAngle, anticlockwise]\nexport type ArcToCommandData = [Command, x1, y1, x2, y2, radius]\n\n\nexport type CanvasPathCommand = 1 | 2 | 5 | 7 | 11 // M | L | C | Q | Z canvas可以绘制的命令\n\nexport type IPathCommandData = number[] // ...(MCommandData | LCommandData | CCommandData | QCommandData | ZCommandData)\n\nexport interface IPathCommandDataWithRadius {\n data: IPathCommandData\n radius: number[]\n}\n\nexport interface IPathCommandDataWithWindingRule {\n data: IPathCommandData\n windingRule?: IWindingRule\n}\n\n// 路径命令对象\nexport interface MoveToCommandObject {\n name: 'M'\n x: number\n y: number\n}\nexport interface LineToCommandObject {\n name: 'L'\n x: number\n y: number\n}\n\nexport interface BezierCurveToCommandObject {\n name: 'C'\n x1: number\n y1: number\n x2: number\n y2: number\n x: number\n y: number\n}\n\nexport interface QuadraticCurveToCommandObject {\n name: 'Q'\n x1: number\n y1: number\n x: number\n y: number\n}\n\nexport interface ClosePathCommandObject {\n name: 'Z'\n}\n\nexport type IPathCommandObject = MoveToCommandObject | LineToCommandObject | BezierCurveToCommandObject | QuadraticCurveToCommandObject | ClosePathCommandObject // M | L | C | Q | Z canvas可以绘制的命令\n\n\n// 可视化路径节点\n\nexport interface IPathCommandNodeBase {\n name: 'M^' | 'L^' | 'C^' | 'Z^'\n x: number\n y: number\n r?: number // 圆角半径\n a?: IPointData // 第一个手柄,连接上一个节点\n b?: IPointData // 第二个手柄,连接下一个节点\n ab?: PathNodeHandleType // 手柄类型\n}\n\nexport interface MoveToCommandNode extends IPathCommandNodeBase {\n name: 'M^'\n}\nexport interface LineToCommandNode extends IPathCommandNodeBase {\n name: 'L^'\n}\n\nexport interface BezierCurveToCommandNode extends IPathCommandNodeBase {\n name: 'C^'\n}\n\nexport interface ClosePathCommandNode {\n name: 'Z^'\n x?: number\n y?: number\n r?: number // 圆角半径\n a?: IPointData\n b?: IPointData\n ab?: PathNodeHandleType\n}\n\nexport type IPathCommandNode = MoveToCommandNode | LineToCommandNode | BezierCurveToCommandNode | ClosePathCommandNode // M | L | C | Z 路径节点命令(适合可视化编辑)\n\nexport enum PathNodeHandleType { // 手柄类型\n none = 1, // 无手柄\n free = 2, // 每个手柄自由控制\n mirrorAngle = 3, // 仅镜像角度\n mirror = 4, // 镜像角度和长度\n}\n\nexport type PathNodeHandleName = 'a' | 'b' // 手柄名称\n\nexport interface IPathNodeBase {\n pathNode: IPathCommandNode\n}"],"names":["PathNodeHandleType"],"mappings":"iBAwIYA,gtBAAAA,QAAAA,wBAAAA,GAAAA,EAAAA,QAAAA,qBAAAA,2BAAkB,CAAA,IAC1BA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,YAAA,GAAA,cACAA,EAAAA,EAAA,OAAA,GAAA"}
|