@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
package/cjs/marker/point.js
CHANGED
|
@@ -2,16 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.MarkPoint = void 0;
|
|
5
|
+
}), exports.MarkPoint = exports.registerMarkPointAnimate = void 0;
|
|
6
6
|
|
|
7
|
-
const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils"), segment_1 = require("../segment"), tag_1 = require("../tag"), base_1 = require("./base"), config_1 = require("./config"), type_1 = require("./type"), register_1 = require("./register"), limit_shape_1 = require("../util/limit-shape");
|
|
7
|
+
const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils"), segment_1 = require("../segment"), tag_1 = require("../tag"), base_1 = require("./base"), config_1 = require("./config"), type_1 = require("./type"), register_1 = require("./register"), limit_shape_1 = require("../util/limit-shape"), constant_1 = require("../constant"), animate_1 = require("./animate/animate");
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
function registerMarkPointAnimate() {
|
|
10
|
+
MarkPoint._animate = animate_1.markPointAnimate;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
(0, register_1.loadMarkPointComponent)(), exports.registerMarkPointAnimate = registerMarkPointAnimate;
|
|
10
14
|
|
|
11
15
|
class MarkPoint extends base_1.Marker {
|
|
16
|
+
markerAnimate(state) {
|
|
17
|
+
MarkPoint._animate && MarkPoint._animate([ this._line, this._decorativeLine ], this._item, this._animationConfig, state);
|
|
18
|
+
}
|
|
12
19
|
constructor(attributes, options) {
|
|
13
20
|
super((null == options ? void 0 : options.skipDefault) ? attributes : (0, vutils_1.merge)({}, MarkPoint.defaultAttributes, attributes)),
|
|
14
|
-
this.name = "markPoint"
|
|
21
|
+
this.name = "markPoint", this.defaultUpdateAnimation = animate_1.DefaultUpdateMarkPointAnimation,
|
|
22
|
+
this.defaultExitAnimation = animate_1.DefaultExitMarkerAnimation;
|
|
15
23
|
}
|
|
16
24
|
setLabelPos() {}
|
|
17
25
|
setItemAttributes(item, itemContent, itemPosition, itemType) {
|
|
@@ -43,10 +51,20 @@ class MarkPoint extends base_1.Marker {
|
|
|
43
51
|
return position.includes("top") || position.includes("Top") ? -height : position.includes("middle") || position.includes("Middle") ? -height / 2 : 0;
|
|
44
52
|
}
|
|
45
53
|
initItem(itemContent, itemPosition) {
|
|
46
|
-
const {type: type = "text", symbolStyle: symbolStyle, richTextStyle: richTextStyle, imageStyle: imageStyle, renderCustomCallback: renderCustomCallback} = itemContent;
|
|
54
|
+
const {state: state} = this.attribute, {type: type = "text", symbolStyle: symbolStyle, richTextStyle: richTextStyle, imageStyle: imageStyle, renderCustomCallback: renderCustomCallback} = itemContent;
|
|
47
55
|
let item;
|
|
48
|
-
return "symbol" === type ? item = vrender_core_1.graphicCreator.symbol(Object.assign(Object.assign({}, itemPosition), symbolStyle))
|
|
49
|
-
|
|
56
|
+
return "symbol" === type ? (item = vrender_core_1.graphicCreator.symbol(Object.assign(Object.assign({}, itemPosition), symbolStyle)),
|
|
57
|
+
item.states = (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.symbol)) : "text" === type ? item = new tag_1.Tag(Object.assign(Object.assign({}, itemPosition), {
|
|
58
|
+
state: {
|
|
59
|
+
panel: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.textBackground),
|
|
60
|
+
text: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.text)
|
|
61
|
+
}
|
|
62
|
+
})) : "richText" === type ? (item = vrender_core_1.graphicCreator.richtext(Object.assign(Object.assign({}, itemPosition), richTextStyle)),
|
|
63
|
+
item.states = (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.richText)) : "image" === type ? (item = vrender_core_1.graphicCreator.image(Object.assign(Object.assign({}, itemPosition), imageStyle)),
|
|
64
|
+
item.states = (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.image)) : "custom" === type && renderCustomCallback && (item = renderCustomCallback(),
|
|
65
|
+
item.states = (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.customMark)),
|
|
66
|
+
item.name = `mark-point-${type}`, this.setItemAttributes(item, itemContent, itemPosition, type),
|
|
67
|
+
item;
|
|
50
68
|
}
|
|
51
69
|
getItemLineAttr(itemLine, position, itemPosition) {
|
|
52
70
|
let points = [];
|
|
@@ -117,17 +135,23 @@ class MarkPoint extends base_1.Marker {
|
|
|
117
135
|
this.setDecorativeLineAttr(itemLine, itemPosition, null === (_a = itemLine.decorativeLine) || void 0 === _a ? void 0 : _a.visible);
|
|
118
136
|
}
|
|
119
137
|
initMarker(container) {
|
|
120
|
-
const {position: position, itemContent: itemContent = {}} = this.attribute, itemPosition = {
|
|
138
|
+
const {position: position, itemContent: itemContent = {}, state: state} = this.attribute, itemPosition = {
|
|
121
139
|
x: position.x + (itemContent.offsetX || 0),
|
|
122
140
|
y: position.y + (itemContent.offsetY || 0)
|
|
123
141
|
}, line = new segment_1.Segment({
|
|
124
142
|
points: [],
|
|
125
|
-
pickable: !1
|
|
143
|
+
pickable: !1,
|
|
144
|
+
state: {
|
|
145
|
+
line: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.line),
|
|
146
|
+
startSymbol: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.lineStartSymbol),
|
|
147
|
+
endSymbol: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.lineEndSymbol)
|
|
148
|
+
}
|
|
126
149
|
});
|
|
127
150
|
line.name = "mark-point-line", this._line = line, container.add(line);
|
|
128
151
|
const decorativeLine = vrender_core_1.graphicCreator.line({
|
|
129
152
|
points: []
|
|
130
153
|
});
|
|
154
|
+
decorativeLine.states = (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.line),
|
|
131
155
|
decorativeLine.name = "mark-point-decorativeLine", this._decorativeLine = decorativeLine,
|
|
132
156
|
container.add(decorativeLine);
|
|
133
157
|
const item = this.initItem(itemContent, itemPosition);
|
package/cjs/marker/point.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/point.ts"],"names":[],"mappings":";;;AAYA,yDAAwD;AAGxD,6CAAwD;AACxD,wCAAqC;AAGrC,gCAA6B;AAC7B,iCAAgC;AAChC,qCAAuF;AAGvF,iCAAgD;AAGhD,yCAAoD;AACpD,qDAA4D;AAE5D,IAAA,iCAAsB,GAAE,CAAC;AACzB,MAAa,SAAU,SAAQ,aAAsB;IAUnD,YAAY,UAA0B,EAAE,OAA0B;QAChE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,C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,CAAC,CAAC;QAC7D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAGlB,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;QACrC,SAAS,CAAC,GAAG,CAAC,IAAwB,CAAC,CAAC;IAC1C,CAAC;IAES,YAAY;QACpB,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,SAA2B,CAAC;QACxE,MAAM,EAAE,IAAI,GAAG,MAAM,EAAE,GAAG,WAAW,CAAC;QAEtC,MAAM,YAAY,GAAG;YACnB,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,OAAO,IAAI,CAAC,CAAC;YAC1C,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,OAAO,IAAI,CAAC,CAAC;SAC3C,CAAC;QAGF,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;QAEpE,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC;IAES,aAAa;QACrB,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,SAA2B,CAAC;QACtD,IAAI,IAAA,sBAAa,EAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAA,sBAAa,EAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;YAC1D,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;;AA7RH,8BA8RC;AA5RQ,2BAAiB,GAAG,iCAAwB,CAAC","file":"point.js","sourcesContent":["import type {\n IGroup,\n IImage,\n INode,\n ISymbol,\n IImageGraphicAttribute,\n IRichText,\n IRichTextGraphicAttribute,\n ILine,\n ILineGraphicAttribute\n} from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport type { IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isValidNumber, merge } from '@visactor/vutils';\nimport { Segment } from '../segment';\nimport type { TagAttributes } from '../tag';\n// eslint-disable-next-line no-duplicate-imports\nimport { Tag } from '../tag';\nimport { Marker } from './base';\nimport { DEFAULT_MARK_POINT_TEXT_STYLE_MAP, DEFAULT_MARK_POINT_THEME } from './config';\nimport type { IItemContent, IItemLine, MarkPointAttrs } from './type';\n// eslint-disable-next-line no-duplicate-imports\nimport { IMarkPointItemPosition } from './type';\nimport type { Point } from '../core/type';\nimport type { ComponentOptions } from '../interface';\nimport { loadMarkPointComponent } from './register';\nimport { computeOffsetForlimit } from '../util/limit-shape';\n\nloadMarkPointComponent();\nexport class MarkPoint extends Marker<MarkPointAttrs> {\n name = 'markPoint';\n static defaultAttributes = DEFAULT_MARK_POINT_THEME;\n\n private _item!: ISymbol | Tag | IImage | IRichText;\n\n private _line?: Segment;\n\n private _decorativeLine!: ILine;\n\n constructor(attributes: MarkPointAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, MarkPoint.defaultAttributes, attributes));\n }\n\n protected setLabelPos() {\n //do nothing\n }\n\n protected setItemAttributes(\n item: ISymbol | Tag | IImage | IRichText,\n itemContent: IItemContent,\n itemPosition: Point,\n itemType: 'symbol' | 'text' | 'image' | 'richText' | 'custom'\n ) {\n if (!item) {\n return;\n }\n const {\n autoRotate = true,\n refX = 0,\n refY = 0,\n refAngle = 0,\n textStyle = {},\n richTextStyle = {},\n imageStyle = {},\n position = IMarkPointItemPosition.middle\n } = itemContent;\n const itemAngle = this._line?.getEndAngle() || 0;\n const itemOffsetX = refX * Math.cos(itemAngle) + refY * Math.cos(itemAngle - Math.PI / 2);\n const itemOffsetY = refX * Math.sin(itemAngle) + refY * Math.sin(itemAngle - Math.PI / 2);\n if (itemType === 'text') {\n item.setAttributes({\n ...(textStyle as TagAttributes),\n textStyle: {\n ...DEFAULT_MARK_POINT_TEXT_STYLE_MAP[itemContent?.position || 'end'],\n ...textStyle.textStyle\n }\n } as any);\n } else if (itemType === 'richText') {\n item.setAttributes({\n dx: this.getItemDx(item, position, richTextStyle) + (richTextStyle.dx || 0),\n dy: this.getItemDy(item, position, richTextStyle) + (richTextStyle.dy || 0)\n });\n } else if (itemType === 'image') {\n item.setAttributes({\n dx: this.getItemDx(item, position, imageStyle) + (imageStyle.dx || 0),\n dy: this.getItemDy(item, position, imageStyle) + (imageStyle.dy || 0)\n });\n }\n item.setAttributes({\n x: itemPosition.x + (itemOffsetX || 0),\n y: itemPosition.y + (itemOffsetY || 0),\n angle: autoRotate && itemAngle + refAngle\n });\n }\n\n protected getItemDx(\n item: ISymbol | Tag | IImage | IRichText,\n position: keyof typeof IMarkPointItemPosition,\n style?: IImageGraphicAttribute | IRichTextGraphicAttribute\n ) {\n const width = (item as IGroup)?.AABBBounds?.width() ?? (style?.width || 0);\n if (position.includes('inside')) {\n return -width;\n }\n if (position === 'insideTop') {\n return 0;\n }\n return 0;\n }\n\n protected getItemDy(\n item: ISymbol | Tag | IImage | IRichText,\n position: keyof typeof IMarkPointItemPosition,\n style?: IImageGraphicAttribute | IRichTextGraphicAttribute\n ) {\n const height = (item as IGroup)?.AABBBounds?.height() ?? (style?.height || 0);\n if (position.includes('top') || position.includes('Top')) {\n return -height;\n }\n if (position.includes('middle') || position.includes('Middle')) {\n return -height / 2;\n }\n return 0;\n }\n\n protected initItem(itemContent: IItemContent, itemPosition: Point) {\n const { type = 'text', symbolStyle, richTextStyle, imageStyle, renderCustomCallback } = itemContent;\n let item: ISymbol | Tag | IImage | IRichText | IGroup;\n if (type === 'symbol') {\n item = graphicCreator.symbol({\n ...itemPosition,\n ...symbolStyle\n });\n } else if (type === 'text') {\n item = new Tag({\n ...itemPosition\n });\n } else if (type === 'richText') {\n item = graphicCreator.richtext({\n ...itemPosition,\n ...richTextStyle\n });\n } else if (type === 'image') {\n item = graphicCreator.image({\n ...itemPosition,\n ...imageStyle\n });\n } else if (type === 'custom' && renderCustomCallback) {\n item = renderCustomCallback();\n }\n this.setItemAttributes(item, itemContent, itemPosition, type);\n return item;\n }\n\n protected getItemLineAttr(itemLine: IItemLine, position: Point, itemPosition: Point) {\n let points: Point[] = [];\n const { type = 'type-s' } = itemLine;\n if (type === 'type-do') {\n points = [\n position,\n {\n x: (position.x + itemPosition.x) / 2,\n y: itemPosition.y\n },\n itemPosition\n ];\n } else if (type === 'type-po') {\n points = [\n position,\n {\n x: itemPosition.x,\n y: position.y\n },\n itemPosition\n ];\n } else if (type === 'type-op') {\n points = [\n position,\n {\n x: position.x,\n y: itemPosition.y\n },\n itemPosition\n ];\n } else {\n points = [position, itemPosition];\n }\n return points;\n }\n\n protected setItemLineAttr(itemLine: IItemLine, position: Point, itemPosition: Point, visible: boolean) {\n if (this._line) {\n const { startSymbol, endSymbol, lineStyle } = itemLine;\n const points = this.getItemLineAttr(itemLine, position, itemPosition);\n this._line.setAttributes({\n points,\n startSymbol,\n endSymbol,\n lineStyle,\n visible\n });\n }\n }\n\n protected getDecorativeLineAttr(itemLine: IItemLine, itemPosition: Point) {\n const decorativeLength = itemLine?.decorativeLine?.length || 10;\n const itemAngle = this._line.getEndAngle() || 0;\n const startPointOffsetX = (decorativeLength / 2) * Math.cos(itemAngle - Math.PI / 2);\n const startPointOffsetY = (decorativeLength / 2) * Math.sin(itemAngle - Math.PI / 2);\n const endPointOffsetX = (-decorativeLength / 2) * Math.cos(itemAngle - Math.PI / 2);\n const endPointOffsetY = (-decorativeLength / 2) * Math.sin(itemAngle - Math.PI / 2);\n return {\n startPointOffsetX,\n startPointOffsetY,\n endPointOffsetX,\n endPointOffsetY\n };\n }\n\n protected setDecorativeLineAttr(itemLine: IItemLine, itemPosition: Point, visible: boolean) {\n if (this._decorativeLine) {\n const { lineStyle } = itemLine;\n const { startPointOffsetX, startPointOffsetY, endPointOffsetX, endPointOffsetY } = this.getDecorativeLineAttr(\n itemLine,\n itemPosition\n );\n this._decorativeLine.setAttributes({\n points: [\n {\n x: itemPosition.x + startPointOffsetX,\n y: itemPosition.y + startPointOffsetY\n },\n {\n x: itemPosition.x + endPointOffsetX,\n y: itemPosition.y + endPointOffsetY\n }\n ] as IPointLike[],\n ...(lineStyle as Partial<ILineGraphicAttribute>),\n visible\n });\n }\n }\n\n protected setAllOfItemsAttr(itemPosition: Point) {\n const { position, itemLine = {}, itemContent = {}, limitRect } = this.attribute as MarkPointAttrs;\n const { type = 'text', confine } = itemContent;\n if (limitRect && confine) {\n const { x, y, width, height } = limitRect;\n const { dx, dy } = computeOffsetForlimit(this._item, {\n x1: x,\n y1: y,\n x2: x + width,\n y2: y + height\n });\n itemPosition.x = itemPosition.x + dx;\n itemPosition.y = itemPosition.y + dy;\n }\n this.setItemAttributes(this._item, itemContent, itemPosition, type);\n this.setItemLineAttr(itemLine, position, itemPosition, itemLine.visible);\n this.setDecorativeLineAttr(itemLine, itemPosition, itemLine.decorativeLine?.visible);\n }\n\n protected initMarker(container: IGroup) {\n const { position, itemContent = {} } = this.attribute as MarkPointAttrs;\n const itemPosition = {\n x: position.x + (itemContent.offsetX || 0),\n y: position.y + (itemContent.offsetY || 0)\n };\n\n const line = new Segment({\n points: [],\n pickable: false // 组件容器本身不参与拾取\n });\n line.name = 'mark-point-line';\n this._line = line;\n container.add(line as unknown as INode);\n\n const decorativeLine = graphicCreator.line({\n points: []\n });\n decorativeLine.name = 'mark-point-decorativeLine';\n this._decorativeLine = decorativeLine;\n container.add(decorativeLine as unknown as INode);\n\n // 为了强制将itemContent限制在limitRect内, 所以需要先绘制item, 然后根据item bounds 动态调整位置\n const item = this.initItem(itemContent as any, itemPosition);\n this._item = item;\n\n // 由于itemLine的指向也要变化, 所以需要对所有的内容进行渲染\n this.setAllOfItemsAttr(itemPosition);\n container.add(item as unknown as INode);\n }\n\n protected updateMarker() {\n const { position, itemContent = {} } = this.attribute as MarkPointAttrs;\n const { type = 'text' } = itemContent;\n\n const itemPosition = {\n x: position.x + (itemContent.offsetX || 0),\n y: position.y + (itemContent.offsetY || 0)\n };\n\n // 为了强制将itemContent限制在limitRect内, 所以需要先绘制item, 然后根据item bounds 动态调整位置\n this.setItemAttributes(this._item, itemContent, itemPosition, type);\n // 由于itemLine的指向也要变化, 所以需要对所有的内容进行渲染\n this.setAllOfItemsAttr(itemPosition);\n }\n\n protected isValidPoints() {\n const { position } = this.attribute as MarkPointAttrs;\n if (isValidNumber(position.x) && isValidNumber(position.y)) {\n return true;\n }\n return false;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/marker/point.ts"],"names":[],"mappings":";;;AAYA,yDAAwD;AAGxD,6CAAwD;AACxD,wCAAqC;AAGrC,gCAA6B;AAC7B,iCAAgC;AAChC,qCAAuF;AAGvF,iCAAgD;AAGhD,yCAAoD;AACpD,qDAA4D;AAC5D,0CAA6C;AAC7C,+CAAkH;AAElH,IAAA,iCAAsB,GAAE,CAAC;AAEzB,SAAgB,wBAAwB;IACtC,SAAS,CAAC,QAAQ,GAAG,0BAAgB,CAAC;AACxC,CAAC;AAFD,4DAEC;AAED,MAAa,SAAU,SAAQ,aAA8C;IAOjE,aAAa,CAAC,KAA2B;QACjD,IAAI,SAAS,CAAC,QAAQ,EAAE;YACtB,SAAS,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;SAClG;IACH,CAAC;IAQD,YAAY,UAA0B,EAAE,OAA0B;QAChE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,SAAS,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAnBhG,SAAI,GAAG,WAAW,CAAC;QAInB,2BAAsB,GAAG,yCAA+B,CAAC;QACzD,yBAAoB,GAAG,oCAA0B,CAAC;IAelD,CAAC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kB,EAAE,YAAY,CAAC,CAAC;QAC7D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAGlB,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;QACrC,SAAS,CAAC,GAAG,CAAC,IAAwB,CAAC,CAAC;IAC1C,CAAC;IAES,YAAY;QACpB,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,SAA2B,CAAC;QACxE,MAAM,EAAE,IAAI,GAAG,MAAM,EAAE,GAAG,WAAW,CAAC;QAEtC,MAAM,YAAY,GAAG;YACnB,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,OAAO,IAAI,CAAC,CAAC;YAC1C,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,OAAO,IAAI,CAAC,CAAC;SAC3C,CAAC;QAGF,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;QAEpE,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC;IAES,aAAa;QACrB,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,SAA2B,CAAC;QACtD,IAAI,IAAA,sBAAa,EAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAA,sBAAa,EAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;YAC1D,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;;AAtTH,8BAuTC;AArTQ,2BAAiB,GAAG,iCAAwB,CAAC","file":"point.js","sourcesContent":["import type {\n IGroup,\n IImage,\n INode,\n ISymbol,\n IImageGraphicAttribute,\n IRichText,\n IRichTextGraphicAttribute,\n ILine,\n ILineGraphicAttribute\n} from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport type { IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isValidNumber, merge } from '@visactor/vutils';\nimport { Segment } from '../segment';\nimport type { TagAttributes } from '../tag';\n// eslint-disable-next-line no-duplicate-imports\nimport { Tag } from '../tag';\nimport { Marker } from './base';\nimport { DEFAULT_MARK_POINT_TEXT_STYLE_MAP, DEFAULT_MARK_POINT_THEME } from './config';\nimport type { IItemContent, IItemLine, MarkPointAnimationType, MarkPointAttrs, MarkerAnimationState } from './type';\n// eslint-disable-next-line no-duplicate-imports\nimport { IMarkPointItemPosition } from './type';\nimport type { Point } from '../core/type';\nimport type { ComponentOptions } from '../interface';\nimport { loadMarkPointComponent } from './register';\nimport { computeOffsetForlimit } from '../util/limit-shape';\nimport { DEFAULT_STATES } from '../constant';\nimport { DefaultExitMarkerAnimation, DefaultUpdateMarkPointAnimation, markPointAnimate } from './animate/animate';\n\nloadMarkPointComponent();\n\nexport function registerMarkPointAnimate() {\n MarkPoint._animate = markPointAnimate;\n}\n\nexport class MarkPoint extends Marker<MarkPointAttrs, MarkPointAnimationType> {\n name = 'markPoint';\n static defaultAttributes = DEFAULT_MARK_POINT_THEME;\n\n /** animate */\n defaultUpdateAnimation = DefaultUpdateMarkPointAnimation;\n defaultExitAnimation = DefaultExitMarkerAnimation;\n protected markerAnimate(state: MarkerAnimationState): void {\n if (MarkPoint._animate) {\n MarkPoint._animate([this._line, this._decorativeLine], this._item, this._animationConfig, state);\n }\n }\n\n private _item!: ISymbol | Tag | IImage | IRichText;\n\n private _line?: Segment;\n\n private _decorativeLine!: ILine;\n\n constructor(attributes: MarkPointAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, MarkPoint.defaultAttributes, attributes));\n }\n\n protected setLabelPos() {\n //do nothing\n }\n\n protected setItemAttributes(\n item: ISymbol | Tag | IImage | IRichText,\n itemContent: IItemContent,\n itemPosition: Point,\n itemType: 'symbol' | 'text' | 'image' | 'richText' | 'custom'\n ) {\n if (!item) {\n return;\n }\n const {\n autoRotate = true,\n refX = 0,\n refY = 0,\n refAngle = 0,\n textStyle = {},\n richTextStyle = {},\n imageStyle = {},\n position = IMarkPointItemPosition.middle\n } = itemContent;\n const itemAngle = this._line?.getEndAngle() || 0;\n const itemOffsetX = refX * Math.cos(itemAngle) + refY * Math.cos(itemAngle - Math.PI / 2);\n const itemOffsetY = refX * Math.sin(itemAngle) + refY * Math.sin(itemAngle - Math.PI / 2);\n if (itemType === 'text') {\n item.setAttributes({\n ...(textStyle as TagAttributes),\n textStyle: {\n ...DEFAULT_MARK_POINT_TEXT_STYLE_MAP[itemContent?.position || 'end'],\n ...textStyle.textStyle\n }\n } as any);\n } else if (itemType === 'richText') {\n item.setAttributes({\n dx: this.getItemDx(item, position, richTextStyle) + (richTextStyle.dx || 0),\n dy: this.getItemDy(item, position, richTextStyle) + (richTextStyle.dy || 0)\n });\n } else if (itemType === 'image') {\n item.setAttributes({\n dx: this.getItemDx(item, position, imageStyle) + (imageStyle.dx || 0),\n dy: this.getItemDy(item, position, imageStyle) + (imageStyle.dy || 0)\n });\n }\n item.setAttributes({\n x: itemPosition.x + (itemOffsetX || 0),\n y: itemPosition.y + (itemOffsetY || 0),\n angle: autoRotate && itemAngle + refAngle\n });\n }\n\n protected getItemDx(\n item: ISymbol | Tag | IImage | IRichText,\n position: keyof typeof IMarkPointItemPosition,\n style?: IImageGraphicAttribute | IRichTextGraphicAttribute\n ) {\n const width = (item as IGroup)?.AABBBounds?.width() ?? (style?.width || 0);\n if (position.includes('inside')) {\n return -width;\n }\n if (position === 'insideTop') {\n return 0;\n }\n return 0;\n }\n\n protected getItemDy(\n item: ISymbol | Tag | IImage | IRichText,\n position: keyof typeof IMarkPointItemPosition,\n style?: IImageGraphicAttribute | IRichTextGraphicAttribute\n ) {\n const height = (item as IGroup)?.AABBBounds?.height() ?? (style?.height || 0);\n if (position.includes('top') || position.includes('Top')) {\n return -height;\n }\n if (position.includes('middle') || position.includes('Middle')) {\n return -height / 2;\n }\n return 0;\n }\n\n protected initItem(itemContent: IItemContent, itemPosition: Point) {\n const { state } = this.attribute as MarkPointAttrs;\n const { type = 'text', symbolStyle, richTextStyle, imageStyle, renderCustomCallback } = itemContent;\n let item: ISymbol | Tag | IImage | IRichText | IGroup;\n if (type === 'symbol') {\n item = graphicCreator.symbol({\n ...itemPosition,\n ...symbolStyle\n });\n item.states = merge({}, DEFAULT_STATES, state?.symbol);\n } else if (type === 'text') {\n item = new Tag({\n ...itemPosition,\n state: {\n panel: merge({}, DEFAULT_STATES, state?.textBackground),\n text: merge({}, DEFAULT_STATES, state?.text)\n }\n });\n } else if (type === 'richText') {\n item = graphicCreator.richtext({\n ...itemPosition,\n ...richTextStyle\n });\n item.states = merge({}, DEFAULT_STATES, state?.richText);\n } else if (type === 'image') {\n item = graphicCreator.image({\n ...itemPosition,\n ...imageStyle\n });\n item.states = merge({}, DEFAULT_STATES, state?.image);\n } else if (type === 'custom' && renderCustomCallback) {\n item = renderCustomCallback();\n item.states = merge({}, DEFAULT_STATES, state?.customMark);\n }\n item.name = `mark-point-${type}`;\n this.setItemAttributes(item, itemContent, itemPosition, type);\n return item;\n }\n\n protected getItemLineAttr(itemLine: IItemLine, position: Point, itemPosition: Point) {\n let points: Point[] = [];\n const { type = 'type-s' } = itemLine;\n if (type === 'type-do') {\n points = [\n position,\n {\n x: (position.x + itemPosition.x) / 2,\n y: itemPosition.y\n },\n itemPosition\n ];\n } else if (type === 'type-po') {\n points = [\n position,\n {\n x: itemPosition.x,\n y: position.y\n },\n itemPosition\n ];\n } else if (type === 'type-op') {\n points = [\n position,\n {\n x: position.x,\n y: itemPosition.y\n },\n itemPosition\n ];\n } else {\n points = [position, itemPosition];\n }\n return points;\n }\n\n protected setItemLineAttr(itemLine: IItemLine, position: Point, itemPosition: Point, visible: boolean) {\n if (this._line) {\n const { startSymbol, endSymbol, lineStyle } = itemLine;\n const points = this.getItemLineAttr(itemLine, position, itemPosition);\n this._line.setAttributes({\n points,\n startSymbol,\n endSymbol,\n lineStyle,\n visible\n });\n }\n }\n\n protected getDecorativeLineAttr(itemLine: IItemLine, itemPosition: Point) {\n const decorativeLength = itemLine?.decorativeLine?.length || 10;\n const itemAngle = this._line.getEndAngle() || 0;\n const startPointOffsetX = (decorativeLength / 2) * Math.cos(itemAngle - Math.PI / 2);\n const startPointOffsetY = (decorativeLength / 2) * Math.sin(itemAngle - Math.PI / 2);\n const endPointOffsetX = (-decorativeLength / 2) * Math.cos(itemAngle - Math.PI / 2);\n const endPointOffsetY = (-decorativeLength / 2) * Math.sin(itemAngle - Math.PI / 2);\n return {\n startPointOffsetX,\n startPointOffsetY,\n endPointOffsetX,\n endPointOffsetY\n };\n }\n\n protected setDecorativeLineAttr(itemLine: IItemLine, itemPosition: Point, visible: boolean) {\n if (this._decorativeLine) {\n const { lineStyle } = itemLine;\n const { startPointOffsetX, startPointOffsetY, endPointOffsetX, endPointOffsetY } = this.getDecorativeLineAttr(\n itemLine,\n itemPosition\n );\n this._decorativeLine.setAttributes({\n points: [\n {\n x: itemPosition.x + startPointOffsetX,\n y: itemPosition.y + startPointOffsetY\n },\n {\n x: itemPosition.x + endPointOffsetX,\n y: itemPosition.y + endPointOffsetY\n }\n ] as IPointLike[],\n ...(lineStyle as Partial<ILineGraphicAttribute>),\n visible\n });\n }\n }\n\n protected setAllOfItemsAttr(itemPosition: Point) {\n const { position, itemLine = {}, itemContent = {}, limitRect } = this.attribute as MarkPointAttrs;\n const { type = 'text', confine } = itemContent;\n if (limitRect && confine) {\n const { x, y, width, height } = limitRect;\n const { dx, dy } = computeOffsetForlimit(this._item, {\n x1: x,\n y1: y,\n x2: x + width,\n y2: y + height\n });\n itemPosition.x = itemPosition.x + dx;\n itemPosition.y = itemPosition.y + dy;\n }\n this.setItemAttributes(this._item, itemContent, itemPosition, type);\n this.setItemLineAttr(itemLine, position, itemPosition, itemLine.visible);\n this.setDecorativeLineAttr(itemLine, itemPosition, itemLine.decorativeLine?.visible);\n }\n\n protected initMarker(container: IGroup) {\n const { position, itemContent = {}, state } = this.attribute as MarkPointAttrs;\n const itemPosition = {\n x: position.x + (itemContent.offsetX || 0),\n y: position.y + (itemContent.offsetY || 0)\n };\n\n const line = new Segment({\n points: [],\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 line.name = 'mark-point-line';\n this._line = line;\n container.add(line as unknown as INode);\n\n const decorativeLine = graphicCreator.line({\n points: []\n });\n decorativeLine.states = merge({}, DEFAULT_STATES, state?.line);\n decorativeLine.name = 'mark-point-decorativeLine';\n this._decorativeLine = decorativeLine;\n container.add(decorativeLine as unknown as INode);\n\n // 为了强制将itemContent限制在limitRect内, 所以需要先绘制item, 然后根据item bounds 动态调整位置\n const item = this.initItem(itemContent as any, itemPosition);\n this._item = item;\n\n // 由于itemLine的指向也要变化, 所以需要对所有的内容进行渲染\n this.setAllOfItemsAttr(itemPosition);\n container.add(item as unknown as INode);\n }\n\n protected updateMarker() {\n const { position, itemContent = {} } = this.attribute as MarkPointAttrs;\n const { type = 'text' } = itemContent;\n\n const itemPosition = {\n x: position.x + (itemContent.offsetX || 0),\n y: position.y + (itemContent.offsetY || 0)\n };\n\n // 为了强制将itemContent限制在limitRect内, 所以需要先绘制item, 然后根据item bounds 动态调整位置\n this.setItemAttributes(this._item, itemContent, itemPosition, type);\n // 由于itemLine的指向也要变化, 所以需要对所有的内容进行渲染\n this.setAllOfItemsAttr(itemPosition);\n }\n\n protected isValidPoints() {\n const { position } = this.attribute as MarkPointAttrs;\n if (isValidNumber(position.x) && isValidNumber(position.y)) {\n return true;\n }\n return false;\n }\n}\n"]}
|
package/cjs/marker/register.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare function loadMarkLineComponent(): void;
|
|
2
|
+
export declare function loadMarkArcLineComponent(): void;
|
|
2
3
|
export declare function loadMarkAreaComponent(): void;
|
|
4
|
+
export declare function loadMarkArcAreaComponent(): void;
|
|
3
5
|
export declare function loadMarkPointComponent(): void;
|
package/cjs/marker/register.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.loadMarkPointComponent = exports.loadMarkAreaComponent = exports.loadMarkLineComponent = void 0;
|
|
5
|
+
}), exports.loadMarkPointComponent = exports.loadMarkArcAreaComponent = exports.loadMarkAreaComponent = exports.loadMarkArcLineComponent = exports.loadMarkLineComponent = void 0;
|
|
6
6
|
|
|
7
7
|
const vrender_kits_1 = require("@visactor/vrender-kits"), register_1 = require("../tag/register"), register_2 = require("../segment/register");
|
|
8
8
|
|
|
@@ -14,15 +14,24 @@ function loadMarkLineComponent() {
|
|
|
14
14
|
loadBaseMarker(), (0, register_2.loadSegmentComponent)();
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
function loadMarkArcLineComponent() {
|
|
18
|
+
loadBaseMarker(), (0, register_2.loadArcSegmentComponent)();
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
function loadMarkAreaComponent() {
|
|
18
22
|
loadBaseMarker(), (0, vrender_kits_1.registerPolygon)();
|
|
19
23
|
}
|
|
20
24
|
|
|
25
|
+
function loadMarkArcAreaComponent() {
|
|
26
|
+
loadBaseMarker(), (0, vrender_kits_1.registerArc)();
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
function loadMarkPointComponent() {
|
|
22
30
|
loadBaseMarker(), (0, register_2.loadSegmentComponent)(), (0, vrender_kits_1.registerSymbol)(),
|
|
23
31
|
(0, vrender_kits_1.registerImage)(), (0, vrender_kits_1.registerLine)();
|
|
24
32
|
}
|
|
25
33
|
|
|
26
|
-
exports.loadMarkLineComponent = loadMarkLineComponent, exports.
|
|
34
|
+
exports.loadMarkLineComponent = loadMarkLineComponent, exports.loadMarkArcLineComponent = loadMarkArcLineComponent,
|
|
35
|
+
exports.loadMarkAreaComponent = loadMarkAreaComponent, exports.loadMarkArcAreaComponent = loadMarkArcAreaComponent,
|
|
27
36
|
exports.loadMarkPointComponent = loadMarkPointComponent;
|
|
28
37
|
//# sourceMappingURL=register.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/register.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"sources":["../src/marker/register.ts"],"names":[],"mappings":";;;AAAA,yDAOgC;AAChC,8CAAmD;AACnD,kDAAoF;AAOpF,SAAS,cAAc;IACrB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAgB,GAAE,CAAC;AACrB,CAAC;AAED,SAAgB,qBAAqB;IACnC,cAAc,EAAE,CAAC;IACjB,IAAA,+BAAoB,GAAE,CAAC;AACzB,CAAC;AAHD,sDAGC;AAED,SAAgB,wBAAwB;IACtC,cAAc,EAAE,CAAC;IACjB,IAAA,kCAAuB,GAAE,CAAC;AAC5B,CAAC;AAHD,4DAGC;AAED,SAAgB,qBAAqB;IACnC,cAAc,EAAE,CAAC;IACjB,IAAA,8BAAe,GAAE,CAAC;AACpB,CAAC;AAHD,sDAGC;AAED,SAAgB,wBAAwB;IACtC,cAAc,EAAE,CAAC;IACjB,IAAA,0BAAW,GAAE,CAAC;AAChB,CAAC;AAHD,4DAGC;AAED,SAAgB,sBAAsB;IACpC,cAAc,EAAE,CAAC;IACjB,IAAA,+BAAoB,GAAE,CAAC;IACvB,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;AACjB,CAAC;AAND,wDAMC","file":"register.js","sourcesContent":["import {\n registerArc,\n registerGroup,\n registerImage,\n registerLine,\n registerPolygon,\n registerSymbol\n} from '@visactor/vrender-kits';\nimport { loadTagComponent } from '../tag/register';\nimport { loadArcSegmentComponent, loadSegmentComponent } from '../segment/register';\nimport { MarkLine } from './line';\nimport { MarkArcLine } from './arc-line';\nimport { markArcAreaAnimate, markAreaAnimate, commonMarkLineAnimate, markPointAnimate } from './animate/animate';\nimport { MarkArea } from './area';\nimport { MarkArcArea } from './arc-area';\nimport { MarkPoint } from './point';\nfunction loadBaseMarker() {\n registerGroup();\n loadTagComponent();\n}\n\nexport function loadMarkLineComponent() {\n loadBaseMarker();\n loadSegmentComponent();\n}\n\nexport function loadMarkArcLineComponent() {\n loadBaseMarker();\n loadArcSegmentComponent();\n}\n\nexport function loadMarkAreaComponent() {\n loadBaseMarker();\n registerPolygon();\n}\n\nexport function loadMarkArcAreaComponent() {\n loadBaseMarker();\n registerArc();\n}\n\nexport function loadMarkPointComponent() {\n loadBaseMarker();\n loadSegmentComponent();\n registerSymbol();\n registerImage();\n registerLine();\n}\n"]}
|
package/cjs/marker/type.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { IGroup, IGroupGraphicAttribute, IImageGraphicAttribute, IPolygonAttribute, IRichTextGraphicAttribute, ISymbolGraphicAttribute } from '@visactor/vrender-core';
|
|
2
|
-
import type { SegmentAttributes, SymbolAttributes } from '../segment';
|
|
1
|
+
import type { EasingType, IArcGraphicAttribute, IGroup, IGroupGraphicAttribute, IImageGraphicAttribute, ILineGraphicAttribute, IPolygonAttribute, IPolygonGraphicAttribute, IRectGraphicAttribute, IRichTextGraphicAttribute, ISymbolGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender-core';
|
|
2
|
+
import type { CommonSegmentAttributes, ILineGraphicWithCornerRadius, SegmentAttributes, SymbolAttributes } from '../segment';
|
|
3
3
|
import type { TagAttributes } from '../tag';
|
|
4
|
-
import type { Point } from '../core/type';
|
|
4
|
+
import type { Point, State } from '../core/type';
|
|
5
5
|
export declare enum IMarkLineLabelPosition {
|
|
6
6
|
start = "start",
|
|
7
7
|
middle = "middle",
|
|
@@ -24,6 +24,15 @@ export declare enum IMarkAreaLabelPosition {
|
|
|
24
24
|
insideTop = "insideTop",
|
|
25
25
|
insideBottom = "insideBottom"
|
|
26
26
|
}
|
|
27
|
+
export declare enum IMarkCommonArcLabelPosition {
|
|
28
|
+
arcInnerStart = "arcInnerStart",
|
|
29
|
+
arcInnerEnd = "arcInnerEnd",
|
|
30
|
+
arcInnerMiddle = "arcInnerMiddle",
|
|
31
|
+
arcOuterStart = "arcOuterStart",
|
|
32
|
+
arcOuterEnd = "arcOuterEnd",
|
|
33
|
+
arcOuterMiddle = "arcOuterMiddle",
|
|
34
|
+
center = "center"
|
|
35
|
+
}
|
|
27
36
|
export declare enum IMarkPointItemPosition {
|
|
28
37
|
top = "top",
|
|
29
38
|
bottom = "bottom",
|
|
@@ -46,9 +55,11 @@ export type IMarkRef = {
|
|
|
46
55
|
refY?: number;
|
|
47
56
|
refAngle?: number;
|
|
48
57
|
};
|
|
49
|
-
export type MarkerAttrs = IGroupGraphicAttribute & {
|
|
50
|
-
type?: 'line' | 'area' | 'point';
|
|
58
|
+
export type MarkerAttrs<AnimationType> = IGroupGraphicAttribute & {
|
|
59
|
+
type?: 'line' | 'arc-line' | 'area' | 'arc-area' | 'point';
|
|
51
60
|
interactive?: boolean;
|
|
61
|
+
select?: boolean;
|
|
62
|
+
hover?: boolean;
|
|
52
63
|
visible?: boolean;
|
|
53
64
|
clipInRange?: boolean;
|
|
54
65
|
limitRect?: {
|
|
@@ -57,16 +68,76 @@ export type MarkerAttrs = IGroupGraphicAttribute & {
|
|
|
57
68
|
width: number;
|
|
58
69
|
height: number;
|
|
59
70
|
};
|
|
71
|
+
} & BaseMarkerAnimation<AnimationType>;
|
|
72
|
+
export type BaseMarkerAnimation<T> = {
|
|
73
|
+
animation?: MarkerAnimation<T> | boolean;
|
|
74
|
+
animationEnter?: MarkerUpdateAnimation<T>;
|
|
75
|
+
animationUpdate?: MarkerUpdateAnimation<T>;
|
|
76
|
+
animationExit?: MarkerExitAnimation;
|
|
60
77
|
};
|
|
61
|
-
export type
|
|
62
|
-
|
|
63
|
-
|
|
78
|
+
export type MarkerAnimation<T> = MarkerUpdateAnimation<T> | MarkerUpdateAnimation<T>;
|
|
79
|
+
export type MarkerUpdateAnimation<T> = {
|
|
80
|
+
type: T;
|
|
81
|
+
} & MarkerExitAnimation;
|
|
82
|
+
export type CommonMarkLineAnimationType = 'clipIn' | 'fadeIn';
|
|
83
|
+
export type CommonMarkAreaAnimationType = 'fadeIn';
|
|
84
|
+
export type MarkPointAnimationType = 'callIn' | 'fadeIn';
|
|
85
|
+
export type MarkerExitAnimation = {
|
|
86
|
+
type: 'fadeOut';
|
|
87
|
+
duration?: number;
|
|
88
|
+
delay?: number;
|
|
89
|
+
easing?: EasingType;
|
|
90
|
+
};
|
|
91
|
+
export type MarkerAnimationState = 'enter' | 'update' | 'exit';
|
|
92
|
+
export type CommonMarkLineState<LineAttr> = {
|
|
93
|
+
line?: State<LineAttr>;
|
|
94
|
+
lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;
|
|
95
|
+
lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;
|
|
96
|
+
label?: State<Partial<ITextGraphicAttribute>>;
|
|
97
|
+
labelBackground?: State<Partial<IRectGraphicAttribute>>;
|
|
98
|
+
};
|
|
99
|
+
export type CommonMarkAreaState<AreaAttr> = {
|
|
100
|
+
area?: State<Partial<AreaAttr>>;
|
|
101
|
+
label?: State<Partial<ITextGraphicAttribute>>;
|
|
102
|
+
labelBackground?: State<Partial<IRectGraphicAttribute>>;
|
|
103
|
+
};
|
|
104
|
+
export type MarkPointState = {
|
|
105
|
+
line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[]>;
|
|
106
|
+
lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;
|
|
107
|
+
lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;
|
|
108
|
+
symbol?: State<Partial<ISymbolGraphicAttribute>>;
|
|
109
|
+
image?: State<Partial<IImageGraphicAttribute>>;
|
|
110
|
+
text?: State<Partial<ITextGraphicAttribute>>;
|
|
111
|
+
textBackground?: State<Partial<IRectGraphicAttribute>>;
|
|
112
|
+
richText?: State<Partial<IRichTextGraphicAttribute>>;
|
|
113
|
+
customMark?: State<Partial<IGroupGraphicAttribute>>;
|
|
114
|
+
};
|
|
115
|
+
export type CommonMarkLineAttrs<LineAttr, LineLabelPosition, CommonMarkLineAnimationType> = MarkerAttrs<CommonMarkLineAnimationType> & Omit<CommonSegmentAttributes, 'state' | 'lineStyle'> & {
|
|
64
116
|
label?: {
|
|
65
|
-
position?:
|
|
117
|
+
position?: LineLabelPosition;
|
|
66
118
|
confine?: boolean;
|
|
67
119
|
} & IMarkRef & IMarkLabel;
|
|
120
|
+
state?: CommonMarkLineState<LineAttr>;
|
|
121
|
+
};
|
|
122
|
+
export type MarkLineAttrs = CommonMarkLineAttrs<ILineGraphicWithCornerRadius | ILineGraphicAttribute[], keyof typeof IMarkLineLabelPosition, CommonMarkLineAnimationType> & {
|
|
123
|
+
type?: 'line';
|
|
124
|
+
multiSegment?: boolean;
|
|
125
|
+
mainSegmentIndex?: number;
|
|
126
|
+
points: Point[] | Point[][];
|
|
127
|
+
lineStyle?: ILineGraphicAttribute;
|
|
128
|
+
};
|
|
129
|
+
export type MarkArcLineAttrs = CommonMarkLineAttrs<IArcGraphicAttribute, keyof typeof IMarkCommonArcLabelPosition, CommonMarkLineAnimationType> & {
|
|
130
|
+
type?: 'arc-line';
|
|
131
|
+
center: {
|
|
132
|
+
x: number;
|
|
133
|
+
y: number;
|
|
134
|
+
};
|
|
135
|
+
radius: number;
|
|
136
|
+
startAngle: number;
|
|
137
|
+
endAngle: number;
|
|
138
|
+
lineStyle?: IArcGraphicAttribute;
|
|
68
139
|
};
|
|
69
|
-
export type MarkAreaAttrs = MarkerAttrs & {
|
|
140
|
+
export type MarkAreaAttrs = MarkerAttrs<CommonMarkAreaAnimationType> & {
|
|
70
141
|
type?: 'area';
|
|
71
142
|
points: Point[];
|
|
72
143
|
label?: {
|
|
@@ -74,6 +145,24 @@ export type MarkAreaAttrs = MarkerAttrs & {
|
|
|
74
145
|
confine?: boolean;
|
|
75
146
|
} & IMarkLabel;
|
|
76
147
|
areaStyle?: IPolygonAttribute;
|
|
148
|
+
state?: CommonMarkAreaState<IPolygonGraphicAttribute>;
|
|
149
|
+
};
|
|
150
|
+
export type MarkArcAreaAttrs = MarkerAttrs<CommonMarkAreaAnimationType> & {
|
|
151
|
+
type?: 'arc-area';
|
|
152
|
+
center: {
|
|
153
|
+
x: number;
|
|
154
|
+
y: number;
|
|
155
|
+
};
|
|
156
|
+
innerRadius: number;
|
|
157
|
+
outerRadius: number;
|
|
158
|
+
startAngle: number;
|
|
159
|
+
endAngle: number;
|
|
160
|
+
label?: {
|
|
161
|
+
position?: keyof typeof IMarkCommonArcLabelPosition;
|
|
162
|
+
confine?: boolean;
|
|
163
|
+
} & IMarkRef & IMarkLabel;
|
|
164
|
+
areaStyle?: IArcGraphicAttribute;
|
|
165
|
+
state?: CommonMarkAreaState<IArcGraphicAttribute>;
|
|
77
166
|
};
|
|
78
167
|
export type IItemContent = IMarkRef & {
|
|
79
168
|
type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';
|
|
@@ -95,8 +184,9 @@ export type IItemLine = {
|
|
|
95
184
|
length?: number;
|
|
96
185
|
};
|
|
97
186
|
} & Omit<SegmentAttributes, 'points'>;
|
|
98
|
-
export type MarkPointAttrs = Omit<MarkerAttrs
|
|
187
|
+
export type MarkPointAttrs = Omit<MarkerAttrs<MarkPointAnimationType>, 'labelStyle'> & {
|
|
99
188
|
position: Point;
|
|
100
189
|
itemLine?: IItemLine;
|
|
101
190
|
itemContent?: IItemContent;
|
|
102
|
-
|
|
191
|
+
state?: MarkPointState;
|
|
192
|
+
} & BaseMarkerAnimation<MarkPointAnimationType>;
|
package/cjs/marker/type.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var IMarkLineLabelPosition, IMarkAreaLabelPosition, IMarkPointItemPosition;
|
|
3
|
+
var IMarkLineLabelPosition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkPointItemPosition;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: !0
|
|
7
|
-
}), exports.IMarkPointItemPosition = exports.IMarkAreaLabelPosition = exports.IMarkLineLabelPosition = void 0,
|
|
7
|
+
}), exports.IMarkPointItemPosition = exports.IMarkCommonArcLabelPosition = exports.IMarkAreaLabelPosition = exports.IMarkLineLabelPosition = void 0,
|
|
8
8
|
function(IMarkLineLabelPosition) {
|
|
9
9
|
IMarkLineLabelPosition.start = "start", IMarkLineLabelPosition.middle = "middle",
|
|
10
10
|
IMarkLineLabelPosition.end = "end", IMarkLineLabelPosition.insideStartTop = "insideStartTop",
|
|
@@ -18,6 +18,12 @@ function(IMarkAreaLabelPosition) {
|
|
|
18
18
|
IMarkAreaLabelPosition.insideLeft = "insideLeft", IMarkAreaLabelPosition.insideRight = "insideRight",
|
|
19
19
|
IMarkAreaLabelPosition.insideTop = "insideTop", IMarkAreaLabelPosition.insideBottom = "insideBottom";
|
|
20
20
|
}(IMarkAreaLabelPosition = exports.IMarkAreaLabelPosition || (exports.IMarkAreaLabelPosition = {})),
|
|
21
|
+
function(IMarkCommonArcLabelPosition) {
|
|
22
|
+
IMarkCommonArcLabelPosition.arcInnerStart = "arcInnerStart", IMarkCommonArcLabelPosition.arcInnerEnd = "arcInnerEnd",
|
|
23
|
+
IMarkCommonArcLabelPosition.arcInnerMiddle = "arcInnerMiddle", IMarkCommonArcLabelPosition.arcOuterStart = "arcOuterStart",
|
|
24
|
+
IMarkCommonArcLabelPosition.arcOuterEnd = "arcOuterEnd", IMarkCommonArcLabelPosition.arcOuterMiddle = "arcOuterMiddle",
|
|
25
|
+
IMarkCommonArcLabelPosition.center = "center";
|
|
26
|
+
}(IMarkCommonArcLabelPosition = exports.IMarkCommonArcLabelPosition || (exports.IMarkCommonArcLabelPosition = {})),
|
|
21
27
|
function(IMarkPointItemPosition) {
|
|
22
28
|
IMarkPointItemPosition.top = "top", IMarkPointItemPosition.bottom = "bottom", IMarkPointItemPosition.middle = "middle",
|
|
23
29
|
IMarkPointItemPosition.insideTop = "insideTop", IMarkPointItemPosition.insideBottom = "insideBottom",
|
package/cjs/marker/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/type.ts"],"names":[],"mappings":";;;AAYA,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,2CAAiB,CAAA;IACjB,qCAAW,CAAA;IACX,2DAAiC,CAAA;IACjC,iEAAuC,CAAA;IACvC,6DAAmC,CAAA;IACnC,mEAAyC,CAAA;IACzC,uDAA6B,CAAA;IAC7B,6DAAmC,CAAA;AACrC,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAC3B,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;AAC/B,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,uDAA6B,CAAA;AAC/B,CAAC,EAPW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAOjC","file":"type.js","sourcesContent":["import type {\n IGroup,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n IPolygonAttribute,\n IRichTextGraphicAttribute,\n ISymbolGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { SegmentAttributes, SymbolAttributes } from '../segment';\nimport type { TagAttributes } from '../tag';\nimport type { Point } from '../core/type';\n\nexport enum IMarkLineLabelPosition {\n start = 'start',\n middle = 'middle',\n end = 'end',\n insideStartTop = 'insideStartTop',\n insideStartBottom = 'insideStartBottom',\n insideMiddleTop = 'insideMiddleTop',\n insideMiddleBottom = 'insideMiddleBottom',\n insideEndTop = 'insideEndTop',\n insideEndBottom = 'insideEndBottom'\n}\n\nexport enum IMarkAreaLabelPosition {\n left = 'left',\n right = 'right',\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideLeft = 'insideLeft',\n insideRight = 'insideRight',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom'\n}\n\nexport enum IMarkPointItemPosition {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideMiddle = 'insideMiddle'\n}\n\nexport type IMarkBackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n /**\n * TODO: 根据文字宽度进行背景 panel size自适应\n */\n autoHeight?: boolean;\n /**\n * TODO: 根据文高度度进行背景 panel size自适应\n */\n autoWidth?: boolean;\n} & Partial<SymbolAttributes>;\n\nexport type IMarkLabel = Omit<TagAttributes, 'x' | 'y' | 'panel'> & {\n /**\n * 标签的背景面板配置\n */\n panel?: IMarkBackgroundAttributes;\n};\n\nexport type IMarkRef = {\n /**\n * 自动旋转,沿着线的方向,默认 true\n */\n autoRotate?: boolean;\n /**\n * label 相对line平行方向上的偏移\n */\n refX?: number;\n /**\n * label 相对line正交方向上的偏移\n */\n refY?: number;\n /**\n * label 相对默认角度的偏移 (label跟随line的角度做自动旋转时,默认按照line的平行向量作为初始角度)\n */\n refAngle?: number;\n};\n\nexport type MarkerAttrs = IGroupGraphicAttribute & {\n type?: 'line' | 'area' | 'point';\n /**\n * 是否支持交互\n * @default false\n */\n interactive?: boolean;\n /**\n * 是否显示marker组件\n * @default true\n */\n visible?: boolean;\n /**\n * 是否将组件在绘制区域内进行剪切\n * @default true\n */\n clipInRange?: boolean;\n /**\n * 组件绘制范围配置\n */\n limitRect?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n};\n\nexport type MarkLineAttrs = MarkerAttrs &\n SegmentAttributes & {\n type?: 'line';\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为曲线\n */\n points: Point[] | Point[][];\n\n /**\n * 标签\n */\n label?: {\n /**\n * label 相对line的位置\n */\n position?: keyof typeof IMarkLineLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n };\n\nexport type MarkAreaAttrs = MarkerAttrs & {\n type?: 'area';\n /**\n * 构成area的点\n */\n points: Point[];\n /**\n * 标签\n */\n label?: {\n position?: keyof typeof IMarkAreaLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IPolygonAttribute;\n};\n\nexport type IItemContent = IMarkRef & {\n /**\n * 标注类型\n * Tips: 保留'richText'与之前的定义做兼容\n */\n type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';\n position?: keyof typeof IMarkPointItemPosition;\n /**\n * x 方向偏移量\n */\n offsetX?: number;\n /**\n * y 方向偏移量\n */\n offsetY?: number;\n /**\n * type为symbol时, symbol的样式\n */\n symbolStyle?: ISymbolGraphicAttribute;\n /**\n * type为image时, image的样式\n */\n imageStyle?: IImageGraphicAttribute;\n /**\n * type为text时, text的配置\n * 'text'类型的ItemContent新增三种子类型:'text','rich','html'。配置在textStyle.type上,继承自TagAttributes。\n */\n textStyle?: IMarkLabel;\n /**\n * type为rich text时, rich text的样式\n */\n richTextStyle?: IRichTextGraphicAttribute;\n /**\n * type为custom时,允许以callback的方式传入需要render的item\n */\n renderCustomCallback?: () => IGroup;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n};\n\nexport type IItemLine = {\n /** TODO:'type-opo' */\n type?: 'type-s' | 'type-do' | 'type-po' | 'type-op';\n visible?: boolean;\n /**\n * 垂直于引导线的装饰线,参考案例: https://observablehq.com/@mikelotis/edmonton-population-history-line-chart\n */\n decorativeLine?: {\n visible?: boolean;\n length?: number;\n };\n} & Omit<SegmentAttributes, 'points'>;\n\nexport type MarkPointAttrs = Omit<MarkerAttrs, 'labelStyle'> & {\n /**\n * markPoint的位置(也是path的起点)\n */\n position: Point;\n /**\n * 标注引导线\n */\n itemLine?: IItemLine;\n\n /**\n * 标注内容\n */\n itemContent?: IItemContent;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/marker/type.ts"],"names":[],"mappings":";;;AAwBA,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,2CAAiB,CAAA;IACjB,qCAAW,CAAA;IACX,2DAAiC,CAAA;IACjC,iEAAuC,CAAA;IACvC,6DAAmC,CAAA;IACnC,mEAAyC,CAAA;IACzC,uDAA6B,CAAA;IAC7B,6DAAmC,CAAA;AACrC,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAC3B,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;AAC/B,CAAC,EAVW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAUjC;AAED,IAAY,2BAQX;AARD,WAAY,2BAA2B;IACrC,8DAA+B,CAAA;IAC/B,0DAA2B,CAAA;IAC3B,gEAAiC,CAAA;IACjC,8DAA+B,CAAA;IAC/B,0DAA2B,CAAA;IAC3B,gEAAiC,CAAA;IACjC,gDAAiB,CAAA;AACnB,CAAC,EARW,2BAA2B,GAA3B,mCAA2B,KAA3B,mCAA2B,QAQtC;AAED,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,qCAAW,CAAA;IACX,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;IAC7B,uDAA6B,CAAA;AAC/B,CAAC,EAPW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAOjC","file":"type.js","sourcesContent":["import type {\n EasingType,\n IArcGraphicAttribute,\n IGroup,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n ILineGraphicAttribute,\n IPolygonAttribute,\n IPolygonGraphicAttribute,\n IRectGraphicAttribute,\n IRichTextGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type {\n ArcSegmentAttributes,\n CommonSegmentAttributes,\n ILineGraphicWithCornerRadius,\n SegmentAttributes,\n SymbolAttributes\n} from '../segment';\nimport type { TagAttributes } from '../tag';\nimport type { Point, State } from '../core/type';\n\nexport enum IMarkLineLabelPosition {\n start = 'start',\n middle = 'middle',\n end = 'end',\n insideStartTop = 'insideStartTop',\n insideStartBottom = 'insideStartBottom',\n insideMiddleTop = 'insideMiddleTop',\n insideMiddleBottom = 'insideMiddleBottom',\n insideEndTop = 'insideEndTop',\n insideEndBottom = 'insideEndBottom'\n}\n\nexport enum IMarkAreaLabelPosition {\n left = 'left',\n right = 'right',\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideLeft = 'insideLeft',\n insideRight = 'insideRight',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom'\n}\n\nexport enum IMarkCommonArcLabelPosition {\n arcInnerStart = 'arcInnerStart',\n arcInnerEnd = 'arcInnerEnd',\n arcInnerMiddle = 'arcInnerMiddle',\n arcOuterStart = 'arcOuterStart',\n arcOuterEnd = 'arcOuterEnd',\n arcOuterMiddle = 'arcOuterMiddle',\n center = 'center'\n}\n\nexport enum IMarkPointItemPosition {\n top = 'top',\n bottom = 'bottom',\n middle = 'middle',\n insideTop = 'insideTop',\n insideBottom = 'insideBottom',\n insideMiddle = 'insideMiddle'\n}\n\nexport type IMarkBackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n /**\n * TODO: 根据文字宽度进行背景 panel size自适应\n */\n autoHeight?: boolean;\n /**\n * TODO: 根据文高度度进行背景 panel size自适应\n */\n autoWidth?: boolean;\n} & Partial<SymbolAttributes>;\n\nexport type IMarkLabel = Omit<TagAttributes, 'x' | 'y' | 'panel'> & {\n /**\n * 标签的背景面板配置\n */\n panel?: IMarkBackgroundAttributes;\n};\n\nexport type IMarkRef = {\n /**\n * 自动旋转,沿着线的方向,默认 true\n */\n autoRotate?: boolean;\n /**\n * label 相对line平行方向上的偏移\n */\n refX?: number;\n /**\n * label 相对line正交方向上的偏移\n */\n refY?: number;\n /**\n * label 相对默认角度的偏移 (label跟随line的角度做自动旋转时,默认按照line的平行向量作为初始角度)\n */\n refAngle?: number;\n};\n\nexport type MarkerAttrs<AnimationType> = IGroupGraphicAttribute & {\n type?: 'line' | 'arc-line' | 'area' | 'arc-area' | 'point';\n /**\n * 是否支持交互\n * @default true\n */\n interactive?: boolean;\n /**\n * 是否开启选中交互\n * @default false\n */\n select?: boolean;\n /**\n * 是否开启 hover 交互\n * @default false\n */\n hover?: boolean;\n /**\n * 是否显示marker组件\n * @default true\n */\n visible?: boolean;\n /**\n * 是否将组件在绘制区域内进行剪切\n * @default true\n */\n clipInRange?: boolean;\n /**\n * 组件绘制范围配置\n */\n limitRect?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n} & BaseMarkerAnimation<AnimationType>;\n\n/** animation type */\nexport type BaseMarkerAnimation<T> = {\n animation?: MarkerAnimation<T> | boolean;\n animationEnter?: MarkerUpdateAnimation<T>;\n animationUpdate?: MarkerUpdateAnimation<T>;\n animationExit?: MarkerExitAnimation;\n};\nexport type MarkerAnimation<T> = MarkerUpdateAnimation<T> | MarkerUpdateAnimation<T>;\n\nexport type MarkerUpdateAnimation<T> = {\n type: T;\n} & MarkerExitAnimation;\n\nexport type CommonMarkLineAnimationType = 'clipIn' | 'fadeIn';\n\nexport type CommonMarkAreaAnimationType = 'fadeIn';\n\nexport type MarkPointAnimationType = 'callIn' | 'fadeIn';\n\nexport type MarkerExitAnimation = {\n type: 'fadeOut';\n duration?: number;\n delay?: number;\n easing?: EasingType;\n};\n\nexport type MarkerAnimationState = 'enter' | 'update' | 'exit';\n\n/** state type */\nexport type CommonMarkLineState<LineAttr> = {\n line?: State<LineAttr>;\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n label?: State<Partial<ITextGraphicAttribute>>;\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type CommonMarkAreaState<AreaAttr> = {\n area?: State<Partial<AreaAttr>>;\n label?: State<Partial<ITextGraphicAttribute>>;\n labelBackground?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type MarkPointState = {\n line?: State<ILineGraphicWithCornerRadius | Partial<ILineGraphicAttribute>[]>;\n lineStartSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n lineEndSymbol?: State<Partial<ISymbolGraphicAttribute>>;\n symbol?: State<Partial<ISymbolGraphicAttribute>>;\n image?: State<Partial<IImageGraphicAttribute>>;\n text?: State<Partial<ITextGraphicAttribute>>;\n textBackground?: State<Partial<IRectGraphicAttribute>>;\n richText?: State<Partial<IRichTextGraphicAttribute>>;\n customMark?: State<Partial<IGroupGraphicAttribute>>;\n};\n\nexport type CommonMarkLineAttrs<LineAttr, LineLabelPosition, CommonMarkLineAnimationType> =\n MarkerAttrs<CommonMarkLineAnimationType> &\n Omit<CommonSegmentAttributes, 'state' | 'lineStyle'> & {\n /**\n * 标签\n */\n label?: {\n /**\n * label 相对line的位置\n */\n position?: LineLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n state?: CommonMarkLineState<LineAttr>;\n };\n\nexport type MarkLineAttrs = CommonMarkLineAttrs<\n ILineGraphicWithCornerRadius | ILineGraphicAttribute[],\n keyof typeof IMarkLineLabelPosition,\n CommonMarkLineAnimationType\n> & {\n type?: 'line';\n /**\n * 是否对 points 进行多段处理,默认为 false,即直接将所有的点连接成线。\n * 如果需要进行多段处理,需要将 points 属性配置为 Point[][] 类型\n * @default false\n */\n multiSegment?: boolean;\n /**\n * 在 `multiSegment` 属性开启的前提下,用于声明那一段线段用来作为主线段,如果不声明,默认全段为主线段\n */\n mainSegmentIndex?: number;\n /**\n * 构成line的点: 如果是两个点,则为直线;多个点则为曲线\n */\n points: Point[] | Point[][];\n lineStyle?: ILineGraphicAttribute;\n};\n\nexport type MarkArcLineAttrs = CommonMarkLineAttrs<\n IArcGraphicAttribute,\n keyof typeof IMarkCommonArcLabelPosition,\n CommonMarkLineAnimationType\n> & {\n type?: 'arc-line';\n /**\n * 弧线中心位置\n */\n center: {\n x: number;\n y: number;\n };\n /**\n * 弧线半径\n */\n radius: number;\n /**\n * 弧线起始角度(弧度)\n */\n startAngle: number;\n /**\n * 弧线终点角度(弧度)\n */\n endAngle: number;\n lineStyle?: IArcGraphicAttribute;\n};\n\nexport type MarkAreaAttrs = MarkerAttrs<CommonMarkAreaAnimationType> & {\n type?: 'area';\n /**\n * 构成area的点\n */\n points: Point[];\n /**\n * 标签\n */\n label?: {\n position?: keyof typeof IMarkAreaLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IPolygonAttribute;\n\n state?: CommonMarkAreaState<IPolygonGraphicAttribute>;\n};\n\nexport type MarkArcAreaAttrs = MarkerAttrs<CommonMarkAreaAnimationType> & {\n type?: 'arc-area';\n /**\n * 扇区中心位置\n */\n center: {\n x: number;\n y: number;\n };\n /**\n * 扇区内半径\n */\n innerRadius: number;\n /**\n * 扇区外半径\n */\n outerRadius: number;\n /**\n * 扇区起始角度(弧度)\n */\n startAngle: number;\n /**\n * 扇区终点角度(弧度)\n */\n endAngle: number;\n /**\n * 标签\n */\n label?: {\n position?: keyof typeof IMarkCommonArcLabelPosition;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n } & IMarkRef &\n IMarkLabel;\n /**\n * area的样式\n */\n areaStyle?: IArcGraphicAttribute;\n\n state?: CommonMarkAreaState<IArcGraphicAttribute>;\n};\n\nexport type IItemContent = IMarkRef & {\n /**\n * 标注类型\n * Tips: 保留'richText'与之前的定义做兼容\n */\n type?: 'symbol' | 'text' | 'image' | 'richText' | 'custom';\n position?: keyof typeof IMarkPointItemPosition;\n /**\n * x 方向偏移量\n */\n offsetX?: number;\n /**\n * y 方向偏移量\n */\n offsetY?: number;\n /**\n * type为symbol时, symbol的样式\n */\n symbolStyle?: ISymbolGraphicAttribute;\n /**\n * type为image时, image的样式\n */\n imageStyle?: IImageGraphicAttribute;\n /**\n * type为text时, text的配置\n * 'text'类型的ItemContent新增三种子类型:'text','rich','html'。配置在textStyle.type上,继承自TagAttributes。\n */\n textStyle?: IMarkLabel;\n /**\n * type为rich text时, rich text的样式\n */\n richTextStyle?: IRichTextGraphicAttribute;\n /**\n * type为custom时,允许以callback的方式传入需要render的item\n */\n renderCustomCallback?: () => IGroup;\n /**\n * 当 mark 配置了 limitRect 之后,label 是否自动调整位置\n * @default false\n */\n confine?: boolean;\n};\n\nexport type IItemLine = {\n /** TODO:'type-opo' */\n type?: 'type-s' | 'type-do' | 'type-po' | 'type-op';\n visible?: boolean;\n /**\n * 垂直于引导线的装饰线,参考案例: https://observablehq.com/@mikelotis/edmonton-population-history-line-chart\n */\n decorativeLine?: {\n visible?: boolean;\n length?: number;\n };\n} & Omit<SegmentAttributes, 'points'>;\n\nexport type MarkPointAttrs = Omit<MarkerAttrs<MarkPointAnimationType>, 'labelStyle'> & {\n /**\n * markPoint的位置(也是path的起点)\n */\n position: Point;\n /**\n * 标注引导线\n */\n itemLine?: IItemLine;\n\n /**\n * 标注内容\n */\n itemContent?: IItemContent;\n\n state?: MarkPointState;\n} & BaseMarkerAnimation<MarkPointAnimationType>;\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IArc } from '@visactor/vrender-core';
|
|
2
|
+
import type { ArcSegmentAttributes } from './type';
|
|
3
|
+
import type { Point } from '../core/type';
|
|
4
|
+
import type { ComponentOptions } from '../interface';
|
|
5
|
+
import { Segment } from './segment';
|
|
6
|
+
export declare class ArcSegment extends Segment {
|
|
7
|
+
name: string;
|
|
8
|
+
line?: IArc;
|
|
9
|
+
constructor(attributes: ArcSegmentAttributes, options?: ComponentOptions);
|
|
10
|
+
getMainSegmentPoints(): Point[];
|
|
11
|
+
protected _computeRotate(angle: number): number;
|
|
12
|
+
protected render(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.ArcSegment = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), vrender_core_1 = require("@visactor/vrender-core"), register_1 = require("./register"), segment_1 = require("./segment");
|
|
8
|
+
|
|
9
|
+
(0, register_1.loadArcSegmentComponent)();
|
|
10
|
+
|
|
11
|
+
class ArcSegment extends segment_1.Segment {
|
|
12
|
+
constructor(attributes, options) {
|
|
13
|
+
super((null == options ? void 0 : options.skipDefault) ? attributes : (0, vutils_1.merge)({}, segment_1.Segment.defaultAttributes, attributes)),
|
|
14
|
+
this.name = "arc-segment";
|
|
15
|
+
}
|
|
16
|
+
getMainSegmentPoints() {
|
|
17
|
+
return this._mainSegmentPoints;
|
|
18
|
+
}
|
|
19
|
+
_computeRotate(angle) {
|
|
20
|
+
return angle + Math.PI;
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
this.removeAllChild(!0), this._reset();
|
|
24
|
+
const {startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle, state: state, visible: visible = !0, radius: radius, startAngle: startAngle, endAngle: endAngle, center: center} = this.attribute;
|
|
25
|
+
if (!visible) return;
|
|
26
|
+
this._startAngle = startAngle, this._endAngle = endAngle;
|
|
27
|
+
const startPoint = {
|
|
28
|
+
x: center.x + radius * Math.cos(this._startAngle),
|
|
29
|
+
y: center.y + radius * Math.sin(this._startAngle)
|
|
30
|
+
}, endPoint = {
|
|
31
|
+
x: center.x + radius * Math.cos(this._endAngle),
|
|
32
|
+
y: center.y + radius * Math.sin(this._endAngle)
|
|
33
|
+
};
|
|
34
|
+
this._mainSegmentPoints = [ startPoint, endPoint ];
|
|
35
|
+
const startSymbolShape = this._renderSymbol(startSymbol, this._mainSegmentPoints, "start"), endSymbolShape = this._renderSymbol(endSymbol, this._mainSegmentPoints, "end");
|
|
36
|
+
this.startSymbol = startSymbolShape, this.endSymbol = endSymbolShape;
|
|
37
|
+
const line = vrender_core_1.graphicCreator.arc(Object.assign({
|
|
38
|
+
x: center.x,
|
|
39
|
+
y: center.y,
|
|
40
|
+
startAngle: startAngle,
|
|
41
|
+
endAngle: endAngle,
|
|
42
|
+
innerRadius: radius,
|
|
43
|
+
outerRadius: radius
|
|
44
|
+
}, lineStyle));
|
|
45
|
+
line.name = `${this.name}-line`, line.id = this._getNodeId("arc"), (0, vutils_1.isEmpty)(null == state ? void 0 : state.line) || (line.states = [].concat(state.line)[0]),
|
|
46
|
+
this.add(line), this.line = line;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
exports.ArcSegment = ArcSegment;
|
|
51
|
+
//# sourceMappingURL=arc-segment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/segment/arc-segment.ts"],"names":[],"mappings":";;;AAGA,6CAAkD;AAGlD,yDAAwD;AAIxD,yCAAqD;AACrD,uCA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from '@visactor/vutils';\nimport type { IArc } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { graphicCreator } from '@visactor/vrender-core';\nimport type { ArcSegmentAttributes, SymbolAttributes } from './type';\nimport type { Point } from '../core/type';\nimport type { ComponentOptions } from '../interface';\nimport { loadArcSegmentComponent } from './register';\nimport { Segment } from './segment';\n\nloadArcSegmentComponent();\nexport class ArcSegment extends Segment {\n name = 'arc-segment';\n line?: IArc;\n\n constructor(attributes: ArcSegmentAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Segment.defaultAttributes, attributes));\n }\n\n getMainSegmentPoints() {\n return this._mainSegmentPoints;\n }\n\n protected _computeRotate(angle: number) {\n return angle + Math.PI;\n }\n\n protected render() {\n this.removeAllChild(true);\n this._reset();\n const {\n // points,\n startSymbol,\n endSymbol,\n lineStyle,\n state,\n visible = true,\n radius,\n startAngle,\n endAngle,\n center\n } = this.attribute as ArcSegmentAttributes;\n\n if (!visible) {\n return;\n }\n\n this._startAngle = startAngle;\n this._endAngle = endAngle;\n\n // 绘制start和end symbol\n const startPoint: Point = {\n x: center.x + radius * Math.cos(this._startAngle),\n y: center.y + radius * Math.sin(this._startAngle)\n };\n const endPoint: Point = {\n x: center.x + radius * Math.cos(this._endAngle),\n y: center.y + radius * Math.sin(this._endAngle)\n };\n this._mainSegmentPoints = [startPoint, endPoint];\n\n const startSymbolShape = this._renderSymbol(startSymbol as SymbolAttributes, this._mainSegmentPoints, 'start');\n const endSymbolShape = this._renderSymbol(endSymbol as SymbolAttributes, this._mainSegmentPoints, 'end');\n\n this.startSymbol = startSymbolShape;\n this.endSymbol = endSymbolShape;\n\n const line = graphicCreator.arc({\n x: center.x,\n y: center.y,\n startAngle,\n endAngle,\n innerRadius: radius,\n outerRadius: radius,\n ...lineStyle\n });\n\n line.name = `${this.name}-line`;\n line.id = this._getNodeId('arc');\n if (!isEmpty(state?.line)) {\n line.states = [].concat(state.line)[0];\n }\n this.add(line);\n this.line = line;\n }\n}\n"]}
|
package/cjs/segment/index.d.ts
CHANGED
package/cjs/segment/index.js
CHANGED
|
@@ -17,5 +17,6 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
17
17
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
|
-
}), __exportStar(require("./segment"), exports), __exportStar(require("./
|
|
20
|
+
}), __exportStar(require("./segment"), exports), __exportStar(require("./arc-segment"), exports),
|
|
21
|
+
__exportStar(require("./type"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
package/cjs/segment/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/segment/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,4CAA0B;AAC1B,yCAAuB","file":"index.js","sourcesContent":["/**\n * @description 线,两端可带箭头等 symbol\n */\nexport * from './segment';\nexport * from './type';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/segment/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,4CAA0B;AAC1B,gDAA8B;AAC9B,yCAAuB","file":"index.js","sourcesContent":["/**\n * @description 线,两端可带箭头等 symbol\n */\nexport * from './segment';\nexport * from './arc-segment';\nexport * from './type';\n"]}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare function loadSegmentComponent(): void;
|
|
1
|
+
export declare function loadSegmentComponent(enableAnimation?: boolean): void;
|
|
2
|
+
export declare function loadArcSegmentComponent(enableAnimation?: boolean): void;
|
package/cjs/segment/register.js
CHANGED
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.loadSegmentComponent = void 0;
|
|
5
|
+
}), exports.loadArcSegmentComponent = exports.loadSegmentComponent = void 0;
|
|
6
6
|
|
|
7
7
|
const vrender_kits_1 = require("@visactor/vrender-kits");
|
|
8
8
|
|
|
9
|
-
function loadSegmentComponent() {
|
|
9
|
+
function loadSegmentComponent(enableAnimation = !1) {
|
|
10
10
|
(0, vrender_kits_1.registerGroup)(), (0, vrender_kits_1.registerLine)(), (0, vrender_kits_1.registerPolygon)(),
|
|
11
11
|
(0, vrender_kits_1.registerSymbol)();
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
function loadArcSegmentComponent(enableAnimation = !1) {
|
|
15
|
+
(0, vrender_kits_1.registerGroup)(), (0, vrender_kits_1.registerLine)(), (0, vrender_kits_1.registerArc)(),
|
|
16
|
+
(0, vrender_kits_1.registerSymbol)();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.loadSegmentComponent = loadSegmentComponent, exports.loadArcSegmentComponent = loadArcSegmentComponent;
|
|
15
20
|
//# sourceMappingURL=register.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/segment/register.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"sources":["../src/segment/register.ts"],"names":[],"mappings":";;;AAAA,yDAAmH;AAEnH,SAAgB,oBAAoB,CAAC,kBAA2B,KAAK;IACnE,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,8BAAe,GAAE,CAAC;IAClB,IAAA,6BAAc,GAAE,CAAC;AACnB,CAAC;AALD,oDAKC;AAED,SAAgB,uBAAuB,CAAC,kBAA2B,KAAK;IACtE,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,0BAAW,GAAE,CAAC;IACd,IAAA,6BAAc,GAAE,CAAC;AACnB,CAAC;AALD,0DAKC","file":"register.js","sourcesContent":["import { registerGroup, registerLine, registerPolygon, registerSymbol, registerArc } from '@visactor/vrender-kits';\n\nexport function loadSegmentComponent(enableAnimation: boolean = false) {\n registerGroup();\n registerLine();\n registerPolygon();\n registerSymbol();\n}\n\nexport function loadArcSegmentComponent(enableAnimation: boolean = false) {\n registerGroup();\n registerLine();\n registerArc();\n registerSymbol();\n}\n"]}
|