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

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 (103) 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/marker/base-line.d.ts +17 -0
  5. package/cjs/marker/base-line.js +67 -0
  6. package/cjs/marker/base-line.js.map +1 -0
  7. package/cjs/marker/{area.d.ts → cartesian/area.d.ts} +7 -7
  8. package/cjs/marker/{area.js → cartesian/area.js} +10 -10
  9. package/cjs/marker/cartesian/area.js.map +1 -0
  10. package/cjs/marker/cartesian/line.d.ts +14 -0
  11. package/cjs/marker/cartesian/line.js +57 -0
  12. package/cjs/marker/cartesian/line.js.map +1 -0
  13. package/cjs/marker/config.d.ts +34 -7
  14. package/cjs/marker/config.js +33 -7
  15. package/cjs/marker/config.js.map +1 -1
  16. package/cjs/marker/index.d.ts +4 -2
  17. package/cjs/marker/index.js +3 -2
  18. package/cjs/marker/index.js.map +1 -1
  19. package/cjs/marker/polar/arc-line.d.ts +11 -0
  20. package/cjs/marker/polar/arc-line.js +50 -0
  21. package/cjs/marker/polar/arc-line.js.map +1 -0
  22. package/cjs/marker/polar/area.d.ts +44 -0
  23. package/cjs/marker/polar/area.js +117 -0
  24. package/cjs/marker/polar/area.js.map +1 -0
  25. package/cjs/marker/polar/line.d.ts +1 -0
  26. package/cjs/marker/polar/line.js +3 -0
  27. package/cjs/marker/polar/line.js.map +1 -0
  28. package/cjs/marker/register.d.ts +5 -2
  29. package/cjs/marker/register.js +18 -5
  30. package/cjs/marker/register.js.map +1 -1
  31. package/cjs/marker/type.d.ts +71 -21
  32. package/cjs/marker/type.js +21 -15
  33. package/cjs/marker/type.js.map +1 -1
  34. package/cjs/segment/arc-segment.d.ts +13 -0
  35. package/cjs/segment/arc-segment.js +51 -0
  36. package/cjs/segment/arc-segment.js.map +1 -0
  37. package/cjs/segment/index.d.ts +1 -0
  38. package/cjs/segment/index.js +2 -1
  39. package/cjs/segment/index.js.map +1 -1
  40. package/cjs/segment/register.d.ts +1 -0
  41. package/cjs/segment/register.js +7 -2
  42. package/cjs/segment/register.js.map +1 -1
  43. package/cjs/segment/segment.d.ts +7 -6
  44. package/cjs/segment/segment.js +7 -5
  45. package/cjs/segment/segment.js.map +1 -1
  46. package/cjs/segment/type.d.ts +22 -4
  47. package/cjs/segment/type.js.map +1 -1
  48. package/es/index.d.ts +1 -1
  49. package/es/index.js +1 -1
  50. package/es/index.js.map +1 -1
  51. package/es/marker/base-line.d.ts +17 -0
  52. package/es/marker/base-line.js +71 -0
  53. package/es/marker/base-line.js.map +1 -0
  54. package/es/marker/{area.d.ts → cartesian/area.d.ts} +7 -7
  55. package/es/marker/{area.js → cartesian/area.js} +14 -14
  56. package/es/marker/cartesian/area.js.map +1 -0
  57. package/es/marker/cartesian/line.d.ts +14 -0
  58. package/es/marker/cartesian/line.js +61 -0
  59. package/es/marker/cartesian/line.js.map +1 -0
  60. package/es/marker/config.d.ts +34 -7
  61. package/es/marker/config.js +35 -7
  62. package/es/marker/config.js.map +1 -1
  63. package/es/marker/index.d.ts +4 -2
  64. package/es/marker/index.js +6 -2
  65. package/es/marker/index.js.map +1 -1
  66. package/es/marker/polar/arc-line.d.ts +11 -0
  67. package/es/marker/polar/arc-line.js +54 -0
  68. package/es/marker/polar/arc-line.js.map +1 -0
  69. package/es/marker/polar/area.d.ts +44 -0
  70. package/es/marker/polar/area.js +127 -0
  71. package/es/marker/polar/area.js.map +1 -0
  72. package/es/marker/polar/line.d.ts +1 -0
  73. package/es/marker/polar/line.js +3 -0
  74. package/es/marker/polar/line.js.map +1 -0
  75. package/es/marker/register.d.ts +5 -2
  76. package/es/marker/register.js +16 -4
  77. package/es/marker/register.js.map +1 -1
  78. package/es/marker/type.d.ts +71 -21
  79. package/es/marker/type.js +24 -15
  80. package/es/marker/type.js.map +1 -1
  81. package/es/segment/arc-segment.d.ts +13 -0
  82. package/es/segment/arc-segment.js +49 -0
  83. package/es/segment/arc-segment.js.map +1 -0
  84. package/es/segment/index.d.ts +1 -0
  85. package/es/segment/index.js +2 -0
  86. package/es/segment/index.js.map +1 -1
  87. package/es/segment/register.d.ts +1 -0
  88. package/es/segment/register.js +5 -1
  89. package/es/segment/register.js.map +1 -1
  90. package/es/segment/segment.d.ts +7 -6
  91. package/es/segment/segment.js +7 -5
  92. package/es/segment/segment.js.map +1 -1
  93. package/es/segment/type.d.ts +22 -4
  94. package/es/segment/type.js.map +1 -1
  95. package/package.json +3 -3
  96. package/cjs/marker/area.js.map +0 -1
  97. package/cjs/marker/line.d.ts +0 -18
  98. package/cjs/marker/line.js +0 -100
  99. package/cjs/marker/line.js.map +0 -1
  100. package/es/marker/area.js.map +0 -1
  101. package/es/marker/line.d.ts +0 -18
  102. package/es/marker/line.js +0 -108
  103. package/es/marker/line.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/marker/polar/arc-line.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,2CAA2C;AAC3C,sCAA2D;AAE3D,0CAA4D;AAC5D,6CAAgD;AAChD,4CAA4C;AAE5C,IAAA,wCAA6B,GAAE,CAAC;AAChC,MAAa,gBAAiB,SAAQ,wBAAY;IAAlD;;QACE,SAAI,GAAG,kBAAkB,CAAC;IA0C5B,CAAC;IAtCW,aAAa;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAES,aAAa;QACrB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI;aAC5F,SAAkC,CAAC;QACtC,OAAO,IAAI,oBAAU,CAAC;YACpB,MAAM;YACN,MAAM;YACN,UAAU;YACV,QAAQ;YACR,WAAW;YACX,SAAS;YACT,SAAS;YACT,KAAK,EAAE;gBACL,IAAI,EAAE,IAAA,cAAK,EAAC,EAAE,EAAE,yBAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAC;gBAC5C,WAAW,EAAE,IAAA,cAAK,EAAC,EAAE,EAAE,yBAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,CAAC;gBAC9D,SAAS,EAAE,IAAA,cAAK,EAAC,EAAE,EAAE,yBAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,CAAC;aAC3D;SACF,CAAC,CAAC;IACL,CAAC;IAES,iBAAiB;QACzB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI;aACrF,SAAkC,CAAC;QACtC,IAAI,IAAI,CAAC,KAAK,EAAE;YACb,IAAI,CAAC,KAAa,CAAC,aAAa,CAAC;gBAChC,MAAM;gBACN,MAAM;gBACN,UAAU;gBACV,QAAQ;gBACR,WAAW;gBACX,SAAS;gBACT,SAAS;aACV,CAAC,CAAC;SACJ;IACH,CAAC;;AA1CH,4CA2CC;AAzCQ,kCAAiB,GAAmC,uCAA8B,CAAC","file":"arc-line.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { ArcSegment } from '../../segment';\nimport { DEFAULT_COMMON_MARK_LINE_THEME } from '../config';\nimport type { PolarMarkArcLineAttrs } from '../type';\nimport { loadPolarMarkArcLineComponent } from '../register';\nimport { DEFAULT_STATES } from '../../constant';\nimport { BaseMarkLine } from '../base-line';\n\nloadPolarMarkArcLineComponent();\nexport class PolarMarkArcLine extends BaseMarkLine {\n name = 'polarMarkArcLine';\n static defaultAttributes: Partial<PolarMarkArcLineAttrs> = DEFAULT_COMMON_MARK_LINE_THEME;\n protected _line!: ArcSegment;\n\n protected isValidPoints() {\n return true;\n }\n\n protected createSegment() {\n const { center, radius, startAngle, endAngle, startSymbol, endSymbol, lineStyle, state } = this\n .attribute as PolarMarkArcLineAttrs;\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 { center, radius, startAngle, endAngle, startSymbol, endSymbol, lineStyle } = this\n .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"]}
@@ -0,0 +1,44 @@
1
+ import type { IArc, IGroup } from '@visactor/vrender-core';
2
+ import { Tag } from '../../tag';
3
+ import { Marker } from '../base';
4
+ import { IPolarMarkAreaLabelPosition, type PolarMarkAreaAttrs } from '../type';
5
+ import type { ComponentOptions } from '../../interface';
6
+ export declare class PolarMarkArea extends Marker<PolarMarkAreaAttrs> {
7
+ name: string;
8
+ static defaultAttributes: {
9
+ interactive: boolean;
10
+ label: {
11
+ position: IPolarMarkAreaLabelPosition;
12
+ textStyle: {
13
+ fill: string;
14
+ stroke: string;
15
+ lineWidth: number;
16
+ fontSize: number;
17
+ fontWeight: string;
18
+ fontStyle: string;
19
+ textAlign: string;
20
+ textBaseLine: string;
21
+ };
22
+ padding: number[];
23
+ panel: {
24
+ visible: boolean;
25
+ cornerRadius: number;
26
+ fill: string;
27
+ fillOpacity: number;
28
+ };
29
+ };
30
+ areaStyle: {
31
+ fill: string;
32
+ visible: boolean;
33
+ };
34
+ };
35
+ private _area;
36
+ getArea(): IArc;
37
+ getLabel(): Tag;
38
+ constructor(attributes: PolarMarkAreaAttrs, options?: ComponentOptions);
39
+ private _getPositionByDirection;
40
+ protected setLabelPos(): void;
41
+ protected initMarker(container: IGroup): void;
42
+ protected updateMarker(): void;
43
+ protected isValidPoints(): boolean;
44
+ }
@@ -0,0 +1,117 @@
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(area, direction) {
23
+ const {center: center, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle} = this.attribute;
24
+ switch (direction) {
25
+ case type_1.IPolarMarkAreaLabelPosition.center:
26
+ return {
27
+ x: center.x + (innerRadius + outerRadius) / 2 * Math.cos((startAngle + endAngle) / 2),
28
+ y: center.y + (innerRadius + outerRadius) / 2 * Math.sin((startAngle + endAngle) / 2)
29
+ };
30
+
31
+ case type_1.IPolarMarkAreaLabelPosition.arcStart:
32
+ return {
33
+ x: center.x + (innerRadius + outerRadius) / 2 * Math.cos(startAngle),
34
+ y: center.y + (innerRadius + outerRadius) / 2 * Math.sin(startAngle)
35
+ };
36
+
37
+ case type_1.IPolarMarkAreaLabelPosition.arcEnd:
38
+ return {
39
+ x: center.x + (innerRadius + outerRadius) / 2 * Math.cos(endAngle),
40
+ y: center.y + (innerRadius + outerRadius) / 2 * Math.sin(endAngle)
41
+ };
42
+
43
+ case type_1.IPolarMarkAreaLabelPosition.arcInner:
44
+ return {
45
+ x: center.x + innerRadius * Math.cos((startAngle + endAngle) / 2),
46
+ y: center.y + innerRadius * Math.sin((startAngle + endAngle) / 2)
47
+ };
48
+
49
+ case type_1.IPolarMarkAreaLabelPosition.arcOuter:
50
+ return {
51
+ x: center.x + outerRadius * Math.cos((startAngle + endAngle) / 2),
52
+ y: center.y + outerRadius * Math.sin((startAngle + endAngle) / 2)
53
+ };
54
+
55
+ default:
56
+ return {
57
+ x: center.x + innerRadius * Math.cos((startAngle + endAngle) / 2),
58
+ y: center.y + innerRadius * Math.sin((startAngle + endAngle) / 2)
59
+ };
60
+ }
61
+ }
62
+ setLabelPos() {
63
+ var _a;
64
+ if (this._label && this._area) {
65
+ const {label: label = {}} = this.attribute, labelPosition = null !== (_a = label.position) && void 0 !== _a ? _a : "middle", labelPoint = this._getPositionByDirection(this._area, labelPosition);
66
+ if (this._label.setAttributes(Object.assign({}, labelPoint)), this.attribute.limitRect && label.confine) {
67
+ const {x: x, y: y, width: width, height: height} = this.attribute.limitRect;
68
+ (0, limit_shape_1.limitShapeInBounds)(this._label, {
69
+ x1: x,
70
+ y1: y,
71
+ x2: x + width,
72
+ y2: y + height
73
+ });
74
+ }
75
+ }
76
+ }
77
+ initMarker(container) {
78
+ 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({
79
+ x: center.x,
80
+ y: center.y,
81
+ innerRadius: innerRadius,
82
+ outerRadius: outerRadius,
83
+ startAngle: startAngle,
84
+ endAngle: endAngle
85
+ }, areaStyle));
86
+ area.states = (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.area),
87
+ area.name = "polar-mark-area-area", this._area = area, container.add(area);
88
+ const markLabel = new tag_1.Tag(Object.assign(Object.assign({}, label), {
89
+ state: {
90
+ panel: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.labelBackground),
91
+ text: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.label)
92
+ }
93
+ }));
94
+ markLabel.name = "mark-area-label", this._label = markLabel, container.add(markLabel),
95
+ this.setLabelPos();
96
+ }
97
+ updateMarker() {
98
+ const {center: center, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle, areaStyle: areaStyle, label: label} = this.attribute;
99
+ this._area && this._area.setAttributes(Object.assign({
100
+ x: center.x,
101
+ y: center.y,
102
+ innerRadius: innerRadius,
103
+ outerRadius: outerRadius,
104
+ startAngle: startAngle,
105
+ endAngle: endAngle
106
+ }, areaStyle)), this._area && this._label.setAttributes(Object.assign({
107
+ dx: 0,
108
+ dy: 0
109
+ }, label)), this.setLabelPos();
110
+ }
111
+ isValidPoints() {
112
+ return !0;
113
+ }
114
+ }
115
+
116
+ exports.PolarMarkArea = PolarMarkArea, PolarMarkArea.defaultAttributes = config_1.DEFAULT_POLAR_MARK_AREA_THEME;
117
+ //# 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,kCAA+E;AAC/E,wDAA4D;AAE5D,0CAAyD;AACzD,6CAAgD;AAEhD,IAAA,qCAA0B,GAAE,CAAC;AAC7B,MAAa,aAAc,SAAQ,aAA0B;IAK3D,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,YAAY,UAA8B,EAAE,OAA0B;QACpE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,aAAa,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAbpG,SAAI,GAAG,eAAe,CAAC;IAcvB,CAAC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,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;;AAnIH,sCAoIC;AAlIQ,+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 { IPolarMarkAreaLabelPosition, 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 private _getPositionByDirection(area: IArc, direction: string) {\n const { center, innerRadius, outerRadius, startAngle, endAngle } = this.attribute as PolarMarkAreaAttrs;\n\n switch (direction) {\n case IPolarMarkAreaLabelPosition.center:\n return {\n x: center.x + ((innerRadius + outerRadius) / 2) * Math.cos((startAngle + endAngle) / 2),\n y: center.y + ((innerRadius + outerRadius) / 2) * Math.sin((startAngle + endAngle) / 2)\n };\n case IPolarMarkAreaLabelPosition.arcStart:\n return {\n x: center.x + ((innerRadius + outerRadius) / 2) * Math.cos(startAngle),\n y: center.y + ((innerRadius + outerRadius) / 2) * Math.sin(startAngle)\n };\n case IPolarMarkAreaLabelPosition.arcEnd:\n return {\n x: center.x + ((innerRadius + outerRadius) / 2) * Math.cos(endAngle),\n y: center.y + ((innerRadius + outerRadius) / 2) * Math.sin(endAngle)\n };\n case IPolarMarkAreaLabelPosition.arcInner:\n return {\n x: center.x + innerRadius * Math.cos((startAngle + endAngle) / 2),\n y: center.y + innerRadius * Math.sin((startAngle + endAngle) / 2)\n };\n case IPolarMarkAreaLabelPosition.arcOuter:\n return {\n x: center.x + outerRadius * Math.cos((startAngle + endAngle) / 2),\n y: center.y + outerRadius * Math.sin((startAngle + endAngle) / 2)\n };\n default: // default arcOuter\n return {\n x: center.x + innerRadius * Math.cos((startAngle + endAngle) / 2),\n y: center.y + innerRadius * Math.sin((startAngle + endAngle) / 2)\n };\n }\n }\n\n protected setLabelPos() {\n if (this._label && this._area) {\n const { label = {} } = this.attribute as PolarMarkAreaAttrs;\n const labelPosition = label.position ?? 'middle';\n const labelPoint = this._getPositionByDirection(this._area, labelPosition);\n this._label.setAttributes({\n ...labelPoint\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 ICommonMarkLineLabelPosition {
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,13 @@ export declare enum IMarkAreaLabelPosition {
24
24
  insideTop = "insideTop",
25
25
  insideBottom = "insideBottom"
26
26
  }
27
+ export declare enum IPolarMarkAreaLabelPosition {
28
+ arcStart = "arcStart",
29
+ arcEnd = "arcEnd",
30
+ arcInner = "arcInner",
31
+ arcOuter = "arcOuter",
32
+ center = "center"
33
+ }
27
34
  export declare enum IMarkPointItemPosition {
28
35
  top = "top",
29
36
  bottom = "bottom",
@@ -47,7 +54,7 @@ export type IMarkRef = {
47
54
  refAngle?: number;
48
55
  };
49
56
  export type MarkerAttrs = IGroupGraphicAttribute & {
50
- type?: 'line' | 'area' | 'point';
57
+ type?: 'cartesian-line' | 'polar-line' | 'polar-arc-line' | 'cartesian-area' | 'polar-area' | 'point';
51
58
  interactive?: boolean;
52
59
  select?: boolean;
53
60
  hover?: boolean;
@@ -70,26 +77,31 @@ export type MarkerAnimation<T> = MarkerUpdateAnimation<T> | MarkerUpdateAnimatio
70
77
  export type MarkerUpdateAnimation<T> = {
71
78
  type: T;
72
79
  } & MarkerExitAnimation;
73
- export type MarkLineAnimationType = 'clipIn' | 'fadeIn';
74
- export type MarkAreaAnimationType = 'fadeIn';
80
+ export type CommonMarkLineAnimationType = 'clipIn' | 'fadeIn';
81
+ export type CommonMarkAreaAnimationType = 'fadeIn';
75
82
  export type MarkPointAnimationType = 'callIn' | 'fadeIn';
76
83
  export type MarkerExitAnimation = {
77
84
  duration?: number;
78
85
  delay?: number;
79
86
  easing?: EasingType;
80
87
  };
81
- export type MarkLineState = {
82
- line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[]>;
88
+ export type CommonMarkLineState = {
89
+ line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[] | IArcGraphicAttribute>;
83
90
  lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;
84
91
  lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;
85
92
  label?: State<Partial<ITextGraphicAttribute>>;
86
93
  labelBackground?: State<Partial<IRectGraphicAttribute>>;
87
94
  };
88
- export type MarkAreaState = {
95
+ export type CartesianMarkAreaState = {
89
96
  area?: State<Partial<IPolygonGraphicAttribute>>;
90
97
  label?: State<Partial<ITextGraphicAttribute>>;
91
98
  labelBackground?: State<Partial<IRectGraphicAttribute>>;
92
99
  };
100
+ export type PolarMarkAreaState = {
101
+ area?: State<Partial<IArcGraphicAttribute>>;
102
+ label?: State<Partial<ITextGraphicAttribute>>;
103
+ labelBackground?: State<Partial<IRectGraphicAttribute>>;
104
+ };
93
105
  export type MarkPointState = {
94
106
  line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[]>;
95
107
  lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;
@@ -101,25 +113,63 @@ export type MarkPointState = {
101
113
  richText?: State<Partial<IRichTextGraphicAttribute>>;
102
114
  customMark?: State<Partial<IGroupGraphicAttribute>>;
103
115
  };
104
- export type MarkLineAttrs = MarkerAttrs & Omit<SegmentAttributes, 'state'> & {
105
- type?: 'line';
106
- points: Point[] | Point[][];
116
+ export type CommonMarkLineAttrs = MarkerAttrs & Omit<CommonSegmentAttributes, 'state' | 'lineStyle'> & {
107
117
  label?: {
108
- position?: keyof typeof IMarkLineLabelPosition;
118
+ position?: keyof typeof ICommonMarkLineLabelPosition;
109
119
  confine?: boolean;
110
120
  } & IMarkRef & IMarkLabel;
111
- state?: MarkLineState;
112
- } & BaseMarkerAnimation<MarkLineAnimationType>;
113
- export type MarkAreaAttrs = MarkerAttrs & {
114
- type?: 'area';
121
+ state?: CommonMarkLineState;
122
+ } & BaseMarkerAnimation<CommonMarkLineAnimationType>;
123
+ export type CartesianMarkLineAttrs = CommonMarkLineAttrs & {
124
+ type?: 'cartesian-line';
125
+ multiSegment?: boolean;
126
+ mainSegmentIndex?: number;
127
+ points: Point[] | Point[][];
128
+ lineStyle?: ILineGraphicAttribute;
129
+ };
130
+ export type PolarMarkLineAttrs = CommonMarkLineAttrs & {
131
+ type?: 'polar-line';
132
+ points: Point[] | Point[][];
133
+ lineStyle?: ILineGraphicAttribute;
134
+ };
135
+ export type PolarMarkArcLineAttrs = CommonMarkLineAttrs & {
136
+ type?: 'polar-arc-line';
137
+ center: {
138
+ x: number;
139
+ y: number;
140
+ };
141
+ radius: number;
142
+ startAngle: number;
143
+ endAngle: number;
144
+ lineStyle?: IArcGraphicAttribute;
145
+ };
146
+ export type CartesianMarkAreaAttrs = MarkerAttrs & {
147
+ type?: 'cartesian-area';
115
148
  points: Point[];
116
149
  label?: {
117
- position?: keyof typeof IMarkAreaLabelPosition;
150
+ position?: keyof typeof ICartesianMarkAreaLabelPosition;
118
151
  confine?: boolean;
119
152
  } & IMarkLabel;
120
153
  areaStyle?: IPolygonAttribute;
121
- state?: MarkAreaState;
122
- } & BaseMarkerAnimation<MarkAreaAnimationType>;
154
+ state?: CartesianMarkAreaState;
155
+ } & BaseMarkerAnimation<CommonMarkAreaAnimationType>;
156
+ export type PolarMarkAreaAttrs = MarkerAttrs & {
157
+ type?: 'polar-area';
158
+ center: {
159
+ x: number;
160
+ y: number;
161
+ };
162
+ innerRadius: number;
163
+ outerRadius: number;
164
+ startAngle: number;
165
+ endAngle: number;
166
+ label?: {
167
+ position?: keyof typeof IPolarMarkAreaLabelPosition;
168
+ confine?: boolean;
169
+ } & IMarkLabel;
170
+ areaStyle?: IArcGraphicAttribute;
171
+ state?: PolarMarkAreaState;
172
+ } & BaseMarkerAnimation<CommonMarkAreaAnimationType>;
123
173
  export type IItemContent = IMarkRef & {
124
174
  type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';
125
175
  position?: keyof typeof IMarkPointItemPosition;
@@ -1,23 +1,29 @@
1
1
  "use strict";
2
2
 
3
- var IMarkLineLabelPosition, IMarkAreaLabelPosition, IMarkPointItemPosition;
3
+ var ICommonMarkLineLabelPosition, ICartesianMarkAreaLabelPosition, IPolarMarkAreaLabelPosition, 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.IPolarMarkAreaLabelPosition = exports.ICartesianMarkAreaLabelPosition = exports.ICommonMarkLineLabelPosition = void 0,
8
+ function(ICommonMarkLineLabelPosition) {
9
+ ICommonMarkLineLabelPosition.start = "start", ICommonMarkLineLabelPosition.middle = "middle",
10
+ ICommonMarkLineLabelPosition.end = "end", ICommonMarkLineLabelPosition.insideStartTop = "insideStartTop",
11
+ ICommonMarkLineLabelPosition.insideStartBottom = "insideStartBottom", ICommonMarkLineLabelPosition.insideMiddleTop = "insideMiddleTop",
12
+ ICommonMarkLineLabelPosition.insideMiddleBottom = "insideMiddleBottom", ICommonMarkLineLabelPosition.insideEndTop = "insideEndTop",
13
+ ICommonMarkLineLabelPosition.insideEndBottom = "insideEndBottom";
14
+ }(ICommonMarkLineLabelPosition = exports.ICommonMarkLineLabelPosition || (exports.ICommonMarkLineLabelPosition = {})),
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(IPolarMarkAreaLabelPosition) {
23
+ IPolarMarkAreaLabelPosition.arcStart = "arcStart", IPolarMarkAreaLabelPosition.arcEnd = "arcEnd",
24
+ IPolarMarkAreaLabelPosition.arcInner = "arcInner", IPolarMarkAreaLabelPosition.arcOuter = "arcOuter",
25
+ IPolarMarkAreaLabelPosition.center = "center";
26
+ }(IPolarMarkAreaLabelPosition = exports.IPolarMarkAreaLabelPosition || (exports.IPolarMarkAreaLabelPosition = {})),
21
27
  function(IMarkPointItemPosition) {
22
28
  IMarkPointItemPosition.top = "top", IMarkPointItemPosition.bottom = "bottom", IMarkPointItemPosition.middle = "middle",
23
29
  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,4BAUX;AAVD,WAAY,4BAA4B;IACtC,+CAAe,CAAA;IACf,iDAAiB,CAAA;IACjB,2CAAW,CAAA;IACX,iEAAiC,CAAA;IACjC,uEAAuC,CAAA;IACvC,mEAAmC,CAAA;IACnC,yEAAyC,CAAA;IACzC,6DAA6B,CAAA;IAC7B,mEAAmC,CAAA;AACrC,CAAC,EAVW,4BAA4B,GAA5B,oCAA4B,KAA5B,oCAA4B,QAUvC;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,2BAMX;AAND,WAAY,2BAA2B;IACrC,oDAAqB,CAAA;IACrB,gDAAiB,CAAA;IACjB,oDAAqB,CAAA;IACrB,oDAAqB,CAAA;IACrB,gDAAiB,CAAA;AACnB,CAAC,EANW,2BAA2B,GAA3B,mCAA2B,KAA3B,mCAA2B,QAMtC;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 ICommonMarkLineLabelPosition {\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 IPolarMarkAreaLabelPosition {\n arcStart = 'arcStart',\n arcEnd = 'arcEnd',\n arcInner = 'arcInner',\n arcOuter = 'arcOuter',\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 = MarkerAttrs &\n Omit<CommonSegmentAttributes, 'state' | 'lineStyle'> & {\n /**\n * 标签\n */\n label?: {\n /**\n * label 相对line的位置\n */\n position?: keyof typeof ICommonMarkLineLabelPosition;\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 & {\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 & {\n type?: 'polar-line';\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为曲线\n */\n points: Point[] | Point[][];\n lineStyle?: ILineGraphicAttribute;\n};\n\nexport type PolarMarkArcLineAttrs = CommonMarkLineAttrs & {\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 IPolarMarkAreaLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\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,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,CAAC,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,OAAO,CAAC;QAChC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,CAAC,IAAA,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