@leafer/worker 2.1.4 → 2.1.6

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.
@@ -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'\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"}
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 pressure?: number // 压感\n}\nexport interface LineToCommandObject {\n name: 'L'\n x: number\n y: number\n pressure?: 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 pressure?: number\n}\n\nexport interface QuadraticCurveToCommandObject {\n name: 'Q'\n x1: number\n y1: number\n x: number\n y: number\n pressure?: 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 pressure?: number // 压感\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":"ktBA6IYA,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
@@ -240,7 +240,7 @@ var LeaferUI = function(exports) {
240
240
  RUNTIME: "runtime",
241
241
  LEAF: "leaf",
242
242
  TASK: "task",
243
- CNAVAS: "canvas",
243
+ CANVAS: "canvas",
244
244
  IMAGE: "image",
245
245
  types: {},
246
246
  create(typeName) {
@@ -869,7 +869,7 @@ var LeaferUI = function(exports) {
869
869
  return quick ? t.x === point.x && t.y === point.y : float$5(t.x) === float$5(point.x) && float$5(t.y) === float$5(point.y);
870
870
  },
871
871
  reset(t) {
872
- P$7.reset(t);
872
+ t.x = t.y = 0;
873
873
  }
874
874
  };
875
875
  const P$7 = PointHelper;
@@ -1073,6 +1073,7 @@ var LeaferUI = function(exports) {
1073
1073
  }
1074
1074
  reset() {
1075
1075
  MatrixHelper.reset(this);
1076
+ return this;
1076
1077
  }
1077
1078
  }
1078
1079
  const tempMatrix$2 = new Matrix;
@@ -2177,7 +2178,7 @@ var LeaferUI = function(exports) {
2177
2178
  this.worldTransform = {};
2178
2179
  if (!config) config = minSize;
2179
2180
  this.manager = manager;
2180
- this.innerId = IncrementId.create(IncrementId.CNAVAS);
2181
+ this.innerId = IncrementId.create(IncrementId.CANVAS);
2181
2182
  const {width: width, height: height, pixelRatio: pixelRatio} = config;
2182
2183
  this.autoLayout = !width || !height;
2183
2184
  this.size.pixelRatio = pixelRatio || Platform.devicePixelRatio;
@@ -2327,6 +2328,7 @@ var LeaferUI = function(exports) {
2327
2328
  }
2328
2329
  useGrayscaleAlpha(bounds) {
2329
2330
  this.setTempPixelBounds(bounds, true, true);
2331
+ if (!tempPixelBounds.width || !tempPixelBounds.height) return;
2330
2332
  let alpha, pixel;
2331
2333
  const {context: context} = this, imageData = context.getImageData(tempPixelBounds.x, tempPixelBounds.y, tempPixelBounds.width, tempPixelBounds.height), {data: data} = imageData;
2332
2334
  for (let i = 0, len = data.length; i < len; i += 4) {
@@ -2607,10 +2609,10 @@ var LeaferUI = function(exports) {
2607
2609
  const centerY = y1 + c * sin$4(startRadian + totalRadian / 2 + PI_2 * sign);
2608
2610
  startRadian -= PI_2 * sign;
2609
2611
  endRadian -= PI_2 * sign;
2610
- return ellipse$8(data, centerX, centerY, radius, radius, 0, startRadian / OneRadian, endRadian / OneRadian, anticlockwise, setPointBounds, setEndPoint, setStartPoint);
2612
+ return ellipse$7(data, centerX, centerY, radius, radius, 0, startRadian / OneRadian, endRadian / OneRadian, anticlockwise, setPointBounds, setEndPoint, setStartPoint);
2611
2613
  },
2612
2614
  arc(data, x, y, radius, startAngle, endAngle, anticlockwise, setPointBounds, setEndPoint, setStartPoint) {
2613
- return ellipse$8(data, x, y, radius, radius, 0, startAngle, endAngle, anticlockwise, setPointBounds, setEndPoint, setStartPoint);
2615
+ return ellipse$7(data, x, y, radius, radius, 0, startAngle, endAngle, anticlockwise, setPointBounds, setEndPoint, setStartPoint);
2614
2616
  },
2615
2617
  ellipse(data, cx, cy, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise, setPointBounds, setEndPoint, setStartPoint) {
2616
2618
  const rotationRadian = rotation * OneRadian;
@@ -2737,9 +2739,9 @@ var LeaferUI = function(exports) {
2737
2739
  };
2738
2740
  }
2739
2741
  };
2740
- const {getPointAndSet: getPointAndSet, toTwoPointBounds: toTwoPointBounds$1, ellipse: ellipse$8} = BezierHelper;
2742
+ const {getPointAndSet: getPointAndSet, toTwoPointBounds: toTwoPointBounds$1, ellipse: ellipse$7} = BezierHelper;
2741
2743
  const {sin: sin$3, cos: cos$3, sqrt: sqrt$2, atan2: atan2} = Math;
2742
- const {ellipse: ellipse$7} = BezierHelper;
2744
+ const {ellipse: ellipse$6} = BezierHelper;
2743
2745
  const EllipseHelper = {
2744
2746
  ellipticalArc(data, fromX, fromY, radiusX, radiusY, rotation, largeFlag, sweepFlag, toX, toY, curveMode) {
2745
2747
  const halfX = (toX - fromX) / 2;
@@ -2776,7 +2778,7 @@ var LeaferUI = function(exports) {
2776
2778
  const centerY = fromY + halfY + rotationSin * cx + rotationCos * cy;
2777
2779
  const anticlockwise = totalRadian < 0 ? 1 : 0;
2778
2780
  if (curveMode || Platform.ellipseToCurve) {
2779
- ellipse$7(data, centerX, centerY, radiusX, radiusY, rotation, startRadian / OneRadian, endRadian / OneRadian, anticlockwise);
2781
+ ellipse$6(data, centerX, centerY, radiusX, radiusY, rotation, startRadian / OneRadian, endRadian / OneRadian, anticlockwise);
2780
2782
  } else {
2781
2783
  if (radiusX === radiusY && !rotation) {
2782
2784
  data.push(PathCommandMap.O, centerX, centerY, radiusX, startRadian / OneRadian, endRadian / OneRadian, anticlockwise);
@@ -2795,7 +2797,7 @@ var LeaferUI = function(exports) {
2795
2797
  }
2796
2798
  };
2797
2799
  const {M: M$a, m: m, L: L$a, l: l, H: H, h: h, V: V, v: v, C: C$8, c: c, S: S$1, s: s, Q: Q$6, q: q, T: T, t: t, A: A, a: a, Z: Z$8, z: z, N: N$5, D: D$6, X: X$5, G: G$5, F: F$6, O: O$6, P: P$5, U: U$5} = PathCommandMap;
2798
- const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$4, arc: arc$3, ellipse: ellipse$6, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
2800
+ const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$4, arc: arc$3, ellipse: ellipse$5, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
2799
2801
  const {ellipticalArc: ellipticalArc} = EllipseHelper;
2800
2802
  const debug$f = Debug.get("PathConvert");
2801
2803
  const setEndPoint$1 = {};
@@ -3027,14 +3029,14 @@ var LeaferUI = function(exports) {
3027
3029
  break;
3028
3030
 
3029
3031
  case G$5:
3030
- ellipse$6(curveMode ? data : copyData(data, old, i, 9), old[i + 1], old[i + 2], old[i + 3], old[i + 4], old[i + 5], old[i + 6], old[i + 7], old[i + 8], null, setEndPoint$1);
3032
+ ellipse$5(curveMode ? data : copyData(data, old, i, 9), old[i + 1], old[i + 2], old[i + 3], old[i + 4], old[i + 5], old[i + 6], old[i + 7], old[i + 8], null, setEndPoint$1);
3031
3033
  x = setEndPoint$1.x;
3032
3034
  y = setEndPoint$1.y;
3033
3035
  i += 9;
3034
3036
  break;
3035
3037
 
3036
3038
  case F$6:
3037
- curveMode ? ellipse$6(data, old[i + 1], old[i + 2], old[i + 3], old[i + 4], 0, 0, 360, false) : copyData(data, old, i, 5);
3039
+ curveMode ? ellipse$5(data, old[i + 1], old[i + 2], old[i + 3], old[i + 4], 0, 0, 360, false) : copyData(data, old, i, 5);
3038
3040
  x = old[i + 1] + old[i + 3];
3039
3041
  y = old[i + 2];
3040
3042
  i += 5;
@@ -3182,7 +3184,7 @@ var LeaferUI = function(exports) {
3182
3184
  drawEllipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
3183
3185
  BezierHelper.ellipse(null, x, y, radiusX, radiusY, isNull(rotation) ? 0 : rotation, isNull(startAngle) ? 0 : startAngle, isNull(endAngle) ? 360 : endAngle, anticlockwise, null, null, startPoint);
3184
3186
  data.push(M$9, startPoint.x, startPoint.y);
3185
- ellipse$5(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
3187
+ ellipse$4(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
3186
3188
  },
3187
3189
  drawArc(data, x, y, radius, startAngle, endAngle, anticlockwise) {
3188
3190
  BezierHelper.arc(null, x, y, radius, isNull(startAngle) ? 0 : startAngle, isNull(endAngle) ? 360 : endAngle, anticlockwise, null, null, startPoint);
@@ -3193,8 +3195,8 @@ var LeaferUI = function(exports) {
3193
3195
  BezierHelper.points(data, points, curve, close);
3194
3196
  }
3195
3197
  };
3196
- const {ellipse: ellipse$5, arc: arc$2} = PathCommandDataHelper;
3197
- const {moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo: quadraticCurveTo, bezierCurveTo: bezierCurveTo, closePath: closePath$3, beginPath: beginPath, rect: rect$2, roundRect: roundRect$1, ellipse: ellipse$4, arc: arc$1, arcTo: arcTo$3, drawEllipse: drawEllipse, drawArc: drawArc, drawPoints: drawPoints$2} = PathCommandDataHelper;
3198
+ const {ellipse: ellipse$4, arc: arc$2} = PathCommandDataHelper;
3199
+ const {moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo: quadraticCurveTo, bezierCurveTo: bezierCurveTo, closePath: closePath$3, beginPath: beginPath, rect: rect$2, roundRect: roundRect$1, ellipse: ellipse$3, arc: arc$1, arcTo: arcTo$3, drawEllipse: drawEllipse, drawArc: drawArc, drawPoints: drawPoints$2} = PathCommandDataHelper;
3198
3200
  class PathCreator {
3199
3201
  set path(value) {
3200
3202
  this.__path = value;
@@ -3250,7 +3252,7 @@ var LeaferUI = function(exports) {
3250
3252
  return this;
3251
3253
  }
3252
3254
  ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
3253
- ellipse$4(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
3255
+ ellipse$3(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
3254
3256
  this.paint();
3255
3257
  return this;
3256
3258
  }
@@ -3367,7 +3369,7 @@ var LeaferUI = function(exports) {
3367
3369
  }
3368
3370
  };
3369
3371
  const {M: M$7, L: L$7, C: C$5, Q: Q$3, Z: Z$5, N: N$2, D: D$3, X: X$2, G: G$2, F: F$3, O: O$3, P: P$2, U: U$2} = PathCommandMap;
3370
- const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$2, arc: arc, ellipse: ellipse$3} = BezierHelper;
3372
+ const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$2, arc: arc, ellipse: ellipse$2} = BezierHelper;
3371
3373
  const {addPointBounds: addPointBounds, copy: copy$9, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
3372
3374
  const debug$d = Debug.get("PathBounds");
3373
3375
  let radius, radiusX, radiusY;
@@ -3443,7 +3445,7 @@ var LeaferUI = function(exports) {
3443
3445
  break;
3444
3446
 
3445
3447
  case G$2:
3446
- ellipse$3(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], data[i + 7], data[i + 8], tempPointBounds, setEndPoint);
3448
+ ellipse$2(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], data[i + 7], data[i + 8], tempPointBounds, setEndPoint);
3447
3449
  i === 0 ? copy$9(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3448
3450
  x = setEndPoint.x;
3449
3451
  y = setEndPoint.y;
@@ -3497,7 +3499,7 @@ var LeaferUI = function(exports) {
3497
3499
  const {arcTo: arcTo$1} = PathCommandDataHelper;
3498
3500
  const PathCorner = {
3499
3501
  smooth(data, cornerRadius, _cornerSmoothing) {
3500
- let command, lastCommand, commandLen;
3502
+ let command, lastCommand, commandLen, startXIndex, startYIndex, smoothLen;
3501
3503
  let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
3502
3504
  if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
3503
3505
  const len = data.length, three = len === 9;
@@ -3506,6 +3508,11 @@ var LeaferUI = function(exports) {
3506
3508
  command = data[i];
3507
3509
  switch (command) {
3508
3510
  case M$6:
3511
+ smoothLen = smooth.length;
3512
+ if (smoothLen && lastCommand !== Z$4) {
3513
+ smooth[startXIndex] = startX;
3514
+ smooth[startYIndex] = startY;
3515
+ }
3509
3516
  startX = lastX = data[i + 1];
3510
3517
  startY = lastY = data[i + 2];
3511
3518
  i += 3;
@@ -3516,6 +3523,8 @@ var LeaferUI = function(exports) {
3516
3523
  } else {
3517
3524
  smooth.push(M$6, startX, startY);
3518
3525
  }
3526
+ startXIndex = smoothLen + 1;
3527
+ startYIndex = smoothLen + 2;
3519
3528
  break;
3520
3529
 
3521
3530
  case L$6:
@@ -3554,8 +3563,8 @@ var LeaferUI = function(exports) {
3554
3563
  lastCommand = command;
3555
3564
  }
3556
3565
  if (command !== Z$4) {
3557
- smooth[1] = startX;
3558
- smooth[2] = startY;
3566
+ smooth[startXIndex] = startX;
3567
+ smooth[startYIndex] = startY;
3559
3568
  }
3560
3569
  return smooth;
3561
3570
  }
@@ -5207,6 +5216,7 @@ var LeaferUI = function(exports) {
5207
5216
  this.renderChanged = true;
5208
5217
  this.renderSpread || (this.renderSpread = 1);
5209
5218
  this.boundsChanged = true;
5219
+ this.hitCanvasChanged = true;
5210
5220
  }
5211
5221
  scaleChange() {
5212
5222
  this.scaleChanged = true;
@@ -6053,10 +6063,6 @@ var LeaferUI = function(exports) {
6053
6063
  }
6054
6064
  }
6055
6065
  }
6056
- set(_data, _isTemp) {}
6057
- get(_name) {
6058
- return undefined;
6059
- }
6060
6066
  setAttr(name, value) {
6061
6067
  this[name] = value;
6062
6068
  }
@@ -6073,37 +6079,10 @@ var LeaferUI = function(exports) {
6073
6079
  toString(options) {
6074
6080
  return JSON.stringify(this.toJSON(options));
6075
6081
  }
6076
- toSVG() {
6077
- return undefined;
6078
- }
6079
- __SVG(_data) {}
6080
- toHTML() {
6081
- return undefined;
6082
- }
6083
- __setAttr(_attrName, _newValue) {
6084
- return true;
6085
- }
6086
- __getAttr(_attrName) {
6087
- return undefined;
6088
- }
6089
- setProxyAttr(_attrName, _newValue) {}
6090
- getProxyAttr(_attrName) {
6091
- return undefined;
6092
- }
6093
- find(_condition, _options) {
6094
- return undefined;
6095
- }
6096
- findTag(_tag) {
6097
- return undefined;
6098
- }
6099
- findOne(_condition, _options) {
6100
- return undefined;
6101
- }
6102
- findId(_id) {
6103
- return undefined;
6082
+ scaleResize(scaleX, scaleY = scaleX, _noResize, _boundsType) {
6083
+ this.scaleX *= scaleX;
6084
+ this.scaleY *= scaleY;
6104
6085
  }
6105
- focus(_value) {}
6106
- updateState() {}
6107
6086
  updateLayout() {
6108
6087
  this.__layout.update();
6109
6088
  }
@@ -6119,27 +6098,6 @@ var LeaferUI = function(exports) {
6119
6098
  __extraUpdate() {
6120
6099
  if (this.leaferIsReady) this.leafer.layouter.addExtra(this);
6121
6100
  }
6122
- __updateWorldMatrix() {}
6123
- __updateLocalMatrix() {}
6124
- __updateWorldBounds() {}
6125
- __updateLocalBounds() {}
6126
- __updateLocalBoxBounds() {}
6127
- __updateLocalStrokeBounds() {}
6128
- __updateLocalRenderBounds() {}
6129
- __updateBoxBounds(_secondLayout, _bounds) {}
6130
- __updateContentBounds() {}
6131
- __updateStrokeBounds(_bounds) {}
6132
- __updateRenderBounds(_bounds) {}
6133
- __updateAutoLayout() {}
6134
- __updateFlowLayout() {}
6135
- __updateNaturalSize() {}
6136
- __updateStrokeSpread() {
6137
- return 0;
6138
- }
6139
- __updateRenderSpread() {
6140
- return 0;
6141
- }
6142
- __onUpdateSize() {}
6143
6101
  __updateEraser(value) {
6144
6102
  this.__hasEraser = value ? true : this.children.some(item => item.__.eraser);
6145
6103
  }
@@ -6153,7 +6111,6 @@ var LeaferUI = function(exports) {
6153
6111
  __updateMask(_value) {
6154
6112
  this.__hasMask = this.children.some(item => item.__.mask && item.__.visible && item.__.opacity);
6155
6113
  }
6156
- __renderMask(_canvas, _options) {}
6157
6114
  __getNowWorld(options) {
6158
6115
  if (options.matrix) {
6159
6116
  if (!this.__cameraWorld) this.__cameraWorld = {};
@@ -6309,76 +6266,12 @@ var LeaferUI = function(exports) {
6309
6266
  flip(axis, transition) {
6310
6267
  transform(this, getFlipTransform(this, axis), false, transition);
6311
6268
  }
6312
- scaleResize(scaleX, scaleY = scaleX, _noResize, _boundsType) {
6313
- this.scaleX *= scaleX;
6314
- this.scaleY *= scaleY;
6315
- }
6316
- __scaleResize(_scaleX, _scaleY) {}
6317
- resizeWidth(_width) {}
6318
- resizeHeight(_height) {}
6319
- hit(_world, _hitRadius) {
6320
- return true;
6321
- }
6322
- __hitWorld(_point, _forceHitFill) {
6323
- return true;
6324
- }
6325
- __hit(_local, _forceHitFill) {
6326
- return true;
6327
- }
6328
- __hitFill(_inner) {
6329
- return true;
6330
- }
6331
- __hitStroke(_inner, _strokeWidth) {
6332
- return true;
6333
- }
6334
- __hitPixel(_inner) {
6335
- return true;
6336
- }
6337
- __drawHitPath(_canvas) {}
6338
- __updateHitCanvas() {}
6339
- __render(_canvas, _options) {}
6340
- __drawFast(_canvas, _options) {}
6341
- __draw(_canvas, _options, _originCanvas) {}
6342
- __clip(_canvas, _options) {}
6343
- __renderShape(_canvas, _options) {}
6344
- __drawShape(_canvas, _options) {}
6345
- __updateWorldOpacity() {}
6346
- __updateChange() {}
6347
- __drawPath(_canvas) {}
6348
- __drawRenderPath(_canvas) {}
6349
- __updatePath() {}
6350
- __updateRenderPath(_updateCache) {}
6351
- getMotionPathData() {
6352
- return Plugin.need("path");
6353
- }
6354
- getMotionPoint(_motionDistance) {
6355
- return Plugin.need("path");
6356
- }
6357
- getMotionTotal() {
6358
- return 0;
6359
- }
6360
- __updateMotionPath() {}
6361
- __runAnimation(_type, _complete) {}
6362
- __updateSortChildren() {}
6363
- add(_child, _index) {}
6364
6269
  remove(_child, destroy) {
6365
6270
  if (this.parent) this.parent.remove(this, destroy);
6366
6271
  }
6367
6272
  dropTo(parent, index, resize) {
6368
6273
  drop(this, parent, index, resize);
6369
6274
  }
6370
- on(_type, _listener, _options) {}
6371
- off(_type, _listener, _options) {}
6372
- on_(_type, _listener, _bind, _options) {
6373
- return undefined;
6374
- }
6375
- off_(_id) {}
6376
- once(_type, _listener, _captureOrBind, _capture) {}
6377
- emit(_type, _event, _capture) {}
6378
- emitEvent(_event, _capture) {}
6379
- hasEvent(_type, _capture) {
6380
- return false;
6381
- }
6382
6275
  static changeAttr(attrName, defaultValue, fn) {
6383
6276
  fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue);
6384
6277
  }
@@ -6674,7 +6567,7 @@ var LeaferUI = function(exports) {
6674
6567
  this.levelMap = null;
6675
6568
  }
6676
6569
  }
6677
- const version = "2.1.4";
6570
+ const version = "2.1.6";
6678
6571
  class LeaferCanvas extends LeaferCanvasBase {
6679
6572
  get allowBackgroundColor() {
6680
6573
  return true;
@@ -8080,17 +7973,12 @@ var LeaferUI = function(exports) {
8080
7973
  if (!path) this.__drawPathByBox(pen);
8081
7974
  return pen;
8082
7975
  }
8083
- reset(_data) {}
8084
7976
  set(data, _transition) {
8085
7977
  if (data) Object.assign(this, data);
8086
7978
  }
8087
7979
  get(name) {
8088
7980
  return isString(name) ? this.__.__getInput(name) : this.__.__getInputData(name);
8089
7981
  }
8090
- createProxyData() {
8091
- return undefined;
8092
- }
8093
- clearProxyData() {}
8094
7982
  find(_condition, _options) {
8095
7983
  return Plugin.need("find");
8096
7984
  }
@@ -8128,6 +8016,7 @@ var LeaferUI = function(exports) {
8128
8016
  data.lazy && !this.__inLazyBounds && !Export.running ? data.__needComputePaint = true : data.__computePaint();
8129
8017
  }
8130
8018
  }
8019
+ __updatePath() {}
8131
8020
  __updateRenderPath(updateCache) {
8132
8021
  const data = this.__;
8133
8022
  if (data.path) {
@@ -8163,7 +8052,6 @@ var LeaferUI = function(exports) {
8163
8052
  this.set(keyframe);
8164
8053
  return Plugin.need("animate");
8165
8054
  }
8166
- killAnimate(_type, _nextStyle) {}
8167
8055
  export(_filename, _options) {
8168
8056
  return Plugin.need("export");
8169
8057
  }
@@ -8266,7 +8154,6 @@ var LeaferUI = function(exports) {
8266
8154
  __decorate([ surfaceType() ], exports.UI.prototype, "placeholderColor", void 0);
8267
8155
  __decorate([ dataType(100) ], exports.UI.prototype, "placeholderDelay", void 0);
8268
8156
  __decorate([ dataType({}) ], exports.UI.prototype, "data", void 0);
8269
- __decorate([ rewrite(exports.Leaf.prototype.reset) ], exports.UI.prototype, "reset", null);
8270
8157
  exports.UI = UI_1 = __decorate([ useModule(UIBounds), useModule(UIRender), rewriteAble() ], exports.UI);
8271
8158
  exports.Group = class Group extends exports.UI {
8272
8159
  get __tag() {
@@ -8302,9 +8189,6 @@ var LeaferUI = function(exports) {
8302
8189
  }
8303
8190
  return data;
8304
8191
  }
8305
- pick(_hitPoint, _options) {
8306
- return undefined;
8307
- }
8308
8192
  addAt(child, index) {
8309
8193
  this.add(child, index);
8310
8194
  }
@@ -8314,11 +8198,6 @@ var LeaferUI = function(exports) {
8314
8198
  addBefore(child, before) {
8315
8199
  this.add(child, this.children.indexOf(before));
8316
8200
  }
8317
- add(_child, _index) {}
8318
- addMany(..._children) {}
8319
- remove(_child, _destroy) {}
8320
- removeAll(_destroy) {}
8321
- clear() {}
8322
8201
  };
8323
8202
  __decorate([ dataProcessor(GroupData) ], exports.Group.prototype, "__", void 0);
8324
8203
  __decorate([ boundsType(0) ], exports.Group.prototype, "width", void 0);
@@ -8820,7 +8699,7 @@ var LeaferUI = function(exports) {
8820
8699
  __decorate([ surfaceType("#FFFFFF") ], exports.Frame.prototype, "fill", void 0);
8821
8700
  __decorate([ affectRenderBoundsType("hide") ], exports.Frame.prototype, "overflow", void 0);
8822
8701
  exports.Frame = __decorate([ registerUI() ], exports.Frame);
8823
- const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse$2} = PathCommandDataHelper;
8702
+ const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse$1} = PathCommandDataHelper;
8824
8703
  exports.Ellipse = class Ellipse extends exports.UI {
8825
8704
  get __tag() {
8826
8705
  return "Ellipse";
@@ -8832,21 +8711,21 @@ var LeaferUI = function(exports) {
8832
8711
  let open;
8833
8712
  if (innerRadius) {
8834
8713
  if (startAngle || endAngle) {
8835
- if (innerRadius < 1) ellipse$2(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false); else open = true;
8836
- ellipse$2(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
8714
+ if (innerRadius < 1) ellipse$1(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false); else open = true;
8715
+ ellipse$1(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
8837
8716
  } else {
8838
8717
  if (innerRadius < 1) {
8839
- ellipse$2(path, rx, ry, rx * innerRadius, ry * innerRadius);
8718
+ ellipse$1(path, rx, ry, rx * innerRadius, ry * innerRadius);
8840
8719
  moveTo$3(path, width, ry);
8841
8720
  }
8842
- ellipse$2(path, rx, ry, rx, ry, 0, 360, 0, true);
8721
+ ellipse$1(path, rx, ry, rx, ry, 0, 360, 0, true);
8843
8722
  }
8844
8723
  } else {
8845
8724
  if (startAngle || endAngle) {
8846
8725
  moveTo$3(path, rx, ry);
8847
- ellipse$2(path, rx, ry, rx, ry, 0, startAngle, endAngle, false);
8726
+ ellipse$1(path, rx, ry, rx, ry, 0, startAngle, endAngle, false);
8848
8727
  } else {
8849
- ellipse$2(path, rx, ry, rx, ry);
8728
+ ellipse$1(path, rx, ry, rx, ry);
8850
8729
  }
8851
8730
  }
8852
8731
  if (!open) closePath$2(path);
@@ -9172,51 +9051,6 @@ var LeaferUI = function(exports) {
9172
9051
  this.add(path);
9173
9052
  return this;
9174
9053
  }
9175
- beginPath() {
9176
- return this;
9177
- }
9178
- moveTo(_x, _y) {
9179
- return this;
9180
- }
9181
- lineTo(_x, _y) {
9182
- return this;
9183
- }
9184
- bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) {
9185
- return this;
9186
- }
9187
- quadraticCurveTo(_x1, _y1, _x, _y) {
9188
- return this;
9189
- }
9190
- closePath() {
9191
- return this;
9192
- }
9193
- rect(_x, _y, _width, _height) {
9194
- return this;
9195
- }
9196
- roundRect(_x, _y, _width, _height, _cornerRadius) {
9197
- return this;
9198
- }
9199
- ellipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) {
9200
- return this;
9201
- }
9202
- arc(_x, _y, _radius, _startAngle, _endAngle, _anticlockwise) {
9203
- return this;
9204
- }
9205
- arcTo(_x1, _y1, _x2, _y2, _radius) {
9206
- return this;
9207
- }
9208
- drawEllipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) {
9209
- return this;
9210
- }
9211
- drawArc(_x, _y, _radius, _startAngle, _endAngle, _anticlockwise) {
9212
- return this;
9213
- }
9214
- drawPoints(_points, _curve, _close) {
9215
- return this;
9216
- }
9217
- clearPath() {
9218
- return this;
9219
- }
9220
9054
  paint() {
9221
9055
  const {pathElement: pathElement} = this;
9222
9056
  if (!pathElement.__layout.boxChanged) pathElement.forceUpdate("path");
@@ -11042,7 +10876,7 @@ var LeaferUI = function(exports) {
11042
10876
  needUpdate = false;
11043
10877
  }
11044
10878
  }
11045
- if (paint.mode === "brush") PaintImage.brush(leafPaint, ui);
10879
+ if (paint.mode === "brush") PaintImage.brush(leafPaint, ui, attrName);
11046
10880
  if (!leafPaint.data) {
11047
10881
  PaintImage.createData(leafPaint, image, paint, boxBounds);
11048
10882
  const {transform: transform} = leafPaint.data, {opacity: opacity} = paint;
@@ -11126,8 +10960,9 @@ var LeaferUI = function(exports) {
11126
10960
  break;
11127
10961
 
11128
10962
  case "repeat":
11129
- case "brush":
11130
10963
  if (!sameBox || scaleX || rotation || skew) PaintImage.repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, align, paint.freeTransform);
10964
+
10965
+ case "brush":
11131
10966
  if (!repeat) data.repeat = "repeat";
11132
10967
  const count = isObject(repeat);
11133
10968
  if (gap || count) data.gap = getGapData(gap, count && repeat, tempImage.width, tempImage.height, box);
@@ -11138,7 +10973,7 @@ var LeaferUI = function(exports) {
11138
10973
  default:
11139
10974
  if (scaleX) PaintImage.fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
11140
10975
  }
11141
- if (!data.transform) {
10976
+ if (!data.transform && mode !== "brush") {
11142
10977
  if (box.x || box.y) translate$1(data.transform = get$3(), box.x, box.y);
11143
10978
  }
11144
10979
  if (scaleX) {
@@ -11254,8 +11089,9 @@ var LeaferUI = function(exports) {
11254
11089
  let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
11255
11090
  if (paint.patternId !== id && !ui.destroyed) {
11256
11091
  if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
11257
- const {image: image, brush: brush, data: data} = paint, {opacity: opacity} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
11258
- let imageMatrix, xGap, yGap, {width: width, height: height} = image;
11092
+ const {image: image, brush: brush, data: data} = paint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
11093
+ let imageMatrix, xGap, yGap, {width: width, height: height} = image, {opacity: opacity} = paint.originPaint;
11094
+ if (brush || opacity === 1) opacity = undefined;
11259
11095
  if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
11260
11096
  width *= scaleX;
11261
11097
  height *= scaleY;
@@ -14856,7 +14692,8 @@ var LeaferUI = function(exports) {
14856
14692
  exports.UI.addAttr("editConfig", undefined, dataType);
14857
14693
  exports.UI.addAttr("editOuter", ui => {
14858
14694
  ui.updateLayout();
14859
- return ui.__.__isLinePath ? "LineEditTool" : "EditTool";
14695
+ const name = (ui.tag === "Line" ? "" : ui.tag) + "EditTool";
14696
+ return ui.__.__isLinePath ? "LineEditTool" : EditToolCreator.list[name] ? name : "EditTool";
14860
14697
  }, dataType);
14861
14698
  exports.UI.addAttr("editInner", "PathEditor", dataType);
14862
14699
  exports.Group.addAttr("editInner", "", dataType);
@@ -15126,8 +14963,9 @@ var LeaferUI = function(exports) {
15126
14963
  addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);
15127
14964
  if (leafer.isApp || custom) return;
15128
14965
  leafer.__eventIds.push(leafer.on_(exports.MoveEvent.BEFORE_MOVE, e => {
15129
- const move = leafer.getValidMove(e.moveX, e.moveY, false);
15130
- if (getScrollType(leafer).includes("limit")) {
14966
+ const limit = getScrollType(leafer).includes("limit"), stopLimit = leafer.app.config.move.scrollLimit === "stop";
14967
+ const move = leafer.getValidMove(e.moveX, e.moveY, limit && stopLimit);
14968
+ if (limit && !stopLimit) {
15131
14969
  const testMove = leafer.getValidMove(0, 0);
15132
14970
  if (testMove.x || testMove.y) {
15133
14971
  const maxX = 100, maxY = 200, resistance = e.moveType === "drag" ? .3 : .05;
@@ -19365,7 +19203,7 @@ var LeaferUI = function(exports) {
19365
19203
  Plugin.add("scale-fixed");
19366
19204
  exports.UI.addAttr("scaleFixed", undefined, scaleFixedType);
19367
19205
  class EllipseBoxData extends BoxData {}
19368
- const ellipse$1 = exports.Ellipse.prototype;
19206
+ const ellipse = exports.Ellipse.prototype;
19369
19207
  exports.EllipseBox = class EllipseBox extends exports.Box {
19370
19208
  get __tag() {
19371
19209
  return "EllipseBox";
@@ -19376,7 +19214,7 @@ var LeaferUI = function(exports) {
19376
19214
  __decorate([ pathType(0) ], exports.EllipseBox.prototype, "innerRadius", void 0);
19377
19215
  __decorate([ pathType(0) ], exports.EllipseBox.prototype, "startAngle", void 0);
19378
19216
  __decorate([ pathType(0) ], exports.EllipseBox.prototype, "endAngle", void 0);
19379
- __decorate([ rewrite(ellipse$1.__updatePath) ], exports.EllipseBox.prototype, "__updatePath", null);
19217
+ __decorate([ rewrite(ellipse.__updatePath) ], exports.EllipseBox.prototype, "__updatePath", null);
19380
19218
  exports.EllipseBox = __decorate([ rewriteAble(), registerUI() ], exports.EllipseBox);
19381
19219
  class PolygonBoxData extends BoxData {
19382
19220
  get __usePathBox() {
@@ -19397,7 +19235,7 @@ var LeaferUI = function(exports) {
19397
19235
  __decorate([ rewrite(polygon.__updatePath) ], exports.PolygonBox.prototype, "__updatePath", null);
19398
19236
  exports.PolygonBox = __decorate([ rewriteAble(), registerUI() ], exports.PolygonBox);
19399
19237
  class StarBoxData extends BoxData {}
19400
- const ellipse = exports.Star.prototype;
19238
+ const star = exports.Star.prototype;
19401
19239
  exports.StarBox = class StarBox extends exports.Box {
19402
19240
  get __tag() {
19403
19241
  return "StarBox";
@@ -19407,7 +19245,7 @@ var LeaferUI = function(exports) {
19407
19245
  __decorate([ pathType(5) ], exports.StarBox.prototype, "corners", void 0);
19408
19246
  __decorate([ pathType(.382) ], exports.StarBox.prototype, "innerRadius", void 0);
19409
19247
  __decorate([ dataProcessor(StarBoxData) ], exports.StarBox.prototype, "__", void 0);
19410
- __decorate([ rewrite(ellipse.__updatePath) ], exports.StarBox.prototype, "__updatePath", null);
19248
+ __decorate([ rewrite(star.__updatePath) ], exports.StarBox.prototype, "__updatePath", null);
19411
19249
  exports.StarBox = __decorate([ rewriteAble(), registerUI() ], exports.StarBox);
19412
19250
  class PathBoxData extends BoxData {}
19413
19251
  exports.PathBox = class PathBox extends exports.Box {
@@ -1 +1 @@
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"}
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 pressure?: number // 压感\n}\nexport interface LineToCommandObject {\n name: 'L'\n x: number\n y: number\n pressure?: 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 pressure?: number\n}\n\nexport interface QuadraticCurveToCommandObject {\n name: 'Q'\n x1: number\n y1: number\n x: number\n y: number\n pressure?: 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 pressure?: number // 压感\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":"iBA6IYA,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"}