@visactor/vchart 1.13.9-alpha.5 → 1.13.9

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.
Files changed (180) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +1063 -804
  3. package/build/index.js +1063 -803
  4. package/build/index.min.js +1 -1
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/chart/base/base-chart.d.ts +8 -1
  7. package/cjs/chart/base/base-chart.js +33 -20
  8. package/cjs/chart/base/base-chart.js.map +1 -1
  9. package/cjs/chart/index.d.ts +1 -1
  10. package/cjs/chart/index.js.map +1 -1
  11. package/cjs/chart/interface/chart.d.ts +8 -1
  12. package/cjs/chart/interface/chart.js.map +1 -1
  13. package/cjs/chart/pictogram/interface.d.ts +1 -1
  14. package/cjs/chart/pictogram/interface.js.map +1 -1
  15. package/cjs/chart/progress/linear/linear-progress-transformer.js +1 -1
  16. package/cjs/chart/progress/linear/linear-progress-transformer.js.map +1 -1
  17. package/cjs/chart/sankey/sankey.js +21 -21
  18. package/cjs/chart/sankey/sankey.js.map +1 -1
  19. package/cjs/compile/mark/compilable-mark.d.ts +1 -0
  20. package/cjs/compile/mark/compilable-mark.js +3 -0
  21. package/cjs/compile/mark/compilable-mark.js.map +1 -1
  22. package/cjs/component/axis/base-axis.js +7 -2
  23. package/cjs/component/axis/base-axis.js.map +1 -1
  24. package/cjs/component/axis/interface/spec.d.ts +7 -2
  25. package/cjs/component/axis/interface/spec.js.map +1 -1
  26. package/cjs/component/brush/brush.d.ts +23 -24
  27. package/cjs/component/brush/brush.js +183 -182
  28. package/cjs/component/brush/brush.js.map +1 -1
  29. package/cjs/component/brush/interface.d.ts +2 -0
  30. package/cjs/component/brush/interface.js.map +1 -1
  31. package/cjs/component/crosshair/base.js +1 -1
  32. package/cjs/component/crosshair/base.js.map +1 -1
  33. package/cjs/component/crosshair/utils/cartesian.js +9 -8
  34. package/cjs/component/crosshair/utils/cartesian.js.map +1 -1
  35. package/cjs/component/data-zoom/data-zoom/interface.d.ts +2 -3
  36. package/cjs/component/data-zoom/data-zoom/interface.js.map +1 -1
  37. package/cjs/component/marker/mark-area/base-mark-area.js +27 -17
  38. package/cjs/component/marker/mark-area/base-mark-area.js.map +1 -1
  39. package/cjs/component/marker/mark-area/interface/theme.d.ts +4 -3
  40. package/cjs/component/marker/mark-area/interface/theme.js.map +1 -1
  41. package/cjs/component/marker/mark-line/base-mark-line.js +31 -20
  42. package/cjs/component/marker/mark-line/base-mark-line.js.map +1 -1
  43. package/cjs/component/marker/mark-line/cartesian-mark-line.js +32 -26
  44. package/cjs/component/marker/mark-line/cartesian-mark-line.js.map +1 -1
  45. package/cjs/component/marker/mark-line/interface/theme.d.ts +4 -3
  46. package/cjs/component/marker/mark-line/interface/theme.js.map +1 -1
  47. package/cjs/component/marker/mark-point/cartesian-mark-point.js +3 -1
  48. package/cjs/component/marker/mark-point/cartesian-mark-point.js.map +1 -1
  49. package/cjs/component/marker/utils.d.ts +12 -0
  50. package/cjs/component/marker/utils.js +22 -7
  51. package/cjs/component/marker/utils.js.map +1 -1
  52. package/cjs/constant/event.d.ts +1 -0
  53. package/cjs/constant/event.js +6 -6
  54. package/cjs/constant/event.js.map +1 -1
  55. package/cjs/constant/funnel.js +2 -1
  56. package/cjs/constant/sunburst.js +1 -2
  57. package/cjs/core/index.d.ts +1 -1
  58. package/cjs/core/index.js +1 -1
  59. package/cjs/core/index.js.map +1 -1
  60. package/cjs/core/interface.js +2 -1
  61. package/cjs/core/vchart.js +1 -2
  62. package/cjs/data/transforms/pictogram.d.ts +1 -9
  63. package/cjs/data/transforms/pictogram.js +3 -3
  64. package/cjs/data/transforms/pictogram.js.map +1 -1
  65. package/cjs/data/transforms/pie.js +1 -1
  66. package/cjs/data/transforms/pie.js.map +1 -1
  67. package/cjs/index-harmony-simple.js.map +1 -1
  68. package/cjs/index.d.ts +1 -0
  69. package/cjs/index.js +8 -7
  70. package/cjs/index.js.map +1 -1
  71. package/cjs/model/base-model.d.ts +1 -0
  72. package/cjs/model/base-model.js +6 -0
  73. package/cjs/model/base-model.js.map +1 -1
  74. package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.js +11 -7
  75. package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.js.map +1 -1
  76. package/cjs/series/bar/bar.js.map +1 -1
  77. package/cjs/series/gauge/gauge.js +7 -5
  78. package/cjs/series/gauge/gauge.js.map +1 -1
  79. package/cjs/series/pictogram/tooltip-helper.d.ts +2 -2
  80. package/cjs/series/pictogram/tooltip-helper.js.map +1 -1
  81. package/cjs/series/pie/pie.js +3 -3
  82. package/cjs/series/pie/pie.js.map +1 -1
  83. package/cjs/series/polar/progress-like/interface.d.ts +1 -0
  84. package/cjs/series/polar/progress-like/interface.js.map +1 -1
  85. package/cjs/series/polar/progress-like/progress-like.js +4 -3
  86. package/cjs/series/polar/progress-like/progress-like.js.map +1 -1
  87. package/cjs/series/progress/linear/interface.d.ts +1 -0
  88. package/cjs/series/progress/linear/interface.js.map +1 -1
  89. package/cjs/series/progress/linear/linear.js +6 -4
  90. package/cjs/series/progress/linear/linear.js.map +1 -1
  91. package/cjs/typings/visual.d.ts +1 -1
  92. package/cjs/typings/visual.js.map +1 -1
  93. package/esm/chart/base/base-chart.d.ts +8 -1
  94. package/esm/chart/base/base-chart.js +33 -20
  95. package/esm/chart/base/base-chart.js.map +1 -1
  96. package/esm/chart/index.d.ts +1 -1
  97. package/esm/chart/index.js.map +1 -1
  98. package/esm/chart/interface/chart.d.ts +8 -1
  99. package/esm/chart/interface/chart.js.map +1 -1
  100. package/esm/chart/pictogram/interface.d.ts +1 -1
  101. package/esm/chart/pictogram/interface.js.map +1 -1
  102. package/esm/chart/progress/linear/linear-progress-transformer.js +1 -1
  103. package/esm/chart/progress/linear/linear-progress-transformer.js.map +1 -1
  104. package/esm/chart/sankey/sankey.js +22 -22
  105. package/esm/chart/sankey/sankey.js.map +1 -1
  106. package/esm/compile/mark/compilable-mark.d.ts +1 -0
  107. package/esm/compile/mark/compilable-mark.js +3 -0
  108. package/esm/compile/mark/compilable-mark.js.map +1 -1
  109. package/esm/component/axis/base-axis.js +7 -2
  110. package/esm/component/axis/base-axis.js.map +1 -1
  111. package/esm/component/axis/interface/spec.d.ts +7 -2
  112. package/esm/component/axis/interface/spec.js.map +1 -1
  113. package/esm/component/brush/brush.d.ts +23 -24
  114. package/esm/component/brush/brush.js +179 -177
  115. package/esm/component/brush/brush.js.map +1 -1
  116. package/esm/component/brush/interface.d.ts +2 -0
  117. package/esm/component/brush/interface.js.map +1 -1
  118. package/esm/component/crosshair/base.js +1 -1
  119. package/esm/component/crosshair/base.js.map +1 -1
  120. package/esm/component/crosshair/utils/cartesian.js +9 -8
  121. package/esm/component/crosshair/utils/cartesian.js.map +1 -1
  122. package/esm/component/data-zoom/data-zoom/interface.d.ts +2 -3
  123. package/esm/component/data-zoom/data-zoom/interface.js.map +1 -1
  124. package/esm/component/marker/mark-area/base-mark-area.js +27 -16
  125. package/esm/component/marker/mark-area/base-mark-area.js.map +1 -1
  126. package/esm/component/marker/mark-area/interface/theme.d.ts +4 -3
  127. package/esm/component/marker/mark-area/interface/theme.js.map +1 -1
  128. package/esm/component/marker/mark-line/base-mark-line.js +30 -19
  129. package/esm/component/marker/mark-line/base-mark-line.js.map +1 -1
  130. package/esm/component/marker/mark-line/cartesian-mark-line.js +31 -26
  131. package/esm/component/marker/mark-line/cartesian-mark-line.js.map +1 -1
  132. package/esm/component/marker/mark-line/interface/theme.d.ts +4 -3
  133. package/esm/component/marker/mark-line/interface/theme.js.map +1 -1
  134. package/esm/component/marker/mark-point/cartesian-mark-point.js +1 -1
  135. package/esm/component/marker/mark-point/cartesian-mark-point.js.map +1 -1
  136. package/esm/component/marker/utils.d.ts +12 -0
  137. package/esm/component/marker/utils.js +19 -4
  138. package/esm/component/marker/utils.js.map +1 -1
  139. package/esm/constant/event.d.ts +1 -0
  140. package/esm/constant/event.js +6 -6
  141. package/esm/constant/event.js.map +1 -1
  142. package/esm/constant/funnel.js +2 -1
  143. package/esm/constant/sunburst.js +1 -2
  144. package/esm/core/index.d.ts +1 -1
  145. package/esm/core/index.js +1 -1
  146. package/esm/core/index.js.map +1 -1
  147. package/esm/core/interface.js +2 -1
  148. package/esm/core/vchart.js +1 -2
  149. package/esm/data/transforms/pictogram.d.ts +1 -9
  150. package/esm/data/transforms/pictogram.js +3 -3
  151. package/esm/data/transforms/pictogram.js.map +1 -1
  152. package/esm/data/transforms/pie.js +1 -1
  153. package/esm/data/transforms/pie.js.map +1 -1
  154. package/esm/index-harmony-simple.js.map +1 -1
  155. package/esm/index.d.ts +1 -0
  156. package/esm/index.js +2 -0
  157. package/esm/index.js.map +1 -1
  158. package/esm/model/base-model.d.ts +1 -0
  159. package/esm/model/base-model.js +6 -0
  160. package/esm/model/base-model.js.map +1 -1
  161. package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.js +11 -7
  162. package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.js.map +1 -1
  163. package/esm/series/bar/bar.js.map +1 -1
  164. package/esm/series/gauge/gauge.js +6 -4
  165. package/esm/series/gauge/gauge.js.map +1 -1
  166. package/esm/series/pictogram/tooltip-helper.d.ts +2 -2
  167. package/esm/series/pictogram/tooltip-helper.js.map +1 -1
  168. package/esm/series/pie/pie.js +4 -4
  169. package/esm/series/pie/pie.js.map +1 -1
  170. package/esm/series/polar/progress-like/interface.d.ts +1 -0
  171. package/esm/series/polar/progress-like/interface.js.map +1 -1
  172. package/esm/series/polar/progress-like/progress-like.js +4 -3
  173. package/esm/series/polar/progress-like/progress-like.js.map +1 -1
  174. package/esm/series/progress/linear/interface.d.ts +1 -0
  175. package/esm/series/progress/linear/interface.js.map +1 -1
  176. package/esm/series/progress/linear/linear.js +6 -4
  177. package/esm/series/progress/linear/linear.js.map +1 -1
  178. package/esm/typings/visual.d.ts +1 -1
  179. package/esm/typings/visual.js.map +1 -1
  180. package/package.json +18 -18
@@ -37,45 +37,23 @@ export declare class Brush<T extends IBrushSpec = IBrushSpec> extends BaseCompon
37
37
  protected _linkedOutOfBrushElementsMap: {
38
38
  [elementKey: string]: IElement;
39
39
  };
40
- private _needInitOutState;
41
40
  private _cacheInteractiveRangeAttrs;
42
41
  private _needDisablePickable;
43
42
  private _releatedAxes;
44
43
  private _regionAxisMap;
45
44
  private _axisDataZoomMap;
46
45
  private _zoomRecord;
47
- init(): void;
48
46
  static getSpecInfo(chartSpec: any): Maybe<IModelSpecInfo[]>;
47
+ init(): void;
48
+ private _initNeedOperatedItem;
49
49
  created(): void;
50
- protected _extendDataInBrush(elementsMap: {
51
- [brushName: string]: {
52
- [elementKey: string]: IElement;
53
- };
54
- }): any[];
55
- protected _extendDatumOutOfBrush(elementsMap: {
56
- [elementKey: string]: IElement;
57
- }): any[];
58
- protected _getBrushInteractiveAttr(region: IRegion): BrushInteractiveRangeAttr;
59
- protected _updateBrushComponent(region: IRegion, componentIndex: number): void;
60
- protected _createBrushComponent(region: IRegion, componentIndex: number): void;
61
- private _handleBrushChange;
62
- private _emitEvent;
63
- private _transformBrushedMarkAttr;
64
- private _reconfigItem;
65
- private _reconfigLinkedItem;
66
- private _isBrushContainItem;
67
- private _stateClamp;
68
- private _setAxisAndDataZoom;
69
50
  protected _bindRegions(): void;
70
51
  protected _bindLinkedSeries(): void;
71
52
  private _initRegionAxisMap;
72
53
  private _initAxisDataZoomMap;
73
- private _initNeedOperatedItem;
74
- protected _initMarkBrushState(componentIndex: number, stateName: string): void;
75
54
  protected initEvent(): void;
76
55
  onRender(ctx: IModelRenderOption): void;
77
56
  changeRegions(regions: IRegion[]): void;
78
- protected _getNeedClearVRenderComponents(): IGraphic[];
79
57
  _compareSpec(spec: T, prevSpec: T): {
80
58
  change: boolean;
81
59
  reMake: boolean;
@@ -84,6 +62,27 @@ export declare class Brush<T extends IBrushSpec = IBrushSpec> extends BaseCompon
84
62
  reCompile: boolean;
85
63
  };
86
64
  onLayoutEnd(ctx: any): void;
65
+ protected _updateBrushComponent(region: IRegion, componentIndex: number): void;
66
+ protected _createBrushComponent(region: IRegion, componentIndex: number): void;
67
+ protected _getBrushInteractiveAttr(region: IRegion): BrushInteractiveRangeAttr;
68
+ private _transformBrushedMarkAttr;
69
+ private _handleBrushChange;
70
+ protected _extendDataInBrush(elementsMap: {
71
+ [brushName: string]: {
72
+ [elementKey: string]: IElement;
73
+ };
74
+ }): any[];
75
+ protected _extendDatumOutOfBrush(elementsMap: {
76
+ [elementKey: string]: IElement;
77
+ }): any[];
78
+ private _emitEvent;
79
+ private _reconfigItem;
80
+ private _reconfigLinkedItem;
81
+ private _isBrushContainItem;
82
+ protected _initMarkBrushState(componentIndex: number, stateName: string): void;
83
+ private _stateClamp;
84
+ private _setAxisAndDataZoom;
85
+ protected _getNeedClearVRenderComponents(): IGraphic[];
87
86
  clearGraphic(): void;
88
87
  clear(): void;
89
88
  }
@@ -28,8 +28,11 @@ export class Brush extends BaseComponent {
28
28
  this.name = ComponentTypeEnum.brush, this.specKey = "brush", this.layoutZIndex = LayoutZIndex.Brush,
29
29
  this._linkedSeries = [], this._itemMap = {}, this._linkedItemMap = {}, this._inBrushElementsMap = {},
30
30
  this._outOfBrushElementsMap = {}, this._linkedInBrushElementsMap = {}, this._linkedOutOfBrushElementsMap = {},
31
- this._needInitOutState = !0, this._cacheInteractiveRangeAttrs = [], this._needDisablePickable = !1,
32
- this._releatedAxes = [], this._regionAxisMap = {}, this._axisDataZoomMap = {}, this._zoomRecord = [];
31
+ this._cacheInteractiveRangeAttrs = [], this._needDisablePickable = !1, this._releatedAxes = [],
32
+ this._regionAxisMap = {}, this._axisDataZoomMap = {}, this._zoomRecord = [];
33
+ }
34
+ static getSpecInfo(chartSpec) {
35
+ return getSpecInfo(chartSpec, this.specKey, this.type, (s => !1 !== s.visible));
33
36
  }
34
37
  init() {
35
38
  const inBrushMarkAttr = this._transformBrushedMarkAttr(this._spec.inBrush), outOfBrushMarkAttr = this._transformBrushedMarkAttr(this._spec.outOfBrush);
@@ -40,42 +43,67 @@ export class Brush extends BaseComponent {
40
43
  }));
41
44
  }));
42
45
  }
43
- static getSpecInfo(chartSpec) {
44
- return getSpecInfo(chartSpec, this.specKey, this.type, (s => !1 !== s.visible));
46
+ _initNeedOperatedItem() {
47
+ const seriesUserId = this._spec.seriesId, seriesIndex = this._spec.seriesIndex;
48
+ this._relativeRegions.forEach((r => {
49
+ const allMarks = [];
50
+ r.getSeries().forEach((s => {
51
+ (seriesUserId && array(seriesUserId).includes(s.userId.toString()) || seriesIndex && array(seriesIndex).includes(s.getSpecIndex()) || !seriesIndex && !seriesUserId) && allMarks.push(...s.getMarksWithoutRoot()),
52
+ this._itemMap[r.id] = allMarks;
53
+ }));
54
+ })), this._linkedSeries.forEach((s => {
55
+ this._linkedItemMap[s.id] = s.getMarksWithoutRoot();
56
+ }));
45
57
  }
46
58
  created() {
47
59
  super.created(), this.initEvent(), this._bindRegions(), this._bindLinkedSeries(),
48
60
  this._initRegionAxisMap(), this._initAxisDataZoomMap(), this._initNeedOperatedItem();
49
61
  }
50
- _extendDataInBrush(elementsMap) {
51
- var _a, _b;
52
- const data = [];
53
- for (const brushName in elementsMap) for (const elementKey in elementsMap[brushName]) data.push(Object.assign({}, null === (_b = null === (_a = elementsMap[brushName][elementKey]) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0]));
54
- return data;
62
+ _bindRegions() {
63
+ isValid(this._spec.regionId) || isValid(this._spec.regionIndex) ? this._relativeRegions = this._option.getRegionsInUserIdOrIndex(array(this._spec.regionId), array(this._spec.regionIndex)) : this._relativeRegions = this._option.getAllRegions();
55
64
  }
56
- _extendDatumOutOfBrush(elementsMap) {
57
- var _a;
58
- const data = [];
59
- for (const elementKey in elementsMap) data.push(null === (_a = elementsMap[elementKey].data) || void 0 === _a ? void 0 : _a[0]);
60
- return data;
65
+ _bindLinkedSeries() {
66
+ (isValid(this._spec.brushLinkSeriesId) || isValid(this._spec.brushLinkSeriesIndex)) && (this._linkedSeries = this._option.getSeriesInUserIdOrIndex(array(this._spec.brushLinkSeriesId), array(this._spec.brushLinkSeriesIndex)));
61
67
  }
62
- _getBrushInteractiveAttr(region) {
63
- const regionLayoutPosition = region.getLayoutStartPoint(), regionLayoutRect = region.getLayoutRect(), seriesRegionStartX = regionLayoutPosition.x, seriesRegionEndX = seriesRegionStartX + regionLayoutRect.width, seriesRegionStartY = regionLayoutPosition.y, seriesRegionEndY = seriesRegionStartY + regionLayoutRect.height;
64
- return {
65
- interactiveRange: {
66
- minY: seriesRegionStartY,
67
- maxY: seriesRegionEndY,
68
- minX: seriesRegionStartX,
69
- maxX: seriesRegionEndX
70
- },
71
- xRange: [ seriesRegionStartX, seriesRegionEndX ],
72
- yRange: [ seriesRegionStartY, seriesRegionEndY ]
73
- };
68
+ _initRegionAxisMap() {
69
+ isValid(this._spec.axisId) ? array(this._spec.axisId).forEach((axisId => {
70
+ this._releatedAxes.push(this._option.getComponentByUserId(axisId));
71
+ })) : isValid(this._spec.axisIndex) ? array(this._spec.axisIndex).forEach((axisIndex => {
72
+ this._releatedAxes.push(this._option.getComponentByIndex("axes", axisIndex));
73
+ })) : this._releatedAxes = this._option.getComponentsByKey("axes"), this._releatedAxes.forEach((axis => {
74
+ null == axis || axis.getRegions().forEach((region => {
75
+ this._regionAxisMap["region_" + region.id] ? this._regionAxisMap["region_" + region.id].push(axis) : this._regionAxisMap["region_" + region.id] = [ axis ];
76
+ }));
77
+ }));
78
+ }
79
+ _initAxisDataZoomMap() {
80
+ this._option.getComponentsByKey("dataZoom").forEach((dz => {
81
+ dz.relatedAxisComponent && (this._axisDataZoomMap[dz.relatedAxisComponent.id] = dz);
82
+ }));
83
+ }
84
+ initEvent() {}
85
+ onRender(ctx) {}
86
+ changeRegions(regions) {}
87
+ _compareSpec(spec, prevSpec) {
88
+ this._brushComponents && this._relativeRegions.forEach(((region, index) => {
89
+ this._updateBrushComponent(region, index);
90
+ }));
91
+ const result = super._compareSpec(spec, prevSpec);
92
+ return isEqual(prevSpec, spec) || (result.reRender = !0, result.reMake = !0), result;
93
+ }
94
+ onLayoutEnd(ctx) {
95
+ var _a;
96
+ if (super.onLayoutEnd(ctx), this._option.disableTriggerEvent) return;
97
+ (null === (_a = this._spec.visible) || void 0 === _a || _a) && (this._brushComponents ? this._relativeRegions.forEach(((region, index) => {
98
+ this._updateBrushComponent(region, index);
99
+ })) : (this._brushComponents = [], this._relativeRegions.forEach(((region, index) => {
100
+ this._createBrushComponent(region, index);
101
+ }))));
74
102
  }
75
103
  _updateBrushComponent(region, componentIndex) {
76
104
  const interactiveAttr = this._getBrushInteractiveAttr(region), brushComponent = this._brushComponents[componentIndex];
77
105
  brushComponent.setAttributes(interactiveAttr), this._initMarkBrushState(componentIndex, ""),
78
- brushComponent.children[0].removeAllChild(), this._needInitOutState = !0;
106
+ brushComponent.children[0].removeAllChild();
79
107
  }
80
108
  _createBrushComponent(region, componentIndex) {
81
109
  var _a, _b;
@@ -86,43 +114,75 @@ export class Brush extends BaseComponent {
86
114
  disableTriggerEvent: this._option.disableTriggerEvent
87
115
  }));
88
116
  brush.id = null !== (_b = this._spec.id) && void 0 !== _b ? _b : `brush-${this.id}`,
89
- this.getContainer().add(brush);
90
- const {brushMode: brushMode = "single"} = this._spec;
91
- this._brushComponents.push(brush), this._cacheInteractiveRangeAttrs.push(interactiveAttr),
92
- brush.addEventListener(BrushEvent.drawStart, (e => {
117
+ this.getContainer().add(brush), this._brushComponents.push(brush), this._cacheInteractiveRangeAttrs.push(interactiveAttr),
118
+ brush.addEventListener(BrushEvent.brushActive, (e => {
119
+ this._initMarkBrushState(componentIndex, "outOfBrush"), this._emitEvent(ChartEvent.brushActive, region);
120
+ })), brush.addEventListener(BrushEvent.drawStart, (e => {
93
121
  this._emitEvent(ChartEvent.brushStart, region);
94
122
  })), brush.addEventListener(BrushEvent.moveStart, (e => {
95
123
  this._emitEvent(ChartEvent.brushStart, region);
96
124
  })), brush.addEventListener(BrushEvent.drawing, (e => {
97
- this._needInitOutState && "single" === brushMode && this._initMarkBrushState(componentIndex, "outOfBrush"),
98
- this._needInitOutState = !1, this._needDisablePickable = !0, this._handleBrushChange(ChartEvent.brushChange, region, e),
99
- this._emitEvent(ChartEvent.brushChange, region);
125
+ this._needDisablePickable = !0, this._handleBrushChange(region, e), this._emitEvent(ChartEvent.brushChange, region);
100
126
  })), brush.addEventListener(BrushEvent.moving, (e => {
101
- this._handleBrushChange(ChartEvent.brushChange, region, e), this._emitEvent(ChartEvent.brushChange, region);
127
+ this._handleBrushChange(region, e), this._emitEvent(ChartEvent.brushChange, region);
102
128
  })), brush.addEventListener(BrushEvent.brushClear, (e => {
103
- this._initMarkBrushState(componentIndex, ""), this._needInitOutState = !0, this._needDisablePickable = !1,
104
- this._handleBrushChange(ChartEvent.brushChange, region, e), this._handleBrushChange(ChartEvent.brushClear, region, e),
105
- this._emitEvent(ChartEvent.brushChange, region), this._emitEvent(ChartEvent.brushClear, region);
129
+ this._initMarkBrushState(componentIndex, ""), this._needDisablePickable = !1, this._emitEvent(ChartEvent.brushClear, region);
106
130
  })), brush.addEventListener(BrushEvent.drawEnd, (e => {
107
- this._needInitOutState = !0, this._needDisablePickable = !1;
131
+ var _a;
132
+ this._needDisablePickable = !1;
108
133
  const {operateMask: operateMask} = e.detail;
109
- this._handleBrushChange(ChartEvent.brushEnd, region, e);
110
- const inBrushData = this._extendDataInBrush(this._inBrushElementsMap);
111
- !this._spec.zoomWhenEmpty && inBrushData.length > 0 && this._setAxisAndDataZoom(operateMask, region),
112
- this._emitEvent(ChartEvent.brushEnd, region);
134
+ if (null === (_a = this._spec) || void 0 === _a ? void 0 : _a.onBrushEnd) !0 === this._spec.onBrushEnd(e) ? (this.clearGraphic(),
135
+ this._initMarkBrushState(componentIndex, ""), this._needDisablePickable = !1, this._emitEvent(ChartEvent.brushClear, region)) : (this._spec.onBrushEnd(e),
136
+ this._emitEvent(ChartEvent.brushEnd, region)); else {
137
+ const inBrushData = this._extendDataInBrush(this._inBrushElementsMap);
138
+ !this._spec.zoomWhenEmpty && inBrushData.length > 0 && this._setAxisAndDataZoom(operateMask, region),
139
+ this._emitEvent(ChartEvent.brushEnd, region);
140
+ }
113
141
  })), brush.addEventListener(BrushEvent.moveEnd, (e => {
114
- const {operateMask: operateMask} = e.detail;
115
- this._handleBrushChange(ChartEvent.brushEnd, region, e);
116
- const inBrushData = this._extendDataInBrush(this._inBrushElementsMap);
142
+ const {operateMask: operateMask} = e.detail, inBrushData = this._extendDataInBrush(this._inBrushElementsMap);
117
143
  !this._spec.zoomWhenEmpty && inBrushData.length > 0 && this._setAxisAndDataZoom(operateMask, region),
118
144
  this._emitEvent(ChartEvent.brushEnd, region);
119
145
  }));
120
146
  }
121
- _handleBrushChange(eventType, region, e) {
147
+ _getBrushInteractiveAttr(region) {
148
+ const regionLayoutPosition = region.getLayoutStartPoint(), regionLayoutRect = region.getLayoutRect(), seriesRegionStartX = regionLayoutPosition.x, seriesRegionEndX = seriesRegionStartX + regionLayoutRect.width, seriesRegionStartY = regionLayoutPosition.y, seriesRegionEndY = seriesRegionStartY + regionLayoutRect.height;
149
+ return {
150
+ interactiveRange: {
151
+ minY: seriesRegionStartY,
152
+ maxY: seriesRegionEndY,
153
+ minX: seriesRegionStartX,
154
+ maxX: seriesRegionEndX
155
+ },
156
+ xRange: [ seriesRegionStartX, seriesRegionEndX ],
157
+ yRange: [ seriesRegionStartY, seriesRegionEndY ]
158
+ };
159
+ }
160
+ _transformBrushedMarkAttr(brushedStyle) {
161
+ const styleResult = {};
162
+ return (null == brushedStyle ? void 0 : brushedStyle.symbol) && (styleResult.symbolType = brushedStyle.symbol),
163
+ (null == brushedStyle ? void 0 : brushedStyle.symbolSize) && (styleResult.size = brushedStyle.symbolSize),
164
+ (null == brushedStyle ? void 0 : brushedStyle.color) && (styleResult.fill = brushedStyle.color),
165
+ (null == brushedStyle ? void 0 : brushedStyle.colorAlpha) && (styleResult.fillOpacity = brushedStyle.colorAlpha),
166
+ Object.assign(Object.assign({}, transformToGraphic(brushedStyle)), styleResult);
167
+ }
168
+ _handleBrushChange(region, e) {
122
169
  const {operateMask: operateMask} = e.detail;
123
170
  this._reconfigItem(operateMask, region), this._reconfigLinkedItem(operateMask, region);
124
171
  }
172
+ _extendDataInBrush(elementsMap) {
173
+ var _a, _b;
174
+ const data = [];
175
+ for (const brushName in elementsMap) for (const elementKey in elementsMap[brushName]) data.push(Object.assign({}, null === (_b = null === (_a = elementsMap[brushName][elementKey]) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0]));
176
+ return data;
177
+ }
178
+ _extendDatumOutOfBrush(elementsMap) {
179
+ var _a;
180
+ const data = [];
181
+ for (const elementKey in elementsMap) data.push(null === (_a = elementsMap[elementKey].data) || void 0 === _a ? void 0 : _a[0]);
182
+ return data;
183
+ }
125
184
  _emitEvent(eventType, region) {
185
+ var _a;
126
186
  this.event.emit(eventType, {
127
187
  model: this,
128
188
  value: {
@@ -137,102 +197,113 @@ export class Brush extends BaseComponent {
137
197
  linkedInBrushElementsMap: this._linkedInBrushElementsMap,
138
198
  linkedOutOfBrushElementsMap: this._linkedOutOfBrushElementsMap,
139
199
  zoomRecord: this._zoomRecord
140
- }
200
+ },
201
+ vchart: null === (_a = this._option) || void 0 === _a ? void 0 : _a.globalInstance
141
202
  });
142
203
  }
143
- _transformBrushedMarkAttr(brushedStyle) {
144
- const styleResult = {};
145
- return (null == brushedStyle ? void 0 : brushedStyle.symbol) && (styleResult.symbolType = brushedStyle.symbol),
146
- (null == brushedStyle ? void 0 : brushedStyle.symbolSize) && (styleResult.size = brushedStyle.symbolSize),
147
- (null == brushedStyle ? void 0 : brushedStyle.color) && (styleResult.fill = brushedStyle.color),
148
- (null == brushedStyle ? void 0 : brushedStyle.colorAlpha) && (styleResult.fillOpacity = brushedStyle.colorAlpha),
149
- Object.assign(Object.assign({}, transformToGraphic(brushedStyle)), styleResult);
150
- }
151
204
  _reconfigItem(operateMask, region) {
205
+ var _a, _b, _c;
206
+ if (!(null == operateMask ? void 0 : operateMask.globalTransMatrix) || !(null === (_a = null == operateMask ? void 0 : operateMask.attribute) || void 0 === _a ? void 0 : _a.points)) return;
207
+ const points = null !== (_c = null === (_b = null == operateMask ? void 0 : operateMask.attribute) || void 0 === _b ? void 0 : _b.points) && void 0 !== _c ? _c : [], {a: a, b: b, c: c, d: d, e: e, f: f} = operateMask.globalTransMatrix, pointsCoord = points.map((p => ({
208
+ x: a * p.x + c * p.y + e,
209
+ y: b * p.x + d * p.y + f
210
+ }))), {markTypeFilter: markTypeFilter = []} = this._spec;
152
211
  this._itemMap[region.id].forEach((mark => {
212
+ if (markTypeFilter.includes(mark.type)) return;
153
213
  const grammarMark = mark.getProduct();
154
214
  if (!grammarMark || !grammarMark.elements || !grammarMark.elements.length) return;
155
215
  grammarMark.elements.forEach((el => {
156
216
  var _a, _b, _c;
157
- const graphicItem = el.getGraphicItem(), elementKey = mark.id + "_" + el.key;
158
- (null === (_a = this._outOfBrushElementsMap) || void 0 === _a ? void 0 : _a[elementKey]) && this._isBrushContainItem(operateMask, graphicItem) ? (el.addState("inBrush"),
217
+ const graphicItem = el.getGraphicItem(), elementKey = mark.id + "_" + el.key, isBrushContainItem = this._isBrushContainItem(operateMask.globalAABBBounds, pointsCoord, graphicItem);
218
+ (null === (_a = this._outOfBrushElementsMap) || void 0 === _a ? void 0 : _a[elementKey]) && isBrushContainItem ? (el.addState("inBrush"),
159
219
  this._inBrushElementsMap[null == operateMask ? void 0 : operateMask.name] || (this._inBrushElementsMap[null == operateMask ? void 0 : operateMask.name] = {}),
160
220
  this._inBrushElementsMap[null == operateMask ? void 0 : operateMask.name][elementKey] = el,
161
- delete this._outOfBrushElementsMap[elementKey]) : (null === (_c = null === (_b = this._inBrushElementsMap) || void 0 === _b ? void 0 : _b[null == operateMask ? void 0 : operateMask.name]) || void 0 === _c ? void 0 : _c[elementKey]) && !this._isBrushContainItem(operateMask, graphicItem) && (el.removeState("inBrush"),
221
+ delete this._outOfBrushElementsMap[elementKey]) : (null === (_c = null === (_b = this._inBrushElementsMap) || void 0 === _b ? void 0 : _b[null == operateMask ? void 0 : operateMask.name]) || void 0 === _c ? void 0 : _c[elementKey]) && !isBrushContainItem && (el.removeState("inBrush"),
162
222
  el.addState("outOfBrush"), this._outOfBrushElementsMap[elementKey] = el, delete this._inBrushElementsMap[operateMask.name][elementKey]),
163
223
  graphicItem.setAttribute("pickable", !this._needDisablePickable);
164
224
  }));
165
225
  }));
166
226
  }
167
227
  _reconfigLinkedItem(operateMask, region) {
228
+ var _a;
229
+ if (!(null == operateMask ? void 0 : operateMask.globalTransMatrix) || !(null === (_a = null == operateMask ? void 0 : operateMask.attribute) || void 0 === _a ? void 0 : _a.points)) return;
168
230
  const regionLayoutPos = region.getLayoutStartPoint(), seriesId = region.getSeries().map((s => s.id));
169
231
  this._linkedSeries.forEach((s => {
232
+ var _a, _b;
170
233
  if (!seriesId.includes(s.id)) {
171
- const sRegionLayoutPos = s.getRegion().getLayoutStartPoint(), regionOffsetX = sRegionLayoutPos.x - regionLayoutPos.x, regionOffsetY = sRegionLayoutPos.y - regionLayoutPos.y;
234
+ const sRegionLayoutPos = s.getRegion().getLayoutStartPoint(), regionOffsetX = sRegionLayoutPos.x - regionLayoutPos.x, regionOffsetY = sRegionLayoutPos.y - regionLayoutPos.y, points = null !== (_b = null === (_a = null == operateMask ? void 0 : operateMask.attribute) || void 0 === _a ? void 0 : _a.points) && void 0 !== _b ? _b : [], {a: a, b: b, c: c, d: d, e: e, f: f} = operateMask.globalTransMatrix, dx = regionOffsetX || 0, dy = regionOffsetY || 0, pointsCoord = points.map((p => ({
235
+ x: a * p.x + c * p.y + e + dx,
236
+ y: b * p.x + d * p.y + f + dy
237
+ })));
238
+ operateMask.globalAABBBounds.clone().set(operateMask.globalAABBBounds.x1 + dx, operateMask.globalAABBBounds.y1 + dy, operateMask.globalAABBBounds.x2 + dx, operateMask.globalAABBBounds.y2 + dy);
239
+ const {markTypeFilter: markTypeFilter = []} = this._spec;
172
240
  this._linkedItemMap[s.id].forEach((mark => {
241
+ if (markTypeFilter.includes(mark.type)) return;
173
242
  const grammarMark = mark.getProduct();
174
243
  if (!grammarMark || !grammarMark.elements || !grammarMark.elements.length) return;
175
244
  grammarMark.elements.forEach((el => {
176
245
  var _a, _b, _c;
177
246
  const graphicItem = el.getGraphicItem(), elementKey = mark.id + "_" + el.key;
178
- (null === (_a = this._linkedOutOfBrushElementsMap) || void 0 === _a ? void 0 : _a[elementKey]) && this._isBrushContainItem(operateMask, graphicItem, {
179
- dx: regionOffsetX,
180
- dy: regionOffsetY
181
- }) ? (el.addState("inBrush"), this._linkedInBrushElementsMap[null == operateMask ? void 0 : operateMask.name] || (this._linkedInBrushElementsMap[null == operateMask ? void 0 : operateMask.name] = {}),
247
+ (null === (_a = this._linkedOutOfBrushElementsMap) || void 0 === _a ? void 0 : _a[elementKey]) && this._isBrushContainItem(operateMask.globalAABBBounds, pointsCoord, graphicItem) ? (el.addState("inBrush"),
248
+ this._linkedInBrushElementsMap[null == operateMask ? void 0 : operateMask.name] || (this._linkedInBrushElementsMap[null == operateMask ? void 0 : operateMask.name] = {}),
182
249
  this._linkedInBrushElementsMap[null == operateMask ? void 0 : operateMask.name][elementKey] = el,
183
- delete this._linkedOutOfBrushElementsMap[elementKey]) : (null === (_c = null === (_b = this._linkedInBrushElementsMap) || void 0 === _b ? void 0 : _b[null == operateMask ? void 0 : operateMask.name]) || void 0 === _c ? void 0 : _c[elementKey]) && !this._isBrushContainItem(operateMask, graphicItem, {
184
- dx: regionOffsetX,
185
- dy: regionOffsetY
186
- }) && (el.removeState("inBrush"), el.addState("outOfBrush"), this._linkedOutOfBrushElementsMap[elementKey] = el),
250
+ delete this._linkedOutOfBrushElementsMap[elementKey]) : (null === (_c = null === (_b = this._linkedInBrushElementsMap) || void 0 === _b ? void 0 : _b[null == operateMask ? void 0 : operateMask.name]) || void 0 === _c ? void 0 : _c[elementKey]) && !this._isBrushContainItem(operateMask.globalAABBBounds, pointsCoord, graphicItem) && (el.removeState("inBrush"),
251
+ el.addState("outOfBrush"), this._linkedOutOfBrushElementsMap[elementKey] = el),
187
252
  graphicItem.setAttribute("pickable", !this._needDisablePickable);
188
253
  }));
189
254
  }));
190
255
  }
191
256
  }));
192
257
  }
193
- _isBrushContainItem(brushMask, item, linkedOffset) {
194
- var _a, _b, _c;
195
- if (!(null == brushMask ? void 0 : brushMask.globalTransMatrix) || !(null === (_a = null == brushMask ? void 0 : brushMask.attribute) || void 0 === _a ? void 0 : _a.points)) return !1;
196
- const points = null !== (_c = null === (_b = null == brushMask ? void 0 : brushMask.attribute) || void 0 === _b ? void 0 : _b.points) && void 0 !== _c ? _c : [], {a: a, b: b, c: c, d: d, e: e, f: f} = brushMask.globalTransMatrix, dx = (null == linkedOffset ? void 0 : linkedOffset.dx) || 0, dy = (null == linkedOffset ? void 0 : linkedOffset.dy) || 0, pointsCoord = points.map((p => ({
197
- x: a * p.x + c * p.y + e + dx,
198
- y: b * p.x + d * p.y + f + dy
199
- })));
200
- brushMask.globalAABBBounds.clone().set(brushMask.globalAABBBounds.x1 + dx, brushMask.globalAABBBounds.y1 + dy, brushMask.globalAABBBounds.x2 + dx, brushMask.globalAABBBounds.y2 + dy);
201
- const x = item.globalTransMatrix.e, y = item.globalTransMatrix.f;
258
+ _isBrushContainItem(brushMaskAABBBounds, brushMaskPointsCoord, item) {
202
259
  let itemBounds = [];
203
- if ("symbol" === item.type) {
204
- const {size: itemSize = 0} = null == item ? void 0 : item.attribute, size = array(itemSize)[0] / 2;
260
+ if ([ "symbol", "rect" ].includes(item.type)) {
261
+ const {x1: x1, x2: x2, y1: y1, y2: y2} = null == item ? void 0 : item.globalAABBBounds;
205
262
  return itemBounds = [ {
206
- x: x - size,
207
- y: y - size
263
+ x: x1,
264
+ y: y1
208
265
  }, {
209
- x: x + size,
210
- y: y - size
266
+ x: x2,
267
+ y: y1
211
268
  }, {
212
- x: x + size,
213
- y: y + size
269
+ x: x2,
270
+ y: y2
214
271
  }, {
215
- x: x - size,
216
- y: y + size
217
- } ], polygonIntersectPolygon(pointsCoord, itemBounds);
272
+ x: x1,
273
+ y: y2
274
+ } ], polygonIntersectPolygon(brushMaskPointsCoord, itemBounds);
218
275
  }
219
- if ("rect" === item.type) {
220
- const {x1: x1, x2: x2, y1: y1, y2: y2} = null == item ? void 0 : item.AABBBounds, width = Math.abs(x1 - x2), height = Math.abs(y1 - y2);
221
- return itemBounds = [ {
222
- x: x,
223
- y: y
224
- }, {
225
- x: x + width,
226
- y: y
227
- }, {
228
- x: x + width,
229
- y: y + height
230
- }, {
231
- x: x,
232
- y: y + height
233
- } ], polygonIntersectPolygon(pointsCoord, itemBounds);
234
- }
235
- return brushMask.globalAABBBounds.intersects(item.globalAABBBounds);
276
+ return brushMaskAABBBounds.intersects(item.globalAABBBounds);
277
+ }
278
+ _initMarkBrushState(componentIndex, stateName) {
279
+ this._brushComponents.forEach(((brush, index) => {
280
+ index !== componentIndex && brush.children[0].removeAllChild();
281
+ })), this._inBrushElementsMap = {}, this._outOfBrushElementsMap = {}, this._linkedInBrushElementsMap = {},
282
+ this._linkedOutOfBrushElementsMap = {};
283
+ const {markTypeFilter: markTypeFilter = []} = this._spec;
284
+ Object.entries(this._itemMap).forEach((([regionId, marks]) => {
285
+ marks.forEach((mark => {
286
+ if (markTypeFilter.includes(mark.type)) return;
287
+ const grammarMark = mark.getProduct();
288
+ if (!grammarMark || !grammarMark.elements || !grammarMark.elements.length) return;
289
+ grammarMark.elements.forEach((el => {
290
+ const elementKey = mark.id + "_" + el.key;
291
+ el.removeState("inBrush"), el.removeState("outOfBrush"), el.addState(stateName),
292
+ this._outOfBrushElementsMap[elementKey] = el;
293
+ }));
294
+ }));
295
+ })), Object.entries(this._linkedItemMap).forEach((([seriesId, marks]) => {
296
+ marks.forEach((mark => {
297
+ if (markTypeFilter.includes(mark.type)) return;
298
+ const grammarMark = mark.getProduct();
299
+ if (!grammarMark || !grammarMark.elements || !grammarMark.elements.length) return;
300
+ grammarMark.elements.forEach((el => {
301
+ const elementKey = mark.id + "_" + el.key;
302
+ el.removeState("inBrush"), el.removeState("outOfBrush"), el.addState(stateName),
303
+ this._linkedOutOfBrushElementsMap[elementKey] = el;
304
+ }));
305
+ }));
306
+ }));
236
307
  }
237
308
  _stateClamp(state) {
238
309
  return Math.min(Math.max(0, state), 1);
@@ -267,79 +338,9 @@ export class Brush extends BaseComponent {
267
338
  }));
268
339
  }
269
340
  }
270
- _bindRegions() {
271
- isValid(this._spec.regionId) && isValid(this._spec.regionIndex) && (this._relativeRegions = this._option.getAllRegions()),
272
- this._relativeRegions = this._option.getRegionsInUserIdOrIndex(array(this._spec.regionId), array(this._spec.regionIndex));
273
- }
274
- _bindLinkedSeries() {
275
- isValid(this._spec.brushLinkSeriesId) && isValid(this._spec.brushLinkSeriesIndex) || (this._linkedSeries = this._option.getSeriesInUserIdOrIndex(array(this._spec.brushLinkSeriesId), array(this._spec.brushLinkSeriesIndex)));
276
- }
277
- _initRegionAxisMap() {
278
- isValid(this._spec.axisId) ? array(this._spec.axisId).forEach((axisId => {
279
- this._releatedAxes.push(this._option.getComponentByUserId(axisId));
280
- })) : isValid(this._spec.axisIndex) ? array(this._spec.axisIndex).forEach((axisIndex => {
281
- this._releatedAxes.push(this._option.getComponentByIndex("axes", axisIndex));
282
- })) : this._releatedAxes = this._option.getComponentsByKey("axes"), this._releatedAxes.forEach((axis => {
283
- null == axis || axis.getRegions().forEach((region => {
284
- this._regionAxisMap["region_" + region.id] ? this._regionAxisMap["region_" + region.id].push(axis) : this._regionAxisMap["region_" + region.id] = [ axis ];
285
- }));
286
- }));
287
- }
288
- _initAxisDataZoomMap() {
289
- this._option.getComponentsByKey("dataZoom").forEach((dz => {
290
- dz.relatedAxisComponent && (this._axisDataZoomMap[dz.relatedAxisComponent.id] = dz);
291
- }));
292
- }
293
- _initNeedOperatedItem() {
294
- const seriesUserId = this._spec.seriesId, seriesIndex = this._spec.seriesIndex;
295
- this._relativeRegions.forEach((r => {
296
- const allMarks = [];
297
- r.getSeries().forEach((s => {
298
- (seriesUserId && array(seriesUserId).includes(s.userId.toString()) || seriesIndex && array(seriesIndex).includes(s.getSpecIndex()) || !seriesIndex && !seriesUserId) && allMarks.push(...s.getMarksWithoutRoot()),
299
- this._itemMap[r.id] = allMarks;
300
- }));
301
- })), this._linkedSeries.forEach((s => {
302
- this._linkedItemMap[s.id] = s.getMarksWithoutRoot();
303
- }));
304
- }
305
- _initMarkBrushState(componentIndex, stateName) {
306
- this._brushComponents.forEach(((brush, index) => {
307
- index !== componentIndex && brush.children[0].removeAllChild();
308
- })), this._inBrushElementsMap = {}, this._outOfBrushElementsMap = {}, this._linkedInBrushElementsMap = {},
309
- this._linkedOutOfBrushElementsMap = {}, this._option.getAllSeries().forEach((s => {
310
- s.getMarksWithoutRoot().forEach((mark => {
311
- const grammarMark = mark.getProduct();
312
- if (!grammarMark || !grammarMark.elements || !grammarMark.elements.length) return;
313
- grammarMark.elements.forEach((el => {
314
- const elementKey = mark.id + "_" + el.key;
315
- el.removeState("inBrush"), el.removeState("outOfBrush"), el.addState(stateName),
316
- this._outOfBrushElementsMap[elementKey] = el, this._linkedOutOfBrushElementsMap[elementKey] = el;
317
- }));
318
- }));
319
- }));
320
- }
321
- initEvent() {}
322
- onRender(ctx) {}
323
- changeRegions(regions) {}
324
341
  _getNeedClearVRenderComponents() {
325
342
  return this._brushComponents;
326
343
  }
327
- _compareSpec(spec, prevSpec) {
328
- this._brushComponents && this._relativeRegions.forEach(((region, index) => {
329
- this._updateBrushComponent(region, index);
330
- }));
331
- const result = super._compareSpec(spec, prevSpec);
332
- return isEqual(prevSpec, spec) || (result.reRender = !0, result.reMake = !0), result;
333
- }
334
- onLayoutEnd(ctx) {
335
- var _a;
336
- if (super.onLayoutEnd(ctx), this._option.disableTriggerEvent) return;
337
- (null === (_a = this._spec.visible) || void 0 === _a || _a) && (this._brushComponents ? this._relativeRegions.forEach(((region, index) => {
338
- this._updateBrushComponent(region, index);
339
- })) : (this._brushComponents = [], this._relativeRegions.forEach(((region, index) => {
340
- this._createBrushComponent(region, index);
341
- }))));
342
- }
343
344
  clearGraphic() {
344
345
  this._brushComponents && this._brushComponents.forEach((brush => {
345
346
  brush._container.incrementalClearChild();
@@ -348,8 +349,9 @@ export class Brush extends BaseComponent {
348
349
  clear() {
349
350
  if (this._brushComponents) {
350
351
  const container = this.getContainer();
351
- this._brushComponents.forEach((brush => {
352
- brush.removeAllChild(), brush.releaseBrushEvents(), container && container.removeChild(brush);
352
+ this._brushComponents.forEach(((brush, index) => {
353
+ this._initMarkBrushState(index, ""), this._needDisablePickable = !1, brush.removeAllChild(),
354
+ brush.releaseBrushEvents(), container && container.removeChild(brush);
353
355
  })), this._brushComponents = null;
354
356
  }
355
357
  }