@visactor/vrender-components 0.19.6-alpha.1 → 0.19.6-alpha.2
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/marker/common-line.js +1 -1
- package/cjs/marker/common-line.js.map +1 -1
- package/cjs/marker/config.js +4 -52
- package/cjs/marker/config.js.map +1 -1
- package/cjs/marker/line.js +9 -5
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/point.d.ts +3 -4
- package/cjs/marker/point.js +29 -34
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/type.d.ts +2 -8
- package/cjs/marker/type.js +4 -7
- package/cjs/marker/type.js.map +1 -1
- package/cjs/segment/arc-segment.js +4 -4
- package/cjs/segment/arc-segment.js.map +1 -1
- package/cjs/segment/segment.js +5 -5
- package/cjs/segment/segment.js.map +1 -1
- package/cjs/util/common.d.ts +2 -7
- package/cjs/util/common.js +7 -17
- package/cjs/util/common.js.map +1 -1
- package/dist/index.es.js +84 -158
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/marker/common-line.js +1 -1
- package/es/marker/common-line.js.map +1 -1
- package/es/marker/config.js +4 -52
- package/es/marker/config.js.map +1 -1
- package/es/marker/line.js +10 -4
- package/es/marker/line.js.map +1 -1
- package/es/marker/point.d.ts +3 -4
- package/es/marker/point.js +28 -31
- package/es/marker/point.js.map +1 -1
- package/es/marker/type.d.ts +2 -8
- package/es/marker/type.js +4 -7
- package/es/marker/type.js.map +1 -1
- package/es/segment/arc-segment.js +4 -4
- package/es/segment/arc-segment.js.map +1 -1
- package/es/segment/segment.js +5 -5
- package/es/segment/segment.js.map +1 -1
- package/es/util/common.d.ts +2 -7
- package/es/util/common.js +4 -14
- package/es/util/common.js.map +1 -1
- package/package.json +5 -5
package/dist/index.es.js
CHANGED
|
@@ -781,7 +781,7 @@ class Hook {
|
|
|
781
781
|
}
|
|
782
782
|
unTap(options, fn) {
|
|
783
783
|
const name = "string" == typeof options ? options.trim() : options.name;
|
|
784
|
-
name && (this.taps = this.taps.filter(tap => tap.name
|
|
784
|
+
name && (this.taps = this.taps.filter(tap => !(tap.name === name && (!fn || tap.fn === fn))));
|
|
785
785
|
}
|
|
786
786
|
_parseOptions(type, options, fn) {
|
|
787
787
|
let _options;
|
|
@@ -3452,7 +3452,7 @@ class Node extends EventEmitter {
|
|
|
3452
3452
|
if (!this._idMap.has(child._uid)) return null;
|
|
3453
3453
|
if (this._idMap.delete(child._uid), this._nodeList) {
|
|
3454
3454
|
const idx = this._nodeList.findIndex(n => n === child);
|
|
3455
|
-
idx
|
|
3455
|
+
idx >= 0 && this._nodeList.splice(idx, 1);
|
|
3456
3456
|
}
|
|
3457
3457
|
return child._prev ? child._prev._next = child._next : this._firstChild = child._next, child._next ? child._next._prev = child._prev : this._lastChild = child._prev, child.parent = null, child._prev = null, child._next = null, this._structEdit = !0, this.setCount(-child.count), child;
|
|
3458
3458
|
}
|
|
@@ -3461,6 +3461,7 @@ class Node extends EventEmitter {
|
|
|
3461
3461
|
}
|
|
3462
3462
|
removeAllChild(deep) {
|
|
3463
3463
|
if (!this._idMap) return;
|
|
3464
|
+
this._nodeList && (this._nodeList.length = 0);
|
|
3464
3465
|
let child = this._firstChild;
|
|
3465
3466
|
for (; child;) {
|
|
3466
3467
|
const next = child._next;
|
|
@@ -3727,7 +3728,7 @@ class FederatedEvent {
|
|
|
3727
3728
|
return !this.manager || this.path && this.path[this.path.length - 1] === this.target || (this.path = this.target ? this.manager.propagationPath(this.target) : []), this.composedDetailPath(), this.path;
|
|
3728
3729
|
}
|
|
3729
3730
|
composedDetailPath() {
|
|
3730
|
-
this.pickParams && this.pickParams.graphic
|
|
3731
|
+
return this.pickParams && this.pickParams.graphic ? (this.detailPath = this.path.slice(), this._composedDetailPath(this.pickParams)) : this.detailPath = this.path.slice(), this.detailPath;
|
|
3731
3732
|
}
|
|
3732
3733
|
_composedDetailPath(params) {
|
|
3733
3734
|
if (params && params.graphic) {
|
|
@@ -4497,7 +4498,7 @@ _defineProperty(ColorStore, "store1", {});
|
|
|
4497
4498
|
|
|
4498
4499
|
function colorArrayToString(color) {
|
|
4499
4500
|
let alphaChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
4500
|
-
return Array.isArray(color) ? alphaChannel ? `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])},${color[3].toFixed(2)})` : `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])})` : color;
|
|
4501
|
+
return Array.isArray(color) && isNumber(color[0]) ? alphaChannel ? `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])},${color[3].toFixed(2)})` : `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])})` : color;
|
|
4501
4502
|
}
|
|
4502
4503
|
function interpolateColor(from, to, ratio, alphaChannel, cb) {
|
|
4503
4504
|
if (!from || !to) return from && colorArrayToString(from) || to && colorArrayToString(to) || !1;
|
|
@@ -15541,33 +15542,14 @@ function removeRepeatPoint(points) {
|
|
|
15541
15542
|
}
|
|
15542
15543
|
return result;
|
|
15543
15544
|
}
|
|
15544
|
-
function
|
|
15545
|
-
return
|
|
15545
|
+
function isPostiveXAxisCartes(angle) {
|
|
15546
|
+
return angle > -Math.PI / 2 && angle < Math.PI / 2;
|
|
15546
15547
|
}
|
|
15547
|
-
function
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
function getTextAlignAttrOfVerticalDir(autoRotate, lineEndAngle, itemPosition) {
|
|
15551
|
-
if (autoRotate) {
|
|
15552
|
-
return {
|
|
15553
|
-
textAlign: 'right',
|
|
15554
|
-
textBaseline: 'middle'
|
|
15555
|
-
};
|
|
15548
|
+
function isPostiveXAxisPolar(angle, isReverse) {
|
|
15549
|
+
if (isReverse) {
|
|
15550
|
+
return (angle > 0 && angle < Math.PI / 2) || (angle < 0 && angle > -Math.PI * 2);
|
|
15556
15551
|
}
|
|
15557
|
-
return
|
|
15558
|
-
textAlign: (lineEndAngle < Math.PI && itemPosition.toLocaleLowerCase().includes('top')) ||
|
|
15559
|
-
(lineEndAngle > Math.PI && itemPosition.toLocaleLowerCase().includes('bottom'))
|
|
15560
|
-
? 'left'
|
|
15561
|
-
:
|
|
15562
|
-
(lineEndAngle < Math.PI && itemPosition.toLocaleLowerCase().includes('bottom')) ||
|
|
15563
|
-
(lineEndAngle > Math.PI && itemPosition.toLocaleLowerCase().includes('top'))
|
|
15564
|
-
? 'right'
|
|
15565
|
-
: 'center',
|
|
15566
|
-
textBaseline: (lineEndAngle < Math.PI && itemPosition.includes('inside')) ||
|
|
15567
|
-
(lineEndAngle > Math.PI && !itemPosition.includes('inside'))
|
|
15568
|
-
? 'bottom'
|
|
15569
|
-
: 'top'
|
|
15570
|
-
};
|
|
15552
|
+
return (angle > 0 && angle < Math.PI / 2) || (angle > (Math.PI * 3) / 2 && angle < Math.PI * 2);
|
|
15571
15553
|
}
|
|
15572
15554
|
|
|
15573
15555
|
const defaultAlternativeColors = ['#ffffff', '#000000'];
|
|
@@ -18852,18 +18834,10 @@ function loadArcSegmentComponent() {
|
|
|
18852
18834
|
loadSegmentComponent();
|
|
18853
18835
|
class Segment extends AbstractComponent {
|
|
18854
18836
|
getStartAngle() {
|
|
18855
|
-
return this._startAngle
|
|
18856
|
-
? this._startAngle + Math.PI * 2
|
|
18857
|
-
: this._startAngle > Math.PI * 2
|
|
18858
|
-
? this._startAngle - Math.PI * 2
|
|
18859
|
-
: this._startAngle;
|
|
18837
|
+
return this._startAngle;
|
|
18860
18838
|
}
|
|
18861
18839
|
getEndAngle() {
|
|
18862
|
-
return this._endAngle
|
|
18863
|
-
? this._endAngle + Math.PI * 2
|
|
18864
|
-
: this._endAngle > Math.PI * 2
|
|
18865
|
-
? this._endAngle - Math.PI * 2
|
|
18866
|
-
: this._endAngle;
|
|
18840
|
+
return this._endAngle;
|
|
18867
18841
|
}
|
|
18868
18842
|
getMainSegmentPoints() {
|
|
18869
18843
|
return this._mainSegmentPoints;
|
|
@@ -18938,8 +18912,8 @@ class Segment extends AbstractComponent {
|
|
|
18938
18912
|
const { autoRotate = true } = attribute;
|
|
18939
18913
|
let symbol;
|
|
18940
18914
|
if (attribute && attribute.visible) {
|
|
18941
|
-
const startAngle = this.
|
|
18942
|
-
const endAngle = this.
|
|
18915
|
+
const startAngle = this._startAngle;
|
|
18916
|
+
const endAngle = this._endAngle;
|
|
18943
18917
|
const { state } = this.attribute;
|
|
18944
18918
|
const start = points[0];
|
|
18945
18919
|
const end = points[points.length - 1];
|
|
@@ -18953,14 +18927,14 @@ class Segment extends AbstractComponent {
|
|
|
18953
18927
|
y: start.y +
|
|
18954
18928
|
(isValidNumber(startAngle) ? refX * Math.sin(startAngle) + refY * Math.sin(startAngle - Math.PI / 2) : 0)
|
|
18955
18929
|
};
|
|
18956
|
-
rotate = this._computeStartRotate(
|
|
18930
|
+
rotate = this._computeStartRotate(startAngle);
|
|
18957
18931
|
}
|
|
18958
18932
|
else {
|
|
18959
18933
|
position = {
|
|
18960
18934
|
x: end.x + (isValidNumber(endAngle) ? refX * Math.cos(endAngle) + refY * Math.cos(endAngle - Math.PI / 2) : 0),
|
|
18961
18935
|
y: end.y + (isValidNumber(endAngle) ? refX * Math.sin(endAngle) + refY * Math.sin(endAngle - Math.PI / 2) : 0)
|
|
18962
18936
|
};
|
|
18963
|
-
rotate = this._computeEndRotate(
|
|
18937
|
+
rotate = this._computeEndRotate(endAngle);
|
|
18964
18938
|
}
|
|
18965
18939
|
symbol = graphicCreator.symbol(Object.assign(Object.assign(Object.assign({}, position), { symbolType: symbolType, size, angle: autoRotate ? rotate + refAngle : 0, strokeBoundsBuffer: 0 }), style));
|
|
18966
18940
|
symbol.name = `${this.name}-${dim}-symbol`;
|
|
@@ -19090,12 +19064,12 @@ class ArcSegment extends Segment {
|
|
|
19090
19064
|
this.isReverseArc = false;
|
|
19091
19065
|
}
|
|
19092
19066
|
getStartAngle() {
|
|
19093
|
-
const
|
|
19094
|
-
return
|
|
19067
|
+
const startAngle = this.isReverseArc ? this._startAngle + Math.PI / 2 : this._startAngle - Math.PI / 2;
|
|
19068
|
+
return startAngle > Math.PI * 2 ? startAngle - Math.PI * 2 : startAngle;
|
|
19095
19069
|
}
|
|
19096
19070
|
getEndAngle() {
|
|
19097
|
-
const
|
|
19098
|
-
return
|
|
19071
|
+
const endAngle = this.isReverseArc ? this._endAngle - Math.PI / 2 : this._endAngle + Math.PI / 2;
|
|
19072
|
+
return endAngle > Math.PI * 2 ? endAngle - Math.PI * 2 : endAngle;
|
|
19099
19073
|
}
|
|
19100
19074
|
getMainSegmentPoints() {
|
|
19101
19075
|
return this._mainSegmentPoints;
|
|
@@ -22692,18 +22666,12 @@ DataZoom.defaultAttributes = DEFAULT_DATA_ZOOM_ATTRIBUTES;
|
|
|
22692
22666
|
var IMarkLineLabelPosition;
|
|
22693
22667
|
(function (IMarkLineLabelPosition) {
|
|
22694
22668
|
IMarkLineLabelPosition["start"] = "start";
|
|
22695
|
-
IMarkLineLabelPosition["
|
|
22696
|
-
IMarkLineLabelPosition["
|
|
22697
|
-
IMarkLineLabelPosition["insideStart"] = "insideStart";
|
|
22669
|
+
IMarkLineLabelPosition["middle"] = "middle";
|
|
22670
|
+
IMarkLineLabelPosition["end"] = "end";
|
|
22698
22671
|
IMarkLineLabelPosition["insideStartTop"] = "insideStartTop";
|
|
22699
22672
|
IMarkLineLabelPosition["insideStartBottom"] = "insideStartBottom";
|
|
22700
|
-
IMarkLineLabelPosition["middle"] = "middle";
|
|
22701
22673
|
IMarkLineLabelPosition["insideMiddleTop"] = "insideMiddleTop";
|
|
22702
22674
|
IMarkLineLabelPosition["insideMiddleBottom"] = "insideMiddleBottom";
|
|
22703
|
-
IMarkLineLabelPosition["end"] = "end";
|
|
22704
|
-
IMarkLineLabelPosition["endTop"] = "endTop";
|
|
22705
|
-
IMarkLineLabelPosition["endBottom"] = "endBottom";
|
|
22706
|
-
IMarkLineLabelPosition["insideEnd"] = "insideEnd";
|
|
22707
22675
|
IMarkLineLabelPosition["insideEndTop"] = "insideEndTop";
|
|
22708
22676
|
IMarkLineLabelPosition["insideEndBottom"] = "insideEndBottom";
|
|
22709
22677
|
})(IMarkLineLabelPosition || (IMarkLineLabelPosition = {}));
|
|
@@ -23209,9 +23177,7 @@ class MarkCommonLine extends Marker {
|
|
|
23209
23177
|
const { label = {}, limitRect } = this.attribute;
|
|
23210
23178
|
const { position, confine, autoRotate } = label;
|
|
23211
23179
|
const labelPoint = this.getPointAttrByPosition(position);
|
|
23212
|
-
const labelAngle =
|
|
23213
|
-
? this._line.getStartAngle() || 0
|
|
23214
|
-
: this._line.getEndAngle() || 0;
|
|
23180
|
+
const labelAngle = this._line.getEndAngle() || 0;
|
|
23215
23181
|
this._label.setAttributes(Object.assign(Object.assign({}, labelPoint.position), { angle: autoRotate ? this.getRotateByAngle(labelPoint.angle) : 0, textStyle: Object.assign(Object.assign({}, this.getTextStyle(position, labelAngle, autoRotate)), label.textStyle) }));
|
|
23216
23182
|
if (limitRect && confine) {
|
|
23217
23183
|
const { x, y, width, height } = limitRect;
|
|
@@ -23297,27 +23263,15 @@ const DEFAULT_MARK_LINE_THEME = {
|
|
|
23297
23263
|
const DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP = {
|
|
23298
23264
|
postiveXAxis: {
|
|
23299
23265
|
start: {
|
|
23300
|
-
textAlign: 'left',
|
|
23301
|
-
textBaseline: 'middle'
|
|
23302
|
-
},
|
|
23303
|
-
startTop: {
|
|
23304
|
-
textAlign: 'left',
|
|
23305
|
-
textBaseline: 'bottom'
|
|
23306
|
-
},
|
|
23307
|
-
startBottom: {
|
|
23308
|
-
textAlign: 'left',
|
|
23309
|
-
textBaseline: 'top'
|
|
23310
|
-
},
|
|
23311
|
-
insideStart: {
|
|
23312
23266
|
textAlign: 'right',
|
|
23313
23267
|
textBaseline: 'middle'
|
|
23314
23268
|
},
|
|
23315
23269
|
insideStartTop: {
|
|
23316
|
-
textAlign: '
|
|
23270
|
+
textAlign: 'left',
|
|
23317
23271
|
textBaseline: 'bottom'
|
|
23318
23272
|
},
|
|
23319
23273
|
insideStartBottom: {
|
|
23320
|
-
textAlign: '
|
|
23274
|
+
textAlign: 'left',
|
|
23321
23275
|
textBaseline: 'top'
|
|
23322
23276
|
},
|
|
23323
23277
|
middle: {
|
|
@@ -23336,18 +23290,6 @@ const DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP = {
|
|
|
23336
23290
|
textAlign: 'left',
|
|
23337
23291
|
textBaseline: 'middle'
|
|
23338
23292
|
},
|
|
23339
|
-
endTop: {
|
|
23340
|
-
textAlign: 'left',
|
|
23341
|
-
textBaseline: 'bottom'
|
|
23342
|
-
},
|
|
23343
|
-
endBottom: {
|
|
23344
|
-
textAlign: 'left',
|
|
23345
|
-
textBaseline: 'top'
|
|
23346
|
-
},
|
|
23347
|
-
insideEnd: {
|
|
23348
|
-
textAlign: 'right',
|
|
23349
|
-
textBaseline: 'middle'
|
|
23350
|
-
},
|
|
23351
23293
|
insideEndTop: {
|
|
23352
23294
|
textAlign: 'right',
|
|
23353
23295
|
textBaseline: 'bottom'
|
|
@@ -23359,27 +23301,15 @@ const DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP = {
|
|
|
23359
23301
|
},
|
|
23360
23302
|
negativeXAxis: {
|
|
23361
23303
|
start: {
|
|
23362
|
-
textAlign: 'right',
|
|
23363
|
-
textBaseline: 'middle'
|
|
23364
|
-
},
|
|
23365
|
-
startTop: {
|
|
23366
|
-
textAlign: 'right',
|
|
23367
|
-
textBaseline: 'bottom'
|
|
23368
|
-
},
|
|
23369
|
-
startBottom: {
|
|
23370
|
-
textAlign: 'right',
|
|
23371
|
-
textBaseline: 'top'
|
|
23372
|
-
},
|
|
23373
|
-
insideStart: {
|
|
23374
23304
|
textAlign: 'left',
|
|
23375
23305
|
textBaseline: 'middle'
|
|
23376
23306
|
},
|
|
23377
23307
|
insideStartTop: {
|
|
23378
|
-
textAlign: '
|
|
23308
|
+
textAlign: 'right',
|
|
23379
23309
|
textBaseline: 'bottom'
|
|
23380
23310
|
},
|
|
23381
23311
|
insideStartBottom: {
|
|
23382
|
-
textAlign: '
|
|
23312
|
+
textAlign: 'right',
|
|
23383
23313
|
textBaseline: 'top'
|
|
23384
23314
|
},
|
|
23385
23315
|
middle: {
|
|
@@ -23398,18 +23328,6 @@ const DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP = {
|
|
|
23398
23328
|
textAlign: 'right',
|
|
23399
23329
|
textBaseline: 'middle'
|
|
23400
23330
|
},
|
|
23401
|
-
endTop: {
|
|
23402
|
-
textAlign: 'right',
|
|
23403
|
-
textBaseline: 'bottom'
|
|
23404
|
-
},
|
|
23405
|
-
endBottom: {
|
|
23406
|
-
textAlign: 'right',
|
|
23407
|
-
textBaseline: 'top'
|
|
23408
|
-
},
|
|
23409
|
-
insideEnd: {
|
|
23410
|
-
textAlign: 'left',
|
|
23411
|
-
textBaseline: 'middle'
|
|
23412
|
-
},
|
|
23413
23331
|
insideEndTop: {
|
|
23414
23332
|
textAlign: 'left',
|
|
23415
23333
|
textBaseline: 'bottom'
|
|
@@ -23723,7 +23641,7 @@ class MarkLine extends MarkCommonLine {
|
|
|
23723
23641
|
const { refX = 0, refY = 0 } = label;
|
|
23724
23642
|
const points = this._line.getMainSegmentPoints();
|
|
23725
23643
|
const lineEndAngle = (_a = this._line.getEndAngle()) !== null && _a !== void 0 ? _a : 0;
|
|
23726
|
-
const labelAngle =
|
|
23644
|
+
const labelAngle = isPostiveXAxisCartes(lineEndAngle) ? lineEndAngle : lineEndAngle;
|
|
23727
23645
|
const labelOffsetX = refX * Math.cos(labelAngle) + refY * Math.cos(labelAngle - Math.PI / 2);
|
|
23728
23646
|
const labelOffsetY = refX * Math.sin(labelAngle) + refY * Math.sin(labelAngle - Math.PI / 2);
|
|
23729
23647
|
if (position.includes('start') || position.includes('Start')) {
|
|
@@ -23754,15 +23672,25 @@ class MarkLine extends MarkCommonLine {
|
|
|
23754
23672
|
}
|
|
23755
23673
|
getRotateByAngle(angle) {
|
|
23756
23674
|
var _a;
|
|
23757
|
-
const itemAngle =
|
|
23675
|
+
const itemAngle = isPostiveXAxisCartes(angle) ? angle : angle - Math.PI;
|
|
23758
23676
|
return itemAngle + ((_a = this.attribute.label.refAngle) !== null && _a !== void 0 ? _a : 0);
|
|
23759
23677
|
}
|
|
23760
23678
|
getTextStyle(position, labelAngle, autoRotate) {
|
|
23761
|
-
if (
|
|
23762
|
-
|
|
23763
|
-
|
|
23679
|
+
if (Math.abs(Math.abs(labelAngle) - Math.PI / 2) < 0.0001) {
|
|
23680
|
+
if (autoRotate) {
|
|
23681
|
+
return {
|
|
23682
|
+
textAlign: 'right',
|
|
23683
|
+
textBaseline: 'middle'
|
|
23684
|
+
};
|
|
23685
|
+
}
|
|
23686
|
+
return {
|
|
23687
|
+
textAlign: 'center',
|
|
23688
|
+
textBaseline: (labelAngle > 0 && position.includes('inside')) || (labelAngle < 0 && !position.includes('inside'))
|
|
23689
|
+
? 'bottom'
|
|
23690
|
+
: 'top'
|
|
23691
|
+
};
|
|
23764
23692
|
}
|
|
23765
|
-
if (
|
|
23693
|
+
if (isPostiveXAxisCartes(labelAngle)) {
|
|
23766
23694
|
return DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP.postiveXAxis[position];
|
|
23767
23695
|
}
|
|
23768
23696
|
return DEFAULT_CARTESIAN_MARK_LINE_TEXT_STYLE_MAP.negativeXAxis[position];
|
|
@@ -24181,7 +24109,6 @@ loadMarkPointComponent();
|
|
|
24181
24109
|
function registerMarkPointAnimate() {
|
|
24182
24110
|
MarkPoint._animate = markPointAnimate;
|
|
24183
24111
|
}
|
|
24184
|
-
const FUZZY_EQUAL_DELTA = 0.001;
|
|
24185
24112
|
class MarkPoint extends Marker {
|
|
24186
24113
|
markerAnimate(state) {
|
|
24187
24114
|
if (MarkPoint._animate && this._animationConfig) {
|
|
@@ -24194,16 +24121,18 @@ class MarkPoint extends Marker {
|
|
|
24194
24121
|
this.defaultUpdateAnimation = DefaultUpdateMarkPointAnimation;
|
|
24195
24122
|
this.defaultExitAnimation = DefaultExitMarkerAnimation;
|
|
24196
24123
|
this._isArcLine = false;
|
|
24197
|
-
this._isStraightLine = false;
|
|
24198
24124
|
}
|
|
24199
24125
|
setLabelPos() {
|
|
24200
24126
|
}
|
|
24201
24127
|
getTextAlignAttr(autoRotate, offsetX, offsetY, lineEndAngle, itemPosition) {
|
|
24202
|
-
|
|
24203
|
-
|
|
24204
|
-
|
|
24128
|
+
let isPostiveXAxis = true;
|
|
24129
|
+
if (this._isArcLine) {
|
|
24130
|
+
isPostiveXAxis = isPostiveXAxisPolar(lineEndAngle, this._line.isReverseArc);
|
|
24131
|
+
}
|
|
24132
|
+
else {
|
|
24133
|
+
isPostiveXAxis = isPostiveXAxisCartes(lineEndAngle);
|
|
24205
24134
|
}
|
|
24206
|
-
if (isPostiveXAxis
|
|
24135
|
+
if (isPostiveXAxis) {
|
|
24207
24136
|
return DEFAULT_MARK_POINT_TEXT_STYLE_MAP.postiveXAxis[itemPosition];
|
|
24208
24137
|
}
|
|
24209
24138
|
return DEFAULT_MARK_POINT_TEXT_STYLE_MAP.negativeXAxis[itemPosition];
|
|
@@ -24216,8 +24145,8 @@ class MarkPoint extends Marker {
|
|
|
24216
24145
|
const { autoRotate = true, refX = 0, refY = 0, refAngle = 0, textStyle = {}, richTextStyle = {}, imageStyle = {}, position: positionType = IMarkPointItemPosition.middle } = itemContent;
|
|
24217
24146
|
const { state } = this.attribute;
|
|
24218
24147
|
const lineEndAngle = ((_a = this._line) === null || _a === void 0 ? void 0 : _a.getEndAngle()) || 0;
|
|
24219
|
-
const itemRefOffsetX = refX * Math.cos(lineEndAngle) + refY * Math.cos(lineEndAngle
|
|
24220
|
-
const itemRefOffsetY = refX * Math.sin(lineEndAngle) + refY * Math.sin(lineEndAngle
|
|
24148
|
+
const itemRefOffsetX = refX * Math.cos(lineEndAngle) + refY * Math.cos(lineEndAngle);
|
|
24149
|
+
const itemRefOffsetY = refX * Math.sin(lineEndAngle) + refY * Math.sin(lineEndAngle);
|
|
24221
24150
|
if (itemType === 'text') {
|
|
24222
24151
|
const offsetX = newItemPosition.x - newPosition.x;
|
|
24223
24152
|
const offsetY = newItemPosition.y - newPosition.y;
|
|
@@ -24240,7 +24169,16 @@ class MarkPoint extends Marker {
|
|
|
24240
24169
|
});
|
|
24241
24170
|
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.image);
|
|
24242
24171
|
}
|
|
24243
|
-
|
|
24172
|
+
let isPostiveXAxis = true;
|
|
24173
|
+
let itemAngle;
|
|
24174
|
+
if (this._isArcLine) {
|
|
24175
|
+
isPostiveXAxis = isPostiveXAxisPolar(lineEndAngle, this._line.isReverseArc);
|
|
24176
|
+
itemAngle = isPostiveXAxis ? lineEndAngle : lineEndAngle - Math.PI;
|
|
24177
|
+
}
|
|
24178
|
+
else {
|
|
24179
|
+
isPostiveXAxis = isPostiveXAxisCartes(lineEndAngle);
|
|
24180
|
+
itemAngle = isPostiveXAxis ? lineEndAngle : lineEndAngle - Math.PI;
|
|
24181
|
+
}
|
|
24244
24182
|
item.setAttributes({
|
|
24245
24183
|
x: newItemPosition.x + (itemRefOffsetX || 0),
|
|
24246
24184
|
y: newItemPosition.y + (itemRefOffsetY || 0),
|
|
@@ -24306,10 +24244,6 @@ class MarkPoint extends Marker {
|
|
|
24306
24244
|
let startAngle = 0;
|
|
24307
24245
|
let endAngle = 0;
|
|
24308
24246
|
const { type = 'type-s', arcRatio = 0.8 } = itemLine;
|
|
24309
|
-
const itemOffsetX = newItemPosition.x - newPosition.x;
|
|
24310
|
-
const itemOffsetY = newItemPosition.y - newPosition.y;
|
|
24311
|
-
this._isStraightLine =
|
|
24312
|
-
fuzzyEqualNumber(itemOffsetX, 0, FUZZY_EQUAL_DELTA) || fuzzyEqualNumber(itemOffsetY, 0, FUZZY_EQUAL_DELTA);
|
|
24313
24247
|
if (this._isArcLine) {
|
|
24314
24248
|
const { x: x1, y: y1 } = newPosition;
|
|
24315
24249
|
const { x: x2, y: y2 } = newItemPosition;
|
|
@@ -24321,22 +24255,12 @@ class MarkPoint extends Marker {
|
|
|
24321
24255
|
const deltaX = arcRatio * direction * x0;
|
|
24322
24256
|
const centerX = x0 + deltaX;
|
|
24323
24257
|
const centerY = line(centerX);
|
|
24258
|
+
center = { x: centerX, y: centerY };
|
|
24324
24259
|
startAngle = deltaXYToAngle(y1 - centerY, x1 - centerX);
|
|
24325
24260
|
endAngle = deltaXYToAngle(y2 - centerY, x2 - centerX);
|
|
24326
|
-
center = { x: centerX, y: centerY };
|
|
24327
|
-
if (arcRatio > 0) {
|
|
24328
|
-
if (endAngle < startAngle) {
|
|
24329
|
-
endAngle += Math.PI * 2;
|
|
24330
|
-
}
|
|
24331
|
-
}
|
|
24332
|
-
else {
|
|
24333
|
-
if (startAngle < endAngle) {
|
|
24334
|
-
startAngle += Math.PI * 2;
|
|
24335
|
-
}
|
|
24336
|
-
}
|
|
24337
24261
|
radius = Math.sqrt((centerX - x1) * (centerX - x1) + (centerY - y1) * (centerY - y1));
|
|
24338
24262
|
}
|
|
24339
|
-
else if (type === 'type-do'
|
|
24263
|
+
else if (type === 'type-do') {
|
|
24340
24264
|
points = [
|
|
24341
24265
|
newPosition,
|
|
24342
24266
|
{
|
|
@@ -24346,7 +24270,7 @@ class MarkPoint extends Marker {
|
|
|
24346
24270
|
newItemPosition
|
|
24347
24271
|
];
|
|
24348
24272
|
}
|
|
24349
|
-
else if (type === 'type-po'
|
|
24273
|
+
else if (type === 'type-po') {
|
|
24350
24274
|
points = [
|
|
24351
24275
|
newPosition,
|
|
24352
24276
|
{
|
|
@@ -24356,7 +24280,7 @@ class MarkPoint extends Marker {
|
|
|
24356
24280
|
newItemPosition
|
|
24357
24281
|
];
|
|
24358
24282
|
}
|
|
24359
|
-
else if (type === 'type-op'
|
|
24283
|
+
else if (type === 'type-op') {
|
|
24360
24284
|
points = [
|
|
24361
24285
|
newPosition,
|
|
24362
24286
|
{
|
|
@@ -24398,7 +24322,8 @@ class MarkPoint extends Marker {
|
|
|
24398
24322
|
const { startSymbol, endSymbol, lineStyle, type = 'type-s' } = itemLine;
|
|
24399
24323
|
const { state } = this.attribute;
|
|
24400
24324
|
const pointsAttr = this.getItemLineAttr(itemLine, newPosition, newItemPosition);
|
|
24401
|
-
if ((
|
|
24325
|
+
if ((type === 'type-arc' && this._line.key === 'arc-segment') ||
|
|
24326
|
+
(type !== 'type-arc' && this._line.key === 'segment')) {
|
|
24402
24327
|
this._line.setAttributes(Object.assign(Object.assign({}, pointsAttr), { startSymbol,
|
|
24403
24328
|
endSymbol,
|
|
24404
24329
|
lineStyle, visible: itemLine.visible, state: {
|
|
@@ -24480,23 +24405,24 @@ class MarkPoint extends Marker {
|
|
|
24480
24405
|
const targetSize = targetItemvisible ? targetSymbolSize || ((_a = targetSymbolStyle.size) !== null && _a !== void 0 ? _a : 10) : 0;
|
|
24481
24406
|
const targetOffsetAngle = deltaXYToAngle(itemContentOffsetY, itemContentOffsetX);
|
|
24482
24407
|
const newPosition = {
|
|
24483
|
-
x: position.x + (targetSize
|
|
24484
|
-
y: position.y + (targetSize
|
|
24408
|
+
x: position.x + (targetSize + targetSymbolOffset) * Math.cos(targetOffsetAngle),
|
|
24409
|
+
y: position.y + (targetSize + targetSymbolOffset) * Math.sin(targetOffsetAngle)
|
|
24485
24410
|
};
|
|
24486
24411
|
const newItemPosition = {
|
|
24487
|
-
x: position.x + (targetSize
|
|
24488
|
-
y: position.y + (targetSize
|
|
24412
|
+
x: position.x + (targetSize + targetSymbolOffset) * Math.cos(targetOffsetAngle) + itemContentOffsetX,
|
|
24413
|
+
y: position.y + (targetSize + targetSymbolOffset) * Math.sin(targetOffsetAngle) + itemContentOffsetY
|
|
24489
24414
|
};
|
|
24490
24415
|
return { newPosition, newItemPosition };
|
|
24491
24416
|
}
|
|
24492
24417
|
initMarker(container) {
|
|
24493
24418
|
const { position, itemContent = {}, itemLine } = this.attribute;
|
|
24494
24419
|
const { type: itemLineType = 'type-s', arcRatio = 0.8 } = itemLine;
|
|
24495
|
-
const { offsetX = 0, offsetY = 0 } = itemContent;
|
|
24496
|
-
this._isStraightLine =
|
|
24497
|
-
fuzzyEqualNumber(offsetX, 0, FUZZY_EQUAL_DELTA) || fuzzyEqualNumber(offsetY, 0, FUZZY_EQUAL_DELTA);
|
|
24498
|
-
this._isArcLine = itemLineType === 'type-arc' && arcRatio !== 0 && !this._isStraightLine;
|
|
24499
24420
|
const { newPosition, newItemPosition } = this.computeNewPositionAfterTargetItem(position);
|
|
24421
|
+
this._isArcLine =
|
|
24422
|
+
itemLineType === 'type-arc' &&
|
|
24423
|
+
arcRatio !== 0 &&
|
|
24424
|
+
newPosition.x !== newItemPosition.x &&
|
|
24425
|
+
newPosition.y !== newItemPosition.y;
|
|
24500
24426
|
const lineConstructor = this._isArcLine ? ArcSegment : Segment;
|
|
24501
24427
|
const line = new lineConstructor({
|
|
24502
24428
|
points: [],
|
|
@@ -24528,11 +24454,11 @@ class MarkPoint extends Marker {
|
|
|
24528
24454
|
const { position, itemContent = {}, itemLine } = this.attribute;
|
|
24529
24455
|
const { type = 'text' } = itemContent;
|
|
24530
24456
|
const { type: itemLineType = 'type-s', arcRatio = 0.8 } = itemLine;
|
|
24531
|
-
const { offsetX = 0, offsetY = 0 } = itemContent;
|
|
24532
|
-
this._isStraightLine =
|
|
24533
|
-
fuzzyEqualNumber(offsetX, 0, FUZZY_EQUAL_DELTA) || fuzzyEqualNumber(offsetY, 0, FUZZY_EQUAL_DELTA);
|
|
24534
|
-
const isArcLine = itemLineType === 'type-arc' && arcRatio !== 0 && !this._isStraightLine;
|
|
24535
24457
|
const { newPosition, newItemPosition } = this.computeNewPositionAfterTargetItem(position);
|
|
24458
|
+
const isArcLine = itemLineType === 'type-arc' &&
|
|
24459
|
+
arcRatio !== 0 &&
|
|
24460
|
+
newPosition.x !== newItemPosition.x &&
|
|
24461
|
+
newPosition.y !== newItemPosition.y;
|
|
24536
24462
|
if (isArcLine !== this._isArcLine) {
|
|
24537
24463
|
this._isArcLine = isArcLine;
|
|
24538
24464
|
this.reDrawLine(itemLine, {
|
|
@@ -29426,6 +29352,6 @@ Radio.defaultAttributes = {
|
|
|
29426
29352
|
}
|
|
29427
29353
|
};
|
|
29428
29354
|
|
|
29429
|
-
const version = "0.19.6-alpha.
|
|
29355
|
+
const version = "0.19.6-alpha.2";
|
|
29430
29356
|
|
|
29431
|
-
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AreaLabel, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, GroupFadeIn, GroupFadeOut, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineDataLabel, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Title, Tooltip, VTag, angle, angleLabelOrientAttribute, angleTo, clampRadian, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, direction,
|
|
29357
|
+
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AreaLabel, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, GroupFadeIn, GroupFadeOut, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineDataLabel, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Title, Tooltip, VTag, angle, angleLabelOrientAttribute, angleTo, clampRadian, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, direction, getCircleLabelPosition, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getSizeHandlerPath, getTextType, getVerticalCoord, getVerticalPath, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxisCartes, isPostiveXAxisPolar, isRichText, isVisible, labelSmartInvert, length, loadPoptip, measureTextSize, normalize, reactAttributeTransform, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, ticks, traverseGroup, version };
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.19.6-alpha.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.19.6-alpha.2\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './util';\n"]}
|
package/es/marker/common-line.js
CHANGED
|
@@ -22,7 +22,7 @@ export class MarkCommonLine extends Marker {
|
|
|
22
22
|
return this._label;
|
|
23
23
|
}
|
|
24
24
|
setLabelPos() {
|
|
25
|
-
const {label: label = {}, limitRect: limitRect} = this.attribute, {position: position, confine: confine, autoRotate: autoRotate} = label, labelPoint = this.getPointAttrByPosition(position), labelAngle =
|
|
25
|
+
const {label: label = {}, limitRect: limitRect} = this.attribute, {position: position, confine: confine, autoRotate: autoRotate} = label, labelPoint = this.getPointAttrByPosition(position), labelAngle = this._line.getEndAngle() || 0;
|
|
26
26
|
if (this._label.setAttributes(Object.assign(Object.assign({}, labelPoint.position), {
|
|
27
27
|
angle: autoRotate ? this.getRotateByAngle(labelPoint.angle) : 0,
|
|
28
28
|
textStyle: Object.assign(Object.assign({}, this.getTextStyle(position, labelAngle, autoRotate)), label.textStyle)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marker/common-line.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAIzC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AAE/F,MAAM,OAAgB,cAAwC,SAAQ,MAGrE;IAHD;;QAIE,SAAI,GAAG,gBAAgB,CAAC;QAIxB,2BAAsB,GAAG,8BAA8B,CAAC;QACxD,yBAAoB,GAAG,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/marker/common-line.ts"],"names":[],"mappings":"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","file":"common-line.js","sourcesContent":["import type { IGroup, INode } from '@visactor/vrender-core';\nimport { merge } from '@visactor/vutils';\nimport type { ArcSegment, Segment } from '../segment';\nimport type { TagAttributes } from '../tag';\n// eslint-disable-next-line no-duplicate-imports\nimport { Tag } from '../tag';\nimport type { MarkCommonLineAnimationType, MarkCommonLineAttrs, MarkerAnimationState } from './type';\nimport { limitShapeInBounds } from '../util/limit-shape';\nimport { DEFAULT_STATES } from '../constant';\nimport { Marker } from './base';\nimport { DefaultExitMarkerAnimation, DefaultUpdateMarkLineAnimation } from './animate/animate';\n\nexport abstract class MarkCommonLine<LineAttr, LabelPosition> extends Marker<\n MarkCommonLineAttrs<LineAttr, LabelPosition, MarkCommonLineAnimationType>,\n MarkCommonLineAnimationType\n> {\n name = 'markCommonLine';\n\n /** animate */\n static _animate?: (line: Segment | ArcSegment, label: Tag, animationConfig: any, state: MarkerAnimationState) => void;\n defaultUpdateAnimation = DefaultUpdateMarkLineAnimation;\n defaultExitAnimation = DefaultExitMarkerAnimation;\n\n protected _line!: Segment | ArcSegment;\n protected abstract createSegment(): any;\n protected abstract setLineAttributes(): any;\n protected abstract getPointAttrByPosition(position: any): any;\n protected abstract getRotateByAngle(angle: number): number;\n protected abstract getTextStyle(position: any, labelAngle: number, autoRotate: boolean): any;\n protected abstract markerAnimate(state: MarkerAnimationState): void;\n\n getLine() {\n return this._line;\n }\n getLabel() {\n return this._label;\n }\n\n protected setLabelPos(): void {\n const { label = {}, limitRect } = this.attribute;\n const { position, confine, autoRotate } = label;\n const labelPoint = this.getPointAttrByPosition(position);\n const labelAngle = this._line.getEndAngle() || 0;\n this._label.setAttributes({\n ...labelPoint.position,\n angle: autoRotate ? this.getRotateByAngle(labelPoint.angle) : 0,\n textStyle: {\n ...this.getTextStyle(position, labelAngle, autoRotate),\n ...label.textStyle\n }\n });\n if (limitRect && confine) {\n const { x, y, width, height } = limitRect;\n limitShapeInBounds(this._label, {\n x1: x,\n y1: y,\n x2: x + width,\n y2: y + height\n });\n }\n }\n\n protected initMarker(container: IGroup) {\n const { label, state } = this.attribute as MarkCommonLineAttrs<\n LineAttr,\n LabelPosition,\n MarkCommonLineAnimationType\n >;\n const line = this.createSegment();\n line.name = 'mark-common-line-line';\n this._line = line;\n container.add(line as unknown as INode);\n\n const markLabel = new Tag({\n ...(label as TagAttributes),\n state: {\n panel: merge({}, DEFAULT_STATES, state?.labelBackground),\n text: merge({}, DEFAULT_STATES, state?.label)\n }\n });\n markLabel.name = 'mark-common-line-label';\n this._label = markLabel;\n container.add(markLabel as unknown as INode);\n this.setLabelPos();\n }\n\n protected updateMarker() {\n const { label, state } = this.attribute as MarkCommonLineAttrs<\n LineAttr,\n LabelPosition,\n MarkCommonLineAnimationType\n >;\n\n this.setLineAttributes();\n\n if (this._label) {\n this._label.setAttributes({\n dx: 0,\n dy: 0, // 需要进行复位\n ...(label as TagAttributes),\n state: {\n panel: merge({}, DEFAULT_STATES, state?.labelBackground),\n text: merge({}, DEFAULT_STATES, state?.label)\n }\n });\n this.setLabelPos();\n }\n }\n}\n"]}
|