@visactor/vrender-components 0.19.4-alpha.4 → 0.19.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/legend/discrete/discrete.d.ts +1 -0
- package/cjs/legend/discrete/discrete.js +3 -0
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/marker/animate/common.js +8 -4
- package/cjs/marker/animate/common.js.map +1 -1
- package/cjs/marker/arc-area.js +10 -4
- package/cjs/marker/arc-area.js.map +1 -1
- package/cjs/marker/arc-line.js +7 -2
- package/cjs/marker/arc-line.js.map +1 -1
- package/cjs/marker/area.js +10 -4
- package/cjs/marker/area.js.map +1 -1
- package/cjs/marker/base.d.ts +1 -1
- package/cjs/marker/base.js.map +1 -1
- package/cjs/marker/common-line.d.ts +1 -1
- package/cjs/marker/common-line.js +10 -5
- package/cjs/marker/common-line.js.map +1 -1
- package/cjs/marker/config.d.ts +18 -4
- package/cjs/marker/config.js +134 -56
- package/cjs/marker/config.js.map +1 -1
- package/cjs/marker/line.d.ts +3 -3
- package/cjs/marker/line.js +19 -7
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/point.d.ts +39 -7
- package/cjs/marker/point.js +163 -71
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/register.js +2 -2
- package/cjs/marker/register.js.map +1 -1
- package/cjs/marker/type.d.ts +12 -4
- package/cjs/marker/type.js.map +1 -1
- package/cjs/segment/arc-segment.d.ts +6 -1
- package/cjs/segment/arc-segment.js +15 -4
- package/cjs/segment/arc-segment.js.map +1 -1
- package/cjs/segment/register.d.ts +2 -2
- package/cjs/segment/register.js +2 -2
- package/cjs/segment/register.js.map +1 -1
- package/cjs/segment/segment.d.ts +3 -1
- package/cjs/segment/segment.js +7 -4
- package/cjs/segment/segment.js.map +1 -1
- package/cjs/tooltip/util.js +1 -1
- package/cjs/tooltip/util.js.map +1 -1
- package/cjs/util/common.d.ts +4 -0
- package/cjs/util/common.js +18 -2
- package/cjs/util/common.js.map +1 -1
- package/cjs/util/index.d.ts +1 -0
- package/cjs/util/index.js +2 -1
- package/cjs/util/index.js.map +1 -1
- package/cjs/util/polar.d.ts +2 -0
- package/cjs/util/polar.js +17 -0
- package/cjs/util/polar.js.map +1 -0
- package/dist/index.es.js +28816 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/legend/discrete/discrete.d.ts +1 -0
- package/es/legend/discrete/discrete.js +3 -0
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/marker/animate/common.js +8 -4
- package/es/marker/animate/common.js.map +1 -1
- package/es/marker/arc-area.js +10 -4
- package/es/marker/arc-area.js.map +1 -1
- package/es/marker/arc-line.js +7 -2
- package/es/marker/arc-line.js.map +1 -1
- package/es/marker/area.js +10 -4
- package/es/marker/area.js.map +1 -1
- package/es/marker/base.d.ts +1 -1
- package/es/marker/base.js.map +1 -1
- package/es/marker/common-line.d.ts +1 -1
- package/es/marker/common-line.js +10 -5
- package/es/marker/common-line.js.map +1 -1
- package/es/marker/config.d.ts +18 -4
- package/es/marker/config.js +134 -56
- package/es/marker/config.js.map +1 -1
- package/es/marker/line.d.ts +3 -3
- package/es/marker/line.js +20 -6
- package/es/marker/line.js.map +1 -1
- package/es/marker/point.d.ts +39 -7
- package/es/marker/point.js +163 -71
- package/es/marker/point.js.map +1 -1
- package/es/marker/register.js +2 -1
- package/es/marker/register.js.map +1 -1
- package/es/marker/type.d.ts +12 -4
- package/es/marker/type.js.map +1 -1
- package/es/segment/arc-segment.d.ts +6 -1
- package/es/segment/arc-segment.js +15 -4
- package/es/segment/arc-segment.js.map +1 -1
- package/es/segment/register.d.ts +2 -2
- package/es/segment/register.js +2 -2
- package/es/segment/register.js.map +1 -1
- package/es/segment/segment.d.ts +3 -1
- package/es/segment/segment.js +7 -4
- package/es/segment/segment.js.map +1 -1
- package/es/tooltip/util.js +1 -1
- package/es/tooltip/util.js.map +1 -1
- package/es/util/common.d.ts +4 -0
- package/es/util/common.js +14 -0
- package/es/util/common.js.map +1 -1
- package/es/util/index.d.ts +1 -0
- package/es/util/index.js +2 -0
- package/es/util/index.js.map +1 -1
- package/es/util/polar.d.ts +2 -0
- package/es/util/polar.js +7 -0
- package/es/util/polar.js.map +1 -0
- package/package.json +3 -3
package/cjs/marker/line.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.MarkLine = exports.registerMarkLineAnimate = void 0;
|
|
6
6
|
|
|
7
|
-
const vutils_1 = require("@visactor/vutils"), register_1 = require("./register"), common_line_1 = require("./common-line"), segment_1 = require("../segment"), constant_1 = require("../constant"), config_1 = require("./config"), animate_1 = require("./animate/animate");
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), register_1 = require("./register"), common_line_1 = require("./common-line"), segment_1 = require("../segment"), constant_1 = require("../constant"), config_1 = require("./config"), animate_1 = require("./animate/animate"), util_1 = require("../util");
|
|
8
8
|
|
|
9
9
|
function registerMarkLineAnimate() {
|
|
10
10
|
MarkLine._animate = animate_1.markCommonLineAnimate;
|
|
@@ -22,7 +22,8 @@ class MarkLine extends common_line_1.MarkCommonLine {
|
|
|
22
22
|
}
|
|
23
23
|
getPointAttrByPosition(position) {
|
|
24
24
|
var _a;
|
|
25
|
-
const {label: label = {}} = this.attribute, {refX: refX = 0, refY: refY = 0} = label, points = this._line.getMainSegmentPoints(),
|
|
25
|
+
const {label: label = {}} = this.attribute, {refX: refX = 0, refY: refY = 0} = label, points = this._line.getMainSegmentPoints(), lineEndAngle = null !== (_a = this._line.getEndAngle()) && void 0 !== _a ? _a : 0, labelAngle = ((0,
|
|
26
|
+
util_1.isPostiveXAxisCartes)(lineEndAngle), lineEndAngle), labelOffsetX = refX * Math.cos(labelAngle) + refY * Math.cos(labelAngle - Math.PI / 2), labelOffsetY = refX * Math.sin(labelAngle) + refY * Math.sin(labelAngle - Math.PI / 2);
|
|
26
27
|
return position.includes("start") || position.includes("Start") ? {
|
|
27
28
|
position: {
|
|
28
29
|
x: points[0].x + labelOffsetX,
|
|
@@ -45,10 +46,16 @@ class MarkLine extends common_line_1.MarkCommonLine {
|
|
|
45
46
|
}
|
|
46
47
|
getRotateByAngle(angle) {
|
|
47
48
|
var _a;
|
|
48
|
-
return angle + (null !== (_a = this.attribute.label.refAngle) && void 0 !== _a ? _a : 0);
|
|
49
|
+
return ((0, util_1.isPostiveXAxisCartes)(angle) ? angle : angle - Math.PI) + (null !== (_a = this.attribute.label.refAngle) && void 0 !== _a ? _a : 0);
|
|
49
50
|
}
|
|
50
|
-
getTextStyle(position) {
|
|
51
|
-
return
|
|
51
|
+
getTextStyle(position, labelAngle, autoRotate) {
|
|
52
|
+
return Math.abs(Math.abs(labelAngle) - Math.PI / 2) < 1e-4 ? autoRotate ? {
|
|
53
|
+
textAlign: "right",
|
|
54
|
+
textBaseline: "middle"
|
|
55
|
+
} : {
|
|
56
|
+
textAlign: "center",
|
|
57
|
+
textBaseline: labelAngle > 0 && position.includes("inside") || labelAngle < 0 && !position.includes("inside") ? "bottom" : "top"
|
|
58
|
+
} : (0, util_1.isPostiveXAxisCartes)(labelAngle) ? config_1.DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP.postiveXAxis[position] : config_1.DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP.negativeXAxis[position];
|
|
52
59
|
}
|
|
53
60
|
createSegment() {
|
|
54
61
|
const {points: points, startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle, mainSegmentIndex: mainSegmentIndex, multiSegment: multiSegment, state: state} = this.attribute;
|
|
@@ -68,14 +75,19 @@ class MarkLine extends common_line_1.MarkCommonLine {
|
|
|
68
75
|
});
|
|
69
76
|
}
|
|
70
77
|
setLineAttributes() {
|
|
71
|
-
const {points: points, startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle, mainSegmentIndex: mainSegmentIndex, multiSegment: multiSegment} = this.attribute;
|
|
78
|
+
const {points: points, startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle, mainSegmentIndex: mainSegmentIndex, multiSegment: multiSegment, state: state} = this.attribute;
|
|
72
79
|
this._line && this._line.setAttributes({
|
|
73
80
|
points: points,
|
|
74
81
|
startSymbol: startSymbol,
|
|
75
82
|
endSymbol: endSymbol,
|
|
76
83
|
lineStyle: lineStyle,
|
|
77
84
|
mainSegmentIndex: mainSegmentIndex,
|
|
78
|
-
multiSegment: multiSegment
|
|
85
|
+
multiSegment: multiSegment,
|
|
86
|
+
state: {
|
|
87
|
+
line: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.line),
|
|
88
|
+
startSymbol: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.lineStartSymbol),
|
|
89
|
+
endSymbol: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.lineEndSymbol)
|
|
90
|
+
}
|
|
79
91
|
});
|
|
80
92
|
}
|
|
81
93
|
isValidPoints() {
|
package/cjs/marker/line.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/line.ts"],"names":[],"mappings":";;;AAAA,6CAAwD;AAKxD,yCAAmD;AAEnD,+CAA+C;AAG/C,wCAAqC;AACrC,0CAA6C;AAC7C,qCAA+F;AAE/F,+CAA0D;AAG1D,IAAA,gCAAqB,GAAE,CAAC;AAExB,SAAgB,uBAAuB;IACrC,QAAQ,CAAC,QAAQ,GAAG,+BAAqB,CAAC;AAC5C,CAAC;AAFD,0DAEC;AAED,MAAa,QAAS,SAAQ,4BAA6D;IAO/E,aAAa,CAAC,KAA2B;QACjD,IAAI,QAAQ,CAAC,QAAQ,IAAI,IAAI,CAAC,gBAAgB,EAAE;YAC9C,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK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IAAI,CAAC,IAAA,sBAAa,EAAE,CAAW,CAAC,CAAC,CAAC,IAAI,CAAC,IAAA,sBAAa,EAAE,CAAW,CAAC,CAAC,CAAC,EAAE;wBACpE,SAAS,GAAG,KAAK,CAAC;wBAClB,OAAO;qBACR;gBACH,CAAC,CAAC,CAAC;aACJ;iBAAM,IAAI,CAAC,IAAA,sBAAa,EAAE,KAAe,CAAC,CAAC,CAAC,IAAI,CAAC,IAAA,sBAAa,EAAE,KAAe,CAAC,CAAC,CAAC,EAAE;gBACnF,SAAS,GAAG,KAAK,CAAC;gBAClB,OAAO;aACR;QACH,CAAC,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACnB,CAAC;;AAlHH,4BAmHC;AAhHQ,0BAAiB,GAA2B,gCAAmD,CAAC","file":"line.js","sourcesContent":["import { isValidNumber, merge } from '@visactor/vutils';\nimport type { IMarkLineLabelPosition } from './type';\n// eslint-disable-next-line no-duplicate-imports\nimport type { MarkLineAttrs, MarkerAnimationState } from './type';\nimport type { ComponentOptions } from '../interface';\nimport { loadMarkLineComponent } from './register';\nimport type { Point } from '../core/type';\nimport { MarkCommonLine } from './common-line';\nimport type { ArcSegment } from '../segment';\n// eslint-disable-next-line no-duplicate-imports\nimport { Segment } from '../segment';\nimport { DEFAULT_STATES } from '../constant';\nimport { DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP, DEFAULT_MARK_LINE_THEME } from './config';\nimport type { ILineGraphicAttribute } from '@visactor/vrender-core';\nimport { markCommonLineAnimate } from './animate/animate';\nimport { limitShapeInBounds } from '../util/limit-shape';\n\nloadMarkLineComponent();\n\nexport function registerMarkLineAnimate() {\n MarkLine._animate = markCommonLineAnimate;\n}\n\nexport class MarkLine extends MarkCommonLine<ILineGraphicAttribute, IMarkLineLabelPosition> {\n name = 'markLine';\n // eslint-disable-next-line max-len\n static defaultAttributes: Partial<MarkLineAttrs> = DEFAULT_MARK_LINE_THEME as unknown as MarkLineAttrs;\n protected _line!: Segment | ArcSegment;\n\n /** animate */\n protected markerAnimate(state: MarkerAnimationState) {\n if (MarkLine._animate && this._animationConfig) {\n MarkLine._animate(this._line, this._label, this._animationConfig, state);\n }\n }\n\n constructor(attributes: MarkLineAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, MarkLine.defaultAttributes, attributes));\n }\n\n protected getPointAttrByPosition(position: IMarkLineLabelPosition) {\n const { label = {} } = this.attribute;\n const { refX = 0, refY = 0 } = label;\n const points = this._line.getMainSegmentPoints();\n const labelAngle = this._line.getEndAngle() ?? 0;\n\n const labelOffsetX = refX * Math.cos(labelAngle) + refX * Math.cos(labelAngle - Math.PI / 2);\n const labelOffsetY = refX * Math.sin(labelAngle) + refY * Math.sin(labelAngle - Math.PI / 2);\n\n if (position.includes('start') || position.includes('Start')) {\n return {\n position: {\n x: points[0].x + labelOffsetX,\n y: points[0].y + labelOffsetY\n },\n angle: labelAngle\n };\n } else if (position.includes('middle') || position.includes('Middle')) {\n return {\n position: {\n x: (points[0].x + points[points.length - 1].x) / 2 + labelOffsetX,\n y: (points[0].y + points[points.length - 1].y) / 2 + labelOffsetY\n },\n angle: labelAngle\n };\n }\n return {\n position: {\n x: points[points.length - 1].x + labelOffsetX,\n y: points[points.length - 1].y + labelOffsetY\n },\n angle: labelAngle\n };\n }\n\n protected getRotateByAngle(angle: number): number {\n return angle + (this.attribute.label.refAngle ?? 0);\n }\n\n protected getTextStyle(position: IMarkLineLabelPosition) {\n return DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP[position];\n }\n\n protected createSegment() {\n const { points, startSymbol, endSymbol, lineStyle, mainSegmentIndex, multiSegment, state } = this\n .attribute as MarkLineAttrs;\n return new Segment({\n points,\n startSymbol,\n endSymbol,\n lineStyle,\n mainSegmentIndex,\n multiSegment,\n pickable: false, // 组件容器本身不参与拾取\n state: {\n line: merge({}, DEFAULT_STATES, state?.line),\n startSymbol: merge({}, DEFAULT_STATES, state?.lineStartSymbol),\n endSymbol: merge({}, DEFAULT_STATES, state?.lineEndSymbol)\n }\n });\n }\n\n protected setLineAttributes() {\n const { points, startSymbol, endSymbol, lineStyle, mainSegmentIndex, multiSegment } = this\n .attribute as MarkLineAttrs;\n if (this._line) {\n this._line.setAttributes({\n points,\n startSymbol,\n endSymbol,\n lineStyle,\n mainSegmentIndex,\n multiSegment\n });\n }\n }\n\n protected isValidPoints() {\n const { points } = this.attribute as MarkLineAttrs;\n if (!points || points.length < 2) {\n return false;\n }\n let validFlag = true;\n points.forEach((point: Point | Point[]) => {\n if ((point as any).length) {\n (point as Point[]).forEach((p: Point) => {\n if (!isValidNumber((p as Point).x) || !isValidNumber((p as Point).y)) {\n validFlag = false;\n return;\n }\n });\n } else if (!isValidNumber((point as Point).x) || !isValidNumber((point as Point).y)) {\n validFlag = false;\n return;\n }\n });\n return validFlag;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/marker/line.ts"],"names":[],"mappings":";;;AAAA,6CAAwD;AAKxD,yCAAmD;AAEnD,+CAA+C;AAG/C,wCAAqC;AACrC,0CAA6C;AAC7C,qCAA+F;AAE/F,+CAA0D;AAC1D,kCAA+C;AAE/C,IAAA,gCAAqB,GAAE,CAAC;AAExB,SAAgB,uBAAuB;IACrC,QAAQ,CAAC,QAAQ,GAAG,+BAAqB,CAAC;AAC5C,CAAC;AAFD,0DAEC;AAED,MAAa,QAAS,SAAQ,4BAA6D;IAO/E,aAAa,CAAC,KAA2B;QACjD,IAAI,QAAQ,CAAC,QAAQ,IAAI,IAAI,CAAC,gBAAgB,EAAE;YAC9C,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;SAC1E;IACH,CAAC;IAED,YAAY,UAAyB,EAAE,OAA0B;QAC/D,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CA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B,OAAO;qBACR;gBACH,CAAC,CAAC,CAAC;aACJ;iBAAM,IAAI,CAAC,IAAA,sBAAa,EAAE,KAAe,CAAC,CAAC,CAAC,IAAI,CAAC,IAAA,sBAAa,EAAE,KAAe,CAAC,CAAC,CAAC,EAAE;gBACnF,SAAS,GAAG,KAAK,CAAC;gBAClB,OAAO;aACR;QACH,CAAC,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACnB,CAAC;;AA7IH,4BA8IC;AA3IQ,0BAAiB,GAA2B,gCAAmD,CAAC","file":"line.js","sourcesContent":["import { isValidNumber, merge } from '@visactor/vutils';\nimport type { IMarkLineLabelPosition } from './type';\n// eslint-disable-next-line no-duplicate-imports\nimport type { MarkLineAttrs, MarkerAnimationState } from './type';\nimport type { ComponentOptions } from '../interface';\nimport { loadMarkLineComponent } from './register';\nimport type { Point } from '../core/type';\nimport { MarkCommonLine } from './common-line';\nimport type { ArcSegment } from '../segment';\n// eslint-disable-next-line no-duplicate-imports\nimport { Segment } from '../segment';\nimport { DEFAULT_STATES } from '../constant';\nimport { DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP, DEFAULT_MARK_LINE_THEME } from './config';\nimport type { ILineGraphicAttribute } from '@visactor/vrender-core';\nimport { markCommonLineAnimate } from './animate/animate';\nimport { isPostiveXAxisCartes } from '../util';\n\nloadMarkLineComponent();\n\nexport function registerMarkLineAnimate() {\n MarkLine._animate = markCommonLineAnimate;\n}\n\nexport class MarkLine extends MarkCommonLine<ILineGraphicAttribute, IMarkLineLabelPosition> {\n name = 'markLine';\n // eslint-disable-next-line max-len\n static defaultAttributes: Partial<MarkLineAttrs> = DEFAULT_MARK_LINE_THEME as unknown as MarkLineAttrs;\n protected _line!: Segment | ArcSegment;\n\n /** animate */\n protected markerAnimate(state: MarkerAnimationState) {\n if (MarkLine._animate && this._animationConfig) {\n MarkLine._animate(this._line, this._label, this._animationConfig, state);\n }\n }\n\n constructor(attributes: MarkLineAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, MarkLine.defaultAttributes, attributes));\n }\n\n protected getPointAttrByPosition(position: IMarkLineLabelPosition) {\n const { label = {} } = this.attribute;\n const { refX = 0, refY = 0 } = label;\n const points = this._line.getMainSegmentPoints();\n const lineEndAngle = this._line.getEndAngle() ?? 0;\n const labelAngle = isPostiveXAxisCartes(lineEndAngle) ? lineEndAngle : lineEndAngle;\n\n const labelOffsetX = refX * Math.cos(labelAngle) + refY * Math.cos(labelAngle - Math.PI / 2);\n const labelOffsetY = refX * Math.sin(labelAngle) + refY * Math.sin(labelAngle - Math.PI / 2);\n\n if (position.includes('start') || position.includes('Start')) {\n return {\n position: {\n x: points[0].x + labelOffsetX,\n y: points[0].y + labelOffsetY\n },\n angle: labelAngle\n };\n } else if (position.includes('middle') || position.includes('Middle')) {\n return {\n position: {\n x: (points[0].x + points[points.length - 1].x) / 2 + labelOffsetX,\n y: (points[0].y + points[points.length - 1].y) / 2 + labelOffsetY\n },\n angle: labelAngle\n };\n }\n return {\n position: {\n x: points[points.length - 1].x + labelOffsetX,\n y: points[points.length - 1].y + labelOffsetY\n },\n angle: labelAngle\n };\n }\n\n protected getRotateByAngle(angle: number): number {\n const itemAngle = isPostiveXAxisCartes(angle) ? angle : angle - Math.PI;\n return itemAngle + (this.attribute.label.refAngle ?? 0);\n }\n\n protected getTextStyle(position: IMarkLineLabelPosition, labelAngle: number, autoRotate: boolean) {\n // 垂直方向例外\n if (Math.abs(Math.abs(labelAngle) - Math.PI / 2) < 0.0001) {\n if (autoRotate) {\n return {\n textAlign: 'right',\n textBaseline: 'middle'\n };\n }\n return {\n textAlign: 'center',\n textBaseline:\n (labelAngle > 0 && position.includes('inside')) || (labelAngle < 0 && !position.includes('inside'))\n ? 'bottom'\n : 'top'\n };\n }\n\n if (isPostiveXAxisCartes(labelAngle)) {\n return DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP.postiveXAxis[position];\n }\n return DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP.negativeXAxis[position];\n }\n\n protected createSegment() {\n const { points, startSymbol, endSymbol, lineStyle, mainSegmentIndex, multiSegment, state } = this\n .attribute as MarkLineAttrs;\n return new Segment({\n points,\n startSymbol,\n endSymbol,\n lineStyle,\n mainSegmentIndex,\n multiSegment,\n pickable: false, // 组件容器本身不参与拾取\n state: {\n line: merge({}, DEFAULT_STATES, state?.line),\n startSymbol: merge({}, DEFAULT_STATES, state?.lineStartSymbol),\n endSymbol: merge({}, DEFAULT_STATES, state?.lineEndSymbol)\n }\n });\n }\n\n protected setLineAttributes() {\n const { points, startSymbol, endSymbol, lineStyle, mainSegmentIndex, multiSegment, state } = this\n .attribute as MarkLineAttrs;\n if (this._line) {\n this._line.setAttributes({\n points,\n startSymbol,\n endSymbol,\n lineStyle,\n mainSegmentIndex,\n multiSegment,\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\n protected isValidPoints() {\n const { points } = this.attribute as MarkLineAttrs;\n if (!points || points.length < 2) {\n return false;\n }\n let validFlag = true;\n points.forEach((point: Point | Point[]) => {\n if ((point as any).length) {\n (point as Point[]).forEach((p: Point) => {\n if (!isValidNumber((p as Point).x) || !isValidNumber((p as Point).y)) {\n validFlag = false;\n return;\n }\n });\n } else if (!isValidNumber((point as Point).x) || !isValidNumber((point as Point).y)) {\n validFlag = false;\n return;\n }\n });\n return validFlag;\n }\n}\n"]}
|
package/cjs/marker/point.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IGroup, IImage, ISymbol, IImageGraphicAttribute, IRichText, IRichTextGraphicAttribute } from '@visactor/vrender-core';
|
|
2
|
+
import type { IPointLike } from '@visactor/vutils';
|
|
2
3
|
import { Tag } from '../tag';
|
|
3
4
|
import { Marker } from './base';
|
|
4
5
|
import type { IItemContent, IItemLine, MarkPointAnimationType, MarkPointAttrs, MarkerAnimationState } from './type';
|
|
@@ -10,6 +11,16 @@ export declare class MarkPoint extends Marker<MarkPointAttrs, MarkPointAnimation
|
|
|
10
11
|
name: string;
|
|
11
12
|
static defaultAttributes: {
|
|
12
13
|
interactive: boolean;
|
|
14
|
+
targetSymbol: {
|
|
15
|
+
visible: boolean;
|
|
16
|
+
offset: number;
|
|
17
|
+
style: {
|
|
18
|
+
symbolType: string;
|
|
19
|
+
size: number;
|
|
20
|
+
fill: boolean;
|
|
21
|
+
stroke: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
13
24
|
itemLine: {
|
|
14
25
|
visible: boolean;
|
|
15
26
|
decorativeLine: {
|
|
@@ -69,24 +80,45 @@ export declare class MarkPoint extends Marker<MarkPointAttrs, MarkPointAnimation
|
|
|
69
80
|
defaultExitAnimation: import("./type").MarkerExitAnimation;
|
|
70
81
|
protected markerAnimate(state: MarkerAnimationState): void;
|
|
71
82
|
private _item;
|
|
83
|
+
private _targetItem;
|
|
72
84
|
private _line?;
|
|
73
85
|
private _decorativeLine;
|
|
86
|
+
private _isArcLine;
|
|
74
87
|
constructor(attributes: MarkPointAttrs, options?: ComponentOptions);
|
|
75
88
|
protected setLabelPos(): void;
|
|
76
|
-
protected
|
|
89
|
+
protected getTextAlignAttr(autoRotate: boolean, offsetX: number, offsetY: number, lineEndAngle: number, itemPosition: keyof typeof IMarkPointItemPosition): {
|
|
90
|
+
textAlign: import("@visactor/vrender-core").TextAlignType;
|
|
91
|
+
textBaseline: import("@visactor/vrender-core").TextBaselineType;
|
|
92
|
+
};
|
|
93
|
+
protected setItemAttributes(item: ISymbol | Tag | IImage | IRichText, itemContent: IItemContent, newPosition: Point, newItemPosition: Point, itemType: 'symbol' | 'text' | 'image' | 'richText' | 'custom'): void;
|
|
77
94
|
protected getItemDx(item: ISymbol | Tag | IImage | IRichText, position: keyof typeof IMarkPointItemPosition, style?: IImageGraphicAttribute | IRichTextGraphicAttribute): number;
|
|
78
95
|
protected getItemDy(item: ISymbol | Tag | IImage | IRichText, position: keyof typeof IMarkPointItemPosition, style?: IImageGraphicAttribute | IRichTextGraphicAttribute): number;
|
|
79
|
-
protected initItem(itemContent: IItemContent,
|
|
80
|
-
protected getItemLineAttr(itemLine: IItemLine,
|
|
81
|
-
|
|
82
|
-
|
|
96
|
+
protected initItem(itemContent: IItemContent, newPosition: Point, newItemPosition: Point): IGroup | IRichText | Tag | ISymbol | IImage;
|
|
97
|
+
protected getItemLineAttr(itemLine: IItemLine, newPosition: Point, newItemPosition: Point): {
|
|
98
|
+
points: Point[];
|
|
99
|
+
center: {
|
|
100
|
+
x: number;
|
|
101
|
+
y: number;
|
|
102
|
+
};
|
|
103
|
+
radius: number;
|
|
104
|
+
startAngle: number;
|
|
105
|
+
endAngle: number;
|
|
106
|
+
};
|
|
107
|
+
protected reDrawLine(itemLine: IItemLine, pointsAttr: any): void;
|
|
108
|
+
protected setItemLineAttr(itemLine: IItemLine, newPosition: Point, newItemPosition: Point): void;
|
|
109
|
+
protected getDecorativeLineAttr(itemLine: IItemLine): {
|
|
83
110
|
startPointOffsetX: number;
|
|
84
111
|
startPointOffsetY: number;
|
|
85
112
|
endPointOffsetX: number;
|
|
86
113
|
endPointOffsetY: number;
|
|
87
114
|
};
|
|
88
|
-
protected setDecorativeLineAttr(itemLine: IItemLine,
|
|
89
|
-
protected
|
|
115
|
+
protected setDecorativeLineAttr(itemLine: IItemLine, newItemPosition: Point, visible: boolean): void;
|
|
116
|
+
protected setTargetItemAttributes(targetItem: any, position: IPointLike): void;
|
|
117
|
+
protected setAllOfItemsAttr(newPosition: Point, newItemPosition: Point): void;
|
|
118
|
+
protected computeNewPositionAfterTargetItem(position: Point): {
|
|
119
|
+
newPosition: Point;
|
|
120
|
+
newItemPosition: Point;
|
|
121
|
+
};
|
|
90
122
|
protected initMarker(container: IGroup): void;
|
|
91
123
|
protected updateMarker(): void;
|
|
92
124
|
protected isValidPoints(): boolean;
|
package/cjs/marker/point.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
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"), constant_1 = require("../constant"), animate_1 = require("./animate/animate");
|
|
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"), util_1 = require("../util");
|
|
8
8
|
|
|
9
9
|
function registerMarkPointAnimate() {
|
|
10
10
|
MarkPoint._animate = animate_1.markPointAnimate;
|
|
@@ -19,24 +19,41 @@ class MarkPoint extends base_1.Marker {
|
|
|
19
19
|
constructor(attributes, options) {
|
|
20
20
|
super((null == options ? void 0 : options.skipDefault) ? attributes : (0, vutils_1.merge)({}, MarkPoint.defaultAttributes, attributes)),
|
|
21
21
|
this.name = "markPoint", this.defaultUpdateAnimation = animate_1.DefaultUpdateMarkPointAnimation,
|
|
22
|
-
this.defaultExitAnimation = animate_1.DefaultExitMarkerAnimation;
|
|
22
|
+
this.defaultExitAnimation = animate_1.DefaultExitMarkerAnimation, this._isArcLine = !1;
|
|
23
23
|
}
|
|
24
24
|
setLabelPos() {}
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
getTextAlignAttr(autoRotate, offsetX, offsetY, lineEndAngle, itemPosition) {
|
|
26
|
+
let isPostiveXAxis = !0;
|
|
27
|
+
return isPostiveXAxis = this._isArcLine ? (0, util_1.isPostiveXAxisPolar)(lineEndAngle, this._line.isReverseArc) : (0,
|
|
28
|
+
util_1.isPostiveXAxisCartes)(lineEndAngle), isPostiveXAxis ? config_1.DEFAULT_MARK_POINT_TEXT_STYLE_MAP.postiveXAxis[itemPosition] : config_1.DEFAULT_MARK_POINT_TEXT_STYLE_MAP.negativeXAxis[itemPosition];
|
|
29
|
+
}
|
|
30
|
+
setItemAttributes(item, itemContent, newPosition, newItemPosition, itemType) {
|
|
31
|
+
var _a, _b;
|
|
27
32
|
if (!item) return;
|
|
28
|
-
const {autoRotate: autoRotate = !0, refX: refX = 0, refY: refY = 0, refAngle: refAngle = 0, textStyle: textStyle = {}, richTextStyle: richTextStyle = {}, imageStyle: imageStyle = {}, position:
|
|
29
|
-
"text" === itemType
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
const {autoRotate: autoRotate = !0, refX: refX = 0, refY: refY = 0, refAngle: refAngle = 0, textStyle: textStyle = {}, richTextStyle: richTextStyle = {}, imageStyle: imageStyle = {}, position: positionType = type_1.IMarkPointItemPosition.middle} = itemContent, {state: state} = this.attribute, lineEndAngle = (null === (_a = this._line) || void 0 === _a ? void 0 : _a.getEndAngle()) || 0, itemRefOffsetX = refX * Math.cos(lineEndAngle) + refY * Math.cos(lineEndAngle), itemRefOffsetY = refX * Math.sin(lineEndAngle) + refY * Math.sin(lineEndAngle);
|
|
34
|
+
if ("text" === itemType) {
|
|
35
|
+
const offsetX = newItemPosition.x - newPosition.x, offsetY = newItemPosition.y - newPosition.y;
|
|
36
|
+
item.setAttributes(Object.assign(Object.assign({}, textStyle), {
|
|
37
|
+
textStyle: Object.assign(Object.assign({}, this.getTextAlignAttr(autoRotate, offsetX, offsetY, lineEndAngle, null !== (_b = itemContent.position) && void 0 !== _b ? _b : "end")), textStyle.textStyle),
|
|
38
|
+
state: {
|
|
39
|
+
panel: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.textBackground),
|
|
40
|
+
text: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.text)
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
} else "richText" === itemType ? (item.setAttributes({
|
|
44
|
+
dx: this.getItemDx(item, positionType, richTextStyle) + (richTextStyle.dx || 0),
|
|
45
|
+
dy: this.getItemDy(item, positionType, richTextStyle) + (richTextStyle.dy || 0)
|
|
46
|
+
}), item.states = (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.richText)) : "image" === itemType && (item.setAttributes({
|
|
47
|
+
dx: this.getItemDx(item, positionType, imageStyle) + (imageStyle.dx || 0),
|
|
48
|
+
dy: this.getItemDy(item, positionType, imageStyle) + (imageStyle.dy || 0)
|
|
49
|
+
}), item.states = (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.image));
|
|
50
|
+
let itemAngle, isPostiveXAxis = !0;
|
|
51
|
+
this._isArcLine ? (isPostiveXAxis = (0, util_1.isPostiveXAxisPolar)(lineEndAngle, this._line.isReverseArc),
|
|
52
|
+
itemAngle = isPostiveXAxis ? lineEndAngle : lineEndAngle - Math.PI) : (isPostiveXAxis = (0,
|
|
53
|
+
util_1.isPostiveXAxisCartes)(lineEndAngle), itemAngle = isPostiveXAxis ? lineEndAngle : lineEndAngle - Math.PI),
|
|
54
|
+
item.setAttributes({
|
|
55
|
+
x: newItemPosition.x + (itemRefOffsetX || 0),
|
|
56
|
+
y: newItemPosition.y + (itemRefOffsetY || 0),
|
|
40
57
|
angle: autoRotate && itemAngle + refAngle
|
|
41
58
|
});
|
|
42
59
|
}
|
|
@@ -50,49 +67,86 @@ class MarkPoint extends base_1.Marker {
|
|
|
50
67
|
const height = null !== (_b = null === (_a = null == item ? void 0 : item.AABBBounds) || void 0 === _a ? void 0 : _a.height()) && void 0 !== _b ? _b : (null == style ? void 0 : style.height) || 0;
|
|
51
68
|
return position.includes("top") || position.includes("Top") ? -height : position.includes("middle") || position.includes("Middle") ? -height / 2 : 0;
|
|
52
69
|
}
|
|
53
|
-
initItem(itemContent,
|
|
70
|
+
initItem(itemContent, newPosition, newItemPosition) {
|
|
54
71
|
const {state: state} = this.attribute, {type: type = "text", symbolStyle: symbolStyle, richTextStyle: richTextStyle, imageStyle: imageStyle, renderCustomCallback: renderCustomCallback} = itemContent;
|
|
55
72
|
let item;
|
|
56
|
-
return "symbol" === type ? (item = vrender_core_1.graphicCreator.symbol(Object.assign(Object.assign({},
|
|
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({},
|
|
73
|
+
return "symbol" === type ? (item = vrender_core_1.graphicCreator.symbol(Object.assign(Object.assign({}, newItemPosition), symbolStyle)),
|
|
74
|
+
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({}, newItemPosition), {
|
|
58
75
|
state: {
|
|
59
76
|
panel: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.textBackground),
|
|
60
77
|
text: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.text)
|
|
61
78
|
}
|
|
62
|
-
})) : "richText" === type ? (item = vrender_core_1.graphicCreator.richtext(Object.assign(Object.assign({},
|
|
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({},
|
|
79
|
+
})) : "richText" === type ? (item = vrender_core_1.graphicCreator.richtext(Object.assign(Object.assign({}, newItemPosition), richTextStyle)),
|
|
80
|
+
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({}, newItemPosition), imageStyle)),
|
|
64
81
|
item.states = (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.image)) : "custom" === type && renderCustomCallback && (item = renderCustomCallback(),
|
|
65
82
|
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,
|
|
83
|
+
item.name = `mark-point-${type}`, this.setItemAttributes(item, itemContent, newPosition, newItemPosition, type),
|
|
67
84
|
item;
|
|
68
85
|
}
|
|
69
|
-
getItemLineAttr(itemLine,
|
|
70
|
-
let points = []
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
x:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
86
|
+
getItemLineAttr(itemLine, newPosition, newItemPosition) {
|
|
87
|
+
let points = [], center = {
|
|
88
|
+
x: 0,
|
|
89
|
+
y: 0
|
|
90
|
+
}, radius = 0, startAngle = 0, endAngle = 0;
|
|
91
|
+
const {type: type = "type-s", arcRatio: arcRatio = .8} = itemLine;
|
|
92
|
+
if (this._isArcLine) {
|
|
93
|
+
const {x: x1, y: y1} = newPosition, {x: x2, y: y2} = newItemPosition, x0 = (x1 + x2) / 2, y0 = (y1 + y2) / 2, k = y1 === y2 ? 0 : -(x1 - x2) / (y1 - y2), centerX = x0 + arcRatio * (y2 > y1 ? -1 : 1) * x0, centerY = (x => k * (x - x0) + y0)(centerX);
|
|
94
|
+
center = {
|
|
95
|
+
x: centerX,
|
|
96
|
+
y: centerY
|
|
97
|
+
}, startAngle = (0, util_1.deltaXYToAngle)(y1 - centerY, x1 - centerX), endAngle = (0,
|
|
98
|
+
util_1.deltaXYToAngle)(y2 - centerY, x2 - centerX), radius = Math.sqrt((centerX - x1) * (centerX - x1) + (centerY - y1) * (centerY - y1));
|
|
99
|
+
} else points = "type-do" === type ? [ newPosition, {
|
|
100
|
+
x: (newPosition.x + newItemPosition.x) / 2,
|
|
101
|
+
y: newItemPosition.y
|
|
102
|
+
}, newItemPosition ] : "type-po" === type ? [ newPosition, {
|
|
103
|
+
x: newItemPosition.x,
|
|
104
|
+
y: newPosition.y
|
|
105
|
+
}, newItemPosition ] : "type-op" === type ? [ newPosition, {
|
|
106
|
+
x: newPosition.x,
|
|
107
|
+
y: newItemPosition.y
|
|
108
|
+
}, newItemPosition ] : [ newPosition, newItemPosition ];
|
|
109
|
+
return points = (0, util_1.removeRepeatPoint)(points), {
|
|
110
|
+
points: points,
|
|
111
|
+
center: center,
|
|
112
|
+
radius: radius,
|
|
113
|
+
startAngle: startAngle,
|
|
114
|
+
endAngle: endAngle
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
reDrawLine(itemLine, pointsAttr) {
|
|
118
|
+
this._line.release();
|
|
119
|
+
const {startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle, type: type = "type-s"} = itemLine, {state: state} = this.attribute, lineConstructor = this._isArcLine ? segment_1.ArcSegment : segment_1.Segment;
|
|
120
|
+
this._container.removeChild(this._line), this._line = new lineConstructor(Object.assign(Object.assign({}, pointsAttr), {
|
|
121
|
+
pickable: !1,
|
|
122
|
+
startSymbol: startSymbol,
|
|
123
|
+
endSymbol: endSymbol,
|
|
124
|
+
lineStyle: lineStyle,
|
|
125
|
+
visible: itemLine.visible,
|
|
126
|
+
state: {
|
|
127
|
+
line: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.line),
|
|
128
|
+
startSymbol: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.lineStartSymbol),
|
|
129
|
+
endSymbol: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.lineEndSymbol)
|
|
130
|
+
}
|
|
131
|
+
})), this._container.add(this._line);
|
|
82
132
|
}
|
|
83
|
-
setItemLineAttr(itemLine,
|
|
133
|
+
setItemLineAttr(itemLine, newPosition, newItemPosition) {
|
|
84
134
|
if (this._line) {
|
|
85
|
-
const {startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle} = itemLine,
|
|
86
|
-
this._line.setAttributes({
|
|
87
|
-
points: points,
|
|
135
|
+
const {startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle, type: type = "type-s"} = itemLine, {state: state} = this.attribute, pointsAttr = this.getItemLineAttr(itemLine, newPosition, newItemPosition);
|
|
136
|
+
"type-arc" === type && "arc-segment" === this._line.key || "type-arc" !== type && "segment" === this._line.key ? this._line.setAttributes(Object.assign(Object.assign({}, pointsAttr), {
|
|
88
137
|
startSymbol: startSymbol,
|
|
89
138
|
endSymbol: endSymbol,
|
|
90
139
|
lineStyle: lineStyle,
|
|
91
|
-
visible: visible
|
|
92
|
-
|
|
140
|
+
visible: itemLine.visible,
|
|
141
|
+
state: {
|
|
142
|
+
line: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.line),
|
|
143
|
+
startSymbol: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.lineStartSymbol),
|
|
144
|
+
endSymbol: (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.lineEndSymbol)
|
|
145
|
+
}
|
|
146
|
+
})) : this.reDrawLine(itemLine, pointsAttr);
|
|
93
147
|
}
|
|
94
148
|
}
|
|
95
|
-
getDecorativeLineAttr(itemLine
|
|
149
|
+
getDecorativeLineAttr(itemLine) {
|
|
96
150
|
var _a;
|
|
97
151
|
const decorativeLength = (null === (_a = null == itemLine ? void 0 : itemLine.decorativeLine) || void 0 === _a ? void 0 : _a.length) || 10, itemAngle = this._line.getEndAngle() || 0;
|
|
98
152
|
return {
|
|
@@ -102,25 +156,34 @@ class MarkPoint extends base_1.Marker {
|
|
|
102
156
|
endPointOffsetY: -decorativeLength / 2 * Math.sin(itemAngle - Math.PI / 2)
|
|
103
157
|
};
|
|
104
158
|
}
|
|
105
|
-
setDecorativeLineAttr(itemLine,
|
|
159
|
+
setDecorativeLineAttr(itemLine, newItemPosition, visible) {
|
|
160
|
+
var _a;
|
|
106
161
|
if (this._decorativeLine) {
|
|
107
|
-
const {lineStyle: lineStyle} = itemLine, {startPointOffsetX: startPointOffsetX, startPointOffsetY: startPointOffsetY, endPointOffsetX: endPointOffsetX, endPointOffsetY: endPointOffsetY} = this.getDecorativeLineAttr(itemLine
|
|
162
|
+
const {lineStyle: lineStyle} = itemLine, {startPointOffsetX: startPointOffsetX, startPointOffsetY: startPointOffsetY, endPointOffsetX: endPointOffsetX, endPointOffsetY: endPointOffsetY} = this.getDecorativeLineAttr(itemLine);
|
|
108
163
|
this._decorativeLine.setAttributes(Object.assign(Object.assign({
|
|
109
164
|
points: [ {
|
|
110
|
-
x:
|
|
111
|
-
y:
|
|
165
|
+
x: newItemPosition.x + startPointOffsetX,
|
|
166
|
+
y: newItemPosition.y + startPointOffsetY
|
|
112
167
|
}, {
|
|
113
|
-
x:
|
|
114
|
-
y:
|
|
168
|
+
x: newItemPosition.x + endPointOffsetX,
|
|
169
|
+
y: newItemPosition.y + endPointOffsetY
|
|
115
170
|
} ]
|
|
116
171
|
}, lineStyle), {
|
|
117
172
|
visible: visible
|
|
118
|
-
}));
|
|
173
|
+
})), this._decorativeLine.states = (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null === (_a = this.attribute.state) || void 0 === _a ? void 0 : _a.line);
|
|
119
174
|
}
|
|
120
175
|
}
|
|
121
|
-
|
|
176
|
+
setTargetItemAttributes(targetItem, position) {
|
|
177
|
+
var _a, _b;
|
|
178
|
+
this._targetItem && (this._targetItem.setAttributes(Object.assign({
|
|
179
|
+
x: position.x,
|
|
180
|
+
y: position.y,
|
|
181
|
+
visible: null !== (_a = targetItem.visible) && void 0 !== _a && _a
|
|
182
|
+
}, targetItem.style)), this._targetItem.states = (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null === (_b = this.attribute.state) || void 0 === _b ? void 0 : _b.targetItem));
|
|
183
|
+
}
|
|
184
|
+
setAllOfItemsAttr(newPosition, newItemPosition) {
|
|
122
185
|
var _a;
|
|
123
|
-
const {position: position, itemLine: itemLine = {}, itemContent: itemContent = {}, limitRect: limitRect} = this.attribute, {type: type = "text", confine: confine} = itemContent;
|
|
186
|
+
const {position: position, itemLine: itemLine = {}, itemContent: itemContent = {}, limitRect: limitRect, targetSymbol: targetSymbol} = this.attribute, {type: type = "text", confine: confine} = itemContent;
|
|
124
187
|
if (limitRect && confine) {
|
|
125
188
|
const {x: x, y: y, width: width, height: height} = limitRect, {dx: dx, dy: dy} = (0,
|
|
126
189
|
limit_shape_1.computeOffsetForlimit)(this._item, {
|
|
@@ -129,40 +192,69 @@ class MarkPoint extends base_1.Marker {
|
|
|
129
192
|
x2: x + width,
|
|
130
193
|
y2: y + height
|
|
131
194
|
});
|
|
132
|
-
|
|
195
|
+
newItemPosition.x = newItemPosition.x + dx, newItemPosition.y = newItemPosition.y + dy;
|
|
133
196
|
}
|
|
134
|
-
this.
|
|
135
|
-
this.
|
|
197
|
+
this.setTargetItemAttributes(targetSymbol, position), this.setItemLineAttr(itemLine, newPosition, newItemPosition),
|
|
198
|
+
this.setItemAttributes(this._item, itemContent, newPosition, newItemPosition, type),
|
|
199
|
+
this.setDecorativeLineAttr(itemLine, newItemPosition, null === (_a = itemLine.decorativeLine) || void 0 === _a ? void 0 : _a.visible);
|
|
200
|
+
}
|
|
201
|
+
computeNewPositionAfterTargetItem(position) {
|
|
202
|
+
var _a;
|
|
203
|
+
const {itemContent: itemContent = {}, targetSymbol: targetSymbol} = this.attribute, {offsetX: itemContentOffsetX = 0, offsetY: itemContentOffsetY = 0} = itemContent, {offset: targetSymbolOffset = 0, style: targetSymbolStyle, visible: targetItemvisible = !1, size: targetSymbolSize} = targetSymbol, targetSize = targetItemvisible ? targetSymbolSize || (null !== (_a = targetSymbolStyle.size) && void 0 !== _a ? _a : 10) : 0, targetOffsetAngle = (0,
|
|
204
|
+
util_1.deltaXYToAngle)(itemContentOffsetY, itemContentOffsetX);
|
|
205
|
+
return {
|
|
206
|
+
newPosition: {
|
|
207
|
+
x: position.x + (targetSize + targetSymbolOffset) * Math.cos(targetOffsetAngle),
|
|
208
|
+
y: position.y + (targetSize + targetSymbolOffset) * Math.sin(targetOffsetAngle)
|
|
209
|
+
},
|
|
210
|
+
newItemPosition: {
|
|
211
|
+
x: position.x + (targetSize + targetSymbolOffset) * Math.cos(targetOffsetAngle) + itemContentOffsetX,
|
|
212
|
+
y: position.y + (targetSize + targetSymbolOffset) * Math.sin(targetOffsetAngle) + itemContentOffsetY
|
|
213
|
+
}
|
|
214
|
+
};
|
|
136
215
|
}
|
|
137
216
|
initMarker(container) {
|
|
138
|
-
const {position: position, itemContent: itemContent = {},
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}, line = new segment_1.Segment({
|
|
217
|
+
const {position: position, itemContent: itemContent = {}, itemLine: itemLine} = this.attribute, {type: itemLineType = "type-s", arcRatio: arcRatio = .8} = itemLine, {newPosition: newPosition, newItemPosition: newItemPosition} = this.computeNewPositionAfterTargetItem(position);
|
|
218
|
+
this._isArcLine = "type-arc" === itemLineType && 0 !== arcRatio && newPosition.x !== newItemPosition.x && newPosition.y !== newItemPosition.y;
|
|
219
|
+
const line = new (this._isArcLine ? segment_1.ArcSegment : segment_1.Segment)({
|
|
142
220
|
points: [],
|
|
143
221
|
pickable: !1,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
222
|
+
center: {
|
|
223
|
+
x: 0,
|
|
224
|
+
y: 0
|
|
225
|
+
},
|
|
226
|
+
radius: 0,
|
|
227
|
+
startAngle: 0,
|
|
228
|
+
endAngle: 0
|
|
149
229
|
});
|
|
150
230
|
line.name = "mark-point-line", this._line = line, container.add(line);
|
|
151
231
|
const decorativeLine = vrender_core_1.graphicCreator.line({
|
|
152
232
|
points: []
|
|
153
233
|
});
|
|
154
|
-
decorativeLine.states = (0, vutils_1.merge)({}, constant_1.DEFAULT_STATES, null == state ? void 0 : state.line),
|
|
155
234
|
decorativeLine.name = "mark-point-decorativeLine", this._decorativeLine = decorativeLine,
|
|
156
235
|
container.add(decorativeLine);
|
|
157
|
-
const
|
|
158
|
-
|
|
236
|
+
const targetItem = vrender_core_1.graphicCreator.symbol({});
|
|
237
|
+
targetItem.name = "mark-point-targetItem", this._targetItem = targetItem, container.add(this._targetItem);
|
|
238
|
+
const item = this.initItem(itemContent, newPosition, newItemPosition);
|
|
239
|
+
this._item = item, container.add(item), this.setAllOfItemsAttr(newPosition, newItemPosition);
|
|
159
240
|
}
|
|
160
241
|
updateMarker() {
|
|
161
|
-
const {position: position, itemContent: itemContent = {}} = this.attribute, {type: type = "text"} = itemContent,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
242
|
+
const {position: position, itemContent: itemContent = {}, itemLine: itemLine} = this.attribute, {type: type = "text"} = itemContent, {type: itemLineType = "type-s", arcRatio: arcRatio = .8} = itemLine, {newPosition: newPosition, newItemPosition: newItemPosition} = this.computeNewPositionAfterTargetItem(position), isArcLine = "type-arc" === itemLineType && 0 !== arcRatio && newPosition.x !== newItemPosition.x && newPosition.y !== newItemPosition.y;
|
|
243
|
+
isArcLine !== this._isArcLine ? (this._isArcLine = isArcLine, this.reDrawLine(itemLine, {
|
|
244
|
+
points: [ {
|
|
245
|
+
x: 0,
|
|
246
|
+
y: 0
|
|
247
|
+
} ],
|
|
248
|
+
pickable: !1,
|
|
249
|
+
center: {
|
|
250
|
+
x: 0,
|
|
251
|
+
y: 0
|
|
252
|
+
},
|
|
253
|
+
radius: 0,
|
|
254
|
+
startAngle: 0,
|
|
255
|
+
endAngle: 0
|
|
256
|
+
})) : this._isArcLine = isArcLine, this.setItemAttributes(this._item, itemContent, newPosition, newItemPosition, type),
|
|
257
|
+
this.setAllOfItemsAttr(newPosition, newItemPosition);
|
|
166
258
|
}
|
|
167
259
|
isValidPoints() {
|
|
168
260
|
const {position: position} = this.attribute;
|