@visactor/vrender-components 0.18.11 → 0.19.0-alpha.0
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/axis/base.js +4 -20
- package/cjs/axis/base.js.map +1 -1
- package/cjs/brush/brush.js +1 -2
- package/cjs/brush/type.js +2 -1
- package/cjs/index.d.ts +1 -2
- package/cjs/index.js +2 -3
- package/cjs/index.js.map +1 -1
- package/cjs/label/arc.d.ts +2 -2
- package/cjs/label/base.d.ts +2 -2
- package/cjs/label/index.js +2 -1
- package/cjs/label/line.js +1 -1
- package/cjs/label/polygon.js +1 -1
- package/cjs/label/rect.js +1 -1
- package/cjs/label/register.js +1 -1
- package/cjs/label/symbol.js +1 -1
- package/cjs/label/type.js +1 -1
- package/cjs/legend/base.js +1 -1
- package/cjs/legend/constant.js +1 -1
- package/cjs/legend/index.js +1 -1
- package/cjs/legend/register.js +1 -1
- package/cjs/legend/type.js +1 -2
- package/cjs/legend/util.js +1 -1
- package/cjs/marker/animate/animate.d.ts +13 -0
- package/cjs/marker/animate/animate.js +92 -0
- package/cjs/marker/animate/animate.js.map +1 -0
- package/cjs/marker/animate/call-in.d.ts +4 -0
- package/cjs/marker/animate/call-in.js +27 -0
- package/cjs/marker/animate/call-in.js.map +1 -0
- package/cjs/marker/animate/clip-in.d.ts +4 -0
- package/cjs/marker/animate/clip-in.js +23 -0
- package/cjs/marker/animate/clip-in.js.map +1 -0
- package/cjs/marker/animate/common.d.ts +9 -0
- package/cjs/marker/animate/common.js +48 -0
- package/cjs/marker/animate/common.js.map +1 -0
- package/cjs/marker/animate/fade-in.d.ts +7 -0
- package/cjs/marker/animate/fade-in.js +30 -0
- package/cjs/marker/animate/fade-in.js.map +1 -0
- package/cjs/marker/animate/fade-out.d.ts +7 -0
- package/cjs/marker/animate/fade-out.js +30 -0
- package/cjs/marker/animate/fade-out.js.map +1 -0
- package/cjs/marker/animate/index.js +3 -0
- package/cjs/marker/animate/index.js.map +1 -0
- package/cjs/marker/arc-area.d.ts +55 -0
- package/cjs/marker/arc-area.js +131 -0
- package/cjs/marker/arc-area.js.map +1 -0
- package/cjs/marker/arc-line.d.ts +25 -0
- package/cjs/marker/arc-line.js +106 -0
- package/cjs/marker/arc-line.js.map +1 -0
- package/cjs/marker/area.d.ts +14 -4
- package/cjs/marker/area.js +34 -21
- package/cjs/marker/area.js.map +1 -1
- package/cjs/marker/base.d.ts +21 -3
- package/cjs/marker/base.js +40 -5
- package/cjs/marker/base.js.map +1 -1
- package/cjs/marker/common-line.d.ts +22 -0
- package/cjs/marker/common-line.js +56 -0
- package/cjs/marker/common-line.js.map +1 -0
- package/cjs/marker/config.d.ts +79 -6
- package/cjs/marker/config.js +77 -37
- package/cjs/marker/config.js.map +1 -1
- package/cjs/marker/index.d.ts +2 -0
- package/cjs/marker/index.js +2 -1
- package/cjs/marker/index.js.map +1 -1
- package/cjs/marker/line.d.ts +24 -12
- package/cjs/marker/line.js +111 -45
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/point.d.ts +8 -3
- package/cjs/marker/point.js +33 -9
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/register.d.ts +2 -0
- package/cjs/marker/register.js +11 -2
- package/cjs/marker/register.js.map +1 -1
- package/cjs/marker/type.d.ts +102 -12
- package/cjs/marker/type.js +8 -2
- package/cjs/marker/type.js.map +1 -1
- package/cjs/segment/arc-segment.d.ts +13 -0
- package/cjs/segment/arc-segment.js +51 -0
- package/cjs/segment/arc-segment.js.map +1 -0
- package/cjs/segment/index.d.ts +1 -0
- package/cjs/segment/index.js +2 -1
- package/cjs/segment/index.js.map +1 -1
- package/cjs/segment/register.d.ts +2 -1
- package/cjs/segment/register.js +8 -3
- package/cjs/segment/register.js.map +1 -1
- package/cjs/segment/segment.d.ts +9 -7
- package/cjs/segment/segment.js +12 -8
- package/cjs/segment/segment.js.map +1 -1
- package/cjs/segment/type.d.ts +24 -4
- package/cjs/segment/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/cjs/util/interaction.d.ts +4 -0
- package/cjs/util/interaction.js +37 -0
- package/cjs/util/interaction.js.map +1 -0
- package/es/axis/base.js +7 -21
- package/es/axis/base.js.map +1 -1
- package/es/brush/brush.js +1 -2
- package/es/brush/type.js +2 -1
- package/es/index.d.ts +1 -2
- package/es/index.js +1 -3
- package/es/index.js.map +1 -1
- package/es/label/arc.d.ts +2 -2
- package/es/label/base.d.ts +2 -2
- package/es/label/index.js +2 -1
- package/es/label/line.js +1 -1
- package/es/label/polygon.js +1 -1
- package/es/label/rect.js +1 -1
- package/es/label/register.js +1 -1
- package/es/label/symbol.js +1 -1
- package/es/label/type.js +1 -1
- package/es/legend/base.js +1 -1
- package/es/legend/constant.js +1 -1
- package/es/legend/index.js +1 -1
- package/es/legend/register.js +1 -1
- package/es/legend/type.js +1 -2
- package/es/legend/util.js +1 -1
- package/es/marker/animate/animate.d.ts +13 -0
- package/es/marker/animate/animate.js +92 -0
- package/es/marker/animate/animate.js.map +1 -0
- package/es/marker/animate/call-in.d.ts +4 -0
- package/es/marker/animate/call-in.js +17 -0
- package/es/marker/animate/call-in.js.map +1 -0
- package/es/marker/animate/clip-in.d.ts +4 -0
- package/es/marker/animate/clip-in.js +15 -0
- package/es/marker/animate/clip-in.js.map +1 -0
- package/es/marker/animate/common.d.ts +9 -0
- package/es/marker/animate/common.js +39 -0
- package/es/marker/animate/common.js.map +1 -0
- package/es/marker/animate/fade-in.d.ts +7 -0
- package/es/marker/animate/fade-in.js +20 -0
- package/es/marker/animate/fade-in.js.map +1 -0
- package/es/marker/animate/fade-out.d.ts +7 -0
- package/es/marker/animate/fade-out.js +20 -0
- package/es/marker/animate/fade-out.js.map +1 -0
- package/es/marker/animate/index.js +3 -0
- package/es/marker/animate/index.js.map +1 -0
- package/es/marker/arc-area.d.ts +55 -0
- package/es/marker/arc-area.js +143 -0
- package/es/marker/arc-area.js.map +1 -0
- package/es/marker/arc-line.d.ts +25 -0
- package/es/marker/arc-line.js +114 -0
- package/es/marker/arc-line.js.map +1 -0
- package/es/marker/area.d.ts +14 -4
- package/es/marker/area.js +36 -19
- package/es/marker/area.js.map +1 -1
- package/es/marker/base.d.ts +21 -3
- package/es/marker/base.js +43 -4
- package/es/marker/base.js.map +1 -1
- package/es/marker/common-line.d.ts +22 -0
- package/es/marker/common-line.js +58 -0
- package/es/marker/common-line.js.map +1 -0
- package/es/marker/config.d.ts +79 -6
- package/es/marker/config.js +79 -37
- package/es/marker/config.js.map +1 -1
- package/es/marker/index.d.ts +2 -0
- package/es/marker/index.js +4 -0
- package/es/marker/index.js.map +1 -1
- package/es/marker/line.d.ts +24 -12
- package/es/marker/line.js +116 -48
- package/es/marker/line.js.map +1 -1
- package/es/marker/point.d.ts +8 -3
- package/es/marker/point.js +34 -6
- package/es/marker/point.js.map +1 -1
- package/es/marker/register.d.ts +2 -0
- package/es/marker/register.js +10 -2
- package/es/marker/register.js.map +1 -1
- package/es/marker/type.d.ts +102 -12
- package/es/marker/type.js +9 -0
- package/es/marker/type.js.map +1 -1
- package/es/segment/arc-segment.d.ts +13 -0
- package/es/segment/arc-segment.js +49 -0
- package/es/segment/arc-segment.js.map +1 -0
- package/es/segment/index.d.ts +1 -0
- package/es/segment/index.js +2 -0
- package/es/segment/index.js.map +1 -1
- package/es/segment/register.d.ts +2 -1
- package/es/segment/register.js +6 -2
- package/es/segment/register.js.map +1 -1
- package/es/segment/segment.d.ts +9 -7
- package/es/segment/segment.js +11 -8
- package/es/segment/segment.js.map +1 -1
- package/es/segment/type.d.ts +24 -4
- package/es/segment/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/es/util/interaction.d.ts +4 -0
- package/es/util/interaction.js +30 -0
- package/es/util/interaction.js.map +1 -0
- package/package.json +5 -5
- package/cjs/marker/util.js +0 -3
- package/cjs/marker/util.js.map +0 -1
- package/cjs/radio/index.d.ts +0 -2
- package/cjs/radio/index.js +0 -21
- package/cjs/radio/index.js.map +0 -1
- package/cjs/radio/radio.d.ts +0 -16
- package/cjs/radio/radio.js +0 -88
- package/cjs/radio/radio.js.map +0 -1
- package/cjs/radio/register.d.ts +0 -1
- package/cjs/radio/register.js +0 -15
- package/cjs/radio/register.js.map +0 -1
- package/cjs/radio/type.d.ts +0 -21
- package/cjs/radio/type.js +0 -6
- package/cjs/radio/type.js.map +0 -1
- package/es/marker/util.js +0 -3
- package/es/marker/util.js.map +0 -1
- package/es/radio/index.d.ts +0 -2
- package/es/radio/index.js +0 -4
- package/es/radio/index.js.map +0 -1
- package/es/radio/radio.d.ts +0 -16
- package/es/radio/radio.js +0 -87
- package/es/radio/radio.js.map +0 -1
- package/es/radio/register.d.ts +0 -1
- package/es/radio/register.js +0 -6
- package/es/radio/register.js.map +0 -1
- package/es/radio/type.d.ts +0 -21
- package/es/radio/type.js +0 -2
- package/es/radio/type.js.map +0 -1
- /package/cjs/marker/{util.d.ts → animate/index.d.ts} +0 -0
- /package/es/marker/{util.d.ts → animate/index.d.ts} +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.commonLineClipIn = void 0;
|
|
6
|
+
|
|
7
|
+
const common_1 = require("./common");
|
|
8
|
+
|
|
9
|
+
function commonLineClipIn(line, label, duration, delay, easing) {
|
|
10
|
+
const startSymbolDuration = .1 * duration, lineDuration = .7 * duration, endSymbolDuration = .1 * duration, labelDuration = .1 * duration;
|
|
11
|
+
(0, common_1.graphicFadeIn)(line.startSymbol, delay, startSymbolDuration, easing),
|
|
12
|
+
line.lines.forEach((line => line.setAttribute("clipRange", 0))), line.lines.forEach(((l, index) => {
|
|
13
|
+
const stepDuration = lineDuration / line.lines.length;
|
|
14
|
+
l.animate().wait(delay + startSymbolDuration + index * stepDuration).to({
|
|
15
|
+
clipRange: 1
|
|
16
|
+
}, stepDuration, easing);
|
|
17
|
+
})), (0, common_1.graphicFadeIn)(line.endSymbol, delay + startSymbolDuration + lineDuration, endSymbolDuration, easing),
|
|
18
|
+
(0, common_1.graphicFadeIn)(label.getTextShape(), delay + startSymbolDuration + lineDuration + endSymbolDuration, labelDuration, easing),
|
|
19
|
+
(0, common_1.graphicFadeIn)(label.getBgRect(), delay + startSymbolDuration + lineDuration + endSymbolDuration, labelDuration, easing);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
exports.commonLineClipIn = commonLineClipIn;
|
|
23
|
+
//# sourceMappingURL=clip-in.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/marker/animate/clip-in.ts"],"names":[],"mappings":";;;AAGA,qCAAyC;AAEzC,SAAgB,gBAAgB,CAC9B,IAA0B,EAC1B,KAAU,EACV,QAAgB,EAChB,KAAa,EACb,MAAkB;IAElB,MAAM,mBAAmB,GAAG,GAAG,GAAG,QAAQ,CAAC;IAC3C,MAAM,YAAY,GAAG,GAAG,GAAG,QAAQ,CAAC;IACpC,MAAM,iBAAiB,GAAG,GAAG,GAAG,QAAQ,CAAC;IACzC,MAAM,aAAa,GAAG,GAAG,GAAG,QAAQ,CAAC;IAGrC,IAAA,sBAAa,EAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAC;IAGpE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;QAC9B,MAAM,YAAY,GAAG,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QACtD,CAAC,CAAC,OAAO,EAAE;aACR,IAAI,CAAC,KAAK,GAAG,mBAAmB,GAAG,KAAK,GAAG,YAAY,CAAC;aACxD,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAGH,IAAA,sBAAa,EAAC,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,mBAAmB,GAAG,YAAY,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAGrG,IAAA,sBAAa,EACX,KAAK,CAAC,YAAY,EAAE,EACpB,KAAK,GAAG,mBAAmB,GAAG,YAAY,GAAG,iBAAiB,EAC9D,aAAa,EACb,MAAM,CACP,CAAC;IAGF,IAAA,sBAAa,EACX,KAAK,CAAC,SAAS,EAAE,EACjB,KAAK,GAAG,mBAAmB,GAAG,YAAY,GAAG,iBAAiB,EAC9D,aAAa,EACb,MAAM,CACP,CAAC;AACJ,CAAC;AA1CD,4CA0CC","file":"clip-in.js","sourcesContent":["import type { EasingType } from '@visactor/vrender-core';\nimport type { ArcSegment, Segment } from '../../segment';\nimport type { Tag } from '../../tag';\nimport { graphicFadeIn } from './common';\n\nexport function commonLineClipIn(\n line: Segment | ArcSegment,\n label: Tag,\n duration: number,\n delay: number,\n easing: EasingType\n) {\n const startSymbolDuration = 0.1 * duration;\n const lineDuration = 0.7 * duration;\n const endSymbolDuration = 0.1 * duration;\n const labelDuration = 0.1 * duration;\n\n // start symbol\n graphicFadeIn(line.startSymbol, delay, startSymbolDuration, easing);\n\n // line\n line.lines.forEach(line => line.setAttribute('clipRange', 0));\n line.lines.forEach((l, index) => {\n const stepDuration = lineDuration / line.lines.length;\n l.animate()\n .wait(delay + startSymbolDuration + index * stepDuration)\n .to({ clipRange: 1 }, stepDuration, easing);\n });\n\n // end symbol\n graphicFadeIn(line.endSymbol, delay + startSymbolDuration + lineDuration, endSymbolDuration, easing);\n\n // text\n graphicFadeIn(\n label.getTextShape(),\n delay + startSymbolDuration + lineDuration + endSymbolDuration,\n labelDuration,\n easing\n );\n\n // text background\n graphicFadeIn(\n label.getBgRect(),\n delay + startSymbolDuration + lineDuration + endSymbolDuration,\n labelDuration,\n easing\n );\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EasingType, IGraphic } from '@visactor/vrender-core';
|
|
2
|
+
import type { ArcSegment, Segment } from '../../segment';
|
|
3
|
+
import type { Tag } from '../../tag';
|
|
4
|
+
export declare function graphicFadeIn(graphic: IGraphic, delay: number, duration: number, easing: EasingType): void;
|
|
5
|
+
export declare function segmentFadeIn(segment: Segment, delay: number, duration: number, easing: EasingType): void;
|
|
6
|
+
export declare function tagFadeIn(tag: Tag, delay: number, duration: number, easing: EasingType): void;
|
|
7
|
+
export declare function graphicFadeOut(graphic: IGraphic, delay: number, duration: number, easing: EasingType): void;
|
|
8
|
+
export declare function segmentFadeOut(segment: Segment | ArcSegment, delay: number, duration: number, easing: EasingType): void;
|
|
9
|
+
export declare function tagFadeOut(tag: Tag, delay: number, duration: number, easing: EasingType): void;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function graphicFadeIn(graphic, delay, duration, easing) {
|
|
4
|
+
graphic && (graphic.setAttributes({
|
|
5
|
+
fillOpacity: 0,
|
|
6
|
+
strokeOpacity: 0
|
|
7
|
+
}), graphic.animate().wait(delay).to({
|
|
8
|
+
fillOpacity: 1,
|
|
9
|
+
strokeOpacity: 1
|
|
10
|
+
}, duration, easing));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function segmentFadeIn(segment, delay, duration, easing) {
|
|
14
|
+
segment && (graphicFadeIn(segment.startSymbol, delay, duration, easing), segment.lines.forEach((line => graphicFadeIn(line, delay, duration, easing))),
|
|
15
|
+
graphicFadeIn(segment.line, delay, duration, easing), graphicFadeIn(segment.endSymbol, delay, duration, easing));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function tagFadeIn(tag, delay, duration, easing) {
|
|
19
|
+
tag && (graphicFadeIn(tag.getTextShape(), delay, duration, easing), graphicFadeIn(tag.getBgRect(), delay, duration, easing));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function graphicFadeOut(graphic, delay, duration, easing) {
|
|
23
|
+
var _a, _b, _c, _d;
|
|
24
|
+
graphic && (graphic.setAttributes({
|
|
25
|
+
fillOpacity: null !== (_b = null === (_a = graphic.attribute) || void 0 === _a ? void 0 : _a.fillOpacity) && void 0 !== _b ? _b : 1,
|
|
26
|
+
strokeOpacity: null !== (_d = null === (_c = graphic.attribute) || void 0 === _c ? void 0 : _c.strokeOpacity) && void 0 !== _d ? _d : 1
|
|
27
|
+
}), graphic.animate().wait(delay).to({
|
|
28
|
+
fillOpacity: 0,
|
|
29
|
+
strokeOpacity: 0
|
|
30
|
+
}, duration, easing));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function segmentFadeOut(segment, delay, duration, easing) {
|
|
34
|
+
segment && (graphicFadeOut(segment.startSymbol, delay, duration, easing), segment.lines.forEach((line => graphicFadeOut(line, delay, duration, easing))),
|
|
35
|
+
graphicFadeOut(segment.line, delay, duration, easing), graphicFadeOut(segment.endSymbol, delay, duration, easing));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function tagFadeOut(tag, delay, duration, easing) {
|
|
39
|
+
tag && (graphicFadeOut(tag.getTextShape(), delay, duration, easing), graphicFadeOut(tag.getBgRect(), delay, duration, easing));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
Object.defineProperty(exports, "__esModule", {
|
|
43
|
+
value: !0
|
|
44
|
+
}), exports.tagFadeOut = exports.segmentFadeOut = exports.graphicFadeOut = exports.tagFadeIn = exports.segmentFadeIn = exports.graphicFadeIn = void 0,
|
|
45
|
+
exports.graphicFadeIn = graphicFadeIn, exports.segmentFadeIn = segmentFadeIn, exports.tagFadeIn = tagFadeIn,
|
|
46
|
+
exports.graphicFadeOut = graphicFadeOut, exports.segmentFadeOut = segmentFadeOut,
|
|
47
|
+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dD,wCAcC;AAED,SAAgB,UAAU,CAAC,GAAQ,EAAE,KAAa,EAAE,QAAgB,EAAE,MAAkB;IACtF,IAAI,CAAC,GAAG,EAAE;QACR,OAAO;KACR;IAGD,cAAc,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAG5D,cAAc,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC3D,CAAC;AAVD,gCAUC","file":"common.js","sourcesContent":["import type { EasingType, IGraphic } from '@visactor/vrender-core';\nimport type { ArcSegment, Segment } from '../../segment';\nimport type { Tag } from '../../tag';\n\n/** fade-in */\nexport function graphicFadeIn(graphic: IGraphic, delay: number, duration: number, easing: EasingType) {\n if (!graphic) {\n return;\n }\n\n graphic.setAttributes({\n fillOpacity: 0,\n strokeOpacity: 0\n });\n\n graphic.animate().wait(delay).to({ fillOpacity: 1, strokeOpacity: 1 }, duration, easing);\n}\n\nexport function segmentFadeIn(segment: Segment, delay: number, duration: number, easing: EasingType) {\n if (!segment) {\n return;\n }\n\n // start symbol\n graphicFadeIn(segment.startSymbol, delay, duration, easing);\n\n // line\n segment.lines.forEach(line => graphicFadeIn(line, delay, duration, easing));\n graphicFadeIn((segment as ArcSegment).line, delay, duration, easing);\n\n // end symbol\n graphicFadeIn(segment.endSymbol, delay, duration, easing);\n}\n\nexport function tagFadeIn(tag: Tag, delay: number, duration: number, easing: EasingType) {\n if (!tag) {\n return;\n }\n\n // text\n graphicFadeIn(tag.getTextShape(), delay, duration, easing);\n\n // text background\n graphicFadeIn(tag.getBgRect(), delay, duration, easing);\n}\n\n/** fade-out */\nexport function graphicFadeOut(graphic: IGraphic, delay: number, duration: number, easing: EasingType) {\n if (!graphic) {\n return;\n }\n\n graphic.setAttributes({\n fillOpacity: graphic.attribute?.fillOpacity ?? 1,\n strokeOpacity: graphic.attribute?.strokeOpacity ?? 1\n });\n\n graphic.animate().wait(delay).to({ fillOpacity: 0, strokeOpacity: 0 }, duration, easing);\n}\n\nexport function segmentFadeOut(segment: Segment | ArcSegment, delay: number, duration: number, easing: EasingType) {\n if (!segment) {\n return;\n }\n\n // start symbol\n graphicFadeOut(segment.startSymbol, delay, duration, easing);\n\n // line\n segment.lines.forEach(line => graphicFadeOut(line, delay, duration, easing));\n graphicFadeOut((segment as ArcSegment).line, delay, duration, easing);\n\n // end symbol\n graphicFadeOut(segment.endSymbol, delay, duration, easing);\n}\n\nexport function tagFadeOut(tag: Tag, delay: number, duration: number, easing: EasingType) {\n if (!tag) {\n return;\n }\n\n // text\n graphicFadeOut(tag.getTextShape(), delay, duration, easing);\n\n // text background\n graphicFadeOut(tag.getBgRect(), delay, duration, easing);\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { EasingType, IArc, IImage, ILine, IPolygon, IRichText, ISymbol } from '@visactor/vrender-core';
|
|
2
|
+
import type { ArcSegment, Segment } from '../../segment';
|
|
3
|
+
import type { Tag } from '../../tag';
|
|
4
|
+
export declare function commonLineFadeIn(line: Segment | ArcSegment, label: Tag, duration: number, delay: number, easing: EasingType): void;
|
|
5
|
+
export declare function areaFadeIn(area: IPolygon, label: Tag, duration: number, delay: number, easing: EasingType): void;
|
|
6
|
+
export declare function arcAreaFadeIn(area: IArc, label: Tag, duration: number, delay: number, easing: EasingType): void;
|
|
7
|
+
export declare function pointFadeIn(itemLine: Segment, decorativeLine: ILine, item: Tag | IRichText | ISymbol | IImage, duration: number, delay: number, easing: EasingType): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.pointFadeIn = exports.arcAreaFadeIn = exports.areaFadeIn = exports.commonLineFadeIn = void 0;
|
|
6
|
+
|
|
7
|
+
const common_1 = require("./common");
|
|
8
|
+
|
|
9
|
+
function commonLineFadeIn(line, label, duration, delay, easing) {
|
|
10
|
+
(0, common_1.segmentFadeIn)(line, delay, duration, easing), (0, common_1.tagFadeIn)(label, delay, duration, easing);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function areaFadeIn(area, label, duration, delay, easing) {
|
|
14
|
+
(0, common_1.graphicFadeIn)(area, delay, duration, easing), (0, common_1.tagFadeIn)(label, delay, duration, easing);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function arcAreaFadeIn(area, label, duration, delay, easing) {
|
|
18
|
+
(0, common_1.graphicFadeIn)(area, delay, duration, easing), (0, common_1.tagFadeIn)(label, delay, duration, easing);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function pointFadeIn(itemLine, decorativeLine, item, duration, delay, easing) {
|
|
22
|
+
var _a;
|
|
23
|
+
(0, common_1.segmentFadeIn)(itemLine, delay, duration, easing), (0, common_1.graphicFadeIn)(decorativeLine, delay, duration, easing),
|
|
24
|
+
(null === (_a = item.getTextShape) || void 0 === _a ? void 0 : _a.call(item)) ? (0,
|
|
25
|
+
common_1.tagFadeIn)(item, delay, duration, easing) : (0, common_1.graphicFadeIn)(item, delay, duration, easing);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
exports.commonLineFadeIn = commonLineFadeIn, exports.areaFadeIn = areaFadeIn, exports.arcAreaFadeIn = arcAreaFadeIn,
|
|
29
|
+
exports.pointFadeIn = pointFadeIn;
|
|
30
|
+
//# sourceMappingURL=fade-in.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/marker/animate/fade-in.ts"],"names":[],"mappings":";;;AAGA,qCAAmE;AAEnE,SAAgB,gBAAgB,CAC9B,IAA0B,EAC1B,KAAU,EACV,QAAgB,EAChB,KAAa,EACb,MAAkB;IAElB,IAAA,sBAAa,EAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC7C,IAAA,kBAAS,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC;AATD,4CASC;AAED,SAAgB,UAAU,CAAC,IAAc,EAAE,KAAU,EAAE,QAAgB,EAAE,KAAa,EAAE,MAAkB;IACxG,IAAA,sBAAa,EAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC7C,IAAA,kBAAS,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC;AAHD,gCAGC;AAED,SAAgB,aAAa,CAAC,IAAU,EAAE,KAAU,EAAE,QAAgB,EAAE,KAAa,EAAE,MAAkB;IACvG,IAAA,sBAAa,EAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC7C,IAAA,kBAAS,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC;AAHD,sCAGC;AAED,SAAgB,WAAW,CACzB,QAAiB,EACjB,cAAqB,EACrB,IAAwC,EACxC,QAAgB,EAChB,KAAa,EACb,MAAkB;;IAElB,IAAA,sBAAa,EAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjD,IAAA,sBAAa,EAAC,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACvD,IAAI,MAAA,IAAI,CAAC,YAAY,oDAAI,EAAE;QAEzB,IAAA,kBAAS,EAAC,IAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;KACjD;SAAM;QAEL,IAAA,sBAAa,EAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;KAC9C;AACH,CAAC;AAjBD,kCAiBC","file":"fade-in.js","sourcesContent":["import type { EasingType, IArc, IImage, ILine, IPolygon, IRichText, ISymbol } from '@visactor/vrender-core';\nimport type { ArcSegment, Segment } from '../../segment';\nimport type { Tag } from '../../tag';\nimport { graphicFadeIn, segmentFadeIn, tagFadeIn } from './common';\n\nexport function commonLineFadeIn(\n line: Segment | ArcSegment,\n label: Tag,\n duration: number,\n delay: number,\n easing: EasingType\n) {\n segmentFadeIn(line, delay, duration, easing);\n tagFadeIn(label, delay, duration, easing);\n}\n\nexport function areaFadeIn(area: IPolygon, label: Tag, duration: number, delay: number, easing: EasingType) {\n graphicFadeIn(area, delay, duration, easing);\n tagFadeIn(label, delay, duration, easing);\n}\n\nexport function arcAreaFadeIn(area: IArc, label: Tag, duration: number, delay: number, easing: EasingType) {\n graphicFadeIn(area, delay, duration, easing);\n tagFadeIn(label, delay, duration, easing);\n}\n\nexport function pointFadeIn(\n itemLine: Segment,\n decorativeLine: ILine,\n item: Tag | IRichText | ISymbol | IImage,\n duration: number,\n delay: number,\n easing: EasingType\n) {\n segmentFadeIn(itemLine, delay, duration, easing);\n graphicFadeIn(decorativeLine, delay, duration, easing);\n if (item.getTextShape?.()) {\n // tag\n tagFadeIn(item as Tag, delay, duration, easing);\n } else {\n // symbol / richText / image\n graphicFadeIn(item, delay, duration, easing);\n }\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { EasingType, IArc, IImage, ILine, IPolygon, IRichText, ISymbol } from '@visactor/vrender-core';
|
|
2
|
+
import type { ArcSegment, Segment } from '../../segment';
|
|
3
|
+
import type { Tag } from '../../tag';
|
|
4
|
+
export declare function commonLineFadeOut(line: Segment | ArcSegment, label: Tag, duration: number, delay: number, easing: EasingType): void;
|
|
5
|
+
export declare function areaFadeOut(area: IPolygon, label: Tag, duration: number, delay: number, easing: EasingType): void;
|
|
6
|
+
export declare function arcAreaFadeOut(area: IArc, label: Tag, duration: number, delay: number, easing: EasingType): void;
|
|
7
|
+
export declare function pointFadeOut(itemLine: Segment, decorativeLine: ILine, item: Tag | IRichText | ISymbol | IImage, duration: number, delay: number, easing: EasingType): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.pointFadeOut = exports.arcAreaFadeOut = exports.areaFadeOut = exports.commonLineFadeOut = void 0;
|
|
6
|
+
|
|
7
|
+
const common_1 = require("./common");
|
|
8
|
+
|
|
9
|
+
function commonLineFadeOut(line, label, duration, delay, easing) {
|
|
10
|
+
(0, common_1.segmentFadeOut)(line, delay, duration, easing), (0, common_1.tagFadeOut)(label, delay, duration, easing);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function areaFadeOut(area, label, duration, delay, easing) {
|
|
14
|
+
(0, common_1.graphicFadeOut)(area, delay, duration, easing), (0, common_1.tagFadeOut)(label, delay, duration, easing);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function arcAreaFadeOut(area, label, duration, delay, easing) {
|
|
18
|
+
(0, common_1.graphicFadeOut)(area, delay, duration, easing), (0, common_1.tagFadeOut)(label, delay, duration, easing);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function pointFadeOut(itemLine, decorativeLine, item, duration, delay, easing) {
|
|
22
|
+
var _a;
|
|
23
|
+
(0, common_1.segmentFadeOut)(itemLine, delay, duration, easing), (0, common_1.graphicFadeOut)(decorativeLine, delay, duration, easing),
|
|
24
|
+
(null === (_a = item.getTextShape) || void 0 === _a ? void 0 : _a.call(item)) ? (0,
|
|
25
|
+
common_1.tagFadeOut)(item, delay, duration, easing) : (0, common_1.graphicFadeOut)(item, delay, duration, easing);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
exports.commonLineFadeOut = commonLineFadeOut, exports.areaFadeOut = areaFadeOut,
|
|
29
|
+
exports.arcAreaFadeOut = arcAreaFadeOut, exports.pointFadeOut = pointFadeOut;
|
|
30
|
+
//# sourceMappingURL=fade-out.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/marker/animate/fade-out.ts"],"names":[],"mappings":";;;AA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,IAAA,uBAAc,EAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;KAC/C;AACH,CAAC;AAjBD,oCAiBC","file":"fade-out.js","sourcesContent":["import type { EasingType, IArc, IImage, ILine, IPolygon, IRichText, ISymbol } from '@visactor/vrender-core';\nimport type { ArcSegment, Segment } from '../../segment';\nimport type { Tag } from '../../tag';\nimport { graphicFadeOut, segmentFadeOut, tagFadeOut } from './common';\n\nexport function commonLineFadeOut(\n line: Segment | ArcSegment,\n label: Tag,\n duration: number,\n delay: number,\n easing: EasingType\n) {\n segmentFadeOut(line, delay, duration, easing);\n tagFadeOut(label, delay, duration, easing);\n}\n\nexport function areaFadeOut(area: IPolygon, label: Tag, duration: number, delay: number, easing: EasingType) {\n graphicFadeOut(area, delay, duration, easing);\n tagFadeOut(label, delay, duration, easing);\n}\n\nexport function arcAreaFadeOut(area: IArc, label: Tag, duration: number, delay: number, easing: EasingType) {\n graphicFadeOut(area, delay, duration, easing);\n tagFadeOut(label, delay, duration, easing);\n}\n\nexport function pointFadeOut(\n itemLine: Segment,\n decorativeLine: ILine,\n item: Tag | IRichText | ISymbol | IImage,\n duration: number,\n delay: number,\n easing: EasingType\n) {\n segmentFadeOut(itemLine, delay, duration, easing);\n graphicFadeOut(decorativeLine, delay, duration, easing);\n if (item.getTextShape?.()) {\n // tag\n tagFadeOut(item as Tag, delay, duration, easing);\n } else {\n // symbol / richText / image\n graphicFadeOut(item, delay, duration, easing);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/marker/animate/index.ts"],"names":[],"mappings":"","file":"index.js","sourcesContent":[""]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { IArc, IGroup } from '@visactor/vrender-core';
|
|
2
|
+
import { Tag } from '../tag';
|
|
3
|
+
import { Marker } from './base';
|
|
4
|
+
import type { CommonMarkAreaAnimationType, MarkerAnimationState } from './type';
|
|
5
|
+
import { IMarkCommonArcLabelPosition, type MarkArcAreaAttrs } from './type';
|
|
6
|
+
import type { ComponentOptions } from '../interface';
|
|
7
|
+
export declare function registerMarkArcAreaAnimate(): void;
|
|
8
|
+
export declare class MarkArcArea extends Marker<MarkArcAreaAttrs, CommonMarkAreaAnimationType> {
|
|
9
|
+
name: string;
|
|
10
|
+
static defaultAttributes: {
|
|
11
|
+
interactive: boolean;
|
|
12
|
+
label: {
|
|
13
|
+
position: IMarkCommonArcLabelPosition;
|
|
14
|
+
textStyle: {
|
|
15
|
+
fill: string;
|
|
16
|
+
stroke: string;
|
|
17
|
+
lineWidth: number;
|
|
18
|
+
fontSize: number;
|
|
19
|
+
fontWeight: string;
|
|
20
|
+
fontStyle: string;
|
|
21
|
+
textAlign: string;
|
|
22
|
+
textBaseline: string;
|
|
23
|
+
};
|
|
24
|
+
padding: number[];
|
|
25
|
+
panel: {
|
|
26
|
+
visible: boolean;
|
|
27
|
+
cornerRadius: number;
|
|
28
|
+
fill: string;
|
|
29
|
+
fillOpacity: number;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
areaStyle: {
|
|
33
|
+
fill: string;
|
|
34
|
+
visible: boolean;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
private _area;
|
|
38
|
+
defaultUpdateAnimation: never;
|
|
39
|
+
defaultExitAnimation: import("./type").MarkerExitAnimation;
|
|
40
|
+
protected markerAnimate(state: MarkerAnimationState): void;
|
|
41
|
+
getArea(): IArc;
|
|
42
|
+
getLabel(): Tag;
|
|
43
|
+
constructor(attributes: MarkArcAreaAttrs, options?: ComponentOptions);
|
|
44
|
+
protected getPointAttrByPosition(position: IMarkCommonArcLabelPosition): {
|
|
45
|
+
position: {
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
};
|
|
49
|
+
angle: number;
|
|
50
|
+
};
|
|
51
|
+
protected setLabelPos(): void;
|
|
52
|
+
protected initMarker(container: IGroup): void;
|
|
53
|
+
protected updateMarker(): void;
|
|
54
|
+
protected isValidPoints(): boolean;
|
|
55
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.MarkArcArea = exports.registerMarkArcAreaAnimate = 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"), animate_1 = require("./animate/animate");
|
|
8
|
+
|
|
9
|
+
function registerMarkArcAreaAnimate() {
|
|
10
|
+
MarkArcArea._animate = animate_1.markArcAreaAnimate;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
(0, register_1.loadMarkArcAreaComponent)(), exports.registerMarkArcAreaAnimate = registerMarkArcAreaAnimate;
|
|
14
|
+
|
|
15
|
+
class MarkArcArea extends base_1.Marker {
|
|
16
|
+
markerAnimate(state) {
|
|
17
|
+
MarkArcArea._animate && MarkArcArea._animate(this._area, this._label, this._animationConfig, state);
|
|
18
|
+
}
|
|
19
|
+
getArea() {
|
|
20
|
+
return this._area;
|
|
21
|
+
}
|
|
22
|
+
getLabel() {
|
|
23
|
+
return this._label;
|
|
24
|
+
}
|
|
25
|
+
constructor(attributes, options) {
|
|
26
|
+
super((null == options ? void 0 : options.skipDefault) ? attributes : (0, vutils_1.merge)({}, MarkArcArea.defaultAttributes, attributes)),
|
|
27
|
+
this.name = "markArcArea", this.defaultUpdateAnimation = animate_1.DefaultUpdateMarkAreaAnimation,
|
|
28
|
+
this.defaultExitAnimation = animate_1.DefaultExitMarkerAnimation;
|
|
29
|
+
}
|
|
30
|
+
getPointAttrByPosition(position) {
|
|
31
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
32
|
+
const {center: center, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle, label: label} = this.attribute, {refX: refX = 0, refY: refY = 0} = label, labelRectHeight = Math.abs((null !== (_b = null === (_a = this._label.getTextShape().AABBBounds) || void 0 === _a ? void 0 : _a.y2) && void 0 !== _b ? _b : 0) - (null !== (_d = null === (_c = this._label.getTextShape()) || void 0 === _c ? void 0 : _c.AABBBounds.y1) && void 0 !== _d ? _d : 0)), labelTextHeight = Math.abs((null !== (_f = null === (_e = this._label.getBgRect().AABBBounds) || void 0 === _e ? void 0 : _e.y2) && void 0 !== _f ? _f : 0) - (null !== (_h = null === (_g = this._label.getBgRect()) || void 0 === _g ? void 0 : _g.AABBBounds.y1) && void 0 !== _h ? _h : 0)), labelHeight = Math.max(labelRectHeight, labelTextHeight);
|
|
33
|
+
let radius, angle, orthogonalOffsetDirection;
|
|
34
|
+
switch (position) {
|
|
35
|
+
case type_1.IMarkCommonArcLabelPosition.center:
|
|
36
|
+
radius = (innerRadius + outerRadius) / 2, angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = 0;
|
|
37
|
+
break;
|
|
38
|
+
|
|
39
|
+
case type_1.IMarkCommonArcLabelPosition.arcInnerStart:
|
|
40
|
+
radius = innerRadius, angle = startAngle, orthogonalOffsetDirection = -1;
|
|
41
|
+
break;
|
|
42
|
+
|
|
43
|
+
case type_1.IMarkCommonArcLabelPosition.arcOuterStart:
|
|
44
|
+
radius = outerRadius, angle = startAngle, orthogonalOffsetDirection = 1;
|
|
45
|
+
break;
|
|
46
|
+
|
|
47
|
+
case type_1.IMarkCommonArcLabelPosition.arcInnerEnd:
|
|
48
|
+
radius = innerRadius, angle = endAngle, orthogonalOffsetDirection = -1;
|
|
49
|
+
break;
|
|
50
|
+
|
|
51
|
+
case type_1.IMarkCommonArcLabelPosition.arcOuterEnd:
|
|
52
|
+
radius = outerRadius, angle = endAngle, orthogonalOffsetDirection = 1;
|
|
53
|
+
break;
|
|
54
|
+
|
|
55
|
+
case type_1.IMarkCommonArcLabelPosition.arcInnerMiddle:
|
|
56
|
+
radius = innerRadius, angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = -1;
|
|
57
|
+
break;
|
|
58
|
+
|
|
59
|
+
case type_1.IMarkCommonArcLabelPosition.arcOuterMiddle:
|
|
60
|
+
radius = outerRadius, angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = 1;
|
|
61
|
+
break;
|
|
62
|
+
|
|
63
|
+
default:
|
|
64
|
+
radius = innerRadius, angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = -1;
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
position: {
|
|
68
|
+
x: center.x + (radius + orthogonalOffsetDirection * labelHeight / 2 + refY) * Math.cos(angle) + refX * Math.cos(angle - Math.PI / 2),
|
|
69
|
+
y: center.y + (radius + orthogonalOffsetDirection * labelHeight / 2 + refY) * Math.sin(angle) + refX * Math.sin(angle - Math.PI / 2)
|
|
70
|
+
},
|
|
71
|
+
angle: angle
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
setLabelPos() {
|
|
75
|
+
var _a;
|
|
76
|
+
if (this._label && this._area) {
|
|
77
|
+
const {label: label = {}} = this.attribute, {position: labelPosition = "arcInnerMiddle", autoRotate: autoRotate = !0} = label, labelAttr = this.getPointAttrByPosition(labelPosition);
|
|
78
|
+
if (this._label.setAttributes(Object.assign(Object.assign({}, labelAttr.position), {
|
|
79
|
+
angle: autoRotate ? labelAttr.angle - Math.PI / 2 + (null !== (_a = label.refAngle) && void 0 !== _a ? _a : 0) : 0
|
|
80
|
+
})), this.attribute.limitRect && label.confine) {
|
|
81
|
+
const {x: x, y: y, width: width, height: height} = this.attribute.limitRect;
|
|
82
|
+
(0, limit_shape_1.limitShapeInBounds)(this._label, {
|
|
83
|
+
x1: x,
|
|
84
|
+
y1: y,
|
|
85
|
+
x2: x + width,
|
|
86
|
+
y2: y + height
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
initMarker(container) {
|
|
92
|
+
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({
|
|
93
|
+
x: center.x,
|
|
94
|
+
y: center.y,
|
|
95
|
+
innerRadius: innerRadius,
|
|
96
|
+
outerRadius: outerRadius,
|
|
97
|
+
startAngle: startAngle,
|
|
98
|
+
endAngle: endAngle
|
|
99
|
+
}, areaStyle));
|
|
100
|
+
area.states = (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.area),
|
|
101
|
+
area.name = "polar-mark-area-area", this._area = area, container.add(area);
|
|
102
|
+
const markLabel = new tag_1.Tag(Object.assign(Object.assign({}, label), {
|
|
103
|
+
state: {
|
|
104
|
+
panel: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.labelBackground),
|
|
105
|
+
text: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.label)
|
|
106
|
+
}
|
|
107
|
+
}));
|
|
108
|
+
markLabel.name = "mark-area-label", this._label = markLabel, container.add(markLabel),
|
|
109
|
+
this.setLabelPos();
|
|
110
|
+
}
|
|
111
|
+
updateMarker() {
|
|
112
|
+
const {center: center, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle, areaStyle: areaStyle, label: label} = this.attribute;
|
|
113
|
+
this._area && this._area.setAttributes(Object.assign({
|
|
114
|
+
x: center.x,
|
|
115
|
+
y: center.y,
|
|
116
|
+
innerRadius: innerRadius,
|
|
117
|
+
outerRadius: outerRadius,
|
|
118
|
+
startAngle: startAngle,
|
|
119
|
+
endAngle: endAngle
|
|
120
|
+
}, areaStyle)), this._area && this._label.setAttributes(Object.assign({
|
|
121
|
+
dx: 0,
|
|
122
|
+
dy: 0
|
|
123
|
+
}, label)), this.setLabelPos();
|
|
124
|
+
}
|
|
125
|
+
isValidPoints() {
|
|
126
|
+
return !0;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
exports.MarkArcArea = MarkArcArea, MarkArcArea.defaultAttributes = config_1.DEFAULT_MARK_ARC_AREA_THEME;
|
|
131
|
+
//# sourceMappingURL=arc-area.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/marker/arc-area.ts"],"names":[],"mappings":";;;AAEA,yDAAwD;AACxD,6CAAyC;AAGzC,gCAA6B;AAC7B,iCAAgC;AAChC,qCAAuD;AAGvD,iCAA4E;AAC5E,qDAAyD;AAEzD,yCAAsD;AACtD,0CAA6C;AAC7C,+CAAmH;AAEnH,IAAA,mCAAwB,GAAE,CAAC;AAE3B,SAAgB,0BAA0B;IACxC,WAAW,CAAC,QAAQ,GAAG,4BAAkB,CAAC;AAC5C,CAAC;AAFD,gEAEC;AAED,MAAa,WAAY,SAAQ,aAAqD;IAQ1E,aAAa,CAAC,KAA2B;QACjD,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;SAC7E;IACH,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,YAAY,UAA4B,EAAE,OAA0B;QAClE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,WAAW,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAtBlG,SAAI,GAAG,aAAa,CAAC;QAKrB,2BAAsB,GAAG,wCAA8B,CAAC;QACxD,yBAAoB,GAAG,oCAA0B,CAAC;IAiB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rB,CAAC;IAES,YAAY;QACpB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI;aACtF,SAA6B,CAAC;QACjC,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;;AArLH,kCAsLC;AApLQ,6BAAiB,GAAG,oCAA2B,CAAC","file":"arc-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_MARK_ARC_AREA_THEME } from './config';\nimport type { CommonMarkAreaAnimationType, MarkerAnimationState } from './type';\n// eslint-disable-next-line no-duplicate-imports\nimport { IMarkCommonArcLabelPosition, type MarkArcAreaAttrs } from './type';\nimport { limitShapeInBounds } from '../util/limit-shape';\nimport type { ComponentOptions } from '../interface';\nimport { loadMarkArcAreaComponent } from './register';\nimport { DEFAULT_STATES } from '../constant';\nimport { DefaultExitMarkerAnimation, DefaultUpdateMarkAreaAnimation, markArcAreaAnimate } from './animate/animate';\n\nloadMarkArcAreaComponent();\n\nexport function registerMarkArcAreaAnimate() {\n MarkArcArea._animate = markArcAreaAnimate;\n}\n\nexport class MarkArcArea extends Marker<MarkArcAreaAttrs, CommonMarkAreaAnimationType> {\n name = 'markArcArea';\n static defaultAttributes = DEFAULT_MARK_ARC_AREA_THEME;\n private _area!: IArc;\n\n /** animate */\n defaultUpdateAnimation = DefaultUpdateMarkAreaAnimation;\n defaultExitAnimation = DefaultExitMarkerAnimation;\n protected markerAnimate(state: MarkerAnimationState) {\n if (MarkArcArea._animate) {\n MarkArcArea._animate(this._area, this._label, this._animationConfig, state);\n }\n }\n\n getArea() {\n return this._area;\n }\n\n getLabel() {\n return this._label;\n }\n\n constructor(attributes: MarkArcAreaAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, MarkArcArea.defaultAttributes, attributes));\n }\n\n protected getPointAttrByPosition(position: IMarkCommonArcLabelPosition) {\n const { center, innerRadius, outerRadius, startAngle, endAngle, label } = this.attribute as MarkArcAreaAttrs;\n const { refX = 0, refY = 0 } = label;\n // eslint-disable-next-line max-len\n const labelRectHeight = Math.abs(\n (this._label.getTextShape().AABBBounds?.y2 ?? 0) - (this._label.getTextShape()?.AABBBounds.y1 ?? 0)\n );\n // eslint-disable-next-line max-len\n const labelTextHeight = Math.abs(\n (this._label.getBgRect().AABBBounds?.y2 ?? 0) - (this._label.getBgRect()?.AABBBounds.y1 ?? 0)\n );\n const labelHeight = Math.max(labelRectHeight, labelTextHeight);\n\n let radius;\n let angle;\n // tag在正交方向是向内偏移,还是向外偏移\n // 不偏移: 0, 内: -1, 外: 1\n let orthogonalOffsetDirection;\n\n switch (position) {\n case IMarkCommonArcLabelPosition.center:\n radius = (innerRadius + outerRadius) / 2;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = 0;\n break;\n case IMarkCommonArcLabelPosition.arcInnerStart:\n radius = innerRadius;\n angle = startAngle;\n orthogonalOffsetDirection = -1;\n break;\n case IMarkCommonArcLabelPosition.arcOuterStart:\n radius = outerRadius;\n angle = startAngle;\n orthogonalOffsetDirection = 1;\n break;\n case IMarkCommonArcLabelPosition.arcInnerEnd:\n radius = innerRadius;\n angle = endAngle;\n orthogonalOffsetDirection = -1;\n break;\n case IMarkCommonArcLabelPosition.arcOuterEnd:\n radius = outerRadius;\n angle = endAngle;\n orthogonalOffsetDirection = 1;\n break;\n case IMarkCommonArcLabelPosition.arcInnerMiddle:\n radius = innerRadius;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = -1;\n break;\n case IMarkCommonArcLabelPosition.arcOuterMiddle:\n radius = outerRadius;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = 1;\n break;\n default: // default arcInnerMiddle\n radius = innerRadius;\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = -1;\n }\n\n return {\n position: {\n x:\n center.x +\n (radius + (orthogonalOffsetDirection * labelHeight) / 2 + refY) * Math.cos(angle) +\n refX * Math.cos(angle - Math.PI / 2),\n y:\n center.y +\n (radius + (orthogonalOffsetDirection * labelHeight) / 2 + refY) * Math.sin(angle) +\n refX * Math.sin(angle - Math.PI / 2)\n },\n angle\n };\n }\n\n protected setLabelPos() {\n if (this._label && this._area) {\n const { label = {} } = this.attribute as MarkArcAreaAttrs;\n const { position: labelPosition = 'arcInnerMiddle', autoRotate = true } = label;\n const labelAttr = this.getPointAttrByPosition(labelPosition as IMarkCommonArcLabelPosition);\n\n this._label.setAttributes({\n ...labelAttr.position,\n angle: autoRotate ? labelAttr.angle - Math.PI / 2 + (label.refAngle ?? 0) : 0\n });\n\n if (this.attribute.limitRect && label.confine) {\n const { x, y, width, height } = this.attribute.limitRect;\n limitShapeInBounds(this._label, {\n x1: x,\n y1: y,\n x2: x + width,\n y2: y + height\n });\n }\n }\n }\n\n protected initMarker(container: IGroup) {\n const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label, state } = this\n .attribute as MarkArcAreaAttrs;\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 MarkArcAreaAttrs;\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,25 @@
|
|
|
1
|
+
import { ArcSegment } from '../segment';
|
|
2
|
+
import { MarkCommonLine } from './common-line';
|
|
3
|
+
import type { ComponentOptions } from '../interface';
|
|
4
|
+
import type { IArcGraphicAttribute } from '@visactor/vrender-core';
|
|
5
|
+
import { IMarkCommonArcLabelPosition } from './type';
|
|
6
|
+
import type { MarkArcLineAttrs, MarkerAnimationState } from './type';
|
|
7
|
+
export declare function registerMarkArcLineAnimate(): void;
|
|
8
|
+
export declare class MarkArcLine extends MarkCommonLine<IArcGraphicAttribute, IMarkCommonArcLabelPosition> {
|
|
9
|
+
name: string;
|
|
10
|
+
static defaultAttributes: Partial<MarkArcLineAttrs>;
|
|
11
|
+
protected _line: ArcSegment;
|
|
12
|
+
protected markerAnimate(state: MarkerAnimationState): void;
|
|
13
|
+
constructor(attributes: MarkArcLineAttrs, options?: ComponentOptions);
|
|
14
|
+
protected getPointAttrByPosition(direction: IMarkCommonArcLabelPosition): {
|
|
15
|
+
position: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
};
|
|
19
|
+
angle: number;
|
|
20
|
+
};
|
|
21
|
+
protected getRotateByAngle(angle: number): number;
|
|
22
|
+
protected createSegment(): ArcSegment;
|
|
23
|
+
protected setLineAttributes(): void;
|
|
24
|
+
protected isValidPoints(): boolean;
|
|
25
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.MarkArcLine = exports.registerMarkArcLineAnimate = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), segment_1 = require("../segment"), register_1 = require("./register"), constant_1 = require("../constant"), common_line_1 = require("./common-line"), type_1 = require("./type"), config_1 = require("./config"), animate_1 = require("./animate/animate");
|
|
8
|
+
|
|
9
|
+
function registerMarkArcLineAnimate() {
|
|
10
|
+
MarkArcLine._animate = animate_1.commonMarkLineAnimate;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
(0, register_1.loadMarkArcLineComponent)(), exports.registerMarkArcLineAnimate = registerMarkArcLineAnimate;
|
|
14
|
+
|
|
15
|
+
class MarkArcLine extends common_line_1.MarkCommonLine {
|
|
16
|
+
markerAnimate(state) {
|
|
17
|
+
MarkArcLine._animate && MarkArcLine._animate(this._line, this._label, this._animationConfig, state);
|
|
18
|
+
}
|
|
19
|
+
constructor(attributes, options) {
|
|
20
|
+
super((null == options ? void 0 : options.skipDefault) ? attributes : (0, vutils_1.merge)({}, MarkArcLine.defaultAttributes, attributes)),
|
|
21
|
+
this.name = "markArcLine";
|
|
22
|
+
}
|
|
23
|
+
getPointAttrByPosition(direction) {
|
|
24
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
25
|
+
const {center: center, radius: radius, startAngle: startAngle, endAngle: endAngle, label: label} = this.attribute, {refX: refX = 0, refY: refY = 0} = label, labelRectHeight = Math.abs((null !== (_c = null === (_b = null === (_a = this._label.getTextShape()) || void 0 === _a ? void 0 : _a.AABBBounds) || void 0 === _b ? void 0 : _b.y2) && void 0 !== _c ? _c : 0) - (null !== (_e = null === (_d = this._label.getTextShape()) || void 0 === _d ? void 0 : _d.AABBBounds.y1) && void 0 !== _e ? _e : 0)), labelTextHeight = Math.abs((null !== (_h = null === (_g = null === (_f = this._label.getBgRect()) || void 0 === _f ? void 0 : _f.AABBBounds) || void 0 === _g ? void 0 : _g.y2) && void 0 !== _h ? _h : 0) - (null !== (_k = null === (_j = this._label.getBgRect()) || void 0 === _j ? void 0 : _j.AABBBounds.y1) && void 0 !== _k ? _k : 0)), labelHeight = Math.max(labelRectHeight, labelTextHeight);
|
|
26
|
+
let angle, orthogonalOffsetDirection;
|
|
27
|
+
switch (direction) {
|
|
28
|
+
case type_1.IMarkCommonArcLabelPosition.center:
|
|
29
|
+
angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = 0;
|
|
30
|
+
break;
|
|
31
|
+
|
|
32
|
+
case type_1.IMarkCommonArcLabelPosition.arcInnerStart:
|
|
33
|
+
angle = startAngle, orthogonalOffsetDirection = -1;
|
|
34
|
+
break;
|
|
35
|
+
|
|
36
|
+
case type_1.IMarkCommonArcLabelPosition.arcOuterStart:
|
|
37
|
+
angle = startAngle, orthogonalOffsetDirection = 1;
|
|
38
|
+
break;
|
|
39
|
+
|
|
40
|
+
case type_1.IMarkCommonArcLabelPosition.arcInnerEnd:
|
|
41
|
+
angle = endAngle, orthogonalOffsetDirection = -1;
|
|
42
|
+
break;
|
|
43
|
+
|
|
44
|
+
case type_1.IMarkCommonArcLabelPosition.arcOuterEnd:
|
|
45
|
+
angle = endAngle, orthogonalOffsetDirection = 1;
|
|
46
|
+
break;
|
|
47
|
+
|
|
48
|
+
case type_1.IMarkCommonArcLabelPosition.arcInnerMiddle:
|
|
49
|
+
angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = -1;
|
|
50
|
+
break;
|
|
51
|
+
|
|
52
|
+
case type_1.IMarkCommonArcLabelPosition.arcOuterMiddle:
|
|
53
|
+
angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = 1;
|
|
54
|
+
break;
|
|
55
|
+
|
|
56
|
+
default:
|
|
57
|
+
angle = (startAngle + endAngle) / 2, orthogonalOffsetDirection = -1;
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
position: {
|
|
61
|
+
x: center.x + (radius + orthogonalOffsetDirection * labelHeight / 2 + refY) * Math.cos(angle) + refX * Math.cos(angle - Math.PI / 2),
|
|
62
|
+
y: center.y + (radius + orthogonalOffsetDirection * labelHeight / 2 + refY) * Math.sin(angle) + refX * Math.sin(angle - Math.PI / 2)
|
|
63
|
+
},
|
|
64
|
+
angle: angle
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
getRotateByAngle(angle) {
|
|
68
|
+
var _a;
|
|
69
|
+
return angle - Math.PI / 2 + (null !== (_a = this.attribute.label.refAngle) && void 0 !== _a ? _a : 0);
|
|
70
|
+
}
|
|
71
|
+
createSegment() {
|
|
72
|
+
const {center: center, radius: radius, startAngle: startAngle, endAngle: endAngle, startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle, state: state} = this.attribute;
|
|
73
|
+
return new segment_1.ArcSegment({
|
|
74
|
+
center: center,
|
|
75
|
+
radius: radius,
|
|
76
|
+
startAngle: startAngle,
|
|
77
|
+
endAngle: endAngle,
|
|
78
|
+
startSymbol: startSymbol,
|
|
79
|
+
endSymbol: endSymbol,
|
|
80
|
+
lineStyle: lineStyle,
|
|
81
|
+
state: {
|
|
82
|
+
line: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.line),
|
|
83
|
+
startSymbol: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.lineStartSymbol),
|
|
84
|
+
endSymbol: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.lineEndSymbol)
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
setLineAttributes() {
|
|
89
|
+
const {center: center, radius: radius, startAngle: startAngle, endAngle: endAngle, startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle} = this.attribute;
|
|
90
|
+
this._line && this._line.setAttributes({
|
|
91
|
+
center: center,
|
|
92
|
+
radius: radius,
|
|
93
|
+
startAngle: startAngle,
|
|
94
|
+
endAngle: endAngle,
|
|
95
|
+
startSymbol: startSymbol,
|
|
96
|
+
endSymbol: endSymbol,
|
|
97
|
+
lineStyle: lineStyle
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
isValidPoints() {
|
|
101
|
+
return !0;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
exports.MarkArcLine = MarkArcLine, MarkArcLine.defaultAttributes = config_1.DEFAULT_MARK_ARC_LINE_THEME;
|
|
106
|
+
//# sourceMappingURL=arc-line.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/marker/arc-line.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,wCAAwC;AACxC,yCAAsD;AACtD,0CAA6C;AAC7C,+CAA+C;AAG/C,iCAAqD;AAGrD,qCAAuD;AACvD,+CAA0D;AAE1D,IAAA,mCAAwB,GAAE,CAAC;AAE3B,SAAgB,0BAA0B;IACxC,WAAW,CAAC,QAAQ,GAAG,+BAAqB,CAAC;AAC/C,CAAC;AAFD,gEAEC;AACD,MAAa,WAAY,SAAQ,4BAAiE;IAMtF,aAAa,CAAC,KAA2B;QACjD,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;SAC7E;IACH,CAAC;IAED,YAAY,UAA4B,EAAE,OAA0B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AE,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI;aACrF,SAA6B,CAAC;QACjC,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;IAES,aAAa;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;;AA1HH,kCA2HC;AAxHQ,6BAAiB,GAA8B,oCAA0D,CAAC","file":"arc-line.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { ArcSegment } from '../segment';\nimport { loadMarkArcLineComponent } from './register';\nimport { DEFAULT_STATES } from '../constant';\nimport { MarkCommonLine } from './common-line';\nimport type { ComponentOptions } from '../interface';\nimport type { IArcGraphicAttribute } from '@visactor/vrender-core';\nimport { IMarkCommonArcLabelPosition } from './type';\n// eslint-disable-next-line no-duplicate-imports\nimport type { MarkArcLineAttrs, MarkerAnimationState } from './type';\nimport { DEFAULT_MARK_ARC_LINE_THEME } from './config';\nimport { commonMarkLineAnimate } from './animate/animate';\n\nloadMarkArcLineComponent();\n\nexport function registerMarkArcLineAnimate() {\n MarkArcLine._animate = commonMarkLineAnimate;\n}\nexport class MarkArcLine extends MarkCommonLine<IArcGraphicAttribute, IMarkCommonArcLabelPosition> {\n name = 'markArcLine';\n // eslint-disable-next-line max-len\n static defaultAttributes: Partial<MarkArcLineAttrs> = DEFAULT_MARK_ARC_LINE_THEME as unknown as MarkArcLineAttrs;\n protected _line!: ArcSegment;\n\n protected markerAnimate(state: MarkerAnimationState) {\n if (MarkArcLine._animate) {\n MarkArcLine._animate(this._line, this._label, this._animationConfig, state);\n }\n }\n\n constructor(attributes: MarkArcLineAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, MarkArcLine.defaultAttributes, attributes));\n }\n\n protected getPointAttrByPosition(direction: IMarkCommonArcLabelPosition) {\n const { center, radius, startAngle, endAngle, label } = this.attribute as MarkArcLineAttrs;\n const { refX = 0, refY = 0 } = label;\n const labelRectHeight = Math.abs(\n (this._label.getTextShape()?.AABBBounds?.y2 ?? 0) - (this._label.getTextShape()?.AABBBounds.y1 ?? 0)\n );\n const labelTextHeight = Math.abs(\n (this._label.getBgRect()?.AABBBounds?.y2 ?? 0) - (this._label.getBgRect()?.AABBBounds.y1 ?? 0)\n );\n const labelHeight = Math.max(labelRectHeight, labelTextHeight);\n\n let angle;\n // tag在正交方向是向内偏移,还是向外偏移\n // 不偏移: 0, 内: -1, 外: 1\n let orthogonalOffsetDirection;\n\n switch (direction) {\n case IMarkCommonArcLabelPosition.center:\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = 0;\n break;\n case IMarkCommonArcLabelPosition.arcInnerStart:\n angle = startAngle;\n orthogonalOffsetDirection = -1;\n break;\n case IMarkCommonArcLabelPosition.arcOuterStart:\n angle = startAngle;\n orthogonalOffsetDirection = 1;\n break;\n case IMarkCommonArcLabelPosition.arcInnerEnd:\n angle = endAngle;\n orthogonalOffsetDirection = -1;\n break;\n case IMarkCommonArcLabelPosition.arcOuterEnd:\n angle = endAngle;\n orthogonalOffsetDirection = 1;\n break;\n case IMarkCommonArcLabelPosition.arcInnerMiddle:\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = -1;\n break;\n case IMarkCommonArcLabelPosition.arcOuterMiddle:\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = 1;\n break;\n default: // default arcInnerMiddle\n angle = (startAngle + endAngle) / 2;\n orthogonalOffsetDirection = -1;\n }\n\n return {\n position: {\n x:\n center.x +\n (radius + (orthogonalOffsetDirection * labelHeight) / 2 + refY) * Math.cos(angle) +\n refX * Math.cos(angle - Math.PI / 2),\n y:\n center.y +\n (radius + (orthogonalOffsetDirection * labelHeight) / 2 + refY) * Math.sin(angle) +\n refX * Math.sin(angle - Math.PI / 2)\n },\n angle\n };\n }\n\n protected getRotateByAngle(angle: number): number {\n return angle - Math.PI / 2 + (this.attribute.label.refAngle ?? 0);\n }\n\n protected createSegment() {\n const { center, radius, startAngle, endAngle, startSymbol, endSymbol, lineStyle, state } = this\n .attribute as MarkArcLineAttrs;\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 MarkArcLineAttrs;\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 protected isValidPoints() {\n return true;\n }\n}\n"]}
|
package/cjs/marker/area.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { IGroup, IPolygon } from '@visactor/vrender-core';
|
|
2
2
|
import { Tag } from '../tag';
|
|
3
3
|
import { Marker } from './base';
|
|
4
|
-
import type { MarkAreaAttrs } from './type';
|
|
4
|
+
import type { CommonMarkAreaAnimationType, IMarkAreaLabelPosition, MarkAreaAttrs, MarkerAnimationState } from './type';
|
|
5
5
|
import type { ComponentOptions } from '../interface';
|
|
6
|
-
export declare
|
|
6
|
+
export declare function registerMarkAreaAnimate(): void;
|
|
7
|
+
export declare class MarkArea extends Marker<MarkAreaAttrs, CommonMarkAreaAnimationType> {
|
|
7
8
|
name: string;
|
|
8
9
|
static defaultAttributes: {
|
|
10
|
+
interactive: boolean;
|
|
9
11
|
label: {
|
|
10
|
-
position:
|
|
12
|
+
position: IMarkAreaLabelPosition;
|
|
11
13
|
textStyle: {
|
|
12
14
|
fill: string;
|
|
13
15
|
stroke: string;
|
|
@@ -15,6 +17,8 @@ export declare class MarkArea extends Marker<MarkAreaAttrs> {
|
|
|
15
17
|
fontSize: number;
|
|
16
18
|
fontWeight: string;
|
|
17
19
|
fontStyle: string;
|
|
20
|
+
textAlign: string;
|
|
21
|
+
textBaseline: string;
|
|
18
22
|
};
|
|
19
23
|
padding: number[];
|
|
20
24
|
panel: {
|
|
@@ -29,11 +33,17 @@ export declare class MarkArea extends Marker<MarkAreaAttrs> {
|
|
|
29
33
|
visible: boolean;
|
|
30
34
|
};
|
|
31
35
|
};
|
|
36
|
+
defaultUpdateAnimation: never;
|
|
37
|
+
defaultExitAnimation: import("./type").MarkerExitAnimation;
|
|
38
|
+
protected markerAnimate(state: MarkerAnimationState): void;
|
|
32
39
|
private _area;
|
|
33
40
|
getArea(): IPolygon;
|
|
34
41
|
getLabel(): Tag;
|
|
35
42
|
constructor(attributes: MarkAreaAttrs, options?: ComponentOptions);
|
|
36
|
-
|
|
43
|
+
protected getPointAttrByPosition(position: IMarkAreaLabelPosition): {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
};
|
|
37
47
|
protected setLabelPos(): void;
|
|
38
48
|
protected initMarker(container: IGroup): void;
|
|
39
49
|
protected updateMarker(): void;
|