@visactor/vrender-components 0.13.5-alpha.6 → 0.13.6
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/base.d.ts +10 -13
- package/cjs/label/base.js +56 -113
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/dataLabel.js +2 -3
- package/cjs/label/dataLabel.js.map +1 -1
- package/cjs/label/index.d.ts +0 -1
- package/cjs/label/index.js +1 -2
- package/cjs/label/index.js.map +1 -1
- package/cjs/label/overlap/place.d.ts +4 -8
- package/cjs/label/overlap/place.js +2 -14
- package/cjs/label/overlap/place.js.map +1 -1
- package/cjs/label/rect.d.ts +3 -5
- package/cjs/label/rect.js.map +1 -1
- package/cjs/label/symbol.d.ts +3 -5
- package/cjs/label/symbol.js.map +1 -1
- package/cjs/label/type.d.ts +7 -48
- package/cjs/label/type.js.map +1 -1
- package/cjs/link-path/link-path.js +2 -1
- package/cjs/marker/base.js +1 -2
- package/cjs/marker/type.js +1 -1
- package/cjs/pager/index.js +1 -1
- package/cjs/pager/pager.js +1 -1
- package/dist/index.js +75 -926
- 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/base.d.ts +10 -13
- package/es/label/base.js +59 -115
- package/es/label/base.js.map +1 -1
- package/es/label/dataLabel.js +1 -4
- package/es/label/dataLabel.js.map +1 -1
- package/es/label/index.d.ts +0 -1
- package/es/label/index.js +0 -2
- package/es/label/index.js.map +1 -1
- package/es/label/overlap/place.d.ts +4 -8
- package/es/label/overlap/place.js +0 -11
- package/es/label/overlap/place.js.map +1 -1
- package/es/label/rect.d.ts +3 -5
- package/es/label/rect.js.map +1 -1
- package/es/label/symbol.d.ts +3 -5
- package/es/label/symbol.js.map +1 -1
- package/es/label/type.d.ts +7 -48
- package/es/label/type.js.map +1 -1
- package/es/link-path/link-path.js +2 -1
- package/es/marker/base.js +1 -2
- package/es/marker/type.js +1 -1
- package/es/pager/index.js +1 -1
- package/es/pager/pager.js +1 -1
- package/package.json +4 -4
- package/cjs/label/arc.d.ts +0 -69
- package/cjs/label/arc.js +0 -396
- package/cjs/label/arc.js.map +0 -1
- package/cjs/label/constant.d.ts +0 -18
- package/cjs/label/constant.js +0 -15
- package/cjs/label/constant.js.map +0 -1
- package/cjs/label/util.d.ts +0 -10
- package/cjs/label/util.js +0 -102
- package/cjs/label/util.js.map +0 -1
- package/es/label/arc.d.ts +0 -69
- package/es/label/arc.js +0 -390
- package/es/label/arc.js.map +0 -1
- package/es/label/constant.d.ts +0 -18
- package/es/label/constant.js +0 -36
- package/es/label/constant.js.map +0 -1
- package/es/label/util.d.ts +0 -10
- package/es/label/util.js +0 -89
- package/es/label/util.js.map +0 -1
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
17
17
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
|
-
}), exports.version = void 0, exports.version = "0.13.
|
|
20
|
+
}), exports.version = void 0, exports.version = "0.13.6", __exportStar(require("./core/base"), exports),
|
|
21
21
|
__exportStar(require("./scrollbar"), exports), __exportStar(require("./tag"), exports),
|
|
22
22
|
__exportStar(require("./poptip"), exports), __exportStar(require("./crosshair"), exports),
|
|
23
23
|
__exportStar(require("./label"), exports), __exportStar(require("./axis"), exports),
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,8CAA4B;AAC5B,8CAA4B;AAC5B,wCAAsB;AACtB,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,8CAA4B","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.13.6\";\n\nexport * from './core/base';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\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';\n"]}
|
package/cjs/label/base.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { AbstractComponent } from '../core/base';
|
|
|
4
4
|
import type { PointLocationCfg } from '../core/type';
|
|
5
5
|
import type { Bitmap } from './overlap';
|
|
6
6
|
import { bitmapTool } from './overlap';
|
|
7
|
-
import type { BaseLabelAttrs,
|
|
7
|
+
import type { BaseLabelAttrs, OverlapAttrs, ILabelGraphicAttribute, ILabelAnimation } from './type';
|
|
8
8
|
export declare abstract class LabelBase<T extends BaseLabelAttrs> extends AbstractComponent<T> {
|
|
9
9
|
name: string;
|
|
10
10
|
protected _baseMarks?: IGraphic[];
|
|
@@ -12,17 +12,14 @@ export declare abstract class LabelBase<T extends BaseLabelAttrs> extends Abstra
|
|
|
12
12
|
setBitmap(bitmap: Bitmap): void;
|
|
13
13
|
protected _bmpTool?: ReturnType<typeof bitmapTool>;
|
|
14
14
|
setBitmapTool(bmpTool: ReturnType<typeof bitmapTool>): void;
|
|
15
|
-
protected
|
|
16
|
-
protected
|
|
15
|
+
protected _relationMap: Map<number, IGraphic>;
|
|
16
|
+
protected _prevRelationMap: Map<number, IGraphic>;
|
|
17
|
+
protected _textMap: Map<IGraphic, IText>;
|
|
17
18
|
onAfterLabelOverlap?: (bitmap: Bitmap) => void;
|
|
18
19
|
private _lastHover;
|
|
19
20
|
private _lastSelect;
|
|
20
21
|
private _enableAnimation;
|
|
21
|
-
protected abstract labeling(textBounds: IBoundsLike, graphicBounds: IBoundsLike, position?: BaseLabelAttrs['position'], offset?: number
|
|
22
|
-
x: number;
|
|
23
|
-
y: number;
|
|
24
|
-
} | undefined;
|
|
25
|
-
protected layoutArcLabels(position?: BaseLabelAttrs['position'], attribute?: any, currentMarks?: IGraphic[]): any;
|
|
22
|
+
protected abstract labeling(textBounds: IBoundsLike, graphicBounds: IBoundsLike, position?: BaseLabelAttrs['position'], offset?: number): Partial<ILabelGraphicAttribute> | undefined;
|
|
26
23
|
protected render(): void;
|
|
27
24
|
private _bindEvent;
|
|
28
25
|
private _setStates;
|
|
@@ -30,17 +27,17 @@ export declare abstract class LabelBase<T extends BaseLabelAttrs> extends Abstra
|
|
|
30
27
|
private _onUnHover;
|
|
31
28
|
private _onClick;
|
|
32
29
|
private _createLabelText;
|
|
33
|
-
private
|
|
34
|
-
protected layout(
|
|
35
|
-
protected
|
|
30
|
+
private _checkMarks;
|
|
31
|
+
protected layout(currentMarks?: IGraphic[]): ILabelGraphicAttribute[];
|
|
32
|
+
protected overlapping(labels: ILabelGraphicAttribute[], option?: OverlapAttrs): ILabelGraphicAttribute[];
|
|
36
33
|
protected getBaseMarks(): IGraphic<Partial<import("@visactor/vrender").IGraphicAttribute>>[];
|
|
37
34
|
protected getBaseMarkGroup(): IGroup;
|
|
38
35
|
protected getGraphicBounds(graphic?: IGraphic, point?: Partial<PointLocationCfg>): IBoundsLike;
|
|
39
|
-
protected _renderLabels(labels:
|
|
36
|
+
protected _renderLabels(labels: ILabelGraphicAttribute[]): void;
|
|
40
37
|
protected _afterRelatedGraphicAttributeUpdate(text: IText, texts: IText[], index: number, relatedGraphic: IGraphic, { mode, duration, easing, to, delay }: ILabelAnimation & {
|
|
41
38
|
to: any;
|
|
42
39
|
}): (event: any) => {};
|
|
43
|
-
protected _smartInvert(labels:
|
|
40
|
+
protected _smartInvert(labels: ILabelGraphicAttribute[]): void;
|
|
44
41
|
setLocation(point: PointLocationCfg): void;
|
|
45
42
|
disableAnimation(): void;
|
|
46
43
|
enableAnimation(): void;
|
package/cjs/label/base.js
CHANGED
|
@@ -38,16 +38,9 @@ class LabelBase extends base_1.AbstractComponent {
|
|
|
38
38
|
setBitmapTool(bmpTool) {
|
|
39
39
|
this._bmpTool = bmpTool;
|
|
40
40
|
}
|
|
41
|
-
layoutArcLabels(position, attribute, currentMarks) {
|
|
42
|
-
return [];
|
|
43
|
-
}
|
|
44
41
|
render() {
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
-
let labels, data = this.attribute.data;
|
|
48
|
-
(0, vutils_1.isFunction)(dataFilter) && (data = dataFilter(data)), (0, vutils_1.isFunction)(customLayoutFunc) ? labels = customLayoutFunc(data, (d => this._idToGraphic.get(d.id))) : (labels = this.layout(data),
|
|
49
|
-
"arc" !== this.attribute.type && ((0, vutils_1.isFunction)(customOverlapFunc) ? labels = customOverlapFunc(labels, (d => this._idToGraphic.get(d.id))) : !1 !== overlap && (labels = this._overlapping(labels)))),
|
|
50
|
-
!1 !== smartInvert && this._smartInvert(labels), this._renderLabels(labels);
|
|
42
|
+
const currentBaseMarks = this._checkMarks(), labels = this.layout(currentBaseMarks);
|
|
43
|
+
this._smartInvert(labels), this._renderLabels(labels);
|
|
51
44
|
}
|
|
52
45
|
_bindEvent(target) {
|
|
53
46
|
if (!target) return;
|
|
@@ -64,61 +57,43 @@ class LabelBase extends base_1.AbstractComponent {
|
|
|
64
57
|
const text = (0, vrender_1.createText)(attributes);
|
|
65
58
|
return this._bindEvent(text), this._setStates(text), text;
|
|
66
59
|
}
|
|
67
|
-
|
|
60
|
+
_checkMarks() {
|
|
68
61
|
var _a;
|
|
69
62
|
const baseMarks = this.getBaseMarks(), currentBaseMarks = [];
|
|
70
|
-
|
|
63
|
+
return baseMarks.forEach((mark => {
|
|
71
64
|
"willRelease" !== mark.releaseStatus && currentBaseMarks.push(mark);
|
|
72
|
-
})), null === (_a = this.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
layout(data = []) {
|
|
85
|
-
const {textStyle: textStyle = {}, position: position, offset: offset} = this.attribute, labels = [];
|
|
65
|
+
})), this._prevRelationMap = new Map(this._relationMap), null === (_a = this._relationMap) || void 0 === _a || _a.clear(),
|
|
66
|
+
currentBaseMarks;
|
|
67
|
+
}
|
|
68
|
+
layout(currentMarks) {
|
|
69
|
+
const {textStyle: textStyle, position: position, offset: offset} = this.attribute;
|
|
70
|
+
let {data: data} = this.attribute;
|
|
71
|
+
if ((0, vutils_1.isFunction)(data) && (data = data({})), !data || 0 === data.length) return [];
|
|
72
|
+
let labels = [];
|
|
73
|
+
(0, vutils_1.isFunction)(this.attribute.sort) && currentMarks && currentMarks.length && (currentMarks = currentMarks.sort(this.attribute.sort)),
|
|
74
|
+
this._relationMap || (this._relationMap = new Map);
|
|
86
75
|
for (let i = 0; i < data.length; i++) {
|
|
87
|
-
const textData = data[i], baseMark =
|
|
88
|
-
|
|
89
|
-
y: textData.y
|
|
76
|
+
const textData = data[i], baseMark = null == currentMarks ? void 0 : currentMarks[i], labelAttribute = Object.assign(Object.assign(Object.assign({}, textStyle), textData), {
|
|
77
|
+
_relatedIndex: i
|
|
90
78
|
});
|
|
91
|
-
if (
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
labels.push(
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if ("arc" === this.attribute.type) {
|
|
103
|
-
const arcs = this.layoutArcLabels(position, this.attribute, Array.from(this._idToGraphic.values()));
|
|
104
|
-
for (let i = 0; i < data.length; i++) {
|
|
105
|
-
const textData = data[i], basedArc = arcs.find((arc => arc.labelText === textData.text)), labelAttribute = {
|
|
106
|
-
x: basedArc.labelPosition.x,
|
|
107
|
-
y: basedArc.labelPosition.y,
|
|
108
|
-
textAlign: basedArc.textAlign,
|
|
109
|
-
textBaseline: basedArc.textBaseline,
|
|
110
|
-
angle: basedArc.angle
|
|
111
|
-
};
|
|
112
|
-
labels[i].setAttributes(labelAttribute), labels[i].pointA = basedArc.pointA, labels[i].pointB = basedArc.pointB,
|
|
113
|
-
labels[i].pointC = basedArc.pointC;
|
|
79
|
+
if (this._relationMap.set(i, baseMark), textData) {
|
|
80
|
+
const text = (0, vrender_1.createText)(labelAttribute);
|
|
81
|
+
text.update();
|
|
82
|
+
const textBounds = this.getGraphicBounds(text), graphicBounds = this.getGraphicBounds(baseMark, {
|
|
83
|
+
x: textData.x,
|
|
84
|
+
y: textData.y
|
|
85
|
+
}), textAttributes = this.labeling(textBounds, graphicBounds, (0, vutils_1.isFunction)(position) ? position(textData) : position, offset);
|
|
86
|
+
if (!textAttributes) continue;
|
|
87
|
+
labelAttribute.x = textAttributes.x, labelAttribute.y = textAttributes.y, labels.push(labelAttribute);
|
|
114
88
|
}
|
|
115
89
|
}
|
|
116
|
-
return labels
|
|
90
|
+
return this._baseMarks = currentMarks, !1 !== this.attribute.overlap && (labels = this.overlapping(labels, this.attribute.overlap)),
|
|
91
|
+
labels;
|
|
117
92
|
}
|
|
118
|
-
|
|
119
|
-
var _a, _b, _c, _d;
|
|
93
|
+
overlapping(labels, option = {}) {
|
|
94
|
+
var _a, _b, _c, _d, _e;
|
|
120
95
|
if (0 === labels.length) return [];
|
|
121
|
-
const
|
|
96
|
+
const result = [], baseMarkGroup = this.getBaseMarkGroup(), size = null !== (_a = option.size) && void 0 !== _a ? _a : {
|
|
122
97
|
width: null !== (_b = null == baseMarkGroup ? void 0 : baseMarkGroup.AABBBounds.width()) && void 0 !== _b ? _b : 0,
|
|
123
98
|
height: null !== (_c = null == baseMarkGroup ? void 0 : baseMarkGroup.AABBBounds.height()) && void 0 !== _c ? _c : 0
|
|
124
99
|
};
|
|
@@ -130,42 +105,27 @@ class LabelBase extends base_1.AbstractComponent {
|
|
|
130
105
|
})));
|
|
131
106
|
for (let i = 0; i < labels.length; i++) {
|
|
132
107
|
if (!1 === labels[i].visible) continue;
|
|
133
|
-
const text = labels[i], baseMark = this.
|
|
108
|
+
const text = (0, vrender_1.createText)(labels[i]), baseMark = null === (_e = this._baseMarks) || void 0 === _e ? void 0 : _e[i];
|
|
134
109
|
if (text.update(), (0, overlap_1.canPlace)(bmpTool, bitmap, text.AABBBounds, clampForce)) {
|
|
135
110
|
if (!checkBounds) {
|
|
136
|
-
bitmap.setRange((0, overlap_1.boundToRange)(bmpTool, text.AABBBounds, !0)), result.push(text);
|
|
111
|
+
bitmap.setRange((0, overlap_1.boundToRange)(bmpTool, text.AABBBounds, !0)), result.push(Object.assign({}, text.attribute));
|
|
137
112
|
continue;
|
|
138
113
|
}
|
|
139
114
|
if (checkBounds && (null == baseMark ? void 0 : baseMark.AABBBounds) && (0, overlap_1.canPlaceInside)(text.AABBBounds, null == baseMark ? void 0 : baseMark.AABBBounds)) {
|
|
140
|
-
bitmap.setRange((0, overlap_1.boundToRange)(bmpTool, text.AABBBounds, !0)), result.push(text);
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
if (clampForce) {
|
|
145
|
-
const {dx: dx = 0, dy: dy = 0} = (0, overlap_1.clampText)(text, bmpTool.width, bmpTool.height);
|
|
146
|
-
if ((0 !== dx || 0 !== dy) && (0, overlap_1.canPlace)(bmpTool, bitmap, {
|
|
147
|
-
x1: text.AABBBounds.x1 + dx,
|
|
148
|
-
x2: text.AABBBounds.x2 + dx,
|
|
149
|
-
y1: text.AABBBounds.y1 + dy,
|
|
150
|
-
y2: text.AABBBounds.y2 + dy
|
|
151
|
-
})) {
|
|
152
|
-
text.setAttributes({
|
|
153
|
-
x: text.attribute.x + dx,
|
|
154
|
-
y: text.attribute.y + dy
|
|
155
|
-
}), result.push(text);
|
|
115
|
+
bitmap.setRange((0, overlap_1.boundToRange)(bmpTool, text.AABBBounds, !0)), result.push(Object.assign({}, text.attribute));
|
|
156
116
|
continue;
|
|
157
117
|
}
|
|
158
118
|
}
|
|
159
119
|
let hasPlace = !1;
|
|
160
120
|
for (let j = 0; j < strategy.length; j++) if (hasPlace = (0, overlap_1.place)(bmpTool, bitmap, strategy[j], this.attribute, text, this.getGraphicBounds(baseMark, labels[i]), this.labeling),
|
|
161
121
|
!1 !== hasPlace) {
|
|
162
|
-
|
|
122
|
+
result.push(Object.assign(Object.assign({}, text.attribute), {
|
|
163
123
|
x: hasPlace.x,
|
|
164
124
|
y: hasPlace.y
|
|
165
|
-
})
|
|
125
|
+
}));
|
|
166
126
|
break;
|
|
167
127
|
}
|
|
168
|
-
!hasPlace && !hideOnHit && result.push(text);
|
|
128
|
+
!hasPlace && !hideOnHit && result.push(Object.assign({}, text.attribute));
|
|
169
129
|
}
|
|
170
130
|
return (0, vutils_1.isFunction)(this.onAfterLabelOverlap) && this.onAfterLabelOverlap(bitmap),
|
|
171
131
|
result;
|
|
@@ -188,23 +148,13 @@ class LabelBase extends base_1.AbstractComponent {
|
|
|
188
148
|
}
|
|
189
149
|
_renderLabels(labels) {
|
|
190
150
|
var _a, _b, _c, _d, _e;
|
|
191
|
-
const animationConfig = null !== (_a = this.attribute.animation) && void 0 !== _a ? _a : {}, disableAnimation = !1 === this._enableAnimation || !1 === animationConfig, mode = null !== (_b = animationConfig.mode) && void 0 !== _b ? _b : animate_1.DefaultLabelAnimation.mode, duration = null !== (_c = animationConfig.duration) && void 0 !== _c ? _c : animate_1.DefaultLabelAnimation.duration, easing = null !== (_d = animationConfig.easing) && void 0 !== _d ? _d : animate_1.DefaultLabelAnimation.easing, delay = null !== (_e = animationConfig.delay) && void 0 !== _e ? _e : 0, currentTextMap = new Map, prevTextMap = this.
|
|
192
|
-
labels.forEach(((
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
stroke: null !== (_e = null === (_d = null === (_c = text.attribute) || void 0 === _c ? void 0 : _c.line) || void 0 === _d ? void 0 : _d.stroke) && void 0 !== _e ? _e : null === (_f = text.attribute) || void 0 === _f ? void 0 : _f.fill,
|
|
199
|
-
lineWidth: 1,
|
|
200
|
-
path: `M${Math.round(text.pointA.x)},${Math.round(text.pointA.y)} L${Math.round(text.pointB.x)},${Math.round(text.pointB.y)} L${Math.round(text.pointC.x)},${Math.round(text.pointC.y)}`
|
|
201
|
-
}));
|
|
202
|
-
const relatedGraphic = this._idToGraphic.get(text.attribute.id), state = (null == prevTextMap ? void 0 : prevTextMap.get(relatedGraphic)) ? "update" : "enter";
|
|
203
|
-
if ("enter" === state) if (texts.push(text), "arc" === this.attribute.type && "outside" === this.attribute.position && labelLines.push(labelLine),
|
|
204
|
-
currentTextMap.set(relatedGraphic, text), !disableAnimation && relatedGraphic) {
|
|
205
|
-
const {from: from, to: to} = (0, animate_1.getAnimationAttributes)(text.attribute, "fadeIn");
|
|
206
|
-
this.add(text), "arc" === this.attribute.type && "outside" === this.attribute.position && this.add(labelLine),
|
|
207
|
-
relatedGraphic.onAnimateBind = () => {
|
|
151
|
+
const animationConfig = null !== (_a = this.attribute.animation) && void 0 !== _a ? _a : {}, disableAnimation = !1 === this._enableAnimation || !1 === animationConfig, mode = null !== (_b = animationConfig.mode) && void 0 !== _b ? _b : animate_1.DefaultLabelAnimation.mode, duration = null !== (_c = animationConfig.duration) && void 0 !== _c ? _c : animate_1.DefaultLabelAnimation.duration, easing = null !== (_d = animationConfig.easing) && void 0 !== _d ? _d : animate_1.DefaultLabelAnimation.easing, delay = null !== (_e = animationConfig.delay) && void 0 !== _e ? _e : 0, currentTextMap = new Map, prevTextMap = this._textMap || new Map, texts = [];
|
|
152
|
+
labels.forEach(((label, index) => {
|
|
153
|
+
const text = this._createLabelText(label), relatedGraphic = this._relationMap.get(label._relatedIndex), state = (null == prevTextMap ? void 0 : prevTextMap.get(relatedGraphic)) ? "update" : "enter";
|
|
154
|
+
if ("enter" === state) if (texts.push(text), currentTextMap.set(relatedGraphic, text),
|
|
155
|
+
!disableAnimation && relatedGraphic) {
|
|
156
|
+
const {from: from, to: to} = (0, animate_1.getAnimationAttributes)(label, "fadeIn");
|
|
157
|
+
this.add(text), relatedGraphic.onAnimateBind = () => {
|
|
208
158
|
text.setAttributes(from);
|
|
209
159
|
const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, {
|
|
210
160
|
mode: mode,
|
|
@@ -232,7 +182,7 @@ class LabelBase extends base_1.AbstractComponent {
|
|
|
232
182
|
animate_1.getAnimationAttributes)(label.attribute, "fadeOut").to, duration, easing).onEnd((() => {
|
|
233
183
|
this.removeChild(label);
|
|
234
184
|
}));
|
|
235
|
-
})), this.
|
|
185
|
+
})), this._textMap = currentTextMap;
|
|
236
186
|
}
|
|
237
187
|
_afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, {mode: mode, duration: duration, easing: easing, to: to, delay: delay}) {
|
|
238
188
|
const listener = event => {
|
|
@@ -268,26 +218,19 @@ class LabelBase extends base_1.AbstractComponent {
|
|
|
268
218
|
return listener;
|
|
269
219
|
}
|
|
270
220
|
_smartInvert(labels) {
|
|
271
|
-
|
|
272
|
-
for (let i = 0; i < labels.length; i++) {
|
|
273
|
-
const label = labels[i];
|
|
221
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
222
|
+
if (!1 !== this.attribute.smartInvert) for (let i = 0; i < labels.length; i++) {
|
|
223
|
+
const label = null == labels ? void 0 : labels[i];
|
|
274
224
|
if (!label) continue;
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
label.
|
|
283
|
-
|
|
284
|
-
});
|
|
285
|
-
} else if (label.attribute.lineWidth > 0) {
|
|
286
|
-
const backgroundColor = label.attribute.stroke, foregroundColor = label.attribute.fill;
|
|
287
|
-
label.setAttributes({
|
|
288
|
-
stroke: baseMark.attribute.fill,
|
|
289
|
-
fill: (0, labelSmartInvert_1.labelSmartInvert)(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors)
|
|
290
|
-
});
|
|
225
|
+
const isInside = (0, overlap_1.canPlaceInside)((0, vrender_1.createText)(label).AABBBounds, null === (_a = this._relationMap.get(label._relatedIndex)) || void 0 === _a ? void 0 : _a.AABBBounds);
|
|
226
|
+
if (label.stroke && label.lineWidth > 0) label.fill = (0, labelSmartInvert_1.labelSmartInvert)(label.fill, label.stroke, null === (_b = this.attribute.smartInvert) || void 0 === _b ? void 0 : _b.textType, null === (_c = this.attribute.smartInvert) || void 0 === _c ? void 0 : _c.contrastRatiosThreshold, null === (_d = this.attribute.smartInvert) || void 0 === _d ? void 0 : _d.alternativeColors); else if (isInside) {
|
|
227
|
+
const backgroundColor = this._relationMap.get(label._relatedIndex).attribute.fill, foregroundColor = label.fill;
|
|
228
|
+
label.fill = (0, labelSmartInvert_1.labelSmartInvert)(foregroundColor, backgroundColor, null === (_e = this.attribute.smartInvert) || void 0 === _e ? void 0 : _e.textType, null === (_f = this.attribute.smartInvert) || void 0 === _f ? void 0 : _f.contrastRatiosThreshold, null === (_g = this.attribute.smartInvert) || void 0 === _g ? void 0 : _g.alternativeColors);
|
|
229
|
+
} else if (label.lineWidth > 0) {
|
|
230
|
+
const baseMark = this._relationMap.get(label._relatedIndex);
|
|
231
|
+
label.stroke = baseMark.attribute.fill;
|
|
232
|
+
const backgroundColor = label.stroke, foregroundColor = label.fill;
|
|
233
|
+
label.fill = (0, labelSmartInvert_1.labelSmartInvert)(foregroundColor, backgroundColor, null === (_h = this.attribute.smartInvert) || void 0 === _h ? void 0 : _h.textType, null === (_j = this.attribute.smartInvert) || void 0 === _j ? void 0 : _j.contrastRatiosThreshold, null === (_k = this.attribute.smartInvert) || void 0 === _k ? void 0 : _k.alternativeColors);
|
|
291
234
|
}
|
|
292
235
|
}
|
|
293
236
|
}
|
package/cjs/label/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["label/base.ts"],"names":[],"mappings":";;;AAIA,+CAA+F;AAE/F,6CAA+E;AAC/E,uCAAiD;AAEjD,+DAA4D;AAC5D,kCAAwC;AACxC,0CAAyC;AAEzC,uCAAiG;AAEjG,+CAAkF;AAGlF,MAAsB,SAAoC,SAAQ,wBAAoB;IAAtF;;QACE,SAAI,GAAG,OAAO,CAAC;QA+GP,aAAQ,GAAG,CAAC,CAAwB,EAAE,EAAE;YAC9C,MAAM,MAAM,GAAG,CAAC,CAAC,MAA6B,CAAC;YAC/C,IAAI,MAAM,KAAK,IAAI,CAAC,UAAU,IAAI,CAAC,IAAA,gBAAO,EAAC,MAAM,CAAC,MAAM,CAAC,EAAE;gBACzD,MAAM,CAAC,QAAQ,CAAC,qBAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;gBACxC,IAAA,oBAAa,EAAC,IAA2B,EAAE,CAAC,IAAc,EAAE,EAAE;oBAC5D,IAAI,IAAI,KAAK,MAAM,IAAI,CAAC,IAAA,gBAAO,EAAC,IAAI,CAAC,MAAM,CAAC,EAAE;wBAC5C,IAAI,CAAC,QAAQ,CAAC,qBAAU,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;qBAC9C;gBACH,CAAC,CAAC,CAAC;gBACH,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;aAC1B;QACH,CAAC,CAAC;QAEM,eAAU,GAAG,CAAC,CAAwB,EAAE,EAAE;YAChD,IAAI,IAAI,CAAC,UAAU,EAAE;gBACnB,IAAA,oBAAa,EAAC,IAA2B,EAAE,CAAC,IAAc,EAAE,EAAE;oBAC5D,IAAI,CAAC,IAAA,gBAAO,EAAC,IAA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AG,IAAI,CAAC;IAC/B,CAAC;CACF;AAxpBD,8BAwpBC","file":"base.js","sourcesContent":["/**\n * @description Label 基类\n */\nimport type { IGroup, Text, IGraphic, IText, FederatedPointerEvent, IColor, IPath, Path } from '@visactor/vrender';\nimport { createText, IncreaseCount, AttributeUpdateType, createPath } from '@visactor/vrender';\nimport type { IBoundsLike } from '@visactor/vutils';\nimport { isFunction, isValidNumber, isEmpty, isValid } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { PointLocationCfg } from '../core/type';\nimport { labelSmartInvert } from '../util/labelSmartInvert';\nimport { traverseGroup } from '../util';\nimport { StateValue } from '../constant';\nimport type { Bitmap } from './overlap';\nimport { bitmapTool, boundToRange, canPlace, canPlaceInside, clampText, place } from './overlap';\nimport type { BaseLabelAttrs, OverlapAttrs, ILabelAnimation, ArcLabelAttrs, LabelItem, SmartInvertAttrs } from './type';\nimport { DefaultLabelAnimation, getAnimationAttributes } from './animate/animate';\nimport type { ArcInfo } from './arc';\n\nexport abstract class LabelBase<T extends BaseLabelAttrs> extends AbstractComponent<T> {\n name = 'label';\n\n protected _baseMarks?: IGraphic[];\n\n protected _bitmap?: Bitmap;\n\n setBitmap(bitmap: Bitmap) {\n this._bitmap = bitmap;\n }\n\n protected _bmpTool?: ReturnType<typeof bitmapTool>;\n setBitmapTool(bmpTool: ReturnType<typeof bitmapTool>) {\n this._bmpTool = bmpTool;\n }\n\n protected _graphicToText: Map<IGraphic, IText>;\n\n protected _idToGraphic: Map<string, IGraphic>;\n\n onAfterLabelOverlap?: (bitmap: Bitmap) => void;\n\n private _lastHover: IGraphic;\n private _lastSelect: IGraphic;\n\n private _enableAnimation: boolean;\n\n protected abstract labeling(\n textBounds: IBoundsLike,\n graphicBounds: IBoundsLike,\n position?: BaseLabelAttrs['position'],\n offset?: number,\n\n graphicAttributes?: any,\n textData?: any,\n width?: number,\n height?: number,\n attribute?: any\n ): { x: number; y: number } | undefined;\n\n protected layoutArcLabels(position?: BaseLabelAttrs['position'], attribute?: any, currentMarks?: IGraphic[]): any {\n const arcs: ArcInfo[] = [];\n return arcs;\n }\n\n protected render() {\n this._prepare();\n\n const { overlap, smartInvert, dataFilter, customLayoutFunc, customOverlapFunc } = this.attribute;\n let data = this.attribute.data;\n\n if (isFunction(dataFilter)) {\n data = dataFilter(data);\n }\n\n let labels: IText[];\n\n if (isFunction(customLayoutFunc)) {\n labels = customLayoutFunc(data, (d: LabelItem) => this._idToGraphic.get(d.id));\n } else {\n // 根据关联图元和配置的position计算标签坐标\n labels = this.layout(data);\n\n if (this.attribute.type !== 'arc') {\n if (isFunction(customOverlapFunc)) {\n labels = customOverlapFunc(labels as Text[], (d: LabelItem) => this._idToGraphic.get(d.id));\n } else {\n // 防重叠逻辑\n if (overlap !== false) {\n labels = this._overlapping(labels);\n }\n }\n }\n }\n\n if (smartInvert !== false) {\n this._smartInvert(labels);\n }\n\n this._renderLabels(labels);\n }\n\n private _bindEvent(target: IGraphic) {\n if (!target) {\n return;\n }\n\n const { hover, select } = this.attribute;\n\n if (hover) {\n target.addEventListener('pointermove', this._onHover as EventListenerOrEventListenerObject);\n target.addEventListener('pointerout', this._onUnHover as EventListenerOrEventListenerObject);\n }\n\n if (select) {\n target.addEventListener('pointerdown', this._onClick as EventListenerOrEventListenerObject);\n }\n }\n\n private _setStates(target: IGraphic) {\n if (!target) {\n return;\n }\n const state = this.attribute.state;\n\n if (!state || isEmpty(state)) {\n return;\n }\n\n target.states = state;\n }\n\n private _onHover = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (target !== this._lastHover && !isEmpty(target.states)) {\n target.addState(StateValue.hover, true);\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (node !== target && !isEmpty(node.states)) {\n node.addState(StateValue.hoverReverse, true);\n }\n });\n this._lastHover = target;\n }\n };\n\n private _onUnHover = (e: FederatedPointerEvent) => {\n if (this._lastHover) {\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (!isEmpty(node.states)) {\n node.removeState(StateValue.hoverReverse);\n node.removeState(StateValue.hover);\n }\n });\n this._lastHover = null;\n }\n };\n\n private _onClick = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (this._lastSelect === target && target.hasState('selected')) {\n // 取消选中\n this._lastSelect = null;\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (!isEmpty(node.states)) {\n node.removeState(StateValue.selectedReverse);\n node.removeState(StateValue.selected);\n }\n });\n return;\n }\n\n if (!isEmpty(target.states)) {\n target.addState(StateValue.selected, true);\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (node !== target && !isEmpty(node.states)) {\n node.addState(StateValue.selectedReverse, true);\n }\n });\n this._lastSelect = target;\n }\n };\n\n private _createLabelText(attributes: LabelItem) {\n const text = createText(attributes);\n this._bindEvent(text);\n this._setStates(text);\n return text;\n }\n\n private _prepare() {\n const baseMarks = this.getBaseMarks();\n const currentBaseMarks: IGraphic[] = [];\n baseMarks.forEach(mark => {\n if ((mark as any).releaseStatus !== 'willRelease') {\n currentBaseMarks.push(mark);\n }\n });\n\n this._idToGraphic?.clear();\n this._baseMarks = currentBaseMarks;\n\n if (!currentBaseMarks || currentBaseMarks.length === 0) {\n return;\n }\n\n const { data } = this.attribute;\n\n if (!data || data.length === 0) {\n return;\n }\n\n if (!this._idToGraphic) {\n this._idToGraphic = new Map();\n }\n // generate id mapping before data filter\n for (let i = 0; i < currentBaseMarks.length; i++) {\n const textData = data[i];\n const baseMark = currentBaseMarks[i] as IGraphic;\n if (textData && baseMark) {\n if (!isValid(textData.id)) {\n textData.id = `vrender-component-${this.name}-${i}`;\n }\n this._idToGraphic.set(textData.id, baseMark);\n }\n }\n }\n\n protected layout(data: LabelItem[] = []): IText[] {\n const { textStyle = {}, position, offset } = this.attribute;\n const labels = [];\n\n for (let i = 0; i < data.length; i++) {\n const textData = data[i];\n const baseMark = this._idToGraphic.get(textData.id);\n\n const labelAttribute = {\n ...textStyle,\n ...textData\n };\n const text = this._createLabelText(labelAttribute);\n const textBounds = this.getGraphicBounds(text);\n const graphicBounds = this.getGraphicBounds(baseMark, { x: textData.x as number, y: textData.y as number });\n\n if (this.attribute.type === 'arc') {\n const graphicAttributes = baseMark.attribute;\n const { width, height } = this.attribute as ArcLabelAttrs;\n\n this.labeling(\n textBounds,\n graphicBounds,\n isFunction(position) ? position(textData) : position,\n offset,\n graphicAttributes,\n textData,\n width,\n height,\n this.attribute\n );\n labels.push(text);\n } else {\n const textLocation = this.labeling(\n textBounds,\n graphicBounds,\n isFunction(position) ? position(textData) : position,\n offset\n );\n if (!textLocation) {\n continue;\n }\n labelAttribute.x = textLocation.x;\n labelAttribute.y = textLocation.y;\n\n text.setAttributes(textLocation);\n labels.push(text);\n }\n }\n\n if (this.attribute.type === 'arc') {\n const arcs: ArcInfo[] = this.layoutArcLabels(position, this.attribute, Array.from(this._idToGraphic.values()));\n for (let i = 0; i < data.length; i++) {\n const textData = data[i];\n const basedArc = arcs.find(arc => arc.labelText === textData.text);\n\n const labelAttribute = {\n x: basedArc.labelPosition.x,\n y: basedArc.labelPosition.y,\n textAlign: basedArc.textAlign,\n textBaseline: basedArc.textBaseline,\n angle: basedArc.angle\n };\n\n labels[i].setAttributes(labelAttribute);\n\n // 用于做labelLine\n labels[i].pointA = basedArc.pointA;\n labels[i].pointB = basedArc.pointB;\n labels[i].pointC = basedArc.pointC;\n }\n }\n\n return labels;\n }\n\n protected _overlapping(labels: IText[]) {\n if (labels.length === 0) {\n return [];\n }\n const option = this.attribute.overlap as OverlapAttrs;\n\n const result: IText[] = [];\n const baseMarkGroup = this.getBaseMarkGroup();\n\n const size = option.size ?? {\n width: baseMarkGroup?.AABBBounds.width() ?? 0,\n height: baseMarkGroup?.AABBBounds.height() ?? 0\n };\n\n if (size.width === 0 || size.height === 0) {\n return labels;\n }\n\n const { avoidBaseMark, strategy = [], hideOnHit = true, clampForce = true } = option;\n const bmpTool = this._bmpTool || bitmapTool(size.width, size.height);\n const bitmap = this._bitmap || bmpTool.bitmap();\n const checkBounds = strategy.some(s => s.type === 'bound');\n\n if (avoidBaseMark) {\n this._baseMarks?.forEach(mark => {\n mark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, mark.AABBBounds, true));\n });\n }\n\n for (let i = 0; i < labels.length; i++) {\n if (labels[i].visible === false) {\n continue;\n }\n const text = labels[i] as IText;\n const baseMark = this._idToGraphic.get((text.attribute as LabelItem).id);\n text.update();\n\n // 默认位置可以放置\n if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce)) {\n // 如果配置了限制在图形内部,需要提前判断;\n if (!checkBounds) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n\n if (checkBounds && baseMark?.AABBBounds && canPlaceInside(text.AABBBounds, baseMark?.AABBBounds)) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push(text);\n continue;\n }\n }\n\n // 尝试向内挤压\n if (clampForce) {\n const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height);\n if (\n !(dx === 0 && dy === 0) &&\n canPlace(bmpTool, bitmap, {\n x1: text.AABBBounds.x1 + dx,\n x2: text.AABBBounds.x2 + dx,\n y1: text.AABBBounds.y1 + dy,\n y2: text.AABBBounds.y2 + dy\n })\n ) {\n text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });\n result.push(text);\n continue;\n }\n }\n\n let hasPlace: ReturnType<typeof place> = false;\n // 发生碰撞,根据策略寻找可放置的位置\n for (let j = 0; j < strategy.length; j++) {\n hasPlace = place(\n bmpTool,\n bitmap,\n strategy[j],\n <BaseLabelAttrs>this.attribute,\n text as Text,\n this.getGraphicBounds(baseMark, labels[i]),\n this.labeling\n );\n if (hasPlace !== false) {\n text.setAttributes({ x: hasPlace.x, y: hasPlace.y });\n result.push(text);\n break;\n }\n }\n\n !hasPlace && !hideOnHit && result.push(text);\n }\n\n if (isFunction(this.onAfterLabelOverlap)) {\n this.onAfterLabelOverlap(bitmap);\n }\n\n return result;\n }\n\n protected getBaseMarks() {\n const baseMarkGroup = this.getBaseMarkGroup() as IGroup;\n if (!baseMarkGroup) {\n return;\n }\n return baseMarkGroup.getChildren() as IGraphic[];\n }\n\n protected getBaseMarkGroup() {\n const { baseMarkGroupName } = this.attribute as BaseLabelAttrs;\n if (!baseMarkGroupName) {\n return;\n }\n return (this.getRootNode() as IGroup).find(node => node.name === baseMarkGroupName, true) as IGroup;\n }\n\n protected getGraphicBounds(graphic?: IGraphic, point: Partial<PointLocationCfg> = {}): IBoundsLike {\n // if (graphic && !isEmpty((graphic as any).finalAttrs)) {\n // const g = graphic.clone();\n // g.onBeforeAttributeUpdate = graphic.onBeforeAttributeUpdate;\n // g.setAttributes((graphic as any).finalAttrs);\n // g.update();\n // return g.AABBBounds;\n // }\n return (\n graphic?.AABBBounds ||\n ({\n x1: point.x,\n x2: point.x,\n y1: point.y,\n y2: point.y\n } as IBoundsLike)\n );\n }\n\n protected _renderLabels(labels: IText[]) {\n const animationConfig = (this.attribute.animation ?? {}) as ILabelAnimation;\n const disableAnimation = this._enableAnimation === false || (animationConfig as unknown as boolean) === false;\n const mode = animationConfig.mode ?? DefaultLabelAnimation.mode;\n const duration = animationConfig.duration ?? DefaultLabelAnimation.duration;\n const easing = animationConfig.easing ?? DefaultLabelAnimation.easing;\n const delay = animationConfig.delay ?? 0;\n\n const currentTextMap = new Map();\n const prevTextMap = this._graphicToText || new Map();\n const texts = [] as IText[];\n const labelLines = [] as IPath[];\n\n labels.forEach((text, index) => {\n // const text = this._createLabelText(label);\n let labelLine: IPath;\n\n if (this.attribute.type === 'arc' && this.attribute.position === 'outside') {\n labelLine = createPath({\n visible: text.attribute?.visible ?? true,\n stroke: (text.attribute as ArcLabelAttrs)?.line?.stroke ?? text.attribute?.fill,\n lineWidth: 1,\n path:\n `M${Math.round(text.pointA.x)},${Math.round(text.pointA.y)}` +\n ` L${Math.round(text.pointB.x)},${Math.round(text.pointB.y)}` +\n ` L${Math.round(text.pointC.x)},${Math.round(text.pointC.y)}`\n }) as Path;\n }\n const relatedGraphic = this._idToGraphic.get((text.attribute as LabelItem).id);\n const state = prevTextMap?.get(relatedGraphic) ? 'update' : 'enter';\n if (state === 'enter') {\n texts.push(text);\n if (this.attribute.type === 'arc' && this.attribute.position === 'outside') {\n labelLines.push(labelLine);\n }\n currentTextMap.set(relatedGraphic, text);\n if (!disableAnimation && relatedGraphic) {\n const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');\n this.add(text);\n if (this.attribute.type === 'arc' && this.attribute.position === 'outside') {\n this.add(labelLine);\n }\n relatedGraphic.onAnimateBind = () => {\n text.setAttributes(from);\n const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, {\n mode,\n duration,\n easing,\n to,\n delay\n });\n relatedGraphic.on('afterAttributeUpdate', listener);\n };\n } else {\n this.add(text);\n }\n }\n\n if (state === 'update') {\n const prevText = prevTextMap.get(relatedGraphic);\n prevTextMap.delete(relatedGraphic);\n currentTextMap.set(relatedGraphic, prevText);\n if (!disableAnimation) {\n prevText.animate().to(text.attribute, duration, easing);\n if (\n animationConfig.increaseEffect !== false &&\n prevText.attribute.text !== text.attribute.text &&\n isValidNumber(Number(prevText.attribute.text) * Number(text.attribute.text))\n ) {\n prevText\n .animate()\n .play(\n new IncreaseCount(\n { text: prevText.attribute.text as string },\n { text: text.attribute.text as string },\n duration,\n easing\n )\n );\n }\n } else {\n prevText.setAttributes(text.attribute);\n }\n }\n });\n prevTextMap.forEach(label => {\n if (disableAnimation) {\n this.removeChild(label);\n } else {\n label\n ?.animate()\n .to(getAnimationAttributes(label.attribute, 'fadeOut').to, duration, easing)\n .onEnd(() => {\n this.removeChild(label);\n });\n }\n });\n\n this._graphicToText = currentTextMap;\n }\n\n protected _afterRelatedGraphicAttributeUpdate(\n text: IText,\n texts: IText[],\n index: number,\n relatedGraphic: IGraphic,\n { mode, duration, easing, to, delay }: ILabelAnimation & { to: any }\n ) {\n const listener = (event: any) => {\n const { detail } = event;\n if (!detail) {\n return {};\n }\n\n const isValidAnimateState =\n detail &&\n detail.type === AttributeUpdateType.ANIMATE_UPDATE &&\n detail.animationState &&\n detail.animationState.step?.type !== 'wait';\n\n if (!isValidAnimateState) {\n return {};\n }\n\n if (detail.type === AttributeUpdateType.ANIMATE_END) {\n text.setAttributes(to);\n return;\n }\n\n const onEnd = () => {\n if (relatedGraphic) {\n relatedGraphic.onAnimateBind = undefined;\n relatedGraphic.removeEventListener('afterAttributeUpdate', listener);\n }\n };\n\n switch (mode) {\n case 'after':\n // 3. 当前关联图元的动画播放结束后\n if (detail.animationState.end) {\n text.animate({ onEnd }).wait(delay).to(to, duration, easing);\n }\n break;\n case 'after-all':\n // 2. 所有完成后才开始;\n if (index === texts.length - 1) {\n if (detail.animationState.end) {\n texts.forEach(t => {\n t.animate({ onEnd }).wait(delay).to(to, duration, easing);\n });\n }\n }\n break;\n case 'same-time':\n default:\n // 1. 与当前关联图元的动画播放同时进行\n if (detail.animationState.isFirstFrameOfStep) {\n text.animate({ onEnd }).wait(delay).to(to, duration, easing);\n }\n break;\n }\n };\n return listener;\n }\n\n protected _smartInvert(labels: IText[]) {\n const option = (this.attribute.smartInvert || {}) as SmartInvertAttrs;\n const { textType, contrastRatiosThreshold, alternativeColors } = option;\n\n for (let i = 0; i < labels.length; i++) {\n const label = labels[i];\n if (!label) {\n continue;\n }\n\n const baseMark = this._idToGraphic.get((label.attribute as LabelItem).id);\n let isInside = canPlaceInside(label.AABBBounds, baseMark?.AABBBounds);\n\n if (this.attribute.type === 'arc') {\n if (this.attribute.position === 'inside') {\n isInside = true;\n } else {\n isInside = false;\n }\n }\n\n /**\n * stroke 的处理逻辑\n * 1. 当文本在图元内部时,有两种情况:\n * - a. 未设置stroke:labelFill为前景色,baseMark填充色为背景色\n * - b. 设置了stroke:labelFill为前景色,labelStroke填充色为背景色\n * 2. 当文本在图元外部时,有两种情况:\n * - a. 未设置stroke:此时设置strokeColor为backgroundColor。labelFill为前景色,labelStroke填充色为背景色。避免文字一半在图元内部,一半在图元外部时,在图元外部文字不可见。\n * - b. 设置了stroke:保持strokeColor。labelFill为前景色,labelStroke填充色为背景色。\n */\n if (label.attribute.stroke && label.attribute.lineWidth > 0) {\n /**\n * 1-b, 2-b\n * 若label存在stroke,label填充色为前景色,label描边色为背景色\n * WCAG 2 字母周围的文本发光/光晕可用作背景颜色\n */\n label.setAttributes({\n fill: labelSmartInvert(\n label.attribute.fill as IColor,\n label.attribute.stroke as IColor,\n textType,\n contrastRatiosThreshold,\n alternativeColors\n )\n });\n } else if (isInside) {\n /**\n * 1-a\n * label在图元内部时,label填充色为前景色,baseMark填充色为背景色\n */\n const backgroundColor = baseMark.attribute.fill as IColor;\n const foregroundColor = label.attribute.fill as IColor;\n label.setAttributes({\n fill: labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors)\n });\n } else if (label.attribute.lineWidth > 0) {\n /**\n * 2-a\n * 当文本在图元外部时,设置strokeColor为backgroundColor。labelFill为前景色,labelStroke填充色为背景色。\n */\n const backgroundColor = label.attribute.stroke as IColor;\n const foregroundColor = label.attribute.fill as IColor;\n label.setAttributes({\n stroke: baseMark.attribute.fill,\n fill: labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors)\n });\n }\n }\n }\n\n setLocation(point: PointLocationCfg) {\n this.translateTo(point.x, point.y);\n }\n\n disableAnimation() {\n this._enableAnimation = false;\n }\n\n enableAnimation() {\n this._enableAnimation = true;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["label/base.ts"],"names":[],"mappings":";;;AAIA,+CAAmF;AAEnF,6CAAsE;AACtE,uCAAiD;AAEjD,+DAA4D;AAC5D,kCAAwC;AACxC,0CAAyC;AAEzC,uCAAsF;AAEtF,+CAAkF;AAElF,MAAsB,SAAoC,SAAQ,wBAAoB;IAAtF;;QACE,SAAI,GAAG,OAAO,CAAC;QA0EP,aAAQ,GAAG,CAAC,CAAw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ent":["/**\n * @description Label 基类\n */\nimport type { IGroup, Text, IGraphic, IText, FederatedPointerEvent, IColor } from '@visactor/vrender';\nimport { createText, IncreaseCount, AttributeUpdateType } from '@visactor/vrender';\nimport type { IBoundsLike } from '@visactor/vutils';\nimport { isFunction, isValidNumber, isEmpty } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { PointLocationCfg } from '../core/type';\nimport { labelSmartInvert } from '../util/labelSmartInvert';\nimport { traverseGroup } from '../util';\nimport { StateValue } from '../constant';\nimport type { Bitmap } from './overlap';\nimport { bitmapTool, boundToRange, canPlace, canPlaceInside, place } from './overlap';\nimport type { BaseLabelAttrs, OverlapAttrs, ILabelGraphicAttribute, ILabelAnimation } from './type';\nimport { DefaultLabelAnimation, getAnimationAttributes } from './animate/animate';\n\nexport abstract class LabelBase<T extends BaseLabelAttrs> extends AbstractComponent<T> {\n name = 'label';\n\n protected _baseMarks?: IGraphic[];\n\n protected _bitmap?: Bitmap;\n\n setBitmap(bitmap: Bitmap) {\n this._bitmap = bitmap;\n }\n\n protected _bmpTool?: ReturnType<typeof bitmapTool>;\n setBitmapTool(bmpTool: ReturnType<typeof bitmapTool>) {\n this._bmpTool = bmpTool;\n }\n\n protected _relationMap: Map<number, IGraphic>;\n\n protected _prevRelationMap: Map<number, IGraphic>;\n\n protected _textMap: Map<IGraphic, IText>;\n\n onAfterLabelOverlap?: (bitmap: Bitmap) => void;\n\n private _lastHover: IGraphic;\n private _lastSelect: IGraphic;\n\n private _enableAnimation: boolean;\n\n protected abstract labeling(\n textBounds: IBoundsLike,\n graphicBounds: IBoundsLike,\n position?: BaseLabelAttrs['position'],\n offset?: number\n ): Partial<ILabelGraphicAttribute> | undefined;\n\n protected render() {\n const currentBaseMarks = this._checkMarks();\n const labels = this.layout(currentBaseMarks);\n\n this._smartInvert(labels);\n\n this._renderLabels(labels);\n }\n\n private _bindEvent(target: IGraphic) {\n if (!target) {\n return;\n }\n\n const { hover, select } = this.attribute;\n\n if (hover) {\n target.addEventListener('pointermove', this._onHover as EventListenerOrEventListenerObject);\n target.addEventListener('pointerout', this._onUnHover as EventListenerOrEventListenerObject);\n }\n\n if (select) {\n target.addEventListener('pointerdown', this._onClick as EventListenerOrEventListenerObject);\n }\n }\n\n private _setStates(target: IGraphic) {\n if (!target) {\n return;\n }\n const state = this.attribute.state;\n\n if (!state || isEmpty(state)) {\n return;\n }\n\n target.states = state;\n }\n\n private _onHover = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (target !== this._lastHover && !isEmpty(target.states)) {\n target.addState(StateValue.hover, true);\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (node !== target && !isEmpty(node.states)) {\n node.addState(StateValue.hoverReverse, true);\n }\n });\n this._lastHover = target;\n }\n };\n\n private _onUnHover = (e: FederatedPointerEvent) => {\n if (this._lastHover) {\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (!isEmpty(node.states)) {\n node.removeState(StateValue.hoverReverse);\n node.removeState(StateValue.hover);\n }\n });\n this._lastHover = null;\n }\n };\n\n private _onClick = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGraphic;\n if (this._lastSelect === target && target.hasState('selected')) {\n // 取消选中\n this._lastSelect = null;\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (!isEmpty(node.states)) {\n node.removeState(StateValue.selectedReverse);\n node.removeState(StateValue.selected);\n }\n });\n return;\n }\n\n if (!isEmpty(target.states)) {\n target.addState(StateValue.selected, true);\n traverseGroup(this as unknown as IGraphic, (node: IGraphic) => {\n if (node !== target && !isEmpty(node.states)) {\n node.addState(StateValue.selectedReverse, true);\n }\n });\n this._lastSelect = target;\n }\n };\n\n private _createLabelText(attributes: ILabelGraphicAttribute) {\n const text = createText(attributes);\n this._bindEvent(text);\n this._setStates(text);\n return text;\n }\n\n private _checkMarks() {\n const baseMarks = this.getBaseMarks();\n const currentBaseMarks: IGraphic[] = [];\n baseMarks.forEach(mark => {\n if ((mark as any).releaseStatus !== 'willRelease') {\n currentBaseMarks.push(mark);\n }\n });\n this._prevRelationMap = new Map(this._relationMap);\n this._relationMap?.clear();\n return currentBaseMarks;\n }\n\n protected layout(currentMarks?: IGraphic[]): ILabelGraphicAttribute[] {\n const { textStyle, position, offset } = this.attribute as BaseLabelAttrs;\n let { data } = this.attribute as BaseLabelAttrs;\n if (isFunction(data)) {\n data = data({});\n }\n if (!data || data.length === 0) {\n return [];\n }\n\n let labels: ILabelGraphicAttribute[] = [];\n\n if (isFunction(this.attribute.sort) && currentMarks && currentMarks.length) {\n currentMarks = currentMarks.sort(this.attribute.sort);\n }\n\n if (!this._relationMap) {\n this._relationMap = new Map();\n }\n\n // 默认根据 index 顺序排序\n for (let i = 0; i < data.length; i++) {\n const textData = data[i];\n const baseMark = currentMarks?.[i] as IGraphic;\n const labelAttribute = {\n ...textStyle,\n ...textData,\n _relatedIndex: i\n };\n this._relationMap.set(i, baseMark);\n\n if (textData) {\n const text = createText(labelAttribute);\n text.update();\n const textBounds = this.getGraphicBounds(text);\n const graphicBounds = this.getGraphicBounds(baseMark, { x: textData.x as number, y: textData.y as number });\n\n const textAttributes = this.labeling(\n textBounds,\n graphicBounds,\n isFunction(position) ? position(textData) : position,\n offset\n );\n\n if (!textAttributes) {\n continue;\n }\n\n labelAttribute.x = textAttributes.x;\n labelAttribute.y = textAttributes.y;\n\n labels.push(labelAttribute);\n }\n }\n\n this._baseMarks = currentMarks as IGraphic[];\n if (this.attribute.overlap !== false) {\n labels = this.overlapping(labels, this.attribute.overlap as OverlapAttrs);\n }\n\n return labels;\n }\n\n protected overlapping(labels: ILabelGraphicAttribute[], option: OverlapAttrs = {}) {\n if (labels.length === 0) {\n return [];\n }\n const result: ILabelGraphicAttribute[] = [];\n const baseMarkGroup = this.getBaseMarkGroup();\n const size = option.size ?? {\n width: baseMarkGroup?.AABBBounds.width() ?? 0,\n height: baseMarkGroup?.AABBBounds.height() ?? 0\n };\n\n if (size.width === 0 || size.height === 0) {\n return labels;\n }\n\n const { avoidBaseMark, strategy = [], hideOnHit = true, clampForce = true } = option;\n const bmpTool = this._bmpTool || bitmapTool(size.width, size.height);\n const bitmap = this._bitmap || bmpTool.bitmap();\n const checkBounds = strategy.some(s => s.type === 'bound');\n\n if (avoidBaseMark) {\n this._baseMarks?.forEach(mark => {\n mark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, mark.AABBBounds, true));\n });\n }\n\n for (let i = 0; i < labels.length; i++) {\n if (labels[i].visible === false) {\n continue;\n }\n const text = createText(labels[i]) as Text;\n const baseMark = this._baseMarks?.[i];\n text.update();\n\n // 默认位置可以放置\n if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce)) {\n // 如果配置了限制在图形内部,需要提前判断;\n if (!checkBounds) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push({ ...text.attribute });\n continue;\n }\n\n if (checkBounds && baseMark?.AABBBounds && canPlaceInside(text.AABBBounds, baseMark?.AABBBounds)) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));\n result.push({ ...text.attribute });\n continue;\n }\n }\n\n let hasPlace: ReturnType<typeof place> = false;\n // 发生碰撞,根据策略寻找可放置的位置\n for (let j = 0; j < strategy.length; j++) {\n hasPlace = place(\n bmpTool,\n bitmap,\n strategy[j],\n <BaseLabelAttrs>this.attribute,\n text,\n this.getGraphicBounds(baseMark, labels[i]),\n this.labeling\n );\n if (hasPlace !== false) {\n result.push({\n ...text.attribute,\n x: hasPlace.x,\n y: hasPlace.y\n });\n break;\n }\n }\n\n !hasPlace && !hideOnHit && result.push({ ...text.attribute });\n }\n\n if (isFunction(this.onAfterLabelOverlap)) {\n this.onAfterLabelOverlap(bitmap);\n }\n\n return result;\n }\n\n protected getBaseMarks() {\n const baseMarkGroup = this.getBaseMarkGroup() as IGroup;\n if (!baseMarkGroup) {\n return;\n }\n return baseMarkGroup.getChildren() as IGraphic[];\n }\n\n protected getBaseMarkGroup() {\n const { baseMarkGroupName } = this.attribute as BaseLabelAttrs;\n if (!baseMarkGroupName) {\n return;\n }\n return (this.getRootNode() as IGroup).find(node => node.name === baseMarkGroupName, true) as IGroup;\n }\n\n protected getGraphicBounds(graphic?: IGraphic, point: Partial<PointLocationCfg> = {}): IBoundsLike {\n // if (graphic && !isEmpty((graphic as any).finalAttrs)) {\n // const g = graphic.clone();\n // g.onBeforeAttributeUpdate = graphic.onBeforeAttributeUpdate;\n // g.setAttributes((graphic as any).finalAttrs);\n // g.update();\n // return g.AABBBounds;\n // }\n return (\n graphic?.AABBBounds ||\n ({\n x1: point.x,\n x2: point.x,\n y1: point.y,\n y2: point.y\n } as IBoundsLike)\n );\n }\n\n protected _renderLabels(labels: ILabelGraphicAttribute[]) {\n const animationConfig = (this.attribute.animation ?? {}) as ILabelAnimation;\n const disableAnimation = this._enableAnimation === false || (animationConfig as unknown as boolean) === false;\n const mode = animationConfig.mode ?? DefaultLabelAnimation.mode;\n const duration = animationConfig.duration ?? DefaultLabelAnimation.duration;\n const easing = animationConfig.easing ?? DefaultLabelAnimation.easing;\n const delay = animationConfig.delay ?? 0;\n\n const currentTextMap = new Map();\n const prevTextMap = this._textMap || new Map();\n const texts = [] as IText[];\n\n labels.forEach((label, index) => {\n const text = this._createLabelText(label);\n const relatedGraphic = this._relationMap.get(label._relatedIndex);\n const state = prevTextMap?.get(relatedGraphic) ? 'update' : 'enter';\n\n if (state === 'enter') {\n texts.push(text);\n currentTextMap.set(relatedGraphic, text);\n if (!disableAnimation && relatedGraphic) {\n const { from, to } = getAnimationAttributes(label, 'fadeIn');\n this.add(text);\n relatedGraphic.onAnimateBind = () => {\n text.setAttributes(from);\n const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, {\n mode,\n duration,\n easing,\n to,\n delay\n });\n relatedGraphic.on('afterAttributeUpdate', listener);\n };\n } else {\n this.add(text);\n }\n }\n\n if (state === 'update') {\n const prevText = prevTextMap.get(relatedGraphic);\n prevTextMap.delete(relatedGraphic);\n currentTextMap.set(relatedGraphic, prevText);\n if (!disableAnimation) {\n prevText.animate().to(text.attribute, duration, easing);\n if (\n animationConfig.increaseEffect !== false &&\n prevText.attribute.text !== text.attribute.text &&\n isValidNumber(Number(prevText.attribute.text) * Number(text.attribute.text))\n ) {\n prevText\n .animate()\n .play(\n new IncreaseCount(\n { text: prevText.attribute.text as string },\n { text: text.attribute.text as string },\n duration,\n easing\n )\n );\n }\n } else {\n prevText.setAttributes(text.attribute);\n }\n }\n });\n prevTextMap.forEach(label => {\n if (disableAnimation) {\n this.removeChild(label);\n } else {\n label\n ?.animate()\n .to(getAnimationAttributes(label.attribute, 'fadeOut').to, duration, easing)\n .onEnd(() => {\n this.removeChild(label);\n });\n }\n });\n\n this._textMap = currentTextMap;\n }\n\n protected _afterRelatedGraphicAttributeUpdate(\n text: IText,\n texts: IText[],\n index: number,\n relatedGraphic: IGraphic,\n { mode, duration, easing, to, delay }: ILabelAnimation & { to: any }\n ) {\n const listener = (event: any) => {\n const { detail } = event;\n if (!detail) {\n return {};\n }\n\n const isValidAnimateState =\n detail &&\n detail.type === AttributeUpdateType.ANIMATE_UPDATE &&\n detail.animationState &&\n detail.animationState.step?.type !== 'wait';\n\n if (!isValidAnimateState) {\n return {};\n }\n\n if (detail.type === AttributeUpdateType.ANIMATE_END) {\n text.setAttributes(to);\n return;\n }\n\n const onEnd = () => {\n if (relatedGraphic) {\n relatedGraphic.onAnimateBind = undefined;\n relatedGraphic.removeEventListener('afterAttributeUpdate', listener);\n }\n };\n\n switch (mode) {\n case 'after':\n // 3. 当前关联图元的动画播放结束后\n if (detail.animationState.end) {\n text.animate({ onEnd }).wait(delay).to(to, duration, easing);\n }\n break;\n case 'after-all':\n // 2. 所有完成后才开始;\n if (index === texts.length - 1) {\n if (detail.animationState.end) {\n texts.forEach(t => {\n t.animate({ onEnd }).wait(delay).to(to, duration, easing);\n });\n }\n }\n break;\n case 'same-time':\n default:\n // 1. 与当前关联图元的动画播放同时进行\n if (detail.animationState.isFirstFrameOfStep) {\n text.animate({ onEnd }).wait(delay).to(to, duration, easing);\n }\n break;\n }\n };\n return listener;\n }\n\n protected _smartInvert(labels: ILabelGraphicAttribute[]) {\n if (this.attribute.smartInvert === false) {\n return;\n }\n for (let i = 0; i < labels.length; i++) {\n const label = labels?.[i] as ILabelGraphicAttribute;\n if (!label) {\n continue;\n }\n\n const isInside = canPlaceInside(\n createText(label).AABBBounds,\n this._relationMap.get(label._relatedIndex)?.AABBBounds\n );\n /**\n * stroke 的处理逻辑\n * 1. 当文本在图元内部时,有两种情况:\n * - a. 未设置stroke:labelFill为前景色,baseMark填充色为背景色\n * - b. 设置了stroke:labelFill为前景色,labelStroke填充色为背景色\n * 2. 当文本在图元外部时,有两种情况:\n * - a. 未设置stroke:此时设置strokeColor为backgroundColor。labelFill为前景色,labelStroke填充色为背景色。避免文字一半在图元内部,一半在图元外部时,在图元外部文字不可见。\n * - b. 设置了stroke:保持strokeColor。labelFill为前景色,labelStroke填充色为背景色。\n */\n if (label.stroke && label.lineWidth > 0) {\n /**\n * 1-b, 2-b\n * 若label存在stroke,label填充色为前景色,label描边色为背景色\n * WCAG 2 字母周围的文本发光/光晕可用作背景颜色\n */\n label.fill = labelSmartInvert(\n label.fill as IColor,\n label.stroke as IColor,\n this.attribute.smartInvert?.textType,\n this.attribute.smartInvert?.contrastRatiosThreshold,\n this.attribute.smartInvert?.alternativeColors\n );\n } else if (isInside) {\n /**\n * 1-a\n * label在图元内部时,label填充色为前景色,baseMark填充色为背景色\n */\n const baseMark = this._relationMap.get(label._relatedIndex);\n const backgroundColor = baseMark.attribute.fill as IColor;\n const foregroundColor = label.fill as IColor;\n label.fill = labelSmartInvert(\n foregroundColor,\n backgroundColor,\n this.attribute.smartInvert?.textType,\n this.attribute.smartInvert?.contrastRatiosThreshold,\n this.attribute.smartInvert?.alternativeColors\n );\n } else if (label.lineWidth > 0) {\n /**\n * 2-a\n * 当文本在图元外部时,设置strokeColor为backgroundColor。labelFill为前景色,labelStroke填充色为背景色。\n */\n const baseMark = this._relationMap.get(label._relatedIndex);\n label.stroke = baseMark.attribute.fill;\n const backgroundColor = label.stroke as IColor;\n const foregroundColor = label.fill as IColor;\n label.fill = labelSmartInvert(\n foregroundColor,\n backgroundColor,\n this.attribute.smartInvert?.textType,\n this.attribute.smartInvert?.contrastRatiosThreshold,\n this.attribute.smartInvert?.alternativeColors\n );\n }\n }\n }\n\n setLocation(point: PointLocationCfg) {\n this.translateTo(point.x, point.y);\n }\n\n disableAnimation() {\n this._enableAnimation = false;\n }\n\n enableAnimation() {\n this._enableAnimation = true;\n }\n}\n"]}
|
package/cjs/label/dataLabel.js
CHANGED
|
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.DataLabel = void 0;
|
|
6
6
|
|
|
7
|
-
const vutils_1 = require("@visactor/vutils"), base_1 = require("../core/base"), overlap_1 = require("./overlap"), rect_1 = require("./rect"), symbol_1 = require("./symbol"),
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), base_1 = require("../core/base"), overlap_1 = require("./overlap"), rect_1 = require("./rect"), symbol_1 = require("./symbol"), labelComponentMap = {
|
|
8
8
|
rect: rect_1.RectLabel,
|
|
9
|
-
symbol: symbol_1.SymbolLabel
|
|
10
|
-
arc: arc_1.ArcLabel
|
|
9
|
+
symbol: symbol_1.SymbolLabel
|
|
11
10
|
};
|
|
12
11
|
|
|
13
12
|
class DataLabel extends base_1.AbstractComponent {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["label/dataLabel.ts"],"names":[],"mappings":";;;AAAA,6CAAwD;AAExD,uCAAiD;AAEjD,uCAAuC;AACvC,iCAAmC;AACnC,qCAAuC;
|
|
1
|
+
{"version":3,"sources":["label/dataLabel.ts"],"names":[],"mappings":";;;AAAA,6CAAwD;AAExD,uCAAiD;AAEjD,uCAAuC;AACvC,iCAAmC;AACnC,qCAAuC;AAIvC,MAAM,iBAAiB,GAAG;IACxB,IAA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,CAAC,SAAS,CAAC,EAAE;YACrC,SAAS,CAAC,eAAe,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC;;AA5EH,8BA6EC;AAxEgB,2BAAiB,GAA4B;IAC1D,QAAQ,EAAE,KAAK;CAChB,CAAC","file":"dataLabel.js","sourcesContent":["import { isValidNumber, merge } from '@visactor/vutils';\nimport { IGraphic, INode } from '@visactor/vrender';\nimport { AbstractComponent } from '../core/base';\nimport type { PointLocationCfg } from '../core/type';\nimport { bitmapTool } from './overlap';\nimport { RectLabel } from './rect';\nimport { SymbolLabel } from './symbol';\nimport type { DataLabelAttrs } from './type';\nimport { LabelBase } from './base';\n\nconst labelComponentMap = {\n rect: RectLabel,\n symbol: SymbolLabel\n};\n\nexport class DataLabel extends AbstractComponent<DataLabelAttrs> {\n name = 'data-label';\n\n private _componentMap: Map<string, LabelBase<any>>;\n\n private static defaultAttributes: Partial<DataLabelAttrs> = {\n pickable: false\n };\n\n constructor(attributes: DataLabelAttrs) {\n super(merge({}, DataLabel.defaultAttributes, attributes));\n }\n\n protected render(): void {\n const { dataLabels, size } = this.attribute;\n if (!dataLabels || dataLabels.length === 0) {\n return;\n }\n const { width = 0, height = 0 } = size || {};\n\n if (!width || !height || !isValidNumber(height * width)) {\n return;\n }\n\n if (!this._componentMap) {\n this._componentMap = new Map();\n }\n const tool = bitmapTool(width, height);\n const bitmap = tool.bitmap();\n\n const currentComponentMap = new Map();\n const prevComponentMap = this._componentMap;\n\n for (let i = 0; i < dataLabels.length; i++) {\n const dataLabel = dataLabels[i];\n if (labelComponentMap[dataLabel.type]) {\n const { baseMarkGroupName } = dataLabel;\n let component = this._componentMap.get(baseMarkGroupName);\n if (component) {\n component.setBitmapTool(tool);\n component.setBitmap(bitmap);\n component.setAttributes(dataLabel);\n currentComponentMap.set(baseMarkGroupName, component);\n } else {\n component = new labelComponentMap[dataLabel.type](dataLabel as any);\n component.setBitmap(bitmap);\n component.setBitmapTool(tool);\n this.add(component as unknown as INode);\n currentComponentMap.set(baseMarkGroupName, component);\n }\n }\n }\n\n prevComponentMap.forEach((cp, key) => {\n if (!currentComponentMap.get(key)) {\n this.removeChild(cp as unknown as IGraphic);\n }\n });\n\n this._componentMap = currentComponentMap;\n }\n\n setLocation(point: PointLocationCfg) {\n this.translateTo(point.x, point.y);\n }\n\n disableAnimation() {\n this._componentMap.forEach(component => {\n component.disableAnimation();\n });\n }\n\n enableAnimation() {\n this._componentMap.forEach(component => {\n component.enableAnimation();\n });\n }\n}\n"]}
|
package/cjs/label/index.d.ts
CHANGED
package/cjs/label/index.js
CHANGED
|
@@ -19,6 +19,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
19
19
|
value: !0
|
|
20
20
|
}), __exportStar(require("./type"), exports), __exportStar(require("./symbol"), exports),
|
|
21
21
|
__exportStar(require("./rect"), exports), __exportStar(require("./line"), exports),
|
|
22
|
-
__exportStar(require("./base"), exports), __exportStar(require("./
|
|
23
|
-
__exportStar(require("./dataLabel"), exports);
|
|
22
|
+
__exportStar(require("./base"), exports), __exportStar(require("./dataLabel"), exports);
|
|
24
23
|
//# sourceMappingURL=index.js.map
|
package/cjs/label/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["label/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,2CAAyB;AACzB,yCAAuB;AACvB,yCAAuB;AACvB,yCAAuB;
|
|
1
|
+
{"version":3,"sources":["label/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,2CAAyB;AACzB,yCAAuB;AACvB,yCAAuB;AACvB,yCAAuB;AAEvB,8CAA4B","file":"index.js","sourcesContent":["export * from './type';\nexport * from './symbol';\nexport * from './rect';\nexport * from './line';\nexport * from './base';\n\nexport * from './dataLabel';\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { Text } from '@visactor/vrender';
|
|
2
|
+
import { IAABBBounds, IBoundsLike } from '@visactor/vutils';
|
|
3
|
+
import { PointLocationCfg } from '../../core/type';
|
|
4
4
|
import type { LabelBase } from '../base';
|
|
5
5
|
import type { BaseLabelAttrs, Strategy } from '../type';
|
|
6
6
|
import type { Bitmap } from './bitmap';
|
|
7
|
-
import
|
|
7
|
+
import { BitmapTool } from './scaler';
|
|
8
8
|
export declare function canPlace($: BitmapTool, bitmap: Bitmap, bound: IBoundsLike, checkBound?: boolean): boolean;
|
|
9
9
|
export declare function canPlaceInside(textBound: IBoundsLike, shapeBound: IAABBBounds): boolean;
|
|
10
10
|
export declare function placeToCandidates($: BitmapTool, bitmap: Bitmap, text: Text, candidates?: PointLocationCfg[], clampForce?: boolean): PointLocationCfg | false;
|
|
@@ -12,7 +12,3 @@ export declare function place<T extends BaseLabelAttrs>($: BitmapTool, bitmap: B
|
|
|
12
12
|
export declare const DefaultPositions: string[];
|
|
13
13
|
export declare const DefaultRectPositions: string[];
|
|
14
14
|
export declare function defaultLabelPosition(type?: string): string[];
|
|
15
|
-
export declare function clampText(text: IText, width: number, height: number): {
|
|
16
|
-
dx: number;
|
|
17
|
-
dy: number;
|
|
18
|
-
};
|