@visactor/vrender 0.15.5 → 0.15.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.
Files changed (49) hide show
  1. package/cjs/allocator/canvas-allocate.js +1 -2
  2. package/cjs/animate/default-ticker.js +2 -1
  3. package/cjs/common/segment/monotone.js +2 -2
  4. package/cjs/common/segment/monotone.js.map +1 -1
  5. package/cjs/core/application.js +2 -1
  6. package/cjs/core/camera.js +1 -1
  7. package/cjs/core/constants.js +1 -1
  8. package/cjs/core/core-modules.js +1 -1
  9. package/cjs/core/global-module.js +2 -0
  10. package/cjs/core/global.js +1 -1
  11. package/cjs/core/graphic-utils.js +1 -1
  12. package/cjs/core/index.js +1 -1
  13. package/cjs/graphic/arc.js +1 -2
  14. package/cjs/graphic/arc3d.js +1 -1
  15. package/cjs/graphic/area.js +1 -1
  16. package/cjs/graphic/bounds.js +1 -1
  17. package/cjs/graphic/circle.js +1 -1
  18. package/cjs/graphic/config.js +1 -1
  19. package/cjs/graphic/constants.js +1 -1
  20. package/cjs/graphic/glyph.js +1 -1
  21. package/cjs/index.d.ts +1 -1
  22. package/cjs/index.js +1 -1
  23. package/cjs/index.js.map +1 -1
  24. package/dist/index.js +3 -3
  25. package/dist/index.min.js +1 -1
  26. package/es/allocator/canvas-allocate.js +1 -2
  27. package/es/animate/default-ticker.js +2 -1
  28. package/es/common/segment/monotone.js +2 -2
  29. package/es/common/segment/monotone.js.map +1 -1
  30. package/es/core/application.js +2 -1
  31. package/es/core/camera.js +1 -1
  32. package/es/core/constants.js +1 -1
  33. package/es/core/core-modules.js +1 -1
  34. package/es/core/global-module.js +2 -0
  35. package/es/core/global.js +1 -1
  36. package/es/core/graphic-utils.js +1 -1
  37. package/es/core/index.js +1 -1
  38. package/es/graphic/arc.js +1 -2
  39. package/es/graphic/arc3d.js +1 -1
  40. package/es/graphic/area.js +1 -1
  41. package/es/graphic/bounds.js +1 -1
  42. package/es/graphic/circle.js +1 -1
  43. package/es/graphic/config.js +1 -1
  44. package/es/graphic/constants.js +1 -1
  45. package/es/graphic/glyph.js +1 -1
  46. package/es/index.d.ts +1 -1
  47. package/es/index.js +1 -1
  48. package/es/index.js.map +1 -1
  49. package/package.json +3 -3
@@ -42,5 +42,4 @@ class DefaultCanvasAllocate {
42
42
  }
43
43
  }
44
44
 
45
- exports.DefaultCanvasAllocate = DefaultCanvasAllocate, exports.canvasAllocate = new DefaultCanvasAllocate;
46
- //# sourceMappingURL=canvas-allocate.js.map
45
+ exports.DefaultCanvasAllocate = DefaultCanvasAllocate, exports.canvasAllocate = new DefaultCanvasAllocate;
@@ -10,4 +10,5 @@ exports.defaultTicker = new default_ticker_1.DefaultTicker, exports.defaultTicke
10
10
 
11
11
  const TICKER_FPS = 60;
12
12
 
13
- exports.defaultTicker.setFPS(60);
13
+ exports.defaultTicker.setFPS(60);
14
+ //# sourceMappingURL=default-ticker.js.map
@@ -41,11 +41,11 @@ class MonotoneX {
41
41
  lineEnd() {
42
42
  switch (this._point) {
43
43
  case 2:
44
- this.context.lineTo(this._x1, this._y1, !1 !== this._lastDefined2, this.lastPoint1);
44
+ this.context.lineTo(this._x1, this._y1, !1 !== this._lastDefined1 && !1 !== this._lastDefined2, this.lastPoint1);
45
45
  break;
46
46
 
47
47
  case 3:
48
- point(this, this._t0, slope2(this, this._t0), !1 !== this._lastDefined2, this.lastPoint1);
48
+ point(this, this._t0, slope2(this, this._t0), !1 !== this._lastDefined1 && !1 !== this._lastDefined2, this.lastPoint1);
49
49
  }
50
50
  (this._line || 0 !== this._line && 1 === this._point) && this.context.closePath(),
51
51
  this._line = 1 - this._line;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/common/segment/monotone.ts"],"names":[],"mappings":";;;AACA,6CAAuC;AACvC,qCAA6C;AAC7C,qCAA4C;AAC5C,gDAA+D;AAC/D,oCAAqC;AAsBrC,SAAS,IAAI,CAAC,CAAS;IACrB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,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CAAC,CAAC,CAAC;QAC9F,CAAC,CAAC,iBAAS,CAAC,GAAG;QACf,CAAC,CAAC,iBAAS,CAAC,MAAM,CAAC,CACxB,CAAC;IACF,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAExD,wBAAwB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAE5C,OAAO,UAAU,CAAC;AACpB,CAAC;AApBD,oDAoBC","file":"monotone.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\nimport { abs } from '@visactor/vutils';\nimport { genLinearSegments } from './linear';\nimport { genCurveSegments } from './common';\nimport { ReflectSegContext, SegContext } from '../seg-context';\nimport { Direction } from '../enums';\nimport type { ICurvedSegment, IGenSegmentParams, ISegPath2D } from '../../interface/curve';\n\n/**\n * 部分源码参考 https://github.com/d3/d3-shape/\n * Copyright 2010-2022 Mike Bostock\n\n Permission to use, copy, modify, and/or distribute this software for any purpose\n with or without fee is hereby granted, provided that the above copyright notice\n and this permission notice appear in all copies.\n\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS\n OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER\n TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF\n THIS SOFTWARE.\n */\n\n// 基于d3-shape重构\n// https://github.com/d3/d3-shape/blob/main/src/curve/monotone.js\nfunction sign(x: number): number {\n return x < 0 ? -1 : 1;\n}\n\n// Calculate the slopes of the tangents (Hermite-type interpolation) based on\n// the following paper: Steffen, M. 1990. A Simple Method for Monotonic\n// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.\n// NOV(II), P. 443, 1990.\nfunction slope3(curveClass: MonotoneX | MonotoneY, x2: number, y2: number) {\n const h0 = curveClass._x1 - curveClass._x0;\n const h1 = x2 - curveClass._x1;\n const s0 = (curveClass._y1 - curveClass._y0) / (h0 || Number(h1 < 0 && -0));\n const s1 = (y2 - curveClass._y1) / (h1 || Number(h0 < 0 && -0));\n const p = (s0 * h1 + s1 * h0) / (h0 + h1);\n return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n}\n\n// Calculate a one-sided slope.\nfunction slope2(curveClass: MonotoneX | MonotoneY, t: number) {\n const h = curveClass._x1 - curveClass._x0;\n return h ? ((3 * (curveClass._y1 - curveClass._y0)) / h - t) / 2 : t;\n}\n\n// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations\n// \"you can express cubic Hermite interpolation in terms of cubic Bézier curves\n// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1\".\nfunction point(curveClass: MonotoneX | MonotoneY, t0: number, t1: number, defined: boolean, p: IPointLike) {\n const x0 = curveClass._x0;\n const y0 = curveClass._y0;\n const x1 = curveClass._x1;\n const y1 = curveClass._y1;\n const dx = (x1 - x0) / 3;\n curveClass.context.bezierCurveTo(\n x0 + dx,\n y0 + dx * t0,\n x1 - dx,\n y1 - dx * t1,\n x1,\n y1,\n defined,\n curveClass.lastPoint1\n );\n}\n\nexport class MonotoneX implements ICurvedSegment {\n protected _lastDefined1?: boolean;\n protected _lastDefined2?: boolean;\n declare context: ISegPath2D;\n declare _t0: number;\n\n protected startPoint?: IPointLike;\n lastPoint0?: IPointLike;\n lastPoint1?: IPointLike;\n\n constructor(context: ISegPath2D, startPoint?: IPointLike) {\n this.context = context;\n this.startPoint = startPoint;\n }\n _x: number;\n _y: number;\n _x0: number;\n _x1: number;\n _y0: number;\n _y1: number;\n _line: number;\n _point: number;\n\n areaStart() {\n this._line = 0;\n }\n areaEnd() {\n this._line = NaN;\n }\n lineStart() {\n this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN;\n this._point = 0;\n this.startPoint && this.point(this.startPoint);\n }\n lineEnd() {\n switch (this._point) {\n case 2:\n this.context.lineTo(this._x1, this._y1, this._lastDefined2 !== false, this.lastPoint1);\n break;\n case 3:\n point(this, this._t0, slope2(this, this._t0), this._lastDefined2 !== false, this.lastPoint1);\n break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) {\n this.context.closePath();\n }\n this._line = 1 - this._line;\n }\n point(p: IPointLike): void {\n let t1 = NaN;\n const x = p.x;\n const y = p.y;\n if (x === this._x1 && y === this._y1) {\n return;\n } // Ignore coincident points.\n switch (this._point) {\n case 0:\n this._point = 1;\n this._line\n ? this.context.lineTo(x, y, this._lastDefined1 !== false && this._lastDefined2 !== false, p)\n : this.context.moveTo(x, y, p);\n break;\n case 1:\n this._point = 2;\n break;\n case 2:\n this._point = 3;\n point(\n this,\n slope2(this, (t1 = slope3(this, x, y))),\n t1,\n this._lastDefined1 !== false && this._lastDefined2 !== false,\n p\n );\n break;\n default:\n point(\n this,\n this._t0,\n (t1 = slope3(this, x, y)),\n this._lastDefined1 !== false && this._lastDefined2 !== false,\n p\n );\n break;\n }\n\n (this._x0 = this._x1), (this._x1 = x);\n (this._y0 = this._y1), (this._y1 = y);\n this._t0 = t1;\n this._lastDefined1 = this._lastDefined2;\n this._lastDefined2 = p.defined !== false;\n this.lastPoint0 = this.lastPoint1;\n this.lastPoint1 = p;\n }\n\n tryUpdateLength(): number {\n return this.context.tryUpdateLength();\n }\n}\n\nexport class MonotoneY extends MonotoneX {\n declare context: ISegPath2D;\n\n protected declare startPoint?: IPointLike;\n\n constructor(context: ISegPath2D, startPoint?: IPointLike) {\n super(context, startPoint);\n }\n\n point(p: IPointLike): void {\n return super.point({ y: p.x, x: p.y, defined: p.defined } as any);\n }\n}\n\nexport function genMonotpneXTypeSegments(path: MonotoneX, points: IPointLike[]): void {\n return genCurveSegments(path, points, 2);\n}\n\nexport function genMonotoneXSegments(points: IPointLike[], params: IGenSegmentParams = {}): ISegPath2D | null {\n const { direction, startPoint } = params;\n\n if (points.length < 2 - Number(!!startPoint)) {\n return null;\n }\n if (points.length < 3 - Number(!!startPoint)) {\n return genLinearSegments(points, params);\n }\n const segContext = new SegContext(\n 'monotoneX',\n direction ??\n (abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y)\n ? Direction.ROW\n : Direction.COLUMN)\n );\n const monotoneX = new MonotoneX(segContext, startPoint);\n\n genMonotpneXTypeSegments(monotoneX, points);\n\n return segContext;\n}\n\nexport function genMonotpneYTypeSegments(path: MonotoneX, points: IPointLike[]): void {\n return genCurveSegments(path, points, 2);\n}\n\nexport function genMonotoneYSegments(points: IPointLike[], params: IGenSegmentParams = {}): ISegPath2D | null {\n const { direction, startPoint } = params;\n if (points.length < 2 - Number(!!startPoint)) {\n return null;\n }\n if (points.length < 3 - Number(!!startPoint)) {\n return genLinearSegments(points, params);\n }\n const segContext = new ReflectSegContext(\n 'monotoneY',\n direction ??\n (abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y)\n ? Direction.ROW\n : Direction.COLUMN)\n );\n const monotoneY = new MonotoneY(segContext, startPoint);\n\n genMonotpneYTypeSegments(monotoneY, points);\n\n return segContext;\n}\n"]}
1
+ {"version":3,"sources":["../src/common/segment/monotone.ts"],"names":[],"mappings":";;;AACA,6CAAuC;AACvC,qCAA6C;AAC7C,qCAA4C;AAC5C,gDAA+D;AAC/D,oCAAqC;AAsBrC,SAAS,IAAI,CAAC,CAAS;IACrB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC;AAMD,SAAS,MAAM,CAAC,UAAiC,EAAE,EAAU,EAAE,EAAU;IACvE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,GAAG,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,CAAC,CACxB,CAAC;IACF,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAExD,wBAAwB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAE5C,OAAO,UAAU,CAAC;AACpB,CAAC;AApBD,oDAoBC","file":"monotone.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\nimport { abs } from '@visactor/vutils';\nimport { genLinearSegments } from './linear';\nimport { genCurveSegments } from './common';\nimport { ReflectSegContext, SegContext } from '../seg-context';\nimport { Direction } from '../enums';\nimport type { ICurvedSegment, IGenSegmentParams, ISegPath2D } from '../../interface/curve';\n\n/**\n * 部分源码参考 https://github.com/d3/d3-shape/\n * Copyright 2010-2022 Mike Bostock\n\n Permission to use, copy, modify, and/or distribute this software for any purpose\n with or without fee is hereby granted, provided that the above copyright notice\n and this permission notice appear in all copies.\n\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\n FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS\n OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER\n TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF\n THIS SOFTWARE.\n */\n\n// 基于d3-shape重构\n// https://github.com/d3/d3-shape/blob/main/src/curve/monotone.js\nfunction sign(x: number): number {\n return x < 0 ? -1 : 1;\n}\n\n// Calculate the slopes of the tangents (Hermite-type interpolation) based on\n// the following paper: Steffen, M. 1990. A Simple Method for Monotonic\n// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.\n// NOV(II), P. 443, 1990.\nfunction slope3(curveClass: MonotoneX | MonotoneY, x2: number, y2: number) {\n const h0 = curveClass._x1 - curveClass._x0;\n const h1 = x2 - curveClass._x1;\n const s0 = (curveClass._y1 - curveClass._y0) / (h0 || Number(h1 < 0 && -0));\n const s1 = (y2 - curveClass._y1) / (h1 || Number(h0 < 0 && -0));\n const p = (s0 * h1 + s1 * h0) / (h0 + h1);\n return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n}\n\n// Calculate a one-sided slope.\nfunction slope2(curveClass: MonotoneX | MonotoneY, t: number) {\n const h = curveClass._x1 - curveClass._x0;\n return h ? ((3 * (curveClass._y1 - curveClass._y0)) / h - t) / 2 : t;\n}\n\n// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations\n// \"you can express cubic Hermite interpolation in terms of cubic Bézier curves\n// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1\".\nfunction point(curveClass: MonotoneX | MonotoneY, t0: number, t1: number, defined: boolean, p: IPointLike) {\n const x0 = curveClass._x0;\n const y0 = curveClass._y0;\n const x1 = curveClass._x1;\n const y1 = curveClass._y1;\n const dx = (x1 - x0) / 3;\n curveClass.context.bezierCurveTo(\n x0 + dx,\n y0 + dx * t0,\n x1 - dx,\n y1 - dx * t1,\n x1,\n y1,\n defined,\n curveClass.lastPoint1\n );\n}\n\nexport class MonotoneX implements ICurvedSegment {\n protected _lastDefined1?: boolean;\n protected _lastDefined2?: boolean;\n declare context: ISegPath2D;\n declare _t0: number;\n\n protected startPoint?: IPointLike;\n lastPoint0?: IPointLike;\n lastPoint1?: IPointLike;\n\n constructor(context: ISegPath2D, startPoint?: IPointLike) {\n this.context = context;\n this.startPoint = startPoint;\n }\n _x: number;\n _y: number;\n _x0: number;\n _x1: number;\n _y0: number;\n _y1: number;\n _line: number;\n _point: number;\n\n areaStart() {\n this._line = 0;\n }\n areaEnd() {\n this._line = NaN;\n }\n lineStart() {\n this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN;\n this._point = 0;\n this.startPoint && this.point(this.startPoint);\n }\n lineEnd() {\n switch (this._point) {\n case 2:\n this.context.lineTo(\n this._x1,\n this._y1,\n this._lastDefined1 !== false && this._lastDefined2 !== false,\n this.lastPoint1\n );\n break;\n case 3:\n point(\n this,\n this._t0,\n slope2(this, this._t0),\n this._lastDefined1 !== false && this._lastDefined2 !== false,\n this.lastPoint1\n );\n break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) {\n this.context.closePath();\n }\n this._line = 1 - this._line;\n }\n point(p: IPointLike): void {\n let t1 = NaN;\n const x = p.x;\n const y = p.y;\n if (x === this._x1 && y === this._y1) {\n return;\n } // Ignore coincident points.\n switch (this._point) {\n case 0:\n this._point = 1;\n this._line\n ? this.context.lineTo(x, y, this._lastDefined1 !== false && this._lastDefined2 !== false, p)\n : this.context.moveTo(x, y, p);\n break;\n case 1:\n this._point = 2;\n break;\n case 2:\n this._point = 3;\n point(\n this,\n slope2(this, (t1 = slope3(this, x, y))),\n t1,\n this._lastDefined1 !== false && this._lastDefined2 !== false,\n p\n );\n break;\n default:\n point(\n this,\n this._t0,\n (t1 = slope3(this, x, y)),\n this._lastDefined1 !== false && this._lastDefined2 !== false,\n p\n );\n break;\n }\n\n (this._x0 = this._x1), (this._x1 = x);\n (this._y0 = this._y1), (this._y1 = y);\n this._t0 = t1;\n this._lastDefined1 = this._lastDefined2;\n this._lastDefined2 = p.defined !== false;\n this.lastPoint0 = this.lastPoint1;\n this.lastPoint1 = p;\n }\n\n tryUpdateLength(): number {\n return this.context.tryUpdateLength();\n }\n}\n\nexport class MonotoneY extends MonotoneX {\n declare context: ISegPath2D;\n\n protected declare startPoint?: IPointLike;\n\n constructor(context: ISegPath2D, startPoint?: IPointLike) {\n super(context, startPoint);\n }\n\n point(p: IPointLike): void {\n return super.point({ y: p.x, x: p.y, defined: p.defined } as any);\n }\n}\n\nexport function genMonotpneXTypeSegments(path: MonotoneX, points: IPointLike[]): void {\n return genCurveSegments(path, points, 2);\n}\n\nexport function genMonotoneXSegments(points: IPointLike[], params: IGenSegmentParams = {}): ISegPath2D | null {\n const { direction, startPoint } = params;\n\n if (points.length < 2 - Number(!!startPoint)) {\n return null;\n }\n if (points.length < 3 - Number(!!startPoint)) {\n return genLinearSegments(points, params);\n }\n const segContext = new SegContext(\n 'monotoneX',\n direction ??\n (abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y)\n ? Direction.ROW\n : Direction.COLUMN)\n );\n const monotoneX = new MonotoneX(segContext, startPoint);\n\n genMonotpneXTypeSegments(monotoneX, points);\n\n return segContext;\n}\n\nexport function genMonotpneYTypeSegments(path: MonotoneX, points: IPointLike[]): void {\n return genCurveSegments(path, points, 2);\n}\n\nexport function genMonotoneYSegments(points: IPointLike[], params: IGenSegmentParams = {}): ISegPath2D | null {\n const { direction, startPoint } = params;\n if (points.length < 2 - Number(!!startPoint)) {\n return null;\n }\n if (points.length < 3 - Number(!!startPoint)) {\n return genLinearSegments(points, params);\n }\n const segContext = new ReflectSegContext(\n 'monotoneY',\n direction ??\n (abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y)\n ? Direction.ROW\n : Direction.COLUMN)\n );\n const monotoneY = new MonotoneY(segContext, startPoint);\n\n genMonotpneYTypeSegments(monotoneY, points);\n\n return segContext;\n}\n"]}
@@ -2,4 +2,5 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.ApplicationContribution = void 0, exports.ApplicationContribution = Symbol("ApplicationContribution");
5
+ }), exports.ApplicationContribution = void 0, exports.ApplicationContribution = Symbol("ApplicationContribution");
6
+ //# sourceMappingURL=application.js.map
@@ -122,4 +122,4 @@ class OrthoCamera {
122
122
  }
123
123
 
124
124
  exports.OrthoCamera = OrthoCamera;
125
- //# sourceMappingURL=camera.js.map
125
+ //# sourceMappingURL=camera.js.map
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  }), exports.LayerService = exports.GraphicUtil = exports.TransformUtil = void 0,
6
6
  exports.TransformUtil = Symbol.for("TransformUtil"), exports.GraphicUtil = Symbol.for("GraphicUtil"),
7
7
  exports.LayerService = Symbol.for("LayerService");
8
- //# sourceMappingURL=constants.js.map
8
+ //# sourceMappingURL=constants.js.map
@@ -13,4 +13,4 @@ exports.default = new inversify_1.ContainerModule((bind => {
13
13
  bind(graphic_utils_1.DefaultTransformUtil).toSelf().inSingletonScope(), bind(constants_1.TransformUtil).toService(graphic_utils_1.DefaultTransformUtil),
14
14
  bind(layer_service_1.DefaultLayerService).toSelf().inSingletonScope(), bind(constants_1.LayerService).toService(layer_service_1.DefaultLayerService);
15
15
  }));
16
- //# sourceMappingURL=core-modules.js.map
16
+ //# sourceMappingURL=core-modules.js.map
@@ -1 +1,3 @@
1
+
2
+
1
3
  //# sourceMappingURL=global-module.js.map
@@ -157,4 +157,4 @@ let DefaultGlobal = class {
157
157
  DefaultGlobal = __decorate([ (0, inversify_1.injectable)(), __param(0, (0, inversify_1.inject)(contribution_provider_1.ContributionProvider)), __param(0, (0,
158
158
  inversify_1.named)(constants_1.EnvContribution)), __metadata("design:paramtypes", [ Object ]) ], DefaultGlobal),
159
159
  exports.DefaultGlobal = DefaultGlobal;
160
- //# sourceMappingURL=global.js.map
160
+ //# sourceMappingURL=global.js.map
@@ -136,4 +136,4 @@ let DefaultTransformUtil = class {
136
136
 
137
137
  DefaultTransformUtil = __decorate([ (0, inversify_1.injectable)(), __metadata("design:paramtypes", []) ], DefaultTransformUtil),
138
138
  exports.DefaultTransformUtil = DefaultTransformUtil;
139
- //# sourceMappingURL=graphic-utils.js.map
139
+ //# sourceMappingURL=graphic-utils.js.map
package/cjs/core/index.js CHANGED
@@ -22,4 +22,4 @@ __exportStar(require("./layer"), exports), __exportStar(require("./stage"), expo
22
22
  __exportStar(require("./graphic-utils"), exports), __exportStar(require("./contributions"), exports),
23
23
  __exportStar(require("./layer-service"), exports), __exportStar(require("./constants"), exports),
24
24
  __exportStar(require("../interface/core"), exports);
25
- //# sourceMappingURL=index.js.map
25
+ //# sourceMappingURL=index.js.map
@@ -137,5 +137,4 @@ class Arc extends graphic_1.Graphic {
137
137
 
138
138
  exports.Arc = Arc, Arc.NOWORK_ANIMATE_ATTR = Object.assign({
139
139
  cap: 1
140
- }, graphic_1.NOWORK_ANIMATE_ATTR);
141
- //# sourceMappingURL=arc.js.map
140
+ }, graphic_1.NOWORK_ANIMATE_ATTR);
@@ -27,4 +27,4 @@ class Arc3d extends arc_1.Arc {
27
27
  exports.Arc3d = Arc3d, Arc3d.NOWORK_ANIMATE_ATTR = Object.assign({
28
28
  cap: 1
29
29
  }, graphic_1.NOWORK_ANIMATE_ATTR);
30
- //# sourceMappingURL=arc3d.js.map
30
+ //# sourceMappingURL=arc3d.js.map
@@ -82,4 +82,4 @@ exports.Area = Area, Area.NOWORK_ANIMATE_ATTR = Object.assign({
82
82
  segments: 1,
83
83
  curveType: 1
84
84
  }, graphic_1.NOWORK_ANIMATE_ATTR);
85
- //# sourceMappingURL=area.js.map
85
+ //# sourceMappingURL=area.js.map
@@ -21,4 +21,4 @@ function getRichTextBounds(params) {
21
21
  }
22
22
 
23
23
  exports.getRichTextBounds = getRichTextBounds;
24
- //# sourceMappingURL=bounds.js.map
24
+ //# sourceMappingURL=bounds.js.map
@@ -61,4 +61,4 @@ class Circle extends graphic_1.Graphic {
61
61
  }
62
62
 
63
63
  exports.Circle = Circle, Circle.NOWORK_ANIMATE_ATTR = graphic_1.NOWORK_ANIMATE_ATTR;
64
- //# sourceMappingURL=circle.js.map
64
+ //# sourceMappingURL=circle.js.map
@@ -230,4 +230,4 @@ exports.DefaultArcAttribute = Object.assign(Object.assign({}, exports.DefaultAtt
230
230
  backgroundRadius: 4,
231
231
  opacity: 1
232
232
  });
233
- //# sourceMappingURL=config.js.map
233
+ //# sourceMappingURL=config.js.map
@@ -36,4 +36,4 @@ exports.GraphicCreator = Symbol.for("GraphicCreator"), exports.SVG_ATTRIBUTE_MAP
36
36
  "@_stroke": "stroke",
37
37
  "@_fill": "fill"
38
38
  }, exports.SVG_PARSE_ATTRIBUTE_MAP_KEYS = Object.keys(exports.SVG_PARSE_ATTRIBUTE_MAP);
39
- //# sourceMappingURL=constants.js.map
39
+ //# sourceMappingURL=constants.js.map
@@ -120,4 +120,4 @@ class Glyph extends graphic_1.Graphic {
120
120
  }
121
121
 
122
122
  exports.Glyph = Glyph, Glyph.NOWORK_ANIMATE_ATTR = graphic_1.NOWORK_ANIMATE_ATTR;
123
- //# sourceMappingURL=glyph.js.map
123
+ //# sourceMappingURL=glyph.js.map
package/cjs/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import 'core-js/proposals/reflect-metadata';
2
2
  import './modules';
3
- export declare const version = "0.15.5";
3
+ export declare const version = "0.15.6";
4
4
  export * from './container';
5
5
  export * from './core/global';
6
6
  export * from './graphic';
package/cjs/index.js CHANGED
@@ -18,7 +18,7 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
18
18
  Object.defineProperty(exports, "__esModule", {
19
19
  value: !0
20
20
  }), exports.wrapContext = exports.wrapCanvas = exports.version = void 0, require("core-js/proposals/reflect-metadata"),
21
- require("./modules"), exports.version = "0.15.5", __exportStar(require("./container"), exports),
21
+ require("./modules"), exports.version = "0.15.6", __exportStar(require("./container"), exports),
22
22
  __exportStar(require("./core/global"), exports), __exportStar(require("./graphic"), exports),
23
23
  __exportStar(require("./modules"), exports), __exportStar(require("./create"), exports),
24
24
  __exportStar(require("./event"), exports), __exportStar(require("./interface"), exports),
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,8CAA4C;AAC5C,qBAAmB;AAGN,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,8CAA4B;AAC5B,gDAA8B;AAC9B,4CAA0B;AAC1B,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,4EAA0D;AAC1D,2CAAyB;AACzB,yCAAuB;AACvB,2CAAyB;AACzB,yCAAuB;AACvB,4CAA0B;AAC1B,2DAAyC;AAGzC,gDAA8B;AAC9B,wDAAsC;AACtC,0DAAwC;AACxC,uDAAqC;AACrC,yDAAuC;AACvC,mDAAiC;AACjC,wDAAsC;AACtC,iEAA+C;AAC/C,qDAAmC;AACnC,iDAA+B;AAC/B,qDAAmC;AACnC,sDAAoC;AAEpC,oDAAkC;AAClC,wDAAsC;AACtC,uDAAqC;AACrC,+DAA6C;AAC7C,gDAA8B;AAC9B,0DAAwC;AACxC,sDAAoC;AACpC,iDAA+B;AAC/B,qDAAmC;AACnC,sDAAoC;AACpC,8DAA4C;AAE5C,2DAAyC;AACzC,sCAAwD;AAA/C,kGAAA,UAAU,OAAA;AAAE,mGAAA,WAAW,OAAA;AAChC,wCAAsB","file":"index.js","sourcesContent":["import 'core-js/proposals/reflect-metadata';\nimport './modules';\n\n// 导出版本号\nexport const version = \"0.15.5\";\n\nexport * from './container';\nexport * from './core/global';\nexport * from './graphic';\nexport * from './modules';\nexport * from './create';\nexport * from './event';\nexport * from './interface';\nexport * from './render';\nexport * from './render/contributions/render/base-render';\nexport * from './canvas';\nexport * from './core';\nexport * from './picker';\nexport * from './kits';\nexport * from './animate';\nexport * from './resource-loader/loader';\n\n/* export common */\nexport * from './common/text';\nexport * from './common/bezier-utils';\nexport * from './common/bounds-context';\nexport * from './common/seg-context';\nexport * from './common/custom-path2d';\nexport * from './common/segment';\nexport * from './common/canvas-utils';\nexport * from './common/contribution-provider';\nexport * from './common/generator';\nexport * from './common/utils';\nexport * from './common/shape/arc';\nexport * from './common/shape/rect';\n\nexport * from './common/path-svg';\nexport * from './common/render-curve';\nexport * from './common/render-area';\nexport * from './common/render-command-list';\nexport * from './common/sort';\nexport * from './common/morphing-utils';\nexport * from './common/split-path';\nexport * from './common/enums';\nexport * from './common/generator';\nexport * from './plugins/constants';\nexport * from './allocator/matrix-allocate';\n\nexport * from './animate/default-ticker';\nexport { wrapCanvas, wrapContext } from './canvas/util';\nexport * from './jsx';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,8CAA4C;AAC5C,qBAAmB;AAGN,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,8CAA4B;AAC5B,gDAA8B;AAC9B,4CAA0B;AAC1B,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,4EAA0D;AAC1D,2CAAyB;AACzB,yCAAuB;AACvB,2CAAyB;AACzB,yCAAuB;AACvB,4CAA0B;AAC1B,2DAAyC;AAGzC,gDAA8B;AAC9B,wDAAsC;AACtC,0DAAwC;AACxC,uDAAqC;AACrC,yDAAuC;AACvC,mDAAiC;AACjC,wDAAsC;AACtC,iEAA+C;AAC/C,qDAAmC;AACnC,iDAA+B;AAC/B,qDAAmC;AACnC,sDAAoC;AAEpC,oDAAkC;AAClC,wDAAsC;AACtC,uDAAqC;AACrC,+DAA6C;AAC7C,gDAA8B;AAC9B,0DAAwC;AACxC,sDAAoC;AACpC,iDAA+B;AAC/B,qDAAmC;AACnC,sDAAoC;AACpC,8DAA4C;AAE5C,2DAAyC;AACzC,sCAAwD;AAA/C,kGAAA,UAAU,OAAA;AAAE,mGAAA,WAAW,OAAA;AAChC,wCAAsB","file":"index.js","sourcesContent":["import 'core-js/proposals/reflect-metadata';\nimport './modules';\n\n// 导出版本号\nexport const version = \"0.15.6\";\n\nexport * from './container';\nexport * from './core/global';\nexport * from './graphic';\nexport * from './modules';\nexport * from './create';\nexport * from './event';\nexport * from './interface';\nexport * from './render';\nexport * from './render/contributions/render/base-render';\nexport * from './canvas';\nexport * from './core';\nexport * from './picker';\nexport * from './kits';\nexport * from './animate';\nexport * from './resource-loader/loader';\n\n/* export common */\nexport * from './common/text';\nexport * from './common/bezier-utils';\nexport * from './common/bounds-context';\nexport * from './common/seg-context';\nexport * from './common/custom-path2d';\nexport * from './common/segment';\nexport * from './common/canvas-utils';\nexport * from './common/contribution-provider';\nexport * from './common/generator';\nexport * from './common/utils';\nexport * from './common/shape/arc';\nexport * from './common/shape/rect';\n\nexport * from './common/path-svg';\nexport * from './common/render-curve';\nexport * from './common/render-area';\nexport * from './common/render-command-list';\nexport * from './common/sort';\nexport * from './common/morphing-utils';\nexport * from './common/split-path';\nexport * from './common/enums';\nexport * from './common/generator';\nexport * from './plugins/constants';\nexport * from './allocator/matrix-allocate';\n\nexport * from './animate/default-ticker';\nexport { wrapCanvas, wrapContext } from './canvas/util';\nexport * from './jsx';\n"]}
package/dist/index.js CHANGED
@@ -8533,10 +8533,10 @@
8533
8533
  lineEnd() {
8534
8534
  switch (this._point) {
8535
8535
  case 2:
8536
- this.context.lineTo(this._x1, this._y1, this._lastDefined2 !== false, this.lastPoint1);
8536
+ this.context.lineTo(this._x1, this._y1, this._lastDefined1 !== false && this._lastDefined2 !== false, this.lastPoint1);
8537
8537
  break;
8538
8538
  case 3:
8539
- point$1(this, this._t0, slope2(this, this._t0), this._lastDefined2 !== false, this.lastPoint1);
8539
+ point$1(this, this._t0, slope2(this, this._t0), this._lastDefined1 !== false && this._lastDefined2 !== false, this.lastPoint1);
8540
8540
  break;
8541
8541
  }
8542
8542
  if (this._line || (this._line !== 0 && this._point === 1)) {
@@ -40548,7 +40548,7 @@
40548
40548
  }
40549
40549
  const Fragment = Group;
40550
40550
 
40551
- const version = "0.15.5";
40551
+ const version = "0.15.6";
40552
40552
 
40553
40553
  exports.ACustomAnimate = ACustomAnimate;
40554
40554
  exports.ARC3D_NUMBER_TYPE = ARC3D_NUMBER_TYPE;