@leafer/worker 1.11.2 → 1.12.0

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'\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}\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":"klBA6HYA,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'\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":"klBA4HYA,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
@@ -3818,16 +3818,27 @@ var LeaferUI = function(exports) {
3818
3818
  recycle(image) {
3819
3819
  image.use--;
3820
3820
  setTimeout(() => {
3821
- if (!image.use) I$1.recycledList.push(image);
3821
+ if (!image.use) {
3822
+ if (Platform.image.isLarge(image)) {
3823
+ if (image.url) Resource.remove(image.url);
3824
+ } else {
3825
+ image.clearLevels();
3826
+ I$1.recycledList.push(image);
3827
+ }
3828
+ }
3822
3829
  });
3823
3830
  },
3824
- clearRecycled() {
3831
+ recyclePaint(paint) {
3832
+ I$1.recycle(paint.image);
3833
+ },
3834
+ clearRecycled(force) {
3825
3835
  const list = I$1.recycledList;
3826
- if (list.length > I$1.maxRecycled) {
3827
- list.forEach(image => !image.use && image.url && Resource.remove(image.url));
3836
+ if (list.length > I$1.maxRecycled || force) {
3837
+ list.forEach(image => (!image.use || force) && image.url && Resource.remove(image.url));
3828
3838
  list.length = 0;
3829
3839
  }
3830
3840
  },
3841
+ clearLevels() {},
3831
3842
  hasAlphaPixel(config) {
3832
3843
  return FileHelper.alphaPixelTypes.some(item => I$1.isFormat(item, config));
3833
3844
  },
@@ -3842,7 +3853,7 @@ var LeaferUI = function(exports) {
3842
3853
  return false;
3843
3854
  },
3844
3855
  destroy() {
3845
- I$1.recycledList = [];
3856
+ this.clearRecycled(true);
3846
3857
  }
3847
3858
  };
3848
3859
  const I$1 = ImageManager;
@@ -3942,11 +3953,15 @@ var LeaferUI = function(exports) {
3942
3953
  Platform.image.setPatternTransform(pattern, transform, paint);
3943
3954
  return pattern;
3944
3955
  }
3956
+ clearLevels(_checkUse) {}
3945
3957
  destroy() {
3958
+ this.clearLevels();
3959
+ const {view: view} = this;
3960
+ if (view && view.close) view.close();
3946
3961
  this.config = {
3947
3962
  url: ""
3948
3963
  };
3949
- this.cache = null;
3964
+ this.cache = this.view = null;
3950
3965
  this.waitComplete.length = 0;
3951
3966
  }
3952
3967
  }
@@ -5576,6 +5591,7 @@ var LeaferUI = function(exports) {
5576
5591
  const LeafRender = {
5577
5592
  __render(canvas, options) {
5578
5593
  if (options.shape) return this.__renderShape(canvas, options);
5594
+ if (options.cellList && !options.cellList.has(this)) return;
5579
5595
  if (this.__worldOpacity) {
5580
5596
  const data = this.__;
5581
5597
  if (data.bright && !options.topRendering) return options.topList.add(this);
@@ -6454,7 +6470,7 @@ var LeaferUI = function(exports) {
6454
6470
  this.levelMap = null;
6455
6471
  }
6456
6472
  }
6457
- const version = "1.11.2";
6473
+ const version = "1.12.0";
6458
6474
  class LeaferCanvas extends LeaferCanvasBase {
6459
6475
  get allowBackgroundColor() {
6460
6476
  return true;
@@ -6556,7 +6572,7 @@ var LeaferUI = function(exports) {
6556
6572
  return this.hasAdd || this.hasRemove || this.hasVisible;
6557
6573
  }
6558
6574
  get updatedList() {
6559
- if (this.hasRemove) {
6575
+ if (this.hasRemove && this.config.usePartLayout) {
6560
6576
  const updatedList = new LeafList;
6561
6577
  this.__updatedList.list.forEach(item => {
6562
6578
  if (item.leafer) updatedList.add(item);
@@ -6591,16 +6607,18 @@ var LeaferUI = function(exports) {
6591
6607
  if (this.running) this.target.emit(RenderEvent.REQUEST);
6592
6608
  }
6593
6609
  __onAttrChange(event) {
6594
- this.__updatedList.add(event.target);
6610
+ if (this.config.usePartLayout) this.__updatedList.add(event.target);
6595
6611
  this.update();
6596
6612
  }
6597
6613
  __onChildEvent(event) {
6598
- if (event.type === ChildEvent.ADD) {
6599
- this.hasAdd = true;
6600
- this.__pushChild(event.child);
6601
- } else {
6602
- this.hasRemove = true;
6603
- this.__updatedList.add(event.parent);
6614
+ if (this.config.usePartLayout) {
6615
+ if (event.type === ChildEvent.ADD) {
6616
+ this.hasAdd = true;
6617
+ this.__pushChild(event.child);
6618
+ } else {
6619
+ this.hasRemove = true;
6620
+ this.__updatedList.add(event.parent);
6621
+ }
6604
6622
  }
6605
6623
  this.update();
6606
6624
  }
@@ -6707,7 +6725,9 @@ var LeaferUI = function(exports) {
6707
6725
  class Layouter {
6708
6726
  constructor(target, userConfig) {
6709
6727
  this.totalTimes = 0;
6710
- this.config = {};
6728
+ this.config = {
6729
+ usePartLayout: true
6730
+ };
6711
6731
  this.__levelList = new LeafLevelList;
6712
6732
  this.target = target;
6713
6733
  if (userConfig) this.config = DataHelper.default(userConfig, this.config);
@@ -6752,7 +6772,7 @@ var LeaferUI = function(exports) {
6752
6772
  this.totalTimes++;
6753
6773
  this.layouting = true;
6754
6774
  this.target.emit(WatchEvent.REQUEST);
6755
- if (this.totalTimes > 1) {
6775
+ if (this.totalTimes > 1 && this.config.usePartLayout) {
6756
6776
  this.partLayout();
6757
6777
  } else {
6758
6778
  this.fullLayout();
@@ -6867,7 +6887,7 @@ var LeaferUI = function(exports) {
6867
6887
  }
6868
6888
  update(change = true) {
6869
6889
  if (!this.changed) this.changed = change;
6870
- this.__requestRender();
6890
+ if (!this.requestTime) this.__requestRender();
6871
6891
  }
6872
6892
  requestLayout() {
6873
6893
  this.target.emit(LayoutEvent.REQUEST);
@@ -6974,7 +6994,7 @@ var LeaferUI = function(exports) {
6974
6994
  Run.end(t);
6975
6995
  }
6976
6996
  __render(bounds, realBounds) {
6977
- const {canvas: canvas} = this, includes = bounds.includes(this.target.__world), options = includes ? {
6997
+ const {canvas: canvas, target: target} = this, includes = bounds.includes(target.__world), options = includes ? {
6978
6998
  includes: includes
6979
6999
  } : {
6980
7000
  bounds: bounds,
@@ -6982,12 +7002,16 @@ var LeaferUI = function(exports) {
6982
7002
  };
6983
7003
  if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
6984
7004
  if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
6985
- Platform.render(this.target, canvas, options);
7005
+ if (this.config.useCellRender) options.cellList = this.getCellList();
7006
+ Platform.render(target, canvas, options);
6986
7007
  this.renderBounds = realBounds = realBounds || bounds;
6987
7008
  this.renderOptions = options;
6988
7009
  this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
6989
7010
  canvas.updateRender(realBounds);
6990
7011
  }
7012
+ getCellList() {
7013
+ return undefined;
7014
+ }
6991
7015
  addBlock(block) {
6992
7016
  if (!this.updateBlocks) this.updateBlocks = [];
6993
7017
  this.updateBlocks.push(block);
@@ -7601,6 +7625,11 @@ var LeaferUI = function(exports) {
7601
7625
  }
7602
7626
  this._boxStyle = value;
7603
7627
  }
7628
+ __getInputData(names, options) {
7629
+ const data = super.__getInputData(names, options);
7630
+ if (data.textEditing) delete data.textEditing;
7631
+ return data;
7632
+ }
7604
7633
  }
7605
7634
  class ImageData extends RectData {
7606
7635
  setUrl(value) {
@@ -10589,6 +10618,7 @@ var LeaferUI = function(exports) {
10589
10618
  const {boxBounds: boxBounds} = ui.__layout;
10590
10619
  switch (paint.type) {
10591
10620
  case "image":
10621
+ if (!paint.url) return undefined;
10592
10622
  leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
10593
10623
  break;
10594
10624
 
@@ -10903,7 +10933,7 @@ var LeaferUI = function(exports) {
10903
10933
  if (scaleX) scaleHelper(transform, scaleX, scaleY);
10904
10934
  translate(transform, box.x + x, box.y + y);
10905
10935
  }
10906
- const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
10936
+ const {get: get$1, scale: scale$1, copy: copy$4} = MatrixHelper;
10907
10937
  const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$6} = Math;
10908
10938
  function createPatternTask(paint, ui, canvas, renderOptions) {
10909
10939
  if (!paint.patternTask) {
@@ -10932,7 +10962,7 @@ var LeaferUI = function(exports) {
10932
10962
  scaleY *= getFloorScale(height + (yGap || 0));
10933
10963
  imageMatrix = get$1();
10934
10964
  if (transform) copy$4(imageMatrix, transform);
10935
- scale$2(imageMatrix, 1 / scaleX, 1 / scaleY);
10965
+ scale$1(imageMatrix, 1 / scaleX, 1 / scaleY);
10936
10966
  }
10937
10967
  const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
10938
10968
  const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
@@ -10962,7 +10992,7 @@ var LeaferUI = function(exports) {
10962
10992
  if (data.repeat) {
10963
10993
  drawImage = false;
10964
10994
  } else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
10965
- drawImage = Platform.image.isLarge(image, scaleX, scaleY);
10995
+ drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
10966
10996
  }
10967
10997
  }
10968
10998
  if (drawImage) {
@@ -11018,7 +11048,7 @@ var LeaferUI = function(exports) {
11018
11048
  if (url) {
11019
11049
  if (!recycleMap) recycleMap = {};
11020
11050
  recycleMap[url] = true;
11021
- ImageManager.recycle(image);
11051
+ ImageManager.recyclePaint(paint);
11022
11052
  if (image.loading) {
11023
11053
  if (!input) {
11024
11054
  input = data.__input && data.__input[attrName] || [];
@@ -11925,7 +11955,7 @@ var LeaferUI = function(exports) {
11925
11955
  };
11926
11956
  }
11927
11957
  const {abs: abs$4} = Math;
11928
- const {copy: copy$2, scale: scale$1} = MatrixHelper;
11958
+ const {copy: copy$2} = MatrixHelper;
11929
11959
  const {setListWithFn: setListWithFn} = BoundsHelper;
11930
11960
  const {worldBounds: worldBounds} = LeafBoundsHelper;
11931
11961
  const matrix$1 = getMatrixData();
@@ -11964,19 +11994,10 @@ var LeaferUI = function(exports) {
11964
11994
  const aScaleX = abs$4(worldTransform.scaleX), aScaleY = abs$4(worldTransform.scaleY);
11965
11995
  copy$2(matrix$1, worldTransform);
11966
11996
  matrix$1.half = strokeWidth % 2;
11967
- if (aScaleX !== aScaleY) {
11968
- scale$1(matrix$1, 1 / aScaleX, 1 / aScaleY);
11969
- canvas.setWorld(matrix$1, options.matrix);
11970
- canvas.beginPath();
11971
- data.strokeWidth = strokeWidth;
11972
- const {x: x, y: y, width: width, height: height} = leaf.__layout.boxBounds;
11973
- canvas.rect(x * aScaleX, y * aScaleY, width * aScaleX, height * aScaleY);
11974
- } else {
11975
- canvas.setWorld(matrix$1, options.matrix);
11976
- canvas.beginPath();
11977
- if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
11978
- data.strokeWidth = strokeWidth / abs$4(worldTransform.scaleX);
11979
- }
11997
+ canvas.setWorld(matrix$1, options.matrix);
11998
+ canvas.beginPath();
11999
+ if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
12000
+ data.strokeWidth = strokeWidth / Math.max(aScaleX, aScaleY);
11980
12001
  if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas, options) : Paint.strokes(stroke, this, canvas, options);
11981
12002
  if (fill) isString(fill) ? Paint.fill(fill, this, canvas, options) : Paint.fills(fill, this, canvas, options);
11982
12003
  }
@@ -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\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}\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":"iBA6HYA,glBAAAA,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'\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":"iBA4HYA,glBAAAA,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"}