@visactor/vrender-components 0.15.0-alpha.23 → 0.15.0-alpha.25
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/link-path/index.js +1 -2
- package/cjs/link-path/link-path.js +1 -1
- package/cjs/link-path/type.js +1 -1
- package/cjs/marker/area.d.ts +20 -1
- package/cjs/marker/area.js +35 -33
- package/cjs/marker/area.js.map +1 -1
- package/cjs/marker/base.d.ts +0 -1
- package/cjs/marker/base.js +17 -24
- 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 +12 -23
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/point.d.ts +7 -7
- package/cjs/marker/point.js +7 -16
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/type.d.ts +5 -9
- package/cjs/marker/type.js.map +1 -1
- package/cjs/pager/index.js +2 -1
- package/cjs/pager/pager.js +1 -1
- package/cjs/pager/type.js +1 -1
- package/cjs/segment/segment.d.ts +6 -11
- package/cjs/segment/segment.js +40 -82
- package/cjs/segment/segment.js.map +1 -1
- package/cjs/segment/type.d.ts +3 -5
- 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/{label-smartInvert.js → labelSmartInvert.js} +1 -1
- package/cjs/util/labelSmartInvert.js.map +1 -0
- package/dist/index.js +163 -297
- 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/link-path/index.js +1 -2
- package/es/link-path/link-path.js +1 -1
- package/es/link-path/type.js +1 -1
- package/es/marker/area.d.ts +20 -1
- package/es/marker/area.js +34 -34
- package/es/marker/area.js.map +1 -1
- package/es/marker/base.d.ts +0 -1
- package/es/marker/base.js +18 -22
- 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 +11 -24
- package/es/marker/line.js.map +1 -1
- package/es/marker/point.d.ts +7 -7
- package/es/marker/point.js +6 -17
- package/es/marker/point.js.map +1 -1
- package/es/marker/type.d.ts +5 -9
- package/es/marker/type.js.map +1 -1
- package/es/pager/index.js +2 -1
- package/es/pager/pager.js +1 -1
- package/es/pager/type.js +1 -1
- package/es/segment/segment.d.ts +6 -11
- package/es/segment/segment.js +41 -81
- package/es/segment/segment.js.map +1 -1
- package/es/segment/type.d.ts +3 -5
- 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/{label-smartInvert.js → labelSmartInvert.js} +1 -1
- package/es/util/labelSmartInvert.js.map +1 -0
- package/package.json +2 -2
- package/cjs/marker/util.d.ts +0 -1
- package/cjs/marker/util.js +0 -3
- package/cjs/marker/util.js.map +0 -1
- package/cjs/util/label-smartInvert.js.map +0 -1
- package/cjs/util/limit-shape.d.ts +0 -3
- package/cjs/util/limit-shape.js +0 -14
- package/cjs/util/limit-shape.js.map +0 -1
- package/es/marker/util.d.ts +0 -1
- package/es/marker/util.js +0 -3
- package/es/marker/util.js.map +0 -1
- package/es/util/label-smartInvert.js.map +0 -1
- package/es/util/limit-shape.d.ts +0 -3
- package/es/util/limit-shape.js +0 -8
- package/es/util/limit-shape.js.map +0 -1
- /package/cjs/util/{label-smartInvert.d.ts → labelSmartInvert.d.ts} +0 -0
- /package/es/util/{label-smartInvert.d.ts → labelSmartInvert.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,74 +3198,69 @@
|
|
|
3211
3198
|
};
|
|
3212
3199
|
|
|
3213
3200
|
class Segment extends AbstractComponent {
|
|
3214
|
-
getStartAngle() {
|
|
3215
|
-
return this._startAngle;
|
|
3216
|
-
}
|
|
3217
|
-
getEndAngle() {
|
|
3218
|
-
return this._endAngle;
|
|
3219
|
-
}
|
|
3220
|
-
getMainSegmentPoints() {
|
|
3221
|
-
return this._mainSegmentPoints;
|
|
3222
|
-
}
|
|
3223
3201
|
constructor(attributes) {
|
|
3224
3202
|
super(vutils.merge({}, Segment.defaultAttributes, attributes));
|
|
3225
3203
|
this.name = 'segment';
|
|
3226
3204
|
}
|
|
3205
|
+
computeLineAngle() {
|
|
3206
|
+
const { points } = this.attribute;
|
|
3207
|
+
const start = points[0];
|
|
3208
|
+
const startInside = points[1];
|
|
3209
|
+
const endInside = points[points.length - 2];
|
|
3210
|
+
const end = points[points.length - 1];
|
|
3211
|
+
const startVector = [start.x - startInside.x, start.y - startInside.y];
|
|
3212
|
+
const startAngle = Math.atan2(startVector[1], startVector[0]);
|
|
3213
|
+
const endVector = [end.x - endInside.x, end.y - endInside.y];
|
|
3214
|
+
const endAngle = Math.atan2(endVector[1], endVector[0]);
|
|
3215
|
+
this._startAngle = startAngle;
|
|
3216
|
+
this._endAngle = endAngle;
|
|
3217
|
+
}
|
|
3227
3218
|
render() {
|
|
3228
3219
|
this.removeAllChild();
|
|
3229
|
-
this.
|
|
3230
|
-
const { startSymbol, endSymbol, lineStyle, state, visible = true, multiSegment, mainSegmentIndex } = this.attribute;
|
|
3220
|
+
const { points, startSymbol, endSymbol, lineStyle, state, visible = true } = this.attribute;
|
|
3231
3221
|
if (!visible) {
|
|
3232
3222
|
return;
|
|
3233
3223
|
}
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3224
|
+
if (points.length > 1) {
|
|
3225
|
+
this.computeLineAngle();
|
|
3226
|
+
}
|
|
3227
|
+
const startSymbolShape = this.renderSymbol(startSymbol, 'start');
|
|
3228
|
+
const endSymbolShape = this.renderSymbol(endSymbol, 'end');
|
|
3237
3229
|
this.startSymbol = startSymbolShape;
|
|
3238
3230
|
this.endSymbol = endSymbolShape;
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
points[points.length - 1][points[points.length - 1].length - 1] =
|
|
3248
|
-
clipPoints[clipPoints.length - 1];
|
|
3249
|
-
}
|
|
3250
|
-
points.forEach((point, index) => {
|
|
3251
|
-
var _a, _b;
|
|
3252
|
-
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 }));
|
|
3253
|
-
line.name = `${this.name}-line`;
|
|
3254
|
-
line.id = this._getNodeId('line' + index);
|
|
3255
|
-
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.line)) {
|
|
3256
|
-
line.states = vutils.isArray(state.line) ? (_b = state.line[index]) !== null && _b !== void 0 ? _b : state.line[state.line.length - 1] : state.line;
|
|
3257
|
-
}
|
|
3258
|
-
this.add(line);
|
|
3259
|
-
});
|
|
3231
|
+
let pointsAfterClip = points;
|
|
3232
|
+
if (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.visible) {
|
|
3233
|
+
const startSize = (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.clip) ? (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.size) || 10 : 0;
|
|
3234
|
+
const pointsStart = {
|
|
3235
|
+
x: points[0].x - (startSize / 2) * (Math.cos(this._startAngle) || 0),
|
|
3236
|
+
y: points[0].y - (startSize / 2) * (Math.sin(this._startAngle) || 0)
|
|
3237
|
+
};
|
|
3238
|
+
pointsAfterClip = [pointsStart, ...pointsAfterClip.slice(1)];
|
|
3260
3239
|
}
|
|
3261
|
-
|
|
3262
|
-
const
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
this.add(line);
|
|
3240
|
+
if (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.visible) {
|
|
3241
|
+
const endSize = (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.clip) ? (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.size) || 10 : 0;
|
|
3242
|
+
const pointsEnd = {
|
|
3243
|
+
x: points[points.length - 1].x - (endSize / 2) * (Math.cos(this._endAngle) || 0),
|
|
3244
|
+
y: points[points.length - 1].y - (endSize / 2) * (Math.sin(this._endAngle) || 0)
|
|
3245
|
+
};
|
|
3246
|
+
pointsAfterClip = [...pointsAfterClip.slice(0, pointsAfterClip.length - 1), pointsEnd];
|
|
3269
3247
|
}
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
if (!
|
|
3274
|
-
|
|
3248
|
+
const line = vrender.createLine(Object.assign({ points: pointsAfterClip, fill: false }, lineStyle));
|
|
3249
|
+
line.name = 'line';
|
|
3250
|
+
line.id = this._getNodeId('line');
|
|
3251
|
+
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.line)) {
|
|
3252
|
+
line.states = state.line;
|
|
3275
3253
|
}
|
|
3254
|
+
this.line = line;
|
|
3255
|
+
this.add(line);
|
|
3256
|
+
}
|
|
3257
|
+
renderSymbol(attribute, dim) {
|
|
3276
3258
|
const { autoRotate = true } = attribute;
|
|
3277
3259
|
let symbol;
|
|
3278
3260
|
if (attribute === null || attribute === void 0 ? void 0 : attribute.visible) {
|
|
3279
3261
|
const startAngle = this._startAngle;
|
|
3280
3262
|
const endAngle = this._endAngle;
|
|
3281
|
-
const { state } = this.attribute;
|
|
3263
|
+
const { points, state } = this.attribute;
|
|
3282
3264
|
const start = points[0];
|
|
3283
3265
|
const end = points[points.length - 1];
|
|
3284
3266
|
const { refX = 0, refY = 0, refAngle = 0, style, symbolType, size = 12 } = attribute;
|
|
@@ -3286,22 +3268,20 @@
|
|
|
3286
3268
|
let rotate;
|
|
3287
3269
|
if (dim === 'start') {
|
|
3288
3270
|
position = {
|
|
3289
|
-
x: start.x +
|
|
3290
|
-
|
|
3291
|
-
y: start.y +
|
|
3292
|
-
(vutils.isValidNumber(startAngle) ? refX * Math.sin(startAngle) + refY * Math.sin(startAngle - Math.PI / 2) : 0)
|
|
3271
|
+
x: start.x + (startAngle ? refX * Math.cos(startAngle) + refY * Math.cos(startAngle - Math.PI / 2) : 0),
|
|
3272
|
+
y: start.y + (startAngle ? refX * Math.sin(startAngle) + refY * Math.sin(startAngle - Math.PI / 2) : 0)
|
|
3293
3273
|
};
|
|
3294
3274
|
rotate = startAngle + Math.PI / 2;
|
|
3295
3275
|
}
|
|
3296
3276
|
else {
|
|
3297
3277
|
position = {
|
|
3298
|
-
x: end.x + (
|
|
3299
|
-
y: end.y + (
|
|
3278
|
+
x: end.x + (endAngle ? refX * Math.cos(endAngle) + refY * Math.cos(endAngle - Math.PI / 2) : 0),
|
|
3279
|
+
y: end.y + (endAngle ? refX * Math.sin(endAngle) + refY * Math.sin(endAngle - Math.PI / 2) : 0)
|
|
3300
3280
|
};
|
|
3301
3281
|
rotate = endAngle + Math.PI / 2;
|
|
3302
3282
|
}
|
|
3303
3283
|
symbol = vrender.createSymbol(Object.assign(Object.assign(Object.assign({}, position), { symbolType: symbolType, size, angle: autoRotate ? rotate + refAngle : 0, strokeBoundsBuffer: 0 }), style));
|
|
3304
|
-
symbol.name = `${
|
|
3284
|
+
symbol.name = `${dim}-symbol`;
|
|
3305
3285
|
symbol.id = this._getNodeId(`${dim}-symbol`);
|
|
3306
3286
|
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.symbol)) {
|
|
3307
3287
|
symbol.states = state.symbol;
|
|
@@ -3310,69 +3290,11 @@
|
|
|
3310
3290
|
}
|
|
3311
3291
|
return symbol;
|
|
3312
3292
|
}
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
return this._mainSegmentPoints;
|
|
3316
|
-
}
|
|
3317
|
-
const { points: originPoints, multiSegment, mainSegmentIndex } = this.attribute;
|
|
3318
|
-
let points;
|
|
3319
|
-
if (multiSegment) {
|
|
3320
|
-
if (vutils.isValidNumber(mainSegmentIndex)) {
|
|
3321
|
-
points = originPoints[mainSegmentIndex];
|
|
3322
|
-
}
|
|
3323
|
-
else {
|
|
3324
|
-
points = vutils.flattenArray(originPoints);
|
|
3325
|
-
}
|
|
3326
|
-
}
|
|
3327
|
-
else {
|
|
3328
|
-
points = originPoints;
|
|
3329
|
-
}
|
|
3330
|
-
this._mainSegmentPoints = points;
|
|
3331
|
-
return points;
|
|
3332
|
-
}
|
|
3333
|
-
_clipPoints(points) {
|
|
3334
|
-
const { startSymbol, endSymbol } = this.attribute;
|
|
3335
|
-
let pointsAfterClip = points;
|
|
3336
|
-
if (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.visible) {
|
|
3337
|
-
const startSize = (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.clip) ? (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.size) || 10 : 0;
|
|
3338
|
-
const pointsStart = {
|
|
3339
|
-
x: points[0].x - (startSize / 2) * (Math.cos(this._startAngle) || 0),
|
|
3340
|
-
y: points[0].y - (startSize / 2) * (Math.sin(this._startAngle) || 0)
|
|
3341
|
-
};
|
|
3342
|
-
pointsAfterClip = [pointsStart, ...pointsAfterClip.slice(1)];
|
|
3343
|
-
}
|
|
3344
|
-
if (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.visible) {
|
|
3345
|
-
const endSize = (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.clip) ? (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.size) || 10 : 0;
|
|
3346
|
-
const pointsEnd = {
|
|
3347
|
-
x: points[points.length - 1].x - (endSize / 2) * (Math.cos(this._endAngle) || 0),
|
|
3348
|
-
y: points[points.length - 1].y - (endSize / 2) * (Math.sin(this._endAngle) || 0)
|
|
3349
|
-
};
|
|
3350
|
-
pointsAfterClip = [...pointsAfterClip.slice(0, pointsAfterClip.length - 1), pointsEnd];
|
|
3351
|
-
}
|
|
3352
|
-
return pointsAfterClip;
|
|
3353
|
-
}
|
|
3354
|
-
_computeLineAngle() {
|
|
3355
|
-
const points = this._getMainSegmentPoints();
|
|
3356
|
-
if (points.length <= 1) {
|
|
3357
|
-
return;
|
|
3358
|
-
}
|
|
3359
|
-
const start = points[0];
|
|
3360
|
-
const startInside = points[1];
|
|
3361
|
-
const endInside = points[points.length - 2];
|
|
3362
|
-
const end = points[points.length - 1];
|
|
3363
|
-
const startVector = [start.x - startInside.x, start.y - startInside.y];
|
|
3364
|
-
const startAngle = Math.atan2(startVector[1], startVector[0]);
|
|
3365
|
-
const endVector = [end.x - endInside.x, end.y - endInside.y];
|
|
3366
|
-
const endAngle = Math.atan2(endVector[1], endVector[0]);
|
|
3367
|
-
this._startAngle = startAngle;
|
|
3368
|
-
this._endAngle = endAngle;
|
|
3293
|
+
getStartAngle() {
|
|
3294
|
+
return this._startAngle;
|
|
3369
3295
|
}
|
|
3370
|
-
|
|
3371
|
-
this.
|
|
3372
|
-
this.endSymbol = null;
|
|
3373
|
-
this._startAngle = null;
|
|
3374
|
-
this._endAngle = null;
|
|
3375
|
-
this._mainSegmentPoints = null;
|
|
3296
|
+
getEndAngle() {
|
|
3297
|
+
return this._endAngle;
|
|
3376
3298
|
}
|
|
3377
3299
|
}
|
|
3378
3300
|
Segment.defaultAttributes = {
|
|
@@ -6084,36 +6006,25 @@
|
|
|
6084
6006
|
})(exports.IMarkPointItemPosition || (exports.IMarkPointItemPosition = {}));
|
|
6085
6007
|
|
|
6086
6008
|
class Marker extends AbstractComponent {
|
|
6087
|
-
constructor() {
|
|
6088
|
-
super(...arguments);
|
|
6089
|
-
this.name = 'marker';
|
|
6090
|
-
}
|
|
6091
6009
|
_initContainer() {
|
|
6092
|
-
var _a, _b;
|
|
6093
|
-
const {
|
|
6010
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
6011
|
+
const groupClip = vrender.createGroup(Object.assign(Object.assign({}, (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.clipRange), { clip: (_c = vutils.isValid((_b = this.attribute) === null || _b === void 0 ? void 0 : _b.clipRange)) !== null && _c !== void 0 ? _c : false }));
|
|
6012
|
+
groupClip.name = 'marker-container';
|
|
6094
6013
|
const group = vrender.createGroup({
|
|
6095
|
-
x: -((
|
|
6096
|
-
y: -((
|
|
6014
|
+
x: -((_f = (_e = (_d = this.attribute) === null || _d === void 0 ? void 0 : _d.clipRange) === null || _e === void 0 ? void 0 : _e.x) !== null && _f !== void 0 ? _f : 0),
|
|
6015
|
+
y: -((_j = (_h = (_g = this.attribute) === null || _g === void 0 ? void 0 : _g.clipRange) === null || _h === void 0 ? void 0 : _h.y) !== null && _j !== void 0 ? _j : 0)
|
|
6097
6016
|
});
|
|
6098
|
-
group
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
groupClip.add(group);
|
|
6102
|
-
this._containerClip = groupClip;
|
|
6103
|
-
this.add(groupClip);
|
|
6104
|
-
}
|
|
6105
|
-
else {
|
|
6106
|
-
this.add(group);
|
|
6107
|
-
}
|
|
6017
|
+
groupClip.add(group);
|
|
6018
|
+
this._containerClip = groupClip;
|
|
6019
|
+
this.add(groupClip);
|
|
6108
6020
|
this._container = group;
|
|
6109
6021
|
}
|
|
6110
6022
|
_updateContainer() {
|
|
6111
|
-
var _a, _b, _c;
|
|
6112
|
-
|
|
6113
|
-
(_a = this._containerClip) === null || _a === void 0 ? void 0 : _a.setAttributes(Object.assign({}, limitRect));
|
|
6023
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
6024
|
+
this._containerClip.setAttributes(Object.assign(Object.assign({}, (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.clipRange), { clip: (_c = vutils.isValid((_b = this.attribute) === null || _b === void 0 ? void 0 : _b.clipRange)) !== null && _c !== void 0 ? _c : false }));
|
|
6114
6025
|
this._container.setAttributes({
|
|
6115
|
-
x: -((
|
|
6116
|
-
y: -((
|
|
6026
|
+
x: -((_f = (_e = (_d = this.attribute) === null || _d === void 0 ? void 0 : _d.clipRange) === null || _e === void 0 ? void 0 : _e.x) !== null && _f !== void 0 ? _f : 0),
|
|
6027
|
+
y: -((_j = (_h = (_g = this.attribute) === null || _g === void 0 ? void 0 : _g.clipRange) === null || _h === void 0 ? void 0 : _h.y) !== null && _j !== void 0 ? _j : 0)
|
|
6117
6028
|
});
|
|
6118
6029
|
}
|
|
6119
6030
|
render() {
|
|
@@ -6125,7 +6036,7 @@
|
|
|
6125
6036
|
this.setAttribute('childrenPickable', false);
|
|
6126
6037
|
}
|
|
6127
6038
|
if (markerVisible) {
|
|
6128
|
-
if (!this.
|
|
6039
|
+
if (!this._containerClip) {
|
|
6129
6040
|
this._initContainer();
|
|
6130
6041
|
this.initMarker(this._container);
|
|
6131
6042
|
}
|
|
@@ -6362,84 +6273,47 @@
|
|
|
6362
6273
|
}
|
|
6363
6274
|
};
|
|
6364
6275
|
|
|
6365
|
-
function limitShapeInBounds(shape, bounds) {
|
|
6366
|
-
const { x1: regionMinX, y1: regionMinY, x2: regionMaxX, y2: regionMaxY } = bounds;
|
|
6367
|
-
const { x1, y1, x2, y2 } = shape.AABBBounds;
|
|
6368
|
-
const { dx: originDx = 0, dy: originDy = 0 } = shape.attribute;
|
|
6369
|
-
let dx = 0;
|
|
6370
|
-
let dy = 0;
|
|
6371
|
-
if (x1 < regionMinX) {
|
|
6372
|
-
dx = regionMinX - x1;
|
|
6373
|
-
}
|
|
6374
|
-
if (y1 < regionMinY) {
|
|
6375
|
-
dy = regionMinY - y1;
|
|
6376
|
-
}
|
|
6377
|
-
if (x2 > regionMaxX) {
|
|
6378
|
-
dx = regionMaxX - x2;
|
|
6379
|
-
}
|
|
6380
|
-
if (y2 > regionMaxY) {
|
|
6381
|
-
dy = regionMaxY - y2;
|
|
6382
|
-
}
|
|
6383
|
-
if (dx) {
|
|
6384
|
-
shape.setAttribute('dx', dx + originDx);
|
|
6385
|
-
}
|
|
6386
|
-
if (dy) {
|
|
6387
|
-
shape.setAttribute('dy', dy + originDy);
|
|
6388
|
-
}
|
|
6389
|
-
}
|
|
6390
|
-
|
|
6391
6276
|
class MarkLine extends Marker {
|
|
6392
6277
|
constructor(attributes) {
|
|
6393
6278
|
super(vutils.merge({}, MarkLine.defaultAttributes, attributes));
|
|
6394
6279
|
}
|
|
6395
6280
|
setLabelPos() {
|
|
6396
|
-
var _a, _b;
|
|
6397
|
-
const {
|
|
6398
|
-
const
|
|
6399
|
-
const
|
|
6400
|
-
const
|
|
6401
|
-
const
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
if (position.includes('start') || position.includes('Start')) {
|
|
6405
|
-
labelPoint = {
|
|
6281
|
+
var _a, _b, _c, _d, _e;
|
|
6282
|
+
const { points, label } = this.attribute;
|
|
6283
|
+
const labelPosition = (_a = label === null || label === void 0 ? void 0 : label.position) !== null && _a !== void 0 ? _a : 'end';
|
|
6284
|
+
const labelAngle = this._line.getEndAngle();
|
|
6285
|
+
const labelOffsetX = (label === null || label === void 0 ? void 0 : label.refX) * Math.cos(labelAngle) + label.refY * Math.cos(labelAngle - Math.PI / 2);
|
|
6286
|
+
const labelOffsetY = (label === null || label === void 0 ? void 0 : label.refX) * Math.sin(labelAngle) + label.refY * Math.sin(labelAngle - Math.PI / 2);
|
|
6287
|
+
if (labelPosition.includes('start') || labelPosition.includes('Start')) {
|
|
6288
|
+
(_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes({
|
|
6406
6289
|
x: points[0].x + labelOffsetX,
|
|
6407
6290
|
y: points[0].y + labelOffsetY
|
|
6408
|
-
};
|
|
6291
|
+
});
|
|
6409
6292
|
}
|
|
6410
|
-
else if (
|
|
6411
|
-
|
|
6293
|
+
else if (labelPosition.includes('middle') || labelPosition.includes('Middle')) {
|
|
6294
|
+
(_c = this._label) === null || _c === void 0 ? void 0 : _c.setAttributes({
|
|
6412
6295
|
x: (points[0].x + points[points.length - 1].x) / 2 + labelOffsetX,
|
|
6413
6296
|
y: (points[0].y + points[points.length - 1].y) / 2 + labelOffsetY
|
|
6414
|
-
};
|
|
6297
|
+
});
|
|
6415
6298
|
}
|
|
6416
6299
|
else {
|
|
6417
|
-
|
|
6300
|
+
(_d = this._label) === null || _d === void 0 ? void 0 : _d.setAttributes({
|
|
6418
6301
|
x: points[points.length - 1].x + labelOffsetX,
|
|
6419
6302
|
y: points[points.length - 1].y + labelOffsetY
|
|
6420
|
-
};
|
|
6421
|
-
}
|
|
6422
|
-
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) }));
|
|
6423
|
-
if (limitRect && confine) {
|
|
6424
|
-
const { x, y, width, height } = limitRect;
|
|
6425
|
-
limitShapeInBounds(this._label, {
|
|
6426
|
-
x1: x,
|
|
6427
|
-
y1: y,
|
|
6428
|
-
x2: x + width,
|
|
6429
|
-
y2: y + height
|
|
6430
6303
|
});
|
|
6431
6304
|
}
|
|
6305
|
+
this._label.setAttributes({
|
|
6306
|
+
angle: label.autoRotate && labelAngle + ((_e = label === null || label === void 0 ? void 0 : label.refAngle) !== null && _e !== void 0 ? _e : 0),
|
|
6307
|
+
textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_LINE_TEXT_STYLE_MAP[labelPosition]), label.textStyle)
|
|
6308
|
+
});
|
|
6432
6309
|
}
|
|
6433
6310
|
initMarker(container) {
|
|
6434
|
-
const { points, startSymbol, endSymbol, label, lineStyle
|
|
6435
|
-
.attribute;
|
|
6311
|
+
const { points, startSymbol, endSymbol, label, lineStyle } = this.attribute;
|
|
6436
6312
|
const line = new Segment({
|
|
6437
6313
|
points,
|
|
6438
6314
|
startSymbol,
|
|
6439
6315
|
endSymbol,
|
|
6440
|
-
lineStyle
|
|
6441
|
-
mainSegmentIndex,
|
|
6442
|
-
multiSegment
|
|
6316
|
+
lineStyle
|
|
6443
6317
|
});
|
|
6444
6318
|
line.name = 'mark-line-line';
|
|
6445
6319
|
this._line = line;
|
|
@@ -6469,54 +6343,58 @@
|
|
|
6469
6343
|
constructor(attributes) {
|
|
6470
6344
|
super(vutils.merge({}, MarkArea.defaultAttributes, attributes));
|
|
6471
6345
|
}
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
}
|
|
6346
|
+
getLeftPos() {
|
|
6347
|
+
return {
|
|
6348
|
+
x: this._area.AABBBounds.x1,
|
|
6349
|
+
y: (this._area.AABBBounds.y1 + this._area.AABBBounds.y2) / 2
|
|
6350
|
+
};
|
|
6351
|
+
}
|
|
6352
|
+
getRightPos() {
|
|
6353
|
+
return {
|
|
6354
|
+
x: this._area.AABBBounds.x2,
|
|
6355
|
+
y: (this._area.AABBBounds.y1 + this._area.AABBBounds.y2) / 2
|
|
6356
|
+
};
|
|
6357
|
+
}
|
|
6358
|
+
getTopPos() {
|
|
6359
|
+
return {
|
|
6360
|
+
x: (this._area.AABBBounds.x1 + this._area.AABBBounds.x2) / 2,
|
|
6361
|
+
y: this._area.AABBBounds.y1
|
|
6362
|
+
};
|
|
6363
|
+
}
|
|
6364
|
+
getBottomPos() {
|
|
6365
|
+
return {
|
|
6366
|
+
x: (this._area.AABBBounds.x1 + this._area.AABBBounds.x2) / 2,
|
|
6367
|
+
y: this._area.AABBBounds.y2
|
|
6368
|
+
};
|
|
6369
|
+
}
|
|
6370
|
+
getMiddlePos() {
|
|
6498
6371
|
return {
|
|
6499
|
-
x: (x1 + x2) / 2,
|
|
6500
|
-
y: (y1 + y2) / 2
|
|
6372
|
+
x: (this._area.AABBBounds.x1 + this._area.AABBBounds.x2) / 2,
|
|
6373
|
+
y: (this._area.AABBBounds.y1 + this._area.AABBBounds.y2) / 2
|
|
6501
6374
|
};
|
|
6502
6375
|
}
|
|
6503
6376
|
setLabelPos() {
|
|
6504
|
-
var _a;
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
}
|
|
6377
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6378
|
+
const { label } = this.attribute;
|
|
6379
|
+
const labelPosition = (_a = label === null || label === void 0 ? void 0 : label.position) !== null && _a !== void 0 ? _a : 'middle';
|
|
6380
|
+
if (labelPosition.includes('left') || labelPosition.includes('Left')) {
|
|
6381
|
+
(_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({}, this.getLeftPos()));
|
|
6382
|
+
}
|
|
6383
|
+
else if (labelPosition.includes('right') || labelPosition.includes('Right')) {
|
|
6384
|
+
(_c = this._label) === null || _c === void 0 ? void 0 : _c.setAttributes(Object.assign({}, this.getRightPos()));
|
|
6385
|
+
}
|
|
6386
|
+
else if (labelPosition.includes('top') || labelPosition.includes('Top')) {
|
|
6387
|
+
(_d = this._label) === null || _d === void 0 ? void 0 : _d.setAttributes(Object.assign({}, this.getTopPos()));
|
|
6388
|
+
}
|
|
6389
|
+
else if (labelPosition.includes('bottom') || labelPosition.includes('Bottom')) {
|
|
6390
|
+
(_e = this._label) === null || _e === void 0 ? void 0 : _e.setAttributes(Object.assign({}, this.getBottomPos()));
|
|
6519
6391
|
}
|
|
6392
|
+
else {
|
|
6393
|
+
(_f = this._label) === null || _f === void 0 ? void 0 : _f.setAttributes(Object.assign({}, this.getMiddlePos()));
|
|
6394
|
+
}
|
|
6395
|
+
(_g = this._label) === null || _g === void 0 ? void 0 : _g.setAttributes({
|
|
6396
|
+
textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_AREA_TEXT_STYLE_MAP[labelPosition]), label.textStyle)
|
|
6397
|
+
});
|
|
6520
6398
|
}
|
|
6521
6399
|
initMarker(container) {
|
|
6522
6400
|
const { points, label, areaStyle } = this.attribute;
|
|
@@ -6547,43 +6425,31 @@
|
|
|
6547
6425
|
setLabelPos() {
|
|
6548
6426
|
}
|
|
6549
6427
|
setItemAttributes(item, itemContent, itemPosition, itemType) {
|
|
6550
|
-
var _a
|
|
6551
|
-
if (!item) {
|
|
6552
|
-
return;
|
|
6553
|
-
}
|
|
6428
|
+
var _a;
|
|
6554
6429
|
const { autoRotate = true, refX = 0, refY = 0, refAngle = 0, textStyle, richTextStyle, imageStyle, position = exports.IMarkPointItemPosition.middle } = itemContent;
|
|
6555
6430
|
const itemAngle = ((_a = this._line) === null || _a === void 0 ? void 0 : _a.getEndAngle()) || 0;
|
|
6556
6431
|
const itemOffsetX = refX * Math.cos(itemAngle) + refY * Math.cos(itemAngle - Math.PI / 2);
|
|
6557
6432
|
const itemOffsetY = refX * Math.sin(itemAngle) + refY * Math.sin(itemAngle - Math.PI / 2);
|
|
6558
6433
|
if (itemType === 'text') {
|
|
6559
|
-
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) }));
|
|
6434
|
+
item === null || item === void 0 ? void 0 : 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) }));
|
|
6560
6435
|
}
|
|
6561
6436
|
else if (itemType === 'richText') {
|
|
6562
|
-
item.setAttributes({
|
|
6437
|
+
item === null || item === void 0 ? void 0 : item.setAttributes({
|
|
6563
6438
|
dx: this.getItemDx(item, position, richTextStyle) + ((richTextStyle === null || richTextStyle === void 0 ? void 0 : richTextStyle.dx) || 0),
|
|
6564
6439
|
dy: this.getItemDy(item, position, richTextStyle) + ((richTextStyle === null || richTextStyle === void 0 ? void 0 : richTextStyle.dy) || 0)
|
|
6565
6440
|
});
|
|
6566
6441
|
}
|
|
6567
6442
|
else if (itemType === 'image') {
|
|
6568
|
-
item.setAttributes({
|
|
6443
|
+
item === null || item === void 0 ? void 0 : item.setAttributes({
|
|
6569
6444
|
dx: this.getItemDx(item, position, imageStyle) + ((imageStyle === null || imageStyle === void 0 ? void 0 : imageStyle.dx) || 0),
|
|
6570
6445
|
dy: this.getItemDy(item, position, imageStyle) + ((imageStyle === null || imageStyle === void 0 ? void 0 : imageStyle.dy) || 0)
|
|
6571
6446
|
});
|
|
6572
6447
|
}
|
|
6573
|
-
item.setAttributes({
|
|
6448
|
+
item === null || item === void 0 ? void 0 : item.setAttributes({
|
|
6574
6449
|
x: itemPosition.x + (itemOffsetX || 0),
|
|
6575
6450
|
y: itemPosition.y + (itemOffsetY || 0),
|
|
6576
6451
|
angle: autoRotate && itemAngle + refAngle
|
|
6577
6452
|
});
|
|
6578
|
-
if (this.attribute.limitRect && ((_b = this.attribute.itemContent) === null || _b === void 0 ? void 0 : _b.confine)) {
|
|
6579
|
-
const { x, y, width, height } = this.attribute.limitRect;
|
|
6580
|
-
limitShapeInBounds(item, {
|
|
6581
|
-
x1: x,
|
|
6582
|
-
y1: y,
|
|
6583
|
-
x2: x + width,
|
|
6584
|
-
y2: y + height
|
|
6585
|
-
});
|
|
6586
|
-
}
|
|
6587
6453
|
}
|
|
6588
6454
|
getItemDx(item, position, style) {
|
|
6589
6455
|
var _a, _b;
|
|
@@ -6591,7 +6457,7 @@
|
|
|
6591
6457
|
if (position.includes('inside')) {
|
|
6592
6458
|
return -width;
|
|
6593
6459
|
}
|
|
6594
|
-
if (position === 'insideTop') {
|
|
6460
|
+
else if (position === 'insideTop') {
|
|
6595
6461
|
return 0;
|
|
6596
6462
|
}
|
|
6597
6463
|
return 0;
|
|
@@ -6602,7 +6468,7 @@
|
|
|
6602
6468
|
if (position.includes('top') || position.includes('Top')) {
|
|
6603
6469
|
return -height;
|
|
6604
6470
|
}
|
|
6605
|
-
if (position.includes('middle') || position.includes('Middle')) {
|
|
6471
|
+
else if (position.includes('middle') || position.includes('Middle')) {
|
|
6606
6472
|
return -height / 2;
|
|
6607
6473
|
}
|
|
6608
6474
|
return 0;
|
|
@@ -10479,7 +10345,7 @@
|
|
|
10479
10345
|
return new Tag(params ? params.attribute : {});
|
|
10480
10346
|
}
|
|
10481
10347
|
|
|
10482
|
-
const version = "0.15.0-alpha.
|
|
10348
|
+
const version = "0.15.0-alpha.25";
|
|
10483
10349
|
|
|
10484
10350
|
exports.AbstractComponent = AbstractComponent;
|
|
10485
10351
|
exports.ArcInfo = ArcInfo;
|