@visactor/vrender-components 0.18.10-alpha.1 → 0.18.10-alpha.3
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.
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/label/arc.d.ts +2 -2
- package/cjs/label/base.d.ts +2 -2
- package/{es/marker/polar/area.d.ts → cjs/marker/arc-area.d.ts} +15 -9
- package/cjs/marker/arc-area.js +123 -0
- package/cjs/marker/arc-area.js.map +1 -0
- package/cjs/marker/arc-line.d.ts +23 -0
- package/cjs/marker/arc-line.js +103 -0
- package/cjs/marker/arc-line.js.map +1 -0
- package/cjs/marker/{cartesian/area.d.ts → area.d.ts} +13 -8
- package/cjs/marker/{cartesian/area.js → area.js} +16 -17
- package/cjs/marker/area.js.map +1 -0
- package/cjs/marker/base-line.d.ts +2 -2
- package/cjs/marker/base-line.js +4 -18
- package/cjs/marker/base-line.js.map +1 -1
- package/cjs/marker/config.d.ts +55 -12
- package/cjs/marker/config.js +54 -43
- package/cjs/marker/config.js.map +1 -1
- package/cjs/marker/index.d.ts +4 -4
- package/cjs/marker/index.js +3 -3
- package/cjs/marker/index.js.map +1 -1
- package/cjs/marker/line.d.ts +28 -0
- package/cjs/marker/line.js +153 -0
- package/cjs/marker/line.js.map +1 -0
- package/cjs/marker/point.d.ts +1 -1
- package/cjs/marker/register.d.ts +4 -5
- package/cjs/marker/register.js +8 -12
- package/cjs/marker/register.js.map +1 -1
- package/cjs/marker/type.d.ts +30 -38
- package/cjs/marker/type.js +21 -21
- package/cjs/marker/type.js.map +1 -1
- package/cjs/tag/tag.d.ts +5 -0
- package/cjs/tag/tag.js +11 -2
- package/cjs/tag/tag.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/label/arc.d.ts +2 -2
- package/es/label/base.d.ts +2 -2
- package/{cjs/marker/polar/area.d.ts → es/marker/arc-area.d.ts} +15 -9
- package/es/marker/arc-area.js +133 -0
- package/es/marker/arc-area.js.map +1 -0
- package/es/marker/arc-line.d.ts +23 -0
- package/es/marker/arc-line.js +109 -0
- package/es/marker/arc-line.js.map +1 -0
- package/es/marker/{cartesian/area.d.ts → area.d.ts} +13 -8
- package/es/marker/{cartesian/area.js → area.js} +20 -21
- package/es/marker/area.js.map +1 -0
- package/es/marker/base-line.d.ts +2 -2
- package/es/marker/base-line.js +2 -20
- package/es/marker/base-line.js.map +1 -1
- package/es/marker/config.d.ts +55 -12
- package/es/marker/config.js +54 -43
- package/es/marker/config.js.map +1 -1
- package/es/marker/index.d.ts +4 -4
- package/es/marker/index.js +4 -4
- package/es/marker/index.js.map +1 -1
- package/es/marker/line.d.ts +28 -0
- package/es/marker/line.js +159 -0
- package/es/marker/line.js.map +1 -0
- package/es/marker/point.d.ts +1 -1
- package/es/marker/register.d.ts +4 -5
- package/es/marker/register.js +4 -8
- package/es/marker/register.js.map +1 -1
- package/es/marker/type.d.ts +30 -38
- package/es/marker/type.js +22 -22
- package/es/marker/type.js.map +1 -1
- package/es/tag/tag.d.ts +5 -0
- package/es/tag/tag.js +11 -2
- package/es/tag/tag.js.map +1 -1
- package/package.json +3 -3
- package/cjs/marker/cartesian/area.js.map +0 -1
- package/cjs/marker/cartesian/line.d.ts +0 -14
- package/cjs/marker/cartesian/line.js +0 -57
- package/cjs/marker/cartesian/line.js.map +0 -1
- package/cjs/marker/polar/arc-line.d.ts +0 -11
- package/cjs/marker/polar/arc-line.js +0 -50
- package/cjs/marker/polar/arc-line.js.map +0 -1
- package/cjs/marker/polar/area.js +0 -117
- package/cjs/marker/polar/area.js.map +0 -1
- package/cjs/marker/polar/line.d.ts +0 -1
- package/cjs/marker/polar/line.js +0 -3
- package/cjs/marker/polar/line.js.map +0 -1
- package/es/marker/cartesian/area.js.map +0 -1
- package/es/marker/cartesian/line.d.ts +0 -14
- package/es/marker/cartesian/line.js +0 -61
- package/es/marker/cartesian/line.js.map +0 -1
- package/es/marker/polar/arc-line.d.ts +0 -11
- package/es/marker/polar/arc-line.js +0 -54
- package/es/marker/polar/arc-line.js.map +0 -1
- package/es/marker/polar/area.js +0 -127
- package/es/marker/polar/area.js.map +0 -1
- package/es/marker/polar/line.d.ts +0 -1
- package/es/marker/polar/line.js +0 -3
- package/es/marker/polar/line.js.map +0 -1
package/cjs/marker/polar/area.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;IAEO,uBAAuB,CAAC,IAAU,EAAE,SAAiB;QAC3D,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,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AAE,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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/cjs/marker/polar/line.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/cartesian/area.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE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S,EAAE,GAAG,IAAI,CAAC,SAAmC,CAAC;QAC9E,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,KAAK,CAAC,aAAa,iBACtB,MAAM,EAAE,MAAM,IACX,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,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,SAAmC,CAAC;QAC5D,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,OAAO,KAAK,CAAC;SACd;QACD,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB,MAAM,CAAC,OAAO,CAAC,CAAC,KAAY,EAAE,EAAE;YAC9B,IAAI,CAAC,aAAa,CAAE,KAAe,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAE,KAAe,CAAC,CAAC,CAAC,EAAE;gBAC5E,SAAS,GAAG,KAAK,CAAC;gBAClB,OAAO;aACR;QACH,CAAC,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACnB,CAAC;;AAhIM,mCAAiB,GAAG,iCAAiC,CAAC","file":"area.js","sourcesContent":["import type { IGroup, INode, IPolygon } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport { isValidNumber, 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_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP, DEFAULT_CARTESIAN_MARK_AREA_THEME } from '../config';\nimport type { CartesianMarkAreaAttrs } from '../type';\nimport { limitShapeInBounds } from '../../util/limit-shape';\nimport type { ComponentOptions } from '../../interface';\nimport { loadCartesianMarkAreaComponent } from '../register';\nimport type { Point } from '../../core/type';\nimport { DEFAULT_STATES } from '../../constant';\n\nloadCartesianMarkAreaComponent();\nexport class CartesianMarkArea extends Marker<CartesianMarkAreaAttrs> {\n name = 'cartesianMarkArea';\n static defaultAttributes = DEFAULT_CARTESIAN_MARK_AREA_THEME;\n private _area!: IPolygon;\n getArea() {\n return this._area;\n }\n\n getLabel() {\n return this._label;\n }\n\n constructor(attributes: CartesianMarkAreaAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, CartesianMarkArea.defaultAttributes, attributes));\n }\n\n private _getPositionByDirection(area: IPolygon, direction: string) {\n const { x1, x2, y1, y2 } = this._area.AABBBounds;\n\n if (direction.includes('left') || direction.includes('Left')) {\n return {\n x: x1,\n y: (y1 + y2) / 2\n };\n }\n if (direction.includes('right') || direction.includes('Right')) {\n return {\n x: x2,\n y: (y1 + y2) / 2\n };\n }\n if (direction.includes('top') || direction.includes('Top')) {\n return {\n x: (x1 + x2) / 2,\n y: y1\n };\n }\n if (direction.includes('bottom') || direction.includes('Bottom')) {\n return {\n x: (x1 + x2) / 2,\n y: y2\n };\n }\n\n return {\n x: (x1 + x2) / 2,\n y: (y1 + y2) / 2\n };\n }\n\n protected setLabelPos() {\n if (this._label && this._area) {\n const { label = {} } = this.attribute as CartesianMarkAreaAttrs;\n const labelPosition = label.position ?? 'middle';\n const labelPoint = this._getPositionByDirection(this._area, labelPosition);\n this._label.setAttributes({\n ...labelPoint,\n textStyle: {\n ...DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP[labelPosition],\n ...label.textStyle\n }\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 { points, label, areaStyle, state } = this.attribute as CartesianMarkAreaAttrs;\n const area = graphicCreator.polygon({\n points: points,\n ...areaStyle\n });\n area.states = merge({}, DEFAULT_STATES, state?.area);\n area.name = 'mark-polygon-polygon';\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-polygon-label';\n this._label = markLabel;\n container.add(markLabel as unknown as INode);\n this.setLabelPos();\n }\n\n protected updateMarker() {\n const { points, label, areaStyle } = this.attribute as CartesianMarkAreaAttrs;\n if (this._area) {\n this._area.setAttributes({\n points: points,\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 const { points } = this.attribute as CartesianMarkAreaAttrs;\n if (!points || points.length < 3) {\n return false;\n }\n let validFlag = true;\n points.forEach((point: Point) => {\n if (!isValidNumber((point as Point).x) || !isValidNumber((point as Point).y)) {\n validFlag = false;\n return;\n }\n });\n return validFlag;\n }\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { CartesianMarkLineAttrs } from '../type';
|
|
2
|
-
import type { ComponentOptions } from '../../interface';
|
|
3
|
-
import { BaseMarkLine } from '../base-line';
|
|
4
|
-
import type { ArcSegment } from '../../segment';
|
|
5
|
-
import { Segment } from '../../segment';
|
|
6
|
-
export declare class CartesianMarkLine extends BaseMarkLine {
|
|
7
|
-
name: string;
|
|
8
|
-
static defaultAttributes: Partial<CartesianMarkLineAttrs>;
|
|
9
|
-
protected _line: Segment | ArcSegment;
|
|
10
|
-
constructor(attributes: CartesianMarkLineAttrs, options?: ComponentOptions);
|
|
11
|
-
protected isValidPoints(): boolean;
|
|
12
|
-
protected createSegment(): Segment;
|
|
13
|
-
protected setLineAttributes(): void;
|
|
14
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { isValidNumber, merge } from "@visactor/vutils";
|
|
2
|
-
|
|
3
|
-
import { DEFAULT_COMMON_MARK_LINE_THEME } from "../config";
|
|
4
|
-
|
|
5
|
-
import { loadCartesianMarkLineComponent } from "../register";
|
|
6
|
-
|
|
7
|
-
import { BaseMarkLine } from "../base-line";
|
|
8
|
-
|
|
9
|
-
import { Segment } from "../../segment";
|
|
10
|
-
|
|
11
|
-
import { DEFAULT_STATES } from "../../constant";
|
|
12
|
-
|
|
13
|
-
loadCartesianMarkLineComponent();
|
|
14
|
-
|
|
15
|
-
export class CartesianMarkLine extends BaseMarkLine {
|
|
16
|
-
constructor(attributes, options) {
|
|
17
|
-
super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, CartesianMarkLine.defaultAttributes, attributes)),
|
|
18
|
-
this.name = "cartesianMarkLine";
|
|
19
|
-
}
|
|
20
|
-
isValidPoints() {
|
|
21
|
-
const {points: points} = this.attribute;
|
|
22
|
-
if (!points || points.length < 2) return !1;
|
|
23
|
-
let validFlag = !0;
|
|
24
|
-
return points.forEach((point => {
|
|
25
|
-
if (point.length) point.forEach((p => {
|
|
26
|
-
isValidNumber(p.x) && isValidNumber(p.y) || (validFlag = !1);
|
|
27
|
-
})); else if (!isValidNumber(point.x) || !isValidNumber(point.y)) return void (validFlag = !1);
|
|
28
|
-
})), validFlag;
|
|
29
|
-
}
|
|
30
|
-
createSegment() {
|
|
31
|
-
const {points: points, startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle, mainSegmentIndex: mainSegmentIndex, multiSegment: multiSegment, state: state} = this.attribute;
|
|
32
|
-
return new Segment({
|
|
33
|
-
points: points,
|
|
34
|
-
startSymbol: startSymbol,
|
|
35
|
-
endSymbol: endSymbol,
|
|
36
|
-
lineStyle: lineStyle,
|
|
37
|
-
mainSegmentIndex: mainSegmentIndex,
|
|
38
|
-
multiSegment: multiSegment,
|
|
39
|
-
pickable: !1,
|
|
40
|
-
state: {
|
|
41
|
-
line: merge({}, DEFAULT_STATES, null == state ? void 0 : state.line),
|
|
42
|
-
startSymbol: merge({}, DEFAULT_STATES, null == state ? void 0 : state.lineStartSymbol),
|
|
43
|
-
endSymbol: merge({}, DEFAULT_STATES, null == state ? void 0 : state.lineEndSymbol)
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
setLineAttributes() {
|
|
48
|
-
const {points: points, startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle, mainSegmentIndex: mainSegmentIndex, multiSegment: multiSegment} = this.attribute;
|
|
49
|
-
this._line && this._line.setAttributes({
|
|
50
|
-
points: points,
|
|
51
|
-
startSymbol: startSymbol,
|
|
52
|
-
endSymbol: endSymbol,
|
|
53
|
-
lineStyle: lineStyle,
|
|
54
|
-
mainSegmentIndex: mainSegmentIndex,
|
|
55
|
-
multiSegment: multiSegment
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
CartesianMarkLine.defaultAttributes = DEFAULT_COMMON_MARK_LINE_THEME;
|
|
61
|
-
//# sourceMappingURL=line.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/cartesian/line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AAG3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,8BAA8B,EAAE,CAAC;AACjC,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IAKjD,YAAY,UAAkC,EAAE,OAA0B;QACxE,KAAK,CAA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AQ,EAAE,KAAK;YACf,KAAK,EAAE;gBACL,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,cAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAC;gBAC5C,WAAW,EAAE,KAAK,CAAC,EAAE,EAAE,cAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,CAAC;gBAC9D,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE,cAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,aAAa,CAAC;aAC3D;SACF,CAAC,CAAC;IACL,CAAC;IACS,iBAAiB;QACzB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,IAAI;aACvF,SAAmC,CAAC;QACvC,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;gBACvB,MAAM;gBACN,WAAW;gBACX,SAAS;gBACT,SAAS;gBACT,gBAAgB;gBAChB,YAAY;aACb,CAAC,CAAC;SACJ;IACH,CAAC;;AA5DM,mCAAiB,GAAoC,8BAA8B,CAAC","file":"line.js","sourcesContent":["import { isValidNumber, merge } from '@visactor/vutils';\nimport { DEFAULT_COMMON_MARK_LINE_THEME } from '../config';\nimport type { CartesianMarkLineAttrs } from '../type';\nimport type { ComponentOptions } from '../../interface';\nimport { loadCartesianMarkLineComponent } from '../register';\nimport type { Point } from '../../core/type';\nimport { BaseMarkLine } from '../base-line';\nimport type { ArcSegment } from '../../segment';\n// eslint-disable-next-line no-duplicate-imports\nimport { Segment } from '../../segment';\nimport { DEFAULT_STATES } from '../../constant';\n\nloadCartesianMarkLineComponent();\nexport class CartesianMarkLine extends BaseMarkLine {\n name = 'cartesianMarkLine';\n static defaultAttributes: Partial<CartesianMarkLineAttrs> = DEFAULT_COMMON_MARK_LINE_THEME;\n protected _line!: Segment | ArcSegment;\n\n constructor(attributes: CartesianMarkLineAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, CartesianMarkLine.defaultAttributes, attributes));\n }\n\n protected isValidPoints() {\n const { points } = this.attribute as CartesianMarkLineAttrs;\n if (!points || points.length < 2) {\n return false;\n }\n let validFlag = true;\n points.forEach((point: Point | Point[]) => {\n if ((point as any).length) {\n (point as Point[]).forEach((p: Point) => {\n if (!isValidNumber((p as Point).x) || !isValidNumber((p as Point).y)) {\n validFlag = false;\n return;\n }\n });\n } else if (!isValidNumber((point as Point).x) || !isValidNumber((point as Point).y)) {\n validFlag = false;\n return;\n }\n });\n return validFlag;\n }\n\n protected createSegment() {\n const { points, startSymbol, endSymbol, lineStyle, mainSegmentIndex, multiSegment, state } = this\n .attribute as CartesianMarkLineAttrs;\n return new Segment({\n points,\n startSymbol,\n endSymbol,\n lineStyle,\n mainSegmentIndex,\n multiSegment,\n pickable: false, // 组件容器本身不参与拾取\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 protected setLineAttributes() {\n const { points, startSymbol, endSymbol, lineStyle, mainSegmentIndex, multiSegment } = this\n .attribute as CartesianMarkLineAttrs;\n if (this._line) {\n this._line.setAttributes({\n points,\n startSymbol,\n endSymbol,\n lineStyle,\n mainSegmentIndex,\n multiSegment\n });\n }\n }\n}\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ArcSegment } from '../../segment';
|
|
2
|
-
import type { PolarMarkArcLineAttrs } from '../type';
|
|
3
|
-
import { BaseMarkLine } from '../base-line';
|
|
4
|
-
export declare class PolarMarkArcLine extends BaseMarkLine {
|
|
5
|
-
name: string;
|
|
6
|
-
static defaultAttributes: Partial<PolarMarkArcLineAttrs>;
|
|
7
|
-
protected _line: ArcSegment;
|
|
8
|
-
protected isValidPoints(): boolean;
|
|
9
|
-
protected createSegment(): ArcSegment;
|
|
10
|
-
protected setLineAttributes(): void;
|
|
11
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { merge } from "@visactor/vutils";
|
|
2
|
-
|
|
3
|
-
import { ArcSegment } from "../../segment";
|
|
4
|
-
|
|
5
|
-
import { DEFAULT_COMMON_MARK_LINE_THEME } from "../config";
|
|
6
|
-
|
|
7
|
-
import { loadPolarMarkArcLineComponent } from "../register";
|
|
8
|
-
|
|
9
|
-
import { DEFAULT_STATES } from "../../constant";
|
|
10
|
-
|
|
11
|
-
import { BaseMarkLine } from "../base-line";
|
|
12
|
-
|
|
13
|
-
loadPolarMarkArcLineComponent();
|
|
14
|
-
|
|
15
|
-
export class PolarMarkArcLine extends BaseMarkLine {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments), this.name = "polarMarkArcLine";
|
|
18
|
-
}
|
|
19
|
-
isValidPoints() {
|
|
20
|
-
return !0;
|
|
21
|
-
}
|
|
22
|
-
createSegment() {
|
|
23
|
-
const {center: center, radius: radius, startAngle: startAngle, endAngle: endAngle, startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle, state: state} = this.attribute;
|
|
24
|
-
return new ArcSegment({
|
|
25
|
-
center: center,
|
|
26
|
-
radius: radius,
|
|
27
|
-
startAngle: startAngle,
|
|
28
|
-
endAngle: endAngle,
|
|
29
|
-
startSymbol: startSymbol,
|
|
30
|
-
endSymbol: endSymbol,
|
|
31
|
-
lineStyle: lineStyle,
|
|
32
|
-
state: {
|
|
33
|
-
line: merge({}, DEFAULT_STATES, null == state ? void 0 : state.line),
|
|
34
|
-
startSymbol: merge({}, DEFAULT_STATES, null == state ? void 0 : state.lineStartSymbol),
|
|
35
|
-
endSymbol: merge({}, DEFAULT_STATES, null == state ? void 0 : state.lineEndSymbol)
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
setLineAttributes() {
|
|
40
|
-
const {center: center, radius: radius, startAngle: startAngle, endAngle: endAngle, startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle} = this.attribute;
|
|
41
|
-
this._line && this._line.setAttributes({
|
|
42
|
-
center: center,
|
|
43
|
-
radius: radius,
|
|
44
|
-
startAngle: startAngle,
|
|
45
|
-
endAngle: endAngle,
|
|
46
|
-
startSymbol: startSymbol,
|
|
47
|
-
endSymbol: endSymbol,
|
|
48
|
-
lineStyle: lineStyle
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
PolarMarkArcLine.defaultAttributes = DEFAULT_COMMON_MARK_LINE_THEME;
|
|
54
|
-
//# sourceMappingURL=arc-line.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/polar/arc-line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AAE3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,6BAA6B,EAAE,CAAC;AAChC,MAAM,OAAO,gBAAiB,SAAQ,YAAY;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,UAAU,CAAC;YACpB,MAAM;YACN,MAAM;YACN,UAAU;YACV,QAAQ;YACR,WAAW;YACX,SAAS;YACT,SAAS;YACT,KAAK,EAAE;gBACL,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,cAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAC;gBAC5C,WAAW,EAAE,KAAK,CAAC,EAAE,EAAE,cAAc,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,CAAC;gBAC9D,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE,cAAc,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;;AAxCM,kCAAiB,GAAmC,8BAA8B,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"]}
|
package/es/marker/polar/area.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { graphicCreator } from "@visactor/vrender-core";
|
|
2
|
-
|
|
3
|
-
import { merge } from "@visactor/vutils";
|
|
4
|
-
|
|
5
|
-
import { Tag } from "../../tag";
|
|
6
|
-
|
|
7
|
-
import { Marker } from "../base";
|
|
8
|
-
|
|
9
|
-
import { DEFAULT_POLAR_MARK_AREA_THEME } from "../config";
|
|
10
|
-
|
|
11
|
-
import { IPolarMarkAreaLabelPosition } from "../type";
|
|
12
|
-
|
|
13
|
-
import { limitShapeInBounds } from "../../util/limit-shape";
|
|
14
|
-
|
|
15
|
-
import { loadPolarMarkAreaComponent } from "../register";
|
|
16
|
-
|
|
17
|
-
import { DEFAULT_STATES } from "../../constant";
|
|
18
|
-
|
|
19
|
-
loadPolarMarkAreaComponent();
|
|
20
|
-
|
|
21
|
-
export class PolarMarkArea extends Marker {
|
|
22
|
-
getArea() {
|
|
23
|
-
return this._area;
|
|
24
|
-
}
|
|
25
|
-
getLabel() {
|
|
26
|
-
return this._label;
|
|
27
|
-
}
|
|
28
|
-
constructor(attributes, options) {
|
|
29
|
-
super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, PolarMarkArea.defaultAttributes, attributes)),
|
|
30
|
-
this.name = "polarMarkArea";
|
|
31
|
-
}
|
|
32
|
-
_getPositionByDirection(area, direction) {
|
|
33
|
-
const {center: center, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle} = this.attribute;
|
|
34
|
-
switch (direction) {
|
|
35
|
-
case IPolarMarkAreaLabelPosition.center:
|
|
36
|
-
return {
|
|
37
|
-
x: center.x + (innerRadius + outerRadius) / 2 * Math.cos((startAngle + endAngle) / 2),
|
|
38
|
-
y: center.y + (innerRadius + outerRadius) / 2 * Math.sin((startAngle + endAngle) / 2)
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
case IPolarMarkAreaLabelPosition.arcStart:
|
|
42
|
-
return {
|
|
43
|
-
x: center.x + (innerRadius + outerRadius) / 2 * Math.cos(startAngle),
|
|
44
|
-
y: center.y + (innerRadius + outerRadius) / 2 * Math.sin(startAngle)
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
case IPolarMarkAreaLabelPosition.arcEnd:
|
|
48
|
-
return {
|
|
49
|
-
x: center.x + (innerRadius + outerRadius) / 2 * Math.cos(endAngle),
|
|
50
|
-
y: center.y + (innerRadius + outerRadius) / 2 * Math.sin(endAngle)
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
case IPolarMarkAreaLabelPosition.arcInner:
|
|
54
|
-
return {
|
|
55
|
-
x: center.x + innerRadius * Math.cos((startAngle + endAngle) / 2),
|
|
56
|
-
y: center.y + innerRadius * Math.sin((startAngle + endAngle) / 2)
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
case IPolarMarkAreaLabelPosition.arcOuter:
|
|
60
|
-
return {
|
|
61
|
-
x: center.x + outerRadius * Math.cos((startAngle + endAngle) / 2),
|
|
62
|
-
y: center.y + outerRadius * Math.sin((startAngle + endAngle) / 2)
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
default:
|
|
66
|
-
return {
|
|
67
|
-
x: center.x + innerRadius * Math.cos((startAngle + endAngle) / 2),
|
|
68
|
-
y: center.y + innerRadius * Math.sin((startAngle + endAngle) / 2)
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
setLabelPos() {
|
|
73
|
-
var _a;
|
|
74
|
-
if (this._label && this._area) {
|
|
75
|
-
const {label: label = {}} = this.attribute, labelPosition = null !== (_a = label.position) && void 0 !== _a ? _a : "middle", labelPoint = this._getPositionByDirection(this._area, labelPosition);
|
|
76
|
-
if (this._label.setAttributes(Object.assign({}, labelPoint)), this.attribute.limitRect && label.confine) {
|
|
77
|
-
const {x: x, y: y, width: width, height: height} = this.attribute.limitRect;
|
|
78
|
-
limitShapeInBounds(this._label, {
|
|
79
|
-
x1: x,
|
|
80
|
-
y1: y,
|
|
81
|
-
x2: x + width,
|
|
82
|
-
y2: y + height
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
initMarker(container) {
|
|
88
|
-
const {center: center, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle, areaStyle: areaStyle, label: label, state: state} = this.attribute, area = graphicCreator.arc(Object.assign({
|
|
89
|
-
x: center.x,
|
|
90
|
-
y: center.y,
|
|
91
|
-
innerRadius: innerRadius,
|
|
92
|
-
outerRadius: outerRadius,
|
|
93
|
-
startAngle: startAngle,
|
|
94
|
-
endAngle: endAngle
|
|
95
|
-
}, areaStyle));
|
|
96
|
-
area.states = merge({}, DEFAULT_STATES, null == state ? void 0 : state.area), area.name = "polar-mark-area-area",
|
|
97
|
-
this._area = area, container.add(area);
|
|
98
|
-
const markLabel = new Tag(Object.assign(Object.assign({}, label), {
|
|
99
|
-
state: {
|
|
100
|
-
panel: merge({}, DEFAULT_STATES, null == state ? void 0 : state.labelBackground),
|
|
101
|
-
text: merge({}, DEFAULT_STATES, null == state ? void 0 : state.label)
|
|
102
|
-
}
|
|
103
|
-
}));
|
|
104
|
-
markLabel.name = "mark-area-label", this._label = markLabel, container.add(markLabel),
|
|
105
|
-
this.setLabelPos();
|
|
106
|
-
}
|
|
107
|
-
updateMarker() {
|
|
108
|
-
const {center: center, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle, areaStyle: areaStyle, label: label} = this.attribute;
|
|
109
|
-
this._area && this._area.setAttributes(Object.assign({
|
|
110
|
-
x: center.x,
|
|
111
|
-
y: center.y,
|
|
112
|
-
innerRadius: innerRadius,
|
|
113
|
-
outerRadius: outerRadius,
|
|
114
|
-
startAngle: startAngle,
|
|
115
|
-
endAngle: endAngle
|
|
116
|
-
}, areaStyle)), this._area && this._label.setAttributes(Object.assign({
|
|
117
|
-
dx: 0,
|
|
118
|
-
dy: 0
|
|
119
|
-
}, label)), this.setLabelPos();
|
|
120
|
-
}
|
|
121
|
-
isValidPoints() {
|
|
122
|
-
return !0;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
PolarMarkArea.defaultAttributes = DEFAULT_POLAR_MARK_AREA_THEME;
|
|
127
|
-
//# sourceMappingURL=area.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/polar/area.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,6BAA6B,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAA2B,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,0BAA0B,EAAE,CAAC;AAC7B,MAAM,OAAO,aAAc,SAAQ,MA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KAAuB,EAC3B,CAAC;SACJ;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAES,aAAa;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;;AAjIM,+BAAiB,GAAG,6BAA6B,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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/es/marker/polar/line.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"]}
|