@leafer/miniapp 2.0.7 → 2.0.9

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":"miniapp.esm.min.js","sources":["../../../../../../../src/leafer/packages/interface/src/path/IPathCommand.ts"],"sourcesContent":["import { IPointData } from '../math/IMath'\n\ntype Command = number\ntype x = number\ntype y = number\ntype x1 = number\ntype y1 = number\ntype x2 = number\ntype y2 = number\ntype radiusX = number\ntype radiusY = number\ntype xAxisRotation = number\ntype largeArcFlag = number\ntype sweepFlag = number\n\n\nexport type MCommandData = [Command, x, y]\nexport type HCommandData = [Command, x]\nexport type VCommandData = [Command, y]\nexport type LCommandData = MCommandData\n\nexport type CCommandData = [Command, x1, y1, x2, y2, x, y]\nexport type SCommandData = [Command, x2, y2, x, y]\n\nexport type QCommandData = [Command, x1, y1, x, y]\nexport type TCommandData = [Command, x, y]\n\nexport type ZCommandData = [Command]\n\nexport type ACommandData = [Command, radiusX, radiusY, xAxisRotation, largeArcFlag, sweepFlag, x, y]\n\n\n// 非svg标准的canvas绘图命令\ntype width = number\ntype height = number\ntype rotation = number\ntype startAngle = number\ntype endAngle = number\ntype anticlockwise = boolean\ntype cornerRadius = number | number[]\ntype radius = number\n\nexport type RectCommandData = [Command, x, y, width, height]\nexport type RoundRectCommandData = [Command, x, y, width, height, cornerRadius]\nexport type EllipseCommandData = [Command, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise]\nexport type ArcCommandData = [Command, x, y, radius, startAngle, endAngle, anticlockwise]\nexport type ArcToCommandData = [Command, x1, y1, x2, y2, radius]\n\n\nexport type CanvasPathCommand = 1 | 2 | 5 | 7 | 11 // M | L | C | Q | Z canvas可以绘制的命令\n\nexport type IPathCommandData = number[] // ...(MCommandData | LCommandData | CCommandData | QCommandData | ZCommandData)\n\nexport interface IPathCommandDataWithRadius {\n data: IPathCommandData\n radius: number[]\n}\n\n// 路径命令对象\nexport interface MoveToCommandObject {\n name: 'M'\n x: number\n y: number\n}\nexport interface LineToCommandObject {\n name: 'L'\n x: number\n y: number\n}\n\nexport interface BezierCurveToCommandObject {\n name: 'C'\n x1: number\n y1: number\n x2: number\n y2: number\n x: number\n y: number\n}\n\nexport interface QuadraticCurveToCommandObject {\n name: 'Q'\n x1: number\n y1: number\n x: number\n y: number\n}\n\nexport interface ClosePathCommandObject {\n name: 'Z'\n}\n\nexport type IPathCommandObject = MoveToCommandObject | LineToCommandObject | BezierCurveToCommandObject | QuadraticCurveToCommandObject | ClosePathCommandObject // M | L | C | Q | Z canvas可以绘制的命令\n\n\n// 可视化路径节点\n\nexport interface IPathCommandNodeBase {\n name: 'M^' | 'L^' | 'C^' | 'Z^'\n x: number\n y: number\n r?: number // 圆角半径\n a?: IPointData // 第一个手柄,连接上一个节点\n b?: IPointData // 第二个手柄,连接下一个节点\n ab?: PathNodeHandleType // 手柄类型\n}\n\nexport interface MoveToCommandNode extends IPathCommandNodeBase {\n name: 'M^'\n}\nexport interface LineToCommandNode extends IPathCommandNodeBase {\n name: 'L^'\n}\n\nexport interface BezierCurveToCommandNode extends IPathCommandNodeBase {\n name: 'C^'\n}\n\nexport interface ClosePathCommandNode {\n name: 'Z^'\n x?: number\n y?: number\n r?: number // 圆角半径\n a?: IPointData\n b?: IPointData\n ab?: PathNodeHandleType\n}\n\nexport type IPathCommandNode = MoveToCommandNode | LineToCommandNode | BezierCurveToCommandNode | ClosePathCommandNode // M | L | C | Z 路径节点命令(适合可视化编辑)\n\nexport enum PathNodeHandleType { // 手柄类型\n none = 1, // 无手柄\n free = 2, // 每个手柄自由控制\n mirrorAngle = 3, // 仅镜像角度\n mirror = 4, // 镜像角度和长度\n}\n\nexport type PathNodeHandleName = 'a' | 'b' // 手柄名称\n\nexport interface IPathNodeBase {\n pathNode: IPathCommandNode\n}"],"names":["PathNodeHandleType"],"mappings":"kpBAkIYA,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":"miniapp.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":"kpBAwIYA,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 +1 @@
1
- {"version":3,"file":"miniapp.min.cjs","sources":["../../../../../../../src/leafer/packages/interface/src/path/IPathCommand.ts"],"sourcesContent":["import { IPointData } from '../math/IMath'\n\ntype Command = number\ntype x = number\ntype y = number\ntype x1 = number\ntype y1 = number\ntype x2 = number\ntype y2 = number\ntype radiusX = number\ntype radiusY = number\ntype xAxisRotation = number\ntype largeArcFlag = number\ntype sweepFlag = number\n\n\nexport type MCommandData = [Command, x, y]\nexport type HCommandData = [Command, x]\nexport type VCommandData = [Command, y]\nexport type LCommandData = MCommandData\n\nexport type CCommandData = [Command, x1, y1, x2, y2, x, y]\nexport type SCommandData = [Command, x2, y2, x, y]\n\nexport type QCommandData = [Command, x1, y1, x, y]\nexport type TCommandData = [Command, x, y]\n\nexport type ZCommandData = [Command]\n\nexport type ACommandData = [Command, radiusX, radiusY, xAxisRotation, largeArcFlag, sweepFlag, x, y]\n\n\n// 非svg标准的canvas绘图命令\ntype width = number\ntype height = number\ntype rotation = number\ntype startAngle = number\ntype endAngle = number\ntype anticlockwise = boolean\ntype cornerRadius = number | number[]\ntype radius = number\n\nexport type RectCommandData = [Command, x, y, width, height]\nexport type RoundRectCommandData = [Command, x, y, width, height, cornerRadius]\nexport type EllipseCommandData = [Command, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise]\nexport type ArcCommandData = [Command, x, y, radius, startAngle, endAngle, anticlockwise]\nexport type ArcToCommandData = [Command, x1, y1, x2, y2, radius]\n\n\nexport type CanvasPathCommand = 1 | 2 | 5 | 7 | 11 // M | L | C | Q | Z canvas可以绘制的命令\n\nexport type IPathCommandData = number[] // ...(MCommandData | LCommandData | CCommandData | QCommandData | ZCommandData)\n\nexport interface IPathCommandDataWithRadius {\n data: IPathCommandData\n radius: number[]\n}\n\n// 路径命令对象\nexport interface MoveToCommandObject {\n name: 'M'\n x: number\n y: number\n}\nexport interface LineToCommandObject {\n name: 'L'\n x: number\n y: number\n}\n\nexport interface BezierCurveToCommandObject {\n name: 'C'\n x1: number\n y1: number\n x2: number\n y2: number\n x: number\n y: number\n}\n\nexport interface QuadraticCurveToCommandObject {\n name: 'Q'\n x1: number\n y1: number\n x: number\n y: number\n}\n\nexport interface ClosePathCommandObject {\n name: 'Z'\n}\n\nexport type IPathCommandObject = MoveToCommandObject | LineToCommandObject | BezierCurveToCommandObject | QuadraticCurveToCommandObject | ClosePathCommandObject // M | L | C | Q | Z canvas可以绘制的命令\n\n\n// 可视化路径节点\n\nexport interface IPathCommandNodeBase {\n name: 'M^' | 'L^' | 'C^' | 'Z^'\n x: number\n y: number\n r?: number // 圆角半径\n a?: IPointData // 第一个手柄,连接上一个节点\n b?: IPointData // 第二个手柄,连接下一个节点\n ab?: PathNodeHandleType // 手柄类型\n}\n\nexport interface MoveToCommandNode extends IPathCommandNodeBase {\n name: 'M^'\n}\nexport interface LineToCommandNode extends IPathCommandNodeBase {\n name: 'L^'\n}\n\nexport interface BezierCurveToCommandNode extends IPathCommandNodeBase {\n name: 'C^'\n}\n\nexport interface ClosePathCommandNode {\n name: 'Z^'\n x?: number\n y?: number\n r?: number // 圆角半径\n a?: IPointData\n b?: IPointData\n ab?: PathNodeHandleType\n}\n\nexport type IPathCommandNode = MoveToCommandNode | LineToCommandNode | BezierCurveToCommandNode | ClosePathCommandNode // M | L | C | Z 路径节点命令(适合可视化编辑)\n\nexport enum PathNodeHandleType { // 手柄类型\n none = 1, // 无手柄\n free = 2, // 每个手柄自由控制\n mirrorAngle = 3, // 仅镜像角度\n mirror = 4, // 镜像角度和长度\n}\n\nexport type PathNodeHandleName = 'a' | 'b' // 手柄名称\n\nexport interface IPathNodeBase {\n pathNode: IPathCommandNode\n}"],"names":["PathNodeHandleType"],"mappings":"iBAkIYA,gpBAAAA,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":"miniapp.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,gpBAAAA,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"}
@@ -735,7 +735,7 @@ const {float: float$5} = MathHelper;
735
735
 
736
736
  const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
737
737
 
738
- const {sin: sin$5, cos: cos$5, abs: abs$a, sqrt: sqrt$4, atan2: atan2$2, min: min$3, round: round$5} = Math;
738
+ const {sin: sin$5, cos: cos$5, abs: abs$b, sqrt: sqrt$4, atan2: atan2$2, min: min$3, round: round$5} = Math;
739
739
 
740
740
  const PointHelper = {
741
741
  defaultPoint: getPointData(),
@@ -833,8 +833,8 @@ const PointHelper = {
833
833
  return getDistanceFrom(t.x, t.y, point.x, point.y);
834
834
  },
835
835
  getDistanceFrom(x1, y1, x2, y2) {
836
- const x = abs$a(x2 - x1);
837
- const y = abs$a(y2 - y1);
836
+ const x = abs$b(x2 - x1);
837
+ const y = abs$b(y2 - y1);
838
838
  return sqrt$4(x * x + y * y);
839
839
  },
840
840
  getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
@@ -2700,7 +2700,7 @@ const RectHelper = {
2700
2700
  }
2701
2701
  };
2702
2702
 
2703
- const {sin: sin$4, cos: cos$4, hypot: hypot$1, atan2: atan2$1, ceil: ceil$1, abs: abs$9, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
2703
+ const {sin: sin$4, cos: cos$4, hypot: hypot$1, atan2: atan2$1, ceil: ceil$1, abs: abs$a, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
2704
2704
 
2705
2705
  const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
2706
2706
 
@@ -2777,7 +2777,7 @@ const BezierHelper = {
2777
2777
  const lenCB = hypot$1(CBx, CBy);
2778
2778
  let totalRadian = endRadian - startRadian;
2779
2779
  if (totalRadian < 0) totalRadian += PI2;
2780
- if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$9(totalRadian - PI$3) < 1e-12) {
2780
+ if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$a(totalRadian - PI$3) < 1e-12) {
2781
2781
  if (data) data.push(L$b, x1, y1);
2782
2782
  if (setPointBounds) {
2783
2783
  setPoint$4(setPointBounds, fromX, fromY);
@@ -2810,7 +2810,7 @@ const BezierHelper = {
2810
2810
  let totalRadian = endRadian - startRadian;
2811
2811
  if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
2812
2812
  if (anticlockwise) totalRadian -= PI2;
2813
- const parts = ceil$1(abs$9(totalRadian / PI_2));
2813
+ const parts = ceil$1(abs$a(totalRadian / PI_2));
2814
2814
  const partRadian = totalRadian / parts;
2815
2815
  const partRadian4Sin = sin$4(partRadian / 4);
2816
2816
  const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$4(partRadian / 2);
@@ -3316,7 +3316,7 @@ const {M: M$9, L: L$9, C: C$7, Q: Q$5, Z: Z$7, N: N$4, D: D$5, X: X$4, G: G$4, F
3316
3316
 
3317
3317
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
3318
3318
 
3319
- const {tan: tan, min: min$2, abs: abs$8} = Math;
3319
+ const {tan: tan, min: min$2, abs: abs$9} = Math;
3320
3320
 
3321
3321
  const startPoint = {};
3322
3322
 
@@ -3376,7 +3376,7 @@ const PathCommandDataHelper = {
3376
3376
  arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
3377
3377
  if (!isUndefined(lastX)) {
3378
3378
  const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
3379
- radius = min$2(radius, min$2(r, r * abs$8(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3379
+ radius = min$2(radius, min$2(r, r * abs$9(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3380
3380
  }
3381
3381
  data.push(U$4, x1, y1, x2, y2, radius);
3382
3382
  },
@@ -7079,7 +7079,7 @@ class LeafLevelList {
7079
7079
  }
7080
7080
  }
7081
7081
 
7082
- const version = "2.0.7";
7082
+ const version = "2.0.9";
7083
7083
 
7084
7084
  class LeaferCanvas extends LeaferCanvasBase {
7085
7085
  get allowBackgroundColor() {
@@ -7141,6 +7141,7 @@ class LeaferCanvas extends LeaferCanvasBase {
7141
7141
  updateClientBounds(callback) {
7142
7142
  if (this.viewSelect) Platform.miniapp.getBounds(this.viewSelect).then(bounds => {
7143
7143
  this.clientBounds = bounds;
7144
+ this.updateViewSize();
7144
7145
  if (callback) callback();
7145
7146
  });
7146
7147
  }
@@ -7240,7 +7241,7 @@ function useCanvas(_canvasType, app) {
7240
7241
  },
7241
7242
  loadImage(src, _crossOrigin, _leaferImage) {
7242
7243
  return new Promise((resolve, reject) => {
7243
- const img = Platform.canvas.view.createImage();
7244
+ const img = Platform.getCanvas().view.createImage();
7244
7245
  img.onload = () => {
7245
7246
  resolve(img);
7246
7247
  };
@@ -7335,21 +7336,25 @@ function useCanvas(_canvasType, app) {
7335
7336
  };
7336
7337
  Platform.canvas = Creator.canvas();
7337
7338
  Platform.conicGradientSupport = !!Platform.canvas.context.createConicGradient;
7339
+ defineKey(Platform, "devicePixelRatio", {
7340
+ get() {
7341
+ return Math.max(1, app.getWindowInfo ? app.getWindowInfo().pixelRatio : app.getSystemInfoSync().pixelRatio);
7342
+ }
7343
+ });
7338
7344
  }
7339
7345
 
7340
7346
  Platform.name = "miniapp";
7341
7347
 
7348
+ Platform.getCanvas = function() {
7349
+ const {renderCanvas: renderCanvas} = Platform;
7350
+ return renderCanvas && renderCanvas.view ? renderCanvas : Platform.canvas;
7351
+ };
7352
+
7342
7353
  Platform.requestRender = function(render) {
7343
- const {view: view} = Platform.renderCanvas || Platform.canvas;
7354
+ const {view: view} = Platform.getCanvas();
7344
7355
  view.requestAnimationFrame ? view.requestAnimationFrame(render) : setTimeout(render, 16);
7345
7356
  };
7346
7357
 
7347
- defineKey(Platform, "devicePixelRatio", {
7348
- get() {
7349
- return Math.max(1, wx.getWindowInfo ? wx.getWindowInfo().pixelRatio : wx.getSystemInfoSync().pixelRatio);
7350
- }
7351
- });
7352
-
7353
7358
  class Watcher {
7354
7359
  get childrenChanged() {
7355
7360
  return this.hasAdd || this.hasRemove || this.hasVisible;
@@ -9624,11 +9629,16 @@ let Polygon = class Polygon extends UI {
9624
9629
  if (data.points) {
9625
9630
  drawPoints$1(path, data.points, data.curve, data.closed);
9626
9631
  } else {
9627
- const {width: width, height: height, sides: sides} = data;
9632
+ const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
9628
9633
  const rx = width / 2, ry = height / 2;
9629
- moveTo$2(path, rx, 0);
9634
+ let startRadian = 0, radian;
9635
+ if (startAngle) {
9636
+ startRadian = startAngle * OneRadian;
9637
+ moveTo$2(path, rx + rx * sin$2(startRadian), ry - ry * cos$2(startRadian));
9638
+ } else moveTo$2(path, rx, 0);
9630
9639
  for (let i = 1; i < sides; i++) {
9631
- lineTo$2(path, rx + rx * sin$2(i * 2 * PI$2 / sides), ry - ry * cos$2(i * 2 * PI$2 / sides));
9640
+ radian = i * 2 * PI$2 / sides + startRadian;
9641
+ lineTo$2(path, rx + rx * sin$2(radian), ry - ry * cos$2(radian));
9632
9642
  }
9633
9643
  closePath$1(path);
9634
9644
  }
@@ -9639,6 +9649,8 @@ __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
9639
9649
 
9640
9650
  __decorate([ pathType(3) ], Polygon.prototype, "sides", void 0);
9641
9651
 
9652
+ __decorate([ pathType(0) ], Polygon.prototype, "startAngle", void 0);
9653
+
9642
9654
  __decorate([ pathType() ], Polygon.prototype, "points", void 0);
9643
9655
 
9644
9656
  __decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
@@ -9654,12 +9666,17 @@ let Star = class Star extends UI {
9654
9666
  return "Star";
9655
9667
  }
9656
9668
  __updatePath() {
9657
- const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
9669
+ const {width: width, height: height, corners: corners, innerRadius: innerRadius, startAngle: startAngle} = this.__;
9658
9670
  const rx = width / 2, ry = height / 2;
9659
9671
  const path = this.__.path = [];
9660
- moveTo$1(path, rx, 0);
9672
+ let startRadian = 0, radian;
9673
+ if (startAngle) {
9674
+ startRadian = startAngle * OneRadian;
9675
+ moveTo$1(path, rx + rx * sin$1(startRadian), ry - ry * cos$1(startRadian));
9676
+ } else moveTo$1(path, rx, 0);
9661
9677
  for (let i = 1; i < corners * 2; i++) {
9662
- lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin$1(i * PI$1 / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos$1(i * PI$1 / corners));
9678
+ radian = i * PI$1 / corners + startRadian;
9679
+ lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin$1(radian), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos$1(radian));
9663
9680
  }
9664
9681
  closePath(path);
9665
9682
  }
@@ -9671,6 +9688,8 @@ __decorate([ pathType(5) ], Star.prototype, "corners", void 0);
9671
9688
 
9672
9689
  __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
9673
9690
 
9691
+ __decorate([ pathType(0) ], Star.prototype, "startAngle", void 0);
9692
+
9674
9693
  Star = __decorate([ registerUI() ], Star);
9675
9694
 
9676
9695
  const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
@@ -10029,7 +10048,8 @@ let Pen = class Pen extends Group {
10029
10048
  return this;
10030
10049
  }
10031
10050
  paint() {
10032
- if (!this.pathElement.__layout.boxChanged) this.pathElement.forceUpdate("path");
10051
+ const {pathElement: pathElement} = this;
10052
+ if (!pathElement.__layout.boxChanged) pathElement.forceUpdate("path");
10033
10053
  }
10034
10054
  };
10035
10055
 
@@ -10247,7 +10267,7 @@ class UIEvent extends Event {
10247
10267
  }
10248
10268
  }
10249
10269
 
10250
- const {min: min$1, max: max$3, abs: abs$7} = Math, {float: float$3, sign: sign$2} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
10270
+ const {min: min$1, max: max$3, abs: abs$8} = Math, {float: float$3, sign: sign$2} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
10251
10271
 
10252
10272
  const tempContent = new Bounds, tempDragBounds = new Bounds;
10253
10273
 
@@ -10271,7 +10291,7 @@ const DragBoundsHelper = {
10271
10291
  return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
10272
10292
  },
10273
10293
  isInnerMode(content, dragBounds, dragBoundsType, sideType) {
10274
- return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
10294
+ return dragBoundsType === "inner" || dragBoundsType === "auto" && float$3(content[sideType]) > float$3(dragBounds[sideType]);
10275
10295
  },
10276
10296
  getValidMove(content, dragBounds, dragBoundsType, move, change) {
10277
10297
  const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
@@ -10324,7 +10344,7 @@ const DragBoundsHelper = {
10324
10344
  bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
10325
10345
  correctScaleY *= max$3(aScale, bScale);
10326
10346
  if (lockRatio) {
10327
- aScale = max$3(abs$7(correctScaleX), abs$7(correctScaleY));
10347
+ aScale = max$3(abs$8(correctScaleX), abs$8(correctScaleY));
10328
10348
  correctScaleX = sign$2(correctScaleX) * aScale;
10329
10349
  correctScaleY = sign$2(correctScaleY) * aScale;
10330
10350
  }
@@ -11741,6 +11761,8 @@ function stroke(stroke, ui, canvas, renderOptions) {
11741
11761
  if (!data.__strokeWidth) return;
11742
11762
  if (data.__font) {
11743
11763
  Paint.strokeText(stroke, ui, canvas, renderOptions);
11764
+ } else if (data.__pathForStroke) {
11765
+ Paint.fillStroke(stroke, ui, canvas, renderOptions);
11744
11766
  } else {
11745
11767
  switch (data.strokeAlign) {
11746
11768
  case "center":
@@ -12037,12 +12059,12 @@ const PaintModule = {
12037
12059
 
12038
12060
  let cache$1, box$2 = new Bounds;
12039
12061
 
12040
- const {isSame: isSame$1} = BoundsHelper;
12062
+ const {isSame: isSame$2} = BoundsHelper;
12041
12063
 
12042
12064
  function image(ui, attrName, paint, boxBounds, firstUse) {
12043
12065
  let leafPaint, event;
12044
12066
  const image = ImageManager.get(paint, paint.type);
12045
- if (cache$1 && paint === cache$1.paint && isSame$1(boxBounds, cache$1.boxBounds)) {
12067
+ if (cache$1 && paint === cache$1.paint && isSame$2(boxBounds, cache$1.boxBounds)) {
12046
12068
  leafPaint = cache$1.leafPaint;
12047
12069
  } else {
12048
12070
  leafPaint = {
@@ -12333,7 +12355,7 @@ function layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew) {
12333
12355
 
12334
12356
  const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
12335
12357
 
12336
- const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$6} = Math;
12358
+ const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$7} = Math;
12337
12359
 
12338
12360
  function createPatternTask(paint, ui, canvas, renderOptions) {
12339
12361
  if (!paint.patternTask) {
@@ -12357,8 +12379,8 @@ function createPattern(paint, ui, canvas, renderOptions) {
12357
12379
  width *= scaleX;
12358
12380
  height *= scaleY;
12359
12381
  if (gap) {
12360
- xGap = gap.x * scaleX / abs$6(data.scaleX || 1);
12361
- yGap = gap.y * scaleY / abs$6(data.scaleY || 1);
12382
+ xGap = gap.x * scaleX / abs$7(data.scaleX || 1);
12383
+ yGap = gap.y * scaleY / abs$7(data.scaleY || 1);
12362
12384
  }
12363
12385
  if (transform || scaleX !== 1 || scaleY !== 1) {
12364
12386
  scaleX *= getFloorScale(width + (xGap || 0));
@@ -12595,7 +12617,7 @@ const PaintGradientModule = {
12595
12617
  getTransform: getTransform
12596
12618
  };
12597
12619
 
12598
- const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$5} = Math;
12620
+ const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$6} = Math;
12599
12621
 
12600
12622
  const tempBounds$1 = {}, tempMatrix = new Matrix;
12601
12623
 
@@ -12639,7 +12661,7 @@ function shadow$1(ui, current, shape) {
12639
12661
  function getShadowRenderSpread(_ui, shadow) {
12640
12662
  let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
12641
12663
  shadow.forEach(item => {
12642
- x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$5(item.spread || 0);
12664
+ x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$6(item.spread || 0);
12643
12665
  top = max$2(top, spread + blur - y);
12644
12666
  right = max$2(right, spread + blur + x);
12645
12667
  bottom = max$2(bottom, spread + blur + y);
@@ -13480,7 +13502,7 @@ function mergeConfigAttr() {
13480
13502
  };
13481
13503
  }
13482
13504
 
13483
- const {abs: abs$4} = Math;
13505
+ const {abs: abs$5} = Math;
13484
13506
 
13485
13507
  const {copy: copy$2} = MatrixHelper;
13486
13508
 
@@ -13523,7 +13545,7 @@ class Stroker extends UI {
13523
13545
  leaf = list[i];
13524
13546
  const {worldTransform: worldTransform, worldRenderBounds: worldRenderBounds} = leaf;
13525
13547
  if (worldRenderBounds.width && worldRenderBounds.height && (!bounds || bounds.hit(worldRenderBounds, options.matrix))) {
13526
- const aScaleX = abs$4(worldTransform.scaleX), aScaleY = abs$4(worldTransform.scaleY);
13548
+ const aScaleX = abs$5(worldTransform.scaleX), aScaleY = abs$5(worldTransform.scaleY);
13527
13549
  copy$2(matrix$1, worldTransform);
13528
13550
  matrix$1.half = strokeWidth % 2;
13529
13551
  canvas.setWorld(matrix$1, options.matrix);
@@ -13836,7 +13858,7 @@ class EditSelect extends Group {
13836
13858
 
13837
13859
  const {topLeft: topLeft$1, top: top$1, topRight: topRight$1, right: right$2, bottomRight: bottomRight, bottom: bottom$1, bottomLeft: bottomLeft, left: left$2} = Direction9;
13838
13860
 
13839
- const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$3} = Math;
13861
+ const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$4} = Math;
13840
13862
 
13841
13863
  const EditDataHelper = {
13842
13864
  getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
@@ -13922,7 +13944,7 @@ const EditDataHelper = {
13922
13944
  break;
13923
13945
 
13924
13946
  default:
13925
- lockScale = Math.sqrt(abs$3(scaleX * scaleY));
13947
+ lockScale = Math.sqrt(abs$4(scaleX * scaleY));
13926
13948
  scaleX = sign$1(scaleX) * lockScale;
13927
13949
  scaleY = sign$1(scaleY) * lockScale;
13928
13950
  }
@@ -13955,10 +13977,10 @@ const EditDataHelper = {
13955
13977
  const nowHeight = boxBounds.height * target.scaleY;
13956
13978
  scaleY = within$3(nowHeight * scaleY, heightRange) / nowHeight;
13957
13979
  }
13958
- if (useScaleX && abs$3(scaleX * worldBoxBounds.width) < 1) scaleX = sign$1(scaleX) / worldBoxBounds.width;
13959
- if (useScaleY && abs$3(scaleY * worldBoxBounds.height) < 1) scaleY = sign$1(scaleY) / worldBoxBounds.height;
13980
+ if (useScaleX && abs$4(scaleX * worldBoxBounds.width) < 1) scaleX = sign$1(scaleX) / worldBoxBounds.width;
13981
+ if (useScaleY && abs$4(scaleY * worldBoxBounds.height) < 1) scaleY = sign$1(scaleY) / worldBoxBounds.height;
13960
13982
  if (lockRatio && scaleX !== scaleY) {
13961
- lockScale = Math.min(abs$3(scaleX), abs$3(scaleY));
13983
+ lockScale = Math.min(abs$4(scaleX), abs$4(scaleY));
13962
13984
  scaleX = sign$1(scaleX) * lockScale;
13963
13985
  scaleY = sign$1(scaleY) * lockScale;
13964
13986
  }
@@ -15997,10 +16019,22 @@ function scaleResizeFontSize(leaf, scaleX, scaleY, direction) {
15997
16019
  }
15998
16020
  }
15999
16021
  leaf.fontSize *= fontScale;
16000
- const data = leaf.__, {padding: padding} = data;
16022
+ const data = leaf.__, {padding: padding, lineHeight: lineHeight, letterSpacing: letterSpacing} = data;
16001
16023
  if (padding) leaf.padding = isArray(padding) ? padding.map(item => item * fontScale) : padding * fontScale;
16002
16024
  if (!data.__autoWidth) leaf.width *= fontScale;
16003
16025
  if (!data.__autoHeight) leaf.height *= fontScale;
16026
+ if (isObject(lineHeight)) {
16027
+ if (lineHeight.type === "px") data.lineHeight = {
16028
+ type: "px",
16029
+ value: lineHeight.value * fontScale
16030
+ };
16031
+ } else if (lineHeight) data.lineHeight = lineHeight * fontScale;
16032
+ if (isObject(letterSpacing)) {
16033
+ if (letterSpacing.type === "px") data.letterSpacing = {
16034
+ type: "px",
16035
+ value: letterSpacing.value * fontScale
16036
+ };
16037
+ } else if (letterSpacing) data.letterSpacing = letterSpacing * fontScale;
16004
16038
  }
16005
16039
 
16006
16040
  function scaleResizePath(leaf, scaleX, scaleY) {
@@ -16313,7 +16347,7 @@ const MultiTouchHelper = {
16313
16347
 
16314
16348
  const M$4 = MultiTouchHelper;
16315
16349
 
16316
- const {abs: abs$2, max: max$1} = Math, {sign: sign, within: within$2} = MathHelper;
16350
+ const {abs: abs$3, max: max$1} = Math, {sign: sign, within: within$2} = MathHelper;
16317
16351
 
16318
16352
  const WheelEventHelper = {
16319
16353
  getMove(event, config) {
@@ -16323,7 +16357,7 @@ const WheelEventHelper = {
16323
16357
  deltaX = deltaY;
16324
16358
  deltaY = 0;
16325
16359
  }
16326
- const absX = abs$2(deltaX), absY = abs$2(deltaY);
16360
+ const absX = abs$3(deltaX), absY = abs$3(deltaY);
16327
16361
  if (absX > 50) deltaX = max$1(50, absX / 3) * sign(deltaX);
16328
16362
  if (absY > 50) deltaY = max$1(50, absY / 3) * sign(deltaY);
16329
16363
  return {
@@ -16345,7 +16379,7 @@ const WheelEventHelper = {
16345
16379
  if (zoom) {
16346
16380
  zoomSpeed = within$2(zoomSpeed, 0, 1);
16347
16381
  const min = event.deltaY ? config.delta.y : config.delta.x;
16348
- const absScale = within$2(1 - abs$2(delta) / (min * 4) * zoomSpeed, .5, 2);
16382
+ const absScale = within$2(1 - abs$3(delta) / (min * 4) * zoomSpeed, .5, 2);
16349
16383
  scale = delta > 0 ? absScale : 1 / absScale;
16350
16384
  }
16351
16385
  return scale;
@@ -16584,7 +16618,7 @@ interaction.multiTouch = function(data, list) {
16584
16618
 
16585
16619
  const dragger = Dragger.prototype;
16586
16620
 
16587
- const {abs: abs$1, min: min, max: max, hypot: hypot} = Math;
16621
+ const {abs: abs$2, min: min, max: max, hypot: hypot} = Math;
16588
16622
 
16589
16623
  dragger.checkDragEndAnimate = function(data) {
16590
16624
  const {interaction: interaction} = this;
@@ -16613,7 +16647,7 @@ dragger.checkDragEndAnimate = function(data) {
16613
16647
  moveX *= boost;
16614
16648
  moveY *= boost;
16615
16649
  }
16616
- const maxAbs = max(abs$1(moveX), abs$1(moveY));
16650
+ const maxAbs = max(abs$2(moveX), abs$2(moveY));
16617
16651
  if (maxAbs > maxMove) {
16618
16652
  s = maxMove / maxAbs;
16619
16653
  moveX *= s;
@@ -16623,7 +16657,7 @@ dragger.checkDragEndAnimate = function(data) {
16623
16657
  moveX *= inertia;
16624
16658
  moveY *= inertia;
16625
16659
  data = Object.assign({}, data);
16626
- if (abs$1(moveX) < stopMove && abs$1(moveY) < stopMove) return this.dragEndReal(data);
16660
+ if (abs$2(moveX) < stopMove && abs$2(moveY) < stopMove) return this.dragEndReal(data);
16627
16661
  PointHelper.move(data, moveX, moveY);
16628
16662
  this.drag(data);
16629
16663
  this.animate(step);
@@ -17213,7 +17247,7 @@ function getArrowPath(ui, arrow, from, to, size, connectOffset, hasDashPattern)
17213
17247
 
17214
17248
  const {M: M$2, L: L$2, C: C$2, Q: Q, Z: Z$2, N: N, D: D, X: X, G: G, F: F, O: O, P: P, U: U} = PathCommandMap;
17215
17249
 
17216
- const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame} = PointHelper;
17250
+ const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame$1} = PointHelper;
17217
17251
 
17218
17252
  const {stintSet: stintSet$1} = DataHelper;
17219
17253
 
@@ -17307,7 +17341,7 @@ const PathArrowModule = {
17307
17341
  }
17308
17342
  count++;
17309
17343
  if (count === 1 && command !== M$2) return;
17310
- if (count === 2 && useStartArrow) copy(second, command === L$2 ? now : isSame(old, first) ? last : old);
17344
+ if (count === 2 && useStartArrow) copy(second, command === L$2 ? now : isSame$1(old, first) ? last : old);
17311
17345
  if (i === len) {
17312
17346
  const path = uData.__pathForRender = clonePathForArrow ? [ ...data ] : data;
17313
17347
  if (useStartArrow) {
@@ -17321,7 +17355,7 @@ const PathArrowModule = {
17321
17355
  }
17322
17356
  }
17323
17357
  if (endArrow && endArrow !== "none") {
17324
- if (isSame(last, now)) copy(last, old);
17358
+ if (isSame$1(last, now)) copy(last, old);
17325
17359
  endArrowPath = getArrowPath(ui, endArrow, last, now, strokeWidth, connectPoint, !!dashPattern);
17326
17360
  singleEndArrow = endArrowPath.fill || dashPattern;
17327
17361
  if (!singleEndArrow) path.push(...endArrowPath.data);
@@ -17937,7 +17971,7 @@ box$1.__updateBoxBounds = function(secondLayout) {
17937
17971
  }
17938
17972
  };
17939
17973
 
17940
- const {cos: cos, sin: sin, pow: pow, sqrt: sqrt$1, abs: abs, ceil: ceil, floor: floor, round: round$2, PI: PI} = Math;
17974
+ const {cos: cos, sin: sin, pow: pow, sqrt: sqrt$1, abs: abs$1, ceil: ceil, floor: floor, round: round$2, PI: PI} = Math;
17941
17975
 
17942
17976
  const PIx5 = PI * 5;
17943
17977
 
@@ -17975,7 +18009,7 @@ function cubicBezier(x1, y1, x2, y2) {
17975
18009
  o = 1 - v;
17976
18010
  x = bezier(v, x1, x2) - t;
17977
18011
  dx = 3 * o * o * x1 + 6 * o * v * (x2 - x1) + 3 * v * v * (1 - x2);
17978
- if (abs(dx) < 1e-6) break;
18012
+ if (abs$1(dx) < 1e-6) break;
17979
18013
  v -= x / dx;
17980
18014
  }
17981
18015
  return cache[key] = bezier(v, y1, y2);
@@ -20834,7 +20868,7 @@ function getCorrectT(d, x, y, x1, y1, x2, y2, toX, toY) {
20834
20868
  return Math.max(0, Math.min(.5, t));
20835
20869
  }
20836
20870
 
20837
- const {M: M, L: L, C: C, Z: Z} = PathCommandMap;
20871
+ const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {abs: abs} = Math;
20838
20872
 
20839
20873
  const {getCenterX: getCenterX, getCenterY: getCenterY} = PointHelper;
20840
20874
 
@@ -20842,7 +20876,7 @@ const {arcTo: arcTo} = PathCommandDataHelper;
20842
20876
 
20843
20877
  PathCorner.smooth = function smooth(data, cornerRadius, _cornerSmoothing) {
20844
20878
  const radius = data.radius;
20845
- if (isNeedConvert(data)) data = PathConvert.toCanvasData(data, true);
20879
+ if (isNeedConvert(data)) data = PathConvert.toCanvasData(data, true); else data = [ ...data ];
20846
20880
  let command, lastCommand, commandLen;
20847
20881
  let i = 0, countCommand = 0, x = 0, y = 0, startX = 0, startY = 0, startR = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0, r, x1, y1, x2, y2, toX, toY;
20848
20882
  if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
@@ -20928,6 +20962,9 @@ PathCorner.smooth = function smooth(data, cornerRadius, _cornerSmoothing) {
20928
20962
  toX = startX, toY = startY;
20929
20963
  setBeforeC(smooth, r, lastX, lastY, x1, y1, x2, y2, x, y, toX, toY, three);
20930
20964
  break;
20965
+
20966
+ default:
20967
+ smooth.push(C, x1, y1, x2, y2, x, y);
20931
20968
  }
20932
20969
  lastX = x;
20933
20970
  lastY = y;
@@ -21017,7 +21054,16 @@ function findEndPoint(data, i) {
21017
21054
  }
21018
21055
 
21019
21056
  function setAfterC(data, i, cornerRadius, lastX, lastY, fromX, fromY, x1, y1, x2, y2, toX, toY) {
21020
- const d = getTangentDistance(cornerRadius, fromX, fromY, lastX, lastY, x1, y1);
21057
+ let targetX = x1, targetY = y1;
21058
+ if (isSame(x1, fromX) && isSame(y1, fromY)) {
21059
+ targetX = x2;
21060
+ targetY = y2;
21061
+ if (isSame(x2, fromX) && isSame(y2, fromY)) {
21062
+ targetX = toX;
21063
+ targetY = toY;
21064
+ }
21065
+ }
21066
+ const d = getTangentDistance(cornerRadius, fromX, fromY, lastX, lastY, targetX, targetY);
21021
21067
  const t = getCorrectT(d, fromX, fromY, x1, y1, x2, y2, toX, toY);
21022
21068
  const two = BezierHelper.cut(t, fromX, fromY, x1, y1, x2, y2, toX, toY);
21023
21069
  const {left: left, right: right} = two;
@@ -21031,7 +21077,16 @@ function setAfterC(data, i, cornerRadius, lastX, lastY, fromX, fromY, x1, y1, x2
21031
21077
  }
21032
21078
 
21033
21079
  function setBeforeC(smooth, cornerRadius, fromX, fromY, x1, y1, x2, y2, toX, toY, nextX, nextY, three) {
21034
- const d = getTangentDistance(cornerRadius, toX, toY, x2, y2, nextX, nextY);
21080
+ let targetX = x2, targetY = y2;
21081
+ if (isSame(targetX, toX) && isSame(targetY, toY)) {
21082
+ targetX = x1;
21083
+ targetY = y1;
21084
+ if (isSame(targetX, toX) && isSame(targetY, toY)) {
21085
+ targetX = fromX;
21086
+ targetY = fromY;
21087
+ }
21088
+ }
21089
+ const d = getTangentDistance(cornerRadius, toX, toY, targetX, targetY, nextX, nextY);
21035
21090
  const t = getCorrectT(d, toX, toY, x2, y2, x1, y1, fromX, fromY);
21036
21091
  const {left: left, right: right} = BezierHelper.cut(1 - t, fromX, fromY, x1, y1, x2, y2, toX, toY);
21037
21092
  if (left && right) {
@@ -21042,6 +21097,10 @@ function setBeforeC(smooth, cornerRadius, fromX, fromY, x1, y1, x2, y2, toX, toY
21042
21097
  }
21043
21098
  }
21044
21099
 
21100
+ function isSame(a, b) {
21101
+ return abs(a - b) < .01;
21102
+ }
21103
+
21045
21104
  Plugin.add("corner");
21046
21105
 
21047
21106
  export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseBox, EllipseBoxData, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageBox, ImageBoxData, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferTypeCreator, LeaferVideo, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathBox, PathBoxData, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonBox, PolygonBoxData, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarBox, StarBoxData, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$3 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$4 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };