MCPcopy
hub / github.com/apache/echarts / BrushFeature

Class BrushFeature

src/component/toolbox/feature/Brush.ts:41–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41class BrushFeature extends ToolboxFeature<ToolboxBrushFeatureOption> {
42
43 private _brushType: BrushTypeUncertain;
44 private _brushMode: string;
45
46 render(
47 featureModel: ToolboxFeatureModel<ToolboxBrushFeatureOption>,
48 ecModel: GlobalModel,
49 api: ExtensionAPI
50 ) {
51 let brushType: BrushTypeUncertain;
52 let brushMode: string;
53 let isBrushed: boolean;
54
55 ecModel.eachComponent({mainType: 'brush'}, function (brushModel: BrushModel) {
56 brushType = brushModel.brushType;
57 brushMode = brushModel.brushOption.brushMode || 'single';
58 isBrushed = isBrushed || !!brushModel.areas.length;
59 });
60 this._brushType = brushType;
61 this._brushMode = brushMode;
62
63 zrUtil.each(featureModel.get('type', true), function (type) {
64 featureModel.setIconStatus(
65 type,
66 (
67 type === 'keep'
68 ? brushMode === 'multiple'
69 : type === 'clear'
70 ? isBrushed
71 : type === brushType
72 ) ? 'emphasis' : 'normal'
73 );
74 });
75 }
76
77 updateView(
78 featureModel: ToolboxFeatureModel<ToolboxBrushFeatureOption>,
79 ecModel: GlobalModel,
80 api: ExtensionAPI
81 ) {
82 this.render(featureModel, ecModel, api);
83 }
84
85 getIcons() {
86 const model = this.model;
87 const availableIcons = model.get('icon', true);
88 const icons: ToolboxBrushFeatureOption['icon'] = {};
89 zrUtil.each(model.get('type', true), function (type) {
90 if (availableIcons[type]) {
91 icons[type] = availableIcons[type];
92 }
93 });
94 return icons;
95 };
96
97 onclick(ecModel: GlobalModel, api: ExtensionAPI, type: IconType) {
98 const brushType = this._brushType;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…