@visactor/vrender-components 0.9.1 → 0.9.2-alpha.0
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/README.md +6 -0
- package/cjs/axis/circle.d.ts +7 -7
- package/cjs/axis/config.d.ts +7 -7
- package/cjs/axis/config.js +7 -7
- package/cjs/axis/config.js.map +1 -1
- package/cjs/axis/grid.js +2 -4
- package/cjs/axis/grid.js.map +1 -1
- package/cjs/axis/line.d.ts +7 -7
- package/cjs/brush/brush.d.ts +2 -3
- package/cjs/brush/config.d.ts +2 -3
- package/cjs/brush/config.js +2 -3
- package/cjs/brush/config.js.map +1 -1
- package/cjs/crosshair/circle.d.ts +1 -2
- package/cjs/crosshair/circle.js +1 -2
- package/cjs/crosshair/circle.js.map +1 -1
- package/cjs/crosshair/line.d.ts +1 -2
- package/cjs/crosshair/line.js +1 -2
- package/cjs/crosshair/line.js.map +1 -1
- package/cjs/crosshair/polygon.d.ts +1 -2
- package/cjs/crosshair/polygon.js +1 -2
- package/cjs/crosshair/polygon.js.map +1 -1
- package/cjs/crosshair/rect.d.ts +1 -1
- package/cjs/crosshair/rect.js +1 -1
- package/cjs/crosshair/rect.js.map +1 -1
- package/cjs/crosshair/sector.d.ts +1 -1
- package/cjs/crosshair/sector.js +1 -1
- package/cjs/crosshair/sector.js.map +1 -1
- package/cjs/data-zoom/config.d.ts +18 -27
- package/cjs/data-zoom/config.js +18 -27
- package/cjs/data-zoom/config.js.map +1 -1
- package/cjs/data-zoom/data-zoom.d.ts +18 -27
- package/cjs/data-zoom/type.js +2 -1
- package/cjs/indicator/config.js +2 -4
- package/cjs/indicator/config.js.map +1 -1
- package/cjs/indicator/type.js +1 -2
- package/cjs/label/base.js +6 -6
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/dataLabel.js +2 -1
- package/cjs/label/line.js +3 -2
- package/cjs/label/line.js.map +1 -1
- package/cjs/label/rect.js +3 -2
- package/cjs/label/rect.js.map +1 -1
- package/cjs/label/symbol.js +3 -2
- package/cjs/label/symbol.js.map +1 -1
- package/cjs/legend/color/color.d.ts +3 -3
- package/cjs/legend/color/color.js +6 -7
- package/cjs/legend/color/color.js.map +1 -1
- package/cjs/legend/discrete/discrete.js +12 -12
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/legend/discrete/type.d.ts +2 -4
- package/cjs/legend/discrete/type.js.map +1 -1
- package/cjs/legend/size/size.d.ts +4 -4
- package/cjs/legend/size/size.js +4 -4
- package/cjs/legend/size/size.js.map +1 -1
- package/cjs/marker/area.d.ts +4 -7
- package/cjs/marker/base.js +1 -2
- package/cjs/marker/config.d.ts +14 -26
- package/cjs/marker/config.js +14 -26
- package/cjs/marker/config.js.map +1 -1
- package/cjs/marker/point.d.ts +4 -8
- package/cjs/pager/pager.js +3 -4
- package/cjs/pager/pager.js.map +1 -1
- package/cjs/player/controller/controller.js +1 -1
- package/cjs/player/controller/controller.js.map +1 -1
- package/cjs/scrollbar/scrollbar.d.ts +2 -4
- package/cjs/scrollbar/scrollbar.js +2 -4
- package/cjs/scrollbar/scrollbar.js.map +1 -1
- package/cjs/segment/segment.js +3 -3
- package/cjs/segment/segment.js.map +1 -1
- package/cjs/slider/slider.d.ts +7 -9
- package/cjs/slider/slider.js +8 -10
- package/cjs/slider/slider.js.map +1 -1
- package/cjs/tag/tag.js +2 -2
- package/cjs/tag/tag.js.map +1 -1
- package/cjs/title/title.js +2 -2
- package/cjs/title/title.js.map +1 -1
- package/cjs/tooltip/config.js +6 -12
- package/cjs/tooltip/config.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.min.js +1 -0
- package/es/axis/circle.d.ts +7 -7
- package/es/axis/config.d.ts +7 -7
- package/es/axis/config.js +7 -7
- package/es/axis/config.js.map +1 -1
- package/es/axis/grid.js +2 -4
- package/es/axis/grid.js.map +1 -1
- package/es/axis/line.d.ts +7 -7
- package/es/brush/brush.d.ts +2 -3
- package/es/brush/config.d.ts +2 -3
- package/es/brush/config.js +2 -3
- package/es/brush/config.js.map +1 -1
- package/es/crosshair/circle.d.ts +1 -2
- package/es/crosshair/circle.js +1 -2
- package/es/crosshair/circle.js.map +1 -1
- package/es/crosshair/line.d.ts +1 -2
- package/es/crosshair/line.js +1 -2
- package/es/crosshair/line.js.map +1 -1
- package/es/crosshair/polygon.d.ts +1 -2
- package/es/crosshair/polygon.js +1 -2
- package/es/crosshair/polygon.js.map +1 -1
- package/es/crosshair/rect.d.ts +1 -1
- package/es/crosshair/rect.js +1 -1
- package/es/crosshair/rect.js.map +1 -1
- package/es/crosshair/sector.d.ts +1 -1
- package/es/crosshair/sector.js +1 -1
- package/es/crosshair/sector.js.map +1 -1
- package/es/data-zoom/config.d.ts +18 -27
- package/es/data-zoom/config.js +18 -27
- package/es/data-zoom/config.js.map +1 -1
- package/es/data-zoom/data-zoom.d.ts +18 -27
- package/es/data-zoom/type.js +2 -1
- package/es/indicator/config.js +2 -4
- package/es/indicator/config.js.map +1 -1
- package/es/indicator/type.js +1 -2
- package/es/label/base.js +6 -6
- package/es/label/base.js.map +1 -1
- package/es/label/dataLabel.js +2 -1
- package/es/label/line.js +3 -2
- package/es/label/line.js.map +1 -1
- package/es/label/rect.js +3 -2
- package/es/label/rect.js.map +1 -1
- package/es/label/symbol.js +3 -2
- package/es/label/symbol.js.map +1 -1
- package/es/legend/color/color.d.ts +3 -3
- package/es/legend/color/color.js +6 -7
- package/es/legend/color/color.js.map +1 -1
- package/es/legend/discrete/discrete.js +13 -13
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/legend/discrete/type.d.ts +2 -4
- package/es/legend/discrete/type.js.map +1 -1
- package/es/legend/size/size.d.ts +4 -4
- package/es/legend/size/size.js +4 -4
- package/es/legend/size/size.js.map +1 -1
- package/es/marker/area.d.ts +4 -7
- package/es/marker/base.js +1 -2
- package/es/marker/config.d.ts +14 -26
- package/es/marker/config.js +14 -26
- package/es/marker/config.js.map +1 -1
- package/es/marker/point.d.ts +4 -8
- package/es/pager/pager.js +3 -4
- package/es/pager/pager.js.map +1 -1
- package/es/player/controller/controller.js +1 -1
- package/es/player/controller/controller.js.map +1 -1
- package/es/scrollbar/scrollbar.d.ts +2 -4
- package/es/scrollbar/scrollbar.js +2 -4
- package/es/scrollbar/scrollbar.js.map +1 -1
- package/es/segment/segment.js +3 -3
- package/es/segment/segment.js.map +1 -1
- package/es/slider/slider.d.ts +7 -9
- package/es/slider/slider.js +8 -10
- package/es/slider/slider.js.map +1 -1
- package/es/tag/tag.js +2 -2
- package/es/tag/tag.js.map +1 -1
- package/es/title/title.js +2 -2
- package/es/title/title.js.map +1 -1
- package/es/tooltip/config.js +6 -12
- package/es/tooltip/config.js.map +1 -1
- package/package.json +10 -4
- package/dist/vrender-components.js.js +0 -1
- package/dist/vrender-components.js.min.js +0 -1
|
@@ -10,47 +10,42 @@ export declare class DataZoom extends AbstractComponent<Required<DataZoomAttribu
|
|
|
10
10
|
showDetail: string;
|
|
11
11
|
brushSelect: boolean;
|
|
12
12
|
backgroundStyle: {
|
|
13
|
-
fill:
|
|
14
|
-
|
|
15
|
-
strokeColor: string;
|
|
13
|
+
fill: string;
|
|
14
|
+
stroke: string;
|
|
16
15
|
lineWidth: number;
|
|
17
16
|
borderRadius: number;
|
|
18
17
|
};
|
|
19
18
|
dragMaskStyle: {
|
|
20
|
-
fill:
|
|
21
|
-
fillColor: string;
|
|
19
|
+
fill: string;
|
|
22
20
|
fillOpacity: number;
|
|
23
21
|
};
|
|
24
22
|
backgroundChartStyle: {
|
|
25
23
|
area: {
|
|
26
24
|
visible: boolean;
|
|
27
|
-
|
|
25
|
+
stroke: string;
|
|
28
26
|
lineWidth: number;
|
|
29
|
-
|
|
30
|
-
fill: boolean;
|
|
27
|
+
fill: string;
|
|
31
28
|
};
|
|
32
29
|
line: {
|
|
33
30
|
visible: boolean;
|
|
34
|
-
|
|
31
|
+
stroke: string;
|
|
35
32
|
lineWidth: number;
|
|
36
33
|
};
|
|
37
34
|
};
|
|
38
35
|
selectedBackgroundStyle: {
|
|
39
|
-
fill:
|
|
40
|
-
fillColor: string;
|
|
36
|
+
fill: string;
|
|
41
37
|
fillOpacity: number;
|
|
42
38
|
};
|
|
43
39
|
selectedBackgroundChartStyle: {
|
|
44
40
|
area: {
|
|
45
41
|
visible: boolean;
|
|
46
|
-
|
|
42
|
+
stroke: string;
|
|
47
43
|
lineWidth: number;
|
|
48
|
-
|
|
49
|
-
fill: boolean;
|
|
44
|
+
fill: string;
|
|
50
45
|
};
|
|
51
46
|
line: {
|
|
52
47
|
visible: boolean;
|
|
53
|
-
|
|
48
|
+
stroke: string;
|
|
54
49
|
lineWidth: number;
|
|
55
50
|
};
|
|
56
51
|
};
|
|
@@ -59,33 +54,29 @@ export declare class DataZoom extends AbstractComponent<Required<DataZoomAttribu
|
|
|
59
54
|
background: {
|
|
60
55
|
size: number;
|
|
61
56
|
style: {
|
|
62
|
-
fill:
|
|
63
|
-
|
|
64
|
-
strokeColor: string;
|
|
57
|
+
fill: string;
|
|
58
|
+
stroke: string;
|
|
65
59
|
borderRadius: number;
|
|
66
60
|
};
|
|
67
61
|
};
|
|
68
62
|
icon: {
|
|
69
63
|
size: number;
|
|
70
|
-
fill:
|
|
71
|
-
|
|
72
|
-
strokeColor: string;
|
|
64
|
+
fill: string;
|
|
65
|
+
stroke: string;
|
|
73
66
|
symbolType: string;
|
|
74
67
|
lineWidth: number;
|
|
75
68
|
};
|
|
76
69
|
};
|
|
77
70
|
startHandlerStyle: {
|
|
78
71
|
symbolType: string;
|
|
79
|
-
fill:
|
|
80
|
-
|
|
81
|
-
strokeColor: string;
|
|
72
|
+
fill: string;
|
|
73
|
+
stroke: string;
|
|
82
74
|
lineWidth: number;
|
|
83
75
|
};
|
|
84
76
|
endHandlerStyle: {
|
|
85
77
|
symbolType: string;
|
|
86
|
-
fill:
|
|
87
|
-
|
|
88
|
-
strokeColor: string;
|
|
78
|
+
fill: string;
|
|
79
|
+
stroke: string;
|
|
89
80
|
lineWidth: number;
|
|
90
81
|
};
|
|
91
82
|
startTextStyle: {
|
package/es/data-zoom/type.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { };
|
|
1
|
+
export { };
|
|
2
|
+
//# sourceMappingURL=type.js.map
|
package/es/indicator/config.js
CHANGED
|
@@ -3,8 +3,7 @@ export const DEFAULT_INDICATOR_THEME = {
|
|
|
3
3
|
style: {
|
|
4
4
|
text: "",
|
|
5
5
|
fontSize: 20,
|
|
6
|
-
fill:
|
|
7
|
-
fillColor: "black",
|
|
6
|
+
fill: "black",
|
|
8
7
|
fontWeight: "normal",
|
|
9
8
|
fillOpacity: 1,
|
|
10
9
|
textBaseline: "top",
|
|
@@ -15,8 +14,7 @@ export const DEFAULT_INDICATOR_THEME = {
|
|
|
15
14
|
style: {
|
|
16
15
|
text: "",
|
|
17
16
|
fontSize: 16,
|
|
18
|
-
fill:
|
|
19
|
-
fillColor: "black",
|
|
17
|
+
fill: "black",
|
|
20
18
|
fontWeight: "normal",
|
|
21
19
|
fillOpacity: 1,
|
|
22
20
|
textBaseline: "top",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["indicator/config.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,uBAAuB,GAAiC;IACnE,KAAK,EAAE;QACL,KAAK,EAAE;YACL,IAAI,EAAE,EAAE;YACR,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,
|
|
1
|
+
{"version":3,"sources":["indicator/config.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,uBAAuB,GAAiC;IACnE,KAAK,EAAE;QACL,KAAK,EAAE;YACL,IAAI,EAAE,EAAE;YACR,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,OAAO;YACb,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,KAAK;YACnB,SAAS,EAAE,QAAQ;SACpB;KACF;IACD,OAAO,EAAE;QACP,KAAK,EAAE;YACL,IAAI,EAAE,EAAE;YACR,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,OAAO;YACb,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,KAAK;YACnB,SAAS,EAAE,QAAQ;SACpB;KACF;CACF,CAAC","file":"config.js","sourcesContent":["import { IndicatorAttributes } from './type';\nexport const DEFAULT_INDICATOR_THEME: Partial<IndicatorAttributes> = {\n title: {\n style: {\n text: '',\n fontSize: 20,\n fill: 'black',\n fontWeight: 'normal',\n fillOpacity: 1,\n textBaseline: 'top',\n textAlign: 'center'\n }\n },\n content: {\n style: {\n text: '',\n fontSize: 16,\n fill: 'black',\n fontWeight: 'normal',\n fillOpacity: 1,\n textBaseline: 'top',\n textAlign: 'center'\n }\n }\n};\n"]}
|
package/es/indicator/type.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { };
|
|
2
|
-
//# sourceMappingURL=type.js.map
|
|
1
|
+
export { };
|
package/es/label/base.js
CHANGED
|
@@ -238,14 +238,14 @@ export class LabelBase extends AbstractComponent {
|
|
|
238
238
|
const text = createText(label);
|
|
239
239
|
text.update(), isInside = canPlaceInside(text.AABBBounds, null === (_a = this._relationMap.get(label._relatedIndex)) || void 0 === _a ? void 0 : _a.AABBBounds);
|
|
240
240
|
}
|
|
241
|
-
if (label.stroke) label.
|
|
242
|
-
const backgroundColor = this._relationMap.get(label._relatedIndex).attribute.
|
|
243
|
-
label.
|
|
241
|
+
if (label.stroke && label.lineWidth > 0) label.fill = 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) {
|
|
242
|
+
const backgroundColor = this._relationMap.get(label._relatedIndex).attribute.fill, foregroundColor = label.fill;
|
|
243
|
+
label.fill = 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);
|
|
244
244
|
} else if (label.lineWidth > 0) {
|
|
245
245
|
const baseMark = this._relationMap.get(label._relatedIndex);
|
|
246
|
-
label.stroke =
|
|
247
|
-
const backgroundColor = label.
|
|
248
|
-
label.
|
|
246
|
+
label.stroke = baseMark.attribute.fill;
|
|
247
|
+
const backgroundColor = label.stroke, foregroundColor = label.fill;
|
|
248
|
+
label.fill = 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);
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
}
|
package/es/label/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["label/base.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,UAAU,EAGV,aAAa,EACb,mBAAmB,EAEpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAe,aAAa,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAU,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAE9F,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAElF,MAAM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BAAiB,CAC9C,CAAC;aACH;SACF;IACH,CAAC;IAED,WAAW,CAAC,KAAuB;QACjC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;IAChC,CAAC;IAED,eAAe;QACb,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC/B,CAAC;CACF","file":"base.js","sourcesContent":["/**\n * @description Label 基类\n */\nimport {\n IGroup,\n Text,\n createText,\n IGraphic,\n IText,\n IncreaseCount,\n AttributeUpdateType,\n FederatedPointerEvent\n} from '@visactor/vrender';\nimport { isFunction, IBoundsLike, isValidNumber, isEmpty } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport { PointLocationCfg } from '../core/type';\nimport { labelSmartInvert } from '../util/labelSmartInvert';\nimport { traverseGroup } from '../util';\nimport { StateValue } from '../constant';\nimport { Bitmap, bitmapTool, boundToRange, canPlace, canPlaceInside, place } from './overlap';\nimport { 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));\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));\n result.push({\n ...text.attribute,\n _insideGraphic: canPlaceInside(text.AABBBounds, baseMark?.AABBBounds),\n _computedBound: text.AABBBounds\n });\n continue;\n }\n\n if (checkBounds && baseMark?.AABBBounds && canPlaceInside(text.AABBBounds, baseMark?.AABBBounds)) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds));\n result.push({ ...text.attribute, _insideGraphic: true, _computedBound: text.AABBBounds });\n continue;\n }\n }\n\n // 发生碰撞,根据策略寻找可放置的位置\n for (let j = 0; j < strategy.length; j++) {\n const 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) {\n result.push({\n ...text.attribute,\n _insideGraphic: canPlaceInside(text.AABBBounds, baseMark?.AABBBounds),\n _computedBound: text.AABBBounds\n });\n break;\n }\n }\n\n !hideOnHit &&\n result.push({\n ...text.attribute,\n _insideGraphic: canPlaceInside(text.AABBBounds, baseMark?.AABBBounds),\n _computedBound: text.AABBBounds\n });\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 let isInside = label._insideGraphic;\n if (isInside === undefined) {\n const text = createText(label);\n text.update();\n isInside = canPlaceInside(text.AABBBounds, 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) {\n /**\n * 1-b, 2-b\n * 若label存在stroke,label填充色为前景色,label描边色为背景色\n * WCAG 2 字母周围的文本发光/光晕可用作背景颜色\n */\n label.fillColor = labelSmartInvert(\n label.fillColor,\n label.strokeColor,\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.fillColor;\n const foregroundColor = label.fillColor;\n label.fillColor = 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 = true;\n label.strokeColor = baseMark.attribute.fillColor;\n const backgroundColor = label.strokeColor;\n const foregroundColor = label.fillColor;\n label.fillColor = 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"]}
|
|
1
|
+
{"version":3,"sources":["label/base.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,UAAU,EAGV,aAAa,EACb,mBAAmB,EAGpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAe,aAAa,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,UAAU,E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GAAG,gBAAgB,CAC3B,eAAe,EACf,eAAe,EACf,MAAA,IAAI,CAAC,SAAS,CAAC,WAAW,0CAAE,QAAQ,EACpC,MAAA,IAAI,CAAC,SAAS,CAAC,WAAW,0CAAE,uBAAuB,EACnD,MAAA,IAAI,CAAC,SAAS,CAAC,WAAW,0CAAE,iBAAiB,CAC9C,CAAC;aACH;SACF;IACH,CAAC;IAED,WAAW,CAAC,KAAuB;QACjC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;IAChC,CAAC;IAED,eAAe;QACb,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC/B,CAAC;CACF","file":"base.js","sourcesContent":["/**\n * @description Label 基类\n */\nimport {\n IGroup,\n Text,\n createText,\n IGraphic,\n IText,\n IncreaseCount,\n AttributeUpdateType,\n FederatedPointerEvent,\n IColor\n} from '@visactor/vrender';\nimport { isFunction, IBoundsLike, isValidNumber, isEmpty } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport { PointLocationCfg } from '../core/type';\nimport { labelSmartInvert } from '../util/labelSmartInvert';\nimport { traverseGroup } from '../util';\nimport { StateValue } from '../constant';\nimport { Bitmap, bitmapTool, boundToRange, canPlace, canPlaceInside, place } from './overlap';\nimport { 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));\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));\n result.push({\n ...text.attribute,\n _insideGraphic: canPlaceInside(text.AABBBounds, baseMark?.AABBBounds),\n _computedBound: text.AABBBounds\n });\n continue;\n }\n\n if (checkBounds && baseMark?.AABBBounds && canPlaceInside(text.AABBBounds, baseMark?.AABBBounds)) {\n bitmap.setRange(boundToRange(bmpTool, text.AABBBounds));\n result.push({ ...text.attribute, _insideGraphic: true, _computedBound: text.AABBBounds });\n continue;\n }\n }\n\n // 发生碰撞,根据策略寻找可放置的位置\n for (let j = 0; j < strategy.length; j++) {\n const 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) {\n result.push({\n ...text.attribute,\n _insideGraphic: canPlaceInside(text.AABBBounds, baseMark?.AABBBounds),\n _computedBound: text.AABBBounds\n });\n break;\n }\n }\n\n !hideOnHit &&\n result.push({\n ...text.attribute,\n _insideGraphic: canPlaceInside(text.AABBBounds, baseMark?.AABBBounds),\n _computedBound: text.AABBBounds\n });\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 let isInside = label._insideGraphic;\n if (isInside === undefined) {\n const text = createText(label);\n text.update();\n isInside = canPlaceInside(text.AABBBounds, 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/es/label/dataLabel.js
CHANGED
package/es/label/line.js
CHANGED
|
@@ -32,9 +32,10 @@ export class LineLabel extends LabelBase {
|
|
|
32
32
|
LineLabel.defaultAttributes = {
|
|
33
33
|
textStyle: {
|
|
34
34
|
fontSize: 12,
|
|
35
|
-
|
|
35
|
+
fill: "#000",
|
|
36
36
|
textAlign: "center",
|
|
37
|
-
textBaseline: "middle"
|
|
37
|
+
textBaseline: "middle",
|
|
38
|
+
boundsPadding: [ -1, 0, -1, 0 ]
|
|
38
39
|
},
|
|
39
40
|
position: "end",
|
|
40
41
|
offset: 6,
|
package/es/label/line.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["label/line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAe,MAAM,kBAAkB,CAAC;AAItD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,MAAM,OAAO,SAAU,SAAQ,SAAyB;
|
|
1
|
+
{"version":3,"sources":["label/line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAe,MAAM,kBAAkB,CAAC;AAItD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,MAAM,OAAO,SAAU,SAAQ,SAAyB;IAgBtD,YAAY,UAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,SAAS,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAhB5D,SAAI,GAAG,YAAY,CAAC;IAiBpB,CAAC;IAES,gBAAgB,CAAC,OAAc,EAAE,QAAmC,EAAE;;QAC9E,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE;YAC3B,OAAO,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SAC/C;QACD,MAAM,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;QAC5C,MAAM,MAAM,GAAG,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,0CAAE,MAAM,KAAI,CAAC,KAAK,CAAC,CAAC;QACrD,MAAM,KAAK,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC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,CAAC,EAAE,CAAC,CAAC;KAC9B;IACD,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,KAAK;CAChB,CAAC","file":"line.js","sourcesContent":["import { merge, IBoundsLike } from '@visactor/vutils';\nimport type { ILine } from '@visactor/vrender';\nimport { PointLocationCfg } from '../core/type';\nimport type { LineLabelAttrs } from './type';\nimport { LabelBase } from './base';\n\nexport class LineLabel extends LabelBase<LineLabelAttrs> {\n name = 'line-label';\n\n static defaultAttributes: Partial<LineLabelAttrs> = {\n textStyle: {\n fontSize: 12,\n fill: '#000',\n textAlign: 'center',\n textBaseline: 'middle',\n boundsPadding: [-1, 0, -1, 0] // to ignore the textBound buf\n },\n position: 'end',\n offset: 6,\n pickable: false\n };\n\n constructor(attributes: LineLabelAttrs) {\n super(merge({}, LineLabel.defaultAttributes, attributes));\n }\n\n protected getGraphicBounds(graphic: ILine, point: Partial<PointLocationCfg> = {}) {\n if (graphic.type !== 'line') {\n return super.getGraphicBounds(graphic, point);\n }\n const { position = 'end' } = this.attribute;\n const points = graphic?.attribute?.points || [point];\n const index = position === 'start' ? 0 : points.length - 1;\n return {\n x1: points[index].x as number,\n x2: points[index].x as number,\n y1: points[index].y as number,\n y2: points[index].y as number\n };\n }\n\n protected labeling(\n textBounds: IBoundsLike,\n graphicBounds: IBoundsLike,\n position: LineLabelAttrs['position'] = 'end',\n offset = 0\n ) {\n if (!textBounds || !graphicBounds) {\n return;\n }\n\n const { x1, x2 } = textBounds;\n const width = Math.abs(x2 - x1);\n\n const anchorX = graphicBounds.x1;\n const anchorY = graphicBounds.y1;\n\n let x = anchorX;\n const y = anchorY;\n\n if (position === 'end') {\n x = anchorX + width / 2 + offset;\n } else if (position === 'start') {\n x = anchorX - width / 2 - offset;\n }\n\n return { x, y };\n }\n}\n"]}
|
package/es/label/rect.js
CHANGED
|
@@ -44,9 +44,10 @@ export class RectLabel extends LabelBase {
|
|
|
44
44
|
RectLabel.tag = "rect-label", RectLabel.defaultAttributes = {
|
|
45
45
|
textStyle: {
|
|
46
46
|
fontSize: 12,
|
|
47
|
-
|
|
47
|
+
fill: "#000",
|
|
48
48
|
textAlign: "center",
|
|
49
|
-
textBaseline: "middle"
|
|
49
|
+
textBaseline: "middle",
|
|
50
|
+
boundsPadding: [ -1, 0, -1, 0 ]
|
|
50
51
|
},
|
|
51
52
|
position: "top",
|
|
52
53
|
offset: 5,
|
package/es/label/rect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["label/rect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAe,MAAM,kBAAkB,CAAC;AAGtD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,MAAM,OAAO,SAAU,SAAQ,SAAyB;
|
|
1
|
+
{"version":3,"sources":["label/rect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAe,MAAM,kBAAkB,CAAC;AAGtD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,MAAM,OAAO,SAAU,SAAQ,SAAyB;IAgBtD,YAAY,UAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,SAAS,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;IAC5D,CAAC;IAES,QAAQ,CAChB,UAAuB,EACvB,aAA0B,EAC1B,QAAQ,GAAG,KAAK,EAChB,MAAM,GAAG,CAAC;QAEV,IAAI,CAAC,UAAU,IAAI,CAAC,aAAa,EAAE;YACjC,OAAO;SACR;QAED,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,UAAU,CAAC;QACtC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAChC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAEjC,MAAM,SAAS,GAAG,I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AAC,QAAQ,CAAC,EAAE;YACtC,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACxB;aAAM,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACpC,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACxB;aAAM,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YACrC,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACxB;QAED,MAAM,CAAC,GAAG,OAAO,GAAG,EAAE,GAAG,MAAM,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACnD,MAAM,CAAC,GAAG,OAAO,GAAG,EAAE,GAAG,MAAM,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAEpD,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAClB,CAAC;;AAlFM,aAAG,GAAG,YAAY,CAAC;AAEnB,2BAAiB,GAA4B;IAClD,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,QAAQ;QACtB,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAC9B;IACD,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,KAAK;CAChB,CAAC","file":"rect.js","sourcesContent":["import { merge, IBoundsLike } from '@visactor/vutils';\nimport type { ITextGraphicAttribute } from '@visactor/vrender';\nimport type { RectLabelAttrs } from './type';\nimport { LabelBase } from './base';\n\nexport class RectLabel extends LabelBase<RectLabelAttrs> {\n static tag = 'rect-label';\n\n static defaultAttributes: Partial<RectLabelAttrs> = {\n textStyle: {\n fontSize: 12,\n fill: '#000',\n textAlign: 'center',\n textBaseline: 'middle',\n boundsPadding: [-1, 0, -1, 0] // to ignore the textBound buf\n },\n position: 'top',\n offset: 5,\n pickable: false\n };\n\n constructor(attributes: RectLabelAttrs) {\n super(merge({}, RectLabel.defaultAttributes, attributes));\n }\n\n protected labeling(\n textBounds: IBoundsLike,\n graphicBounds: IBoundsLike,\n position = 'top',\n offset = 0\n ): Partial<ITextGraphicAttribute> | undefined {\n if (!textBounds || !graphicBounds) {\n return;\n }\n\n const { x1, y1, x2, y2 } = textBounds;\n const width = Math.abs(x2 - x1);\n const height = Math.abs(y2 - y1);\n\n const rectWidth = Math.abs(graphicBounds.x2 - graphicBounds.x1);\n const rectHeight = Math.abs(graphicBounds.y2 - graphicBounds.y1);\n let anchorX = (graphicBounds.x1 + graphicBounds.x2) / 2;\n let anchorY = (graphicBounds.y1 + graphicBounds.y2) / 2;\n\n let sx = 0;\n let sy = 0;\n\n switch (position) {\n case 'top':\n case 'inside-top':\n sy = -0.5;\n break;\n case 'bottom':\n case 'inside-bottom':\n sy = 0.5;\n break;\n case 'left':\n case 'inside-left':\n sx = -0.5;\n break;\n case 'right':\n case 'inside-right':\n sx = 0.5;\n break;\n }\n\n anchorX += sx * rectWidth;\n anchorY += sy * rectHeight;\n\n let vx = 0;\n let vy = 0;\n\n const isInside = position.includes('inside');\n\n if (position.includes('top')) {\n vy = isInside ? 1 : -1;\n } else if (position.includes('bottom')) {\n vy = isInside ? -1 : 1;\n } else if (position.includes('left')) {\n vx = isInside ? 1 : -1;\n } else if (position.includes('right')) {\n vx = isInside ? -1 : 1;\n }\n\n const x = anchorX + vx * offset + (vx * width) / 2;\n const y = anchorY + vy * offset + (vy * height) / 2;\n\n return { x, y };\n }\n}\n"]}
|
package/es/label/symbol.js
CHANGED
|
@@ -54,9 +54,10 @@ export class SymbolLabel extends LabelBase {
|
|
|
54
54
|
SymbolLabel.defaultAttributes = {
|
|
55
55
|
textStyle: {
|
|
56
56
|
fontSize: 12,
|
|
57
|
-
|
|
57
|
+
fill: "#000",
|
|
58
58
|
textAlign: "center",
|
|
59
|
-
textBaseline: "middle"
|
|
59
|
+
textBaseline: "middle",
|
|
60
|
+
boundsPadding: [ -1, 0, -1, 0 ]
|
|
60
61
|
},
|
|
61
62
|
position: "top",
|
|
62
63
|
offset: 5,
|
package/es/label/symbol.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["label/symbol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAe,MAAM,kBAAkB,CAAC;AAGtD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,MAAM,OAAO,WAAY,SAAQ,SAA2B;
|
|
1
|
+
{"version":3,"sources":["label/symbol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAe,MAAM,kBAAkB,CAAC;AAGtD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,MAAM,OAAO,WAAY,SAAQ,SAA2B;IAgB1D,YAAY,UAA4B;QACtC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,WAAW,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAhB9D,SAAI,GAAG,cAAc,CAAC;IAiBtB,CAAC;IAES,QAAQ,CAChB,UAAuB,EACvB,aAA0B,EAC1B,QAAQ,GAAG,KAAK,EAChB,MAAM,GAAG,CAAC;QAEV,IAAI,CAAC,UAAU,EAAE;YACf,OAAO;SACR;QAED,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,UAAU,CAAC;QACtC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAChC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAEjC,MAAM,OAAO,GAAG,CAAC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AC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;gBACjD,MAAM;YACR,KAAK,QAAQ;gBACX,EAAE,GAAG,CAAC,CAAC;gBACP,EAAE,GAAG,CAAC,CAAC;gBACP,MAAM;SACT;QAED,MAAM,CAAC,GAAG,OAAO,GAAG,EAAE,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAC1E,MAAM,CAAC,GAAG,OAAO,GAAG,EAAE,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAE3E,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAClB,CAAC;;AAhFM,6BAAiB,GAA8B;IACpD,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,QAAQ;QACtB,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAC9B;IACD,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,KAAK;CAChB,CAAC","file":"symbol.js","sourcesContent":["import { merge, IBoundsLike } from '@visactor/vutils';\nimport type { ITextGraphicAttribute } from '@visactor/vrender';\nimport type { SymbolLabelAttrs } from './type';\nimport { LabelBase } from './base';\n\nexport class SymbolLabel extends LabelBase<SymbolLabelAttrs> {\n name = 'symbol-label';\n\n static defaultAttributes: Partial<SymbolLabelAttrs> = {\n textStyle: {\n fontSize: 12,\n fill: '#000',\n textAlign: 'center',\n textBaseline: 'middle',\n boundsPadding: [-1, 0, -1, 0] // to ignore the textBound buf\n },\n position: 'top',\n offset: 5,\n pickable: false\n };\n\n constructor(attributes: SymbolLabelAttrs) {\n super(merge({}, SymbolLabel.defaultAttributes, attributes));\n }\n\n protected labeling(\n textBounds: IBoundsLike,\n graphicBounds: IBoundsLike,\n position = 'top',\n offset = 0\n ): Partial<ITextGraphicAttribute> | undefined {\n if (!textBounds) {\n return;\n }\n\n const { x1, y1, x2, y2 } = textBounds;\n const width = Math.abs(x2 - x1);\n const height = Math.abs(y2 - y1);\n\n const anchorX = (graphicBounds.x1 + graphicBounds.x2) / 2;\n const anchorY = (graphicBounds.y1 + graphicBounds.y2) / 2;\n\n let sx = 0;\n let sy = 0;\n let offsetX = 0;\n let offsetY = 0;\n if (graphicBounds) {\n offsetX = Math.abs(graphicBounds.x1 - graphicBounds.x2) / 2;\n offsetY = Math.abs(graphicBounds.y1 - graphicBounds.y2) / 2;\n }\n\n const angle = {\n 'top-right': -235,\n 'top-left': 235,\n 'bottom-right': 45,\n 'bottom-left': -45\n };\n\n switch (position) {\n case 'top':\n sy = -1;\n break;\n case 'bottom':\n sy = 1;\n break;\n case 'left':\n sx = -1;\n break;\n case 'right':\n sx = 1;\n break;\n case 'bottom-left':\n case 'bottom-right':\n case 'top-left':\n case 'top-right':\n sx = Math.sin(angle[position] * (Math.PI / 180));\n sy = Math.cos(angle[position] * (Math.PI / 180));\n break;\n case 'center':\n sx = 0;\n sy = 0;\n break;\n }\n\n const x = anchorX + sx * (offset + offsetX) + Math.sign(sx) * (width / 2);\n const y = anchorY + sy * (offset + offsetY) + Math.sign(sy) * (height / 2);\n\n return { x, y };\n }\n}\n"]}
|
|
@@ -10,17 +10,17 @@ export declare class ColorContinuousLegend extends LegendBase<ColorLegendAttribu
|
|
|
10
10
|
textStyle: {
|
|
11
11
|
fontSize: number;
|
|
12
12
|
fontWeight: string;
|
|
13
|
-
|
|
13
|
+
fill: string;
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
handlerSize: number;
|
|
17
17
|
handlerStyle: {
|
|
18
18
|
lineWidth: number;
|
|
19
|
-
|
|
19
|
+
stroke: string;
|
|
20
20
|
outerBorder: {
|
|
21
21
|
distance: number;
|
|
22
22
|
lineWidth: number;
|
|
23
|
-
|
|
23
|
+
stroke: string;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
};
|
package/es/legend/color/color.js
CHANGED
|
@@ -41,7 +41,7 @@ export class ColorContinuousLegend extends LegendBase {
|
|
|
41
41
|
handlerStyle: handlerStyle,
|
|
42
42
|
railStyle: railStyle,
|
|
43
43
|
trackStyle: Object.assign({
|
|
44
|
-
|
|
44
|
+
fill: this._color
|
|
45
45
|
}, trackStyle),
|
|
46
46
|
startText: startText,
|
|
47
47
|
endText: endText,
|
|
@@ -80,8 +80,7 @@ export class ColorContinuousLegend extends LegendBase {
|
|
|
80
80
|
}
|
|
81
81
|
_updateColor() {
|
|
82
82
|
const {layout: layout = "horizontal", colors: colors, railWidth: railWidth, railHeight: railHeight} = this.attribute, {startHandler: startHandler, endHandler: endHandler, track: track} = this._slider, {startValue: startValue, endValue: endValue, startPos: startPos, endPos: endPos} = this._slider.currentValue, startHandlerColor = this._colorScale.scale(startValue), endHandlerColor = this._colorScale.scale(endValue);
|
|
83
|
-
null == startHandler || startHandler.setAttribute("
|
|
84
|
-
null == endHandler || endHandler.setAttribute("fillColor", endHandlerColor);
|
|
83
|
+
null == startHandler || startHandler.setAttribute("fill", startHandlerColor), null == endHandler || endHandler.setAttribute("fill", endHandlerColor);
|
|
85
84
|
const railLen = "horizontal" === layout ? railWidth : railHeight;
|
|
86
85
|
if (Math.abs(startPos - endPos) !== railLen && colors && colors.length > 1) {
|
|
87
86
|
const stops = this._color.stops, start = Math.min(startPos, endPos), end = Math.max(startPos, endPos), startRatio = start / railLen, endRatio = end / railLen, range = endRatio - startRatio, betweenStops = stops.filter((stop => stop.offset > startRatio && stop.offset < endRatio)), minValue = Math.min(startValue, endValue), maxValue = Math.max(startValue, endValue), startColor = this._colorScale.scale(minValue), endColor = this._colorScale.scale(maxValue), newStops = [ {
|
|
@@ -96,7 +95,7 @@ export class ColorContinuousLegend extends LegendBase {
|
|
|
96
95
|
})), newStops.push({
|
|
97
96
|
offset: 1,
|
|
98
97
|
color: endColor
|
|
99
|
-
}), track.setAttribute("
|
|
98
|
+
}), track.setAttribute("fill", Object.assign(Object.assign({}, this._color), {
|
|
100
99
|
stops: newStops
|
|
101
100
|
}));
|
|
102
101
|
}
|
|
@@ -111,17 +110,17 @@ ColorContinuousLegend.defaultAttributes = {
|
|
|
111
110
|
textStyle: {
|
|
112
111
|
fontSize: 12,
|
|
113
112
|
fontWeight: "bold",
|
|
114
|
-
|
|
113
|
+
fill: "rgba(46, 47, 50, 1)"
|
|
115
114
|
}
|
|
116
115
|
},
|
|
117
116
|
handlerSize: 10,
|
|
118
117
|
handlerStyle: {
|
|
119
118
|
lineWidth: 4,
|
|
120
|
-
|
|
119
|
+
stroke: "#fff",
|
|
121
120
|
outerBorder: {
|
|
122
121
|
distance: 2,
|
|
123
122
|
lineWidth: 1,
|
|
124
|
-
|
|
123
|
+
stroke: "#ccc"
|
|
125
124
|
}
|
|
126
125
|
}
|
|
127
126
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["legend/color/color.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlD,MAAM,OAAO,qBAAsB,SAAQ,UAAiC;IA+B1E,YAAY,UAAiC;QAC3C,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,qBAAqB,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QA/BxE,S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Q,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;YACpD,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBAC1B,QAAQ,CAAC,IAAI,CAAC;oBACZ,MAAM,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,GAAG,KAAK;oBAC1C,KAAK,EAAE,IAAI,CAAC,KAAK;iBAClB,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YACH,QAAQ,CAAC,IAAI,CAAC;gBACZ,MAAM,EAAE,CAAC;gBACT,KAAK,EAAE,QAAQ;aAChB,CAAC,CAAC;YACH,KAAK,CAAC,YAAY,CAAC,WAAW,kCACxB,IAAI,CAAC,MAA0B,KACnC,KAAK,EAAE,QAAQ,IACf,CAAC;SACJ;IACH,CAAC;;AA3MM,uCAAiB,GAAG;IACzB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE;QAEL,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,mBAAmB;QAC1B,SAAS,EAAE;YACT,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,MAAM;YAClB,SAAS,EAAE,qBAAqB;SACjC;KACF;IACD,WAAW,EAAE,EAAE;IACf,YAAY,EAAE;QACZ,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,MAAM;QACnB,WAAW,EAAE;YACX,QAAQ,EAAE,CAAC;YACX,SAAS,EAAE,CAAC;YACZ,WAAW,EAAE,MAAM;SACpB;KACF;CACF,CAAC","file":"color.js","sourcesContent":["/**\n * @description 连续颜色图例\n * TODO:\n * showHandlers 测试\n */\nimport { merge, isEmpty, get } from '@visactor/vutils';\nimport { FederatedPointerEvent, IColor, ILinearGradient, INode } from '@visactor/vrender';\nimport { LinearScale, ILinearScale } from '@visactor/vscale';\nimport { LegendBase } from '../base';\nimport { Slider } from '../../slider';\nimport { DEFAULT_TITLE_SPACE } from '../constant';\nimport { ColorLegendAttributes } from './type';\n\nexport class ColorContinuousLegend extends LegendBase<ColorLegendAttributes> {\n name = 'colorLegend';\n\n static defaultAttributes = {\n layout: 'horizontal',\n title: {\n // orient: 'top',\n align: 'start',\n space: DEFAULT_TITLE_SPACE,\n textStyle: {\n fontSize: 12,\n fontWeight: 'bold',\n fillColor: 'rgba(46, 47, 50, 1)'\n }\n },\n handlerSize: 10,\n handlerStyle: {\n lineWidth: 4,\n strokeColor: '#fff',\n outerBorder: {\n distance: 2,\n lineWidth: 1,\n strokeColor: '#ccc'\n }\n }\n };\n\n private _slider!: Slider;\n private _colorScale!: ILinearScale;\n private _color: IColor | undefined;\n\n constructor(attributes: ColorLegendAttributes) {\n super(merge({}, ColorContinuousLegend.defaultAttributes, attributes));\n }\n\n /**\n * 更新数据选中范围\n * @param value 选中数据范围\n * @returns\n */\n setSelected(value: number[]) {\n if (!this._slider) {\n return;\n }\n this._slider.setValue(value);\n this._updateColor();\n }\n\n protected _renderContent(): void {\n const {\n colors,\n slidable,\n layout,\n align,\n min,\n max,\n value,\n railWidth,\n railHeight,\n showHandler = true,\n handlerSize,\n handlerStyle,\n railStyle,\n trackStyle,\n startText,\n endText,\n handlerText,\n showTooltip,\n tooltip\n } = this.attribute as ColorLegendAttributes;\n\n // 创建 colorScale\n const domain = [];\n const step = (max - min) / (colors.length - 1);\n for (let i = 0; i < colors.length; i++) {\n domain.push(min + step * i);\n }\n this._colorScale = new LinearScale().domain(domain, true).range(colors);\n this._color = this._getTrackColor();\n\n const slider = new Slider({\n x: 0,\n y: 0,\n range: {\n draggableTrack: true\n },\n slidable,\n layout,\n align,\n min,\n max,\n value,\n railWidth,\n railHeight,\n showHandler,\n handlerSize,\n handlerStyle,\n railStyle,\n trackStyle: {\n fillColor: this._color,\n ...trackStyle\n },\n startText,\n endText,\n handlerText,\n showTooltip,\n tooltip\n });\n this._innerView.add(slider as unknown as INode);\n this._slider = slider;\n // 做下位置调整,对齐\n slider.translateTo(\n 0 - slider.AABBBounds.x1,\n (this._title ? this._title.AABBBounds.height() + get(this.attribute, 'title.space', DEFAULT_TITLE_SPACE) : 0) -\n slider.AABBBounds.y1\n );\n this._updateColor();\n }\n\n protected _bindEvents(): void {\n if (this._slider) {\n this._slider.addEventListener('change', this._onSliderChange as EventListenerOrEventListenerObject);\n }\n }\n\n private _getTrackColor(): IColor | undefined {\n const { colors, layout } = this.attribute as ColorLegendAttributes;\n\n if (isEmpty(colors)) {\n return undefined;\n }\n const count = colors.length;\n if (count === 1) {\n return colors[0];\n }\n const stops = [];\n\n for (let i = 0; i < count; i++) {\n const percent = i / (count - 1);\n stops.push({\n offset: percent,\n color: colors[i]\n });\n }\n const isHorizontal = layout === 'horizontal';\n return {\n gradient: 'linear',\n stops,\n x0: 0,\n y0: 0,\n x1: isHorizontal ? 1 : 0,\n y1: isHorizontal ? 0 : 1\n };\n }\n\n private _onSliderChange = (e: FederatedPointerEvent) => {\n // 更新 handler 以及 track 的渐变色\n this._updateColor();\n this.dispatchEvent(e);\n };\n\n private _updateColor() {\n const { layout = 'horizontal', colors, railWidth, railHeight } = this.attribute as ColorLegendAttributes;\n const { startHandler, endHandler, track } = this._slider;\n const { startValue, endValue, startPos, endPos } = this._slider.currentValue;\n\n // 计算颜色\n const startHandlerColor = this._colorScale.scale(startValue);\n const endHandlerColor = this._colorScale.scale(endValue);\n startHandler?.setAttribute('fillColor', startHandlerColor);\n endHandler?.setAttribute('fillColor', endHandlerColor);\n\n const isHorizontal = layout === 'horizontal';\n const railLen = isHorizontal ? railWidth : railHeight;\n const trackLength = Math.abs((startPos as number) - (endPos as number));\n\n // 计算渐变色\n if (trackLength !== railLen && colors && colors.length > 1) {\n const stops = (this._color as ILinearGradient).stops;\n const start = Math.min(startPos as number, endPos as number);\n const end = Math.max(startPos as number, endPos as number);\n const startRatio = start / railLen;\n const endRatio = end / railLen;\n const range = endRatio - startRatio;\n const betweenStops = stops.filter(stop => stop.offset > startRatio && stop.offset < endRatio);\n\n const minValue = Math.min(startValue, endValue);\n const maxValue = Math.max(startValue, endValue);\n const startColor = this._colorScale.scale(minValue);\n const endColor = this._colorScale.scale(maxValue);\n const newStops = [{ offset: 0, color: startColor }];\n betweenStops.forEach(stop => {\n newStops.push({\n offset: (stop.offset - startRatio) / range,\n color: stop.color\n });\n });\n newStops.push({\n offset: 1,\n color: endColor\n });\n track.setAttribute('fillColor', {\n ...(this._color as ILinearGradient),\n stops: newStops\n });\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["legend/color/color.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlD,MAAM,OAAO,qBAAsB,SAAQ,UAAiC;IA+B1E,YAAY,UAAiC;QAC3C,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,qBAAqB,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QA/BxE,SAAI,GAAG,aAAa,CAAC;QA0Jb,oBAAe,GAAG,CAAC,CAAwB,EAAE,EAAE;YAErD,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC,CAAC;IA9HF,CAAC;IAOD,WAAW,CAAC,KAAe;QACzB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO;SACR;QACD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC7B,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;IAES,cAAc;QACtB,MAAM,EACJ,MAAM,EACN,QAAQ,EACR,MAAM,EACN,KAAK,EACL,GAAG,EACH,GAAG,EACH,KAAK,E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KAAK,EAAE,QAAQ,IACf,CAAC;SACJ;IACH,CAAC;;AA3MM,uCAAiB,GAAG;IACzB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE;QAEL,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,mBAAmB;QAC1B,SAAS,EAAE;YACT,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,MAAM;YAClB,IAAI,EAAE,qBAAqB;SAC5B;KACF;IACD,WAAW,EAAE,EAAE;IACf,YAAY,EAAE;QACZ,SAAS,EAAE,CAAC;QACZ,MAAM,EAAE,MAAM;QACd,WAAW,EAAE;YACX,QAAQ,EAAE,CAAC;YACX,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,MAAM;SACf;KACF;CACF,CAAC","file":"color.js","sourcesContent":["/**\n * @description 连续颜色图例\n * TODO:\n * showHandlers 测试\n */\nimport { merge, isEmpty, get } from '@visactor/vutils';\nimport { FederatedPointerEvent, IColor, ILinearGradient, INode } from '@visactor/vrender';\nimport { LinearScale, ILinearScale } from '@visactor/vscale';\nimport { LegendBase } from '../base';\nimport { Slider } from '../../slider';\nimport { DEFAULT_TITLE_SPACE } from '../constant';\nimport { ColorLegendAttributes } from './type';\n\nexport class ColorContinuousLegend extends LegendBase<ColorLegendAttributes> {\n name = 'colorLegend';\n\n static defaultAttributes = {\n layout: 'horizontal',\n title: {\n // orient: 'top',\n align: 'start',\n space: DEFAULT_TITLE_SPACE,\n textStyle: {\n fontSize: 12,\n fontWeight: 'bold',\n fill: 'rgba(46, 47, 50, 1)'\n }\n },\n handlerSize: 10,\n handlerStyle: {\n lineWidth: 4,\n stroke: '#fff',\n outerBorder: {\n distance: 2,\n lineWidth: 1,\n stroke: '#ccc'\n }\n }\n };\n\n private _slider!: Slider;\n private _colorScale!: ILinearScale;\n private _color: IColor | undefined;\n\n constructor(attributes: ColorLegendAttributes) {\n super(merge({}, ColorContinuousLegend.defaultAttributes, attributes));\n }\n\n /**\n * 更新数据选中范围\n * @param value 选中数据范围\n * @returns\n */\n setSelected(value: number[]) {\n if (!this._slider) {\n return;\n }\n this._slider.setValue(value);\n this._updateColor();\n }\n\n protected _renderContent(): void {\n const {\n colors,\n slidable,\n layout,\n align,\n min,\n max,\n value,\n railWidth,\n railHeight,\n showHandler = true,\n handlerSize,\n handlerStyle,\n railStyle,\n trackStyle,\n startText,\n endText,\n handlerText,\n showTooltip,\n tooltip\n } = this.attribute as ColorLegendAttributes;\n\n // 创建 colorScale\n const domain = [];\n const step = (max - min) / (colors.length - 1);\n for (let i = 0; i < colors.length; i++) {\n domain.push(min + step * i);\n }\n this._colorScale = new LinearScale().domain(domain, true).range(colors);\n this._color = this._getTrackColor();\n\n const slider = new Slider({\n x: 0,\n y: 0,\n range: {\n draggableTrack: true\n },\n slidable,\n layout,\n align,\n min,\n max,\n value,\n railWidth,\n railHeight,\n showHandler,\n handlerSize,\n handlerStyle,\n railStyle,\n trackStyle: {\n fill: this._color,\n ...trackStyle\n },\n startText,\n endText,\n handlerText,\n showTooltip,\n tooltip\n });\n this._innerView.add(slider as unknown as INode);\n this._slider = slider;\n // 做下位置调整,对齐\n slider.translateTo(\n 0 - slider.AABBBounds.x1,\n (this._title ? this._title.AABBBounds.height() + get(this.attribute, 'title.space', DEFAULT_TITLE_SPACE) : 0) -\n slider.AABBBounds.y1\n );\n this._updateColor();\n }\n\n protected _bindEvents(): void {\n if (this._slider) {\n this._slider.addEventListener('change', this._onSliderChange as EventListenerOrEventListenerObject);\n }\n }\n\n private _getTrackColor(): IColor | undefined {\n const { colors, layout } = this.attribute as ColorLegendAttributes;\n\n if (isEmpty(colors)) {\n return undefined;\n }\n const count = colors.length;\n if (count === 1) {\n return colors[0];\n }\n const stops = [];\n\n for (let i = 0; i < count; i++) {\n const percent = i / (count - 1);\n stops.push({\n offset: percent,\n color: colors[i]\n });\n }\n const isHorizontal = layout === 'horizontal';\n return {\n gradient: 'linear',\n stops,\n x0: 0,\n y0: 0,\n x1: isHorizontal ? 1 : 0,\n y1: isHorizontal ? 0 : 1\n };\n }\n\n private _onSliderChange = (e: FederatedPointerEvent) => {\n // 更新 handler 以及 track 的渐变色\n this._updateColor();\n this.dispatchEvent(e);\n };\n\n private _updateColor() {\n const { layout = 'horizontal', colors, railWidth, railHeight } = this.attribute as ColorLegendAttributes;\n const { startHandler, endHandler, track } = this._slider;\n const { startValue, endValue, startPos, endPos } = this._slider.currentValue;\n\n // 计算颜色\n const startHandlerColor = this._colorScale.scale(startValue);\n const endHandlerColor = this._colorScale.scale(endValue);\n startHandler?.setAttribute('fill', startHandlerColor);\n endHandler?.setAttribute('fill', endHandlerColor);\n\n const isHorizontal = layout === 'horizontal';\n const railLen = isHorizontal ? railWidth : railHeight;\n const trackLength = Math.abs((startPos as number) - (endPos as number));\n\n // 计算渐变色\n if (trackLength !== railLen && colors && colors.length > 1) {\n const stops = (this._color as ILinearGradient).stops;\n const start = Math.min(startPos as number, endPos as number);\n const end = Math.max(startPos as number, endPos as number);\n const startRatio = start / railLen;\n const endRatio = end / railLen;\n const range = endRatio - startRatio;\n const betweenStops = stops.filter(stop => stop.offset > startRatio && stop.offset < endRatio);\n\n const minValue = Math.min(startValue, endValue);\n const maxValue = Math.max(startValue, endValue);\n const startColor = this._colorScale.scale(minValue);\n const endColor = this._colorScale.scale(maxValue);\n const newStops = [{ offset: 0, color: startColor }];\n betweenStops.forEach(stop => {\n newStops.push({\n offset: (stop.offset - startRatio) / range,\n color: stop.color\n });\n });\n newStops.push({\n offset: 1,\n color: endColor\n });\n track.setAttribute('fill', {\n ...(this._color as ILinearGradient),\n stops: newStops\n });\n }\n }\n}\n"]}
|