@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/es/marker/line.js
CHANGED
|
@@ -12,6 +12,8 @@ import { DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP, DEFAULT_MARK_LINE_THEME } f
|
|
|
12
12
|
|
|
13
13
|
import { markCommonLineAnimate } from "./animate/animate";
|
|
14
14
|
|
|
15
|
+
import { isPostiveXAxisCartes } from "../util";
|
|
16
|
+
|
|
15
17
|
loadMarkLineComponent();
|
|
16
18
|
|
|
17
19
|
export function registerMarkLineAnimate() {
|
|
@@ -28,7 +30,8 @@ export class MarkLine extends MarkCommonLine {
|
|
|
28
30
|
}
|
|
29
31
|
getPointAttrByPosition(position) {
|
|
30
32
|
var _a;
|
|
31
|
-
const {label: label = {}} = this.attribute, {refX: refX = 0, refY: refY = 0} = label, points = this._line.getMainSegmentPoints(),
|
|
33
|
+
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 = (isPostiveXAxisCartes(lineEndAngle),
|
|
34
|
+
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);
|
|
32
35
|
return position.includes("start") || position.includes("Start") ? {
|
|
33
36
|
position: {
|
|
34
37
|
x: points[0].x + labelOffsetX,
|
|
@@ -51,10 +54,16 @@ export class MarkLine extends MarkCommonLine {
|
|
|
51
54
|
}
|
|
52
55
|
getRotateByAngle(angle) {
|
|
53
56
|
var _a;
|
|
54
|
-
return angle + (null !== (_a = this.attribute.label.refAngle) && void 0 !== _a ? _a : 0);
|
|
57
|
+
return (isPostiveXAxisCartes(angle) ? angle : angle - Math.PI) + (null !== (_a = this.attribute.label.refAngle) && void 0 !== _a ? _a : 0);
|
|
55
58
|
}
|
|
56
|
-
getTextStyle(position) {
|
|
57
|
-
return
|
|
59
|
+
getTextStyle(position, labelAngle, autoRotate) {
|
|
60
|
+
return Math.abs(Math.abs(labelAngle) - Math.PI / 2) < 1e-4 ? autoRotate ? {
|
|
61
|
+
textAlign: "right",
|
|
62
|
+
textBaseline: "middle"
|
|
63
|
+
} : {
|
|
64
|
+
textAlign: "center",
|
|
65
|
+
textBaseline: labelAngle > 0 && position.includes("inside") || labelAngle < 0 && !position.includes("inside") ? "bottom" : "top"
|
|
66
|
+
} : isPostiveXAxisCartes(labelAngle) ? DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP.postiveXAxis[position] : DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP.negativeXAxis[position];
|
|
58
67
|
}
|
|
59
68
|
createSegment() {
|
|
60
69
|
const {points: points, startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle, mainSegmentIndex: mainSegmentIndex, multiSegment: multiSegment, state: state} = this.attribute;
|
|
@@ -74,14 +83,19 @@ export class MarkLine extends MarkCommonLine {
|
|
|
74
83
|
});
|
|
75
84
|
}
|
|
76
85
|
setLineAttributes() {
|
|
77
|
-
const {points: points, startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle, mainSegmentIndex: mainSegmentIndex, multiSegment: multiSegment} = this.attribute;
|
|
86
|
+
const {points: points, startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle, mainSegmentIndex: mainSegmentIndex, multiSegment: multiSegment, state: state} = this.attribute;
|
|
78
87
|
this._line && this._line.setAttributes({
|
|
79
88
|
points: points,
|
|
80
89
|
startSymbol: startSymbol,
|
|
81
90
|
endSymbol: endSymbol,
|
|
82
91
|
lineStyle: lineStyle,
|
|
83
92
|
mainSegmentIndex: mainSegmentIndex,
|
|
84
|
-
multiSegment: multiSegment
|
|
93
|
+
multiSegment: multiSegment,
|
|
94
|
+
state: {
|
|
95
|
+
line: merge({}, DEFAULT_STATES, null == state ? void 0 : state.line),
|
|
96
|
+
startSymbol: merge({}, DEFAULT_STATES, null == state ? void 0 : state.lineStartSymbol),
|
|
97
|
+
endSymbol: merge({}, DEFAULT_STATES, null == state ? void 0 : state.lineEndSymbol)
|
|
98
|
+
}
|
|
85
99
|
});
|
|
86
100
|
}
|
|
87
101
|
isValidPoints() {
|
package/es/marker/line.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAKxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,0CAA0C,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAE/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,qBAAqB,EAAE,CAAC;AAExB,MAAM,UAAU,uBAAuB;IACrC,QAAQ,CAAC,QAAQ,GAAG,qBAAqB,CAAC;AAC5C,CAAC;AAED,MAAM,OAAO,QAAS,SAAQ,cAA6D;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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AAC,EAAE;wBACpE,SAAS,GAAG,KAAK,CAAC;wBAClB,OAAO;qBACR;gBACH,CAAC,CAAC,CAAC;aACJ;iBAAM,IAAI,CAAC,aAAa,CAAE,KAAe,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAE,KAAe,CAAC,CAAC,CAAC,EAAE;gBACnF,SAAS,GAAG,KAAK,CAAC;gBAClB,OAAO;aACR;QACH,CAAC,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACnB,CAAC;;AA/GM,0BAAiB,GAA2B,uBAAmD,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,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAKxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,0CAA0C,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAE/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,qBAAqB,EAAE,CAAC;AAExB,MAAM,UAAU,uBAAuB;IACrC,QAAQ,CAAC,QAAQ,GAAG,qBAAqB,CAAC;AAC5C,CAAC;AAED,MAAM,OAAO,QAAS,SAAQ,cAA6D;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,K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aAAa,CAAE,CAAW,CAAC,CAAC,CAAC,EAAE;wBACpE,SAAS,GAAG,KAAK,CAAC;wBAClB,OAAO;qBACR;gBACH,CAAC,CAAC,CAAC;aACJ;iBAAM,IAAI,CAAC,aAAa,CAAE,KAAe,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAE,KAAe,CAAC,CAAC,CAAC,EAAE;gBACnF,SAAS,GAAG,KAAK,CAAC;gBAClB,OAAO;aACR;QACH,CAAC,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACnB,CAAC;;AA1IM,0BAAiB,GAA2B,uBAAmD,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/es/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/es/marker/point.js
CHANGED
|
@@ -2,7 +2,7 @@ import { graphicCreator } from "@visactor/vrender-core";
|
|
|
2
2
|
|
|
3
3
|
import { isValidNumber, merge } from "@visactor/vutils";
|
|
4
4
|
|
|
5
|
-
import { Segment } from "../segment";
|
|
5
|
+
import { ArcSegment, Segment } from "../segment";
|
|
6
6
|
|
|
7
7
|
import { Tag } from "../tag";
|
|
8
8
|
|
|
@@ -20,6 +20,8 @@ import { DEFAULT_STATES } from "../constant";
|
|
|
20
20
|
|
|
21
21
|
import { DefaultExitMarkerAnimation, DefaultUpdateMarkPointAnimation, markPointAnimate } from "./animate/animate";
|
|
22
22
|
|
|
23
|
+
import { deltaXYToAngle, isPostiveXAxisCartes, isPostiveXAxisPolar, removeRepeatPoint } from "../util";
|
|
24
|
+
|
|
23
25
|
loadMarkPointComponent();
|
|
24
26
|
|
|
25
27
|
export function registerMarkPointAnimate() {
|
|
@@ -33,24 +35,40 @@ export class MarkPoint extends Marker {
|
|
|
33
35
|
constructor(attributes, options) {
|
|
34
36
|
super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, MarkPoint.defaultAttributes, attributes)),
|
|
35
37
|
this.name = "markPoint", this.defaultUpdateAnimation = DefaultUpdateMarkPointAnimation,
|
|
36
|
-
this.defaultExitAnimation = DefaultExitMarkerAnimation;
|
|
38
|
+
this.defaultExitAnimation = DefaultExitMarkerAnimation, this._isArcLine = !1;
|
|
37
39
|
}
|
|
38
40
|
setLabelPos() {}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
getTextAlignAttr(autoRotate, offsetX, offsetY, lineEndAngle, itemPosition) {
|
|
42
|
+
let isPostiveXAxis = !0;
|
|
43
|
+
return isPostiveXAxis = this._isArcLine ? isPostiveXAxisPolar(lineEndAngle, this._line.isReverseArc) : isPostiveXAxisCartes(lineEndAngle),
|
|
44
|
+
isPostiveXAxis ? DEFAULT_MARK_POINT_TEXT_STYLE_MAP.postiveXAxis[itemPosition] : DEFAULT_MARK_POINT_TEXT_STYLE_MAP.negativeXAxis[itemPosition];
|
|
45
|
+
}
|
|
46
|
+
setItemAttributes(item, itemContent, newPosition, newItemPosition, itemType) {
|
|
47
|
+
var _a, _b;
|
|
41
48
|
if (!item) return;
|
|
42
|
-
const {autoRotate: autoRotate = !0, refX: refX = 0, refY: refY = 0, refAngle: refAngle = 0, textStyle: textStyle = {}, richTextStyle: richTextStyle = {}, imageStyle: imageStyle = {}, position:
|
|
43
|
-
"text" === itemType
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
const {autoRotate: autoRotate = !0, refX: refX = 0, refY: refY = 0, refAngle: refAngle = 0, textStyle: textStyle = {}, richTextStyle: richTextStyle = {}, imageStyle: imageStyle = {}, position: positionType = 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);
|
|
50
|
+
if ("text" === itemType) {
|
|
51
|
+
const offsetX = newItemPosition.x - newPosition.x, offsetY = newItemPosition.y - newPosition.y;
|
|
52
|
+
item.setAttributes(Object.assign(Object.assign({}, textStyle), {
|
|
53
|
+
textStyle: Object.assign(Object.assign({}, this.getTextAlignAttr(autoRotate, offsetX, offsetY, lineEndAngle, null !== (_b = itemContent.position) && void 0 !== _b ? _b : "end")), textStyle.textStyle),
|
|
54
|
+
state: {
|
|
55
|
+
panel: merge({}, DEFAULT_STATES, null == state ? void 0 : state.textBackground),
|
|
56
|
+
text: merge({}, DEFAULT_STATES, null == state ? void 0 : state.text)
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
} else "richText" === itemType ? (item.setAttributes({
|
|
60
|
+
dx: this.getItemDx(item, positionType, richTextStyle) + (richTextStyle.dx || 0),
|
|
61
|
+
dy: this.getItemDy(item, positionType, richTextStyle) + (richTextStyle.dy || 0)
|
|
62
|
+
}), item.states = merge({}, DEFAULT_STATES, null == state ? void 0 : state.richText)) : "image" === itemType && (item.setAttributes({
|
|
63
|
+
dx: this.getItemDx(item, positionType, imageStyle) + (imageStyle.dx || 0),
|
|
64
|
+
dy: this.getItemDy(item, positionType, imageStyle) + (imageStyle.dy || 0)
|
|
65
|
+
}), item.states = merge({}, DEFAULT_STATES, null == state ? void 0 : state.image));
|
|
66
|
+
let itemAngle, isPostiveXAxis = !0;
|
|
67
|
+
this._isArcLine ? (isPostiveXAxis = isPostiveXAxisPolar(lineEndAngle, this._line.isReverseArc),
|
|
68
|
+
itemAngle = isPostiveXAxis ? lineEndAngle : lineEndAngle - Math.PI) : (isPostiveXAxis = isPostiveXAxisCartes(lineEndAngle),
|
|
69
|
+
itemAngle = isPostiveXAxis ? lineEndAngle : lineEndAngle - Math.PI), item.setAttributes({
|
|
70
|
+
x: newItemPosition.x + (itemRefOffsetX || 0),
|
|
71
|
+
y: newItemPosition.y + (itemRefOffsetY || 0),
|
|
54
72
|
angle: autoRotate && itemAngle + refAngle
|
|
55
73
|
});
|
|
56
74
|
}
|
|
@@ -64,49 +82,86 @@ export class MarkPoint extends Marker {
|
|
|
64
82
|
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;
|
|
65
83
|
return position.includes("top") || position.includes("Top") ? -height : position.includes("middle") || position.includes("Middle") ? -height / 2 : 0;
|
|
66
84
|
}
|
|
67
|
-
initItem(itemContent,
|
|
85
|
+
initItem(itemContent, newPosition, newItemPosition) {
|
|
68
86
|
const {state: state} = this.attribute, {type: type = "text", symbolStyle: symbolStyle, richTextStyle: richTextStyle, imageStyle: imageStyle, renderCustomCallback: renderCustomCallback} = itemContent;
|
|
69
87
|
let item;
|
|
70
|
-
return "symbol" === type ? (item = graphicCreator.symbol(Object.assign(Object.assign({},
|
|
71
|
-
item.states = merge({}, DEFAULT_STATES, null == state ? void 0 : state.symbol)) : "text" === type ? item = new Tag(Object.assign(Object.assign({},
|
|
88
|
+
return "symbol" === type ? (item = graphicCreator.symbol(Object.assign(Object.assign({}, newItemPosition), symbolStyle)),
|
|
89
|
+
item.states = merge({}, DEFAULT_STATES, null == state ? void 0 : state.symbol)) : "text" === type ? item = new Tag(Object.assign(Object.assign({}, newItemPosition), {
|
|
72
90
|
state: {
|
|
73
91
|
panel: merge({}, DEFAULT_STATES, null == state ? void 0 : state.textBackground),
|
|
74
92
|
text: merge({}, DEFAULT_STATES, null == state ? void 0 : state.text)
|
|
75
93
|
}
|
|
76
|
-
})) : "richText" === type ? (item = graphicCreator.richtext(Object.assign(Object.assign({},
|
|
77
|
-
item.states = merge({}, DEFAULT_STATES, null == state ? void 0 : state.richText)) : "image" === type ? (item = graphicCreator.image(Object.assign(Object.assign({},
|
|
94
|
+
})) : "richText" === type ? (item = graphicCreator.richtext(Object.assign(Object.assign({}, newItemPosition), richTextStyle)),
|
|
95
|
+
item.states = merge({}, DEFAULT_STATES, null == state ? void 0 : state.richText)) : "image" === type ? (item = graphicCreator.image(Object.assign(Object.assign({}, newItemPosition), imageStyle)),
|
|
78
96
|
item.states = merge({}, DEFAULT_STATES, null == state ? void 0 : state.image)) : "custom" === type && renderCustomCallback && (item = renderCustomCallback(),
|
|
79
97
|
item.states = merge({}, DEFAULT_STATES, null == state ? void 0 : state.customMark)),
|
|
80
|
-
item.name = `mark-point-${type}`, this.setItemAttributes(item, itemContent,
|
|
98
|
+
item.name = `mark-point-${type}`, this.setItemAttributes(item, itemContent, newPosition, newItemPosition, type),
|
|
81
99
|
item;
|
|
82
100
|
}
|
|
83
|
-
getItemLineAttr(itemLine,
|
|
84
|
-
let points = []
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
x:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
101
|
+
getItemLineAttr(itemLine, newPosition, newItemPosition) {
|
|
102
|
+
let points = [], center = {
|
|
103
|
+
x: 0,
|
|
104
|
+
y: 0
|
|
105
|
+
}, radius = 0, startAngle = 0, endAngle = 0;
|
|
106
|
+
const {type: type = "type-s", arcRatio: arcRatio = .8} = itemLine;
|
|
107
|
+
if (this._isArcLine) {
|
|
108
|
+
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);
|
|
109
|
+
center = {
|
|
110
|
+
x: centerX,
|
|
111
|
+
y: centerY
|
|
112
|
+
}, startAngle = deltaXYToAngle(y1 - centerY, x1 - centerX), endAngle = deltaXYToAngle(y2 - centerY, x2 - centerX),
|
|
113
|
+
radius = Math.sqrt((centerX - x1) * (centerX - x1) + (centerY - y1) * (centerY - y1));
|
|
114
|
+
} else points = "type-do" === type ? [ newPosition, {
|
|
115
|
+
x: (newPosition.x + newItemPosition.x) / 2,
|
|
116
|
+
y: newItemPosition.y
|
|
117
|
+
}, newItemPosition ] : "type-po" === type ? [ newPosition, {
|
|
118
|
+
x: newItemPosition.x,
|
|
119
|
+
y: newPosition.y
|
|
120
|
+
}, newItemPosition ] : "type-op" === type ? [ newPosition, {
|
|
121
|
+
x: newPosition.x,
|
|
122
|
+
y: newItemPosition.y
|
|
123
|
+
}, newItemPosition ] : [ newPosition, newItemPosition ];
|
|
124
|
+
return points = removeRepeatPoint(points), {
|
|
125
|
+
points: points,
|
|
126
|
+
center: center,
|
|
127
|
+
radius: radius,
|
|
128
|
+
startAngle: startAngle,
|
|
129
|
+
endAngle: endAngle
|
|
130
|
+
};
|
|
96
131
|
}
|
|
97
|
-
|
|
132
|
+
reDrawLine(itemLine, pointsAttr) {
|
|
133
|
+
this._line.release();
|
|
134
|
+
const {startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle, type: type = "type-s"} = itemLine, {state: state} = this.attribute, lineConstructor = this._isArcLine ? ArcSegment : Segment;
|
|
135
|
+
this._container.removeChild(this._line), this._line = new lineConstructor(Object.assign(Object.assign({}, pointsAttr), {
|
|
136
|
+
pickable: !1,
|
|
137
|
+
startSymbol: startSymbol,
|
|
138
|
+
endSymbol: endSymbol,
|
|
139
|
+
lineStyle: lineStyle,
|
|
140
|
+
visible: itemLine.visible,
|
|
141
|
+
state: {
|
|
142
|
+
line: merge({}, DEFAULT_STATES, null == state ? void 0 : state.line),
|
|
143
|
+
startSymbol: merge({}, DEFAULT_STATES, null == state ? void 0 : state.lineStartSymbol),
|
|
144
|
+
endSymbol: merge({}, DEFAULT_STATES, null == state ? void 0 : state.lineEndSymbol)
|
|
145
|
+
}
|
|
146
|
+
})), this._container.add(this._line);
|
|
147
|
+
}
|
|
148
|
+
setItemLineAttr(itemLine, newPosition, newItemPosition) {
|
|
98
149
|
if (this._line) {
|
|
99
|
-
const {startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle} = itemLine,
|
|
100
|
-
this._line.setAttributes({
|
|
101
|
-
points: points,
|
|
150
|
+
const {startSymbol: startSymbol, endSymbol: endSymbol, lineStyle: lineStyle, type: type = "type-s"} = itemLine, {state: state} = this.attribute, pointsAttr = this.getItemLineAttr(itemLine, newPosition, newItemPosition);
|
|
151
|
+
"type-arc" === type && "arc-segment" === this._line.key || "type-arc" !== type && "segment" === this._line.key ? this._line.setAttributes(Object.assign(Object.assign({}, pointsAttr), {
|
|
102
152
|
startSymbol: startSymbol,
|
|
103
153
|
endSymbol: endSymbol,
|
|
104
154
|
lineStyle: lineStyle,
|
|
105
|
-
visible: visible
|
|
106
|
-
|
|
155
|
+
visible: itemLine.visible,
|
|
156
|
+
state: {
|
|
157
|
+
line: merge({}, DEFAULT_STATES, null == state ? void 0 : state.line),
|
|
158
|
+
startSymbol: merge({}, DEFAULT_STATES, null == state ? void 0 : state.lineStartSymbol),
|
|
159
|
+
endSymbol: merge({}, DEFAULT_STATES, null == state ? void 0 : state.lineEndSymbol)
|
|
160
|
+
}
|
|
161
|
+
})) : this.reDrawLine(itemLine, pointsAttr);
|
|
107
162
|
}
|
|
108
163
|
}
|
|
109
|
-
getDecorativeLineAttr(itemLine
|
|
164
|
+
getDecorativeLineAttr(itemLine) {
|
|
110
165
|
var _a;
|
|
111
166
|
const decorativeLength = (null === (_a = null == itemLine ? void 0 : itemLine.decorativeLine) || void 0 === _a ? void 0 : _a.length) || 10, itemAngle = this._line.getEndAngle() || 0;
|
|
112
167
|
return {
|
|
@@ -116,25 +171,34 @@ export class MarkPoint extends Marker {
|
|
|
116
171
|
endPointOffsetY: -decorativeLength / 2 * Math.sin(itemAngle - Math.PI / 2)
|
|
117
172
|
};
|
|
118
173
|
}
|
|
119
|
-
setDecorativeLineAttr(itemLine,
|
|
174
|
+
setDecorativeLineAttr(itemLine, newItemPosition, visible) {
|
|
175
|
+
var _a;
|
|
120
176
|
if (this._decorativeLine) {
|
|
121
|
-
const {lineStyle: lineStyle} = itemLine, {startPointOffsetX: startPointOffsetX, startPointOffsetY: startPointOffsetY, endPointOffsetX: endPointOffsetX, endPointOffsetY: endPointOffsetY} = this.getDecorativeLineAttr(itemLine
|
|
177
|
+
const {lineStyle: lineStyle} = itemLine, {startPointOffsetX: startPointOffsetX, startPointOffsetY: startPointOffsetY, endPointOffsetX: endPointOffsetX, endPointOffsetY: endPointOffsetY} = this.getDecorativeLineAttr(itemLine);
|
|
122
178
|
this._decorativeLine.setAttributes(Object.assign(Object.assign({
|
|
123
179
|
points: [ {
|
|
124
|
-
x:
|
|
125
|
-
y:
|
|
180
|
+
x: newItemPosition.x + startPointOffsetX,
|
|
181
|
+
y: newItemPosition.y + startPointOffsetY
|
|
126
182
|
}, {
|
|
127
|
-
x:
|
|
128
|
-
y:
|
|
183
|
+
x: newItemPosition.x + endPointOffsetX,
|
|
184
|
+
y: newItemPosition.y + endPointOffsetY
|
|
129
185
|
} ]
|
|
130
186
|
}, lineStyle), {
|
|
131
187
|
visible: visible
|
|
132
|
-
}));
|
|
188
|
+
})), this._decorativeLine.states = merge({}, DEFAULT_STATES, null === (_a = this.attribute.state) || void 0 === _a ? void 0 : _a.line);
|
|
133
189
|
}
|
|
134
190
|
}
|
|
135
|
-
|
|
191
|
+
setTargetItemAttributes(targetItem, position) {
|
|
192
|
+
var _a, _b;
|
|
193
|
+
this._targetItem && (this._targetItem.setAttributes(Object.assign({
|
|
194
|
+
x: position.x,
|
|
195
|
+
y: position.y,
|
|
196
|
+
visible: null !== (_a = targetItem.visible) && void 0 !== _a && _a
|
|
197
|
+
}, targetItem.style)), this._targetItem.states = merge({}, DEFAULT_STATES, null === (_b = this.attribute.state) || void 0 === _b ? void 0 : _b.targetItem));
|
|
198
|
+
}
|
|
199
|
+
setAllOfItemsAttr(newPosition, newItemPosition) {
|
|
136
200
|
var _a;
|
|
137
|
-
const {position: position, itemLine: itemLine = {}, itemContent: itemContent = {}, limitRect: limitRect} = this.attribute, {type: type = "text", confine: confine} = itemContent;
|
|
201
|
+
const {position: position, itemLine: itemLine = {}, itemContent: itemContent = {}, limitRect: limitRect, targetSymbol: targetSymbol} = this.attribute, {type: type = "text", confine: confine} = itemContent;
|
|
138
202
|
if (limitRect && confine) {
|
|
139
203
|
const {x: x, y: y, width: width, height: height} = limitRect, {dx: dx, dy: dy} = computeOffsetForlimit(this._item, {
|
|
140
204
|
x1: x,
|
|
@@ -142,40 +206,68 @@ export class MarkPoint extends Marker {
|
|
|
142
206
|
x2: x + width,
|
|
143
207
|
y2: y + height
|
|
144
208
|
});
|
|
145
|
-
|
|
209
|
+
newItemPosition.x = newItemPosition.x + dx, newItemPosition.y = newItemPosition.y + dy;
|
|
146
210
|
}
|
|
147
|
-
this.
|
|
148
|
-
this.
|
|
211
|
+
this.setTargetItemAttributes(targetSymbol, position), this.setItemLineAttr(itemLine, newPosition, newItemPosition),
|
|
212
|
+
this.setItemAttributes(this._item, itemContent, newPosition, newItemPosition, type),
|
|
213
|
+
this.setDecorativeLineAttr(itemLine, newItemPosition, null === (_a = itemLine.decorativeLine) || void 0 === _a ? void 0 : _a.visible);
|
|
214
|
+
}
|
|
215
|
+
computeNewPositionAfterTargetItem(position) {
|
|
216
|
+
var _a;
|
|
217
|
+
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 = deltaXYToAngle(itemContentOffsetY, itemContentOffsetX);
|
|
218
|
+
return {
|
|
219
|
+
newPosition: {
|
|
220
|
+
x: position.x + (targetSize + targetSymbolOffset) * Math.cos(targetOffsetAngle),
|
|
221
|
+
y: position.y + (targetSize + targetSymbolOffset) * Math.sin(targetOffsetAngle)
|
|
222
|
+
},
|
|
223
|
+
newItemPosition: {
|
|
224
|
+
x: position.x + (targetSize + targetSymbolOffset) * Math.cos(targetOffsetAngle) + itemContentOffsetX,
|
|
225
|
+
y: position.y + (targetSize + targetSymbolOffset) * Math.sin(targetOffsetAngle) + itemContentOffsetY
|
|
226
|
+
}
|
|
227
|
+
};
|
|
149
228
|
}
|
|
150
229
|
initMarker(container) {
|
|
151
|
-
const {position: position, itemContent: itemContent = {},
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}, line = new Segment({
|
|
230
|
+
const {position: position, itemContent: itemContent = {}, itemLine: itemLine} = this.attribute, {type: itemLineType = "type-s", arcRatio: arcRatio = .8} = itemLine, {newPosition: newPosition, newItemPosition: newItemPosition} = this.computeNewPositionAfterTargetItem(position);
|
|
231
|
+
this._isArcLine = "type-arc" === itemLineType && 0 !== arcRatio && newPosition.x !== newItemPosition.x && newPosition.y !== newItemPosition.y;
|
|
232
|
+
const line = new (this._isArcLine ? ArcSegment : Segment)({
|
|
155
233
|
points: [],
|
|
156
234
|
pickable: !1,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
235
|
+
center: {
|
|
236
|
+
x: 0,
|
|
237
|
+
y: 0
|
|
238
|
+
},
|
|
239
|
+
radius: 0,
|
|
240
|
+
startAngle: 0,
|
|
241
|
+
endAngle: 0
|
|
162
242
|
});
|
|
163
243
|
line.name = "mark-point-line", this._line = line, container.add(line);
|
|
164
244
|
const decorativeLine = graphicCreator.line({
|
|
165
245
|
points: []
|
|
166
246
|
});
|
|
167
|
-
decorativeLine.states = merge({}, DEFAULT_STATES, null == state ? void 0 : state.line),
|
|
168
247
|
decorativeLine.name = "mark-point-decorativeLine", this._decorativeLine = decorativeLine,
|
|
169
248
|
container.add(decorativeLine);
|
|
170
|
-
const
|
|
171
|
-
|
|
249
|
+
const targetItem = graphicCreator.symbol({});
|
|
250
|
+
targetItem.name = "mark-point-targetItem", this._targetItem = targetItem, container.add(this._targetItem);
|
|
251
|
+
const item = this.initItem(itemContent, newPosition, newItemPosition);
|
|
252
|
+
this._item = item, container.add(item), this.setAllOfItemsAttr(newPosition, newItemPosition);
|
|
172
253
|
}
|
|
173
254
|
updateMarker() {
|
|
174
|
-
const {position: position, itemContent: itemContent = {}} = this.attribute, {type: type = "text"} = itemContent,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
255
|
+
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;
|
|
256
|
+
isArcLine !== this._isArcLine ? (this._isArcLine = isArcLine, this.reDrawLine(itemLine, {
|
|
257
|
+
points: [ {
|
|
258
|
+
x: 0,
|
|
259
|
+
y: 0
|
|
260
|
+
} ],
|
|
261
|
+
pickable: !1,
|
|
262
|
+
center: {
|
|
263
|
+
x: 0,
|
|
264
|
+
y: 0
|
|
265
|
+
},
|
|
266
|
+
radius: 0,
|
|
267
|
+
startAngle: 0,
|
|
268
|
+
endAngle: 0
|
|
269
|
+
})) : this._isArcLine = isArcLine, this.setItemAttributes(this._item, itemContent, newPosition, newItemPosition, type),
|
|
270
|
+
this.setAllOfItemsAttr(newPosition, newItemPosition);
|
|
179
271
|
}
|
|
180
272
|
isValidPoints() {
|
|
181
273
|
const {position: position} = this.attribute;
|