leafer-game 2.0.5 → 2.0.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.esm.min.js.map +1 -1
- package/dist/web.js +37 -9
- 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 +37 -9
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +12 -12
package/dist/web.esm.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.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\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 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 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":"web.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":"wLAkIYA,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/web.js
CHANGED
|
@@ -2709,6 +2709,32 @@ var LeaferUI = function(exports) {
|
|
|
2709
2709
|
getDerivative(t, fromV, v1, v2, toV) {
|
|
2710
2710
|
const o = 1 - t;
|
|
2711
2711
|
return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
|
|
2712
|
+
},
|
|
2713
|
+
cut(t, fromX, fromY, x1, y1, x2, y2, toX, toY) {
|
|
2714
|
+
if (t <= 0) return {
|
|
2715
|
+
left: null,
|
|
2716
|
+
right: [ x1, y1, x2, y2, toX, toY ]
|
|
2717
|
+
}; else if (t >= 1) return {
|
|
2718
|
+
left: [ x1, y1, x2, y2, toX, toY ],
|
|
2719
|
+
right: null
|
|
2720
|
+
};
|
|
2721
|
+
const u = 1 - t;
|
|
2722
|
+
const leftX1 = fromX * u + x1 * t;
|
|
2723
|
+
const leftY1 = fromY * u + y1 * t;
|
|
2724
|
+
const P12x = x1 * u + x2 * t;
|
|
2725
|
+
const P12y = y1 * u + y2 * t;
|
|
2726
|
+
const rightX2 = x2 * u + toX * t;
|
|
2727
|
+
const rightY2 = y2 * u + toY * t;
|
|
2728
|
+
const leftX2 = leftX1 * u + P12x * t;
|
|
2729
|
+
const leftY2 = leftY1 * u + P12y * t;
|
|
2730
|
+
const rightX1 = P12x * u + rightX2 * t;
|
|
2731
|
+
const rightY1 = P12y * u + rightY2 * t;
|
|
2732
|
+
const leftX = leftX2 * u + rightX1 * t;
|
|
2733
|
+
const leftY = leftY2 * u + rightY1 * t;
|
|
2734
|
+
return {
|
|
2735
|
+
left: [ leftX1, leftY1, leftX2, leftY2, leftX, leftY ],
|
|
2736
|
+
right: [ rightX1, rightY1, rightX2, rightY2, toX, toY ]
|
|
2737
|
+
};
|
|
2712
2738
|
}
|
|
2713
2739
|
};
|
|
2714
2740
|
const {getPointAndSet: getPointAndSet, toTwoPointBounds: toTwoPointBounds$1, ellipse: ellipse$6} = BezierHelper;
|
|
@@ -6637,7 +6663,7 @@ var LeaferUI = function(exports) {
|
|
|
6637
6663
|
this.levelMap = null;
|
|
6638
6664
|
}
|
|
6639
6665
|
}
|
|
6640
|
-
const version = "2.0.
|
|
6666
|
+
const version = "2.0.7";
|
|
6641
6667
|
const debug$5 = Debug.get("LeaferCanvas");
|
|
6642
6668
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6643
6669
|
set zIndex(zIndex) {
|
|
@@ -6921,7 +6947,6 @@ var LeaferUI = function(exports) {
|
|
|
6921
6947
|
});
|
|
6922
6948
|
const {userAgent: userAgent} = navigator;
|
|
6923
6949
|
if (userAgent.indexOf("Firefox") > -1) {
|
|
6924
|
-
Platform.conicGradientRotate90 = true;
|
|
6925
6950
|
Platform.intWheelDeltaY = true;
|
|
6926
6951
|
Platform.syncDomFont = true;
|
|
6927
6952
|
} else if (/iPhone|iPad|iPod/.test(navigator.userAgent) || /Macintosh/.test(navigator.userAgent) && /Version\/[\d.]+.*Safari/.test(navigator.userAgent)) {
|
|
@@ -8240,6 +8265,7 @@ var LeaferUI = function(exports) {
|
|
|
8240
8265
|
createProxyData() {
|
|
8241
8266
|
return undefined;
|
|
8242
8267
|
}
|
|
8268
|
+
clearProxyData() {}
|
|
8243
8269
|
find(_condition, _options) {
|
|
8244
8270
|
return Plugin.need("find");
|
|
8245
8271
|
}
|
|
@@ -8280,7 +8306,7 @@ var LeaferUI = function(exports) {
|
|
|
8280
8306
|
__updateRenderPath(updateCache) {
|
|
8281
8307
|
const data = this.__;
|
|
8282
8308
|
if (data.path) {
|
|
8283
|
-
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
8309
|
+
data.__pathForRender = data.cornerRadius || data.path.radius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
8284
8310
|
if (data.__useArrow) PathArrow.addArrows(this, updateCache);
|
|
8285
8311
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
8286
8312
|
}
|
|
@@ -8999,7 +9025,7 @@ var LeaferUI = function(exports) {
|
|
|
8999
9025
|
}
|
|
9000
9026
|
}
|
|
9001
9027
|
if (!open) closePath$2(path);
|
|
9002
|
-
if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
|
|
9028
|
+
if (Platform.ellipseToCurve || data.__useArrow || data.cornerRadius) data.path = this.getPath(true);
|
|
9003
9029
|
}
|
|
9004
9030
|
};
|
|
9005
9031
|
__decorate([ dataProcessor(EllipseData) ], exports.Ellipse.prototype, "__", void 0);
|
|
@@ -9017,7 +9043,7 @@ var LeaferUI = function(exports) {
|
|
|
9017
9043
|
const data = this.__;
|
|
9018
9044
|
const path = data.path = [];
|
|
9019
9045
|
if (data.points) {
|
|
9020
|
-
drawPoints$1(path, data.points, data.curve,
|
|
9046
|
+
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
9021
9047
|
} else {
|
|
9022
9048
|
const {width: width, height: height, sides: sides} = data;
|
|
9023
9049
|
const rx = width / 2, ry = height / 2;
|
|
@@ -11487,17 +11513,19 @@ var LeaferUI = function(exports) {
|
|
|
11487
11513
|
return leafPaint;
|
|
11488
11514
|
}
|
|
11489
11515
|
function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
|
|
11516
|
+
let needUpdate = true;
|
|
11490
11517
|
const data = ui.__;
|
|
11491
11518
|
if (attrName === "fill" && !data.__naturalWidth) {
|
|
11492
11519
|
data.__naturalWidth = image.width / data.pixelRatio;
|
|
11493
11520
|
data.__naturalHeight = image.height / data.pixelRatio;
|
|
11494
11521
|
if (data.__autoSide) {
|
|
11495
11522
|
ui.forceUpdate("width");
|
|
11523
|
+
LeafHelper.updateBounds(ui);
|
|
11496
11524
|
if (ui.__proxyData) {
|
|
11497
11525
|
ui.setProxyAttr("width", data.width);
|
|
11498
11526
|
ui.setProxyAttr("height", data.height);
|
|
11499
11527
|
}
|
|
11500
|
-
|
|
11528
|
+
needUpdate = false;
|
|
11501
11529
|
}
|
|
11502
11530
|
}
|
|
11503
11531
|
if (!leafPaint.data) {
|
|
@@ -11507,7 +11535,7 @@ var LeaferUI = function(exports) {
|
|
|
11507
11535
|
if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
|
|
11508
11536
|
}
|
|
11509
11537
|
if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui);
|
|
11510
|
-
return
|
|
11538
|
+
return needUpdate;
|
|
11511
11539
|
}
|
|
11512
11540
|
function onLoad(ui, event) {
|
|
11513
11541
|
emit(ui, ImageEvent.LOAD, event);
|
|
@@ -11910,10 +11938,10 @@ var LeaferUI = function(exports) {
|
|
|
11910
11938
|
const realFrom = {};
|
|
11911
11939
|
const realTo = {};
|
|
11912
11940
|
function conicGradient(paint, box) {
|
|
11913
|
-
let {from: from, to: to, type: type, opacity: opacity, stretch: stretch} = paint;
|
|
11941
|
+
let {from: from, to: to, type: type, opacity: opacity, rotation: rotation, stretch: stretch} = paint;
|
|
11914
11942
|
toPoint(from || "center", box, realFrom);
|
|
11915
11943
|
toPoint(to || "bottom", box, realTo);
|
|
11916
|
-
const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance$1(realFrom, realTo));
|
|
11944
|
+
const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(rotation ? rotation * OneRadian : 0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance$1(realFrom, realTo));
|
|
11917
11945
|
const data = {
|
|
11918
11946
|
type: type,
|
|
11919
11947
|
style: style
|
package/dist/web.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.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\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 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 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":"web.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":"iBAkIYA,sLAAAA,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"}
|