@visactor/vrender-components 0.15.0 → 0.15.1
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/label/arc.d.ts +5 -2
- package/cjs/label/arc.js +23 -37
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.js +8 -8
- package/cjs/label/base.js.map +1 -1
- package/cjs/legend/size/size.d.ts +2 -2
- package/cjs/legend/size/size.js.map +1 -1
- package/cjs/marker/area.d.ts +1 -20
- package/cjs/marker/area.js +37 -37
- package/cjs/marker/area.js.map +1 -1
- package/cjs/marker/base.d.ts +1 -0
- package/cjs/marker/base.js +28 -18
- package/cjs/marker/base.js.map +1 -1
- package/cjs/marker/config.d.ts +1 -1
- package/cjs/marker/config.js.map +1 -1
- package/cjs/marker/line.js +31 -16
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/point.d.ts +7 -7
- package/cjs/marker/point.js +5 -4
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/type.d.ts +8 -5
- package/cjs/marker/type.js.map +1 -1
- package/cjs/marker/util.d.ts +1 -0
- package/cjs/marker/util.js +3 -0
- package/cjs/marker/util.js.map +1 -0
- package/cjs/segment/segment.d.ts +11 -6
- package/cjs/segment/segment.js +82 -40
- package/cjs/segment/segment.js.map +1 -1
- package/cjs/segment/type.d.ts +5 -3
- package/cjs/segment/type.js.map +1 -1
- package/cjs/util/index.d.ts +1 -1
- package/cjs/util/index.js +1 -1
- package/cjs/util/index.js.map +1 -1
- package/cjs/util/{labelSmartInvert.js → label-smartInvert.js} +1 -1
- package/cjs/util/label-smartInvert.js.map +1 -0
- package/cjs/util/limit-shape.d.ts +3 -0
- package/cjs/util/limit-shape.js +14 -0
- package/cjs/util/limit-shape.js.map +1 -0
- package/dist/index.js +288 -181
- package/dist/index.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/label/arc.d.ts +5 -2
- package/es/label/arc.js +23 -36
- package/es/label/arc.js.map +1 -1
- package/es/label/base.js +1 -1
- package/es/label/base.js.map +1 -1
- package/es/legend/size/size.d.ts +2 -2
- package/es/legend/size/size.js.map +1 -1
- package/es/marker/area.d.ts +1 -20
- package/es/marker/area.js +38 -36
- package/es/marker/area.js.map +1 -1
- package/es/marker/base.d.ts +1 -0
- package/es/marker/base.js +27 -19
- package/es/marker/base.js.map +1 -1
- package/es/marker/config.d.ts +1 -1
- package/es/marker/config.js.map +1 -1
- package/es/marker/line.js +32 -15
- package/es/marker/line.js.map +1 -1
- package/es/marker/point.d.ts +7 -7
- package/es/marker/point.js +5 -4
- package/es/marker/point.js.map +1 -1
- package/es/marker/type.d.ts +8 -5
- package/es/marker/type.js.map +1 -1
- package/es/marker/util.d.ts +1 -0
- package/es/marker/util.js +3 -0
- package/es/marker/util.js.map +1 -0
- package/es/segment/segment.d.ts +11 -6
- package/es/segment/segment.js +81 -41
- package/es/segment/segment.js.map +1 -1
- package/es/segment/type.d.ts +5 -3
- package/es/segment/type.js.map +1 -1
- package/es/util/index.d.ts +1 -1
- package/es/util/index.js +1 -1
- package/es/util/index.js.map +1 -1
- package/es/util/{labelSmartInvert.js → label-smartInvert.js} +1 -1
- package/es/util/label-smartInvert.js.map +1 -0
- package/es/util/limit-shape.d.ts +3 -0
- package/es/util/limit-shape.js +8 -0
- package/es/util/limit-shape.js.map +1 -0
- package/package.json +4 -4
- package/cjs/util/labelSmartInvert.js.map +0 -1
- package/es/util/labelSmartInvert.js.map +0 -1
- /package/cjs/util/{labelSmartInvert.d.ts → label-smartInvert.d.ts} +0 -0
- /package/es/util/{labelSmartInvert.d.ts → label-smartInvert.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -2420,13 +2420,16 @@
|
|
|
2420
2420
|
}
|
|
2421
2421
|
|
|
2422
2422
|
class ArcInfo {
|
|
2423
|
-
constructor(refDatum, center, outerCenter, quadrant, radian, middleAngle) {
|
|
2423
|
+
constructor(refDatum, center, outerCenter, quadrant, radian, middleAngle, innerRadius, outerRadius, circleCenter) {
|
|
2424
2424
|
this.refDatum = refDatum;
|
|
2425
2425
|
this.center = center;
|
|
2426
2426
|
this.outerCenter = outerCenter;
|
|
2427
2427
|
this.quadrant = quadrant;
|
|
2428
2428
|
this.radian = radian;
|
|
2429
2429
|
this.middleAngle = middleAngle;
|
|
2430
|
+
this.innerRadius = innerRadius;
|
|
2431
|
+
this.outerRadius = outerRadius;
|
|
2432
|
+
this.circleCenter = circleCenter;
|
|
2430
2433
|
this.labelVisible = true;
|
|
2431
2434
|
this.labelLimit = 0;
|
|
2432
2435
|
}
|
|
@@ -2486,11 +2489,9 @@
|
|
|
2486
2489
|
return labels;
|
|
2487
2490
|
}
|
|
2488
2491
|
layoutArcLabels(position, attribute, currentMarks, data, textBoundsArray, ellipsisWidth) {
|
|
2489
|
-
var _a;
|
|
2490
2492
|
this._arcLeft.clear();
|
|
2491
2493
|
this._arcRight.clear();
|
|
2492
2494
|
this._ellipsisWidth = ellipsisWidth;
|
|
2493
|
-
const centerOffset = (_a = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _a !== void 0 ? _a : 0;
|
|
2494
2495
|
let maxRadius = 0;
|
|
2495
2496
|
currentMarks.forEach(currentMarks => {
|
|
2496
2497
|
if (currentMarks.attribute.outerRadius > maxRadius) {
|
|
@@ -2508,8 +2509,8 @@
|
|
|
2508
2509
|
const arcQuadrant = computeQuadrant(graphicAttribute.endAngle - intervalAngle / 2);
|
|
2509
2510
|
const arcMiddle = circlePoint(center.x, center.y, graphicAttribute.outerRadius, arcMiddleAngle);
|
|
2510
2511
|
const outerArcMiddle = circlePoint(center.x, center.y, maxRadius + attribute.line.line1MinLength, arcMiddleAngle);
|
|
2511
|
-
const arc = new ArcInfo(item, arcMiddle, outerArcMiddle, arcQuadrant, intervalAngle, arcMiddleAngle);
|
|
2512
|
-
arc.pointA = circlePoint(center.x, center.y, this.computeDatumRadius(center.x * 2, center.y * 2, graphicAttribute.outerRadius
|
|
2512
|
+
const arc = new ArcInfo(item, arcMiddle, outerArcMiddle, arcQuadrant, intervalAngle, arcMiddleAngle, graphicAttribute.innerRadius, graphicAttribute.outerRadius, center);
|
|
2513
|
+
arc.pointA = circlePoint(center.x, center.y, this.computeDatumRadius(center.x * 2, center.y * 2, graphicAttribute.outerRadius), arc.middleAngle);
|
|
2513
2514
|
arc.labelSize = {
|
|
2514
2515
|
width: textBounds.x2 - textBounds.x1,
|
|
2515
2516
|
height: textBounds.y2 - textBounds.y1
|
|
@@ -2535,18 +2536,13 @@
|
|
|
2535
2536
|
return arcs;
|
|
2536
2537
|
}
|
|
2537
2538
|
_layoutInsideLabels(arcs, attribute, currentMarks) {
|
|
2538
|
-
var _a, _b, _c, _d, _e;
|
|
2539
|
-
const center = { x: (_b = (_a = currentMarks[0].attribute) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0, y: (_d = (_c = currentMarks[0].attribute) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0 };
|
|
2540
|
-
const centerOffset = (_e = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _e !== void 0 ? _e : 0;
|
|
2541
|
-
const innerRadiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.innerRadius, attribute.width, attribute.height);
|
|
2542
|
-
const outerRadiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height);
|
|
2543
2539
|
const labelConfig = attribute;
|
|
2544
2540
|
const spaceWidth = labelConfig.spaceWidth;
|
|
2545
2541
|
arcs.forEach((arc) => {
|
|
2546
2542
|
var _a, _b;
|
|
2547
2543
|
const { labelSize, radian } = arc;
|
|
2548
|
-
const innerRadius =
|
|
2549
|
-
const outerRadius =
|
|
2544
|
+
const innerRadius = arc.innerRadius;
|
|
2545
|
+
const outerRadius = arc.outerRadius;
|
|
2550
2546
|
const minRadian = connectLineRadian(outerRadius, labelSize.height);
|
|
2551
2547
|
let limit;
|
|
2552
2548
|
if (radian < minRadian) {
|
|
@@ -2571,7 +2567,7 @@
|
|
|
2571
2567
|
const align = this._computeAlign(arc, attribute);
|
|
2572
2568
|
const alignOffset = align === 'left' ? labelWidth : align === 'right' ? 0 : labelWidth / 2;
|
|
2573
2569
|
const labelRadius = outerRadius - spaceWidth - alignOffset;
|
|
2574
|
-
arc.labelPosition = circlePoint(
|
|
2570
|
+
arc.labelPosition = circlePoint(arc.circleCenter.x, arc.circleCenter.y, labelRadius, arc.middleAngle);
|
|
2575
2571
|
arc.labelLimit = labelWidth;
|
|
2576
2572
|
if (!vutils.isGreater(labelWidth, 0)) {
|
|
2577
2573
|
arc.labelVisible = false;
|
|
@@ -2646,9 +2642,8 @@
|
|
|
2646
2642
|
return arcs;
|
|
2647
2643
|
}
|
|
2648
2644
|
_computeX(arc, attribute, currentMarks) {
|
|
2649
|
-
var _a
|
|
2650
|
-
const center =
|
|
2651
|
-
const centerOffset = (_e = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _e !== void 0 ? _e : 0;
|
|
2645
|
+
var _a;
|
|
2646
|
+
const center = arc.circleCenter;
|
|
2652
2647
|
const plotLayout = { width: center.x * 2, height: center.y * 2 };
|
|
2653
2648
|
let maxRadius = 0;
|
|
2654
2649
|
currentMarks.forEach((currentMark) => {
|
|
@@ -2659,7 +2654,7 @@
|
|
|
2659
2654
|
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
|
|
2660
2655
|
const line1MinLength = attribute.line.line1MinLength;
|
|
2661
2656
|
const line2MinLength = attribute.line.line2MinLength;
|
|
2662
|
-
const labelLayoutAlign = (
|
|
2657
|
+
const labelLayoutAlign = (_a = attribute.layout) === null || _a === void 0 ? void 0 : _a.align;
|
|
2663
2658
|
const spaceWidth = attribute.spaceWidth;
|
|
2664
2659
|
const { labelPosition, quadrant, pointB } = arc;
|
|
2665
2660
|
if (!vutils.isValidNumber(pointB.x * pointB.y)) {
|
|
@@ -2667,7 +2662,7 @@
|
|
|
2667
2662
|
labelPosition.x = NaN;
|
|
2668
2663
|
arc.labelLimit = 0;
|
|
2669
2664
|
}
|
|
2670
|
-
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height
|
|
2665
|
+
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height);
|
|
2671
2666
|
const flag = isQuadrantLeft(quadrant) ? -1 : 1;
|
|
2672
2667
|
let cx = 0;
|
|
2673
2668
|
const restWidth = flag > 0 ? plotLayout.width - pointB.x : pointB.x;
|
|
@@ -2885,7 +2880,6 @@
|
|
|
2885
2880
|
return -1;
|
|
2886
2881
|
}
|
|
2887
2882
|
_computePointB(arc, r, attribute, currentMarks) {
|
|
2888
|
-
var _a, _b, _c, _d, _e;
|
|
2889
2883
|
const labelConfig = attribute;
|
|
2890
2884
|
let maxRadius = 0;
|
|
2891
2885
|
currentMarks.forEach((currentMark) => {
|
|
@@ -2903,11 +2897,10 @@
|
|
|
2903
2897
|
};
|
|
2904
2898
|
}
|
|
2905
2899
|
else {
|
|
2906
|
-
const center =
|
|
2907
|
-
const
|
|
2908
|
-
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset);
|
|
2900
|
+
const center = arc.circleCenter;
|
|
2901
|
+
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height);
|
|
2909
2902
|
const { labelPosition, quadrant } = arc;
|
|
2910
|
-
const outerR = Math.max(radius + line1MinLength,
|
|
2903
|
+
const outerR = Math.max(radius + line1MinLength, arc.outerRadius);
|
|
2911
2904
|
const rd = r - outerR;
|
|
2912
2905
|
const x = Math.sqrt(r ** 2 - Math.abs(center.y - labelPosition.y) ** 2) - rd;
|
|
2913
2906
|
if (vutils.isValidNumber(x)) {
|
|
@@ -2929,8 +2922,7 @@
|
|
|
2929
2922
|
}
|
|
2930
2923
|
}
|
|
2931
2924
|
_computeYRange(arc, attribute, currentMarks) {
|
|
2932
|
-
|
|
2933
|
-
const center = { x: (_b = (_a = currentMarks[0].attribute) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0, y: (_d = (_c = currentMarks[0].attribute) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0 };
|
|
2925
|
+
const center = arc.circleCenter;
|
|
2934
2926
|
const plotRect = { width: center.x * 2, height: center.y * 2 };
|
|
2935
2927
|
let maxRadius = 0;
|
|
2936
2928
|
currentMarks.forEach((currentMark) => {
|
|
@@ -2941,8 +2933,7 @@
|
|
|
2941
2933
|
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
|
|
2942
2934
|
const line1MinLength = attribute.line.line1MinLength;
|
|
2943
2935
|
const { width, height } = plotRect;
|
|
2944
|
-
const
|
|
2945
|
-
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset);
|
|
2936
|
+
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height);
|
|
2946
2937
|
const r = this._computeLayoutRadius(height / 2, attribute, currentMarks);
|
|
2947
2938
|
const cx = Math.abs(arc.center.x - width / 2);
|
|
2948
2939
|
const cy = arc.center.y - height / 2;
|
|
@@ -3001,7 +2992,6 @@
|
|
|
3001
2992
|
arc.labelYRange = [min, max];
|
|
3002
2993
|
}
|
|
3003
2994
|
_computeLayoutRadius(halfYLength, attribute, currentMarks) {
|
|
3004
|
-
var _a;
|
|
3005
2995
|
const labelConfig = attribute;
|
|
3006
2996
|
const layoutArcGap = labelConfig.layoutArcGap;
|
|
3007
2997
|
const line1MinLength = labelConfig.line.line1MinLength;
|
|
@@ -3012,8 +3002,7 @@
|
|
|
3012
3002
|
}
|
|
3013
3003
|
});
|
|
3014
3004
|
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
|
|
3015
|
-
const
|
|
3016
|
-
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset);
|
|
3005
|
+
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height);
|
|
3017
3006
|
const outerR = radius + line1MinLength;
|
|
3018
3007
|
const a = outerR - layoutArcGap;
|
|
3019
3008
|
return Math.max((a ** 2 + halfYLength ** 2) / (2 * a), outerR);
|
|
@@ -3092,9 +3081,8 @@
|
|
|
3092
3081
|
: undefined;
|
|
3093
3082
|
return labelLine;
|
|
3094
3083
|
}
|
|
3095
|
-
computeRadius(r, width, height,
|
|
3096
|
-
|
|
3097
|
-
return ((_a = this.computeLayoutRadius(width ? width : 0, height ? height : 0) * r * (vutils.isNil(k) ? 1 : k) + centerOffset) !== null && _a !== void 0 ? _a : 0);
|
|
3084
|
+
computeRadius(r, width, height, k) {
|
|
3085
|
+
return this.computeLayoutRadius(width ? width : 0, height ? height : 0) * r * (vutils.isNil(k) ? 1 : k);
|
|
3098
3086
|
}
|
|
3099
3087
|
computeLayoutRadius(width, height) {
|
|
3100
3088
|
return Math.min(width / 2, height / 2);
|
|
@@ -3105,10 +3093,9 @@
|
|
|
3105
3093
|
computeLayoutOuterRadius(r, width, height) {
|
|
3106
3094
|
return r / (Math.min(width, height) / 2);
|
|
3107
3095
|
}
|
|
3108
|
-
computeDatumRadius(width, height, outerRadius
|
|
3109
|
-
var _a;
|
|
3096
|
+
computeDatumRadius(width, height, outerRadius) {
|
|
3110
3097
|
const outerRadiusRatio = this.computeLayoutOuterRadius(outerRadius, width, height);
|
|
3111
|
-
return
|
|
3098
|
+
return this.computeLayoutRadius(width ? width : 0, height ? height : 0) * outerRadiusRatio;
|
|
3112
3099
|
}
|
|
3113
3100
|
}
|
|
3114
3101
|
ArcLabel.defaultAttributes = {
|
|
@@ -3211,69 +3198,74 @@
|
|
|
3211
3198
|
};
|
|
3212
3199
|
|
|
3213
3200
|
class Segment extends AbstractComponent {
|
|
3201
|
+
getStartAngle() {
|
|
3202
|
+
return this._startAngle;
|
|
3203
|
+
}
|
|
3204
|
+
getEndAngle() {
|
|
3205
|
+
return this._endAngle;
|
|
3206
|
+
}
|
|
3207
|
+
getMainSegmentPoints() {
|
|
3208
|
+
return this._mainSegmentPoints;
|
|
3209
|
+
}
|
|
3214
3210
|
constructor(attributes) {
|
|
3215
3211
|
super(vutils.merge({}, Segment.defaultAttributes, attributes));
|
|
3216
3212
|
this.name = 'segment';
|
|
3217
3213
|
}
|
|
3218
|
-
computeLineAngle() {
|
|
3219
|
-
const { points } = this.attribute;
|
|
3220
|
-
const start = points[0];
|
|
3221
|
-
const startInside = points[1];
|
|
3222
|
-
const endInside = points[points.length - 2];
|
|
3223
|
-
const end = points[points.length - 1];
|
|
3224
|
-
const startVector = [start.x - startInside.x, start.y - startInside.y];
|
|
3225
|
-
const startAngle = Math.atan2(startVector[1], startVector[0]);
|
|
3226
|
-
const endVector = [end.x - endInside.x, end.y - endInside.y];
|
|
3227
|
-
const endAngle = Math.atan2(endVector[1], endVector[0]);
|
|
3228
|
-
this._startAngle = startAngle;
|
|
3229
|
-
this._endAngle = endAngle;
|
|
3230
|
-
}
|
|
3231
3214
|
render() {
|
|
3232
3215
|
this.removeAllChild();
|
|
3233
|
-
|
|
3216
|
+
this._reset();
|
|
3217
|
+
const { startSymbol, endSymbol, lineStyle, state, visible = true, multiSegment, mainSegmentIndex } = this.attribute;
|
|
3234
3218
|
if (!visible) {
|
|
3235
3219
|
return;
|
|
3236
3220
|
}
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
const startSymbolShape = this.renderSymbol(startSymbol, 'start');
|
|
3241
|
-
const endSymbolShape = this.renderSymbol(endSymbol, 'end');
|
|
3221
|
+
this._computeLineAngle();
|
|
3222
|
+
const startSymbolShape = this._renderSymbol(startSymbol, 'start');
|
|
3223
|
+
const endSymbolShape = this._renderSymbol(endSymbol, 'end');
|
|
3242
3224
|
this.startSymbol = startSymbolShape;
|
|
3243
3225
|
this.endSymbol = endSymbolShape;
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3226
|
+
if (multiSegment) {
|
|
3227
|
+
const points = [...this.attribute.points];
|
|
3228
|
+
if (vutils.isValidNumber(mainSegmentIndex)) {
|
|
3229
|
+
points[mainSegmentIndex] = this._clipPoints(points[mainSegmentIndex]);
|
|
3230
|
+
}
|
|
3231
|
+
else {
|
|
3232
|
+
const clipPoints = this._clipPoints(vutils.flattenArray(points));
|
|
3233
|
+
points[0][0] = clipPoints[0];
|
|
3234
|
+
points[points.length - 1][points[points.length - 1].length - 1] =
|
|
3235
|
+
clipPoints[clipPoints.length - 1];
|
|
3236
|
+
}
|
|
3237
|
+
points.forEach((point, index) => {
|
|
3238
|
+
var _a, _b;
|
|
3239
|
+
const line = vrender.createLine(Object.assign(Object.assign({ points: point }, (vutils.isArray(lineStyle) ? (_a = lineStyle[index]) !== null && _a !== void 0 ? _a : lineStyle[lineStyle.length - 1] : lineStyle)), { fill: false }));
|
|
3240
|
+
line.name = `${this.name}-line`;
|
|
3241
|
+
line.id = this._getNodeId('line' + index);
|
|
3242
|
+
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.line)) {
|
|
3243
|
+
line.states = vutils.isArray(state.line) ? (_b = state.line[index]) !== null && _b !== void 0 ? _b : state.line[state.line.length - 1] : state.line;
|
|
3244
|
+
}
|
|
3245
|
+
this.add(line);
|
|
3246
|
+
});
|
|
3260
3247
|
}
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3248
|
+
else {
|
|
3249
|
+
const line = vrender.createLine(Object.assign(Object.assign({ points: this._clipPoints(this.attribute.points) }, vutils.array(lineStyle)[0]), { fill: false }));
|
|
3250
|
+
line.name = `${this.name}-line`;
|
|
3251
|
+
line.id = this._getNodeId('line');
|
|
3252
|
+
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.line)) {
|
|
3253
|
+
line.states = [].concat(state.line)[0];
|
|
3254
|
+
}
|
|
3255
|
+
this.add(line);
|
|
3266
3256
|
}
|
|
3267
|
-
this.line = line;
|
|
3268
|
-
this.add(line);
|
|
3269
3257
|
}
|
|
3270
|
-
|
|
3258
|
+
_renderSymbol(attribute, dim) {
|
|
3259
|
+
const points = this._getMainSegmentPoints();
|
|
3260
|
+
if (!points.length) {
|
|
3261
|
+
return;
|
|
3262
|
+
}
|
|
3271
3263
|
const { autoRotate = true } = attribute;
|
|
3272
3264
|
let symbol;
|
|
3273
3265
|
if (attribute === null || attribute === void 0 ? void 0 : attribute.visible) {
|
|
3274
3266
|
const startAngle = this._startAngle;
|
|
3275
3267
|
const endAngle = this._endAngle;
|
|
3276
|
-
const {
|
|
3268
|
+
const { state } = this.attribute;
|
|
3277
3269
|
const start = points[0];
|
|
3278
3270
|
const end = points[points.length - 1];
|
|
3279
3271
|
const { refX = 0, refY = 0, refAngle = 0, style, symbolType, size = 12 } = attribute;
|
|
@@ -3281,20 +3273,22 @@
|
|
|
3281
3273
|
let rotate;
|
|
3282
3274
|
if (dim === 'start') {
|
|
3283
3275
|
position = {
|
|
3284
|
-
x: start.x +
|
|
3285
|
-
|
|
3276
|
+
x: start.x +
|
|
3277
|
+
(vutils.isValidNumber(startAngle) ? refX * Math.cos(startAngle) + refY * Math.cos(startAngle - Math.PI / 2) : 0),
|
|
3278
|
+
y: start.y +
|
|
3279
|
+
(vutils.isValidNumber(startAngle) ? refX * Math.sin(startAngle) + refY * Math.sin(startAngle - Math.PI / 2) : 0)
|
|
3286
3280
|
};
|
|
3287
3281
|
rotate = startAngle + Math.PI / 2;
|
|
3288
3282
|
}
|
|
3289
3283
|
else {
|
|
3290
3284
|
position = {
|
|
3291
|
-
x: end.x + (endAngle ? refX * Math.cos(endAngle) + refY * Math.cos(endAngle - Math.PI / 2) : 0),
|
|
3292
|
-
y: end.y + (endAngle ? refX * Math.sin(endAngle) + refY * Math.sin(endAngle - Math.PI / 2) : 0)
|
|
3285
|
+
x: end.x + (vutils.isValidNumber(endAngle) ? refX * Math.cos(endAngle) + refY * Math.cos(endAngle - Math.PI / 2) : 0),
|
|
3286
|
+
y: end.y + (vutils.isValidNumber(endAngle) ? refX * Math.sin(endAngle) + refY * Math.sin(endAngle - Math.PI / 2) : 0)
|
|
3293
3287
|
};
|
|
3294
3288
|
rotate = endAngle + Math.PI / 2;
|
|
3295
3289
|
}
|
|
3296
3290
|
symbol = vrender.createSymbol(Object.assign(Object.assign(Object.assign({}, position), { symbolType: symbolType, size, angle: autoRotate ? rotate + refAngle : 0, strokeBoundsBuffer: 0 }), style));
|
|
3297
|
-
symbol.name = `${dim}-symbol`;
|
|
3291
|
+
symbol.name = `${this.name}-${dim}-symbol`;
|
|
3298
3292
|
symbol.id = this._getNodeId(`${dim}-symbol`);
|
|
3299
3293
|
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.symbol)) {
|
|
3300
3294
|
symbol.states = state.symbol;
|
|
@@ -3303,11 +3297,69 @@
|
|
|
3303
3297
|
}
|
|
3304
3298
|
return symbol;
|
|
3305
3299
|
}
|
|
3306
|
-
|
|
3307
|
-
|
|
3300
|
+
_getMainSegmentPoints() {
|
|
3301
|
+
if (this._mainSegmentPoints) {
|
|
3302
|
+
return this._mainSegmentPoints;
|
|
3303
|
+
}
|
|
3304
|
+
const { points: originPoints, multiSegment, mainSegmentIndex } = this.attribute;
|
|
3305
|
+
let points;
|
|
3306
|
+
if (multiSegment) {
|
|
3307
|
+
if (vutils.isValidNumber(mainSegmentIndex)) {
|
|
3308
|
+
points = originPoints[mainSegmentIndex];
|
|
3309
|
+
}
|
|
3310
|
+
else {
|
|
3311
|
+
points = vutils.flattenArray(originPoints);
|
|
3312
|
+
}
|
|
3313
|
+
}
|
|
3314
|
+
else {
|
|
3315
|
+
points = originPoints;
|
|
3316
|
+
}
|
|
3317
|
+
this._mainSegmentPoints = points;
|
|
3318
|
+
return points;
|
|
3308
3319
|
}
|
|
3309
|
-
|
|
3310
|
-
|
|
3320
|
+
_clipPoints(points) {
|
|
3321
|
+
const { startSymbol, endSymbol } = this.attribute;
|
|
3322
|
+
let pointsAfterClip = points;
|
|
3323
|
+
if (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.visible) {
|
|
3324
|
+
const startSize = (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.clip) ? (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.size) || 10 : 0;
|
|
3325
|
+
const pointsStart = {
|
|
3326
|
+
x: points[0].x - (startSize / 2) * (Math.cos(this._startAngle) || 0),
|
|
3327
|
+
y: points[0].y - (startSize / 2) * (Math.sin(this._startAngle) || 0)
|
|
3328
|
+
};
|
|
3329
|
+
pointsAfterClip = [pointsStart, ...pointsAfterClip.slice(1)];
|
|
3330
|
+
}
|
|
3331
|
+
if (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.visible) {
|
|
3332
|
+
const endSize = (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.clip) ? (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.size) || 10 : 0;
|
|
3333
|
+
const pointsEnd = {
|
|
3334
|
+
x: points[points.length - 1].x - (endSize / 2) * (Math.cos(this._endAngle) || 0),
|
|
3335
|
+
y: points[points.length - 1].y - (endSize / 2) * (Math.sin(this._endAngle) || 0)
|
|
3336
|
+
};
|
|
3337
|
+
pointsAfterClip = [...pointsAfterClip.slice(0, pointsAfterClip.length - 1), pointsEnd];
|
|
3338
|
+
}
|
|
3339
|
+
return pointsAfterClip;
|
|
3340
|
+
}
|
|
3341
|
+
_computeLineAngle() {
|
|
3342
|
+
const points = this._getMainSegmentPoints();
|
|
3343
|
+
if (points.length <= 1) {
|
|
3344
|
+
return;
|
|
3345
|
+
}
|
|
3346
|
+
const start = points[0];
|
|
3347
|
+
const startInside = points[1];
|
|
3348
|
+
const endInside = points[points.length - 2];
|
|
3349
|
+
const end = points[points.length - 1];
|
|
3350
|
+
const startVector = [start.x - startInside.x, start.y - startInside.y];
|
|
3351
|
+
const startAngle = Math.atan2(startVector[1], startVector[0]);
|
|
3352
|
+
const endVector = [end.x - endInside.x, end.y - endInside.y];
|
|
3353
|
+
const endAngle = Math.atan2(endVector[1], endVector[0]);
|
|
3354
|
+
this._startAngle = startAngle;
|
|
3355
|
+
this._endAngle = endAngle;
|
|
3356
|
+
}
|
|
3357
|
+
_reset() {
|
|
3358
|
+
this.startSymbol = null;
|
|
3359
|
+
this.endSymbol = null;
|
|
3360
|
+
this._startAngle = null;
|
|
3361
|
+
this._endAngle = null;
|
|
3362
|
+
this._mainSegmentPoints = null;
|
|
3311
3363
|
}
|
|
3312
3364
|
}
|
|
3313
3365
|
Segment.defaultAttributes = {
|
|
@@ -6019,25 +6071,41 @@
|
|
|
6019
6071
|
})(exports.IMarkPointItemPosition || (exports.IMarkPointItemPosition = {}));
|
|
6020
6072
|
|
|
6021
6073
|
class Marker extends AbstractComponent {
|
|
6074
|
+
constructor() {
|
|
6075
|
+
super(...arguments);
|
|
6076
|
+
this.name = 'marker';
|
|
6077
|
+
}
|
|
6022
6078
|
_initContainer() {
|
|
6023
|
-
var _a, _b
|
|
6024
|
-
const
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6079
|
+
var _a, _b;
|
|
6080
|
+
const { limitRect, clipInRange } = this.attribute;
|
|
6081
|
+
let group;
|
|
6082
|
+
if (clipInRange) {
|
|
6083
|
+
const groupClip = vrender.createGroup(Object.assign(Object.assign({}, limitRect), { clip: true, pickable: false }));
|
|
6084
|
+
group = vrender.createGroup({
|
|
6085
|
+
x: -((_a = limitRect === null || limitRect === void 0 ? void 0 : limitRect.x) !== null && _a !== void 0 ? _a : 0),
|
|
6086
|
+
y: -((_b = limitRect === null || limitRect === void 0 ? void 0 : limitRect.y) !== null && _b !== void 0 ? _b : 0)
|
|
6087
|
+
});
|
|
6088
|
+
groupClip.add(group);
|
|
6089
|
+
this._containerClip = groupClip;
|
|
6090
|
+
this.add(groupClip);
|
|
6091
|
+
}
|
|
6092
|
+
else {
|
|
6093
|
+
group = vrender.createGroup({
|
|
6094
|
+
x: 0,
|
|
6095
|
+
y: 0
|
|
6096
|
+
});
|
|
6097
|
+
this.add(group);
|
|
6098
|
+
}
|
|
6099
|
+
group.name = 'marker-container';
|
|
6033
6100
|
this._container = group;
|
|
6034
6101
|
}
|
|
6035
6102
|
_updateContainer() {
|
|
6036
|
-
var _a, _b, _c
|
|
6037
|
-
|
|
6103
|
+
var _a, _b, _c;
|
|
6104
|
+
const { limitRect, clipInRange } = this.attribute;
|
|
6105
|
+
(_a = this._containerClip) === null || _a === void 0 ? void 0 : _a.setAttributes(Object.assign({}, limitRect));
|
|
6038
6106
|
this._container.setAttributes({
|
|
6039
|
-
x:
|
|
6040
|
-
y:
|
|
6107
|
+
x: clipInRange ? -((_b = limitRect === null || limitRect === void 0 ? void 0 : limitRect.x) !== null && _b !== void 0 ? _b : 0) : 0,
|
|
6108
|
+
y: clipInRange ? -((_c = limitRect === null || limitRect === void 0 ? void 0 : limitRect.y) !== null && _c !== void 0 ? _c : 0) : 0
|
|
6041
6109
|
});
|
|
6042
6110
|
}
|
|
6043
6111
|
render() {
|
|
@@ -6049,7 +6117,7 @@
|
|
|
6049
6117
|
this.setAttribute('childrenPickable', false);
|
|
6050
6118
|
}
|
|
6051
6119
|
if (markerVisible) {
|
|
6052
|
-
if (!this.
|
|
6120
|
+
if (!this._container) {
|
|
6053
6121
|
this._initContainer();
|
|
6054
6122
|
this.initMarker(this._container);
|
|
6055
6123
|
}
|
|
@@ -6286,47 +6354,84 @@
|
|
|
6286
6354
|
}
|
|
6287
6355
|
};
|
|
6288
6356
|
|
|
6357
|
+
function limitShapeInBounds(shape, bounds) {
|
|
6358
|
+
const { x1: regionMinX, y1: regionMinY, x2: regionMaxX, y2: regionMaxY } = bounds;
|
|
6359
|
+
const { x1, y1, x2, y2 } = shape.AABBBounds;
|
|
6360
|
+
const { dx: originDx = 0, dy: originDy = 0 } = shape.attribute;
|
|
6361
|
+
let dx = 0;
|
|
6362
|
+
let dy = 0;
|
|
6363
|
+
if (x1 < regionMinX) {
|
|
6364
|
+
dx = regionMinX - x1;
|
|
6365
|
+
}
|
|
6366
|
+
if (y1 < regionMinY) {
|
|
6367
|
+
dy = regionMinY - y1;
|
|
6368
|
+
}
|
|
6369
|
+
if (x2 > regionMaxX) {
|
|
6370
|
+
dx = regionMaxX - x2;
|
|
6371
|
+
}
|
|
6372
|
+
if (y2 > regionMaxY) {
|
|
6373
|
+
dy = regionMaxY - y2;
|
|
6374
|
+
}
|
|
6375
|
+
if (dx) {
|
|
6376
|
+
shape.setAttribute('dx', dx + originDx);
|
|
6377
|
+
}
|
|
6378
|
+
if (dy) {
|
|
6379
|
+
shape.setAttribute('dy', dy + originDy);
|
|
6380
|
+
}
|
|
6381
|
+
}
|
|
6382
|
+
|
|
6289
6383
|
class MarkLine extends Marker {
|
|
6290
6384
|
constructor(attributes) {
|
|
6291
6385
|
super(vutils.merge({}, MarkLine.defaultAttributes, attributes));
|
|
6292
6386
|
}
|
|
6293
6387
|
setLabelPos() {
|
|
6294
|
-
var _a, _b
|
|
6295
|
-
const {
|
|
6296
|
-
const
|
|
6297
|
-
const
|
|
6298
|
-
const
|
|
6299
|
-
const
|
|
6300
|
-
|
|
6301
|
-
|
|
6388
|
+
var _a, _b;
|
|
6389
|
+
const { label = {}, limitRect } = this.attribute;
|
|
6390
|
+
const { position = 'end', refX = 0, refY = 0, confine } = label;
|
|
6391
|
+
const points = this._line.getMainSegmentPoints();
|
|
6392
|
+
const labelAngle = (_a = this._line.getEndAngle()) !== null && _a !== void 0 ? _a : 0;
|
|
6393
|
+
const labelOffsetX = refX * Math.cos(labelAngle) + refY * Math.cos(labelAngle - Math.PI / 2);
|
|
6394
|
+
const labelOffsetY = refX * Math.sin(labelAngle) + refY * Math.sin(labelAngle - Math.PI / 2);
|
|
6395
|
+
let labelPoint;
|
|
6396
|
+
if (position.includes('start') || position.includes('Start')) {
|
|
6397
|
+
labelPoint = {
|
|
6302
6398
|
x: points[0].x + labelOffsetX,
|
|
6303
6399
|
y: points[0].y + labelOffsetY
|
|
6304
|
-
}
|
|
6400
|
+
};
|
|
6305
6401
|
}
|
|
6306
|
-
else if (
|
|
6307
|
-
|
|
6402
|
+
else if (position.includes('middle') || position.includes('Middle')) {
|
|
6403
|
+
labelPoint = {
|
|
6308
6404
|
x: (points[0].x + points[points.length - 1].x) / 2 + labelOffsetX,
|
|
6309
6405
|
y: (points[0].y + points[points.length - 1].y) / 2 + labelOffsetY
|
|
6310
|
-
}
|
|
6406
|
+
};
|
|
6311
6407
|
}
|
|
6312
6408
|
else {
|
|
6313
|
-
|
|
6409
|
+
labelPoint = {
|
|
6314
6410
|
x: points[points.length - 1].x + labelOffsetX,
|
|
6315
6411
|
y: points[points.length - 1].y + labelOffsetY
|
|
6412
|
+
};
|
|
6413
|
+
}
|
|
6414
|
+
this._label.setAttributes(Object.assign(Object.assign({}, labelPoint), { angle: label.autoRotate ? labelAngle + ((_b = label === null || label === void 0 ? void 0 : label.refAngle) !== null && _b !== void 0 ? _b : 0) : 0, textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_LINE_TEXT_STYLE_MAP[position]), label.textStyle) }));
|
|
6415
|
+
if (limitRect && confine) {
|
|
6416
|
+
const { x, y, width, height } = limitRect;
|
|
6417
|
+
limitShapeInBounds(this._label, {
|
|
6418
|
+
x1: x,
|
|
6419
|
+
y1: y,
|
|
6420
|
+
x2: x + width,
|
|
6421
|
+
y2: y + height
|
|
6316
6422
|
});
|
|
6317
6423
|
}
|
|
6318
|
-
this._label.setAttributes({
|
|
6319
|
-
angle: label.autoRotate && labelAngle + ((_e = label === null || label === void 0 ? void 0 : label.refAngle) !== null && _e !== void 0 ? _e : 0),
|
|
6320
|
-
textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_LINE_TEXT_STYLE_MAP[labelPosition]), label.textStyle)
|
|
6321
|
-
});
|
|
6322
6424
|
}
|
|
6323
6425
|
initMarker(container) {
|
|
6324
|
-
const { points, startSymbol, endSymbol, label, lineStyle } = this
|
|
6426
|
+
const { points, startSymbol, endSymbol, label, lineStyle, mainSegmentIndex, multiSegment } = this
|
|
6427
|
+
.attribute;
|
|
6325
6428
|
const line = new Segment({
|
|
6326
6429
|
points,
|
|
6327
6430
|
startSymbol,
|
|
6328
6431
|
endSymbol,
|
|
6329
|
-
lineStyle
|
|
6432
|
+
lineStyle,
|
|
6433
|
+
mainSegmentIndex,
|
|
6434
|
+
multiSegment
|
|
6330
6435
|
});
|
|
6331
6436
|
line.name = 'mark-line-line';
|
|
6332
6437
|
this._line = line;
|
|
@@ -6339,14 +6444,17 @@
|
|
|
6339
6444
|
}
|
|
6340
6445
|
updateMarker() {
|
|
6341
6446
|
var _a, _b;
|
|
6342
|
-
const { points, startSymbol, endSymbol, label, lineStyle } = this
|
|
6447
|
+
const { points, startSymbol, endSymbol, label, lineStyle, mainSegmentIndex, multiSegment } = this
|
|
6448
|
+
.attribute;
|
|
6343
6449
|
(_a = this._line) === null || _a === void 0 ? void 0 : _a.setAttributes({
|
|
6344
6450
|
points,
|
|
6345
6451
|
startSymbol,
|
|
6346
6452
|
endSymbol,
|
|
6347
|
-
lineStyle
|
|
6453
|
+
lineStyle,
|
|
6454
|
+
mainSegmentIndex,
|
|
6455
|
+
multiSegment
|
|
6348
6456
|
});
|
|
6349
|
-
(_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({}, label));
|
|
6457
|
+
(_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({ dx: 0, dy: 0 }, label));
|
|
6350
6458
|
this.setLabelPos();
|
|
6351
6459
|
}
|
|
6352
6460
|
}
|
|
@@ -6356,58 +6464,54 @@
|
|
|
6356
6464
|
constructor(attributes) {
|
|
6357
6465
|
super(vutils.merge({}, MarkArea.defaultAttributes, attributes));
|
|
6358
6466
|
}
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
return {
|
|
6367
|
-
x: this._area.AABBBounds.x2,
|
|
6368
|
-
y: (this._area.AABBBounds.y1 + this._area.AABBBounds.y2) / 2
|
|
6369
|
-
};
|
|
6370
|
-
}
|
|
6371
|
-
getTopPos() {
|
|
6372
|
-
return {
|
|
6373
|
-
x: (this._area.AABBBounds.x1 + this._area.AABBBounds.x2) / 2,
|
|
6374
|
-
y: this._area.AABBBounds.y1
|
|
6375
|
-
};
|
|
6376
|
-
}
|
|
6377
|
-
getBottomPos() {
|
|
6378
|
-
return {
|
|
6379
|
-
x: (this._area.AABBBounds.x1 + this._area.AABBBounds.x2) / 2,
|
|
6380
|
-
y: this._area.AABBBounds.y2
|
|
6381
|
-
};
|
|
6382
|
-
}
|
|
6383
|
-
getMiddlePos() {
|
|
6384
|
-
return {
|
|
6385
|
-
x: (this._area.AABBBounds.x1 + this._area.AABBBounds.x2) / 2,
|
|
6386
|
-
y: (this._area.AABBBounds.y1 + this._area.AABBBounds.y2) / 2
|
|
6387
|
-
};
|
|
6388
|
-
}
|
|
6389
|
-
setLabelPos() {
|
|
6390
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
6391
|
-
const { label } = this.attribute;
|
|
6392
|
-
const labelPosition = (_a = label === null || label === void 0 ? void 0 : label.position) !== null && _a !== void 0 ? _a : 'middle';
|
|
6393
|
-
if (labelPosition.includes('left') || labelPosition.includes('Left')) {
|
|
6394
|
-
(_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({}, this.getLeftPos()));
|
|
6467
|
+
_getPositionByDirection(area, direction) {
|
|
6468
|
+
const { x1, x2, y1, y2 } = this._area.AABBBounds;
|
|
6469
|
+
if (direction.includes('left') || direction.includes('Left')) {
|
|
6470
|
+
return {
|
|
6471
|
+
x: x1,
|
|
6472
|
+
y: (y1 + y2) / 2
|
|
6473
|
+
};
|
|
6395
6474
|
}
|
|
6396
|
-
|
|
6397
|
-
|
|
6475
|
+
if (direction.includes('right') || direction.includes('Right')) {
|
|
6476
|
+
return {
|
|
6477
|
+
x: x2,
|
|
6478
|
+
y: (y1 + y2) / 2
|
|
6479
|
+
};
|
|
6398
6480
|
}
|
|
6399
|
-
|
|
6400
|
-
|
|
6481
|
+
if (direction.includes('top') || direction.includes('Top')) {
|
|
6482
|
+
return {
|
|
6483
|
+
x: (x1 + x2) / 2,
|
|
6484
|
+
y: y1
|
|
6485
|
+
};
|
|
6401
6486
|
}
|
|
6402
|
-
|
|
6403
|
-
|
|
6487
|
+
if (direction.includes('bottom') || direction.includes('Bottom')) {
|
|
6488
|
+
return {
|
|
6489
|
+
x: (x1 + x2) / 2,
|
|
6490
|
+
y: y2
|
|
6491
|
+
};
|
|
6404
6492
|
}
|
|
6405
|
-
|
|
6406
|
-
(
|
|
6493
|
+
return {
|
|
6494
|
+
x: (x1 + x2) / 2,
|
|
6495
|
+
y: (y1 + y2) / 2
|
|
6496
|
+
};
|
|
6497
|
+
}
|
|
6498
|
+
setLabelPos() {
|
|
6499
|
+
var _a;
|
|
6500
|
+
if (this._label && this._area) {
|
|
6501
|
+
const { label } = this.attribute;
|
|
6502
|
+
const labelPosition = (_a = label === null || label === void 0 ? void 0 : label.position) !== null && _a !== void 0 ? _a : 'middle';
|
|
6503
|
+
const labelPoint = this._getPositionByDirection(this._area, labelPosition);
|
|
6504
|
+
this._label.setAttributes(Object.assign(Object.assign({}, labelPoint), { textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_AREA_TEXT_STYLE_MAP[labelPosition]), label.textStyle) }));
|
|
6505
|
+
if (this.attribute.limitRect && (label === null || label === void 0 ? void 0 : label.confine)) {
|
|
6506
|
+
const { x, y, width, height } = this.attribute.limitRect;
|
|
6507
|
+
limitShapeInBounds(this._label, {
|
|
6508
|
+
x1: x,
|
|
6509
|
+
y1: y,
|
|
6510
|
+
x2: x + width,
|
|
6511
|
+
y2: y + height
|
|
6512
|
+
});
|
|
6513
|
+
}
|
|
6407
6514
|
}
|
|
6408
|
-
(_g = this._label) === null || _g === void 0 ? void 0 : _g.setAttributes({
|
|
6409
|
-
textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_AREA_TEXT_STYLE_MAP[labelPosition]), label.textStyle)
|
|
6410
|
-
});
|
|
6411
6515
|
}
|
|
6412
6516
|
initMarker(container) {
|
|
6413
6517
|
const { points, label, areaStyle } = this.attribute;
|
|
@@ -6425,7 +6529,7 @@
|
|
|
6425
6529
|
var _a, _b;
|
|
6426
6530
|
const { points, label, areaStyle } = this.attribute;
|
|
6427
6531
|
(_a = this._area) === null || _a === void 0 ? void 0 : _a.setAttributes(Object.assign({ points: points }, areaStyle));
|
|
6428
|
-
(_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({}, label));
|
|
6532
|
+
(_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({ dx: 0, dy: 0 }, label));
|
|
6429
6533
|
this.setLabelPos();
|
|
6430
6534
|
}
|
|
6431
6535
|
}
|
|
@@ -6439,26 +6543,29 @@
|
|
|
6439
6543
|
}
|
|
6440
6544
|
setItemAttributes(item, itemContent, itemPosition, itemType) {
|
|
6441
6545
|
var _a;
|
|
6546
|
+
if (!item) {
|
|
6547
|
+
return;
|
|
6548
|
+
}
|
|
6442
6549
|
const { autoRotate = true, refX = 0, refY = 0, refAngle = 0, textStyle, richTextStyle, imageStyle, position = exports.IMarkPointItemPosition.middle } = itemContent;
|
|
6443
6550
|
const itemAngle = ((_a = this._line) === null || _a === void 0 ? void 0 : _a.getEndAngle()) || 0;
|
|
6444
6551
|
const itemOffsetX = refX * Math.cos(itemAngle) + refY * Math.cos(itemAngle - Math.PI / 2);
|
|
6445
6552
|
const itemOffsetY = refX * Math.sin(itemAngle) + refY * Math.sin(itemAngle - Math.PI / 2);
|
|
6446
6553
|
if (itemType === 'text') {
|
|
6447
|
-
item
|
|
6554
|
+
item.setAttributes(Object.assign(Object.assign({}, textStyle), { textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_POINT_TEXT_STYLE_MAP[(itemContent === null || itemContent === void 0 ? void 0 : itemContent.position) || 'end']), textStyle === null || textStyle === void 0 ? void 0 : textStyle.textStyle) }));
|
|
6448
6555
|
}
|
|
6449
6556
|
else if (itemType === 'richText') {
|
|
6450
|
-
item
|
|
6557
|
+
item.setAttributes({
|
|
6451
6558
|
dx: this.getItemDx(item, position, richTextStyle) + ((richTextStyle === null || richTextStyle === void 0 ? void 0 : richTextStyle.dx) || 0),
|
|
6452
6559
|
dy: this.getItemDy(item, position, richTextStyle) + ((richTextStyle === null || richTextStyle === void 0 ? void 0 : richTextStyle.dy) || 0)
|
|
6453
6560
|
});
|
|
6454
6561
|
}
|
|
6455
6562
|
else if (itemType === 'image') {
|
|
6456
|
-
item
|
|
6563
|
+
item.setAttributes({
|
|
6457
6564
|
dx: this.getItemDx(item, position, imageStyle) + ((imageStyle === null || imageStyle === void 0 ? void 0 : imageStyle.dx) || 0),
|
|
6458
6565
|
dy: this.getItemDy(item, position, imageStyle) + ((imageStyle === null || imageStyle === void 0 ? void 0 : imageStyle.dy) || 0)
|
|
6459
6566
|
});
|
|
6460
6567
|
}
|
|
6461
|
-
item
|
|
6568
|
+
item.setAttributes({
|
|
6462
6569
|
x: itemPosition.x + (itemOffsetX || 0),
|
|
6463
6570
|
y: itemPosition.y + (itemOffsetY || 0),
|
|
6464
6571
|
angle: autoRotate && itemAngle + refAngle
|
|
@@ -6470,7 +6577,7 @@
|
|
|
6470
6577
|
if (position.includes('inside')) {
|
|
6471
6578
|
return -width;
|
|
6472
6579
|
}
|
|
6473
|
-
|
|
6580
|
+
if (position === 'insideTop') {
|
|
6474
6581
|
return 0;
|
|
6475
6582
|
}
|
|
6476
6583
|
return 0;
|
|
@@ -6481,7 +6588,7 @@
|
|
|
6481
6588
|
if (position.includes('top') || position.includes('Top')) {
|
|
6482
6589
|
return -height;
|
|
6483
6590
|
}
|
|
6484
|
-
|
|
6591
|
+
if (position.includes('middle') || position.includes('Middle')) {
|
|
6485
6592
|
return -height / 2;
|
|
6486
6593
|
}
|
|
6487
6594
|
return 0;
|
|
@@ -10358,7 +10465,7 @@
|
|
|
10358
10465
|
return new Tag(params ? params.attribute : {});
|
|
10359
10466
|
}
|
|
10360
10467
|
|
|
10361
|
-
const version = "0.15.
|
|
10468
|
+
const version = "0.15.1";
|
|
10362
10469
|
|
|
10363
10470
|
exports.AbstractComponent = AbstractComponent;
|
|
10364
10471
|
exports.ArcInfo = ArcInfo;
|