@leafer-game/worker 2.1.3 → 2.1.5

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":"gMAwIYA,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":"gMA6IYA,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$4(t.x) === float$4(point.x) && float$4(t.y) === float$4(point.y);
870
870
  },
871
871
  reset(t) {
872
- P$5.reset(t);
872
+ t.x = t.y = 0;
873
873
  }
874
874
  };
875
875
  const P$5 = 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) {
@@ -2850,7 +2852,8 @@ var LeaferUI = function(exports) {
2850
2852
  current.length = PathCommandLengthMap[char];
2851
2853
  current.index = 0;
2852
2854
  pushData(data, current.name);
2853
- if (char === "m") current.name = PathCommandMap["l"]; else if (char === "M") current.name = PathCommandMap["L"]; else if (!needConvert && convertCommand[char]) needConvert = true;
2855
+ if (char === "m") current.name = PathCommandMap["l"]; else if (char === "M") current.name = PathCommandMap["L"];
2856
+ if (!needConvert && convertCommand[char]) needConvert = true;
2854
2857
  } else {
2855
2858
  if (char === "-" || char === "+") {
2856
2859
  if (lastChar === "e" || lastChar === "E") {
@@ -2926,8 +2929,8 @@ var LeaferUI = function(exports) {
2926
2929
 
2927
2930
  case S:
2928
2931
  smooth = lastCommand === C$4 || lastCommand === S;
2929
- x1 = smooth ? x * 2 - controlX : old[i + 1];
2930
- y1 = smooth ? y * 2 - controlY : old[i + 2];
2932
+ x1 = smooth ? x * 2 - controlX : x;
2933
+ y1 = smooth ? y * 2 - controlY : y;
2931
2934
  controlX = old[i + 1];
2932
2935
  controlY = old[i + 2];
2933
2936
  x = old[i + 3];
@@ -2961,8 +2964,8 @@ var LeaferUI = function(exports) {
2961
2964
 
2962
2965
  case T:
2963
2966
  smooth = lastCommand === Q$3 || lastCommand === T;
2964
- controlX = smooth ? x * 2 - controlX : old[i + 1];
2965
- controlY = smooth ? y * 2 - controlY : old[i + 2];
2967
+ controlX = smooth ? x * 2 - controlX : x;
2968
+ controlY = smooth ? y * 2 - controlY : y;
2966
2969
  curveMode ? quadraticCurveTo$1(data, x, y, controlX, controlY, old[i + 1], old[i + 2]) : data.push(Q$3, controlX, controlY, old[i + 1], old[i + 2]);
2967
2970
  x = old[i + 1];
2968
2971
  y = old[i + 2];
@@ -4568,10 +4571,10 @@ var LeaferUI = function(exports) {
4568
4571
  y: y
4569
4572
  }, transition) : (t.x = x, t.y = y);
4570
4573
  },
4571
- zoomOfWorld(t, origin, scaleX, scaleY, resize, transition) {
4572
- L$1.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition);
4574
+ zoomOfWorld(t, origin, scaleX, scaleY, resize, transition, boundsType) {
4575
+ L$1.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition, boundsType);
4573
4576
  },
4574
- zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition) {
4577
+ zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition, boundsType) {
4575
4578
  const o = t.__localMatrix;
4576
4579
  if (!isNumber(scaleY)) {
4577
4580
  if (scaleY) transition = scaleY;
@@ -4580,7 +4583,7 @@ var LeaferUI = function(exports) {
4580
4583
  copy$5(matrix$1, o);
4581
4584
  scaleOfOuter$2(matrix$1, origin, scaleX, scaleY);
4582
4585
  if (L$1.hasHighPosition(t)) {
4583
- L$1.setTransform(t, matrix$1, resize, transition);
4586
+ L$1.setTransform(t, matrix$1, resize, transition, boundsType);
4584
4587
  } else {
4585
4588
  const x = t.x + matrix$1.e - o.e, y = t.y + matrix$1.f - o.f;
4586
4589
  if (transition && !resize) t.animate({
@@ -4588,7 +4591,7 @@ var LeaferUI = function(exports) {
4588
4591
  y: y,
4589
4592
  scaleX: t.scaleX * scaleX,
4590
4593
  scaleY: t.scaleY * scaleY
4591
- }, transition); else t.x = x, t.y = y, t.scaleResize(scaleX, scaleY, resize !== true);
4594
+ }, transition); else t.x = x, t.y = y, t.scaleResize(scaleX, scaleY, resize !== true, boundsType);
4592
4595
  }
4593
4596
  },
4594
4597
  rotateOfWorld(t, origin, angle, transition) {
@@ -4612,18 +4615,18 @@ var LeaferUI = function(exports) {
4612
4615
  skewOfOuter(matrix$1, origin, skewX, skewY);
4613
4616
  L$1.setTransform(t, matrix$1, resize, transition);
4614
4617
  },
4615
- transformWorld(t, transform, resize, transition) {
4618
+ transformWorld(t, transform, resize, transition, boundsType) {
4616
4619
  copy$5(matrix$1, t.worldTransform);
4617
4620
  multiplyParent$3(matrix$1, transform);
4618
4621
  if (t.parent) divideParent(matrix$1, t.parent.scrollWorldTransform);
4619
- L$1.setTransform(t, matrix$1, resize, transition);
4622
+ L$1.setTransform(t, matrix$1, resize, transition, boundsType);
4620
4623
  },
4621
- transform(t, transform, resize, transition) {
4624
+ transform(t, transform, resize, transition, boundsType) {
4622
4625
  copy$5(matrix$1, t.localTransform);
4623
4626
  multiplyParent$3(matrix$1, transform);
4624
- L$1.setTransform(t, matrix$1, resize, transition);
4627
+ L$1.setTransform(t, matrix$1, resize, transition, boundsType);
4625
4628
  },
4626
- setTransform(t, transform, resize, transition) {
4629
+ setTransform(t, transform, resize, transition, boundsType) {
4627
4630
  const data = t.__, originPoint = data.origin && L$1.getInnerOrigin(t, data.origin);
4628
4631
  const layout = getLayout(transform, originPoint, data.around && L$1.getInnerOrigin(t, data.around));
4629
4632
  if (L$1.hasOffset(t)) {
@@ -4639,7 +4642,7 @@ var LeaferUI = function(exports) {
4639
4642
  PointHelper.move(layout, originPoint.x - changedPoint.x, originPoint.y - changedPoint.y);
4640
4643
  }
4641
4644
  t.set(layout);
4642
- t.scaleResize(scaleX, scaleY, false);
4645
+ t.scaleResize(scaleX, scaleY, false, boundsType);
4643
4646
  } else t.set(layout, transition);
4644
4647
  },
4645
4648
  getFlipTransform(t, axis) {
@@ -5206,6 +5209,7 @@ var LeaferUI = function(exports) {
5206
5209
  this.renderChanged = true;
5207
5210
  this.renderSpread || (this.renderSpread = 1);
5208
5211
  this.boundsChanged = true;
5212
+ this.hitCanvasChanged = true;
5209
5213
  }
5210
5214
  scaleChange() {
5211
5215
  this.scaleChanged = true;
@@ -6052,10 +6056,6 @@ var LeaferUI = function(exports) {
6052
6056
  }
6053
6057
  }
6054
6058
  }
6055
- set(_data, _isTemp) {}
6056
- get(_name) {
6057
- return undefined;
6058
- }
6059
6059
  setAttr(name, value) {
6060
6060
  this[name] = value;
6061
6061
  }
@@ -6072,37 +6072,10 @@ var LeaferUI = function(exports) {
6072
6072
  toString(options) {
6073
6073
  return JSON.stringify(this.toJSON(options));
6074
6074
  }
6075
- toSVG() {
6076
- return undefined;
6077
- }
6078
- __SVG(_data) {}
6079
- toHTML() {
6080
- return undefined;
6081
- }
6082
- __setAttr(_attrName, _newValue) {
6083
- return true;
6084
- }
6085
- __getAttr(_attrName) {
6086
- return undefined;
6087
- }
6088
- setProxyAttr(_attrName, _newValue) {}
6089
- getProxyAttr(_attrName) {
6090
- return undefined;
6091
- }
6092
- find(_condition, _options) {
6093
- return undefined;
6094
- }
6095
- findTag(_tag) {
6096
- return undefined;
6097
- }
6098
- findOne(_condition, _options) {
6099
- return undefined;
6100
- }
6101
- findId(_id) {
6102
- return undefined;
6075
+ scaleResize(scaleX, scaleY = scaleX, _noResize, _boundsType) {
6076
+ this.scaleX *= scaleX;
6077
+ this.scaleY *= scaleY;
6103
6078
  }
6104
- focus(_value) {}
6105
- updateState() {}
6106
6079
  updateLayout() {
6107
6080
  this.__layout.update();
6108
6081
  }
@@ -6118,27 +6091,6 @@ var LeaferUI = function(exports) {
6118
6091
  __extraUpdate() {
6119
6092
  if (this.leaferIsReady) this.leafer.layouter.addExtra(this);
6120
6093
  }
6121
- __updateWorldMatrix() {}
6122
- __updateLocalMatrix() {}
6123
- __updateWorldBounds() {}
6124
- __updateLocalBounds() {}
6125
- __updateLocalBoxBounds() {}
6126
- __updateLocalStrokeBounds() {}
6127
- __updateLocalRenderBounds() {}
6128
- __updateBoxBounds(_secondLayout, _bounds) {}
6129
- __updateContentBounds() {}
6130
- __updateStrokeBounds(_bounds) {}
6131
- __updateRenderBounds(_bounds) {}
6132
- __updateAutoLayout() {}
6133
- __updateFlowLayout() {}
6134
- __updateNaturalSize() {}
6135
- __updateStrokeSpread() {
6136
- return 0;
6137
- }
6138
- __updateRenderSpread() {
6139
- return 0;
6140
- }
6141
- __onUpdateSize() {}
6142
6094
  __updateEraser(value) {
6143
6095
  this.__hasEraser = value ? true : this.children.some(item => item.__.eraser);
6144
6096
  }
@@ -6152,7 +6104,6 @@ var LeaferUI = function(exports) {
6152
6104
  __updateMask(_value) {
6153
6105
  this.__hasMask = this.children.some(item => item.__.mask && item.__.visible && item.__.opacity);
6154
6106
  }
6155
- __renderMask(_canvas, _options) {}
6156
6107
  __getNowWorld(options) {
6157
6108
  if (options.matrix) {
6158
6109
  if (!this.__cameraWorld) this.__cameraWorld = {};
@@ -6269,11 +6220,11 @@ var LeaferUI = function(exports) {
6269
6220
  const layer = this.leafer ? this.leafer.zoomLayer : this;
6270
6221
  return layer.getWorldPoint(page, relative, distance, change);
6271
6222
  }
6272
- setTransform(matrix, resize, transition) {
6273
- setTransform(this, matrix, resize, transition);
6223
+ setTransform(matrix, resize, transition, boundsType) {
6224
+ setTransform(this, matrix, resize, transition, boundsType);
6274
6225
  }
6275
- transform(matrix, resize, transition) {
6276
- transform(this, matrix, resize, transition);
6226
+ transform(matrix, resize, transition, boundsType) {
6227
+ transform(this, matrix, resize, transition, boundsType);
6277
6228
  }
6278
6229
  move(x, y, transition) {
6279
6230
  moveLocal(this, x, y, transition);
@@ -6281,8 +6232,8 @@ var LeaferUI = function(exports) {
6281
6232
  moveInner(x, y, transition) {
6282
6233
  moveWorld(this, x, y, true, transition);
6283
6234
  }
6284
- scaleOf(origin, scaleX, scaleY, resize, transition) {
6285
- zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize, transition);
6235
+ scaleOf(origin, scaleX, scaleY, resize, transition, boundsType) {
6236
+ zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize, transition, boundsType);
6286
6237
  }
6287
6238
  rotateOf(origin, rotation, transition) {
6288
6239
  rotateOfLocal(this, getLocalOrigin(this, origin), rotation, transition);
@@ -6290,14 +6241,14 @@ var LeaferUI = function(exports) {
6290
6241
  skewOf(origin, skewX, skewY, resize, transition) {
6291
6242
  skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize, transition);
6292
6243
  }
6293
- transformWorld(worldTransform, resize, transition) {
6294
- transformWorld(this, worldTransform, resize, transition);
6244
+ transformWorld(worldTransform, resize, transition, boundsType) {
6245
+ transformWorld(this, worldTransform, resize, transition, boundsType);
6295
6246
  }
6296
6247
  moveWorld(x, y, transition) {
6297
6248
  moveWorld(this, x, y, false, transition);
6298
6249
  }
6299
- scaleOfWorld(worldOrigin, scaleX, scaleY, resize, transition) {
6300
- zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition);
6250
+ scaleOfWorld(worldOrigin, scaleX, scaleY, resize, transition, boundsType) {
6251
+ zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition, boundsType);
6301
6252
  }
6302
6253
  rotateOfWorld(worldOrigin, rotation) {
6303
6254
  rotateOfWorld(this, worldOrigin, rotation);
@@ -6308,76 +6259,12 @@ var LeaferUI = function(exports) {
6308
6259
  flip(axis, transition) {
6309
6260
  transform(this, getFlipTransform(this, axis), false, transition);
6310
6261
  }
6311
- scaleResize(scaleX, scaleY = scaleX, _noResize) {
6312
- this.scaleX *= scaleX;
6313
- this.scaleY *= scaleY;
6314
- }
6315
- __scaleResize(_scaleX, _scaleY) {}
6316
- resizeWidth(_width) {}
6317
- resizeHeight(_height) {}
6318
- hit(_world, _hitRadius) {
6319
- return true;
6320
- }
6321
- __hitWorld(_point, _forceHitFill) {
6322
- return true;
6323
- }
6324
- __hit(_local, _forceHitFill) {
6325
- return true;
6326
- }
6327
- __hitFill(_inner) {
6328
- return true;
6329
- }
6330
- __hitStroke(_inner, _strokeWidth) {
6331
- return true;
6332
- }
6333
- __hitPixel(_inner) {
6334
- return true;
6335
- }
6336
- __drawHitPath(_canvas) {}
6337
- __updateHitCanvas() {}
6338
- __render(_canvas, _options) {}
6339
- __drawFast(_canvas, _options) {}
6340
- __draw(_canvas, _options, _originCanvas) {}
6341
- __clip(_canvas, _options) {}
6342
- __renderShape(_canvas, _options) {}
6343
- __drawShape(_canvas, _options) {}
6344
- __updateWorldOpacity() {}
6345
- __updateChange() {}
6346
- __drawPath(_canvas) {}
6347
- __drawRenderPath(_canvas) {}
6348
- __updatePath() {}
6349
- __updateRenderPath(_updateCache) {}
6350
- getMotionPathData() {
6351
- return Plugin.need("path");
6352
- }
6353
- getMotionPoint(_motionDistance) {
6354
- return Plugin.need("path");
6355
- }
6356
- getMotionTotal() {
6357
- return 0;
6358
- }
6359
- __updateMotionPath() {}
6360
- __runAnimation(_type, _complete) {}
6361
- __updateSortChildren() {}
6362
- add(_child, _index) {}
6363
6262
  remove(_child, destroy) {
6364
6263
  if (this.parent) this.parent.remove(this, destroy);
6365
6264
  }
6366
6265
  dropTo(parent, index, resize) {
6367
6266
  drop(this, parent, index, resize);
6368
6267
  }
6369
- on(_type, _listener, _options) {}
6370
- off(_type, _listener, _options) {}
6371
- on_(_type, _listener, _bind, _options) {
6372
- return undefined;
6373
- }
6374
- off_(_id) {}
6375
- once(_type, _listener, _captureOrBind, _capture) {}
6376
- emit(_type, _event, _capture) {}
6377
- emitEvent(_event, _capture) {}
6378
- hasEvent(_type, _capture) {
6379
- return false;
6380
- }
6381
6268
  static changeAttr(attrName, defaultValue, fn) {
6382
6269
  fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue);
6383
6270
  }
@@ -6673,7 +6560,7 @@ var LeaferUI = function(exports) {
6673
6560
  this.levelMap = null;
6674
6561
  }
6675
6562
  }
6676
- const version = "2.1.3";
6563
+ const version = "2.1.5";
6677
6564
  class LeaferCanvas extends LeaferCanvasBase {
6678
6565
  get allowBackgroundColor() {
6679
6566
  return true;
@@ -8079,17 +7966,12 @@ var LeaferUI = function(exports) {
8079
7966
  if (!path) this.__drawPathByBox(pen);
8080
7967
  return pen;
8081
7968
  }
8082
- reset(_data) {}
8083
7969
  set(data, _transition) {
8084
7970
  if (data) Object.assign(this, data);
8085
7971
  }
8086
7972
  get(name) {
8087
7973
  return isString(name) ? this.__.__getInput(name) : this.__.__getInputData(name);
8088
7974
  }
8089
- createProxyData() {
8090
- return undefined;
8091
- }
8092
- clearProxyData() {}
8093
7975
  find(_condition, _options) {
8094
7976
  return Plugin.need("find");
8095
7977
  }
@@ -8127,6 +8009,7 @@ var LeaferUI = function(exports) {
8127
8009
  data.lazy && !this.__inLazyBounds && !Export.running ? data.__needComputePaint = true : data.__computePaint();
8128
8010
  }
8129
8011
  }
8012
+ __updatePath() {}
8130
8013
  __updateRenderPath(updateCache) {
8131
8014
  const data = this.__;
8132
8015
  if (data.path) {
@@ -8162,7 +8045,6 @@ var LeaferUI = function(exports) {
8162
8045
  this.set(keyframe);
8163
8046
  return Plugin.need("animate");
8164
8047
  }
8165
- killAnimate(_type, _nextStyle) {}
8166
8048
  export(_filename, _options) {
8167
8049
  return Plugin.need("export");
8168
8050
  }
@@ -8265,7 +8147,6 @@ var LeaferUI = function(exports) {
8265
8147
  __decorate([ surfaceType() ], exports.UI.prototype, "placeholderColor", void 0);
8266
8148
  __decorate([ dataType(100) ], exports.UI.prototype, "placeholderDelay", void 0);
8267
8149
  __decorate([ dataType({}) ], exports.UI.prototype, "data", void 0);
8268
- __decorate([ rewrite(exports.Leaf.prototype.reset) ], exports.UI.prototype, "reset", null);
8269
8150
  exports.UI = UI_1 = __decorate([ useModule(UIBounds), useModule(UIRender), rewriteAble() ], exports.UI);
8270
8151
  exports.Group = class Group extends exports.UI {
8271
8152
  get __tag() {
@@ -8301,9 +8182,6 @@ var LeaferUI = function(exports) {
8301
8182
  }
8302
8183
  return data;
8303
8184
  }
8304
- pick(_hitPoint, _options) {
8305
- return undefined;
8306
- }
8307
8185
  addAt(child, index) {
8308
8186
  this.add(child, index);
8309
8187
  }
@@ -8313,11 +8191,6 @@ var LeaferUI = function(exports) {
8313
8191
  addBefore(child, before) {
8314
8192
  this.add(child, this.children.indexOf(before));
8315
8193
  }
8316
- add(_child, _index) {}
8317
- addMany(..._children) {}
8318
- remove(_child, _destroy) {}
8319
- removeAll(_destroy) {}
8320
- clear() {}
8321
8194
  };
8322
8195
  __decorate([ dataProcessor(GroupData) ], exports.Group.prototype, "__", void 0);
8323
8196
  __decorate([ boundsType(0) ], exports.Group.prototype, "width", void 0);
@@ -9171,51 +9044,6 @@ var LeaferUI = function(exports) {
9171
9044
  this.add(path);
9172
9045
  return this;
9173
9046
  }
9174
- beginPath() {
9175
- return this;
9176
- }
9177
- moveTo(_x, _y) {
9178
- return this;
9179
- }
9180
- lineTo(_x, _y) {
9181
- return this;
9182
- }
9183
- bezierCurveTo(_x1, _y1, _x2, _y2, _x, _y) {
9184
- return this;
9185
- }
9186
- quadraticCurveTo(_x1, _y1, _x, _y) {
9187
- return this;
9188
- }
9189
- closePath() {
9190
- return this;
9191
- }
9192
- rect(_x, _y, _width, _height) {
9193
- return this;
9194
- }
9195
- roundRect(_x, _y, _width, _height, _cornerRadius) {
9196
- return this;
9197
- }
9198
- ellipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) {
9199
- return this;
9200
- }
9201
- arc(_x, _y, _radius, _startAngle, _endAngle, _anticlockwise) {
9202
- return this;
9203
- }
9204
- arcTo(_x1, _y1, _x2, _y2, _radius) {
9205
- return this;
9206
- }
9207
- drawEllipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) {
9208
- return this;
9209
- }
9210
- drawArc(_x, _y, _radius, _startAngle, _endAngle, _anticlockwise) {
9211
- return this;
9212
- }
9213
- drawPoints(_points, _curve, _close) {
9214
- return this;
9215
- }
9216
- clearPath() {
9217
- return this;
9218
- }
9219
9047
  paint() {
9220
9048
  const {pathElement: pathElement} = this;
9221
9049
  if (!pathElement.__layout.boxChanged) pathElement.forceUpdate("path");
@@ -11041,7 +10869,7 @@ var LeaferUI = function(exports) {
11041
10869
  needUpdate = false;
11042
10870
  }
11043
10871
  }
11044
- if (paint.mode === "brush") PaintImage.brush(leafPaint, ui);
10872
+ if (paint.mode === "brush") PaintImage.brush(leafPaint, ui, attrName);
11045
10873
  if (!leafPaint.data) {
11046
10874
  PaintImage.createData(leafPaint, image, paint, boxBounds);
11047
10875
  const {transform: transform} = leafPaint.data, {opacity: opacity} = paint;
@@ -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,8LAAAA,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,8LAAAA,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"}