leafer-game 2.2.5 → 2.2.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":"web.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":"wLA6IYA,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":"web.esm.min.js","sources":["../../../../src/leafer/packages/interface/src/path/IPathCommand.ts"],"sourcesContent":["import { IPointData } from '../math/IMath'\nimport { IWindingRule } from '../canvas/ICanvas'\nimport { IObject } from '../data/IData'\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}\n\n// points 转曲线\nexport type IPointsCurveType =\n | 'Q' // 使用二次贝塞尔曲线平滑 points\n | 'C' // 使用三次贝塞尔曲线平滑 points\n | (string & {})\n\nexport type IPointsCurveValue = boolean | number\n\nexport interface IPointsCurveData {\n type: IPointsCurveType\n value: IPointsCurveValue\n}\n\nexport type IPointsCurve = IPointsCurveData | IPointsCurveValue\n\nexport interface IPointsCurveFunction {\n (data: IPathCommandData, originPoints: number[] | IPointData[], curve?: boolean | number, close?: boolean, options?: IObject): void\n}\n\nexport interface IPointsCurveFunctionMap {\n [name: string]: IPointsCurveFunction\n}"],"names":["PathNodeHandleType"],"mappings":"wLA8IYA,GAAZ,SAAYA,GACRA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,YAAA,GAAA,cACAA,EAAAA,EAAA,OAAA,GAAA,QACH,CALD,CAAYA,IAAAA,EAAkB,CAAA"}
package/dist/web.js CHANGED
@@ -434,7 +434,7 @@ var LeaferUI = function(exports) {
434
434
  }
435
435
  const {sin: sin$6, cos: cos$6, acos: acos, sqrt: sqrt$5} = Math;
436
436
  const {float: float$5} = MathHelper;
437
- const tempPoint$6 = {};
437
+ const tempPoint$7 = {};
438
438
  function getWorld() {
439
439
  return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
440
440
  scaleX: 1,
@@ -491,8 +491,8 @@ var LeaferUI = function(exports) {
491
491
  to.f = t.f * pixelRatio;
492
492
  },
493
493
  scaleOfOuter(t, origin, scaleX, scaleY) {
494
- M$7.toInnerPoint(t, origin, tempPoint$6);
495
- M$7.scaleOfInner(t, tempPoint$6, scaleX, scaleY);
494
+ M$7.toInnerPoint(t, origin, tempPoint$7);
495
+ M$7.scaleOfInner(t, tempPoint$7, scaleX, scaleY);
496
496
  },
497
497
  scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
498
498
  M$7.translateInner(t, origin.x, origin.y);
@@ -510,8 +510,8 @@ var LeaferUI = function(exports) {
510
510
  t.d = c * sinR + d * cosR;
511
511
  },
512
512
  rotateOfOuter(t, origin, rotation) {
513
- M$7.toInnerPoint(t, origin, tempPoint$6);
514
- M$7.rotateOfInner(t, tempPoint$6, rotation);
513
+ M$7.toInnerPoint(t, origin, tempPoint$7);
514
+ M$7.rotateOfInner(t, tempPoint$7, rotation);
515
515
  },
516
516
  rotateOfInner(t, origin, rotation) {
517
517
  M$7.translateInner(t, origin.x, origin.y);
@@ -532,8 +532,8 @@ var LeaferUI = function(exports) {
532
532
  }
533
533
  },
534
534
  skewOfOuter(t, origin, skewX, skewY) {
535
- M$7.toInnerPoint(t, origin, tempPoint$6);
536
- M$7.skewOfInner(t, tempPoint$6, skewX, skewY);
535
+ M$7.toInnerPoint(t, origin, tempPoint$7);
536
+ M$7.skewOfInner(t, tempPoint$7, skewX, skewY);
537
537
  },
538
538
  skewOfInner(t, origin, skewX, skewY = 0) {
539
539
  M$7.translateInner(t, origin.x, origin.y);
@@ -951,7 +951,7 @@ var LeaferUI = function(exports) {
951
951
  return this;
952
952
  }
953
953
  }
954
- const tempPoint$5 = new Point;
954
+ const tempPoint$6 = new Point;
955
955
  class Matrix {
956
956
  constructor(a, b, c, d, e, f) {
957
957
  this.set(a, b, c, d, e, f);
@@ -1814,7 +1814,7 @@ var LeaferUI = function(exports) {
1814
1814
  return name;
1815
1815
  }
1816
1816
  const D$5 = Debug;
1817
- const debug$g = Debug.get("RunTime");
1817
+ const debug$h = Debug.get("RunTime");
1818
1818
  const Run = {
1819
1819
  currentId: 0,
1820
1820
  currentName: "",
@@ -1832,7 +1832,7 @@ var LeaferUI = function(exports) {
1832
1832
  const time = R$1.idMap[id], name = R$1.nameMap[id];
1833
1833
  const duration = microsecond ? (performance.now() - time) / 1e3 : Date.now() - time;
1834
1834
  R$1.idMap[id] = R$1.nameMap[id] = R$1.nameToIdMap[name] = undefined;
1835
- debug$g.log(name, duration, "ms");
1835
+ debug$h.log(name, duration, "ms");
1836
1836
  },
1837
1837
  endOfName(name, microsecond) {
1838
1838
  const id = R$1.nameToIdMap[name];
@@ -1862,17 +1862,17 @@ var LeaferUI = function(exports) {
1862
1862
  return Plugin.need("editor");
1863
1863
  }
1864
1864
  };
1865
- const debug$f = Debug.get("UICreator");
1865
+ const debug$g = Debug.get("UICreator");
1866
1866
  const UICreator = {
1867
1867
  list: {},
1868
1868
  register(UI) {
1869
1869
  const {__tag: tag} = UI.prototype;
1870
- if (list$1[tag]) debug$f.repeat(tag);
1870
+ if (list$1[tag]) debug$g.repeat(tag);
1871
1871
  list$1[tag] = UI;
1872
1872
  },
1873
1873
  get(tag, data, x, y, width, height) {
1874
1874
  if (!list$1[tag]) {
1875
- debug$f.warn("not register " + tag);
1875
+ debug$g.warn("not register " + tag);
1876
1876
  return undefined;
1877
1877
  }
1878
1878
  const ui = new list$1[tag](data);
@@ -1886,14 +1886,14 @@ var LeaferUI = function(exports) {
1886
1886
  }
1887
1887
  };
1888
1888
  const {list: list$1} = UICreator;
1889
- const debug$e = Debug.get("EventCreator");
1889
+ const debug$f = Debug.get("EventCreator");
1890
1890
  const EventCreator = {
1891
1891
  nameList: {},
1892
1892
  register(Event) {
1893
1893
  let name;
1894
1894
  Object.keys(Event).forEach(key => {
1895
1895
  name = Event[key];
1896
- if (isString(name)) nameList[name] && debug$e.repeat(name), nameList[name] = Event;
1896
+ if (isString(name)) nameList[name] && debug$f.repeat(name), nameList[name] = Event;
1897
1897
  });
1898
1898
  },
1899
1899
  changeName(oldName, newName) {
@@ -2529,7 +2529,7 @@ var LeaferUI = function(exports) {
2529
2529
  const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
2530
2530
  const {set: set$3, toNumberPoints: toNumberPoints} = PointHelper;
2531
2531
  const {M: M$6, L: L$7, C: C$5, Q: Q$4, Z: Z$6} = PathCommandMap;
2532
- const tempPoint$4 = {};
2532
+ const tempPoint$5 = {};
2533
2533
  const BezierHelper = {
2534
2534
  points(data, originPoints, curve, close) {
2535
2535
  let points = toNumberPoints(originPoints);
@@ -2702,8 +2702,8 @@ var LeaferUI = function(exports) {
2702
2702
  addMode ? addPoint$1(pointBounds, fromX, fromY) : setPoint$1(pointBounds, fromX, fromY);
2703
2703
  addPoint$1(pointBounds, toX, toY);
2704
2704
  for (let i = 0, len = tList.length; i < len; i++) {
2705
- getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$4);
2706
- addPoint$1(pointBounds, tempPoint$4.x, tempPoint$4.y);
2705
+ getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$5);
2706
+ addPoint$1(pointBounds, tempPoint$5.x, tempPoint$5.y);
2707
2707
  }
2708
2708
  },
2709
2709
  getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
@@ -2807,7 +2807,7 @@ var LeaferUI = function(exports) {
2807
2807
  const {M: M$5, m: m, L: L$6, l: l, H: H, h: h, V: V, v: v, C: C$4, c: c, S: S, s: s, Q: Q$3, q: q, T: T, t: t, A: A, a: a, Z: Z$5, z: z, N: N$3, D: D$4, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3} = PathCommandMap;
2808
2808
  const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
2809
2809
  const {ellipticalArc: ellipticalArc} = EllipseHelper;
2810
- const debug$d = Debug.get("PathConvert");
2810
+ const debug$e = Debug.get("PathConvert");
2811
2811
  const setEndPoint$1 = {};
2812
2812
  const PathConvert = {
2813
2813
  current: {
@@ -3072,7 +3072,7 @@ var LeaferUI = function(exports) {
3072
3072
  break;
3073
3073
 
3074
3074
  default:
3075
- debug$d.error(`command: ${command} [index:${i}]`, old);
3075
+ debug$e.error(`command: ${command} [index:${i}]`, old);
3076
3076
  return data;
3077
3077
  }
3078
3078
  lastCommand = command;
@@ -3129,7 +3129,9 @@ var LeaferUI = function(exports) {
3129
3129
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
3130
3130
  const {tan: tan, min: min$1, abs: abs$5} = Math;
3131
3131
  const startPoint = {};
3132
+ const debug$d = Debug.get("PointsCurve");
3132
3133
  const PathCommandDataHelper = {
3134
+ pointsCurveList: {},
3133
3135
  beginPath(data) {
3134
3136
  data.length = 0;
3135
3137
  },
@@ -3199,11 +3201,19 @@ var LeaferUI = function(exports) {
3199
3201
  data.push(M$4, startPoint.x, startPoint.y);
3200
3202
  arc$2(data, x, y, radius, startAngle, endAngle, anticlockwise);
3201
3203
  },
3202
- drawPoints(data, points, curve, close) {
3203
- BezierHelper.points(data, points, curve, close);
3204
+ drawPoints(data, points, curve, close, options) {
3205
+ let type = "Q";
3206
+ if (isObject(curve)) type = curve.type, curve = curve.value;
3207
+ if (!pointsCurveList[type]) debug$d.warn("not found:", type), type = "Q";
3208
+ pointsCurveList[type](data, points, curve, close, options);
3204
3209
  }
3205
3210
  };
3206
- const {ellipse: ellipse$3, arc: arc$2} = PathCommandDataHelper;
3211
+ const {ellipse: ellipse$3, arc: arc$2, pointsCurveList: pointsCurveList} = PathCommandDataHelper;
3212
+ function registerPointsCurve(type, fn) {
3213
+ if (pointsCurveList[type]) debug$d.repeat(type);
3214
+ pointsCurveList[type] = fn;
3215
+ }
3216
+ registerPointsCurve("Q", BezierHelper.points);
3207
3217
  const {moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo: quadraticCurveTo, bezierCurveTo: bezierCurveTo, closePath: closePath$3, beginPath: beginPath, rect: rect$2, roundRect: roundRect$1, ellipse: ellipse$2, arc: arc$1, arcTo: arcTo$2, drawEllipse: drawEllipse, drawArc: drawArc, drawPoints: drawPoints$2} = PathCommandDataHelper;
3208
3218
  class PathCreator {
3209
3219
  set path(value) {
@@ -5664,7 +5674,7 @@ var LeaferUI = function(exports) {
5664
5674
  }
5665
5675
  };
5666
5676
  const {setLayout: setLayout, multiplyParent: multiplyParent$2, translateInner: translateInner, defaultWorld: defaultWorld} = MatrixHelper;
5667
- const {toPoint: toPoint$3, tempPoint: tempPoint$3} = AroundHelper;
5677
+ const {toPoint: toPoint$3, tempPoint: tempPoint$4} = AroundHelper;
5668
5678
  const LeafMatrix = {
5669
5679
  __updateWorldMatrix() {
5670
5680
  const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
@@ -5684,8 +5694,8 @@ var LeaferUI = function(exports) {
5684
5694
  local.e = data.x + data.offsetX;
5685
5695
  local.f = data.y + data.offsetY;
5686
5696
  if (data.around || data.origin) {
5687
- toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$3);
5688
- translateInner(local, -tempPoint$3.x, -tempPoint$3.y, !data.around);
5697
+ toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$4);
5698
+ translateInner(local, -tempPoint$4.x, -tempPoint$4.y, !data.around);
5689
5699
  }
5690
5700
  }
5691
5701
  this.__layout.matrixChanged = undefined;
@@ -6606,7 +6616,7 @@ var LeaferUI = function(exports) {
6606
6616
  this.levelMap = null;
6607
6617
  }
6608
6618
  }
6609
- const version = "2.2.5";
6619
+ const version = "2.2.6";
6610
6620
  const debug$5 = Debug.get("LeaferCanvas");
6611
6621
  class LeaferCanvas extends LeaferCanvasBase {
6612
6622
  set zIndex(zIndex) {
@@ -7432,7 +7442,7 @@ var LeaferUI = function(exports) {
7432
7442
  }
7433
7443
  }
7434
7444
  Renderer.clipSpread = 10;
7435
- const tempPoint$2 = {};
7445
+ const tempPoint$3 = {};
7436
7446
  const {copyRadiusPoint: copyRadiusPoint$1} = PointHelper;
7437
7447
  const {hitRadiusPoint: hitRadiusPoint$1} = BoundsHelper;
7438
7448
  class Picker {
@@ -7564,7 +7574,7 @@ var LeaferUI = function(exports) {
7564
7574
  for (let i = len - 1; i > -1; i--) {
7565
7575
  child = children[i], data = child.__;
7566
7576
  if (!data.visible || onlyHitMask && !data.mask) continue;
7567
- hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$2, point, data.hitRadius) : point);
7577
+ hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$3, point, data.hitRadius) : point);
7568
7578
  if (child.isBranch) {
7569
7579
  if (hit || child.__ignoreHitWorld) {
7570
7580
  if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue;
@@ -8073,7 +8083,7 @@ var LeaferUI = function(exports) {
8073
8083
  }
8074
8084
  if (data.__useEffect) {
8075
8085
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
8076
- stintSet$2(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
8086
+ stintSet$2(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && !(shadow[0].blendMode && shadow[0].blendMode !== "pass-through") && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
8077
8087
  data.__useEffect = !!(shadow || otherEffect);
8078
8088
  }
8079
8089
  data.__checkSingle();
@@ -8936,7 +8946,7 @@ var LeaferUI = function(exports) {
8936
8946
  __decorate([ surfaceType("#FFFFFF") ], exports.Frame.prototype, "fill", void 0);
8937
8947
  __decorate([ affectRenderBoundsType("hide") ], exports.Frame.prototype, "overflow", void 0);
8938
8948
  exports.Frame = __decorate([ registerUI() ], exports.Frame);
8939
- const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper, {tempPoint: tempPoint$1, set: set$2, rotate: rotate$2} = PointHelper, {abs: abs$4} = Math, tempCenter = {};
8949
+ const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper, {tempPoint: tempPoint$2, set: set$2, rotate: rotate$2} = PointHelper, {abs: abs$4} = Math, tempCenter = {};
8940
8950
  exports.Ellipse = class Ellipse extends exports.UI {
8941
8951
  get __tag() {
8942
8952
  return "Ellipse";
@@ -8956,9 +8966,9 @@ var LeaferUI = function(exports) {
8956
8966
  if (drawInnerEllipse) {
8957
8967
  if (closedAngle) {
8958
8968
  closePath$2(path);
8959
- set$2(tempPoint$1, rx + innerRx, ry), set$2(tempCenter, rx, ry);
8960
- rotate$2(tempPoint$1, endAngle, tempCenter, rx, ry);
8961
- moveTo$3(path, tempPoint$1.x, tempPoint$1.y);
8969
+ set$2(tempPoint$2, rx + innerRx, ry), set$2(tempCenter, rx, ry);
8970
+ rotate$2(tempPoint$2, endAngle, tempCenter, rx, ry);
8971
+ moveTo$3(path, tempPoint$2.x, tempPoint$2.y);
8962
8972
  }
8963
8973
  ellipse(path, rx, ry, innerRx, innerRy, 0, endAngle, startAngle, true);
8964
8974
  } else {
@@ -9005,7 +9015,7 @@ var LeaferUI = function(exports) {
9005
9015
  const data = this.__;
9006
9016
  const path = data.path = [];
9007
9017
  if (data.points) {
9008
- drawPoints$1(path, data.points, data.curve, data.closed);
9018
+ drawPoints$1(path, data.points, data.curve, data.closed, data);
9009
9019
  } else {
9010
9020
  const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
9011
9021
  const rx = width / 2, ry = height / 2;
@@ -9080,7 +9090,7 @@ var LeaferUI = function(exports) {
9080
9090
  const data = this.__;
9081
9091
  const path = data.path = [];
9082
9092
  if (data.points) {
9083
- drawPoints(path, data.points, data.curve, data.closed);
9093
+ drawPoints(path, data.points, data.curve, data.closed, data);
9084
9094
  } else {
9085
9095
  moveTo(path, 0, 0);
9086
9096
  lineTo(path, this.width, 0);
@@ -14131,7 +14141,7 @@ var LeaferUI = function(exports) {
14131
14141
  };
14132
14142
  const {getDistance: getDistance} = HighBezierHelper;
14133
14143
  const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper, {set: set, getAngle: getAngle, getDistanceFrom: getDistanceFrom, getDistancePoint: getDistancePoint} = PointHelper;
14134
- const tempPoint = {}, tempFrom = {};
14144
+ const tempPoint$1 = {}, tempFrom = {};
14135
14145
  const HighCurveHelper = {
14136
14146
  transform(data, matrix) {
14137
14147
  let i = 0, command;
@@ -14157,11 +14167,11 @@ var LeaferUI = function(exports) {
14157
14167
  },
14158
14168
  transformPoints(data, matrix, start, pointCount) {
14159
14169
  for (let i = start + 1, end = i + pointCount * 2; i < end; i += 2) {
14160
- tempPoint.x = data[i];
14161
- tempPoint.y = data[i + 1];
14162
- MatrixHelper.toOuterPoint(matrix, tempPoint);
14163
- data[i] = tempPoint.x;
14164
- data[i + 1] = tempPoint.y;
14170
+ tempPoint$1.x = data[i];
14171
+ tempPoint$1.y = data[i + 1];
14172
+ MatrixHelper.toOuterPoint(matrix, tempPoint$1);
14173
+ data[i] = tempPoint$1.x;
14174
+ data[i + 1] = tempPoint$1.y;
14165
14175
  }
14166
14176
  },
14167
14177
  getMotionPathData(data) {
@@ -14394,9 +14404,11 @@ var LeaferUI = function(exports) {
14394
14404
  const {updateMatrix: updateMatrix, updateAllMatrix: updateAllMatrix} = LeafHelper;
14395
14405
  const {updateBounds: updateBounds} = BranchHelper;
14396
14406
  const {toVertical: toVertical} = PointHelper;
14407
+ const tempPoint = {};
14397
14408
  exports.UI.addAttr("motionPath", undefined, motionPathType);
14398
14409
  exports.UI.addAttr("motionPrecision", 1, motionPathType);
14399
14410
  exports.UI.addAttr("motion", undefined, motionPathType);
14411
+ exports.UI.addAttr("motionAround", undefined, motionPathType);
14400
14412
  exports.UI.addAttr("motionVertical", "below", motionPathType);
14401
14413
  exports.UI.addAttr("motionRotation", true, motionPathType);
14402
14414
  ui$1.getMotionPath = function() {
@@ -14413,8 +14425,14 @@ var LeaferUI = function(exports) {
14413
14425
  const data = getMotionPathData(pathElement);
14414
14426
  if (!data.total) return {};
14415
14427
  const point = HighCurveHelper.getDistancePoint(data, motionDistance, pathElement.motionPrecision, offsetX);
14416
- const {motionRotation: motionRotation} = this;
14428
+ const {motionRotation: motionRotation, motionAround: motionAround} = this;
14417
14429
  if (isNumber(motionRotation)) point.rotation += motionRotation;
14430
+ if (motionAround && motionAround !== "top-left") {
14431
+ AroundHelper.toPoint(motionAround, this.__layout.boxBounds, tempPoint);
14432
+ PointHelper.set(tempPoint, point.x - tempPoint.x * this.scaleX, point.y - tempPoint.y * this.scaleY);
14433
+ if (point.rotation) PointHelper.rotate(tempPoint, point.rotation, point);
14434
+ PointHelper.copy(point, tempPoint);
14435
+ }
14418
14436
  let verticalType, verticalOffset;
14419
14437
  if (isObject(motionVertical)) verticalType = motionVertical.type, verticalOffset = motionVertical.offset; else if (isNumber(motionVertical)) verticalOffset = motionVertical; else verticalType = motionVertical;
14420
14438
  if (verticalType !== "below" || offsetY) {
@@ -14819,6 +14837,7 @@ var LeaferUI = function(exports) {
14819
14837
  exports.pathType = pathType;
14820
14838
  exports.pen = pen;
14821
14839
  exports.positionType = positionType;
14840
+ exports.registerPointsCurve = registerPointsCurve;
14822
14841
  exports.registerUI = registerUI;
14823
14842
  exports.registerUIEvent = registerUIEvent;
14824
14843
  exports.resizeType = resizeType;
@@ -14834,7 +14853,7 @@ var LeaferUI = function(exports) {
14834
14853
  exports.surfaceType = surfaceType;
14835
14854
  exports.tempBounds = tempBounds$2;
14836
14855
  exports.tempMatrix = tempMatrix$2;
14837
- exports.tempPoint = tempPoint$5;
14856
+ exports.tempPoint = tempPoint$6;
14838
14857
  exports.tryToNumber = tryToNumber;
14839
14858
  exports.useCanvas = useCanvas;
14840
14859
  exports.useModule = useModule;
@@ -1 +1 @@
1
- {"version":3,"file":"web.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,sLAAAA,QAAAA,wBAAAA,GAAAA,EAAAA,QAAAA,qBAAAA,2BAAkB,CAAA,IAC1BA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,YAAA,GAAA,cACAA,EAAAA,EAAA,OAAA,GAAA"}
1
+ {"version":3,"file":"web.min.cjs","sources":["../../../../src/leafer/packages/interface/src/path/IPathCommand.ts"],"sourcesContent":["import { IPointData } from '../math/IMath'\nimport { IWindingRule } from '../canvas/ICanvas'\nimport { IObject } from '../data/IData'\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}\n\n// points 转曲线\nexport type IPointsCurveType =\n | 'Q' // 使用二次贝塞尔曲线平滑 points\n | 'C' // 使用三次贝塞尔曲线平滑 points\n | (string & {})\n\nexport type IPointsCurveValue = boolean | number\n\nexport interface IPointsCurveData {\n type: IPointsCurveType\n value: IPointsCurveValue\n}\n\nexport type IPointsCurve = IPointsCurveData | IPointsCurveValue\n\nexport interface IPointsCurveFunction {\n (data: IPathCommandData, originPoints: number[] | IPointData[], curve?: boolean | number, close?: boolean, options?: IObject): void\n}\n\nexport interface IPointsCurveFunctionMap {\n [name: string]: IPointsCurveFunction\n}"],"names":["PathNodeHandleType"],"mappings":"iBA8IYA,sLAAAA,QAAAA,wBAAAA,GAAAA,EAAAA,QAAAA,qBAAAA,2BAAkB,CAAA,IAC1BA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,YAAA,GAAA,cACAA,EAAAA,EAAA,OAAA,GAAA"}