@visactor/vrender-components 0.18.10-alpha.0 → 0.18.10-alpha.2

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 (115) hide show
  1. package/cjs/index.d.ts +1 -1
  2. package/cjs/index.js +1 -1
  3. package/cjs/index.js.map +1 -1
  4. package/cjs/label/arc.d.ts +2 -2
  5. package/cjs/label/base.d.ts +2 -2
  6. package/cjs/marker/base-line.d.ts +17 -0
  7. package/cjs/marker/base-line.js +53 -0
  8. package/cjs/marker/base-line.js.map +1 -0
  9. package/cjs/marker/{area.d.ts → cartesian/area.d.ts} +13 -8
  10. package/cjs/marker/{area.js → cartesian/area.js} +18 -19
  11. package/cjs/marker/cartesian/area.js.map +1 -0
  12. package/cjs/marker/cartesian/line.d.ts +27 -0
  13. package/cjs/marker/cartesian/line.js +153 -0
  14. package/cjs/marker/cartesian/line.js.map +1 -0
  15. package/cjs/marker/config.d.ts +80 -10
  16. package/cjs/marker/config.js +77 -40
  17. package/cjs/marker/config.js.map +1 -1
  18. package/cjs/marker/index.d.ts +4 -2
  19. package/cjs/marker/index.js +3 -2
  20. package/cjs/marker/index.js.map +1 -1
  21. package/cjs/marker/point.d.ts +1 -1
  22. package/cjs/marker/polar/arc-line.d.ts +22 -0
  23. package/cjs/marker/polar/arc-line.js +103 -0
  24. package/cjs/marker/polar/arc-line.js.map +1 -0
  25. package/cjs/marker/polar/area.d.ts +50 -0
  26. package/cjs/marker/polar/area.js +123 -0
  27. package/cjs/marker/polar/area.js.map +1 -0
  28. package/cjs/marker/polar/line.d.ts +1 -0
  29. package/cjs/marker/polar/line.js +3 -0
  30. package/cjs/marker/polar/line.js.map +1 -0
  31. package/cjs/marker/register.d.ts +5 -2
  32. package/cjs/marker/register.js +18 -5
  33. package/cjs/marker/register.js.map +1 -1
  34. package/cjs/marker/type.d.ts +73 -21
  35. package/cjs/marker/type.js +22 -15
  36. package/cjs/marker/type.js.map +1 -1
  37. package/cjs/segment/arc-segment.d.ts +13 -0
  38. package/cjs/segment/arc-segment.js +51 -0
  39. package/cjs/segment/arc-segment.js.map +1 -0
  40. package/cjs/segment/index.d.ts +1 -0
  41. package/cjs/segment/index.js +2 -1
  42. package/cjs/segment/index.js.map +1 -1
  43. package/cjs/segment/register.d.ts +1 -0
  44. package/cjs/segment/register.js +7 -2
  45. package/cjs/segment/register.js.map +1 -1
  46. package/cjs/segment/segment.d.ts +7 -6
  47. package/cjs/segment/segment.js +7 -5
  48. package/cjs/segment/segment.js.map +1 -1
  49. package/cjs/segment/type.d.ts +22 -4
  50. package/cjs/segment/type.js.map +1 -1
  51. package/cjs/tag/tag.d.ts +5 -0
  52. package/cjs/tag/tag.js +11 -2
  53. package/cjs/tag/tag.js.map +1 -1
  54. package/es/index.d.ts +1 -1
  55. package/es/index.js +1 -1
  56. package/es/index.js.map +1 -1
  57. package/es/label/arc.d.ts +2 -2
  58. package/es/label/base.d.ts +2 -2
  59. package/es/marker/base-line.d.ts +17 -0
  60. package/es/marker/base-line.js +53 -0
  61. package/es/marker/base-line.js.map +1 -0
  62. package/es/marker/{area.d.ts → cartesian/area.d.ts} +13 -8
  63. package/es/marker/{area.js → cartesian/area.js} +22 -23
  64. package/es/marker/cartesian/area.js.map +1 -0
  65. package/es/marker/cartesian/line.d.ts +27 -0
  66. package/es/marker/cartesian/line.js +159 -0
  67. package/es/marker/cartesian/line.js.map +1 -0
  68. package/es/marker/config.d.ts +80 -10
  69. package/es/marker/config.js +79 -40
  70. package/es/marker/config.js.map +1 -1
  71. package/es/marker/index.d.ts +4 -2
  72. package/es/marker/index.js +6 -2
  73. package/es/marker/index.js.map +1 -1
  74. package/es/marker/point.d.ts +1 -1
  75. package/es/marker/polar/arc-line.d.ts +22 -0
  76. package/es/marker/polar/arc-line.js +109 -0
  77. package/es/marker/polar/arc-line.js.map +1 -0
  78. package/es/marker/polar/area.d.ts +50 -0
  79. package/es/marker/polar/area.js +133 -0
  80. package/es/marker/polar/area.js.map +1 -0
  81. package/es/marker/polar/line.d.ts +1 -0
  82. package/es/marker/polar/line.js +3 -0
  83. package/es/marker/polar/line.js.map +1 -0
  84. package/es/marker/register.d.ts +5 -2
  85. package/es/marker/register.js +16 -4
  86. package/es/marker/register.js.map +1 -1
  87. package/es/marker/type.d.ts +73 -21
  88. package/es/marker/type.js +25 -15
  89. package/es/marker/type.js.map +1 -1
  90. package/es/segment/arc-segment.d.ts +13 -0
  91. package/es/segment/arc-segment.js +49 -0
  92. package/es/segment/arc-segment.js.map +1 -0
  93. package/es/segment/index.d.ts +1 -0
  94. package/es/segment/index.js +2 -0
  95. package/es/segment/index.js.map +1 -1
  96. package/es/segment/register.d.ts +1 -0
  97. package/es/segment/register.js +5 -1
  98. package/es/segment/register.js.map +1 -1
  99. package/es/segment/segment.d.ts +7 -6
  100. package/es/segment/segment.js +7 -5
  101. package/es/segment/segment.js.map +1 -1
  102. package/es/segment/type.d.ts +22 -4
  103. package/es/segment/type.js.map +1 -1
  104. package/es/tag/tag.d.ts +5 -0
  105. package/es/tag/tag.js +11 -2
  106. package/es/tag/tag.js.map +1 -1
  107. package/package.json +5 -5
  108. package/cjs/marker/area.js.map +0 -1
  109. package/cjs/marker/line.d.ts +0 -18
  110. package/cjs/marker/line.js +0 -100
  111. package/cjs/marker/line.js.map +0 -1
  112. package/es/marker/area.js.map +0 -1
  113. package/es/marker/line.d.ts +0 -18
  114. package/es/marker/line.js +0 -108
  115. package/es/marker/line.js.map +0 -1
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.PolarMarkArea = void 0;
6
+
7
+ const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils"), tag_1 = require("../../tag"), base_1 = require("../base"), config_1 = require("../config"), type_1 = require("../type"), limit_shape_1 = require("../../util/limit-shape"), register_1 = require("../register"), constant_1 = require("../../constant");
8
+
9
+ (0, register_1.loadPolarMarkAreaComponent)();
10
+
11
+ class PolarMarkArea extends base_1.Marker {
12
+ getArea() {
13
+ return this._area;
14
+ }
15
+ getLabel() {
16
+ return this._label;
17
+ }
18
+ constructor(attributes, options) {
19
+ super((null == options ? void 0 : options.skipDefault) ? attributes : (0, vutils_1.merge)({}, PolarMarkArea.defaultAttributes, attributes)),
20
+ this.name = "polarMarkArea";
21
+ }
22
+ getPositionByDirection(direction) {
23
+ var _a, _b, _c, _d, _e, _f, _g, _h;
24
+ const {center: center, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle, label: label} = this.attribute, {refX: refX = 0, refY: refY = 0} = label, labelRectHeight = Math.abs((null !== (_b = null === (_a = this._label.getTextShape().AABBBounds) || void 0 === _a ? void 0 : _a.y2) && void 0 !== _b ? _b : 0) - (null !== (_d = null === (_c = this._label.getTextShape()) || void 0 === _c ? void 0 : _c.AABBBounds.y1) && void 0 !== _d ? _d : 0)), labelTextHeight = Math.abs((null !== (_f = null === (_e = this._label.getBgRect().AABBBounds) || void 0 === _e ? void 0 : _e.y2) && void 0 !== _f ? _f : 0) - (null !== (_h = null === (_g = this._label.getBgRect()) || void 0 === _g ? void 0 : _g.AABBBounds.y1) && void 0 !== _h ? _h : 0)), labelHeight = Math.max(labelRectHeight, labelTextHeight);
25
+ let radius, angle, orthogonalOffsetDirection;
26
+ switch (direction) {
27
+ case type_1.IPolarMarkLabelPosition.center:
28
+ radius = (innerRadius + outerRadius) / 2, angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = 0;
29
+ break;
30
+
31
+ case type_1.IPolarMarkLabelPosition.arcInnerStart:
32
+ radius = innerRadius, angle = startAngle, orthogonalOffsetDirection = -1;
33
+ break;
34
+
35
+ case type_1.IPolarMarkLabelPosition.arcOuterStart:
36
+ radius = outerRadius, angle = startAngle, orthogonalOffsetDirection = 1;
37
+ break;
38
+
39
+ case type_1.IPolarMarkLabelPosition.arcInnerEnd:
40
+ radius = innerRadius, angle = endAngle, orthogonalOffsetDirection = -1;
41
+ break;
42
+
43
+ case type_1.IPolarMarkLabelPosition.arcOuterEnd:
44
+ radius = outerRadius, angle = endAngle, orthogonalOffsetDirection = 1;
45
+ break;
46
+
47
+ case type_1.IPolarMarkLabelPosition.arcInnerMiddle:
48
+ radius = innerRadius, angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = -1;
49
+ break;
50
+
51
+ case type_1.IPolarMarkLabelPosition.arcOuterMiddle:
52
+ radius = outerRadius, angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = 1;
53
+ break;
54
+
55
+ default:
56
+ radius = innerRadius, angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = -1;
57
+ }
58
+ return {
59
+ position: {
60
+ x: center.x + (radius + orthogonalOffsetDirection * labelHeight / 2 + refY) * Math.cos(angle) + refX * Math.cos(angle - Math.PI / 2),
61
+ y: center.y + (radius + orthogonalOffsetDirection * labelHeight / 2 + refY) * Math.sin(angle) + refX * Math.sin(angle - Math.PI / 2)
62
+ },
63
+ angle: angle
64
+ };
65
+ }
66
+ setLabelPos() {
67
+ var _a;
68
+ if (this._label && this._area) {
69
+ const {label: label = {}} = this.attribute, {position: labelPosition = "arcInnerMiddle", autoRotate: autoRotate = !0} = label, labelAttr = this.getPositionByDirection(labelPosition);
70
+ if (this._label.setAttributes(Object.assign(Object.assign({}, labelAttr.position), {
71
+ angle: autoRotate ? labelAttr.angle - Math.PI / 2 + (null !== (_a = label.refAngle) && void 0 !== _a ? _a : 0) : 0
72
+ })), this.attribute.limitRect && label.confine) {
73
+ const {x: x, y: y, width: width, height: height} = this.attribute.limitRect;
74
+ (0, limit_shape_1.limitShapeInBounds)(this._label, {
75
+ x1: x,
76
+ y1: y,
77
+ x2: x + width,
78
+ y2: y + height
79
+ });
80
+ }
81
+ }
82
+ }
83
+ initMarker(container) {
84
+ const {center: center, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle, areaStyle: areaStyle, label: label, state: state} = this.attribute, area = vrender_core_1.graphicCreator.arc(Object.assign({
85
+ x: center.x,
86
+ y: center.y,
87
+ innerRadius: innerRadius,
88
+ outerRadius: outerRadius,
89
+ startAngle: startAngle,
90
+ endAngle: endAngle
91
+ }, areaStyle));
92
+ area.states = (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.area),
93
+ area.name = "polar-mark-area-area", this._area = area, container.add(area);
94
+ const markLabel = new tag_1.Tag(Object.assign(Object.assign({}, label), {
95
+ state: {
96
+ panel: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.labelBackground),
97
+ text: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.label)
98
+ }
99
+ }));
100
+ markLabel.name = "mark-area-label", this._label = markLabel, container.add(markLabel),
101
+ this.setLabelPos();
102
+ }
103
+ updateMarker() {
104
+ const {center: center, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle, areaStyle: areaStyle, label: label} = this.attribute;
105
+ this._area && this._area.setAttributes(Object.assign({
106
+ x: center.x,
107
+ y: center.y,
108
+ innerRadius: innerRadius,
109
+ outerRadius: outerRadius,
110
+ startAngle: startAngle,
111
+ endAngle: endAngle
112
+ }, areaStyle)), this._area && this._label.setAttributes(Object.assign({
113
+ dx: 0,
114
+ dy: 0
115
+ }, label)), this.setLabelPos();
116
+ }
117
+ isValidPoints() {
118
+ return !0;
119
+ }
120
+ }
121
+
122
+ exports.PolarMarkArea = PolarMarkArea, PolarMarkArea.defaultAttributes = config_1.DEFAULT_POLAR_MARK_AREA_THEME;
123
+ //# sourceMappingURL=area.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/marker/polar/area.ts"],"names":[],"mappings":";;;AAEA,yDAAwD;AACxD,6CAAyC;AAGzC,mCAAgC;AAChC,kCAAiC;AACjC,sCAA0D;AAC1D,kCAA2E;AAC3E,wDAA4D;AAE5D,0CAAyD;AACzD,6CAAgD;AAEhD,IAAA,qCAA0B,GAAE,CAA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AAE,IAAA,cAAK,EAAC,EAAE,EAAE,yBAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,CAAC;gBACxD,IAAI,EAAE,IAAA,cAAK,EAAC,EAAE,EAAE,yBAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,CAAC;aAC9C,IACD,CAAC;QACH,SAAS,CAAC,IAAI,GAAG,iBAAiB,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,SAAS,CAAC,GAAG,CAAC,SAA6B,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAES,YAAY;QACpB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI;aACtF,SAA+B,CAAC;QACnC,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,KAAK,CAAC,aAAa,iBACtB,CAAC,EAAE,MAAM,CAAC,CAAC,EACX,CAAC,EAAE,MAAM,CAAC,CAAC,EACX,WAAW;gBACX,WAAW;gBACX,UAAU;gBACV,QAAQ,IACL,SAAS,EACZ,CAAC;SACJ;QACD,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,MAAM,CAAC,aAAa,iBACvB,EAAE,EAAE,CAAC,EACL,EAAE,EAAE,CAAC,IACD,KAAuB,EAC3B,CAAC;SACJ;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAES,aAAa;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;;AA5KH,sCA6KC;AA3KQ,+BAAiB,GAAG,sCAA6B,CAAC","file":"area.js","sourcesContent":["import type { IArc, IGroup, INode } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport { merge } from '@visactor/vutils';\nimport type { TagAttributes } from '../../tag';\n// eslint-disable-next-line no-duplicate-imports\nimport { Tag } from '../../tag';\nimport { Marker } from '../base';\nimport { DEFAULT_POLAR_MARK_AREA_THEME } from '../config';\nimport { IPolarMarkLabelPosition, type PolarMarkAreaAttrs } from '../type';\nimport { limitShapeInBounds } from '../../util/limit-shape';\nimport type { ComponentOptions } from '../../interface';\nimport { loadPolarMarkAreaComponent } from '../register';\nimport { DEFAULT_STATES } from '../../constant';\n\nloadPolarMarkAreaComponent();\nexport class PolarMarkArea extends Marker<PolarMarkAreaAttrs> {\n name = 'polarMarkArea';\n static defaultAttributes = DEFAULT_POLAR_MARK_AREA_THEME;\n private _area!: IArc;\n\n getArea() {\n return this._area;\n }\n\n getLabel() {\n return this._label;\n }\n\n constructor(attributes: PolarMarkAreaAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, PolarMarkArea.defaultAttributes, attributes));\n }\n\n protected getPositionByDirection(direction: string) {\n const { center, innerRadius, outerRadius, startAngle, endAngle, label } = this.attribute as PolarMarkAreaAttrs;\n const { refX = 0, refY = 0 } = label;\n // eslint-disable-next-line max-len\n const labelRectHeight = Math.abs(\n (this._label.getTextShape().AABBBounds?.y2 ?? 0) - (this._label.getTextShape()?.AABBBounds.y1 ?? 0)\n );\n // eslint-disable-next-line max-len\n const labelTextHeight = Math.abs(\n (this._label.getBgRect().AABBBounds?.y2 ?? 0) - (this._label.getBgRect()?.AABBBounds.y1 ?? 0)\n );\n const labelHeight = Math.max(labelRectHeight, labelTextHeight);\n\n let radius;\n let angle;\n // tag在正交方向是向内偏移,还是向外偏移\n // 不偏移: 0, 内: -1, 外: 1\n let orthogonalOffsetDirection;\n\n switch (direction) {\n case IPolarMarkLabelPosition.center:\n radius = (innerRadius + outerRadius) / 2;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = 0;\n break;\n case IPolarMarkLabelPosition.arcInnerStart:\n radius = innerRadius;\n angle = startAngle;\n orthogonalOffsetDirection = -1;\n break;\n case IPolarMarkLabelPosition.arcOuterStart:\n radius = outerRadius;\n angle = startAngle;\n orthogonalOffsetDirection = 1;\n break;\n case IPolarMarkLabelPosition.arcInnerEnd:\n radius = innerRadius;\n angle = endAngle;\n orthogonalOffsetDirection = -1;\n break;\n case IPolarMarkLabelPosition.arcOuterEnd:\n radius = outerRadius;\n angle = endAngle;\n orthogonalOffsetDirection = 1;\n break;\n case IPolarMarkLabelPosition.arcInnerMiddle:\n radius = innerRadius;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = -1;\n break;\n case IPolarMarkLabelPosition.arcOuterMiddle:\n radius = outerRadius;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = 1;\n break;\n default: // default arcInnerMiddle\n radius = innerRadius;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = -1;\n }\n\n return {\n position: {\n x:\n center.x +\n (radius + (orthogonalOffsetDirection * labelHeight) / 2 + refY) * Math.cos(angle) +\n refX * Math.cos(angle - Math.PI / 2),\n y:\n center.y +\n (radius + (orthogonalOffsetDirection * labelHeight) / 2 + refY) * Math.sin(angle) +\n refX * Math.sin(angle - Math.PI / 2)\n },\n angle\n };\n }\n\n protected setLabelPos() {\n if (this._label && this._area) {\n const { label = {} } = this.attribute as PolarMarkAreaAttrs;\n const { position: labelPosition = 'arcInnerMiddle', autoRotate = true } = label;\n const labelAttr = this.getPositionByDirection(labelPosition);\n\n this._label.setAttributes({\n ...labelAttr.position,\n angle: autoRotate ? labelAttr.angle - Math.PI / 2 + (label.refAngle ?? 0) : 0\n });\n\n if (this.attribute.limitRect && label.confine) {\n const { x, y, width, height } = this.attribute.limitRect;\n limitShapeInBounds(this._label, {\n x1: x,\n y1: y,\n x2: x + width,\n y2: y + height\n });\n }\n }\n }\n\n protected initMarker(container: IGroup) {\n const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label, state } = this\n .attribute as PolarMarkAreaAttrs;\n const area = graphicCreator.arc({\n x: center.x,\n y: center.y,\n innerRadius,\n outerRadius,\n startAngle,\n endAngle,\n ...areaStyle\n });\n area.states = merge({}, DEFAULT_STATES, state?.area);\n area.name = 'polar-mark-area-area';\n this._area = area;\n container.add(area);\n\n const markLabel = new Tag({\n ...(label as TagAttributes),\n state: {\n panel: merge({}, DEFAULT_STATES, state?.labelBackground),\n text: merge({}, DEFAULT_STATES, state?.label)\n }\n });\n markLabel.name = 'mark-area-label';\n this._label = markLabel;\n container.add(markLabel as unknown as INode);\n this.setLabelPos();\n }\n\n protected updateMarker() {\n const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label } = this\n .attribute as PolarMarkAreaAttrs;\n if (this._area) {\n this._area.setAttributes({\n x: center.x,\n y: center.y,\n innerRadius,\n outerRadius,\n startAngle,\n endAngle,\n ...areaStyle\n });\n }\n if (this._area) {\n this._label.setAttributes({\n dx: 0,\n dy: 0, // 需要进行复位\n ...(label as TagAttributes)\n });\n }\n this.setLabelPos();\n }\n\n protected isValidPoints() {\n return true;\n }\n}\n"]}
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,3 @@
1
+
2
+
3
+ //# sourceMappingURL=line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/marker/polar/line.ts"],"names":[],"mappings":"","file":"line.js","sourcesContent":["// import { merge } from '@visactor/vutils';\n// import { DEFAULT_COMMON_MARK_LINE_THEME } from '../config';\n// import type { PolarMarkLineAttrs } from '../type';\n// import { DEFAULT_STATES } from '../../constant';\n// import { BaseMarkLine } from '../base-line';\n// import { loadPolarMarkLineComponent } from '../register';\n\n// loadPolarMarkLineComponent();\n// export class PolarMarkLine extends BaseMarkLine {\n// name = 'polarMarkLine';\n// static defaultAttributes: Partial<PolarMarkLineAttrs> = DEFAULT_COMMON_MARK_LINE_THEME;\n// protected isValidPoints() {\n// return true\n// }\n\n// protected createSegment() {\n// const {\n// center,\n// radius,\n// startAngle,\n// endAngle,\n// startSymbol,\n// endSymbol,\n// lineStyle,\n// state\n// } = this.attribute as PolarMarkLineAttrs;\n// return new ArcSegment({\n// center,\n// radius,\n// startAngle,\n// endAngle,\n// startSymbol,\n// endSymbol,\n// lineStyle,\n// state: {\n// line: merge({}, DEFAULT_STATES, state?.line),\n// startSymbol: merge({}, DEFAULT_STATES, state?.lineStartSymbol),\n// endSymbol: merge({}, DEFAULT_STATES, state?.lineEndSymbol)\n// }\n// })\n// }\n\n// protected setLineAttributes() {\n// const {\n// center,\n// radius,\n// startAngle,\n// endAngle,\n// startSymbol,\n// endSymbol,\n// lineStyle,\n// } = this.attribute as PolarMarkArcLineAttrs;\n// if (this._line) {\n// (this._line as any).setAttributes({\n// center,\n// radius,\n// startAngle,\n// endAngle,\n// startSymbol,\n// endSymbol,\n// lineStyle\n// });\n// }\n// }\n// }\n"]}
@@ -1,3 +1,6 @@
1
- export declare function loadMarkLineComponent(): void;
2
- export declare function loadMarkAreaComponent(): void;
1
+ export declare function loadCartesianMarkLineComponent(): void;
2
+ export declare function loadPolarMarkLineComponent(): void;
3
+ export declare function loadPolarMarkArcLineComponent(): void;
4
+ export declare function loadCartesianMarkAreaComponent(): void;
5
+ export declare function loadPolarMarkAreaComponent(): void;
3
6
  export declare function loadMarkPointComponent(): void;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.loadMarkPointComponent = exports.loadMarkAreaComponent = exports.loadMarkLineComponent = void 0;
5
+ }), exports.loadMarkPointComponent = exports.loadPolarMarkAreaComponent = exports.loadCartesianMarkAreaComponent = exports.loadPolarMarkArcLineComponent = exports.loadPolarMarkLineComponent = exports.loadCartesianMarkLineComponent = void 0;
6
6
 
7
7
  const vrender_kits_1 = require("@visactor/vrender-kits"), register_1 = require("../tag/register"), register_2 = require("../segment/register");
8
8
 
@@ -10,19 +10,32 @@ function loadBaseMarker() {
10
10
  (0, vrender_kits_1.registerGroup)(), (0, register_1.loadTagComponent)();
11
11
  }
12
12
 
13
- function loadMarkLineComponent() {
13
+ function loadCartesianMarkLineComponent() {
14
14
  loadBaseMarker(), (0, register_2.loadSegmentComponent)();
15
15
  }
16
16
 
17
- function loadMarkAreaComponent() {
17
+ function loadPolarMarkLineComponent() {
18
+ loadBaseMarker(), (0, register_2.loadSegmentComponent)();
19
+ }
20
+
21
+ function loadPolarMarkArcLineComponent() {
22
+ loadBaseMarker(), (0, register_2.loadArcSegmentComponent)();
23
+ }
24
+
25
+ function loadCartesianMarkAreaComponent() {
18
26
  loadBaseMarker(), (0, vrender_kits_1.registerPolygon)();
19
27
  }
20
28
 
29
+ function loadPolarMarkAreaComponent() {
30
+ loadBaseMarker(), (0, vrender_kits_1.registerArc)();
31
+ }
32
+
21
33
  function loadMarkPointComponent() {
22
34
  loadBaseMarker(), (0, register_2.loadSegmentComponent)(), (0, vrender_kits_1.registerSymbol)(),
23
35
  (0, vrender_kits_1.registerImage)(), (0, vrender_kits_1.registerLine)();
24
36
  }
25
37
 
26
- exports.loadMarkLineComponent = loadMarkLineComponent, exports.loadMarkAreaComponent = loadMarkAreaComponent,
27
- exports.loadMarkPointComponent = loadMarkPointComponent;
38
+ exports.loadCartesianMarkLineComponent = loadCartesianMarkLineComponent, exports.loadPolarMarkLineComponent = loadPolarMarkLineComponent,
39
+ exports.loadPolarMarkArcLineComponent = loadPolarMarkArcLineComponent, exports.loadCartesianMarkAreaComponent = loadCartesianMarkAreaComponent,
40
+ exports.loadPolarMarkAreaComponent = loadPolarMarkAreaComponent, exports.loadMarkPointComponent = loadMarkPointComponent;
28
41
  //# sourceMappingURL=register.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/marker/register.ts"],"names":[],"mappings":";;;AAAA,yDAAqH;AACrH,8CAAmD;AACnD,kDAA2D;AAC3D,SAAS,cAAc;IACrB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAgB,GAAE,CAAC;AACrB,CAAC;AAED,SAAgB,qBAAqB;IACnC,cAAc,EAAE,CAAC;IACjB,IAAA,+BAAoB,GAAE,CAAC;AACzB,CAAC;AAHD,sDAGC;AAED,SAAgB,qBAAqB;IACnC,cAAc,EAAE,CAAC;IACjB,IAAA,8BAAe,GAAE,CAAC;AACpB,CAAC;AAHD,sDAGC;AAED,SAAgB,sBAAsB;IACpC,cAAc,EAAE,CAAC;IACjB,IAAA,+BAAoB,GAAE,CAAC;IACvB,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;AACjB,CAAC;AAND,wDAMC","file":"register.js","sourcesContent":["import { registerGroup, registerImage, registerLine, registerPolygon, registerSymbol } from '@visactor/vrender-kits';\nimport { loadTagComponent } from '../tag/register';\nimport { loadSegmentComponent } from '../segment/register';\nfunction loadBaseMarker() {\n registerGroup();\n loadTagComponent();\n}\n\nexport function loadMarkLineComponent() {\n loadBaseMarker();\n loadSegmentComponent();\n}\n\nexport function loadMarkAreaComponent() {\n loadBaseMarker();\n registerPolygon();\n}\n\nexport function loadMarkPointComponent() {\n loadBaseMarker();\n loadSegmentComponent();\n registerSymbol();\n registerImage();\n registerLine();\n}\n"]}
1
+ {"version":3,"sources":["../src/marker/register.ts"],"names":[],"mappings":";;;AAAA,yDAOgC;AAChC,8CAAmD;AACnD,kDAAoF;AACpF,SAAS,cAAc;IACrB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAgB,GAAE,CAAC;AACrB,CAAC;AAED,SAAgB,8BAA8B;IAC5C,cAAc,EAAE,CAAC;IACjB,IAAA,+BAAoB,GAAE,CAAC;AACzB,CAAC;AAHD,wEAGC;AAED,SAAgB,0BAA0B;IACxC,cAAc,EAAE,CAAC;IACjB,IAAA,+BAAoB,GAAE,CAAC;AACzB,CAAC;AAHD,gEAGC;AAED,SAAgB,6BAA6B;IAC3C,cAAc,EAAE,CAAC;IACjB,IAAA,kCAAuB,GAAE,CAAC;AAC5B,CAAC;AAHD,sEAGC;AAED,SAAgB,8BAA8B;IAC5C,cAAc,EAAE,CAAC;IACjB,IAAA,8BAAe,GAAE,CAAC;AACpB,CAAC;AAHD,wEAGC;AAED,SAAgB,0BAA0B;IACxC,cAAc,EAAE,CAAC;IACjB,IAAA,0BAAW,GAAE,CAAC;AAChB,CAAC;AAHD,gEAGC;AAED,SAAgB,sBAAsB;IACpC,cAAc,EAAE,CAAC;IACjB,IAAA,+BAAoB,GAAE,CAAC;IACvB,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;AACjB,CAAC;AAND,wDAMC","file":"register.js","sourcesContent":["import {\n registerArc,\n registerGroup,\n registerImage,\n registerLine,\n registerPolygon,\n registerSymbol\n} from '@visactor/vrender-kits';\nimport { loadTagComponent } from '../tag/register';\nimport { loadArcSegmentComponent, loadSegmentComponent } from '../segment/register';\nfunction loadBaseMarker() {\n registerGroup();\n loadTagComponent();\n}\n\nexport function loadCartesianMarkLineComponent() {\n loadBaseMarker();\n loadSegmentComponent();\n}\n\nexport function loadPolarMarkLineComponent() {\n loadBaseMarker();\n loadSegmentComponent();\n}\n\nexport function loadPolarMarkArcLineComponent() {\n loadBaseMarker();\n loadArcSegmentComponent();\n}\n\nexport function loadCartesianMarkAreaComponent() {\n loadBaseMarker();\n registerPolygon();\n}\n\nexport function loadPolarMarkAreaComponent() {\n loadBaseMarker();\n registerArc();\n}\n\nexport function loadMarkPointComponent() {\n loadBaseMarker();\n loadSegmentComponent();\n registerSymbol();\n registerImage();\n registerLine();\n}\n"]}
@@ -1,8 +1,8 @@
1
- import type { EasingType, IGroup, IGroupGraphicAttribute, IImageGraphicAttribute, ILineGraphicAttribute, IPolygonAttribute, IPolygonGraphicAttribute, IRectGraphicAttribute, IRichTextGraphicAttribute, ISymbolGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender-core';
2
- import type { ILineGraphicWithCornerRadius, SegmentAttributes, SymbolAttributes } from '../segment';
1
+ import type { EasingType, IArcGraphicAttribute, IGroup, IGroupGraphicAttribute, IImageGraphicAttribute, ILineGraphicAttribute, IPolygonAttribute, IPolygonGraphicAttribute, IRectGraphicAttribute, IRichTextGraphicAttribute, ISymbolGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender-core';
2
+ import type { CommonSegmentAttributes, ILineGraphicWithCornerRadius, SegmentAttributes, SymbolAttributes } from '../segment';
3
3
  import type { TagAttributes } from '../tag';
4
4
  import type { Point, State } from '../core/type';
5
- export declare enum IMarkLineLabelPosition {
5
+ export declare enum ICartesianMarkLineLabelPosition {
6
6
  start = "start",
7
7
  middle = "middle",
8
8
  end = "end",
@@ -13,7 +13,7 @@ export declare enum IMarkLineLabelPosition {
13
13
  insideEndTop = "insideEndTop",
14
14
  insideEndBottom = "insideEndBottom"
15
15
  }
16
- export declare enum IMarkAreaLabelPosition {
16
+ export declare enum ICartesianMarkAreaLabelPosition {
17
17
  left = "left",
18
18
  right = "right",
19
19
  top = "top",
@@ -24,6 +24,15 @@ export declare enum IMarkAreaLabelPosition {
24
24
  insideTop = "insideTop",
25
25
  insideBottom = "insideBottom"
26
26
  }
27
+ export declare enum IPolarMarkLabelPosition {
28
+ arcInnerStart = "arcInnerStart",
29
+ arcInnerEnd = "arcInnerEnd",
30
+ arcInnerMiddle = "arcInnerMiddle",
31
+ arcOuterStart = "arcOuterStart",
32
+ arcOuterEnd = "arcOuterEnd",
33
+ arcOuterMiddle = "arcOuterMiddle",
34
+ center = "center"
35
+ }
27
36
  export declare enum IMarkPointItemPosition {
28
37
  top = "top",
29
38
  bottom = "bottom",
@@ -47,7 +56,7 @@ export type IMarkRef = {
47
56
  refAngle?: number;
48
57
  };
49
58
  export type MarkerAttrs = IGroupGraphicAttribute & {
50
- type?: 'line' | 'area' | 'point';
59
+ type?: 'cartesian-line' | 'polar-line' | 'polar-arc-line' | 'cartesian-area' | 'polar-area' | 'point';
51
60
  interactive?: boolean;
52
61
  select?: boolean;
53
62
  hover?: boolean;
@@ -70,26 +79,31 @@ export type MarkerAnimation<T> = MarkerUpdateAnimation<T> | MarkerUpdateAnimatio
70
79
  export type MarkerUpdateAnimation<T> = {
71
80
  type: T;
72
81
  } & MarkerExitAnimation;
73
- export type MarkLineAnimationType = 'clipIn' | 'fadeIn';
74
- export type MarkAreaAnimationType = 'fadeIn';
82
+ export type CommonMarkLineAnimationType = 'clipIn' | 'fadeIn';
83
+ export type CommonMarkAreaAnimationType = 'fadeIn';
75
84
  export type MarkPointAnimationType = 'callIn' | 'fadeIn';
76
85
  export type MarkerExitAnimation = {
77
86
  duration?: number;
78
87
  delay?: number;
79
88
  easing?: EasingType;
80
89
  };
81
- export type MarkLineState = {
82
- line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[]>;
90
+ export type CommonMarkLineState = {
91
+ line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[] | IArcGraphicAttribute>;
83
92
  lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;
84
93
  lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;
85
94
  label?: State<Partial<ITextGraphicAttribute>>;
86
95
  labelBackground?: State<Partial<IRectGraphicAttribute>>;
87
96
  };
88
- export type MarkAreaState = {
97
+ export type CartesianMarkAreaState = {
89
98
  area?: State<Partial<IPolygonGraphicAttribute>>;
90
99
  label?: State<Partial<ITextGraphicAttribute>>;
91
100
  labelBackground?: State<Partial<IRectGraphicAttribute>>;
92
101
  };
102
+ export type PolarMarkAreaState = {
103
+ area?: State<Partial<IArcGraphicAttribute>>;
104
+ label?: State<Partial<ITextGraphicAttribute>>;
105
+ labelBackground?: State<Partial<IRectGraphicAttribute>>;
106
+ };
93
107
  export type MarkPointState = {
94
108
  line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[]>;
95
109
  lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;
@@ -101,25 +115,63 @@ export type MarkPointState = {
101
115
  richText?: State<Partial<IRichTextGraphicAttribute>>;
102
116
  customMark?: State<Partial<IGroupGraphicAttribute>>;
103
117
  };
104
- export type MarkLineAttrs = MarkerAttrs & Omit<SegmentAttributes, 'state'> & {
105
- type?: 'line';
106
- points: Point[] | Point[][];
118
+ export type CommonMarkLineAttrs<T> = MarkerAttrs & Omit<CommonSegmentAttributes, 'state' | 'lineStyle'> & {
107
119
  label?: {
108
- position?: keyof typeof IMarkLineLabelPosition;
120
+ position?: T;
109
121
  confine?: boolean;
110
122
  } & IMarkRef & IMarkLabel;
111
- state?: MarkLineState;
112
- } & BaseMarkerAnimation<MarkLineAnimationType>;
113
- export type MarkAreaAttrs = MarkerAttrs & {
114
- type?: 'area';
123
+ state?: CommonMarkLineState;
124
+ } & BaseMarkerAnimation<CommonMarkLineAnimationType>;
125
+ export type CartesianMarkLineAttrs = CommonMarkLineAttrs<keyof typeof ICartesianMarkLineLabelPosition> & {
126
+ type?: 'cartesian-line';
127
+ multiSegment?: boolean;
128
+ mainSegmentIndex?: number;
129
+ points: Point[] | Point[][];
130
+ lineStyle?: ILineGraphicAttribute;
131
+ };
132
+ export type PolarMarkLineAttrs = CommonMarkLineAttrs<keyof typeof ICartesianMarkLineLabelPosition> & {
133
+ type?: 'polar-line';
134
+ points: Point[] | Point[][];
135
+ lineStyle?: ILineGraphicAttribute;
136
+ };
137
+ export type PolarMarkArcLineAttrs = CommonMarkLineAttrs<keyof typeof IPolarMarkLabelPosition> & {
138
+ type?: 'polar-arc-line';
139
+ center: {
140
+ x: number;
141
+ y: number;
142
+ };
143
+ radius: number;
144
+ startAngle: number;
145
+ endAngle: number;
146
+ lineStyle?: IArcGraphicAttribute;
147
+ };
148
+ export type CartesianMarkAreaAttrs = MarkerAttrs & {
149
+ type?: 'cartesian-area';
115
150
  points: Point[];
116
151
  label?: {
117
- position?: keyof typeof IMarkAreaLabelPosition;
152
+ position?: keyof typeof ICartesianMarkAreaLabelPosition;
118
153
  confine?: boolean;
119
154
  } & IMarkLabel;
120
155
  areaStyle?: IPolygonAttribute;
121
- state?: MarkAreaState;
122
- } & BaseMarkerAnimation<MarkAreaAnimationType>;
156
+ state?: CartesianMarkAreaState;
157
+ } & BaseMarkerAnimation<CommonMarkAreaAnimationType>;
158
+ export type PolarMarkAreaAttrs = MarkerAttrs & {
159
+ type?: 'polar-area';
160
+ center: {
161
+ x: number;
162
+ y: number;
163
+ };
164
+ innerRadius: number;
165
+ outerRadius: number;
166
+ startAngle: number;
167
+ endAngle: number;
168
+ label?: {
169
+ position?: keyof typeof IPolarMarkLabelPosition;
170
+ confine?: boolean;
171
+ } & IMarkRef & IMarkLabel;
172
+ areaStyle?: IArcGraphicAttribute;
173
+ state?: PolarMarkAreaState;
174
+ } & BaseMarkerAnimation<CommonMarkAreaAnimationType>;
123
175
  export type IItemContent = IMarkRef & {
124
176
  type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';
125
177
  position?: keyof typeof IMarkPointItemPosition;
@@ -1,23 +1,30 @@
1
1
  "use strict";
2
2
 
3
- var IMarkLineLabelPosition, IMarkAreaLabelPosition, IMarkPointItemPosition;
3
+ var ICartesianMarkLineLabelPosition, ICartesianMarkAreaLabelPosition, IPolarMarkLabelPosition, IMarkPointItemPosition;
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: !0
7
- }), exports.IMarkPointItemPosition = exports.IMarkAreaLabelPosition = exports.IMarkLineLabelPosition = void 0,
8
- function(IMarkLineLabelPosition) {
9
- IMarkLineLabelPosition.start = "start", IMarkLineLabelPosition.middle = "middle",
10
- IMarkLineLabelPosition.end = "end", IMarkLineLabelPosition.insideStartTop = "insideStartTop",
11
- IMarkLineLabelPosition.insideStartBottom = "insideStartBottom", IMarkLineLabelPosition.insideMiddleTop = "insideMiddleTop",
12
- IMarkLineLabelPosition.insideMiddleBottom = "insideMiddleBottom", IMarkLineLabelPosition.insideEndTop = "insideEndTop",
13
- IMarkLineLabelPosition.insideEndBottom = "insideEndBottom";
14
- }(IMarkLineLabelPosition = exports.IMarkLineLabelPosition || (exports.IMarkLineLabelPosition = {})),
15
- function(IMarkAreaLabelPosition) {
16
- IMarkAreaLabelPosition.left = "left", IMarkAreaLabelPosition.right = "right", IMarkAreaLabelPosition.top = "top",
17
- IMarkAreaLabelPosition.bottom = "bottom", IMarkAreaLabelPosition.middle = "middle",
18
- IMarkAreaLabelPosition.insideLeft = "insideLeft", IMarkAreaLabelPosition.insideRight = "insideRight",
19
- IMarkAreaLabelPosition.insideTop = "insideTop", IMarkAreaLabelPosition.insideBottom = "insideBottom";
20
- }(IMarkAreaLabelPosition = exports.IMarkAreaLabelPosition || (exports.IMarkAreaLabelPosition = {})),
7
+ }), exports.IMarkPointItemPosition = exports.IPolarMarkLabelPosition = exports.ICartesianMarkAreaLabelPosition = exports.ICartesianMarkLineLabelPosition = void 0,
8
+ function(ICartesianMarkLineLabelPosition) {
9
+ ICartesianMarkLineLabelPosition.start = "start", ICartesianMarkLineLabelPosition.middle = "middle",
10
+ ICartesianMarkLineLabelPosition.end = "end", ICartesianMarkLineLabelPosition.insideStartTop = "insideStartTop",
11
+ ICartesianMarkLineLabelPosition.insideStartBottom = "insideStartBottom", ICartesianMarkLineLabelPosition.insideMiddleTop = "insideMiddleTop",
12
+ ICartesianMarkLineLabelPosition.insideMiddleBottom = "insideMiddleBottom", ICartesianMarkLineLabelPosition.insideEndTop = "insideEndTop",
13
+ ICartesianMarkLineLabelPosition.insideEndBottom = "insideEndBottom";
14
+ }(ICartesianMarkLineLabelPosition = exports.ICartesianMarkLineLabelPosition || (exports.ICartesianMarkLineLabelPosition = {})),
15
+ function(ICartesianMarkAreaLabelPosition) {
16
+ ICartesianMarkAreaLabelPosition.left = "left", ICartesianMarkAreaLabelPosition.right = "right",
17
+ ICartesianMarkAreaLabelPosition.top = "top", ICartesianMarkAreaLabelPosition.bottom = "bottom",
18
+ ICartesianMarkAreaLabelPosition.middle = "middle", ICartesianMarkAreaLabelPosition.insideLeft = "insideLeft",
19
+ ICartesianMarkAreaLabelPosition.insideRight = "insideRight", ICartesianMarkAreaLabelPosition.insideTop = "insideTop",
20
+ ICartesianMarkAreaLabelPosition.insideBottom = "insideBottom";
21
+ }(ICartesianMarkAreaLabelPosition = exports.ICartesianMarkAreaLabelPosition || (exports.ICartesianMarkAreaLabelPosition = {})),
22
+ function(IPolarMarkLabelPosition) {
23
+ IPolarMarkLabelPosition.arcInnerStart = "arcInnerStart", IPolarMarkLabelPosition.arcInnerEnd = "arcInnerEnd",
24
+ IPolarMarkLabelPosition.arcInnerMiddle = "arcInnerMiddle", IPolarMarkLabelPosition.arcOuterStart = "arcOuterStart",
25
+ IPolarMarkLabelPosition.arcOuterEnd = "arcOuterEnd", IPolarMarkLabelPosition.arcOuterMiddle = "arcOuterMiddle",
26
+ IPolarMarkLabelPosition.center = "center";
27
+ }(IPolarMarkLabelPosition = exports.IPolarMarkLabelPosition || (exports.IPolarMarkLabelPosition = {})),
21
28
  function(IMarkPointItemPosition) {
22
29
  IMarkPointItemPosition.top = "top", IMarkPointItemPosition.bottom = "bottom", IMarkPointItemPosition.middle = "middle",
23
30
  IMarkPointItemPosition.insideTop = "insideTop", IMarkPointItemPosition.insideBottom = "insideBottom",
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/marker/type.ts"],"names":[],"mappings":";;;AAiBA,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,2CAAiB,CAAA;IACjB,qCAAW,CAAA;IACX,2DAAiC,CAAA;IACjC,iEAAuC,CAAA;IACvC,6DAAmC,CAAA;IACnC,mEAAyC,CAAA;IACzC,uDAA6B,CAAA;IAC7B,6DAAmC,CAAA;AACrC,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAC3B,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;AAC/B,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,uDAA6B,CAAA;AAC/B,CAAC,EAPW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAOjC","file":"type.js","sourcesContent":["import type {\n EasingType,\n IGroup,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n ILineGraphicAttribute,\n IPolygonAttribute,\n IPolygonGraphicAttribute,\n IRectGraphicAttribute,\n IRichTextGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { ILineGraphicWithCornerRadius, SegmentAttributes, SymbolAttributes } from '../segment';\nimport type { TagAttributes } from '../tag';\nimport type { Point, State } from '../core/type';\n\nexport enum IMarkLineLabelPosition {\n start = 'start',\n middle = 'middle',\n end = 'end',\n insideStartTop = 'insideStartTop',\n insideStartBottom = 'insideStartBottom',\n insideMiddleTop = 'insideMiddleTop',\n insideMiddleBottom = 'insideMiddleBottom',\n insideEndTop = 'insideEndTop',\n insideEndBottom = 'insideEndBottom'\n}\n\nexport enum IMarkAreaLabelPosition {\n left = 'left',\n right = 'right',\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideLeft = 'insideLeft',\n insideRight = 'insideRight',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom'\n}\n\nexport enum IMarkPointItemPosition {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideMiddle = 'insideMiddle'\n}\n\nexport type IMarkBackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n /**\n * TODO: 根据文字宽度进行背景 panel size自适应\n */\n autoHeight?: boolean;\n /**\n * TODO: 根据文高度度进行背景 panel size自适应\n */\n autoWidth?: boolean;\n} & Partial<SymbolAttributes>;\n\nexport type IMarkLabel = Omit<TagAttributes, 'x' | 'y' | 'panel'> & {\n /**\n * 标签的背景面板配置\n */\n panel?: IMarkBackgroundAttributes;\n};\n\nexport type IMarkRef = {\n /**\n * 自动旋转,沿着线的方向,默认 true\n */\n autoRotate?: boolean;\n /**\n * label 相对line平行方向上的偏移\n */\n refX?: number;\n /**\n * label 相对line正交方向上的偏移\n */\n refY?: number;\n /**\n * label 相对默认角度的偏移 (label跟随line的角度做自动旋转时,默认按照line的平行向量作为初始角度)\n */\n refAngle?: number;\n};\n\nexport type MarkerAttrs = IGroupGraphicAttribute & {\n type?: 'line' | 'area' | 'point';\n /**\n * 是否支持交互\n * @default true\n */\n interactive?: boolean;\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 是否显示marker组件\n * @default true\n */\n visible?: boolean;\n /**\n * 是否将组件在绘制区域内进行剪切\n * @default true\n */\n clipInRange?: boolean;\n /**\n * 组件绘制范围配置\n */\n limitRect?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n};\n\n/** animation type */\nexport type BaseMarkerAnimation<T> = {\n animation?: MarkerAnimation<T> | boolean;\n animationEnter?: MarkerUpdateAnimation<T>;\n animationUpdate?: MarkerUpdateAnimation<T>;\n animationExit?: MarkerExitAnimation;\n};\nexport type MarkerAnimation<T> = MarkerUpdateAnimation<T> | MarkerUpdateAnimation<T>;\n\nexport type MarkerUpdateAnimation<T> = {\n type: T;\n} & MarkerExitAnimation;\n\nexport type MarkLineAnimationType = 'clipIn' | 'fadeIn';\n\nexport type MarkAreaAnimationType = 'fadeIn';\n\nexport type MarkPointAnimationType = 'callIn' | 'fadeIn';\n\nexport type MarkerExitAnimation = {\n duration?: number;\n delay?: number;\n easing?: EasingType;\n};\n\n/** state type */\nexport type MarkLineState = {\n line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[]>;\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n label?: State<Partial<ITextGraphicAttribute>>;\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type MarkAreaState = {\n area?: State<Partial<IPolygonGraphicAttribute>>;\n label?: State<Partial<ITextGraphicAttribute>>;\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type MarkPointState = {\n line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[]>;\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n symbol?: State<Partial<ISymbolGraphicAttribute>>;\n image?: State<Partial<IImageGraphicAttribute>>;\n text?: State<Partial<ITextGraphicAttribute>>;\n textBackground?: State<Partial<IRectGraphicAttribute>>;\n richText?: State<Partial<IRichTextGraphicAttribute>>;\n customMark?: State<Partial<IGroupGraphicAttribute>>;\n};\n\nexport type MarkLineAttrs = MarkerAttrs &\n Omit<SegmentAttributes, 'state'> & {\n type?: 'line';\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为曲线\n */\n points: Point[] | Point[][];\n\n /**\n * 标签\n */\n label?: {\n /**\n * label 相对line的位置\n */\n position?: keyof typeof IMarkLineLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n\n state?: MarkLineState;\n } & BaseMarkerAnimation<MarkLineAnimationType>;\n\nexport type MarkAreaAttrs = MarkerAttrs & {\n type?: 'area';\n /**\n * 构成area的点\n */\n points: Point[];\n /**\n * 标签\n */\n label?: {\n position?: keyof typeof IMarkAreaLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IPolygonAttribute;\n\n state?: MarkAreaState;\n} & BaseMarkerAnimation<MarkAreaAnimationType>;\n\nexport type IItemContent = IMarkRef & {\n /**\n * 标注类型\n * Tips: 保留'richText'与之前的定义做兼容\n */\n type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';\n position?: keyof typeof IMarkPointItemPosition;\n /**\n * x 方向偏移量\n */\n offsetX?: number;\n /**\n * y 方向偏移量\n */\n offsetY?: number;\n /**\n * type为symbol时, symbol的样式\n */\n symbolStyle?: ISymbolGraphicAttribute;\n /**\n * type为image时, image的样式\n */\n imageStyle?: IImageGraphicAttribute;\n /**\n * type为text时, text的配置\n * 'text'类型的ItemContent新增三种子类型:'text','rich','html'。配置在textStyle.type上,继承自TagAttributes。\n */\n textStyle?: IMarkLabel;\n /**\n * type为rich text时, rich text的样式\n */\n richTextStyle?: IRichTextGraphicAttribute;\n /**\n * type为custom时,允许以callback的方式传入需要render的item\n */\n renderCustomCallback?: () => IGroup;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n};\n\nexport type IItemLine = {\n /** TODO:'type-opo' */\n type?: 'type-s' | 'type-do' | 'type-po' | 'type-op';\n visible?: boolean;\n /**\n * 垂直于引导线的装饰线,参考案例: https://observablehq.com/@mikelotis/edmonton-population-history-line-chart\n */\n decorativeLine?: {\n visible?: boolean;\n length?: number;\n };\n} & Omit<SegmentAttributes, 'points'>;\n\nexport type MarkPointAttrs = Omit<MarkerAttrs, 'labelStyle'> & {\n /**\n * markPoint的位置(也是path的起点)\n */\n position: Point;\n /**\n * 标注引导线\n */\n itemLine?: IItemLine;\n\n /**\n * 标注内容\n */\n itemContent?: IItemContent;\n\n state?: MarkPointState;\n} & BaseMarkerAnimation<MarkPointAnimationType>;\n"]}
1
+ {"version":3,"sources":["../src/marker/type.ts"],"names":[],"mappings":";;;AAwBA,IAAY,+BAUX;AAVD,WAAY,+BAA+B;IACzC,kDAAe,CAAA;IACf,oDAAiB,CAAA;IACjB,8CAAW,CAAA;IACX,oEAAiC,CAAA;IACjC,0EAAuC,CAAA;IACvC,sEAAmC,CAAA;IACnC,4EAAyC,CAAA;IACzC,gEAA6B,CAAA;IAC7B,sEAAmC,CAAA;AACrC,CAAC,EAVW,+BAA+B,GAA/B,uCAA+B,KAA/B,uCAA+B,QAU1C;AAED,IAAY,+BAUX;AAVD,WAAY,+BAA+B;IACzC,gDAAa,CAAA;IACb,kDAAe,CAAA;IACf,8CAAW,CAAA;IACX,oDAAiB,CAAA;IACjB,oDAAiB,CAAA;IACjB,4DAAyB,CAAA;IACzB,8DAA2B,CAAA;IAC3B,0DAAuB,CAAA;IACvB,gEAA6B,CAAA;AAC/B,CAAC,EAVW,+BAA+B,GAA/B,uCAA+B,KAA/B,uCAA+B,QAU1C;AAED,IAAY,uBAQX;AARD,WAAY,uBAAuB;IACjC,0DAA+B,CAAA;IAC/B,sDAA2B,CAAA;IAC3B,4DAAiC,CAAA;IACjC,0DAA+B,CAAA;IAC/B,sDAA2B,CAAA;IAC3B,4DAAiC,CAAA;IACjC,4CAAiB,CAAA;AACnB,CAAC,EARW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAQlC;AAED,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,uDAA6B,CAAA;AAC/B,CAAC,EAPW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAOjC","file":"type.js","sourcesContent":["import type {\n EasingType,\n IArcGraphicAttribute,\n IGroup,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n ILineGraphicAttribute,\n IPolygonAttribute,\n IPolygonGraphicAttribute,\n IRectGraphicAttribute,\n IRichTextGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type {\n ArcSegmentAttributes,\n CommonSegmentAttributes,\n ILineGraphicWithCornerRadius,\n SegmentAttributes,\n SymbolAttributes\n} from '../segment';\nimport type { TagAttributes } from '../tag';\nimport type { Point, State } from '../core/type';\n\nexport enum ICartesianMarkLineLabelPosition {\n start = 'start',\n middle = 'middle',\n end = 'end',\n insideStartTop = 'insideStartTop',\n insideStartBottom = 'insideStartBottom',\n insideMiddleTop = 'insideMiddleTop',\n insideMiddleBottom = 'insideMiddleBottom',\n insideEndTop = 'insideEndTop',\n insideEndBottom = 'insideEndBottom'\n}\n\nexport enum ICartesianMarkAreaLabelPosition {\n left = 'left',\n right = 'right',\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideLeft = 'insideLeft',\n insideRight = 'insideRight',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom'\n}\n\nexport enum IPolarMarkLabelPosition {\n arcInnerStart = 'arcInnerStart',\n arcInnerEnd = 'arcInnerEnd',\n arcInnerMiddle = 'arcInnerMiddle',\n arcOuterStart = 'arcOuterStart',\n arcOuterEnd = 'arcOuterEnd',\n arcOuterMiddle = 'arcOuterMiddle',\n center = 'center'\n}\n\nexport enum IMarkPointItemPosition {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideMiddle = 'insideMiddle'\n}\n\nexport type IMarkBackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n /**\n * TODO: 根据文字宽度进行背景 panel size自适应\n */\n autoHeight?: boolean;\n /**\n * TODO: 根据文高度度进行背景 panel size自适应\n */\n autoWidth?: boolean;\n} & Partial<SymbolAttributes>;\n\nexport type IMarkLabel = Omit<TagAttributes, 'x' | 'y' | 'panel'> & {\n /**\n * 标签的背景面板配置\n */\n panel?: IMarkBackgroundAttributes;\n};\n\nexport type IMarkRef = {\n /**\n * 自动旋转,沿着线的方向,默认 true\n */\n autoRotate?: boolean;\n /**\n * label 相对line平行方向上的偏移\n */\n refX?: number;\n /**\n * label 相对line正交方向上的偏移\n */\n refY?: number;\n /**\n * label 相对默认角度的偏移 (label跟随line的角度做自动旋转时,默认按照line的平行向量作为初始角度)\n */\n refAngle?: number;\n};\n\nexport type MarkerAttrs = IGroupGraphicAttribute & {\n type?: 'cartesian-line' | 'polar-line' | 'polar-arc-line' | 'cartesian-area' | 'polar-area' | 'point';\n /**\n * 是否支持交互\n * @default true\n */\n interactive?: boolean;\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 是否显示marker组件\n * @default true\n */\n visible?: boolean;\n /**\n * 是否将组件在绘制区域内进行剪切\n * @default true\n */\n clipInRange?: boolean;\n /**\n * 组件绘制范围配置\n */\n limitRect?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n};\n\n/** animation type */\nexport type BaseMarkerAnimation<T> = {\n animation?: MarkerAnimation<T> | boolean;\n animationEnter?: MarkerUpdateAnimation<T>;\n animationUpdate?: MarkerUpdateAnimation<T>;\n animationExit?: MarkerExitAnimation;\n};\nexport type MarkerAnimation<T> = MarkerUpdateAnimation<T> | MarkerUpdateAnimation<T>;\n\nexport type MarkerUpdateAnimation<T> = {\n type: T;\n} & MarkerExitAnimation;\n\nexport type CommonMarkLineAnimationType = 'clipIn' | 'fadeIn';\n\nexport type CommonMarkAreaAnimationType = 'fadeIn';\n\nexport type MarkPointAnimationType = 'callIn' | 'fadeIn';\n\nexport type MarkerExitAnimation = {\n duration?: number;\n delay?: number;\n easing?: EasingType;\n};\n\n/** state type */\nexport type CommonMarkLineState = {\n line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[] | IArcGraphicAttribute>;\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n label?: State<Partial<ITextGraphicAttribute>>;\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type CartesianMarkAreaState = {\n area?: State<Partial<IPolygonGraphicAttribute>>;\n label?: State<Partial<ITextGraphicAttribute>>;\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type PolarMarkAreaState = {\n area?: State<Partial<IArcGraphicAttribute>>;\n label?: State<Partial<ITextGraphicAttribute>>;\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type MarkPointState = {\n line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[]>;\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n symbol?: State<Partial<ISymbolGraphicAttribute>>;\n image?: State<Partial<IImageGraphicAttribute>>;\n text?: State<Partial<ITextGraphicAttribute>>;\n textBackground?: State<Partial<IRectGraphicAttribute>>;\n richText?: State<Partial<IRichTextGraphicAttribute>>;\n customMark?: State<Partial<IGroupGraphicAttribute>>;\n};\n\nexport type CommonMarkLineAttrs<T> = MarkerAttrs &\n Omit<CommonSegmentAttributes, 'state' | 'lineStyle'> & {\n /**\n * 标签\n */\n label?: {\n /**\n * label 相对line的位置\n */\n position?: T;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n state?: CommonMarkLineState;\n } & BaseMarkerAnimation<CommonMarkLineAnimationType>;\n\nexport type CartesianMarkLineAttrs = CommonMarkLineAttrs<keyof typeof ICartesianMarkLineLabelPosition> & {\n type?: 'cartesian-line';\n /**\n * 是否对 points 进行多段处理,默认为 false,即直接将所有的点连接成线。\n * 如果需要进行多段处理,需要将 points 属性配置为 Point[][] 类型\n * @default false\n */\n multiSegment?: boolean;\n /**\n * 在 `multiSegment` 属性开启的前提下,用于声明那一段线段用来作为主线段,如果不声明,默认全段为主线段\n */\n mainSegmentIndex?: number;\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为曲线\n */\n points: Point[] | Point[][];\n lineStyle?: ILineGraphicAttribute;\n};\n\nexport type PolarMarkLineAttrs = CommonMarkLineAttrs<keyof typeof ICartesianMarkLineLabelPosition> & {\n type?: 'polar-line';\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为曲线\n */\n points: Point[] | Point[][];\n lineStyle?: ILineGraphicAttribute;\n};\n\nexport type PolarMarkArcLineAttrs = CommonMarkLineAttrs<keyof typeof IPolarMarkLabelPosition> & {\n type?: 'polar-arc-line';\n /**\n * 弧线中心位置\n */\n center: {\n x: number;\n y: number;\n };\n /**\n * 弧线半径\n */\n radius: number;\n /**\n * 弧线起始角度(弧度)\n */\n startAngle: number;\n /**\n * 弧线终点角度(弧度)\n */\n endAngle: number;\n lineStyle?: IArcGraphicAttribute;\n};\n\nexport type CartesianMarkAreaAttrs = MarkerAttrs & {\n type?: 'cartesian-area';\n /**\n * 构成area的点\n */\n points: Point[];\n /**\n * 标签\n */\n label?: {\n position?: keyof typeof ICartesianMarkAreaLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IPolygonAttribute;\n\n state?: CartesianMarkAreaState;\n} & BaseMarkerAnimation<CommonMarkAreaAnimationType>;\n\nexport type PolarMarkAreaAttrs = MarkerAttrs & {\n type?: 'polar-area';\n /**\n * 扇区中心位置\n */\n center: {\n x: number;\n y: number;\n };\n /**\n * 扇区内半径\n */\n innerRadius: number;\n /**\n * 扇区外半径\n */\n outerRadius: number;\n /**\n * 扇区起始角度(弧度)\n */\n startAngle: number;\n /**\n * 扇区终点角度(弧度)\n */\n endAngle: number;\n /**\n * 标签\n */\n label?: {\n position?: keyof typeof IPolarMarkLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IArcGraphicAttribute;\n\n state?: PolarMarkAreaState;\n} & BaseMarkerAnimation<CommonMarkAreaAnimationType>;\n\nexport type IItemContent = IMarkRef & {\n /**\n * 标注类型\n * Tips: 保留'richText'与之前的定义做兼容\n */\n type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';\n position?: keyof typeof IMarkPointItemPosition;\n /**\n * x 方向偏移量\n */\n offsetX?: number;\n /**\n * y 方向偏移量\n */\n offsetY?: number;\n /**\n * type为symbol时, symbol的样式\n */\n symbolStyle?: ISymbolGraphicAttribute;\n /**\n * type为image时, image的样式\n */\n imageStyle?: IImageGraphicAttribute;\n /**\n * type为text时, text的配置\n * 'text'类型的ItemContent新增三种子类型:'text','rich','html'。配置在textStyle.type上,继承自TagAttributes。\n */\n textStyle?: IMarkLabel;\n /**\n * type为rich text时, rich text的样式\n */\n richTextStyle?: IRichTextGraphicAttribute;\n /**\n * type为custom时,允许以callback的方式传入需要render的item\n */\n renderCustomCallback?: () => IGroup;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n};\n\nexport type IItemLine = {\n /** TODO:'type-opo' */\n type?: 'type-s' | 'type-do' | 'type-po' | 'type-op';\n visible?: boolean;\n /**\n * 垂直于引导线的装饰线,参考案例: https://observablehq.com/@mikelotis/edmonton-population-history-line-chart\n */\n decorativeLine?: {\n visible?: boolean;\n length?: number;\n };\n} & Omit<SegmentAttributes, 'points'>;\n\nexport type MarkPointAttrs = Omit<MarkerAttrs, 'labelStyle'> & {\n /**\n * markPoint的位置(也是path的起点)\n */\n position: Point;\n /**\n * 标注引导线\n */\n itemLine?: IItemLine;\n\n /**\n * 标注内容\n */\n itemContent?: IItemContent;\n\n state?: MarkPointState;\n} & BaseMarkerAnimation<MarkPointAnimationType>;\n"]}
@@ -0,0 +1,13 @@
1
+ import type { IArc } from '@visactor/vrender-core';
2
+ import type { ArcSegmentAttributes } from './type';
3
+ import type { Point } from '../core/type';
4
+ import type { ComponentOptions } from '../interface';
5
+ import { Segment } from './segment';
6
+ export declare class ArcSegment extends Segment {
7
+ name: string;
8
+ line?: IArc;
9
+ constructor(attributes: ArcSegmentAttributes, options?: ComponentOptions);
10
+ getMainSegmentPoints(): Point[];
11
+ protected _computeRotate(angle: number): number;
12
+ protected render(): void;
13
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.ArcSegment = void 0;
6
+
7
+ const vutils_1 = require("@visactor/vutils"), vrender_core_1 = require("@visactor/vrender-core"), register_1 = require("./register"), segment_1 = require("./segment");
8
+
9
+ (0, register_1.loadArcSegmentComponent)();
10
+
11
+ class ArcSegment extends segment_1.Segment {
12
+ constructor(attributes, options) {
13
+ super((null == options ? void 0 : options.skipDefault) ? attributes : (0, vutils_1.merge)({}, segment_1.Segment.defaultAttributes, attributes)),
14
+ this.name = "arc-segment";
15
+ }
16
+ getMainSegmentPoints() {
17
+ return this._mainSegmentPoints;
18
+ }
19
+ _computeRotate(angle) {
20
+ return angle + Math.PI;
21
+ }
22
+ render() {
23
+ this.removeAllChild(!0), this._reset();
24
+ const {startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle, state: state, visible: visible = !0, radius: radius, startAngle: startAngle, endAngle: endAngle, center: center} = this.attribute;
25
+ if (!visible) return;
26
+ this._startAngle = startAngle, this._endAngle = endAngle;
27
+ const startPoint = {
28
+ x: center.x + radius * Math.cos(this._startAngle),
29
+ y: center.y + radius * Math.sin(this._startAngle)
30
+ }, endPoint = {
31
+ x: center.x + radius * Math.cos(this._endAngle),
32
+ y: center.y + radius * Math.sin(this._endAngle)
33
+ };
34
+ this._mainSegmentPoints = [ startPoint, endPoint ];
35
+ const startSymbolShape = this._renderSymbol(startSymbol, this._mainSegmentPoints, "start"), endSymbolShape = this._renderSymbol(endSymbol, this._mainSegmentPoints, "end");
36
+ this.startSymbol = startSymbolShape, this.endSymbol = endSymbolShape;
37
+ const line = vrender_core_1.graphicCreator.arc(Object.assign({
38
+ x: center.x,
39
+ y: center.y,
40
+ startAngle: startAngle,
41
+ endAngle: endAngle,
42
+ innerRadius: radius,
43
+ outerRadius: radius
44
+ }, lineStyle));
45
+ line.name = `${this.name}-line`, line.id = this._getNodeId("arc"), (0, vutils_1.isEmpty)(null == state ? void 0 : state.line) || (line.states = [].concat(state.line)[0]),
46
+ this.add(line), this.line = line;
47
+ }
48
+ }
49
+
50
+ exports.ArcSegment = ArcSegment;
51
+ //# sourceMappingURL=arc-segment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/segment/arc-segment.ts"],"names":[],"mappings":";;;AAGA,6CAAkD;AAGlD,yDAAwD;AAIxD,yCAAqD;AACrD,uCAAoC;AAEpC,IAAA,kCAAuB,GAAE,CAAC;AAC1B,MAAa,UAAW,SAAQ,iBAAO;IAIrC,YAAY,UAAgC,EAAE,OAA0B;QACtE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,iBAAO,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAJ9F,SAAI,GAAG,aAAa,CAAC;IAKrB,CAAC;IAED,oBAAoB;QAClB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAES,cAAc,CAAC,KAAa;QACpC,OAAO,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC;IACzB,CAAC;IAES,MAAM;QACd,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,MAAM,EAEJ,WAAW,EACX,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,GAAG,IAAI,EACd,MAAM,EACN,UAAU,EACV,QAAQ,EACR,MAAM,EACP,GAAG,IAAI,CAAC,SAAiC,CAAC;QAE3C,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;SACR;QAED,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,QAAQ,C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AA,gBAAO,EAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAC,EAAE;YACzB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;SACxC;QACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AA1ED,gCA0EC","file":"arc-segment.js","sourcesContent":["/**\n * @description 标签组件\n */\nimport { isEmpty, merge } from '@visactor/vutils';\nimport type { IArc } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport type { ArcSegmentAttributes, SymbolAttributes } from './type';\nimport type { Point } from '../core/type';\nimport type { ComponentOptions } from '../interface';\nimport { loadArcSegmentComponent } from './register';\nimport { Segment } from './segment';\n\nloadArcSegmentComponent();\nexport class ArcSegment extends Segment {\n name = 'arc-segment';\n line?: IArc;\n\n constructor(attributes: ArcSegmentAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Segment.defaultAttributes, attributes));\n }\n\n getMainSegmentPoints() {\n return this._mainSegmentPoints;\n }\n\n protected _computeRotate(angle: number) {\n return angle + Math.PI;\n }\n\n protected render() {\n this.removeAllChild(true);\n this._reset();\n const {\n // points,\n startSymbol,\n endSymbol,\n lineStyle,\n state,\n visible = true,\n radius,\n startAngle,\n endAngle,\n center\n } = this.attribute as ArcSegmentAttributes;\n\n if (!visible) {\n return;\n }\n\n this._startAngle = startAngle;\n this._endAngle = endAngle;\n\n // 绘制start和end symbol\n const startPoint: Point = {\n x: center.x + radius * Math.cos(this._startAngle),\n y: center.y + radius * Math.sin(this._startAngle)\n };\n const endPoint: Point = {\n x: center.x + radius * Math.cos(this._endAngle),\n y: center.y + radius * Math.sin(this._endAngle)\n };\n this._mainSegmentPoints = [startPoint, endPoint];\n\n const startSymbolShape = this._renderSymbol(startSymbol as SymbolAttributes, this._mainSegmentPoints, 'start');\n const endSymbolShape = this._renderSymbol(endSymbol as SymbolAttributes, this._mainSegmentPoints, 'end');\n\n this.startSymbol = startSymbolShape;\n this.endSymbol = endSymbolShape;\n\n const line = graphicCreator.arc({\n x: center.x,\n y: center.y,\n startAngle,\n endAngle,\n innerRadius: radius,\n outerRadius: radius,\n ...lineStyle\n });\n\n line.name = `${this.name}-line`;\n line.id = this._getNodeId('arc');\n if (!isEmpty(state?.line)) {\n line.states = [].concat(state.line)[0];\n }\n this.add(line);\n this.line = line;\n }\n}\n"]}
@@ -1,2 +1,3 @@
1
1
  export * from './segment';
2
+ export * from './arc-segment';
2
3
  export * from './type';
@@ -17,5 +17,6 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
17
17
 
18
18
  Object.defineProperty(exports, "__esModule", {
19
19
  value: !0
20
- }), __exportStar(require("./segment"), exports), __exportStar(require("./type"), exports);
20
+ }), __exportStar(require("./segment"), exports), __exportStar(require("./arc-segment"), exports),
21
+ __exportStar(require("./type"), exports);
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/segment/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,4CAA0B;AAC1B,yCAAuB","file":"index.js","sourcesContent":["/**\n * @description 线,两端可带箭头等 symbol\n */\nexport * from './segment';\nexport * from './type';\n"]}
1
+ {"version":3,"sources":["../src/segment/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,4CAA0B;AAC1B,gDAA8B;AAC9B,yCAAuB","file":"index.js","sourcesContent":["/**\n * @description 线,两端可带箭头等 symbol\n */\nexport * from './segment';\nexport * from './arc-segment';\nexport * from './type';\n"]}
@@ -1 +1,2 @@
1
1
  export declare function loadSegmentComponent(enableAnimation?: boolean): void;
2
+ export declare function loadArcSegmentComponent(enableAnimation?: boolean): void;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.loadSegmentComponent = void 0;
5
+ }), exports.loadArcSegmentComponent = exports.loadSegmentComponent = void 0;
6
6
 
7
7
  const vrender_kits_1 = require("@visactor/vrender-kits");
8
8
 
@@ -11,5 +11,10 @@ function loadSegmentComponent(enableAnimation = !1) {
11
11
  (0, vrender_kits_1.registerSymbol)();
12
12
  }
13
13
 
14
- exports.loadSegmentComponent = loadSegmentComponent;
14
+ function loadArcSegmentComponent(enableAnimation = !1) {
15
+ (0, vrender_kits_1.registerGroup)(), (0, vrender_kits_1.registerLine)(), (0, vrender_kits_1.registerArc)(),
16
+ (0, vrender_kits_1.registerSymbol)();
17
+ }
18
+
19
+ exports.loadSegmentComponent = loadSegmentComponent, exports.loadArcSegmentComponent = loadArcSegmentComponent;
15
20
  //# sourceMappingURL=register.js.map