From e8238a23f485c4a0e2858f1a6979f6cea2560c4a Mon Sep 17 00:00:00 2001 From: Adityakashyap1011 Date: Fri, 14 Nov 2025 12:18:39 +0530 Subject: [PATCH] fix: opacity level while data point selection -feat: added the multiple selection without use of prolong mouse down event --- src/component/brush/BrushModel.ts | 2 +- src/component/toolbox/feature/Brush.ts | 6 +- test/brush-feature-test.html | 117 +++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 5 deletions(-) create mode 100644 test/brush-feature-test.html diff --git a/src/component/brush/BrushModel.ts b/src/component/brush/BrushModel.ts index 4bf87b566c..15e1a452d7 100644 --- a/src/component/brush/BrushModel.ts +++ b/src/component/brush/BrushModel.ts @@ -136,7 +136,7 @@ class BrushModel extends ComponentModel { static defaultOption: BrushOption = { seriesIndex: 'all', brushType: 'rect', - brushMode: 'single', + brushMode: 'multiple', transformable: true, brushStyle: { borderWidth: 1, diff --git a/src/component/toolbox/feature/Brush.ts b/src/component/toolbox/feature/Brush.ts index 7c4b7f2fab..e6198be134 100644 --- a/src/component/toolbox/feature/Brush.ts +++ b/src/component/toolbox/feature/Brush.ts @@ -54,7 +54,7 @@ class BrushFeature extends ToolboxFeature { ecModel.eachComponent({mainType: 'brush'}, function (brushModel: BrushModel) { brushType = brushModel.brushType; - brushMode = brushModel.brushOption.brushMode || 'single'; + brushMode = brushModel.brushOption.brushMode || 'multiple'; isBrushed = isBrushed || !!brushModel.areas.length; }); this._brushType = brushType; @@ -120,9 +120,7 @@ class BrushFeature extends ToolboxFeature { brushType: type === 'keep' ? brushType : (brushType === type ? false : type), - brushMode: type === 'keep' - ? (brushMode === 'multiple' ? 'single' : 'multiple') - : brushMode + brushMode: 'multiple' } }); } diff --git a/test/brush-feature-test.html b/test/brush-feature-test.html new file mode 100644 index 0000000000..5672788fb7 --- /dev/null +++ b/test/brush-feature-test.html @@ -0,0 +1,117 @@ + + + + + Brush Feature Test + + + + +

ECharts Brush Feature Test

+ +
+

Test Instructions:

+
    +
  1. Click "box" selection in toolbox
  2. +
  3. Draw first selection box - should be visible
  4. +
  5. Draw second selection box - first box should STILL be visible
  6. +
  7. Check opacity: selected points should be brighter, unselected dimmer
  8. +
  9. Click "clear" to remove all selections
  10. +
+
+ +
+ +
+

Test Results:

+
+
+ + + +